Kirk Humphries

CodeWarrior Command File Script and A128 uP

Discussion created by Kirk Humphries Employee on Jan 29, 2006

This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.

 

Posted: Mon Sep 19, 2005  11:10 pm

 

Hi. I am CodeWarrior for HCS12 A128 microprocessor. I use a Multilink USB BDM with CodeWarrior to debug and load my firmware. I use the following command file to erase the flash on a preload:

 

// **********************************************************

// 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

// erase the flash modules

FLASH ERASE

// arm the flash for programming

FLASH ARM

// **************************************************************

 

The problem I am now having with this is that it also erases the EEPROM on the A128. I like this command script because it is fast but I do not want the EEPROM to be erased. Is there a way to do this? Thanks in advance.

 


 

Posted: Tue Sep 20, 2005  6:24 am

 

In your command file you have to state in the FLASH ERASE command what modules to erase. No parameters means erase all.

 

The modules are represented with a number and to find out the right number you have to check the modules list in the debugger (perhaps there is another way?). This is done with menu ICD-12->Flash... that opens a dialog window whith all modules listed. Starting from the top is module 0 and then module 1 and so on. My modules look like this:

 

Name Start End

=======================================

EEPROM 00002000 - 000027FF

FLASH_4000 00004000 - 00007FFF

FLASH_C000 0000C000 - 0000FFFF

PAGED 00388000 - 003FBFFF

 

So my FLASH ERASE looks like this (not erasing module 0):

 

// erase the flash modules

FLASH ERASE 1,2,3

 

If I remember correctly I also had some troubles to get the EEPROM module there in the first place and this had to be done by tweaking the .prm file manually (the Generate PRM file has to be set to No in the processor experts Bean Insopector build options tab).

 

This is how my prm file looks like. The important parts are EEPROM_AREA in SECTIONS and EEPROM in PLACEMENT.

 

NAMES

 

END

 

SECTIONS

/* List of all sections specified on the "Build options" tab */

RAM = READ_WRITE 0x00002000 TO 0x00003FFF;

ROM_C000 = READ_ONLY 0x0000C000 TO 0x0000CFFF;

ROM_4000 = READ_ONLY 0x00004000 TO 0x00007FFF;

ROM_PAGE38 = READ_ONLY 0x00388000 TO 0x0038BFFF;

ROM_PAGE39 = READ_ONLY 0x00398000 TO 0x0039BFFF;

ROM_PAGE3A = READ_ONLY 0x003A8000 TO 0x003ABFFF;

ROM_PAGE3B = READ_ONLY 0x003B8000 TO 0x003BBFFF;

ROM_PAGE3C = READ_ONLY 0x003C8000 TO 0x003CBFFF;

ROM_PAGE3D = READ_ONLY 0x003D8000 TO 0x003DBFFF;

EEPROM_AREA = NO_INIT 0x00000800 TO 0x00000FFF;

END

 

PLACEMENT

DEFAULT_RAM INTO RAM;

DEFAULT_ROM INTO ROM_PAGE38, ROM_PAGE39, ROM_PAGE3A,

ROM_PAGE3B, ROM_PAGE3C, ROM_PAGE3D;

_PRESTART, STARTUP,

ROM_VAR, STRINGS,

NON_BANKED, COPY INTO ROM_C000, ROM_4000;

EEPROM INTO EEPROM_AREA;

 

END

 

INIT _EntryPoint /* The entry point of the application. This function is generated into the CPU module. */

 

STACKSIZE 0x0180 /* Size of the system stack. Value can be changed on the "Build options" tab */

 


 

Posted: Tue Sep 20, 2005  6:41 am

 

"FLASH ERASE" is without option, therefore erasing all blocks of flash and eeprom (all displayed in Non Volatile Memory dialog). It is possible to simply specify blocks to erase, like, for example, "FLASH ERASE 0,3-5" to erase only flash blocks 0,3,4,5.

 

Also: Flash (and other 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.

 

Regards,

Outcomes