Nios® II Software Developer Handbook

ID 683525
Date 8/28/2023
Public
Document Table of Contents

7.13.4. Use /dev/null

At boot time, standard input, standard output, and standard error are all directed towards the null device, that is, /dev/null. This direction ensures that calls to printf() during driver initialization do nothing and therefore are harmless. After all drivers are installed, these streams are redirected to the channels configured in the HAL. The footprint of the code that performs this redirection is small, but you can eliminate it entirely by selecting null for stdin, stdout, and stderr. This selection assumes that you want to discard all data transmitted on standard out or standard error, and your program never receives input through stdin. You can control the assignment of stdin, stdout, and stderr channels by manipulating BSP settings.