I'm porting code written from mspgcc 4.6.3 into a CCS 6.0.1 project with TI mspgcc 4.9.1.
MSP430FR59xx is the MCU type.
When linking the symbol _end (as I can read from the code it is the start of RAM + sizeof(data) + sizeof(bss) ) is undefined:
./cpu/msp430-common/msp430-main.o:(.data+0x0): undefined reference to `_end' collect2.exe: error: ld returned 1 exit status
What symbol name instead of _end I have to use for gcc 4.9.1?
below the code snippet:
extern int _end; /* Not in sys/unistd.h */ static char *cur_break = (char *) &_end; #define asmv(arg) __asm__ __volatile__(arg) #define STACK_EXTRA 32 /* * Allocate memory from the heap. Check that we don't collide with the * stack right now (some other routine might later). A watchdog might * be used to check if cur_break and the stack pointer meet during * runtime. */ void *sbrk(int incr) { char *stack_pointer; asmv("mov r1, %0" : "=r"(stack_pointer)); stack_pointer -= STACK_EXTRA; if (incr > (stack_pointer - cur_break)) { return (void *) - 1; /* ENOMEM */ } void *old_break = cur_break; cur_break += incr; /* * If the stack was never here then [old_break .. cur_break] should * be filled with zeros. */ return old_break; }
Greetings
Attilio