GCC Linker undefined reference to '_data_start'

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
meatball
Posts: 32
Joined: Thu May 19, 2016 4:39 pm
Has thanked: 9 times
Been thanked: 2 times

GCC Linker undefined reference to '_data_start'

Post 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.
Attachments
linker errors.PNG
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: GCC Linker undefined reference to '_data_start'

Post 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
Post Reply