Hey there, Simply, i tried to use symbols from Keil's linker script but keil outputs "identifier __bss_end__ is undefined"
I found many symbols defined in gcc_arm.ld file and i want to use one of them within other files (C or Assembly). Can anyone tell what makes me use these symbols within other source codes ???
/* A simple C code */ void init(void) { char *ptr = &__bss_end__; }
/* Linker script to configure memory regions. */ MEMORY { FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x40000 /* 256k */ RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x08000 /* 32k */ } /* Library configurations */ GROUP(libgcc.a libc.a libm.a libnosys.a) /* Linker script to place sections and symbol values. Should be used together * with other linker script that defines memory regions FLASH and RAM. * It references following symbols, which must be defined in code: * Reset_Handler : Entry of reset handler * * It defines following symbols, which code can use without definition: * __exidx_start * __exidx_end * __copy_table_start__ * __copy_table_end__ * __zero_table_start__ * __zero_table_end__ * __etext * __data_start__ * __preinit_array_start * __preinit_array_end * __init_array_start * __init_array_end * __fini_array_start * __fini_array_end * __data_end__ * __bss_start__ * __bss_end__ * __end__ * end * __HeapLimit * __StackLimit * __StackTop * __stack */ ENTRY(Reset_Handler)
Are you using the Keil compilers/linkers, or the GNU/GCC ones? Keil has it's own symbols generated by the Linker describing the statics and assorted structures. A review of the .MAP file might provide some insight, and the objects and executable images can be inspected with FromELF. Review how they are imported/used in GNU startup.s files?
extern void * __Vectors; // Importing address exported in startup.s
NVIC_SetVectorTable((u32)(&__Vectors), 0x0); // Smart Base Location
Here: www.keil.com/.../armclang_link_pge1362065957713.htm