This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

fopen problem

Hi!!

I have problem with fopen funciton. I'm using MCB2300 (lpc2378). When I use SD_File examle its work's fine. Now I'm doing my project, I have proglem. I could incialize SD card, but I can't open file (fopen returns error). I have set IRAM2 to addres 0x7FD00000 and size 0x2000, RTLFS.lib (code/cons: default; Zero Initialized Data: IRAM2, Other data: Default)

Default: IRAM1 0x40000000 0x8000
         IRAM2 0x7FD00000 0x2000 (USB)
         RAM1  0x7FE00000 0x4000 (ethernet)

In project I have also included: ETHERNET, DHCP, TELNET, TCP/IP, UDP, TFTP, serial and kernal (from example Http)

I even tried this and don't work:

int main (void) {
   /* Start with 'init' task. */

   FILE *fin;

init_serial();
init_card ();

   fin = fopen ("Test.txt","w");
   if (fin == NULL) {
      send_text ("File not found!\n");
   }
   else {
      // process file content
      fclose (fin);
      send_text ("File OK!\n");
   }
   //os_sys_init(init);
   while(1);
}


Any idea where could be a problem?

Best regard
Peter

Parents
  • I started with this example. I find a problem.

    First problem was, that I didn't inicialize defoult mamory. Now I fixed that, but I have problem with RAM size. It's not enough of them. I tried to seperate 32k ram on two parts, one for general prpose (default) other for RAM drive. The minimum od RAM drive is 16k, but other 16k ram is not enough for zero initialized data (just net_config.c needs cca 19k).

    At first I would to like learn mora about Memory areas.
    What is:
    - code/const
    - zero initialized data
    - other data

    where must be placed (ROM, RAM) and which part od some function or c file present some area. For example where is put global veriable, ...
    Have anybody some tutorial? I looked in Kiel help, but I didn't find nothing usefull.

    What about using function fread? I know, that you have to correctly set code generation (ARM mode ot Thumb mode) and file Retarget.c. Slowly I understanding how it's work.

    Thanke you for your help

Reply
  • I started with this example. I find a problem.

    First problem was, that I didn't inicialize defoult mamory. Now I fixed that, but I have problem with RAM size. It's not enough of them. I tried to seperate 32k ram on two parts, one for general prpose (default) other for RAM drive. The minimum od RAM drive is 16k, but other 16k ram is not enough for zero initialized data (just net_config.c needs cca 19k).

    At first I would to like learn mora about Memory areas.
    What is:
    - code/const
    - zero initialized data
    - other data

    where must be placed (ROM, RAM) and which part od some function or c file present some area. For example where is put global veriable, ...
    Have anybody some tutorial? I looked in Kiel help, but I didn't find nothing usefull.

    What about using function fread? I know, that you have to correctly set code generation (ARM mode ot Thumb mode) and file Retarget.c. Slowly I understanding how it's work.

    Thanke you for your help

Children
No data