EmbDev.net

Forum: ARM programming with GCC/GNU tools need help with debugging Cortex M3 (STM32) using Eclipse, YAGARTO and J-Link


von jera (Guest)


Rate this post
useful
not useful
Hi,

I'm trying to set up a development environmet for ARM Cortex M3 
(STM32F107) on windows XP. I'm using Eclipse (with Zylin plugin), 
YAGARTO, gdb and J-Link debugging hw. All of these are new to me and I'm 
bit confused with all the script and config files.

Getting freeRTOS to work is the target and I found an example project 
close to my setup from here: 
http://developers.stf12.net/just-another-eclipse-demo-str91x To start 
with I modifyed it to be only a led blinker without rtos and can compile 
it. I have currently the STM32CMICOS-EVAL board 
(http://www.st.com/stonline/products/literature/um/16173.pdf) with 
J-Link On Board chip and later possible some other board as well. J-Link 
gdb server is recognizing the target.

As mentioned, I can compile but the above example uses different jtag hw 
so flashing and debugging still needs some work and here are my 
questions.
1. Which script and config files (and makefile settings) are controlling 
flashing and debugging?
2. Is there tutorials/examples for the files?
3. Can I break something with wrong config files?

I'm already followed applicable parts of the following tutorials:
http://developers.stf12.net/eclipse-demo
http://embeddedcraft.org/freearmtools2.html
http://www.yagarto.de/howto.html


jera

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
> 1. Which script and config files (and makefile settings) are controlling
> flashing and debugging?
Eclise uses the Zylin Plugin to talk to a gdb-server via the gdb-client 
(arm-*-gdb). In your case it's the gdb-server from Segger. Did you 
configure TCP/IP port correctly (2331 for J-Link gdb-server IRC)?

For flashing the makefile might include calls to an external 
flash-programming software but this is not realy needed for debugging. 
Just an elf-file is needed.

If you can call a programming-software from Segger from the command line 
you can add this call to the makefile, in example in a programm target. 
But this is not related to debugging or Eclipse.

> 2. Is there tutorials/examples for the files?
I don't know if the J-Link gbd-server has a flash-programming interface. 
If yes, the gdb-command load can be used for flashing. There is no need 
for a special file.

> 3. Can I break something with wrong config files?
I don't think so.

> I'm already followed applicable parts of the following tutorials:
> http://developers.stf12.net/eclipse-demo
You are using the J-Link gdb-server instead of OpenOCD, but the basic 
concept is the same as shown in this tutorial.

> http://embeddedcraft.org/freearmtools2.html
This is not too helpful since Insight is used as debugging frontend, not 
the debugger in Eclipse.

> http://www.yagarto.de/howto.html
You may want to re-read http://www.yagarto.de/howto/yagarto2/index.html


Sorry, no real "fist hand" recommendations, maybe someone else can write 
a little bit more on this. I'm using another hardware-interface 
(FTDI2232-based), another gdb-server (OpenOCD) and another plugin 
("official" Eclipse/CDT gdb-hardware-debugging plugin).
You may also ask in Segger's support-forum or write an e-mail to the 
address mentioned in the imprint or yagarto.de

von jera (Guest)


Rate this post
useful
not useful
Thank you for your answer. I managed to get it sort of working, program 
is downloaded to flash and debugging is partially working. When single 
stepping over for loop (used as delay) program runs away i.e. cursor 
never comes back and target must be hardware reseted. Here are my gdb 
initialization commands.
1
target extended-remote localhost:2331
2
monitor endian little
3
monitor reset
4
monitor sleep 500
5
monitor speed auto
6
set remote memory-write-packet-size 1024
7
set remote memory-write-packet-size fixed
8
monitor flash device = STM32F107VC
9
monitor flash download = 1
10
load RTOSDemo.axf
11
monitor reset
12
break main
13
continue

Does that look like reasonable?

How it is selected is the debugging performed from flash or RAM?

In some gdb initialization examples there were commands for setting PLL. 
Is that needed? What clock frequency is selected without any commands?

jera

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
jera wrote:
>...
> Does that look like reasonable?
The monitor commands are J-Link gdb-server specific. List looks 
reasonable to me but as written, I'm using another gdb-server. Someone 
else needs to comment on this.

> How it is selected is the debugging performed from flash or RAM?
You already have "from Flash". For "from RAM" Link the application into 
addresses in the RAM's address-range (linker-script/setup)

At debugger-startup:
- set the Stack-pointer to first value in vector-table
- set PC to second value in vector-table-table
- make sure the NVIC-offset position is set to the start-address in RAM 
early (before an interrupt can occur).
The steps can be implemented as additional commands in you 
initialization list.

> In some gdb initialization examples there were commands for setting PLL.
> Is that needed?
Some targets start at a very slow coreclock (in example 32kHz). So the 
PLL gets initializes very early the achieve reasonable 
communication/transfer speeds.

> What clock frequency is selected without any commands?
Depends on target. Some targets offer external pins of non-volatile 
memory-sections to set this up. In your case: If /SRST is asserted and 
deasserted during "monitor reset" the clock will be the default clock 
after reset as mentioned see STM32 reference-guide.

von jera (Guest)


Rate this post
useful
not useful
Apparently OpenOCD supports also J-Link and I may use that as well. How 
would you write similar (flash download and debug) initialization 
commands for OpenOCD?

jera

P.S. For J-Link GDB server there shuld be "remote" instead of 
"extended-remote".

von zyklopen (Guest)


Rate this post
useful
not useful
Hi,

I have recently tried OpenOCD for flash operations on STM32F101 ICs and 
I can confirm that it works (for the features I tried). I used a current 
snapshot from the 0.5.0-dev branch, tagged 
91305bfa7f550c96b967008c1512864cffdaa52a, of the github, in conjunction 
with the new libusb-win32 V1.2.1.0.

I compiled and ran OpenOCD with the current version of Cygwin (1.7.5) on 
XP.
My JLink firmware is V6.

In the past, I used to try OpenOCD/JLink/STM32/XP with several releases 
and RCs, but to no avail -- the OpenOCD console was flooded with errors.

GDB I have not tried yet, neither more sophisticated features.

Regards,
zyklopen

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.