![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Andreas
Joined: 25 Oct 2004 Posts: 136
|
Relocating Interrupts |
Posted: Fri Aug 24, 2007 12:24 am |
|
|
Hi Friends !
I know thats an old issue, but I was not able to find samples !
I need to use a ready bootloader which resides at the the beginof programm memory and expects the user area to start at H2028.
It should have zeros at H2000 ... H2007
The interrupts should be at H2008 / H2018
So the memora map is:
0x2028 user program entry
0x2018 Low-Level Interrupt handler
0x2008 High-level interrupt handler
0x2000 user info 8 Bytes filled with zeros
SO my questions are now:
Which directive to use to relocate the interrupt and to set the area H2000..H2007 to zeros ?
any help very appreciated
best regards
Andreas |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
![](templates/subSilver/images/spacer.gif) |
Andreas
Joined: 25 Oct 2004 Posts: 136
|
|
Posted: Fri Aug 24, 2007 2:30 pm |
|
|
Thank You, PCM programmer, I found the point where to start now.
In searching for the best implementation I got to the directives #Locate and reserve.
Out of the explanation in the manual I cannot see a difference in this directives, can You give me the point??
Mybe I cant read it because english is not my native language...
Best regards and Thanks for big contribution to the board
Andreas |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Aug 24, 2007 3:11 pm |
|
|
#locate is used to assign a specific RAM address to a variable.
Normally, you don't need to use #locate, because the CCS compiler will
automatically assign the RAM addresses of each variable to some
appropriate place in the PIC's memory map.
Also, an address that is assigned with #locate will not be used for
other variables by the compiler. For example, here is the memory
map for the program shown below. Notice that value is placed at
address 0x21, and the other variables are automatically placed in
free RAM locations, but they do not use address 0x21.
Code: |
020 a
021 value
022 b
023 c
024 x
025 y
026 z
|
Code: | #include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
int8 a,b,c;
int8 value;
#locate value = 0x21
int8 x,y,z;
//===============================
main()
{
while(1);
} |
The #reserve directive just prevents the compiler from using one or more
bytes of RAM. It doesn't assign any variables to the RAM.
Here is the memory map for the program shown below. Note that
address 0x21 is not used, because the #reserve directive tells the
compiler not to use it.
Code: |
020 a
022 b
023 c
024 x
025 y
026 z |
Code: | #include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
#reserve 0x21
int8 a,b,c;
int8 x,y,z;
//====================================
main()
{
while(1);
} |
|
|
![](templates/subSilver/images/spacer.gif) |
Andreas
Joined: 25 Oct 2004 Posts: 136
|
|
Posted: Sat Aug 25, 2007 7:14 am |
|
|
Hi
Thanks PCM Programmer, that was very usefull explanation.
I have a problem with implementing a third party bootloader:
It needs to have 8 0x00 Bytes at 0x2000, and I couldnt find a way to make this.
The requirements are
Start of user Program 0x2028
High level ints at 0x2008
low level ints at 0x2018
user programinfo = 8 x 0x00 at 0x2000
I made this, but I can see a jump at 0x2000 !!!
Code: |
#build(reset=0x2000)
#build(interrupt=0x2008)
#org 0x0000,0x1FFE
void bootloader() {}
|
So I tried to set the reset to 0x2028 but then the comiler said wrong org statement
I also tried to set #rom 0x2000 = {0,0,0,0,0,0,0,0}
again compiler says wrong org statement
any idea to make this setup working ??
again: User program should start at 0x2028, interupts at 0x2008, and user info at 0x0200
best regards
Andreas |
|
![](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
|