need help CC5x pic16f Overlapping code

Thread Starter

m3atwad

Joined Feb 1, 2010
5
I am writing a C bootloader using the CC5x c compiler for pics (pic in use is a 16f690) I am trying to write some commands to the reset vector so the program will jump to my bootloader at the top of memory space. The directive is #pragma cdata[], but I am getting this error "overlapping code at adress 0x00". I have tried this with other c compilers (hight tech c compiler) and I can't figure out how to write to that memory space with this one either. From what i've found so far it sounds like it could be a linker problem, but i'm not sure. Basically, how to I write a goto command to the reset vector with a pic c compiler? Is it protected or already written to and is that why I can't write to it?
 

rjenkins

Joined Nov 6, 2005
1,013
Typically the compiler will use the reset vector to initialise stuff, like clearing memory and copying any initialised variable data from ROM to RAM, then jump to the user program main();
 

Thread Starter

m3atwad

Joined Feb 1, 2010
5
yea that is 100% correct. looking at the program memory it puts a goto command there that points to memory location 001h. I can't figure out how to force it to put my goto command there instead though. I've been looking though the compiler manual, but haven't come up with much. Is there some kind of command or optimizing option i need to modify?
 

rjenkins

Joined Nov 6, 2005
1,013
If you write in C, you need the compiler to do it's stuff.

Put your code in main() as it needs.

I think your only other option is to write it in assembler so the only code in the chip is what you supply.
 

aashitech

Joined Feb 20, 2009
1
Add below code at very start of main(),0x??? is to be replaced by address where you want to jump...but remember ....please add a "ret" instruction at end of the code you want to jump at because its a "call" not a "goto" at your code ...hope that helps.....

void main()
{
#asm
DW __CALL(0x???)
#endasm

..........
...............
.....................
.......................

}
 
Top