Home arrow Support arrow Forums

Luminary Micro Forums

<< Start < Prev 1 2 Next > End >>

ddrennan

Senior Boarder
Click here to see the profile of this user

2008/06/30 13:46

Re:working with data in flash

Reading from any flash address is trivial. Writing takes a little more care, but it can be done very easily with the driver lib.

To read,

Code:

 #define FLASH_DATA_ADR (unsigned int)(0x00001C00) data = *(volatile unsigned int *)(FLASH_DATA_ADR);



To write using the lib (only zero bits can be written, data is AND'ed into the flash)

Code:

 FlashProgram((unsigned long *)data, (unsigned long)(FLASH_DATA_ADR), 4);



To erase a 1kB block of flash (reset bits to '1')

Code:

 FlashErase((unsigned long)(FLASH_DATA_ADR));



(see the lib docs for the prototype details)

login or register to reply

cb1

Platinum Boarder
Click here to see the profile of this user

2008/06/30 14:05

Re:working with data in flash

Thanks - I was thinking of writing and then reading a, "programmed" device - as I thought was your goal re: serializing devices. In this mode one usually would not have easy, free access to either IAR or source code.

Another thought - how does "recovery" of your serial no. effect your code "security?" Does the bootloader operate with a secured part?

If all else fails - use of a < $.25
eeprom can solve your serial no. requirement...

login or register to reply

ddrennan

Senior Boarder
Click here to see the profile of this user

2008/06/30 14:34

Re:working with data in flash

Depends on the type of security. My understanding of the bootloader is that it can be set to erase the flash before programming the new code. I haven't look at the details, but assume it protects the reserved flash space in this case.

The production process I would like to go through is like this,

  • Build board

  • Programme new bootloader (with reserved flash space)

  • Programme application code

  • Write serial number to reserved flash


It is just that last step that I am a bit unsure how to do, but I reckon it could be done with a custom PC programme that makes use of the bootloader commands.

If there was an easier way than writing a custom programme, that would be great...

login or register to reply

cb1

Platinum Boarder
Click here to see the profile of this user

2008/06/30 15:12

Re:working with data in flash

Your process seems logical - however won't you require some means to "read" your serial number?

Perhaps the bootloader can secure your code/data in "low" memory - yet allow you to "read/recover" a serial number from the protected region.

Can you use the bootloader application to read/recover your serial number? Have you any hardware with which to experiment?

login or register to reply

ddrennan

Senior Boarder
Click here to see the profile of this user

2008/07/01 00:58

Re:working with data in flash

The serial number can be read by the application and sent out serially to the host device. Even if for some reason the application failed, and we wanted to read the serial number this can be done with the J-Link and J-Flash (no license required to read the flash).

login or register to reply
<< Start < Prev 1 2 Next > End >>