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.

MSP430F2013 printf

Other Parts Discussed in Thread: MSP430F2013

Hi,

Just starting my first steps with the MSP430...

Can I have printf with the MSP430F2013? It seems that link fails becuase of sizes and I don't know if there is a solution for it?

Thx

  • printf() does not know which types and features will be used in the format string, so it has to include support for all of them.

    If you want or need to use less code, you must implement the formatting yourself (with itoa() and friends).

  • I saw you can control the printf support level from the CCS but I get the following (see below)

    so printf cannot be use in this chip version?

    ===================================================================================================================

    "../lnk_msp430f2013.cmd", line 95: error #10099-D: program will not fit into available memory. placement with alignment fails for section ".text" size 0x10a8 . Available memory ranges:
    remark #10371-D: (ULP 1.1) Detected no uses of low power mode state changing instructions
    remark #10372-D: (ULP 4.1) Detected uninitialized Port 1 in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins.
    remark #10372-D: (ULP 4.1) Detected uninitialized Port 2 in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins.
    FLASH size: 0x7e0 unused: 0x7be max hole: 0x7be
    "../lnk_msp430f2013.cmd", line 98: error #10099-D: program will not fit into available memory. run placement with alignment fails for section ".cio" size 0x120 . Available memory ranges:
    RAM size: 0x80 unused: 0x4a max hole: 0x48
    error #10099-D: program will not fit into available memory. run placement with alignment fails for section "DATA_GROUP" size 0xfa . Available memory ranges:
    RAM size: 0x80 unused: 0x4a max hole: 0x48
    "../lnk_msp430f2013.cmd", line 89: error #10099-D: program will not fit into available memory. run placement with alignment fails for section ".bss" size 0xae . Available memory ranges:

    >> Compilation failure
    RAM size: 0x80 unused: 0x4a max hole: 0x48
    error #10010: errors encountered during linking; "Hello.out" not built
    gmake: *** [Hello.out] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****
  • Thx,

    Seems that this will help. I followed the thread but I cannot download the files which have a link. I will appreciate if someone can point me to a project which have an example with the tiny printf solution.

    Thx
  • You have to register on the 43oh.com site to download the linked content there.
  • Hi Brian,

    Appreciate your help!

    Made some progress ... Now I can compile the code and run it. The question if I can see the output ....

    I am using TI MSP430 USB stick. Can I see printf output with it? Do I need to change anything in the CCS project preferences?

    Thx
  • Which USB stick? The ez430-F2013? You will need to have a backchannel UART, but as far as I remember, the stick did not have one...hopefully I'm wrong.
  • >I am using TI MSP430 USB stick. Can I see printf output with it?
    No. Particular microcontroller does not have UART, msp430 usb stick does not have uart backchannel. Honestly trying to use printf() on small microcontroller like f201x is not that good idea. - What' s the point to have printf() if you are left with no code memory for your application? :D My usual suggestion of rough data display on small uCs: variable-period LED blinking. If you need to to see exact contents of variables while learning - just use debugger.
  • It would be possible to configure the USI to output a UART-compatible signal: Using the USI as a UART

    Alternatively, it would be possible to implement a UART with bit banging (with hardware support): Implementing a UART Function with Timer_A3

    In any case, you need something to connect to UART pins to. This could be, e.g., a TTL/UART/USB converter, or a LaunchPad.

    In any case, you must use something like the tiny printf() (which does not support all the features of the real printf()), or better format your strings by hand. (For outputting debug strings, even the tiny printf() would be overkill.)

  • Hi All,

    Thx for the help. I think that for now I will start without printf. I guess that as my code increases, I will not be able to use it anyway.

    Thx

**Attention** This is a public forum