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.
Dear TI
To add the support for printf or sprintf, I have to add stdio.h in the project(BlinkLED sample project).
Here are the steps what I already did:
(1) Add #include <stdio.h>, and add code in main.c : printf("Hello");
(2) Set both heap size and stack size to 512, in the menu: Project->Property->Build->MSP430 Linker->Basic options
(3) clean and build
Then the error is showing:
"../lnk_msp430g2553.cmd", line 90: error #10099-D: program will not fit into available memory. run placement with alignment fails for section ".bss" size 0xaa . Available memory ranges:
RAM size: 0x200 unused: 0x70 max hole: 0x70
"../lnk_msp430g2553.cmd", line 91: error #10099-D: program will not fit into available memory. run placement with alignment fails for section ".data" size 0xfc . Available memory ranges:
RAM size: 0x200 unused: 0x70 max hole: 0x70
"../lnk_msp430g2553.cmd", line 100: error #10099-D: program will not fit into available memory. run placement with alignment fails for section ".cio" size 0x120 . Available memory ranges:
I read the MSP430 Optimizing C/C++ Compiler v21.6.0.LTS, in chapter 7.2.1, I read:
cl430 main.c --run_linker --heap_size=400 --library=rts430_eabi.lib --output_file=main.out
Do I miss something in my project configuration? It is urgent, please help me, thanks.
BR
Johnson
#include <stdio.h> #include <string.h> #define UART_PRINTF #ifdef UART_PRINTF int fputc(int _c, register FILE *_fp); int fputs(const char *_ptr, register FILE *_fp); #endif Main() { …………… } #ifdef UART_PRINTF int fputc(int _c, register FILE *_fp) { while(!(UCA0IFG&UCTXIFG)); UCA0TXBUF = (unsigned char) _c; return((unsigned char)_c); } int fputs(const char *_ptr, register FILE *_fp) { unsigned int i, len; len = strlen(_ptr); for(i=0 ; i<len ; i++) { while(!(UCA0IFG&UCTXIFG)); UCA0TXBUF = (unsigned char) _ptr[i]; } return len; } #endif
Here is the code for your to refer.
You can also find some help in this:http://software-dl.ti.com/ccs/esd/documents/sdto_cgt_tips_for_using_printf.html
**Attention** This is a public forum