![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Ron Guest
|
Does CCS compiler always keep reset vector clear? |
Posted: Thu Nov 07, 2002 9:03 am |
|
|
Hello,
Does the compiler always keep the four addresses 0000 - 0003 clear, so I can use my bootload code with any program I make? (PIC18f452)
I have a bootloader which has some code at the reset vector. Normally, the compiler seems to place a goto instruction to the main loop at addresses 0000 - 0003.
But is this always the only code at these four addresses 0000 - 0003? In that case I can safely use my bootload code with any program I make. For the 'goto main' instruction can be easily copied to another location and be run from there. (reset-vector re-location)
Any comments would be appreciated,
Regards,
Ron
___________________________
This message was ported from CCS's old forum
Original Post ID: 8652 |
|
![](templates/subSilver/images/spacer.gif) |
Ivar Johnsrud Guest
|
Re: Does CSS compiler always keep reset vector clear? |
Posted: Thu Nov 07, 2002 12:56 pm |
|
|
The bootloader is moving the two-four first instructions
to another location, so the bootloaders goto wont get
overwritten. If it relocates 2,3 or 4 instructions depends
on how the hex file looks like. The bootloader I have
written is searching for a goto instruction in the reset
vector, and relocates everything before and including the
goto instruction.
-Ivar
:=Hello,
:=
:=Does the compiler always keep the four addresses 0000 - 0003 clear, so I can use my bootload code with any program I make? (PIC18f452)
:=
:=I have a bootloader which has some code at the reset vector. Normally, the compiler seems to place a goto instruction to the main loop at addresses 0000 - 0003.
:=
:=But is this always the only code at these four addresses 0000 - 0003? In that case I can safely use my bootload code with any program I make. For the 'goto main' instruction can be easily copied to another location and be run from there. (reset-vector re-location)
:=
:=Any comments would be appreciated,
:=Regards,
:=Ron
___________________________
This message was ported from CCS's old forum
Original Post ID: 8662 |
|
![](templates/subSilver/images/spacer.gif) |
Ron Guest
|
Re: Does CSS compiler always keep reset vector clear? |
Posted: Fri Nov 08, 2002 9:16 am |
|
|
:=The bootloader I have
:=written is searching for a goto instruction in the reset
:=vector, and relocates everything before and including the
:=goto instruction.
Yeah, alright, mine too. But what if the reset vector has other instructions than a goto in it? If this is the case, those instructions cannot be re-located, because other parts of the program expect these instructions around the reset vector. (e.g. address 0002, or 0006).
So my question still stands: Is there a possibility for the compiler to generate other code at the reset vector than a goto main instruction?
Any comments would be appreciated.
Best regards,
Ron
___________________________
This message was ported from CCS's old forum
Original Post ID: 8686 |
|
![](templates/subSilver/images/spacer.gif) |
Tomi Guest
|
Re: Does CSS compiler always keep reset vector clear? |
Posted: Fri Nov 08, 2002 11:54 am |
|
|
The Interrupt Handler starts at 0x0004 word address. So you have max. 4 instructions to do something PLUS step over the IT handler(s). A correct "long jump" is 3 instructions (load upper address word into W reg, store W reg into PCLATH and the GOTO itself) for 16F87X...
So you could be sure about GOTO main.
:=So my question still stands: Is there a possibility for the compiler to generate other code at the reset vector than a goto main instruction?
:=
:=Any comments would be appreciated.
:=
:=Best regards,
:=Ron
:=
:=
:=
___________________________
This message was ported from CCS's old forum
Original Post ID: 8695 |
|
![](templates/subSilver/images/spacer.gif) |
Ron Guest
|
Re: Does CSS compiler always keep reset vector clear? |
Posted: Mon Nov 11, 2002 2:49 am |
|
|
Thanks Tomi,
You are right there's not much space for other code. Although for the 18f452 things are a bit different:
A GOTO is only 2 instructions long. So in theory there is room for 2 GOTO's. (or 1 GOTO and 2 other instructions, if no interrupts are used. I don't know if the compiler would use interrupt vector location for other purposes, if no interrupts are used)
Therefore I'm not 100\% sure of the reset vector area to be clean of other instructions. That's why I asked.
Best regards,
Ron
:=The Interrupt Handler starts at 0x0004 word address. So you have max. 4 instructions to do something PLUS step over the IT handler(s). A correct "long jump" is 3 instructions (load upper address word into W reg, store W reg into PCLATH and the GOTO itself) for 16F87X...
:=So you could be sure about GOTO main.
:=
:=
:=:=So my question still stands: Is there a possibility for the compiler to generate other code at the reset vector than a goto main instruction?
:=:=
:=:=Any comments would be appreciated.
:=:=
:=:=Best regards,
:=:=Ron
:=:=
:=:=
:=:=
___________________________
This message was ported from CCS's old forum
Original Post ID: 8745 |
|
![](templates/subSilver/images/spacer.gif) |
Ron Guest
|
Re: One solution |
Posted: Tue Nov 12, 2002 2:10 am |
|
|
I learned from CSS that it is possible to change the reset vector:
Use:
#Build(reset=0x200) [for example]
Best regards,
Ron
:=Hello,
:=
:=Does the compiler always keep the four addresses 0000 - 0003 clear, so I can use my bootload code with any program I make? (PIC18f452)
:=
:=I have a bootloader which has some code at the reset vector. Normally, the compiler seems to place a goto instruction to the main loop at addresses 0000 - 0003.
:=
:=But is this always the only code at these four addresses 0000 - 0003? In that case I can safely use my bootload code with any program I make. For the 'goto main' instruction can be easily copied to another location and be run from there. (reset-vector re-location)
:=
:=Any comments would be appreciated,
:=Regards,
:=Ron
___________________________
This message was ported from CCS's old forum
Original Post ID: 8778 |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|