diff --git a/cpu/msp430-common/cpu.c b/cpu/msp430-common/cpu.c index f8c4426b9637..6e48595dc3b3 100644 --- a/cpu/msp430-common/cpu.c +++ b/cpu/msp430-common/cpu.c @@ -50,6 +50,7 @@ NORETURN void cpu_switch_context_exit(void) UNREACHABLE(); } +#if !(MODULE_NEWLIB) /** * mspgcc handles main specially - it does not return but falls * through to section .fini9. @@ -57,6 +58,7 @@ NORETURN void cpu_switch_context_exit(void) * behave like a regular function. This enables a common * thread_stack_init behavior. */ __attribute__((section (".fini9"))) void __main_epilogue(void) { __asm__("ret"); } +#endif //---------------------------------------------------------------------------- // Processor specific routine - here for MSP diff --git a/cpu/msp430-common/msp430-main.c b/cpu/msp430-common/msp430-main.c index 341de7d5c021..b69eb5f2e0ce 100644 --- a/cpu/msp430-common/msp430-main.c +++ b/cpu/msp430-common/msp430-main.c @@ -104,9 +104,11 @@ init_ports(void) } /*---------------------------------------------------------------------------*/ +#if !(MODULE_NEWLIB) /* msp430-ld may align _end incorrectly. Workaround in cpu_init. */ extern int _end; /* Not in sys/unistd.h */ static char *cur_break = (char *) &_end; +#endif void msp430_cpu_init(void) { @@ -115,15 +117,18 @@ void msp430_cpu_init(void) // lpm_init(); irq_enable(); +#if !(MODULE_NEWLIB) if ((uintptr_t)cur_break & 1) { /* Workaround for msp430-ld bug!*/ cur_break++; } +#endif } /*---------------------------------------------------------------------------*/ #define asmv(arg) __asm__ __volatile__(arg) -#define STACK_EXTRA 32 +#if !(MODULE_NEWLIB) +#define STACK_EXTRA 32 /* * Allocate memory from the heap. Check that we don't collide with the @@ -150,6 +155,7 @@ void *sbrk(int incr) */ return old_break; } +#endif /*---------------------------------------------------------------------------*/ /* * Mask all interrupts that can be masked.