8BIT wrote:
The __STARTUP__ label originates in the crt0.s source file for your target. You get crt0.o after it's compiled and you include this as the FIRST file in your linker chain. I usually rename the crt0.o file to match my target, i.e. for my sbc4 target, it becomes sbc4.o.
I too use windows batch files. here's an example from one of my demo's:
Code:
set CC65LIB=c:\cc65\lib
cl65 -t none -C sbc4.cfg -o hello.65b -m hello.map -l %CC65LIB%\sbc4.o hello.s %CC65LIB%\sbc4.lib
del *.o /Q >nul
pause
where sbc4.cfg is the config file for my target, hello.65b is the executable object file, hello.map is a reference map file (not needed), sbc4.o is the crt0.o file, hello.s is the source of the program being executed, and sbc4.lib is the library file for my target.
hope that helps!
Daryl
Hey Daryl, thanks for the quick reply, but I still have issues/questions
I sort of understand what you mean, however my compiler isn't generating a crt0.s file for me. It might help if I show you how everything is structured:
In my directory, I have a file called kmain.c. This will be (hopefully) the main Kernel File for my OS. I then have a .cfg which consists of the following:
Code:
MEMORY {
RAM1: start = $0200, size = $7F00;
ROM1: start = $C000, size = $4000, fill = yes;
}
SEGMENTS {
CODE: load = ROM1, type = ro;
DATA: load = ROM1, type = ro;
}
This is a config file that is specific to Symon so everything is aligned correctly.
My kmain.c consists of the basic:
Code:
int main()
{
return 0;
}
My build process consists of:
Code:
SET PATH=%CC65_BIN%
REM COMPILE ALL C CODE IN .S FILES, BEFORE WE COMPILE AND THEN LINK THEM INTO A 16KB ALIGNED ROM
cc65 kmain.c -t none -Osir --cpu 6502
cl65 kmain.s -t none -C kern.cfg -o kern.bin
pause
However, during the linking stage, ld65 complains that:
Unresolved external `__STARTUP__' referenced in:
ld65: Error: 1 unresolved external(s) found - cannot create output fileOn further inspection of my kmain.s file, I found this,
Code:
.forceimport __STARTUP__
which I'm assuming is the cause of my trouble.
Seeing as there is no __STARTUP__ referenced ANYWHERE in my code, I'm still unsure how to resolve this.
Sorry for the lengthy post hahaha
-Quaker762
EDIT: Wait, is crt0.s meant to act as a bootloader?