PrintF via SWO
DrBanana Thu Oct 06, 2016 1:19 pm
DrBanana Thu Oct 06, 2016 1:19 pm
stevestrong Thu Oct 06, 2016 2:40 pm
The SWO feature would be interesting for me as well.
RogerClark Thu Oct 06, 2016 8:53 pm
Why not just hook up a USB to Serial adaptor to USART1 ( PA9 and PA10),
Slammer Thu Oct 06, 2016 9:39 pm
martinayotte Fri Oct 07, 2016 1:50 pm
Ollie Fri Oct 07, 2016 3:10 pm
If one day, Arduino or stm32duino will have the debugger support, I hope that it would go one step further and leverage all the capabilities built in the M3 platform. Please, take a look of the following blog explaining and demonstrating these capabilities.
http://essentialscrap.com/tips/arm_trace/theory.html
Cheers, Ollie
Pito Fri Oct 07, 2016 4:24 pm
RogerClark Fri Oct 07, 2016 8:07 pm
There is an active thread by @stevestrong where he now uses Eclipse + an Arduino plugin.
This may be the best of both worlds, but it looks like the install is a little tricky.
I dont think the Arduino IDE is going to get debugger support any time in the near future, as for AVR Arduino now recommends the use of Atmel Studio ( aka AVR Studio) if you want debugger support, and surprisingly the Arduino team seem to think debug support is not something beginners would want ( but I think debug support makes things easier for beginners not harder, even web browsers now come with Javascript debuggers by default)
victor_pv Sun Jan 15, 2017 2:57 am
victor_pv Sun Feb 19, 2017 6:11 pm
Now I do have a problem with #define and ifdef in the arduino IDE.
This works fine in both Eclipse and Arduino IDE if I define SWODEBUG, but if I comment it out “#define SWODEBUG” to eliminate the debug output, then in Arduino it doesn’t compile:
#define SWODEBUG
#ifdef SWODEBUG
SWO_Channel SWO;
#define SWO_ErrLog(...) SWO.printf(__VA_ARGS__);
#else /* Not DEBUG */
#define SWO_ErrLog(...)
#endif
stevestrong Sun Feb 19, 2017 6:37 pm
#define SWODEBUG 1victor_pv Mon Feb 20, 2017 12:13 am
#define SWODEBUG 1RogerClark Mon Feb 20, 2017 7:23 am
I suspect the problem is that it needs to be defined globally and if you only define it in the sketch it only gets applied to includes directly included by the sketch not by any of the other core files
You could also try putting it in something like arduino.h as I think that may get included in most files (though not all)
stevestrong Mon Feb 20, 2017 8:28 am
victor_pv Mon Feb 20, 2017 4:11 pm
Nothing goes wrong when I declare the functions in the ino (or rather some of them) myself. It seems like Arduino IDE places the functions before the #define if there is only the pin one, and the #ifdef, but doesn’t do so where there is the other #define there.. In any case, seems to be totally a problem of the Arduino IDE and nothing else. Since I found a way around it if it happens again I can move forward to other things.
Thank you both for the suggestions.
stevestrong Mon Feb 20, 2017 5:47 pm
victor_pv Mon Feb 20, 2017 6:11 pm
ddrown Mon Feb 20, 2017 9:26 pm
#if (SWODEBUG > 0)
SWO_Channel SWO;
#define SWO_ErrLog(...) \
SWO.printf(__VA_ARGS__); \
SWO.printf("LINE: %d, FUNCTION: %s, FILE: %s \r\n", __LINE__, __FILE__, __FUNCTION__);
#else /* Not DEBUG */
#define SWO_ErrLog(...)
#endif victor_pv Mon Feb 20, 2017 9:51 pm
ddrown Tue Feb 21, 2017 12:42 am
stevestrong Tue Feb 21, 2017 8:41 am