|
|
View previous topic :: View next topic |
Author |
Message |
Andy Drummond Guest
|
Location of library routines? |
Posted: Thu May 08, 2003 10:10 am |
|
|
I have written a boot-loader for my PIC18F252 but I need to force the I2C library routines into the boot area - as it is they get located right in the middle of the area I want to load. Is there any way of forcing the location of these routines?
___________________________
This message was ported from CCS's old forum
Original Post ID: 14261 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: Location of library routines? |
Posted: Thu May 08, 2003 2:45 pm |
|
|
:=I have written a boot-loader for my PIC18F252 but I need to force the I2C library routines into the boot area - as it is they get located right in the middle of the area I want to load. Is there any way of forcing the location of these routines?
--------------------------------------------------------------
CCS has a small comment in the README.TXT file regarding
the "#org default" command. I made a test program below,
which appears to work. I was able to relocate the internal
i2c library to ROM address 0x800. But, it wouldn't relocate
until I moved the "#use i2c" statement so it was within main().
Normally, I put it above main(), but then the compiler just
kept putting the i2c code in low ROM.
To test that the "#org default" can be turned off, I have
added another function, my_func(), at the end of the program.
It's placed right after the "#org default" statement which is
below the closing brace of main(). my_func() was placed
in low ROM by the compiler, so it works OK.
The README.TXT file, if you want to read it, is in this folder:
c:\Program Files\Picc\
It refers to an example file, LOADER.C, which is in:
c:\Program Files\Picc\Drivers
I tested this with PCM vs. 3.148.
<PRE>
#include "c:\Program Files\Picc\Devices\16F877.H"
#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 8000000)
//#use rs232(baud = 9600, xmit=PIN_C6, rcv = PIN_C7, ERRORS)
<BR>
<BR>
my_func(void);
<BR>
#ORG 0x0800, 0x0FFF AUTO=0 DEFAULT
<BR>
//=====================================
void main()
{
#use i2c(Master, SDA=PIN_C4, SCL=PIN_C3)
<BR>
i2c_write(0x55);
<BR>
my_func();
<BR>
while(1);
}
//===============================
<BR>
#org default
<BR>
<BR>
my_func(void)
{
char c;
c = 0x55;
}
</PRE>
___________________________
This message was ported from CCS's old forum
Original Post ID: 14270 |
|
|
Andy Drummond Guest
|
Re: Location of library routines? |
Posted: Fri May 09, 2003 6:24 am |
|
|
Thanks PCM, you got me going in the right direction.
I couldn't make it work as you showed, but I #ORG'ed the whole
program from 100-77FF, the loader from 7800-7C00, and the compiler then put the I2C routines (etc) after 7C00 as there was
no space apart from that. All well, thank you.
:=:=I have written a boot-loader for my PIC18F252 but I need to force the I2C library routines into the boot area - as it is they get located right in the middle of the area I want to load. Is there any way of forcing the location of these routines?
:=--------------------------------------------------------------
:=
:=CCS has a small comment in the README.TXT file regarding
:=the "#org default" command. I made a test program below,
:=which appears to work. I was able to relocate the internal
:=i2c library to ROM address 0x800. But, it wouldn't relocate
:=until I moved the "#use i2c" statement so it was within main().
:=Normally, I put it above main(), but then the compiler just
:=kept putting the i2c code in low ROM.
:=
:=To test that the "#org default" can be turned off, I have
:=added another function, my_func(), at the end of the program.
:=It's placed right after the "#org default" statement which is
:=below the closing brace of main(). my_func() was placed
:=in low ROM by the compiler, so it works OK.
:=
:=The README.TXT file, if you want to read it, is in this folder:
:=c:\Program Files\Picc\
:=It refers to an example file, LOADER.C, which is in:
:=c:\Program Files\Picc\Drivers
:=
:=I tested this with PCM vs. 3.148.
:=
:=<PRE>
:=#include "c:\Program Files\Picc\Devices\16F877.H"
:=#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
:=#use delay(clock = 8000000)
:=//#use rs232(baud = 9600, xmit=PIN_C6, rcv = PIN_C7, ERRORS)
:=<BR>
:=<BR>
:=my_func(void);
:=<BR>
:=#ORG 0x0800, 0x0FFF AUTO=0 DEFAULT
:=<BR>
:=//=====================================
:=void main()
:={
:=#use i2c(Master, SDA=PIN_C4, SCL=PIN_C3)
:=<BR>
:=i2c_write(0x55);
:=<BR>
:=my_func();
:=<BR>
:=while(1);
:=}
:=//===============================
:=<BR>
:=#org default
:=<BR>
:=<BR>
:=my_func(void)
:={
:=char c;
:=c = 0x55;
:=}
:=</PRE>
___________________________
This message was ported from CCS's old forum
Original Post ID: 14286 |
|
|
|
|
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
|