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.

MSP430-GCC-OPENSOURCE: MSP430FR5994 printf support

Part Number: MSP430-GCC-OPENSOURCE
Other Parts Discussed in Thread: MSP430FR5994

Hello,

I'm currently working with the MSP430FR5994 and I'm using MSP430-GCC and working outside of the TI CCS IDE. I'm trying to use printf for debugging purposes e.g. sensor bring-up, printing values of readings during development etc. (not aimed at production). However, when using GDB and gdb_agent_console the printf messages seem to be ignored.

I successfully had printf working when using TI CCS, all I had to do was set the heap size to 320 and I was good to go! (Specifying --heap_size=320 in MSP430-GCC seemed to not be recognised either).

Is there a special printf implementation in TI CCS which allows printing to CIO that MSP430-GCC does not support?

Is it possible with MSP430-GCC or do I need to wire up a separate UART interface with a special printf implementation to pipe my output elsewhere?

Any help would be appreciated!

Version info below;

- MSP430-GCC version 9.3.1.11

- MCU is MSP430FR5994

Thanks,

Joe

  • printf assumes operating system support which doesn't exist. I never use it for embedded systems. I sometimes use sprintf to generate a string which I then transmit using a serial output routine that I provide.

    Assuming it compiles then that means that there is hopefully something at the bottom accepting those characters. Even if it actually uses a serial port, which one is it? Have you initialized it? You might want to examine the code with msp430-elf-objdump -S to see what it is doing.

  • Hi Joe,

    As David said, printf is tricky in embedded systems. Are you successfully hitting and passing the printf statement when you run in debug and just not seeing output? 

    What is your Stack Size? By default on the MSP430FR5x examples I think this is around 160bytes, which may not be big enough for some implementations of printf. 

    Please also see Section 5.4 of the MSP430 GCC User's Guide (slau646):

    Best Regards,
    Brandon Fisher

**Attention** This is a public forum