I'd like to reposition my code so all code starts at 0800h. The only things I want below that are the startup vector and interrupt vectors. Am I right in assuming that the vector at locn 0000 (actually an LJMP address) cannot be relocated as this is the start point after a reset? Is it also true that the interrupt vectors are similarly fixed? Using uVision.
Thanks for all the comments. I have so far not got the code relocated and all vectors produced in zero page. I have changed the CSEG AT 0 in STARTUP.A51 to CSEG AT 1000h. Also set the Code Address in the linker to $1000. This produces the correct interrupt vectors in zero page pointing within code that starts at $1000. BUT the reset vector is at $1000 and points to code at $1003. It is not placed in zero page! How do I achieve this?
I have tried this from the Knowledgebase http://www.keil.com/support/docs/76.htm But I used $1000 as my code start address. This produced a reset vector at $1000, Interrupt vectors from $1003 and code after the int vectors. I figured I didn't need the interrupt vectors relocated to set the interrupt vector offset back to zero. This produced a reset vector at $1000, interrupt vectors at $0003 and code at $1003 (after reset vector.) I have played around with the C51 and BL51 options and cannot get ALL vectors in zero page and code from $1000. The only way I have found of achieving this is by setting CSEG AT 0 in STARTUP and location the code at $1000 in the BL51 size/location. This doesn't seem right to me. I have yet to test it as I don't have my programmer at the moment.
the easy way would be to get another PC (trying this on a PC with licenced Keil may/will get you in trouble) and download the Keil software in eval mode. Everything will have the vectors relocated to 0x800
Erik
CSEG at XXXX in the startup code specifies where the reset and interrupt vectors are located (relative to XXXX). So, CSEG at 0000h locates the reset vector at 0000h, interrupt 0 at 0003h, interrupt 1 at 000Bh, and so on. These are ABSOLUTE segments that are located at absolute (physical) addresses.
The CODE linker directive specifies where to start locating the RELOCATABLE code (the stuff generated by the compiler and from the library files). So, if you specify CODE(0x1000) the linker will put all of the relocatable code segments starting up at 1000h.
If you look inside the STARTUP.A51 file you'll find that the "startup code" that's in there is placed in a relocatable segment most likely with an RSEG (from what I recall). That code will get lumped in with all the other relocatable code and stored up at 1000h.
Hopefully, these tips help. I think I got it all correct.
Jon Ward