AnsweredAssumed Answered

What are none, nohost and semihost libraries?

Question asked by LPCware Support on Mar 31, 2016

LPCXpresso is supplied with several 'stubs' that form the very bottom of the C library and include certain low-level functions used by other functions in the library.


Each C library (Redlib and Newlib) is provided in three variants, with each variant providing a differing set of these stubs, and hence providing differing levels of functionality. The libraries are named as follows:


  • Redlib (none)
  • Redlib (nohost)
  • Redlib (semihost)
  • Newlib (none)
  • Newlib (nohost)
  • Newlib (semihost)


The functionality provided in each variant is as follows:




This library variant provides implementation of all functions, including file I/O. The file I/O will be directed through the debugger and will be performed on the host system (semihosting). For example, printf/scanf will use the debugger console window and fread/fwrite will operate on files on the host system. Note that this emulated I/O is slow and can only be used when debugging.




This library variant provides the string and memory handling functions and some file-based I/O functions. However, it assumes that you have no debugging host system, thus any file I/O will do nothing.




This is literally no stub and has the smallest memory footprint. It excludes low-level functions for all file-based I/O and some string and memory handling functions.


In many embedded microcontroller applications it is possible to use the None variant (ie no low level stubs) by careful use of the C library.


For more information...