I'm using the uVison 1 and I'd like to build my project. My example project should include the CSTARTUP.OBJ and some compiled C files There is two methods : 1. with IDE 2. with command line For both, I've some troubles, may someone help me ? 1.With IDE ---------- When linking a project with more than one function, the main function is no longer located to 0000h. So I d'like to include the CSTARTUP file where I wrote :
NAME ?C_STARTUP ?C_C51STARTUP SEGMENT CODE ?STACK SEGMENT IDATA RSEG ?STACK DS 1 EXTRN CODE (main) PUBLIC ?C_STARTUP CSEG AT 0 ?C_STARTUP: LJMP main
C:\TRX8051\CSTARTUP.OBJ, & C:\TRX8051\MAIN.OBJ, & C:\TRX8051\HLCD.OBJ, & C:\TRX8051\INIT.OBJ, & C:\TRX8051\RREX.OBJ & TO C:\TRX8051\TRX8051 & IX NODS NODP NODL NLIB RS(128) PL (68) PW(78)
main() should never be located at 0x0000. 0x0000 is the reset vector. main() cannot be called until the C run-time has executed. Typically the C run-time copies the .data section variables from ROM to RAM, zeroes the .bss section, sets the stack pointer and any other CPU registers appropriately, and *then* calls main(). Since the C run-time must run before main() it follows that it should be located at 0x0000 and main() just goes where ever it goes. The Keil C run-time is automatically linked against so it should be there. If you wish, you can override it or see what it does by looking at cstartup.a51.
But I didn't found in the options of the IDE uVision 1 how to include the CSTARTUP.OBJ in my linking commands and how specify where it should be located ??? You are already doing it by saying:
CSEG AT 0 ?C_STARTUP: LJMP main
code(?PR?MAIN?MY_FILE_NAME(0x100))