[En-Nut-Discussion] Compiler problem

Harald Kipp harald.kipp at egnite.de
Tue Aug 2 20:30:15 CEST 2005


Hi Julien,

almost all Nut/OS applications include one of the
header files, which in turn include compiler.h.

compiler.h includes arch/avr.h (or arch/arm.h for the ARM).
This one contains
#define main    NutAppMain
for the GCC compiler.

If your source file with main() doesn't include any of
them, NutAppMain() will be undefined.

The reason for this ugly hack is, that ugly GCC modifies the
stack pointer when entering main().

Harald

At 16:41 01.08.2005 +0200, you wrote:
>Hi everybody,
>When I want to compile a C file, i''ve got this response from the 
>compiler( and I really don't know why):
>
> > "make.exe" all
>avr-gcc douch_aff_ok.o -mmcu=atmega128 
>-Wl,--defsym=main=0,-Map=douch_aff_ok.map,--cref 
>-LC:/ethernut-3.9.7/nutbld/lib  C:/ethernut-3.9.7/nutbld/lib/nutinit.o 
>-lnutdev -lnutnet -lnutpro -lnutnet -lnutfs -lnutos -lnutdev -lnutcrt 
>-lnutos  -o douch_aff_ok.elf
>C:/ethernut-3.9.7/nutbld/lib/nutinit.o(.text+0x12): In function `NutIdle':
>: undefined reference to `NutAppMain'
>C:/ethernut-3.9.7/nutbld/lib/nutinit.o(.text+0x14): In function `NutIdle':
>: undefined reference to `NutAppMain'
>make.exe: *** [douch_aff_ok.elf] Error 1
>
> > Process Exit Code: 2
>
>Thanks a lot for your help.




More information about the En-Nut-Discussion mailing list