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

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

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

Jump to solution
1,141 Views
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

Labels (1)
0 Kudos
Reply
1 Solution
996 Views
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.)

View solution in original post

0 Kudos
Reply
2 Replies
997 Views
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 Kudos
Reply
996 Views
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 Kudos
Reply