09202024

Last update2016/05/28 14:38

Back 現在地: Home パートナー Strategic Test パートナー Atollic 22.runtime library I/Oのリダイレクトについて

22.runtime library I/Oのリダイレクトについて

22.runtime library I/Oのリダイレクトについて

The C runtime library include many functions, including some that typically handle I/O. The I/O related runtime functions include printf(), fopen(), fclose(), and many others.

It is common to redirect the I/O from these functions to the actual embedded platform, such as redirecting printf() output to an LCD display or a serial cable, or to redirect file operations like fopen() and fclose() to some Flash file system middleware.

The free Lite version of TrueSTUDIO ® do not support I/O redirection, and instead have do-nothing stubs compiled into the C runtime library.

The professional versions of TrueSTUDIO ® do support I/O redirection. To enable I/O redirection the file "syscalls.c" should be included and built into the project:

  • Open TrueSTUDIO ® professional and load your project.
  • In the Project explorer, Right click on the project and select New->Other...
  • Expand System calls.
  • Select "Minimal System Calls Implementation" and click next.
  • Click Browse... and select the src folder as new file container and click OK.
  • Click on Finish and verify that "syscalls.c" is added to your project.

Example: Redirect "printf()" to your target output by modifying the "_write()" function in "syscalls.c":