Help on Codewarrior debugger cmd files

Started by apedroso11 March 21, 2006
Hi all,

I want the codewarrior (CW) debugger to erase only a part of the flash 
when it starts.

I can see in the "P&E_ICD_Erase_unsecure_hcs12.cmd" file that the 
debugger will make a MASS ERASE before programming the flash.

I want to keep my bootloader programmed into the flash although any of 
my colleges use the debugger on our targets. I can't find documentation 
regarding debugger commands.

Does anyone can help me on this topic?

Any other idea to keep the bootloader programmed?

thanks in advance.

Agustin
	
Hi Augustin.

The "P&E_ICD_Erase_unsecure_hcs12.cmd" is NOT the file that is
executed 
when you start debugging your application. This file is only called when 
you select the "Unsecure..." menu entry, in order to Unsecure the chip
when 
"BDM-secured".

Before giving you more hints, please type the "VER" command in a
Command 
window.
I need to know which version of the ICD12 (or P&E Multilink/Cyclone Pro) 
DLL you have.

you should get, for example:

ICD12 6.1.9 Build xxxx
or
P&E Multilink/Cyclone Pro 6.1.14 Build xxxx

Regards,
Gilles
	At 03:38 PM 3/21/2006, you wrote:
>Hi all,
>
>I want the codewarrior (CW) debugger to erase only a part of the flash
>when it starts.
>
>I can see in the "P&E_ICD_Erase_unsecure_hcs12.cmd" file that
the
>debugger will make a MASS ERASE before programming the flash.
>
>I want to keep my bootloader programmed into the flash although any of
>my colleges use the debugger on our targets. I can't find documentation
>regarding debugger commands.
>
>Does anyone can help me on this topic?
>
>Any other idea to keep the bootloader programmed?
>
>thanks in advance.
>
>Agustin
>
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
>
	
this is what I get after typing VER:

in>VER
HI-WAVE          6.1.42 Build 3249
HI-WAVE Engine   6.1.68 Build 4047
Source           6.1.27 Build 3249
Assembly         6.1.20 Build 3249
Procedure        6.1.13 Build 3249
Register         6.1.20 Build 3249
Memory           6.1.30 Build 3249
Data             6.1.37 Build 3249
Data             6.1.37 Build 3249
Command Line     6.1.24 Build 3249
ICD-12 Target    6.1.12 Build 5023
   68HC12 Interface Libraries Version 2.62 (http://www.pemicro.com)

Thank you!

--- In 68HC12@68HC..., Gilles Blanquin <gilles.blanquin@...> 
wrote:
>
> 
> Hi Augustin.
> 
> The "P&E_ICD_Erase_unsecure_hcs12.cmd" is NOT the file that
is 
executed 
> when you start debugging your application. This
file is only called 
when 
> you select the "Unsecure..." menu entry,
in order to Unsecure the 
chip when 
> "BDM-secured".
> 
> Before giving you more hints, please type the "VER" command in a 
Command 
> window.
> I need to know which version of the ICD12 (or P&E Multilink/Cyclone 
Pro) 
> DLL you have.
> 
> you should get, for example:
> 
> ICD12 6.1.9 Build xxxx
> or
> P&E Multilink/Cyclone Pro 6.1.14 Build xxxx
> 
> Regards,
> Gilles
> 
> 
> At 03:38 PM 3/21/2006, you wrote:
> >Hi all,
> >
> >I want the codewarrior (CW) debugger to erase only a part of the 
flash
> >when it starts.
> >
> >I can see in the "P&E_ICD_Erase_unsecure_hcs12.cmd" file
that the
> >debugger will make a MASS ERASE before programming the flash.
> >
> >I want to keep my bootloader programmed into the flash although 
any of
> >my colleges use the debugger on our targets. I
can't find 
documentation
> >regarding debugger commands.
> >
> >Does anyone can help me on this topic?
> >
> >Any other idea to keep the bootloader programmed?
> >
> >thanks in advance.
> >
> >Agustin
> >
> >
> >
> >
> >
> >
> >Yahoo! Groups Links
> >
> >
> >
> >
>
	
Agustin,
	First:
-----

The new command "FLASH 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 "Preload" command file of your
project 
(reported in the ICD12 release note).
	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.

When used, the "FLASH AEFSKIPERASING" command should be placed in the
"Preload" command file.
	Then:
-----

I have posted a new flash driver library (only valid for ICD12 v6.1.11 and 
later revisions) that features a clear separation between range $4000-7FFF 
and $C000-FFFF.

http://f6.grp.yahoofs.com/v1/ACMgRFD_6IwA6isqdF2ATh0PMhKX_gPPCIkVb8x3an3jAdT 
QMlpda78tvhQ8NijeLo31Ig8XxMAErT18AGJSDJ26iGo/fpp%27s%20for%20%20CW12V31%20an 
d%20ICD12%20v6.1.11%20and%20later%20releases.zip
	The driver lists, for DP256:

    0  EEPROM
    1  FLASH_4000
    2  FLASH_C000
    3  ALL_PPAGES
    4  FLAT8000_P30
	"FLASH AEFSKIPERASING 3" will avoid erasing all PPAGES, but sectors
in 
$4000 and in $C000 will be erased, and eeprom (there is no erasing 
implemented in FLAT8000_P30).

Installation:

-debugger closed.
-in CodeWarrior installation, "prog" folder, rename the
"fpp" folder.
-create a new "fpp" folder and unzip all posted files in this folder.

Finally:

If you want to keep the bootloader, I guess you will prevent the FLASH_C000 
from being erased.
If you want a finer granularity, you will have to use debugger commands to 
erase by sector. You then can forget all this here above. The debugger does 
not provide this granularity currently. But I can post you a command script 
to do this, if you want.

I hope this help.

Regards,
Gilles
	At 04:33 PM 3/21/2006, you wrote:
>this is what I get after typing VER:
>
>in>VER
>HI-WAVE          6.1.42 Build 3249
>HI-WAVE Engine   6.1.68 Build 4047
>Source           6.1.27 Build 3249
>Assembly         6.1.20 Build 3249
>Procedure        6.1.13 Build 3249
>Register         6.1.20 Build 3249
>Memory           6.1.30 Build 3249
>Data             6.1.37 Build 3249
>Data             6.1.37 Build 3249
>Command Line     6.1.24 Build 3249
>ICD-12 Target    6.1.12 Build 5023
>    68HC12 Interface Libraries Version 2.62 (http://www.pemicro.com)
>
>Thank you!
>
>--- In 68HC12@68HC..., Gilles Blanquin <gilles.blanquin@...>
>wrote:
> >
> >
> > Hi Augustin.
> >
> > The "P&E_ICD_Erase_unsecure_hcs12.cmd" is NOT the file
that is
>executed
> > when you start debugging your application. This file is only called
>when
> > you select the "Unsecure..." menu entry, in order to
Unsecure the
>chip when
> > "BDM-secured".
> >
> > Before giving you more hints, please type the "VER" command
in a
>Command
> > window.
> > I need to know which version of the ICD12 (or P&E
Multilink/Cyclone
>Pro)
> > DLL you have.
> >
> > you should get, for example:
> >
> > ICD12 6.1.9 Build xxxx
> > or
> > P&E Multilink/Cyclone Pro 6.1.14 Build xxxx
> >
> > Regards,
> > Gilles
> >
> >
> > At 03:38 PM 3/21/2006, you wrote:
> > >Hi all,
> > >
> > >I want the codewarrior (CW) debugger to erase only a part of the
>flash
> > >when it starts.
> > >
> > >I can see in the "P&E_ICD_Erase_unsecure_hcs12.cmd"
file that the
> > >debugger will make a MASS ERASE before programming the flash.
> > >
> > >I want to keep my bootloader programmed into the flash although
>any of
> > >my colleges use the debugger on our targets. I can't find
>documentation
> > >regarding debugger commands.
> > >
> > >Does anyone can help me on this topic?
> > >
> > >Any other idea to keep the bootloader programmed?
> > >
> > >thanks in advance.
> > >
> > >Agustin
> > >
> > >
> > >
> > >
> > >
> > >
> > >Yahoo! Groups Links
> > >
> > >
> > >
> > >
> >
>
>
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
>
	
Thank you! This is what I need!

When you say "a finer granularity" you mean that if I want to erase
only 
part of a page, I will have to use debugger commands as "wb"
"ww" to 
configure flash to write sector by sector?

I guess my bootloader will take only 2K of protected flash area (at the 
end of its development) and I will have to erase all flash but the 
protected area when the debugger starts. Is this what you say that will 
need more granularity?

regards.
	Gilles Blanquin escribi
>
> Agustin,
>
>
> First:
> -----
>
> The new command "FLASH 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 "Preload" command file of your
project
> (reported in the ICD12 release note).
>
>
> 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.
>
> When used, the "FLASH AEFSKIPERASING" command should be placed in
the
> "Preload" command file.
>
>
> Then:
> -----
>
> I have posted a new flash driver library (only valid for ICD12 v6.1.11 
> and
> later revisions) that features a clear separation between range 
> $4000-7FFF
> and $C000-FFFF.
> 
>
http://f6.grp.yahoofs.com/v1/ACMgRFD_6IwA6isqdF2ATh0PMhKX_gPPCIkVb8x3an3jAdT 
>
>
QMlpda78tvhQ8NijeLo31Ig8XxMAErT18AGJSDJ26iGo/fpp%27s%20for%20%20CW12V31%20an 
>
> d%20ICD12%20v6.1.11%20and%20later%20releases.zip
>
>
> The driver lists, for DP256:
>
>     0  EEPROM
>     1  FLASH_4000
>     2  FLASH_C000
>     3  ALL_PPAGES
>     4  FLAT8000_P30
>
>
> "FLASH AEFSKIPERASING 3" will avoid erasing all PPAGES, but
sectors in
> $4000 and in $C000 will be erased, and eeprom (there is no erasing
> implemented in FLAT8000_P30).
>
> Installation:
>
> -debugger closed.
> -in CodeWarrior installation, "prog" folder, rename the
"fpp" folder.
> -create a new "fpp" folder and unzip all posted files in this
folder.
>
> Finally:
>
> If you want to keep the bootloader, I guess you will prevent the 
> FLASH_C000
> from being erased.
> If you want a finer granularity, you will have to use debugger 
> commands to
> erase by sector. You then can forget all this here above. The debugger 
> does
> not provide this granularity currently. But I can post you a command 
> script
> to do this, if you want.
>
> I hope this help.
>
> Regards,
> Gilles
>
>
> At 04:33 PM 3/21/2006, you wrote:
> >this is what I get after typing VER:
> >
> >in>VER
> >HI-WAVE          6.1.42 Build 3249
> >HI-WAVE Engine   6.1.68 Build 4047
> >Source           6.1.27 Build 3249
> >Assembly         6.1.20 Build 3249
> >Procedure        6.1.13 Build 3249
> >Register         6.1.20 Build 3249
> >Memory           6.1.30 Build 3249
> >Data             6.1.37 Build 3249
> >Data             6.1.37 Build 3249
> >Command Line     6.1.24 Build 3249
> >ICD-12 Target    6.1.12 Build 5023
> >    68HC12 Interface Libraries Version 2.62 (http://www.pemicro.com) 
> <http://www.pemicro.com%29>
> >
> >Thank you!
> >
> >--- In 68HC12@68HC..., Gilles Blanquin <gilles.blanquin@...>
> >wrote:
> > >
> > >
> > > Hi Augustin.
> > >
> > > The "P&E_ICD_Erase_unsecure_hcs12.cmd" is NOT the
file that is
> >executed
> > > when you start debugging your application. This file is only
called
> >when
> > > you select the "Unsecure..." menu entry, in order to
Unsecure the
> >chip when
> > > "BDM-secured".
> > >
> > > Before giving you more hints, please type the "VER"
command in a
> >Command
> > > window.
> > > I need to know which version of the ICD12 (or P&E
Multilink/Cyclone
> >Pro)
> > > DLL you have.
> > >
> > > you should get, for example:
> > >
> > > ICD12 6.1.9 Build xxxx
> > > or
> > > P&E Multilink/Cyclone Pro 6.1.14 Build xxxx
> > >
> > > Regards,
> > > Gilles
> > >
> > >
> > > At 03:38 PM 3/21/2006, you wrote:
> > > >Hi all,
> > > >
> > > >I want the codewarrior (CW) debugger to erase only a part of
the
> >flash
> > > >when it starts.
> > > >
> > > >I can see in the
"P&E_ICD_Erase_unsecure_hcs12.cmd" file that the
> > > >debugger will make a MASS ERASE before programming the flash.
> > > >
> > > >I want to keep my bootloader programmed into the flash
although
> >any of
> > > >my colleges use the debugger on our targets. I can't find
> >documentation
> > > >regarding debugger commands.
> > > >
> > > >Does anyone can help me on this topic?
> > > >
> > > >Any other idea to keep the bootloader programmed?
> > > >
> > > >thanks in advance.
> > > >
> > > >Agustin
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >>.
>
>
> 
>

-- 
------------
Agustin Pedroso Rizaldos
Software Engineer
R&D deparment
SEDECAL, S.A.
Tel. (+34)91 628 92 35
Fax. (+34)91 628 05 74
C/ Pelaya 9
Polono Ind. "Rio de Janeiro"
28110 Algete (Madrid)- Espa
-----------
	
Agustin,

The Flash Programmer is currently only handling some ranges, as they are 
listed.
Indeed, if you want to erase one sector, you will not be able to do it 
"transparently".

CodeWarrior for HC(S)12 does not provide a sector granularity for flash
erasing. Also the Flash Programmer will overwrite all protections to get a 
full
access and will eventually erase the entire part.
	However, please find here below a script example that you can adapt to
erase the sectors you want.
	The "erasesectors.cmd" script example here below erases sector in
ppage
$3E, except the last one. Create the file, adapt it to what you want to
erase, and store it in the same folder as your project.

You can call the script from a Startup file, or from the Command window, 
for example, with the CF command.

CF erasesectors.cmd

(if you enter CF without parameter, you can browse for the file).

//***** BEGIN: erasesectors.cmd file ***************
	// 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
define iblock 0
define asector 0x8000
	FLASH RELEASE   // do not interact with Flash Programmer
	wb 0x100 CLKDIV
	for asector=0x8000..0xAE00,0x200

wb 0x103 0           // Set Block Pointer bits to block 0
wb 0x105 0x30        // clear PVIOL and ACCERR in FSTAT register
wb 0x30  0x3E        // Set Page Register (here PPAGE $3E)
wb 0x102 0x00        // clear FTSTMOD
wb 0x104 0xFF        // Disable Protection
wb 0x105 0x30        // clear PVIOL and ACCERR in FSTAT register
ww asector 0         // Write to Flash to set address, data
wb 0x106 0x40        // write SECTOR ERASE  in FCMD reg
wb 0x105 0x80        // clear CBEIF in FSTAT  to execute command
wait 1               // wait for 100 ms - wait for command to complete

endfor
	//***** END: erasesectors.cmd file ***************
	Regards,
Gilles
	At 06:08 PM 3/21/2006, you wrote:
>Thank you! This is what I need!
>
>When you say "a finer granularity" you mean that if I want to
erase only
>part of a page, I will have to use debugger commands as "wb"
"ww" to
>configure flash to write sector by sector?
>
>I guess my bootloader will take only 2K of protected flash area (at the
>end of its development) and I will have to erase all flash but the
>protected area when the debugger starts. Is this what you say that will
>need more granularity?
>
>regards.
>
>
>Gilles Blanquin escribi
> >
> > Agustin,
> >
> >
> > First:
> > -----
> >
> > The new command "FLASH 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 "Preload" command file of
your project
> > (reported in the ICD12 release note).
> >
> >
> > 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.
> >
> > When used, the "FLASH AEFSKIPERASING" command should be
placed in the
> > "Preload" command file.
> >
> >
> > Then:
> > -----
> >
> > I have posted a new flash driver library (only valid for ICD12 v6.1.11
> > and
> > later revisions) that features a clear separation between range
> > $4000-7FFF
> > and $C000-FFFF.
> > 
> > 
>
http://f6.grp.yahoofs.com/v1/ACMgRFD_6IwA6isqdF2ATh0PMhKX_gPPCIkVb8x3an3jAdT
> >
> > 
>
QMlpda78tvhQ8NijeLo31Ig8XxMAErT18AGJSDJ26iGo/fpp%27s%20for%20%20CW12V31%20an
> >
> > d%20ICD12%20v6.1.11%20and%20later%20releases.zip
> >
> >
> > The driver lists, for DP256:
> >
> >     0  EEPROM
> >     1  FLASH_4000
> >     2  FLASH_C000
> >     3  ALL_PPAGES
> >     4  FLAT8000_P30
> >
> >
> > "FLASH AEFSKIPERASING 3" will avoid erasing all PPAGES, but
sectors in
> > $4000 and in $C000 will be erased, and eeprom (there is no erasing
> > implemented in FLAT8000_P30).
> >
> > Installation:
> >
> > -debugger closed.
> > -in CodeWarrior installation, "prog" folder, rename the
"fpp" folder.
> > -create a new "fpp" folder and unzip all posted files in
this folder.
> >
> > Finally:
> >
> > If you want to keep the bootloader, I guess you will prevent the
> > FLASH_C000
> > from being erased.
> > If you want a finer granularity, you will have to use debugger
> > commands to
> > erase by sector. You then can forget all this here above. The debugger
> > does
> > not provide this granularity currently. But I can post you a command
> > script
> > to do this, if you want.
> >
> > I hope this help.
> >
> > Regards,
> > Gilles
> >
> >
> > At 04:33 PM 3/21/2006, you wrote:
> > >this is what I get after typing VER:
> > >
> > >in>VER
> > >HI-WAVE          6.1.42 Build 3249
> > >HI-WAVE Engine   6.1.68 Build 4047
> > >Source           6.1.27 Build 3249
> > >Assembly         6.1.20 Build 3249
> > >Procedure        6.1.13 Build 3249
> > >Register         6.1.20 Build 3249
> > >Memory           6.1.30 Build 3249
> > >Data             6.1.37 Build 3249
> > >Data             6.1.37 Build 3249
> > >Command Line     6.1.24 Build 3249
> > >ICD-12 Target    6.1.12 Build 5023
> > >    68HC12 Interface Libraries Version 2.62
(http://www.pemicro.com)
> > <http://www.pemicro.com%29>
> > >
> > >Thank you!
> > >
> > >--- In 68HC12@68HC..., Gilles Blanquin <gilles.blanquin@...>
> > >wrote:
> > > >
> > > >
> > > > Hi Augustin.
> > > >
> > > > The "P&E_ICD_Erase_unsecure_hcs12.cmd" is NOT
the file that is
> > >executed
> > > > when you start debugging your application. This file is only
called
> > >when
> > > > you select the "Unsecure..." menu entry, in order
to Unsecure the
> > >chip when
> > > > "BDM-secured".
> > > >
> > > > Before giving you more hints, please type the
"VER" command in a
> > >Command
> > > > window.
> > > > I need to know which version of the ICD12 (or P&E
Multilink/Cyclone
> > >Pro)
> > > > DLL you have.
> > > >
> > > > you should get, for example:
> > > >
> > > > ICD12 6.1.9 Build xxxx
> > > > or
> > > > P&E Multilink/Cyclone Pro 6.1.14 Build xxxx
> > > >
> > > > Regards,
> > > > Gilles
> > > >
> > > >
> > > > At 03:38 PM 3/21/2006, you wrote:
> > > > >Hi all,
> > > > >
> > > > >I want the codewarrior (CW) debugger to erase only a
part of the
> > >flash
> > > > >when it starts.
> > > > >
> > > > >I can see in the
"P&E_ICD_Erase_unsecure_hcs12.cmd" file that the
> > > > >debugger will make a MASS ERASE before programming the
flash.
> > > > >
> > > > >I want to keep my bootloader programmed into the flash
although
> > >any of
> > > > >my colleges use the debugger on our targets. I can't
find
> > >documentation
> > > > >regarding debugger commands.
> > > > >
> > > > >Does anyone can help me on this topic?
> > > > >
> > > > >Any other idea to keep the bootloader programmed?
> > > > >
> > > > >thanks in advance.
> > > > >
> > > > >Agustin
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >>.
> >
> >
> > 
> >
>
>--
>------------
>Agustin Pedroso Rizaldos
>Software Engineer
>R&D deparment
>SEDECAL, S.A.
>Tel. (+34)91 628 92 35
>Fax. (+34)91 628 05 74
>C/ Pelaya 9
>Polono Ind. "Rio de Janeiro"
>28110 Algete (Madrid)- Espa
>-----------
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
>