Skip to main content
September 20, 2021
Solved

Why does Terminal I/O redirection break on IAR when enabling CubeMX FreeRTOS?

  • September 20, 2021
  • 1 reply
  • 889 views

I created two CubeMX projects for an STM32L412K Nucleo and IAR EWARM 8.50.9 (licensed).

Project A is a simple default, I don't modify anything at all.

Project B takes project A and enables FreeRTOS in the Middlewares.

I add "printf("test") before while(1) in Project A, and before osKernelStart() in Project B.

When I debug Project A, the test message appears in Terminal IO. The implementation appears to follow _DLIB_FILE_DESCRIPTOR=0, because putchar calls _write as shown in the DLIB library file source.

However, Project B does NOT print anything. And the disassembly shows that putchar calls fputc, which looks like DLIB putchar.c was compiled with _DLIB_FILE_DESCRIPTOR=1.

  1. Nowhere is DLIB_FILE_DESCRIPTOR reconfigured in either project. And manually setting it to zero doesn't fix Project B.
  2. Nowhere is weak putchar() overridden in either project.

I can't figure out what is causing this behavior.

This topic has been closed for replies.
Best answer by

Solved. printf() was called before the osKernelStart(). Placing a printf() in a task worked fine.

1 reply

Best answer
September 21, 2021

Solved. printf() was called before the osKernelStart(). Placing a printf() in a task worked fine.