Save flash data in debugging.

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

Save flash data in debugging.

2,466 Views
IgorN
Contributor II
Wich way can I to lauch the CW IDE debugger on M9S12DP512 without erasing all flash memory?
I want to save the data in the flash . In the *.prm-file those pages declared as NO_INIT. I'm using the Code Warrior IDE version 5.7.0 
Labels (1)
0 Kudos
Reply
5 Replies

888 Views
JimDon
Senior Contributor III


1. Go the the P&E_Multilink_CyclonePro.ini file and remove AUTOERASEANDFLASH from LoadDialogOption
2. Add this to P&E_Multilink_CyclonePro_Preload.cmd:
FLASH INIT AUTOID
FLASH SELECT 2
FLASH ARM
FLASH ERASE  2

3. Add this to P&E_Multilink_CyclonePro_Postload.cmd
RESET

This will keep page 4000 from being erased, and only erase and brun C000 . The number is the Flash Block number. You can only preserve 16K pages.

If you go to the command window and type FLASH you can see a list of the block numbers you have. This was test on a un banked project.




Message Edited by JimDon on 2008-06-12 03:48 PM
0 Kudos
Reply

888 Views
IgorN
Contributor II
Thanks Jim,
Did I can this way to save the pages 28 and 29 of the MC9S12DP512 flash memory? 
0 Kudos
Reply

888 Views
JimDon
Senior Contributor III
This should only erase and burn the pages the pages selected. In my case this was 2, C000.

Did you try it?
0 Kudos
Reply

888 Views
IgorN
Contributor II
It isn't help. Pages 28 and 29 are erased. I'm found the file p&e_erase_unsecure_hcs12.cmd in the ...\cmd directory of the project. It contain this info:
 
// HCS12 Core erasing + unsecuring command file:
// These commands mass erase the chip then program the security byte to 0xFE (unsecured state).
// Evaluate the clock divider to set in ECLKDIV/FCLKDIV registers:
// An average programming clock of 175 kHz is chosen.
// If the oscillator frequency is less than 10 MHz, the value to store
// in ECLKDIV/FCLKDIV is equal to " oscillator frequency (kHz) / 175 ".
// If the oscillator frequency is higher than 10 MHz, the value to store
// in ECLKDIV/FCLKDIV is equal to " oscillator frequency (kHz) / 1400  + 0x40 (to set PRDIV8 flag)".
// Datasheet proposed values:
//
// oscillator frequency     ECLKDIV/FCLKDIV value (hexadecimal)
//
//  16 MHz              $49
//   8 MHz              $27
//   4 MHz              $13
//   2 MHz               $9
//   1 MHz               $4
define CLKDIV 0x49
FLASH MEMUNMAP   // do not interact with regular flash programming monitor
//mass erase flash
wb 0x100 CLKDIV  // set FCLKDIV clock divider
wb 0x103 0       // FCFNG select block 0
wb 0x102 0x10    // set the WRALL bit in FTSTMOD to affect all blocks
wb 0x104 0xFF    // FPROT all protection disabled
wb 0x105 0x30    // clear PVIOL and ACCERR in FSTAT register
ww 0x108 0xD000  // write to FADDR address register
ww 0x10A 0x0000  // write to FDATA data register
wb 0x106 0x41    // write MASS ERASE command in FCMD register
wb 0x105 0x80    // clear CBEIF in FSTAT register to execute the command
wait 20          // wait for command to complete
//mass erase eeprom
wb 0x110 CLKDIV  // set ECLKDV clock divider
wb 0x114 0xFF    // EPROT all protection disabled
wb 0x115 0x30    // clear PVIOL and ACCERR in ESTAT register
ww 0x118 0x0400  // write to EADDR eeprom address register
ww 0x11A 0x0000  // write to EDATA eeprom data register
wb 0x116 0x41    // write MASS ERASE command in ECMD register
wb 0x115 0x80    // clear CBEIF in ESTAT register to execute the command
wait 20          // wait for command to complete
reset
//reprogram Security byte to Unsecure state
wb 0x100 CLKDIV  // set FCLKDIV clock divider
wb 0x103 0       // FCFNG select block 0
wb 0x104 0xFF    // FPROT all protection disabled
wb 0x105 0x30    // clear PVIOL and ACCERR in FSTAT register
ww 0xFF0E 0xFFFE // write security byte to "Unsecured" state
wb 0x106 0x20    // write MEMORY PROGRAM command in FCMD register
wb 0x105 0x80    // clear CBEIF in FSTAT register to execute the command
wait 20          // wait for command to complete
reset
FLASH MEMMAP     // restore regular flash programming monitor
undef CLKDIV     // undefine variable
 
Did I need to change anuthing there?
0 Kudos
Reply

888 Views
JimDon
Senior Contributor III
if you remove AUTOERASEANDFLASH it should not be running that. There is also a dialog in the debugger where you can disable command files.
 
0 Kudos
Reply