This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Setting the program security byte in the f330

How does one set the program memory page lock byte when downloading the program to the part? I would think that this could be accomplished from the linker/locater but can find no reference to it in the manual. Has anyone done this? Comments welcomed

Parents
  • Mike,

    I've always programmed these types of security bytes in our device programmer, but I guess with a flash device that's a bit irrelevant.

    I took a quick look at the datasheet and see that the byte that specifies which pages are locked is located in the "last byte of user flash." While I'm not going to bother to find out where that is on this particular chip, it's easy from that point of view to get the compiler / linker to help you out.

    Make a file (call it, say, LOCKBYTE.C) and put something like:

    const unsigned char code lockval = 0xXX;

    where 0xXX represents the right code for the sections you want to lock.

    Next, use a linker diretive to tell the linker to put this at the last byte of user flash, like so:

    ?CO?LOCKBYTE(0xXXXX)

    again, of course, substitute 0xXXXX for whatever is the last byte of user flash.

    Hope that helps.

Reply
  • Mike,

    I've always programmed these types of security bytes in our device programmer, but I guess with a flash device that's a bit irrelevant.

    I took a quick look at the datasheet and see that the byte that specifies which pages are locked is located in the "last byte of user flash." While I'm not going to bother to find out where that is on this particular chip, it's easy from that point of view to get the compiler / linker to help you out.

    Make a file (call it, say, LOCKBYTE.C) and put something like:

    const unsigned char code lockval = 0xXX;

    where 0xXX represents the right code for the sections you want to lock.

    Next, use a linker diretive to tell the linker to put this at the last byte of user flash, like so:

    ?CO?LOCKBYTE(0xXXXX)

    again, of course, substitute 0xXXXX for whatever is the last byte of user flash.

    Hope that helps.

Children
No data