I'm trying to build a simple LED blinking program for an 8051 based project. I made a small crtstart.asm that looks like...
.area GSINIT0 (CODE)
mov sp,#__start__stack - 1
.area GSINIT2 (CODE)
and main.c is...
P0 = 0;
P0DIR = 0;
P0 ^= 0xFF;
for(i=0; i<0xFF00; ++i);
If I build like this...
sdcc --no-xinit-opt --main-return --iram-size 0x80 --std-c99 crtstart.rel main.c
...I get a properly flashing LED. However, if I do this...
sdcc -c --no-xinit-opt --main-return --iram-size 0x80 --std-c99 main.c
sdcc --no-xinit-opt --main-return --iram-size 0x80 --std-c99 crtstart.rel main.rel
...I get a HEX file that doesn't work. What am I doing wrong?
Looks like I didn't read the manual...
"The file containing the main() function MUST be the FIRST file specified in the command line, since the linkage editor processes file in the order they are presented to it."
Listing main.rel first seems to have fixed the problem.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.