cancel
Showing results for 
Search instead for 
Did you mean: 

I get an error: Undefined referrence to 'ITM_SendChar'. What should I do?

Panagiotis
Associate III

I 'm using Atollic TrueSTUDIO 9.3.0 with STM32CubeMX 5.2.1 and target MCU is an STM32F030F4P6.

I 'm building my project but I get this error:

Undefined referrence to 'ITM_SendChar'.

In the second photo you can see that the folder that contains the file (core_cm3.h) that contains the 'ITM_SendChar' function is included in my project.

(Properties->C++->BuildSettings->ToolSetings->C Compiler->Directories->Include Path)

0690X00000AtA5zQAF.png

0690X00000AtA6EQAV.png

What have I done wrong?

1 ACCEPTED SOLUTION

Accepted Solutions

> STM32F030F4P6

The 'F030 has a Cortex-M0 core, not Cortex-M3 (to which core_cm3.h belongs).

The 'F0 does not have the ITM module.

For "printing", you may/should use a normal UART.

JW

PS. Change your username to a normal nick.

View solution in original post

4 REPLIES 4

> STM32F030F4P6

The 'F030 has a Cortex-M0 core, not Cortex-M3 (to which core_cm3.h belongs).

The 'F0 does not have the ITM module.

For "printing", you may/should use a normal UART.

JW

PS. Change your username to a normal nick.

Panagiotis
Associate III

You mean that I could/should use something like Arduino 's 'Serial.print()' (I 'm totally novice in STM32 so please forgive my reference to Arduino) instead of 'ITM_SendChar' (or of the function that uses it)?

(ITM Module (which my MCU does not have) is something like a serial port?)

> You mean that I could/should use something like Arduino 's 'Serial.print()' (I 'm totally novice in STM32 so please forgive my reference to Arduino) instead of 'ITM_SendChar' (or of the function that uses it)?

You probably can click out some basic USART-related functions in CubeMX, or have a look at the USART-related examples in CubeF0 ("firmware").

I don't use Cube/CubeMX.

You could also write it yourself. You would need to set one USART Tx pin by setting it to AF (0b10) in respective bits in GPIOx_MODER, and the set it to required AF in GPIOx_AFR (have a look at the alternative functions table in datasheet (DS) for your chip) (working with GPIOx registers assumes you have already enabled clock for that GPIOx in RCC); then you would need to enable clock for given USART in RCC, set its baudrate in its baudrate register (USARTx_BRR), enable Tx and enable UART in USARTx_CR1, and then transmit characters by looking first at the TXE bit in USARTx_SR and then writing the given character into USARTx_TDR.

> (ITM Module (which my MCU does not have) is something like a serial port?)

It's a debug module (in Cortex-M3/M4/M7), which can be used also as a simple serial port and that's how most of the users use it.

JW

Panagiotis
Associate III

Thank you very much waclawek.jan. You really helped me a lot!

For now I will just comment out the ITM related code.

But later on I will try to work out this USART and if I have any issues I will return with more questions.