|
|
View previous topic :: View next topic |
Author |
Message |
kypec
Joined: 20 Sep 2003 Posts: 54
|
Re: just curious about undocumented directives |
Posted: Fri Jul 02, 2004 2:29 am |
|
|
Quote: |
1) The boot vector (#build allows this to be relocated).
2) The interrupt vector (#interrupt allows this to be relocated).
3) The 'delay' code.
4) The RS232 handler code.
The 'key' is that the last two, are actually placed in the bottom of memory _before_ the #org is met. The CCS compiler, does not recursively apply it's directives (which can be 'useful', allowing multiple #delay statements etc.). In this case, it means that code has allready been written into the area concerned.
You can relocate (for example) the 'delay' code, by adding an 'org' in front of this, and this would potentially allow the problem to be fixed.
Best Wishes |
Is there any chance to relocate HIGH and LOW priority interrupts
individually on 18F parts?
I mean that #interrupt directive allows you to relocate standard
interrupt vector at ROM address 0x0008.
But what should I do if I want to relocate also the vector at ROM address 0x0018?
TIA
kypec |
|
|
object01
Joined: 13 May 2004 Posts: 90 Location: Nashville, TN
|
Re: #org has no effect |
Posted: Fri Jul 02, 2004 10:59 am |
|
|
Ttelmah wrote: | I'd compile the program without any memory reserved. Look in the produced symbol map for the value assined to 'main', and place the block there. This will be the lowest address 'above' this stuff.
You can use
#org default 0x104
inserted at the start of your code (in front of the #use delay, and the RS232 definitions), to force these routines to all be located after the space you require.
Best Wishes |
The symbol map put main at 0x1b6c, though I think it's worth mentioning other functions I defined were put as low as 0x0004. Anyway, I put the following #org directive in:
Code: | #org 0x1b6c,0x1b6f {}
#ROM 0x1b6c = {1,2,3,4}
#org default |
And the .hex file turned up the following:
Code: | 00001B60 43 30 33 36 41 32 31 30 46 45 39 36 45 30 30 30 C036A210FE96E000 |
(That's from a listing I generated after commenting out #nolist in the device's header file.) It doesn't change if I comment out the #ROM directive.
--
Jeff S. |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Jul 13, 2004 7:15 am |
|
|
Have you found the problem yet?
I just stumbled across a similar case where I place a #device statement after the #org statement. Maybe this applies to your case as well?
The following code compiles without warning but makes the #org statement fail.
Code: | #include <18F458.h>
#device ICD=TRUE
#device adc=8 // This is the correct location for #device statements
#build(reset=0x0100)
#build(interrupt=0x0108)
// Reserve space for the bootloader
#org 0x000, 0x0FF
#rom 0x000 = {1, 2, 3, 4, 5, 6, 7, 8} // Some test data
// #device adc=8 // This line makes the #org non-existant.
#use delay(clock=16000000) |
The data in the region 0x00 - 0xFF is overwritten by the delay routine. I noticed this error when placing a function in the #org-ed region because the compiler then gave an error message. |
|
|
Guest
|
|
Posted: Tue Jul 13, 2004 7:18 am |
|
|
ckielstra wrote: | Have you found the problem yet? |
I gave up and switched to storing persistent data in EEPROM. I couldn't devote any more time to figuring out the idiosyncracies of #org.
--
Jeff S. |
|
|
|
|
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
|