usb BDM. How to program flash & leave Eeprom as is

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

usb BDM. How to program flash & leave Eeprom as is

Jump to solution
10,653 Views
mDavid
Contributor I
Hello,
I am working on a MC9S12DG128B. We are in the developement phase of the project so we program constanly the chip with the USB multilink from PE.. The problem I have is that we need to keep some information on the chip EEProm. This information is generated buy the code itself so we can not have a S19 file to program each time . It is crutial for the debuging of the code that the memory of the EEprom is not erase each time we program the Chip with the USB multilink.
Is there a setting in codewarrior that can tell the USB multilink BDM not to erase the EEprom memory space when reprogramming the chip.
Thank's for the Help
 
David
Labels (1)
Tags (1)
0 Kudos
1 Solution
3,355 Views
CrasyCat
Specialist III
Hello
 
I assume you are using CW HC12 V4.5. AM I right?
 
There is a command AEFSKIPERASING available allowing you to do that.
 
Extract from {Install}\Release_Notes\HC12\Notes_debugger_icd12.txt:
 
" The new command AEFSKIPERASING has been created to specify non volatile memory blocks
 to protect from mass erasing at application loading.
 The command should be placed in a "Startup" command file.
 The command syntax is:
 FLASH AEFSKIPERASING <blockNo>
 with blockNo = {number["-"number][","]}
 
 For example, "FLASH AEFSKIPERASING 0,2-4" avoids erasing flash blocks 0,2,3,4.
 
 Reminder: Flash (and non volatile memory) modules and numbers can be displayed when
  typing the FLASH command in the Command window. Also the Flash/Non Volatile Memory
  dialog list displays all modules starting from block number 0."
 
So basically do the following:
 - Start the debugger
 - Enter command FLASH
 - Check which is the block number associated with the EEPROM block.
 - Edit your startup.cmd file and add the AEFSKIPERASING command there.
 
I hope this helps.
CrasyCat
 

View solution in original post

0 Kudos
36 Replies
3,356 Views
CrasyCat
Specialist III
Hello
 
I assume you are using CW HC12 V4.5. AM I right?
 
There is a command AEFSKIPERASING available allowing you to do that.
 
Extract from {Install}\Release_Notes\HC12\Notes_debugger_icd12.txt:
 
" The new command AEFSKIPERASING has been created to specify non volatile memory blocks
 to protect from mass erasing at application loading.
 The command should be placed in a "Startup" command file.
 The command syntax is:
 FLASH AEFSKIPERASING <blockNo>
 with blockNo = {number["-"number][","]}
 
 For example, "FLASH AEFSKIPERASING 0,2-4" avoids erasing flash blocks 0,2,3,4.
 
 Reminder: Flash (and non volatile memory) modules and numbers can be displayed when
  typing the FLASH command in the Command window. Also the Flash/Non Volatile Memory
  dialog list displays all modules starting from block number 0."
 
So basically do the following:
 - Start the debugger
 - Enter command FLASH
 - Check which is the block number associated with the EEPROM block.
 - Edit your startup.cmd file and add the AEFSKIPERASING command there.
 
I hope this helps.
CrasyCat
 
0 Kudos
2,463 Views
GonzaloVictorio
Contributor I
Hello,
 
I need to do the same thing as David, but I'm developing for the MC9S08DZ32 using CW HC(S)08 v5.1.
 
What can I do?
 
Thank you,

Message Edited by Gonzalo Victorio on 2006-12-1404:01 PM

0 Kudos
2,463 Views
CrasyCat
Specialist III
Hello
 
I assume you are using a Multilink or Cyclone Pro Connection. Am I right?
 
For HC08, you have to use the Expert mode programming.
To start Expert mode programming select MultilinkCyclonePro -> "Start Expert Mode Programmer".
There are commands available to fine tune the programming steps there.
 
From the manual:
"Start Expert Mode Programmer grants the user access to P&E’s graphical flash
programming utility, PROG08SZ. PROG08SZ lets an advanced user control the step-by step
execution of the flash erase/programming procedure. See Figure 13.16 on page 361.
More information on how to use PROG08SZ can be found on P&E Microcomputer
Systems website at: www.pemicro.com."
 
 
CrasyCat
0 Kudos
2,463 Views
GonzaloVictorio
Contributor I
Hello CrasyCat,
 
Correct... I'm using Multilink.
 
Using expert mode would be like something to do once you're in the debugging session, isn't?
 
I'm trying to achieve the same thing as the original post... Being able to work on the development compiling and debugging over and over again and keep the contents of the EEPROM. Is it possible to customize that?
 
Thank you,
Gonzalo
0 Kudos
2,463 Views
CrasyCat
Specialist III
Hello
 
If this is possible you have to use the Expert mode programming and find the appropriate set of command.
I am not an expert in P&E flash programming tool and commands.
 
I would suggest you to get more info about that on the P&E forum:
 
CrasyCat
0 Kudos
2,463 Views
GonzaloVictorio
Contributor I
pemicro seems to have a problem with their website... it would crash when I try to register with them so I cannot search their forums...
 
I've been messing around with the Expert Programmer and it does allow you to do many things but it doesn't look like it would be a very user-friendly way to acomplish what I want... you can either erase the whole module (EEPROM included) or in a sector-by-sector basis.
 
Just imagine you're working on a project where you need to keep the EEPROM contents (which by the way I would think is a very common need) and everytime you recompile/build your code you have to enter into this mode and erase every sector 1-by-1 and then load your code just built.
 
This seems to uggly to be true... I hope there's some help in the pemicro website and a way to create a script for doing this or something. I was hoping there was some help in the actual PROGHCS08 but the only thing under the Help menu is "About"...
 
Any help either on the freescale's CW or pemicro side will be greatly appretiated...
 
Thank you
0 Kudos
2,463 Views
AndyUK
Contributor I
Hi all,
 
I'm also having a similar problem. I'm using a HCS12DP256B, CW 3.1 and a P&E BDM-Multilink (Parallel version)
 
I want to program the flash with my code, but not erase the EEPROM each time I do.
 
I tried changing the 'Startup' file to include 'FLASH AEFSKIPERASING 0' - made no differance.
I tried changing the 'Preload' file to include 'FLASH SELECT 1-8' - also made no differance.
 
This is the reply I get after the FLASH command, so you can see which block is which.
 
!FLASH SELECT 1-8
!
!FLASH
     MCU clock speed: 7994000 Hz
Block Module Name      Address Range   Status
  0  EEPROM             400 -   FFF   Enabled/Programmed/Unprotected - Unselected
  1  FLASH_4000        4000 -  7FFF   Enabled/Programmed/Unprotected - Selected
  2  FLASH_C000        C000 -  FFFF   Enabled/Programmed/Unprotected - Selected
  3  FLASH_3         308000 -33BFFF   Enabled/Blank/Unprotected - Selected
  4  FLASH_2         348000 -37BFFF   Enabled/Blank/Unprotected - Selected
  5  FLASH_1         388000 -3BBFFF   Enabled/Blank/Unprotected - Selected
  6  FLASH_0         3C8000 -3FBFFF   Enabled/Programmed/Unprotected - Selected
!// erase the flash modules
!FLASH ERASE
executing .\cmd\p&e_vppon.cmd
Anyone got any more ideas ? I'm stuck !
 
Thanks
 
Andy
0 Kudos
2,463 Views
CrasyCat
Specialist III
Hello
 
AEFSKIPERASE was not available in CodeWarrior for HC12 V3.1 (as far as I remember).
 
can you give it a try with V4.5 or V4.6. The command is available there.
 
CrasyCat
0 Kudos
2,463 Views
AndyUK
Contributor I
Hi,
 
Is it a painless upgrade from 3.1 to 4.5 / 4.6 ?
 
Only when I went from 2.something to 3.1 it took my ages to get things to work correctly again. I can't remember what was wrong - I only recall it being a real pain !
 
Thanks
0 Kudos
2,463 Views
Alban
Senior Contributor II
Hi Andy,
 
For all my projects, I did not have any problem whatsoever.
I use my own definition files.
 
You might have some errors if definition files were updated.
But other than that I don't forsee any trouble.
 
Cheers,
Alban.
0 Kudos
2,463 Views
GonzaloVictorio
Contributor I
After several weeks... at the end my problem was fixed by modifying the S8P file that the debugger uses to load the code. Freescale support couldn't give me this answer though... which makes me wonder how much they know how their things work?
 
The original S8P file begins like this:
 
;version 1.02, 10/04/2006, Copyright P&E Microcomputer Systems, www.pemicro.com
;device Freescale, 9S08DZ32, All
;begin_cs
REQUIRES_PROG_VERSION=1.43/
WRITE_BYTE=03/00001802/       ;Clear COP Watchdog
WRITE_BYTE=FF/00001824/       ;Disable Flash Protection
DZ_EEPROM_PAGING=40/00001823/
BLANK_MODULE_ONLY
WRITE_BYTE_AND_SYNC=C0/00000049/  ;Bus Freq ~ 2MHZ
09BIT_TRIM=004A/004B/01/FFAF/FFAE/001E8840/
WRITE_BYTE_AND_SYNC=00/00000049/  ;Bus Freq ~ 16MHZ
 
The line in red was replace with:
WRITE_BYTE=3F/00001824/       ;Leave the eeprom protected
 
If you're in the same situation, you might want to try editing the S8P file of the device you're working on.
 
0 Kudos
2,463 Views
AndyUK
Contributor I
Well....
 
I've updated to 4.6, and I have to say that I had no problems installing it or getting it to work.
 
But......
 
I STILL can't get the Flash to program without it erasing the EEPROM as well !!!
 
It is driving me up the wall. How hard can it be I ask myself ?
 
I've tried the AEFSKIPERASING command, and the FLASH SELECT 1-8, thereby hoping it would leave block 0 (EEPROM) alone - but oh no, it just goes and erases the lot !
 
Please.... someone help me
 
Andy
0 Kudos
2,463 Views
CrasyCat
Specialist III
Hello
 
Where did you place the AEFSKIPERASE Command?
If should be placed in the preload command file.
 
CrasyCat
0 Kudos
2,463 Views
AndyUK
Contributor I
The second post in this thread states.....
 
The new command AEFSKIPERASING has been created to specify non volatile memory blocks
 to protect from mass erasing at application loading.
 The command should be placed in a "Startup" command file
 
But now you say it goes in the preload file ??
 
I am confused !
 
I think i've tried it in both anyway - but i'am not sure. If it does go in the preload file, does it need to go in any order ?
 
This is what is in my preload file now..
 
// Before load the commands written below will be executed
// The following commands must be enabled to load in flash with the ICD12.
// reset the device to get default settings
RESET
// initialize flash programming process
FLASH
// select the flash modules
FLASH SELECT 1-8
FLASH
// erase the flash modules
FLASH ERASE
// arm the flash for programming
FLASH ARM
 
I changed the 'FLASH SELECT' to be 'FLASH SELECT 1-8' in the hope that this would stop the erasing of the EEPROM
 
Thanks
 
Andy

 
 
0 Kudos
2,463 Views
CrasyCat
Specialist III
Hello
 
When you are using V4.5 and higher, the debugger is set up to automatically erase and program the flash. So you do not need all these commands in the preload.cmd file.
 
I would suggest you to remove those commands from the preload.cmd file and replace them with
  FLASH AEFSKIPERASING 0
The latest release notes recommend to place that command in preload.cmd file now.
 
If this does not work, you need to submit a service request  for that.
 
To log the issue please go to following URL:
    http://www.freescale.com/TechSupport
and click on "Submit a service request"
 
Make sure to attach a project reproducing the issue to your SR and to provide Installed product information.
  To retrieve that info:
    - Start CodeWarrior
    - Select Help -> About Freescale CodeWarrior
    - Click on "Install Products"
    - Click on Save As, save content of the dialog to a file and attach the file to the SR
CrasyCat
0 Kudos
2,463 Views
AndyUK
Contributor I
OK.
 
So I can remove all the commands from the preload file, including RESET etc ?
 
The file was created under 3.1 so this might be causing me the problems. I'm not in the office right now, but I will try this when I return.
 
Many Thanks for your help
 
Andy
0 Kudos
2,463 Views
Alban
Senior Contributor II
Hi Andy,
 
Yes, you can empty all the command files.
Keep the unsecure 12 command file somewhere as it comes handy if you lose all comms with an S12. (if you secure it or crashed the programming during procedure)
 
Cheers,
Alban.
0 Kudos
2,463 Views
CrasyCat
Specialist III
Hello
 
Just a quick update on this one.
 
CodeWarrior for MCU V6.0 is available for download from our web site at following URL:
 
This release supports HC08/HCS08/RS08 and Coldfire V1.
 
The P&E Multilink/Cyclone Pro connection has been extended in that product and you can now tell the debugger you want to skip some memory area while downloading code.
 
Just select "Advanced programming/Debugging Options" in the Multilink/CyclonePro menu and then indicate the memory areas you want to keep as is in the "Non volatile memory Preservation" group.
 
CrasyCat
0 Kudos
2,463 Views
Byar
Contributor I
I'm wanting to do a very similar thing as the user above.  I am using CodeWarrior for MCU V6.0 and I can see the options you are referencing but they are grayed out.  I am currently connected via the MON08 serial debugger and not a BDM pod. 

Is my connection method the reason the advanced options are unavailable?
If so, are there any other options to accomplish the same task?

Thanks,

Byar
0 Kudos
2,463 Views
CrasyCat
Specialist III
Hello
 
The feature might be available for BDM connections (HCS08) only.
One of our support engineer might know the answer.
 I would recommend you to submit a service request for that.

Click here to submit a service request.
CrasyCat
0 Kudos