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

including "fopen()" prevents program from even starting

Hey everyone,

Very strange problem here. I am using the RL-ARM Flash library.

Essentially, when I include the statment

f = fopen("Test1.txt","r");

it totally fails! The program compiles and programs correctly, but then none of the statements are executed. It's as if using fopen() blows the memory right out of the chip.

More details:
I am using the LPC2378 on the MCB2300 board.

I have included FS_ARM_L.lib, RTL.h, File_config.h, LPC2300.s, MCI_LPC23xx.c, file_config.h, as well as files to write to the LCD.

The code is essentially this:

int main()
{
     FILE* f;
     finit();

     lcd_init();
     msg("Booted up");

     f = fopen("Test1.txt","r");

     if( f != NULL)
     {
          msg("Opened");
     }
     else
     {
          msg("Failed");
     }

     while(1){}

}

When I include the fopen statement, I get no messages on the LCD, no lights on the board, nothing happens at all. When I comment it out, I get the messages and it says that it failed to open (because I didn't fopen the file)... which makes sense.

Has anyone experienced anything like this?

Hoping for some help!

Adam :)

Parents
  • Hi Tamir,

    Thank you for your help. We had not set the heap correctly, but this wasn't the only problem because it still could not work.

    I ended up just copying one of their example projects and removed all the parts that I didn't want... and now it is working! Must have been some setting somewhere I didn't know again.

    Thank you very much for you help!

    Adam :)

Reply
  • Hi Tamir,

    Thank you for your help. We had not set the heap correctly, but this wasn't the only problem because it still could not work.

    I ended up just copying one of their example projects and removed all the parts that I didn't want... and now it is working! Must have been some setting somewhere I didn't know again.

    Thank you very much for you help!

    Adam :)

Children