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.

  • TI Thinks Resolved

TMS320C5517: fopen does not work(return null)

Part Number: TMS320C5517

Hello,

I try to open a file using fopen on my board(tms5517), but it returns 0.

FILE *fp;
fp = fopen(FileName,"rb");

I try to make the stack larger, but it also didn't work.

-stack 0x2000 /* Primary stack size */
-sysstack 0x1000 /* Secondary stack size */
-heap 0x20000 /* Heap area size */

MEMORY
{
MMR: o = 0x000000 l = 0x0000c0 /* 192B Memory Mapped Registers */

DARAM0: o = 0x0000C0 l = 0x001F40 /* 8kB Dual Access RAM 0 */
DARAM1: o = 0x002000 l = 0x002000 /* 8kB Dual Access RAM 1 */
DARAM2: o = 0x004000 l = 0x002000 /* 8kB Dual Access RAM 2 */
DARAM3: o = 0x006000 l = 0x00A000


SARAM0: o = 0x010000 l = 0x040000



CS0: o = 0x050000 l = 0x7B0000 /* 8MB CS0 external memory space */
CS2: o = 0x800000 l = 0x400000 /* 4MB CS2 external memory space */
CS3: o = 0xC00000 l = 0x200000 /* 2MB CS3 external memory space */
CS4: o = 0xE00000 l = 0x100000 /* 1MB CS4 external memory space */
CS5: o = 0xF00000 l = 0x0E0000 /* 1MB CS5 external memory space */
ROM: o = 0xFE0000 l = 0x01FF00 /* 128kB ROM (MPNMC=0) or CS5 (MPNMC=1) */
VECS: o = 0xFFFF00 l = 0x000100 /* reset vector */
}

SECTIONS
{
vectors (NOLOAD) > VECS /* If MPNMC = 1, remove the NOLOAD directive */
.cinit > DARAM3 ALIGN = 4
.text > DARAM3 ALIGN = 4
.stack > SARAM0 ALIGN = 4
.sysstack > SARAM0 ALIGN = 4
.sysmem > SARAM0 ALIGN = 4
.data > SARAM0 ALIGN = 4
.cio > SARAM0 ALIGN = 4
.bss > SARAM0 ALIGN = 4
.const > SARAM0 ALIGN = 4
.switch > SARAM0 ALIGN = 4

}

I didn't use any external RAM, which means that only the memmory in DSP itself. So is the memmory too small that fopen can't run?  

But I want to write a bin file to flash, if I can't open this bin file, I'd have move the whole data into .h file, which is a troublesome job.

Can anybody help me?

  • Hi,

    I've notified the sw team. Their feedback will be posted here.

    Best Regards,
    Yordan

     


     Please make sure you read the forum guidelines first.

  • user4626108,

    Is this a boot image you are trying to load to flash?
    How large is your bin file that you are reading?
    Does wb compared to rb work for fopen?

    Lali
  • In reply to Lalindra Jayatilleke:

    1.
    Yes I'd like to load the bin file to flash, which is about 194k's large now(smaller than 0x40000, 0x40000 is the size of SARAM of 5517). But it will grow larger later. I haven't used external RAM yet.

    Now that I can't use fopen, I used another method: load bin file to an array in the program. But since the flash-writing program takes some spaces on dsp, the application program's size that can be written into FLASH will be smaller.

    2.
    What are wb and rb?
    I have'v tried printf , it didn't work too.
  • In reply to user4626108:

    user4626108,

    Please see the fopen section of http://www.cprogramming.com/tutorial/cfileio.html. Its talks about rb and wb.

    printfs in code can be troublesome. Can you use uartPrintfs to help debug?

    Lali

  • In reply to Lalindra Jayatilleke:

    Both wb and rb do not work with fopen.

    Does uartPrintf use the uart serial port? My serial port is connected to another MCU, and MCU's serial port can be connected PC. It is not very convinient to use serial port. I have to tranmmit the data to MCU first and then MCU transmit the data to DSP.

    So it's better to use fopen if the function works.    But if there is not another way, I have use the serial port at last.

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.