How to make BDM programmer not to overwrite sections of Flash memory

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

How to make BDM programmer not to overwrite sections of Flash memory

Jump to solution
1,556 Views
Punit
Contributor III

I have my bootloader code from E000 to FFFF. Although I have protected this area in my application code as well, however whenever I try to Program my application code through BDM, it erases my Bootloader code as well. And my application code can not work with no bootloader code into Flash.

 

My bootloader code and Application code are two seperate programs and I do not want to program my application code through my bootloader code everytinme as this stage of development.

 

So, can we protect certain Flash areas not to be overwritten through BDM?

Labels (1)
0 Kudos
Reply
1 Solution
703 Views
AppliedRob
Contributor I

I encountered this as well. 

 

To preserve my bootloader code, I did this...

 

Program application code (clicking on Debug in CodeWarrior) as normal.  This first time, it will erase all of the flash as you mentioned.  When in the True-Time Simulator window, click 'MultilinkCyclonePro' at the top of the window and then click 'AdvancedProgramming/Debug options...' from the list shown.  In the section that states 'Preserve this memory range' type in the range that you want to preserve the next time you program your application (E000 to FFFF).  Then select 'Done' and close the True-Time Simulator.

 

Next, open your bootloader and program it as normal. 

 

Then, program the application code again.  It should now skip the range you have selected to preserve. 

 

You should only have to do this once.  The range should stay set on subsequent programmings of your application.  It appears to save the options in an initialization file in my project called 'BDM_P&E_Multilink_CyclonePro.ini'.   

 

 

Rob  

View solution in original post

0 Kudos
Reply
3 Replies
704 Views
AppliedRob
Contributor I

I encountered this as well. 

 

To preserve my bootloader code, I did this...

 

Program application code (clicking on Debug in CodeWarrior) as normal.  This first time, it will erase all of the flash as you mentioned.  When in the True-Time Simulator window, click 'MultilinkCyclonePro' at the top of the window and then click 'AdvancedProgramming/Debug options...' from the list shown.  In the section that states 'Preserve this memory range' type in the range that you want to preserve the next time you program your application (E000 to FFFF).  Then select 'Done' and close the True-Time Simulator.

 

Next, open your bootloader and program it as normal. 

 

Then, program the application code again.  It should now skip the range you have selected to preserve. 

 

You should only have to do this once.  The range should stay set on subsequent programmings of your application.  It appears to save the options in an initialization file in my project called 'BDM_P&E_Multilink_CyclonePro.ini'.   

 

 

Rob  

0 Kudos
Reply
703 Views
kef
Specialist I

1. You can include bootloader S-records in your application code adding this line to PRM file

 

HEXFILE bootloader.s19

 

This makes *.abs (ELF) file including all the code, both application to be debugged adn bootloader. No need to save/restore bootloader part in flash.

 

 

2. You can make CW outputing two variants of S records, full file and only application's S-records. To do so you need to edit burner file (*.bbl). For nonbanked application with bootloader at top of flash it could look as follows:

 

OPENFILE "%ABS_FILE%.s19"
format=motorola
busWidth=1
origin=0
len=0xF000
destination=0
SRECORD=Sx
SENDBYTE 1 "%ABS_FILE%"
CLOSE

 

OPENFILE "%ABS_FILE%of.s19"
format=motorola
busWidth=1
origin=0
len=0x1000000
destination=0
SRECORD=Sx
SENDBYTE 1 "%ABS_FILE%"
CLOSE

 

This should generate two *.s19 files, one with flash addresses from 0 to 0xEFFF (see len=0xF000) and the second one *of.s19 including all codes.

 

0 Kudos
Reply
704 Views
tonyp
Senior Contributor II

My solution is to concatenate the two S19 files into one (after manually editing out the first's S9 record).

0 Kudos
Reply