AN2295 - Setting up a section as NVRAM

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AN2295 - Setting up a section as NVRAM

1,304 Views
phedlund
Contributor I
I am using a GT60 part with the bootloader from AN2295.  I am trying to protect a section from erasure (1A00-19FF) so i can store MAC address, power levels, contrast and various one time settings.  New code updates through the bootloader can't touch this area.  I have been working on this for a while.

Here are clips on how i setup the bootloader ID_STRING section.


FLS_BEG        EQU        $1080   ; FLASH #0 block start
FLS_END        EQU        $1800   ; FLASH #0 block end
FLS_BEG1    EQU        $182C   ; FLASH #1 block start
FLS_END1    EQU        $19FF   ; FLASH #1 block end
FLS_BEG2    EQU        $2000   ; FLASH #2 block start
FLS_END2    EQU        $FDC0   ; FLASH #2 block end


        DC.B    3                    ; number of Flash blocks 
        DC.W    FLS_BEG     ; START ADDRESS OF FLASH   
        DC.W  FLS_END          ; END ADDRESS OF FLASH   
        DC.W    FLS_BEG1    ; START ADDRESS OF FLASH #2
        DC.W    FLS_END1      ; END ADDRESS OF FLASH     #2
        DC.W    FLS_BEG2    ; START ADDRESS OF FLASH #3
        DC.W    FLS_END2      ; END ADDRESS OF FLASH     #3



I am using a BDM to load the bootloader then manually putting values into 1A00 (31 37 30 31)
I then reset the bdm and re-read 1a00 to verify it exists.
When using the bootloader and the PC serial program I put my application in.  (No references are made
in the hex file to locations 1a00-1fff).
I connect it back to the bdm, reset the chip, and read the memory of the device
1a00 is now FF

I would appreciate any input on how i can create a section of memory that the bootloader can't erase.

Labels (1)
0 Kudos
Reply
1 Reply

566 Views
ok2ucx
Contributor IV
Hi,

it seems to me that this erasure is not related directly to the bootloader but rather to the "organizational" structure of the Flash itself.

If your data are at 0x1A00 address, the 512B erase page boundary starts at 0x1A00, ends at 0x1BFF. As you mention, no S19 (hex) data should appear in your code.

If there's no data in that page, master side of the bootloader does NOT issue a Erase command to that page. You can verify this by using Debug version of hc08sprg.exe (find attached). It displays all commands and communication issued during the bootloading. Please, check this.


On the other hand, you can even use the bootloader to store just the MAC address, if you have "MAC address only" S19 file like this:

Code:
S1071A00313730311C
S9030000FC

issuing the bootloader for the second time after your code is loaded.

Pavel (an2295 bootloader developer)
 

Message Edited by t.dowe on 2009-09-03 05:14 PM
0 Kudos
Reply