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.

Limit on number of fopen in CCS?

Other Parts Discussed in Thread: SYSBIOS

Hi,

Sorry to post on an old thread, but it seems that this thread has already dealt with my issue, so seems like a good place to post. I am using the C6748 BIOS PSP MMCSD driver to write data to SD card. I need to write to 30+ separate files, so I need to modify some STDIO library #defines as described above. I have done this and rebuilt the RTS6740_elf.lib with _NFILE = FOPEN_MAX = 40 and also _NSTREAM = 40  file so that I should be able to open 30+ files. Here is the pseudo code I'm using: 

for (i=0-NUM_FILES)

{

sprintf (filename[i], "fat:1:Stream%d.bin", i);

pFile[i] = fopen(filename[i], "wb");

}

If I set the file name to fat:0:Stream%d.bin, it will open 30+ binary files in the same directory as the program binary files (.xe674 / .out files). I want to write to SD card though, so I need to specify the file as fat:1:Stream%d.bin; the :1: in the path seems to identify the SD drive. When I try this, I can only ever open 10 files and then it fails when attempting to open the 11th file. I can't see any MAX open files restriction in the MMCSD driver code, but this issue seems to be unique to opening files on the SD card. 

Has anyone seen this behavior before?

Thanks

Brian

  • Hi Brian
    For completeness can you specify the version of the BIOS PSP driver release you are using for MMC/SD on C674x?
    Regards
    Mukul
  • Hi Brian,

    This e2e thread has been split from below referenced thread for easier tracking. 

    https://e2e.ti.com/support/development_tools/compiler/f/343/t/7507

    Please post the C67xx device specific questions on C67x Single Core DSP Forum for appropriate and faster response.

    https://e2e.ti.com/support/dsp/tms320c6000_high_performance_dsps/f/115

    Thank you.

  • Dear Brian,
    I'm working on this problem and will try to reproduce.
    How many files you able to open with default library ?

    As Mukul asked, can you please share the package details which you are using.

  • Dear Brian,
    Able to reproduce the issue, I'm working on this.
    Also I have tested with general "fopen" in C and didn't see any problem on C6748 LCDK board.
    I think, its may be due to FAT fs.
    Let you know if any progress on this.
  • Dear Brian,
    I'm getting the same problem with the below example code (FatFS example code attached in wiki) also where we don't have MMC/SD related code so I'm suspecting issue on FatFS code, that is, may be fopen is restricted with 10.

    processors.wiki.ti.com/.../BIOS

    We may have to modify the code in the following location (FatFS source) to access the more fopen, also we can try "f_open"
    C:\ti\bios_6_35_04_50\packages\ti\sysbios\fatfs

    Let me update further progress on Monday.
    Happy weekend.
  • Dear Brian,

    After rebuilding the SYS/BIOS, able to open the 20 files.

    Here I have attached the rebuilt FatFS library, you just replace it with yours and rebuild your project.

    C:\ti\bios_6_35_04_50\packages\ti\sysbios\fatfs\lib\release\ti.sysbios.fatfs.ae674

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/ti.sysbios.fatfs.ae674

  • Titus,

    This is excellent to have the changes you made. Can you please show the code changes that you made, perhaps with an attached copy of the source files that needed to change with comments to show where those changes are? Or whatever method you find works best.

    Brian tried to set the number of files to 40, but it looks like you may have set the total to 20. In any case, it would be good to be able to update to any arbitrary number for our many users.

    Thank you for this great work to find the solution.

    Regards,
    RandyP
  • Dear RandyP,

    I changed neither in SYS/BIOS package nor in SYSBIOS's fatFS module but simply when I rebuilt the SYSBIOS package, I'm able to open the files upto 500 now.

    I have tried to change the following file but it didn't worked out.

    C:\ti\bios_6_35_04_50\packages\ti\sysbios\fatfs\ffconf.h

    #define _FS_SHARE       0       /* 0:Disable or >=1:Enable */

    /* To enable file shareing feature, set _FS_SHARE to 1 or greater. The value

      defines how many files can be opened simultaneously. */

    I have compared both libraries and found different XDC tools were used. It may be a cause but not sure.

    In default "ti.sysbios.fatfs.ae674" library used "xdctools_3_24_08_74_eng" but I have used "xdctools_3_25_06_96" for rebuilding the SYSBIOS.

    I have attached the bios.mak file which is used to rebuild the SYS/BIOS package.

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/bios.mak

    Also I have modified the CGT library code as Brian did.

    C:\ti\ccsv5\tools\compiler\c6000_7.4.4\lib\build_Titus\rtssrc\stdio.h

    C:\ti\ccsv5\tools\compiler\c6000_7.4.4\lib\build_Titus\rtssrc\file.h

    With attached library, able to open around 500 files, you can also open much more but needs memory.

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/0257.ti.sysbios.fatfs.ae674

    Dear Brian,

    Can you please try the attached library (just replace or rebuild the SYSBIOS) and confirm us ?

  • Hi Titus,

    Thanks for your assistance with this, it was very helpful. I need to make some more changes to the FatFs library to enable relative path (#define _FS_RPATH       2 ) and increase directory length (#define _USE_LFN        1 ). I've tried making the changes to ffconf.h and rebuilding SYS/BIOS, but the rebuild didn't update any of the libraries, despite completing without any errors.

    Any idea why why this would happen? I've attached my bios.mak file and build output.

    Thanks

    Brian

  • Files attached here:

    6864.buildOp.txt

  • Log seems to me, BIOS source files are building... remove the library and build.
    Otherwise you can rebuild (clean and build), it would take some time to complete.
  • #define
    ,

    I got it to rebuild. The issue was that in my bios.mak file, I hadn't included the path to the C6000 compiler:

    ti.targets.C674 ?=C:/ti/ti-cgt-c6000_8.0.3

    After adding this, the library rebuilt.

    I tried setting

    #define _USE_LFN 1

    but that gave me an error. So I then tried

    #define _USE_LFN 2

    But still my file names are limited to 8 characters. I will investigate some more on it for now.

    Many thanks
    Brian