Setting up your runtime environment
You can set up the runtime environment based on some basic project settings. It is also often convenient to let the C-SPY debugger manage things like standard streams, file I/O, and various other system interactions. This basic runtime environment can be used for simulation before you have any target hardware.
Before you build your project, choose Project>Options>General Options to open the Options dialog box.
On the Library Configuration page, verify the following settings:
Library—choose which library configuration to use. Typically, choose Tiny, Normal,or Full. For library support for C++17, choose Libc++, which uses the Full library configuration.
For information about the various library configurations, see Runtime library configurations.
On the Library Options 1 page, select Auto with multibyte support or Auto without multibyte support for both Printf formatter and Scanf formatter. This means that the linker will automatically choose the appropriate formatters based on information from the compiler. For more information about the available formatters and how to choose one manually, see Formatters for printf and Formatters for scanf, respectively.
To enable C-SPY emulated I/O, choose Project>Options>Linker>Library and select Include C-SPY debugging support.
Danger
On the command line, use the linker option
‑‑debug_lib.Note
The C-SPY Terminal I/O window is not opened automatically—you must open it manually. For more information about this window, see Terminal I/O window.
Note
If you enable debug information before compiling, this information will be included also in the linker output, unless you use the linker option
‑‑strip.On some systems, terminal output might be slow because the host computer and the target system must communicate for each character.
For this reason, a replacement for the
__writefunction called__write_bufferedis included in the runtime library. This module buffers the output and sends it to the debugger one line at a time, speeding up the output.Note
This function uses about 80 bytes of RAM memory.
Caution
To use this feature in the IDE, choose Project>Options>Linker>Library and select the option Buffered write.
Danger
To enable this function on the command line, add this to the linker command line:
‑‑redirect ___write=___write_buffered
Some math functions are available in different versions—default versions, smaller than the default versions, and larger but more accurate than default versions. Consider which versions you should use.
To specify which set of the math functions to use, choose Project>Options>General Options>Library Options 1>Math functions and choose which set to use. You can also specify individual functions.
For more information, see Math functions.
When you build your project, a suitable prebuilt library and library configuration file are automatically used based on the project settings you made.
For information about which project settings affect the choice of library file, see Runtime library configurations.
You have now set up a runtime environment that can be used while developing your application source code.