Test Driven Development (TDD) in Coldfire - Command line download

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

Test Driven Development (TDD) in Coldfire - Command line download

Jump to solution
3,019 Views
grilialex
Contributor II

I am starting to apply Test Driven Development methodologies using either Unity or CppUTest frameworks. In order to run my tests on target i need a batch file to download the executable to the target.

 

The development system i have is the Freescale USB BDM and Eclipse CW 10.1. The microcontroller is MCF52254 (internal flash). I have not find out any document on how to download and execute a file from command line.

 

Does anybody have any information regarding this?

 

Also i have difficulties compiling CppUTest. Has anybody managed to compile the framework to Coldfire?

 

Thanks in advance,

grilialex

Labels (1)
0 Kudos
Reply
1 Solution
2,270 Views
grilialex
Contributor II

Dear Tom,

thank you for your help.

I was using CW Eclipse V10.1 and upon startup i always had the Initialize RSE error (fail to initialize). This error began to happen when i upgraded from V10.0. After executing a full update the CWIDE was crashing. I believe the installation had some problems. I removed the 10.1 version and installed the V10.2.

 

This installation is working without any problems. I used the same batch files and they worked immediately.

One usefull tip for other is that you can actually launch your standard debug configurations instead of manually program the target. see example TCL script (MyApp_MCF52254_IntFlash USB TAP BDM is defined in my debug config):

 

debug {MyApp_MCF52254_IntFlash USB TAP BDM}
log s session.log
bp all off
bp -auto f_SysTickTimer
bp -auto SysTick.c 119
bp #6 ignore 3
bp #5 disable
go
wait 2000
status
v v_idx
display v_ErrLevel_ticks %d
log off
quitIDE

 

However i have one more question. When i setup breakpoints the given id is arbitrary. Is there a way to specify explicity the breakpoint id or to gather the id after a breakpoint set?

 

Thanks,

Ilias

View solution in original post

0 Kudos
Reply
10 Replies
2,270 Views
J2MEJediMaster
Specialist I

The Debugger Shell in the Debugger perspective of the Eclipse IDE has a built-in Tcl implementation that can be used to automate operations such as downloads to flash and software testing.

 

The attached training presentation is a bit old, but it covers the basics. It is directed towards StarCore parts, but the Debugger Shell of CodeWarrrior for MCUs v10.1 has the same capabilities. Hope this helps.

 

---Tom

0 Kudos
Reply
2,270 Views
grilialex
Contributor II

Dear Tom,

 

I tried today to run Eclipse in command line.

However although i managed to run the IDE, it seems that my tcl script is not loaded for execution (ie. the IDE sits idle).

I have tried the tcl commands in the debug console and they work. For some reason the IDE is not aware of the script.

I have tried to include the paths in quotes, slashes instead of backslashes and double backslashes, but i had still the same behavior.

 

"c:\Progs\Embedded\CW MCU v10.1\eclipse\cwide.exe" -data "c:\Users\SOMEPATH\Firmware\code\L1_V3_Project" -vmargsplus -Dcw.script=c:\\Users\\SOMEPATH\\L1_V3_Project\\BC5V300App_Final\\cmddbg.tcl

 

Also what is the difference between cwide and cwidec ?

 

BTW information about command line tools exists also at "Freescale Eclipse Extensions Guide"

 

Thanks in advance,

Ilias

 

0 Kudos
Reply
2,270 Views
J2MEJediMaster
Specialist I

Slashes and double-reverse slashes only work in the Debugger Shell. The command line for invoking the  script is in Windows Command Prompt, so single reverse slashes or quotes must be used.

 

Have you tried starting your script file from within the Debugger Shell to see if the shell reports a problem with it?

 

---Tom

0 Kudos
Reply
2,270 Views
JimDon
Senior Contributor III

Try deleteing all breakpoints first:

bp all off

 

0 Kudos
Reply
2,270 Views
grilialex
Contributor II

This command is already in the script. It worked manually on 10.1 but in 10.2 it does not start placing beakpoints from #1, but rather from #5. I do not know why. Does the debugger take account of other projects, inactive breakpoints?

 

Thanks,

Ilias

0 Kudos
Reply
2,270 Views
J2MEJediMaster
Specialist I

It sounds like something has changed in the v10.2 CW release. I would file a service request on that. Click here to start an on-line service request. Explain your situation in detail, and what has changed between version 10.1 and 10.2.

 

---Tom

0 Kudos
Reply
2,270 Views
grilialex
Contributor II

Added a SR (SR# 1-903519431 : Debugger - Breakpoint ID not same after).

Accepted by Freescale, and it would be resolved in an upcoming release.

 

Regards,

Ilias

 

0 Kudos
Reply
2,270 Views
grilialex
Contributor II

I add here the response of the CW expert team regarding the Breakpoint IDs.

 

Breakpoint IDs should be treated as an opaque handle, you should not expect them to have a specific value.

 

There are multiple reasons:

-     there would be id conflicts when having two simultaneous debug session. E.g. which project bp #1 would refer when debugging  two projects in in parallel?

-     Breakpoints set by user in source files before debug session (or left from previous debug session) precedes the ones that would be set by script. You would have random behavior depending on intentional/unintentional set of breakpoints before starting debug session.

 

Automation solution should rely on the fact that “bp” command will return bp id. You can assign the return value to a TCL variable and use it when referring to that variable.

E.g.

 

set bp_id [bp -auto main.c 21]

 

I have tried a similiar TCL statement but my syntax was apparently in error, so i missed that.

 

The automated script could be modified as follows (only related part is displayed, see previous posts):

 

bp all off
set bp_id [bp -auto SysTick.c 89]
bp #$bp_id ignore 3

 

This closes the automation part.

I will try to compile CppUTest for coldfire to close the process. I will post the results.

 

Thanks,

Ilias

 

0 Kudos
Reply
2,271 Views
grilialex
Contributor II

Dear Tom,

thank you for your help.

I was using CW Eclipse V10.1 and upon startup i always had the Initialize RSE error (fail to initialize). This error began to happen when i upgraded from V10.0. After executing a full update the CWIDE was crashing. I believe the installation had some problems. I removed the 10.1 version and installed the V10.2.

 

This installation is working without any problems. I used the same batch files and they worked immediately.

One usefull tip for other is that you can actually launch your standard debug configurations instead of manually program the target. see example TCL script (MyApp_MCF52254_IntFlash USB TAP BDM is defined in my debug config):

 

debug {MyApp_MCF52254_IntFlash USB TAP BDM}
log s session.log
bp all off
bp -auto f_SysTickTimer
bp -auto SysTick.c 119
bp #6 ignore 3
bp #5 disable
go
wait 2000
status
v v_idx
display v_ErrLevel_ticks %d
log off
quitIDE

 

However i have one more question. When i setup breakpoints the given id is arbitrary. Is there a way to specify explicity the breakpoint id or to gather the id after a breakpoint set?

 

Thanks,

Ilias

0 Kudos
Reply
2,270 Views
JimDon
Senior Contributor III

Tom,

Thanks for that.

However, in 10.1 using a V1, I get this:

%>fl::disconnect
%>fl::image -f MCF51JM128_Internal_Flash/SAMPLE_FRMWK.elf
%>fl::erase all

Error: <internal error>

 

However, I ran the flash programmer and borrowed this which does work:

fl::target -lc "LC for Simple Flash"
fl::target -b 0x800000 0x4000
fl::target -v off -l off
cmdwin::fl::device -d "MCF51JM128_FLASH" -o "128kx32x1" -a 0x0 0x1ffff
cmdwin::fl::erase all
cmdwin::fl::image -f "K:\\CWProjectsDEV\\WORKSPACE_DEV\\SAMPLE_FRMWK\\MCF51JM128_Internal_Flash\\SAMPLE_FRMWK.elf.S19" -t "Auto Detect" -re on -r 0x0 0x1ffff -oe off
cmdwin::fl::erase image
cmdwin::fl::write

 

 So, by running th flash programmer, you can see what to do for your chip....

0 Kudos
Reply