Page 1 of 1

GCC Linker undefined reference to '_data_start'

Posted: Tue Dec 13, 2016 5:12 pm
by meatball
I'm very nearly done with my Embitz(GCC compiler) / ChibiOS project template setup for the F4, and compilation is going well at this time.

Linking is not going as well, as the startup file (crt0_v7m.s) is making use of symbols that the linker can't find.

\ChibiOS_16.1.4\os\common\ports\ARMCMx\compilers\GCC/crt0_v7m.s:253: undefined reference to `_textdata_start'
\ChibiOS_16.1.4\os\common\ports\ARMCMx\compilers\GCC/crt0_v7m.s:254: undefined reference to `_data_start'
\ChibiOS_16.1.4\os\common\ports\ARMCMx\compilers\GCC/crt0_v7m.s:255: undefined reference to `_data_end'

appear as errors and

\os\common\ports\armcmx\compilers\gcc\crt1.o:(.rodata.ram_areas+0x0): undefined reference to `__ram0_init_text__'
\os\common\ports\armcmx\compilers\gcc\crt1.o:(.rodata.ram_areas+0x4): undefined reference to `__ram0_init__'
\os\common\ports\armcmx\compilers\gcc\crt1.o:(.rodata.ram_areas+0x8): undefined reference to `__ram0_clear__'
\os\common\ports\armcmx\compilers\gcc\crt1.o:(.rodata.ram_areas+0xc): undefined reference to `__ram0_noinit__'
\os\common\ports\armcmx\compilers\gcc\crt1.o:(.rodata.ram_areas+0x10): undefined reference to `__ram1_init_text__'

+ all other ram sections 1-7 appear as warnings.

The only other references to `_textdata_start', `_data_start', and `_data_end' are in the rules.ld linker script, but they do not appear to be declarations.

These symbols are resolved (although are under different names) in a CHibiOS 3 project I have running already.

Am I missing a file in my project? Or do I need to tell GCC something more about the dependencies here? Any ideas? Thanks!

See the attached for full build log.

Re: GCC Linker undefined reference to '_data_start'

Posted: Tue Dec 13, 2016 7:15 pm
by Giovanni
Hi,

If you use the ChibiOS-provided startup files then you need to use also the provided .ld files, see inside a Makefile for details. The IDE should have a setting somewhere for custom .ld files.

ChibiOS .ld files support multiple RAM/flash areas, automatic heap sizing and other specific features.

Giovanni