2020-05-13 05:27 AM
Hi, I'm trying to use the console in CubeIDE with my STM32F303RE nucleo board and use printf(). For this, I chose an empty project, not STMCube. In the tool settings, I set floating-point unit to none and Floating-point ABI to Software implementation. Then in the syscall.c , I added to following code snippet below.
//Debug Exception and Monitor Control Register base address
#define DEMCR *((volatile uint32_t*) 0xE000EDFCU )
/* ITM register addresses */
#define ITM_STIMULUS_PORT0 *((volatile uint32_t*) 0xE0000000 )
#define ITM_TRACE_EN *((volatile uint32_t*) 0xE0000E00 )
void ITM_SendChar(uint8_t ch)
{
//Enable TRCENA
DEMCR |= ( 1 << 24);
//enable stimulus port 0
ITM_TRACE_EN |= ( 1 << 0);
// read FIFO status in bit [0]:
while(!(ITM_STIMULUS_PORT0 & 1));
//Write to ITM stimulus port0
ITM_STIMULUS_PORT0 = ch;
}
__attribute__((weak)) int _write(int file, char *ptr, int len)
{
int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++)
{
//__io_putchar(*ptr++);
ITM_SendChar(*ptr++);
}
return len;
}
Before adding this code to syscall.c, I could build the project without any error. However, after adding the definitions and ITM_SendChar function I cannot build the project.
I get the following error.
c:\st\stm32cubeide_1.3.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.0.0.201904181610\tools\arm-none-eabi\bin\ld.exe: error: Src/sysmem.o uses VFP register arguments, 001HelloWorld.elf does not
c:\st\stm32cubeide_1.3.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.0.0.201904181610\tools\arm-none-eabi\bin\ld.exe: failed to merge target specific data of file Src/sysmem.o
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:43: 001HelloWorld.elf] Error 1
"make -j4 all" terminated with exit code 2. Build might be incomplete.
14:16:25 Build Failed. 1 errors, 0 warnings. (took 1s.325ms)
Any ideas, how can I get rid of VFP register arguments and use the printf()?
Thanks for your help in advance.