HCS08 and flash access (writing, erasing, protection...)

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

HCS08 and flash access (writing, erasing, protection...)

Jump to solution
2,378 Views
vcz
Contributor II

Hello all.

 

I'm working on a mc9s08aw16 HCS08 based MCU.

 

I have to program a bootloader and a firmware.

I choose to place the firmware between 0xC000 and 0xEEEE and the bootloader between 0xF000 and 0xFFAF.

I have made a small function which transfert to RAM the code used to write/erase flash

 

But I still not succed in erasing and writing to flash

 

I program the 0xFFBF byte (NVOPT) with 0xFE so the MCU should be unsecured (programming via Cyclone Pro)

 

I'm lost between all the register related to flash.

More precisly with the NVBACKEY registers, KEYACC bit, SEC0 bits...

 

To sum up, is there anybody who can explain me what I have to do with those register to succeed in my goal.

 

Thanks a lot

Labels (1)
0 Kudos
Reply
1 Solution
684 Views
vcz
Contributor II

 Hello.

 

Thanks a lot for your answer. I already have the AN2295 but I didn't find what I want in it.

 

Nevertheless, I have re-written my code and now, it works ! I changed the way to execute from the RAM and it's more efficient and easy understanding.

 

Indeed, instead of making a routine writing to ram the opcode dynamically, I use a tab with statical opcode in it and then jump to the tab address in ram... (I find this idea in a page of this forum !)

 

Thanks !

 

 

 

 

View solution in original post

0 Kudos
Reply
3 Replies
684 Views
vcz
Contributor II
I have forgoten to say that I'm using sdcc to cross compil my project....
0 Kudos
Reply
684 Views
J2MEJediMaster
Specialist I

This sort of task has been discussed many times in the forums. Do a search on "bootloader" using the search box at the bottom left of this web page. Also, search for App Note 2295 (type "AN2295" into the Enter Keyword box at the top right of this web page). It covers a serial bootloader, but it's a good place to start.

 

---Tom

0 Kudos
Reply
685 Views
vcz
Contributor II

 Hello.

 

Thanks a lot for your answer. I already have the AN2295 but I didn't find what I want in it.

 

Nevertheless, I have re-written my code and now, it works ! I changed the way to execute from the RAM and it's more efficient and easy understanding.

 

Indeed, instead of making a routine writing to ram the opcode dynamically, I use a tab with statical opcode in it and then jump to the tab address in ram... (I find this idea in a page of this forum !)

 

Thanks !

 

 

 

 

0 Kudos
Reply