Nios® II Software Developer Handbook

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

5.4.3.5. Controlling the stdio Device

The build tools offer several ways to control the details of your stdio device configuration, such as the following:
  • To prevent a default stdio device from being chosen, use the following command:

    nios2-bsp hal my_bsp --default_stdio none

  • To override the default stdio device and replace it with uart1, use the following command:

    nios2-bsp hal my_bsp --default_stdio uart1

  • To override the stderr device and replace it with uart2, while allowing the default Tcl script to choose the default stdout and stdin devices, use the following command:

    nios2-bsp hal my_bsp --set hal.stderr uart2

In all these cases, if you run nios2-bsp again to update your BSP, you must provide the original command-line options again to prevent the default Tcl script from choosing its own default stdio devices. Alternatively, you can call --default_stdio with the DONT_CHANGE keyword to prevent the default Tcl script from changing the stdio device settings.