Mplab x and relocatable code.

Thread Starter

geoffers

Joined Oct 25, 2010
488
Hi all,
A few questions for the seasoned!
I recently got a new pic to play with (16f1779) 4 op amps :).

First shock was I have to move to mplab x as its not supported on mplab 8.whatever I was using.

Its been a hard change but I'm getting to like it I think....

I also thought I should move to relocatable code, I learnt from a book about 15 years ago that used absolute and I've never tried anything else!

My current project that I'm trying to move across to the 16f1779 has quite tight timing on one section of code, I think I have 5 or 6 instructions to play with on a isr bit of code (32mhz so I can't go any faster with intosc)

First question is, if I put the isr and the bit that calls it in the same asm file does this ensure the linker puts them on the same page? I think if I need to do a pagesel out and back of the isr it will use up all my spare instructions :-(.

Second question, is mplab x smart enough to put in pagesel where needed or do I need to always do;

Pagesel routine
Call routine

To make sure nothing goes wrong? (I think I can guess).
I know this is basic stuff but Google comes up with a lot of info, some of it quite old.

Cheers Geoff
 

dannyf

Joined Sep 13, 2015
2,197
Second question, is mplab x smart enough to put in pagesel where needed or do I need to always do;
Mplab x, or for that matter, any ideas, isn't smart enough to do that, as that's not the job of an ide.

I think you are creating problems for yourself to solve.
 

Thread Starter

geoffers

Joined Oct 25, 2010
488
Thanks,
That's that one cleared up, I had just wondered if the linker knows where it put a block of code it might have been able to know if a page change was need on a call. :)

How about making sure the isr and section of code calling it are on the same page? Is it enough for them to be in the same asm file? Its only crucial for a small section.

Cheers Geoff
 

Thread Starter

geoffers

Joined Oct 25, 2010
488
Thanks,
So I need to do some thing like...

Reset_vec code 0x000
Lgoto start

Int_vec code 0x004
Goto isr

Code 0x008
isr ;do stuff....
Retfie

critical bit ;code that has time critical interrupt

Return

End

And make sure its not over a page long?
Hope that makes sense.
Cheers Geoff
 
Top