Can anyone help with assembler code to program Flash from within the application.

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

Can anyone help with assembler code to program Flash from within the application.

跳至解决方案
1,139 次查看
cwt
Contributor II

Can anyone help with assembler code to program Flash from within the application. I have used routines from AN3942 and HCS08 reference manual.  I have entered sub routines "FlashErase1", "FlashProg1", "DoOnStack", and "SpSub".  But I am not sure how to pass the memory address and the data when calling these routines.

Thanks

Bill

标签 (1)
0 项奖励
回复
1 解答
994 次查看
tonyp
Senior Contributor II

I don't know about the particular application note but usually address is passed in the HX register and data in the A register.

(You can also have a look at my ASM8​​ version inside the ZIP archive file code/lib/flash.sub, or here: http://aspisys.com/code/hc08/flash.html​ to get an idea.)

在原帖中查看解决方案

0 项奖励
回复
2 回复数
995 次查看
tonyp
Senior Contributor II

I don't know about the particular application note but usually address is passed in the HX register and data in the A register.

(You can also have a look at my ASM8​​ version inside the ZIP archive file code/lib/flash.sub, or here: http://aspisys.com/code/hc08/flash.html​ to get an idea.)

0 项奖励
回复
994 次查看
cwt
Contributor II

Tony,

Thanks for the reply. Your 'flash.sub' will take me some time to digest.  It looks similar to the App note but more comprehensive.

I tried running mine in CodeWarrior simulator, but it never exits the subroutine running on the stack. I guess this is because the simulator cannot actually simulate the flash memory erase or write.  There seams to be some time critical operations (flash clock has limited range) and this probably limits the use of Back Ground Debug operation as well. Any comment?

Bill

0 项奖励
回复