CCS10.0下TMS320F28335使用Printf函數的問題


使用Code Composer Studio  Version: 10.1.0.00010 ,建立TMS320F28335工程。

/*
 * main.c
 */
#include <stdio.h>

int fputc(int ch, FILE *f)
{
    while(ScibRegs.SCICTL2.bit.TXRDY == 0);
    ScibRegs.SCITXBUF=ch;
return ch; }
int main(void) { printf("Hello DSP!\r\n"); return 0; }

 編譯出錯

"../CMD/F28335.cmd", line 66: error: program will not fit into available
   memory, or the section contains a call site that requires a trampoline that
   can't be generated for this section. run placement with alignment/blocking
   fails for section ".stack" size 0x400page 1.  Available memory ranges:
   RAMM1        size: 0x400        unused: 0x0          max hole: 0x0 

查看F28335.cmd文件

PAGE 1 :   /* Data Memory */
           /* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE0 for program allocation */
           /* Registers remain on PAGE1                                                  */
   
   BOOT_RSVD   : origin = 0x000000, length = 0x000050     /* Part of M0, BOOT rom will use this for stack */
   RAMM0       : origin = 0x000050, length = 0x0003B0     /* on-chip RAM block M0 */
   RAMM1       : origin = 0x000400, length = 0x000400     /* on-chip RAM block M1 */
   RAML4       : origin = 0x00C000, length = 0x001000     /* on-chip RAM block L1 */
   RAML5       : origin = 0x00D000, length = 0x001000     /* on-chip RAM block L1 */
   RAML6       : origin = 0x00E000, length = 0x001000     /* on-chip RAM block L1 */
   RAML7       : origin = 0x00F000, length = 0x001000     /* on-chip RAM block L1 */

PAGE1 為數據存儲區

   /* Allocate uninitalized data sections: */
   .stack              : > RAMM1       PAGE = 1    
   .ebss               : > RAML5       PAGE = 1
   .esysmem            : > RAMM1       PAGE = 1

stack段空間不夠,修改為

   /* Allocate uninitalized data sections: */
   .stack              : > RAML4       PAGE = 1    
   .ebss               : > RAML5       PAGE = 1
   .esysmem            : > RAML4       PAGE = 1

 修改Printf支持,Level of printf/scanf support required(--printf_support)選擇minimal

堆棧設置


編譯通過,可以正常使用printf函數打印字符串,但還是無法使用%d等格式化輸出功能,即使Level of printf/scanf support required(--printf_support)選擇full也不行。

 

原因待查。。。

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM