Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toolchain update #420

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ndless-sdk/libsyscalls/stdlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,12 @@ clock_t _times(struct tms *ptms)
return 0;
}

int _getentropy (void *, size_t)
{
errno = ENOSYS;
return -1;
}

// Miscellaneous
void *__dso_handle __attribute__((weak));
void __sync_synchronize(){}
Expand Down
18 changes: 14 additions & 4 deletions ndless-sdk/samples/zehn/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,27 @@

using namespace std;

// Test global object construcion and order.
// This should work both with -fuse-cxa-atexit (the default)
// and -fno-use-cxa-atexit.
template <int i>
class Test
{
public:
Test() { cout << "Test();" << endl; }
~Test() { cout << "~Test();" << endl; }
Test() { cout << "Test(" << i << ")" << endl; }
~Test() {
cout << "~Test(" << i << ")" << endl;
if (i == 1000) // Should be last
wait_key_pressed();
}

void doSomething() { cout << "Doing something!" << endl; }
};

//Test global variables + initialization
static Test test;
static __attribute__ ((init_priority (1000))) Test<1000> t1000;
static __attribute__ ((init_priority (1001))) Test<1001> t1001;
// No init_priority is means higher than any init_priority
static Test<1024> test;

int main()
{
Expand Down
2 changes: 1 addition & 1 deletion ndless-sdk/system/crti.S
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* For C++ support */

.section .init_array
.section .init_array.0
__cpp_init: .global __cpp_init
push {r0, r1, r4, r5, lr}
adr r4,ctors
Expand Down
2 changes: 1 addition & 1 deletion ndless-sdk/system/crtn.S
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ exit: .weak exit /* If linked without newlib, used by crt0. Can't be defined in
.section .init_array
.long -1 /* Terminating character for ctor list */

.section .fini_array
.section .fini_array.0
.long -1
11 changes: 9 additions & 2 deletions ndless-sdk/system/ldscript
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
ENTRY(_start)

PHDRS {
text PT_LOAD;
data PT_LOAD;
}

SECTIONS {
.text 0x0 : {
_start = .;
*(.text)
KEEP(*(.text.crtn))
KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*)))
KEEP(*(.init_array))
KEEP(*(.fini_array))
KEEP(*(SORT_BY_INIT_PRIORITY(REVERSE(.fini_array.*))))
*(.text.*)
}
} :text

.got : {
*(.got.plt*)
*(.got)
LONG(0xFFFFFFFF)
}
} :data

.data : {
*(.rodata*)
Expand Down
2 changes: 1 addition & 1 deletion ndless-sdk/thirdparty/nspire-io
10 changes: 5 additions & 5 deletions ndless-sdk/toolchain/build_toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ PREFIX="${PWD}/install" # or the directory where the toolchain should be install
PARALLEL="${PARALLEL--j4}" # or "-j<number of build jobs>"
PYTHON="${PYTHON-$(which python3 2>/dev/null)}" # or the full path to the python interpreter

BINUTILS=binutils-2.38 # https://www.gnu.org/software/binutils/
GCC=gcc-11.2.0 # https://gcc.gnu.org/
NEWLIB=newlib-4.1.0 # https://sourceware.org/newlib/
GDB=gdb-11.2 # https://www.gnu.org/software/gdb/
BINUTILS=binutils-2.42 # https://www.gnu.org/software/binutils/
GCC=gcc-14.1.0 # https://gcc.gnu.org/
NEWLIB=newlib-4.4.0.20231231 # https://sourceware.org/newlib/
GDB=gdb-14.2 # https://www.gnu.org/software/gdb/

# For newlib
export CFLAGS_FOR_TARGET="-DHAVE_RENAME -DMALLOC_PROVIDED -DABORT_PROVIDED -DNO_FORK -mcpu=arm926ej-s -ffunction-sections -O3"
Expand All @@ -31,7 +31,7 @@ export PATH="${PREFIX}/bin:${PATH}"

OPTIONS_BINUTILS="--target=${TARGET} --prefix=${PREFIX} --enable-interwork --enable-multilib --with-system-zlib --with-gnu-as --with-gnu-ld --disable-nls --with-float=soft --disable-werror"
OPTIONS_GCC="--target=${TARGET} --prefix=${PREFIX} --enable-interwork --enable-multilib --enable-languages=c,c++ --with-system-zlib --with-newlib --disable-threads --disable-tls --disable-shared --with-gnu-as --with-gnu-ld --with-float=soft --disable-werror --disable-libstdcxx-verbose"
OPTIONS_NEWLIB="--target=${TARGET} --prefix=${PREFIX} --enable-interwork --enable-multilib --with-gnu-as --with-gnu-ld --enable-newlib-io-long-long --disable-newlib-may-supply-syscalls --disable-newlib-supplied-syscalls --with-float=soft --disable-werror --disable-nls --enable-newlib-io-float"
OPTIONS_NEWLIB="--target=${TARGET} --prefix=${PREFIX} --enable-interwork --enable-multilib --with-gnu-as --with-gnu-ld --enable-newlib-io-long-long --disable-newlib-may-supply-syscalls --disable-newlib-supplied-syscalls --with-float=soft --disable-werror --disable-nls --enable-newlib-io-float --enable-newlib-reent-binary-compat"
OPTIONS_GDB="--target=${TARGET} --prefix=${PREFIX} --enable-interwork --enable-multilib --disable-werror"

if [ -n "${PYTHON}" ]; then
Expand Down
Loading