We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I've got a program getting the startup code to locate in the proper place because its being displaced by the C Lib module Here's a mapfile snippet
* * * * * * * * * * * C O D E M E M O R Y * * * * * * * * * * * * * 000000H 000002H 000003H BYTE OFFS.. CODE ?C_CPURESET?0 000003H 000022H 000020H --- --- **GAP** 000023H 000025H 000003H BYTE OFFS.. CODE ?SYS_SERIAL0?00023 000026H 003FFFH 003FDAH --- --- **GAP** 004000H 004176H 000177H BYTE UNIT CODE ?C?LIB_CODE 004177H 0042A9H 000133H BYTE UNIT CODE ?C_C51STARTUP 0042AAH 0042BEH 000015H BYTE UNIT CODE ?C_INITSEG
BASE START END USED MEMORY CLASS ========================================================== X:000000H X:00A000H X:00FFFFH 00078BH XDATA X:000000H X:020000H X:03FFFEH 000401H HDATA C:000000H C:004000H C:009FFFH 0002C5H CODE C:000000H C:010000H C:01FFFFH 0007C1H ECODE C:000000H C:004000H C:00DFFFH HCONST I:000000H I:000000H I:0000FFH 000001H IDATA I:000000H I:000000H I:00007FH 000018H DATA
Why should 0x4000 be the only proper address for the startup code? It really shouldn't matter where it goes, as long as the reset vector at 0x0000 is set correctly, which I'm quite sure the linker will manage to do regardless of where the startup code ends up. And BTW, startup.a51 isn't really "auto-generated", it's written by hand by Keil people, and then either the source is copied into your project, or a compiled version of the master copy itself automatically added to the link.
Why should 0x4000 be the only proper address for the startup code? It really shouldn't matter where it goes, as long as the reset vector at 0x0000 is set correctly, which I'm quite sure the linker will manage to do regardless of where the startup code ends up. I realised that after posting. The 'reason' (if it can be called that) is I'm moving across from SDCC to Keil and just been keeping with the same settings. It doesn't need to be that high but with the DS80C400 part of the ROM startup writes over the lower part of the RAM (certainly the interrupt vector table) and so you have to leave a gap. Anyway we've managed to get that part working, just got the TINI ROM interface function to go, having problems getting the parameters off of the stack and setting up the return values. Thanks for your help.
Use CODE(0x4000,?C_CSTARTUP) for the linker. This specifies that the CODE area starts at 0x4000 and that the first code segment should be ?C_CSTARTUP. Jon