Program origin and banks
Moderators: David Barker, Jerry Messina
Program origin and banks
Hello,
I need to protect the source, but read a part of the ROM containing some string constants.
I am aware of the configuration parameters to protect the individual banks and would like to know if and how I can position the origin of the program from a specific bank.
Thank you.
I need to protect the source, but read a part of the ROM containing some string constants.
I am aware of the configuration parameters to protect the individual banks and would like to know if and how I can position the origin of the program from a specific bank.
Thank you.
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: Program origin and banks
Read the constants with what? Also, what device are you using? Different ones have different protections.but read a part of the ROM containing some string constants
Octal pointed you to the 'org_xxx' options for moving things around in ROM, but it sounds likehow I can position the origin of the program from a specific bank
what you want is a little different.
Swordfish will locate all of your constants (both const strings and tables) in the lower portion
of memory after the reset and interrupt vectors, but it's not in it's own section... it could
be mixed in with some code.
The const data is considered as part of the code, so when you use the ORG options to move the code
it moves the const data along with it.
There's no easy way that I know of to leave the const data where it's at and only move the code.
Re: Program origin and banks
Hello,
with 18F2682 and below config I disable the code read from MPU..
.. but this also prevents the use of the TBLRD* and always returns 0.
So the idea was put only the constants allowing TBLRD* in the first bank then protect other banks.
I would do the same thing for 18F26K80.
with 18F2682 and below config I disable the code read from MPU..
Code: Select all
CP0 = On
CP1 = On
CP2 = On
CP3 = On
CP4 = On
CP5 = On
EBTR0 = On
EBTR1 = On
EBTR2 = On
EBTR3 = On
EBTR4 = On
EBTR5 = On
CPD = On
CPB = On
So the idea was put only the constants allowing TBLRD* in the first bank then protect other banks.
I would do the same thing for 18F26K80.
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: Program origin and banks
Do you really need the table read protection?
Re: Program origin and banks
Hello Jerry,
I had based on this post http://www.microchip.com/forums/m252258.aspx but rightly once you've set CPn and make sure the bootloader with CPB the FW can not be changed and read than a full erase right?
So EBTRn are superfluous and are those that prevent me from the TBLRD*.
I had based on this post http://www.microchip.com/forums/m252258.aspx but rightly once you've set CPn and make sure the bootloader with CPB the FW can not be changed and read than a full erase right?
So EBTRn are superfluous and are those that prevent me from the TBLRD*.
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: Program origin and banks
I've never used code protection and a bootloader. I'm not sure how all that would work.
It's my understanding that if you code protect the bootloader and write-protect the configuration registers (WRTC)
it makes it difficult to use a low-voltage block erase to modify the bootloader, so you're relatively safe.
That assumes you're using an encripted bootloader of some sort so that the user couldn't just download a small hex file
to dump out the contents.
It's my understanding that if you code protect the bootloader and write-protect the configuration registers (WRTC)
it makes it difficult to use a low-voltage block erase to modify the bootloader, so you're relatively safe.
That assumes you're using an encripted bootloader of some sort so that the user couldn't just download a small hex file
to dump out the contents.