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.

Using <stdio.h>

Other Parts Discussed in Thread: TMS320F28016

I need several functions from stdio.h, and before biting the bullet and rewriting them myself, I had a peek around.  I discovered the existence of stdio.h and added "#include <stdio.h>" to my source file and made a reference to "putchar(ch)" in my code.  That symbol showed up unresolved, meaning I need to add a library.  The only library referenced in the "startup" project I'm using is rts2800_ml.lib.  Where do I find the library containing the stdio stuff?  I'm using CCSV5, Version: 5.1.0.201110281600 Build id: N201110281600 and building for a TMS320F28016 device.

My other question about that library is "Does it associate stdin/stdout with the SCIA serial port?  If not, how do I make that association?

  • The function putchar is defined in rts2800_ml.lib.  I don't know why you are getting a symbol unresolved error when you link.

    Please see this wiki article for more hints on C I/O functions such as putchar().

    Daryl Lee said:
    Does it associate stdin/stdout with the SCIA serial port?

    No.  It only works within CCS.

    Daryl Lee said:
    If not, how do I make that association?

    You have to supply a device driver.  See this app note for an example of how that is done.

    Thanks and regards,

    -George

  • Thanks.  That will give me something to absorb.  I took a quick glance and it looks doable.

    I did have another look at the putchar linkage issue, and I think I have to do some heavy reading.  I cannot reproduce the symbol error, I get a whole litany of errors on memory issues.  The offending code is this:

    void putChar(char ch)
    {
        scia_xmit(ch);
        //putchar(ch);
    }

    With the code as shown, the program builds and runs as desired.  When I switch the comments, to remove scia_xmit() and enable putchar(), I get this in the output; I'm sure I have some huge configuration fubar associated with stdio:

    warning #10247-D: creating output section ".cio" without a SECTIONS
       specification
    warning #10247-D: creating output section ".sysmem" without a SECTIONS
       specification
    warning #10210-D: creating ".sysmem" section with default size of 0x400; use
       the -heap option to change the default size
    "D:/Common/Xio2/HardwareRedesign/DSP/TMS320-P28016-UART-echoback/UART_echoback/DSP280x_common/cmd/28016_RAM_lnk.cmd", line 111: error #10099-D:
       placement fails for object ".text", size 0xeb8 (page 0).  Available ranges:

       PRAML0       size: 0x800        unused: 0x800        max hole: 0x800    
    error #10099-D: run placement fails for object ".sysmem", size 0x400 (page 1).
       Available ranges:
       BOOT_RSVD    size: 0x80         unused: 0x80         max hole: 0x80
       RAMM1        size: 0x380        unused: 0x80         max hole: 0x80
       DEV_EMU      size: 0x180        unused: 0xb0         max hole: 0xb0
       FLASH_REGS   size: 0x60         unused: 0x58         max hole: 0x58
       CSM          size: 0x10         unused: 0x0          max hole: 0x0
       ADC_MIRROR   size: 0x10         unused: 0x0          max hole: 0x0
       CPU_TIMER0   size: 0x8          unused: 0x0          max hole: 0x0
       CPU_TIMER1   size: 0x8          unused: 0x0          max hole: 0x0
       CPU_TIMER2   size: 0x8          unused: 0x0          max hole: 0x0
       PIE_CTRL     size: 0x20         unused: 0x6          max hole: 0x6
       PIE_VECT     size: 0x100        unused: 0x0          max hole: 0x0
       ECANA        size: 0x40         unused: 0xc          max hole: 0xc
       ECANA_LAM    size: 0x40         unused: 0x0          max hole: 0x0
       ECANA_MOTS   size: 0x40         unused: 0x0          max hole: 0x0
       ECANA_MOTO   size: 0x40         unused: 0x0          max hole: 0x0
       ECANA_MBOX   size: 0x100        unused: 0x0          max hole: 0x0
       ECANB        size: 0x40         unused: 0xc          max hole: 0xc
       ECANB_LAM    size: 0x40         unused: 0x0          max hole: 0x0
       ECANB_MOTS   size: 0x40         unused: 0x0          max hole: 0x0
       ECANB_MOTO   size: 0x40         unused: 0x0          max hole: 0x0
       ECANB_MBOX   size: 0x100        unused: 0x0          max hole: 0x0
       EPWM1        size: 0x22         unused: 0x0          max hole: 0x0
       EPWM2        size: 0x22         unused: 0x0          max hole: 0x0
       EPWM3        size: 0x22         unused: 0x0          max hole: 0x0
       EPWM4        size: 0x22         unused: 0x0          max hole: 0x0
       EPWM5        size: 0x22         unused: 0x0          max hole: 0x0
       EPWM6        size: 0x22         unused: 0x0          max hole: 0x0
       ECAP1        size: 0x20         unused: 0x0          max hole: 0x0
       ECAP2        size: 0x20         unused: 0x0          max hole: 0x0
       ECAP3        size: 0x20         unused: 0x0          max hole: 0x0
       ECAP4        size: 0x20         unused: 0x0          max hole: 0x0
       EQEP1        size: 0x40         unused: 0x0          max hole: 0x0
       EQEP2        size: 0x40         unused: 0x0          max hole: 0x0
       GPIOCTRL     size: 0x40         unused: 0x0          max hole: 0x0
       GPIODAT      size: 0x20         unused: 0x0          max hole: 0x0
       GPIOINT      size: 0x20         unused: 0x16         max hole: 0x16
       SYSTEM       size: 0x20         unused: 0x0          max hole: 0x0
       SPIA         size: 0x10         unused: 0x0          max hole: 0x0
       SCIA         size: 0x10         unused: 0x0          max hole: 0x0
       XINTRUPT     size: 0x10         unused: 0x0          max hole: 0x0
       ADC          size: 0x20         unused: 0x2          max hole: 0x2
       SPIB         size: 0x10         unused: 0x0          max hole: 0x0
       SCIB         size: 0x10         unused: 0x0          max hole: 0x0
       ***         size: 0x10         unused: 0x0          max hole: 0x0
       SPID         size: 0x10         unused: 0x0          max hole: 0x0
       I2CA         size: 0x40         unused: 0x1e         max hole: 0x1e
       DRAML0       size: 0x800        unused: 0x39e        max hole: 0x39e
       CSM_PWL      size: 0x8          unused: 0x0          max hole: 0x0      
    error #10010: errors encountered d
    uring linking; "Example_280xSci_echoback.out"
       not built

  • Daryl Lee said:

    "D:/Common/Xio2/HardwareRedesign/DSP/TMS320-P28016-UART-echoback/UART_echoback/DSP280x_common/cmd/28016_RAM_lnk.cmd", line 111: error #10099-D:
       placement fails for object ".text", size 0xeb8 (page 0).  Available ranges:

       PRAML0       size: 0x800        unused: 0x800        max hole: 0x800    
    error #10099-D: run placement fails for object ".sysmem", size 0x400 (page 1).

    There are two errors here, both of which indicate the linker wasn't able to find a place in memory to put a section.  Both ".text" (program code) and ".sysmem" (the heap [malloc]) are probably too large to fit in the memory the linker command file is trying to fit them into.  Check your linker command file to make sure that both sections are being allocated to a memory region that is big enough to hold them.

  • In fact, it looks like you do not have a single memory region that is large enough to hold .text.  You'll need to either make .text smaller, or make one of the memory regions larger.  If your program makes use of formatted I/O (e.g. sprintf), you should consider using --printf_support=minimal to reduce code size (see the Compiler User's Guide).