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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
2,950 次查看
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

标签 (1)
0 项奖励
回复
1 解答
1,256 次查看
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 项奖励
回复
3 回复数
1,256 次查看
vcz
Contributor II
I have forgoten to say that I'm using sdcc to cross compil my project....
0 项奖励
回复
1,256 次查看
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 项奖励
回复
1,257 次查看
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 项奖励
回复