This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Disable CIO in MSP430/Code Composer

In some of my projects, C I/O was turned on.  I have looked through all the settings (toggled the Debug->Program/Memory Load Options -> Enable CIO function use) and cannot find a way to remove it.    The .cio section consumes nearly 300 bytes of memory in my MSP430 and I need that memory.

Thanks!

  • James Batcheler67 said:
    I have looked through all the settings (toggled the Debug->Program/Memory Load Options -> Enable CIO function use) and cannot find a way to remove it.

    The Debug project properties control if the CCS debugger attempts to perform CIO, and not the allocation of the .cio section on the target.

    To prevent the .cio section being allocated on the target you have to ensure there are no calls to run time library functions which use CIO, e.g. ensure there are no calls to printf() in the code.

  • Thanks for the response, Chester.

    Currently, there are no references to run time library functions that use CIO.  I know at one time another programmer put some printf statements in there for testing (they're commented out, along with the header includes).  Pretty sure the project was built at least once with these printf statements in place. Does this taint the project once it happens?

  • James Batcheler67 said:
     Pretty sure the project was built at least once with these printf statements in place. Does this taint the project once it happens?

    No the project doesn't get "tainted" - an an experiment added / removed calls to printf() from and the .cio section was no longer linked when the printf() was commented out.

    Can you post the linker map file, or the project, to try and determine what is causing the .cio to be linked in.

  • I ended up telling the system to not automatically select a RTS library for me.   This makes the objects pulled in from it (namely, C I/O) go away.  I do not invoke any functions in there, so it doesn't cause any errors.

    Not an ideal solution, but it solves my problem in the mean time.

    Thanks for the help.

  • Turns out I had some _assert(0) statements in one of my libraries.  This would in turn bring in stdio, which would demand a .cio section, consuming ~400 bytes of RAM.

  • The CIO feature itself does not affect the generated code. Basically, it places breakpoints on the putchar and getch functions, to fetch/inject the console I/O using JTAG.
    Of course, those two functions need to be in the code to make CIO work, but they are by default simply empty functions. And they are added to the code as soon as you use printf, puts or any other function that does character input or output. But this happens whether you use CIO or not - just because you use printf.

    You can replace them by your own versions, which then may redirect the data from/to UART.

    Using ASSERT, however, will implicitly use printf for error message output. whether the CIO feature is used or not.

**Attention** This is a public forum