PDA

View Full Version : Setting code size boundaries



Charles Linquis
- 8th March 2007, 13:17
Is there a way - in PBP that I can set the upper limit for code? I use Mecanique's MCLoader as a bootloader. That loader occupies high memory
(starting at 1FD00 in an 8722). My code compiles, but when I try to load the chip - just at the end of the programming cycle (which takes quite a while with the '8722), I get a message that my code is attempting to overwrite the bootloader.

Is there a way that I can set limits on PBP, so it will give me a message at compile-time and tell me either the maximum memory location it is using, or else give me an error message of some kind?

I realize I could look at the hex file and find this information, but I'm looking for a more automated way.

Darrel Taylor
- 8th March 2007, 15:12
I think this should work ...


@ __MAXROM 0x1FFFF
@ __BADROM 0x1FD00 - 0x1FFFF

MPASM should then give a warning if the program goes above 1FD00.

Note: 2 underscores before both commands.

HTH,

Charles Linquis
- 8th March 2007, 15:38
Darrel,

When I put

@_MAXROM 0x1FFFF
@_BADROM 0x1C000-0x1FFFF

At the top of my program, I get the following errors when I compile:

Error[108] .... ;Illegal character(0)
Error[108] .... ;Illegal character(0)

Darrel Taylor
- 8th March 2007, 15:45
Space between the @ and the underscores.
And 2 underscores.
<br>

Charles Linquis
- 8th March 2007, 16:05
Closer -

Now I get

Error[126]...;Argument out of range (must be greater than or equal to 2097151)
Error[126]...;Argument out of range (__MAXROM must be used first)

Darrel Taylor
- 8th March 2007, 16:09
Error[126]...;Argument out of range (__MAXROM must be used first)

And, is __MAXROM first?
<br>

Charles Linquis
- 8th March 2007, 16:41
Of course!

Darrel Taylor
- 8th March 2007, 16:58
Oh Great.

Another Mind bender.

It seems to work on every chip except 18F8xxx

Hmm, now what's up with that. :(
<br>

Charles Linquis
- 8th March 2007, 18:07
Thanks for trying!

Darrel Taylor
- 8th March 2007, 18:14
You give up too easy Charles. :eek:

Found it. Actually a documented MPASM error.

Here's the fix. Just have to use a larger number for MAXROM.
@ __MAXROM 0x1FFFFF
@ __BADROM 0x1FD00 - 0x1FFFFF

Charles Linquis
- 8th March 2007, 20:11
I don't usually give up so easily - I just have a TON of code to write!

Thanks!