CodeWarrior Flash Programming from a DOS Shell


I can do test automation or standalone flash programming using the Debugger Shell. But this requires me to use a view inside of Eclipse. What would be nice is to do such things from a lower level: from a Windows Command window (CMD or DOS Shell). This is possible with usage of Eclipse/CodeWarrior in command line mode.

In Show Workspace Location in the Title Bar I have used the Eclipse feature to launch it with command line arguments. A list of command line arguments is documented here. There is an interesting option: Using the -data argument I can specify the workspace:

"c:\Freescale\CW MCU v10.2\eclipse\cwide.exe" -data "c:\tm
p\wsp_StandaloneFlsh"
cmd.exe launching eclipse with a workspace

cmd.exe launching eclipse with a workspace

Note that there are two different executable I can use

  • cwide.exe: this is what I launch normally. If I call this one from my DOS shell, then it will not wait until Eclipse has finished
  • cwidec.exe: The difference to cwide.exe is that this one will wait until Eclipse finishes.

But there is one more magic option: the -vmargsplus argument:

vmargsplus argument description in the documentation

vmargsplus argument description in the documentation

Aha! That way I can execute any Debugger Shell script from the DOS shell :-) . What I needed to do is to add quitIDE to my script to flash a board:

############################################################
# Standalone.tcl: a script file to flash my application
############################################################

# in any case, disconnect an existing debug connection
fl::disconnect

# set launch configuration:
fl::target -lc "LC for Simple Flash"

# set Set the target RAM buffer for downloading image data:
fl::target -b 0x20000000 0xffff

# switch off verify and logging:
fl::target -v off -l off

# select flash device, organization and memory range:
cmdwin::fl::device -d "CFM_MCF5225X_512" -o "256Kx16x1" -a 0x0 0x7ffff

# specify target file, auto detect format, range settings on followed by the flash range, offset settings off
cmdwin::fl::image -f "C:\\tmp\\wsp_StandaloneFlsh\\Application.S19" -t "Auto Detect" -re on -r 0x0 0x7ffff -oe off

# now erase the flash...
cmdwin::fl::erase image

# ... followed by writing the application to flash:
cmdwin::fl::write

# disconnect connection
fl::disconnect

# exit Eclipse IDE
quitIDE

From the DOS shell, I launch it like this:

"c:\Freescale\CW MCU v10.2\eclipse\cwide.exe" -data "c:\tm
p\wsp_StandaloneFlsh" -vmargsplus -Dcw.script="c:\tmp\wsp_StandaloneFlsh\standalone.tcl"

That way no user interaction is required: launching a batch file and things are flashed to the board.

Happy Shelling :-)

About these ads

7 thoughts on “CodeWarrior Flash Programming from a DOS Shell

  1. Additional info to consider. If you want for DOS shell script to wait for Eclipse/CodeWarrior exit (e.g. to finish flashing to target), you should use “cwidec.exe”

      • I tried to do the same with “C:\Program Files\Freescale\CW MCU v10.1\eclipse\cwide.exe” -data “C:\Documents and Settings\testuser\Desktop\flash_proj” -vmargsplus -Dcw.script=”C:\Documents and Settings\testuser\Desktop\flash_proj\script.tcl”
        This open IDE. But my script is not running and I am not able to flash. What might be going wrong here? Please help…………

      • I see that your command line is showing MCU v10.1. So it very likely could be that this functionality does not exist in this version. Have you tried it with MCU10.3?

    • Ok Erich. I am able to run the scripts in the debugger shell after opening IDE. And it is working fine. Thanks for the info provided. I have one more doubt. If I want to erase flash from location 0×4000 to end of flash, How do I need to pass the arguments for fl::erase command?
      Please help.

      Thanks,
      Jagadeesh.

  2. The paper is very helpful to me.
    I would like to have a question that how can we pass parameters to the tcl scripts as Command Line Arguments, It looks like:
    -Dcw.script=add.tcl 23 15

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s