BDM Flash Erase to Non-Sector Boundary

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

BDM Flash Erase to Non-Sector Boundary

2,339件の閲覧回数
ericLGC
Contributor I
I'm using MC9S12A128 and A256 micros with a USB BDM Multilink.  I recently moved my Bootloader to a non-sector boundary.  I can no longer simply use a sector erase before loading non-bootloader code since this will erase my bootloader.  So I can't figure out how to load my non-bootloader code using the BDM without erasing my Bootloader. 
 
I have tried to use the "copymem" command to try to copy the flash values before erasing and then restore them after erasing but the copymem does not seem to be able to copy back to flash. If I could somehow store values into a variable and then write them back to flash that would work.
 
How can read values into variables using a command script? Any help would be appreciated.
 
Thanks,
Eric
 
ラベル(1)
0 件の賞賛
返信
3 返答(返信)

1,173件の閲覧回数
ericLGC
Contributor I
I got the answer.  I use the "SAVE" and "SREC" commands in my preload.cmd script to save the bootloader to an s19 file and then load the s19 file after the erase is complete.  These commands are part of the CodeWarrior Debugger Engine so search on that if you're looking for documentation.  P&E Micro will not tell you about these commands because they want you to purchase their flash loader software which basically does the same thing.
 
Also this method is so much faster than scripting the sector erase up until the Bootloader.  There is some risk in losing the Bootloader if power is cut off during the script or something like that but since I'm debugging anyways I don't care too much about that risk.
 
FLASH
SAVE addr1..addr2 SAVE_BL.s19
FLASH ERASE 3
FLASH ARM
SREC SAVE_BL.s19
 
 
Thanks,
Eric
 
0 件の賞賛
返信

1,173件の閲覧回数
ang
Contributor I
hi
merge the hex/srec files of the bootloader code and application code . Load the the same with BDM.
0 件の賞賛
返信

1,173件の閲覧回数
kef
Specialist I
I don't know your specific needs, but I think that bootloader has to be write protected all the time and without any exceptions. And write protection is sector-boundary aligned. Did you consider possibility of "impossible" reset or power loss after you moved your misaligned sector to RAM or to another sector, erased your misaligned sector, but before you write that cleaned misaligned sector back?
0 件の賞賛
返信