I downloaded a fresh copy of the AWE Core for ARM Cortex-M4. I am using the STM32F407 Discovery board.
The only changes I made to the STM32F407 project are those I usually use for serial wire debugging, namely:
In Debug Configurations, enable Serial Wire Viewer with Core Clock 168.0 MHz.
Enable port 0 of the ITM Stimulus Ports in the SWV Data Trace.
Start trace in SWV ITM Data Console.
main.c looks like this:
Run-Debug immediately causes a crash:
I have not had trouble with serial wire debugging in my other STM32 projects. In your forums I found only one reference to serial wire debugging problems (https://beta.dspconcepts.com/forums/awe-core/797-serial-wire-viewer-no-o...) but visuelle-musik did not experience debug crash as far as I can tell. I did try their idea of DBGMCU->CR = 0x00000020; but this did not improve my situation.
I am successfully controlling AWE objects on my Discovery board using pots and buttons. Once I managed to get the STM32 project into Debug mode, I was able to use Live Expressions and other debug features of STM32CubeIDE. Initially I thought it was my code that was crashing the debugger, but learned it was printf. This is why I stripped back to the vanilla version of the STM32F407 folder, to see if I could get printf working. I'd be grateful for any solution you may be able to suggest.
2:39pm
Hello vandevegte_2322,
Apologies for the debugging issues. While we understand that this is not ideal, if Audio Weaver is not the root cause of the debug crashes (which is my understanding after digesting your comment, but please correct me if I'm misinterpreting), we recommend contacting STMicro concerning STM32CubeIDE printf() issues.
I wouldn't think that this is the issue, however I'll note that the AWE STM32F407 BSP project was originally built with and verified using the older SW4STM32 IDE (predecessor of STM32CubeIDE).
Thanks,
Kevin
2:53pm
The thing is that I do not experience any problems using printf() with my other STM32 projects, only with the STM32F407 project that delivers with your Cortex-M4. I believe some type of initialization is lacking, but I have not been able to determine what the problem might be. Are you able to print to console from the STM32F407 project?
10:00pm
Hello vandevegte_2322,
I have an STM32F407 board around, but would have to dig it up. I can do so when I am able to and if you are unable to make any progress. Could you please verify that the standard C library is being included and linked in? This could be a reason why printf() is giving you trouble.
Thanks,
Kevin
12:24pm
I was very hopeful for the idea of Standard C, but changing from Reduced C did not help. In fact I went to my other projects, in which printf is fine, and they all use Reduced C (with checkbox for Use float with printf checked if necessary). I will keep working on the problem and if I learn anything I will post right away. If you are able to dig up that STM32F407 board and have thoughts for me, I'd be grateful to hear them. My zipped project is too large to attach, but it is the plain version of the BSP, with the usual mods for using printf through serial wire viewer, currently with Standard C selected. main.c is as shown in my original post. Thank you, Kevin.