Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


Unable to debug FreeRTOS tasks in SW4STM32 on STM32H7 processors

Hello,

I am unable to debug FreeRTOS tasks. A bit of information first:

Windows 10
SW4STM32 Version: 2.9.1
Board: NUCLEO-H745ZI-Q
Project created with STm32CubeMX version 5.5.0 with SW4STM32 as the specified toolchain / IDE

I can run and debug code on both the M4 and M7 core fine. However, after adding FreeRTOS (CMSIS v1) to the M4 core project using STM32CubeMX, I cannot step through the StartDefaultTask(). I can step through main() up until the task is created. After the first breakpoint is hit within the task, the debugger locks up and I cannot do anything. Also the Eclipse Debug tab “breaks” when this happens (See screenshot).

Issue

I have tried adding “$_TARGETNAME configure -rtos FreeRTOS” to the bottom of my debug configuration file, but when I try to debug after doing so I am presented with the following:
-------------------
Error in final launch sequence
Failed to execute MI command:
-target-select remote localhost:3333

Error message from debugger back end:
localhost:3333: The system tried to join a drive to a directory on a joined drive.
localhost:3333: The system tried to join a drive to a directory on a joined drive.
-------------------

UPDATE:

I was finally able to get past the first part of letting Eclipse / OpenOCD debugger know this is a FreeRTOS project by adding the following to the bottom of my configuration file:

$_CHIPNAME.cpu1 configure -rtos FreeRTOS

Note the differences from “$_TARGETNAME configure -rtos FreeRTOS”.

cpu1 in this case is the M4 core, and cpu0 is the M7 core.

Now I am getting the following error when trying to debug the M4 core:
---------------------
Error: FreeRTOS: uxTopUsedPriority is not defined, consult the OpenOCD manual for a work-around
---------------------

I have tried adding “#define uxTopUsedPriority xTopReadyPriority” to FreeRTOSConfig.h and also tried adding “FreeRTOS-openocd.c” to CM4/Src and refreshed my project window. The compiler still complains with the above error.

UPDATE 2:

Well I was able to get the uxTopUsedPriority error to go away by including “FreeRTOS-openocd.c” in my project and specifying ‘-Wl,--undefined=uxTopUsedPriority’ in my linker flags.

Linker flag location: Project -> Properties -> C/C++ Build -> Settings -> MCU GCC Linker -> Miscellaneous -> Link flags

The project now builds and the debugger starts without errors, but only the M7 core debugger starts. The M4 core debugger does not start.

Debug Doesnt Start M4

What am I missing?

Thanks!

Hi there,

I was able to solve the initial problem where you can’t step anymore and the debugger freezes once you set a breakpoint inside a thread (even though it worked without a problem in the main() function). I fixed it in CubeMX. Go into the Middleware->Freertos section and there go to Config parameters. Here find the Software timers definitions and enable them. This fixed it for me.

I’m not sure why this fixes it though. Maybe it has to do with the way FreeRtos and HAL interact with the SysTick (I’ve read somewhere that there are 2 SysTicks or something in that direction).

But that would still not explain it fully as I was able to debug without Eclipse using openOcd and gdb-multiarch even in the threads. But even when I replicated the same setup in Eclipse the debug freeze error occurred. So for gdb+openocd enabling the software timer definitions was not necessarry.

So this solution might not be perfect (or at least I don’t understand it well) but at least the problem disappeared.

Cheers

Same here!
Thanks enabling the timers makes it.

STM32H743ZI2


Hi there! I need someone’s advise...
Processor - STM32H745
Board - DISCO
SW4STM
The situation in my project is the same as described in the first post of this thread. By the way i have created huge code for CM7 core under FREERTOS, and there were no problem, but when I started to investigate CM4 I meet this strange behaviour.
The first task for me is to make inter-core communication channel, I tried to use examples from cube, especially OpenAMP library. So it works well until I have enabled FREERTOS on CM4. OpenAMP Example code became unworkable. Trying to debug it i’ve noticed that problem appears after starting scheduler. Using any breakpoint, after it starts, hangs debugger for CM4. The picture is the same as in the first post. Nevertheless, i tried to use code from the example provided by the cube for inter-core AMP “FreeRTOS_AMP_Dual_RTOS”. So debug works, until I tried to delete some code for migrating to OpenAMP.
For examle : CM4\main.c
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin){
prvCore2InterruptHandler(); If I comment this line debugger hangs in freertos task
HAL_EXTI_D2_ClearFlag(EXTI_LINE0);
}
I’m sure that my interrupts are switched off, so this routine never used... I’m lost...
By the way, when I was debugging CM7 there was a similar problem when I was debugging Huge ISR routine (the processing should be fast), so there were some hangs of debugger described in post 1, but I’ve debugged it through console messages through RS232. So in CM7 this bug was only in debugger, but not in code...
May be someone can show me direction for digging...
Thank you for your patience!