Migrating projects with the custom fputc() function
Technical Note 220216
3/1/2022 4:16 PM
Some projects with a custom
fputc() function generate no output when they are migrated to EWARM 9.20.1 or later version.
This Technical Note applies to projects matching all these points:
- Uses Full Library configuration, in other words the
_DLIB_FILE_DESCRIPTOR = 1.
- Only uses the
putchar()function for output.
- Has implemented a custom
Other migrated projects are not affected.
- Evaluate if the project needs Full library configuration. If not, switching to Normal library configuration could solve the problem.
- If Full library configuration is needed: Implement
Note: The recommended way to do retargeting is to implement
__write(). This is described in the IAR C/C++ Development Guide, in the chapter The DLIB runtime environment, in the section Retargeting—Adapting for your target system, under the heading Standard streams for input and output.
EWARM 9.20.1 introduced an optimization in the run-time library.
- The aim of that optimization is to avoid including (in the linked
- In other words, the optimization shrinks linked output in 9.20.1 and later versions.
This link holds two example projects for retargeting
__write() has been retargeted. The example (on the MCB2130 board) shows how to migrate from EWARM 9.10.2 to EWARM 9.20.2.
For migrated projects where this ‘no output’ issue occurs, the change from a custom
fputc() function to a custom
__write() function solves the issue.
A benefit is that the size of the linked
.out file shrinks, when doing retargeting with a custom
All product names are trademarks or registered trademarks of their respective owners.