fopen non-existing file

Hello,

I develop on STM32F407, I'm using CMSIS 5.7.0 (Keil RTX 4.82.0) and MDK-Middleware 7.13.0 (File System 6.14.1) with a NAND Flash.

I need to test whether files are present in my NAND.

When I call fopen on a non-existing file : 

  • I see EvrFsFAT_FileIsNonExistent error on event recorder (in "debug" mode)
  • HardFault_Handler function is called (in "release" mode)
    • There is no hardfault when I add code to understand the problem (because objects are added in ROM and RAM). I tried to increase the stack of the task calling fopen, but there is no hardfault for the same reason.

When I add the file (that was non-exisiting) in the NAND, the problem is solved.

Do you have any idea what's going on? Do you know how I can solve this problem (without creating the non-existing file)?

I can call ffind before fopen, but it seems that ffind requires a lot of stack for the task calling it.

Thanks.