beginner Atollic question on printf/puts embedded STM32

Share code examples or discuss embedded software, including device drivers, interrupt handlers, middleware and application code.

Moderators: Markus Girdland, Mattias Norlander

tompe
Posts: 10
Joined: Sat May 05, 2018 12:06 pm

Re: beginner Atollic question on printf/puts embedded STM32

Postby tompe » Sat May 05, 2018 6:10 pm

Yes, I did exactly like explained in this video https://www.youtube.com/watch?v=BwgPV3uKuzY

Debug -> Start Trace -> Resume

mennamorato
Posts: 15
Joined: Mon Dec 04, 2017 2:04 pm

Re: beginner Atollic question on printf/puts embedded STM32

Postby mennamorato » Sat May 05, 2018 6:38 pm

yes! click on red dot

tompe
Posts: 10
Joined: Sat May 05, 2018 12:06 pm

Re: beginner Atollic question on printf/puts embedded STM32

Postby tompe » Sat May 05, 2018 7:18 pm

@mennamorato
But I did. First I start debugging, then click on the red dot to start tracing, then click on Resume to jump over first brake point and see my led blinking, i.e. the program runs but no output from printf().

:(

georgeb
Posts: 3
Joined: Sat May 05, 2018 5:18 pm

Re: beginner Atollic question on printf/puts embedded STM32

Postby georgeb » Sat May 05, 2018 9:57 pm

I suspect your clock is not correct. Did you initialise clocks first before your tests.
Also please verify that your debugger is not like theseImage. These have problems with swv.

If I read correct you wrote that with the same hardware/debuger you had printf working on other IDE, so this is not the case

My advise is to use a minimal project with correct clocks and use only itm_sendchar for testing. Last please enable LF external osc.

tompe
Posts: 10
Joined: Sat May 05, 2018 12:06 pm

Re: beginner Atollic question on printf/puts embedded STM32

Postby tompe » Sun May 06, 2018 12:58 pm

@georgeb
I in fact use the one on the left shown in the picture... thought the hardware of the clones is the same.

I now tried another minimal project with cubemx, no freertos and only 8MHz sysclk, no messages whatsoever. So the clocks shouldn't be the problem.

I will try to borrow another programmer from a friend and see if that works.

It is just interesting as with same settings printf() works on AC6 System Workbench and also in Eclipse after downloading the STM32 plug-in.
However, Atollic feels more rounded up to me and I would prefer using it for my future projects.

mennamorato
Posts: 15
Joined: Mon Dec 04, 2017 2:04 pm

Re: beginner Atollic question on printf/puts embedded STM32

Postby mennamorato » Sun May 06, 2018 5:40 pm

gosh is AC6 works for you i would stick to that ! Even when TrueStudio debugger works the SWV console hangs on me every few minutes so I personally am moving away from it. Friends with many years experience have moved to AC6 from IAR and love it..but not meant to be a tool discussion.
One other thing though.. i have an STM32 Nucleo board so the on-board USB the only connection and S/T Link 2 is running over that. Since you are using a different USB interface I suspect there is something related to that.

tompe
Posts: 10
Joined: Sat May 05, 2018 12:06 pm

Re: beginner Atollic question on printf/puts embedded STM32

Postby tompe » Mon May 07, 2018 8:06 pm

Ok, so today I tried an original ST-Link V2... and again nothing in my SWV. I was already about to give up and close all my programs when I had the ST-Link manual with its pinout right in front of me again. And there was another pin I have never seen before "SWO". Turns out the ST-Link V2 clones do not have one and on my Blue Pill board it is not with the programming pins but rather between the other pins, i.e. all the time I only connected Vcc, GND, SWDIO, SWCLK.

Wiring a 5th cable from SWO (PB3 on Blue Pill) to SWO on my programmer solved the problem. I don't know why CubeMX did not mark the pin as used when activating the serial wire debug under SYS.
Using a china clone ST-Link, you actually have to solder a little bit to get tracing to work. In my earlier tests with AC6 System Workbench they probably used SWDIO to transmit printf() messages, but don't ask a noob like me on that one.

tl;dr
In order to use SWV you need to also connect SWO with your programmer. If you use a china clone of the ST-Link V2 you will need to modify it first. Here is a post I found explaining how to do this:
https://lujji.github.io/blog/stlink-clone-trace/


Thanks everybody for the help. Hope this information will safe somebody a lot of try and error.

mennamorato
Posts: 15
Joined: Mon Dec 04, 2017 2:04 pm

Re: beginner Atollic question on printf/puts embedded STM32

Postby mennamorato » Mon May 07, 2018 8:38 pm

oh wow...glad to hear you got it working and yes very valuable info!

treecatt
Posts: 39
Joined: Mon Jul 24, 2017 6:56 am

Re: beginner Atollic question on printf/puts embedded STM32

Postby treecatt » Mon May 07, 2018 9:26 pm

In CubeMX under SYS did you select Debug-> Serial or Debug->Trace Asynchronous Sw? To have CubMX enable SWO you need to select Trace Asynchronous Sw (changes from Orange to Green).

tompe
Posts: 10
Joined: Sat May 05, 2018 12:06 pm

Re: beginner Atollic question on printf/puts embedded STM32

Postby tompe » Tue May 08, 2018 7:46 pm

@treecatt
You are right, under SYS I did in fact select Debug->Serial Wire. Changing to Debug->Trace Asynchronous Sw set the SWO pin as used.
So I guess with the first option mentioned that should be debugging via SWDIO, whereas the latter one uses the Trace SWO pin. Just asking because no matter which option I select, Atollic seems to always use the SWO pin. Maybe because we are using the ITM_SendChar() function in syscalls.c. This leaves the question if it is also possible to redirect printf() to SWDIO in order to preserve an additional pin for other purposes. However, I'm already quite happy with the current situation.


Return to “Embedded target code development discussions”

Who is online

Users browsing this forum: No registered users and 1 guest