GNU ARM error undefined __START

Asked by James Geering

Hi All,
I am having problems compiling your minimum.c example within NetBeans 7.3 under Mac OS X. I down loaded the toolchain gcc-arm-none-eabi-4_7-2013q2 and manage to compile the example on the command line.

However, I cannot reproduce successful results with NetBeans after correctly installing the toolchain into the IDE. I have used the same compiler/linker options and receive the following compiler output:

arm-none-eabi-gcc -c -g -D__STARTUP_CLEAR_BSS -D__START=main -mthumb -mcpu=cortex-m0plus -Os -MMD -MP -MF build/Debug/GNU_ARM-MacOSX/main.o.d -o build/Debug/GNU_ARM-MacOSX/main.o main.c
mkdir -p build/Debug/GNU_ARM-MacOSX
arm-none-eabi-as -g -o build/Debug/GNU_ARM-MacOSX/startup_ARMCM0.o startup_ARMCM0.S
mkdir -p dist/Debug/GNU_ARM-MacOSX
arm-none-eabi-gcc -o dist/Debug/GNU_ARM-MacOSX/cppapplication_3 build/Debug/GNU_ARM-MacOSX/main.o build/Debug/GNU_ARM-MacOSX/startup_ARMCM0.o -flto -ffunction-sections -fdata-sections --specs=nano.specs -lc -lc -lnosys -L. -L.//ldscripts -T mem.ld -T sections-nokeep.ld -Wl,--gc-sections -Wl,-Map=main.map
build/Debug/GNU_ARM-MacOSX/startup_ARMCM0.o: In function `Reset_Handler':
/Users/james/workups/Practice/CppApplication_3/startup_ARMCM0.S:151: undefined reference to `__START'
collect2: error: ld returned 1 exit status

Try as I may I cannot get the compiler to recognise the defined __START=main.

I would greatly appreciate any insights into what I am doing wrong.
Many thanks,
James

Question information

Language:
English Edit question
Status:
Solved
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Solved by:
James Geering
Solved:
Last query:
Last reply:
Revision history for this message
Terry Guo (terry.guo) said :
#1

Hi James,

Since I haven't your project, I can only guess from what you showed. I am suspecting below things:

1). The .S file doesn't equal .s file. It needs preprocess to handle macros. I would compile them with arm-none-eabi-gcc rather than arm-none-eabi-as.

2). The last command is used to link objects together. But the target options are not provided. I would add "-mthumb -mcpu=cortex-m0plus" there.

Revision history for this message
James Geering (j-geering) said :
#2

Hi Terry,

Ah I see what your saying; I think I'll start the project again from scratch and have another play this evening, I'll let you know what I see...

Thank you,
James

Revision history for this message
James Geering (j-geering) said :
#3

Hi Terry,

Your comments gave me enough to get it working, in summary I entered the following into the GUI IDE

Preprocessor Definitions:
__STARTUP_CLEAR_BSS __START=main

Additional C compiler options (arm-none-eabi-gcc)
-Os

Additinonal Assembler options (arm-none-eabi-as)
-mthumb -mcpu=cortex-m0

Additional Linker options (arm-none-eabi-gcc)
-flto -ffunction-sections -fdata-sections --specs=nano.specs
-lc -lc -lnosys -T mem.ld -T sections-nokeep.ld
-Wl,--gc-sections -Wl,-Map=main.map -o main-CMO.axf

and crucialy I entered the additionl library "startup_ARMCM0.S"
also into the linker. Before I had this as a source file and
as you rightly pointed out I was confusing this with a
.asm assembly file.

The project was simply the minimum example include in the GNU ARM tool chain collection but built in the GUI!

It now compiles fine; thanks for your very quick reply.

James