Associate III
December 4, 2024
Question
SWV / Trace not working on MP1 in production mode
- December 4, 2024
- 2 replies
- 1981 views
Hi :)
I have a custom-made board with the MP1 (stm32mp157D). The whole board is working fine, the A7 is running Linux and the M4 code runs fine.
But I cannot get SWV to work on the M4 chip.
I have reduced the code to an extremely simple code, nearly 100% generated by CubeIDE - I only added the following lines in the main to increment a counter called DDDEBUG and print using ITM_SendChar() :
/* USER CODE BEGIN 0 */
uint32_t DDDEBUG = 0;
/* USER CODE END 0 */
/**
* @brief The application entry point.
* @retval int
*/
int main(void)
{
// ... (code generated by CubeIDE) ...
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
DDDEBUG++;
for (char* ptr = "test\n"; *ptr; ptr++)
ITM_SendChar(*ptr);
HAL_Delay(1000);
}
/* USER CODE END 3 */
}
The code compiles without errors, and it loads and executes fine, I can see in the debugger the counter incrementing (even in Live Expressions) and the ITM_SendChar function is called correctly.
I also double-checked the PCB design and I can confirm that the TRACESWO / SWO pin is connected correctly to the ST-Link (ST_Link V3 MNIE - an offical ST one, very small without a case). The SWDIO and SWCLK pins are connected and working otherwise the debugging would not work.
The problem is I get absolutely nothing in any of the SWV windows (SWV Data Trace, SWV ITM Data Console, etc.), neither "test" nor can I see the DDDEBUG variable changing. The config is attached and the recording is enabled. I tried both OpenOCD and GDB, they give exact same results (debugging works but not SWV).
Am I missing something here? Is it possible to use SWV at all with an MPU in production mode?
There is very little about SWV for STM32 MPUs, the only article I could find is this one on st wiki and a few topics here which are about engineering mode.
Thank you
Simon
