Hi Hervé
I think that you are using a version of the project which is older than 08.10.2009. In my uFile.c I have the following:
08.10.2009 Add simulation support for embedded user files in file system {15}
Without this the simulator doesn't know whether it should take the addresses from its program space (this is protected and so cause an exception) or from the simulated FLASH space.
I suggest downloading the project latest version and checking for the changes necessary. The two routines that you have shown now look like this:
// The user files must be entered once. They can be removed by calling with a zero pointer
// Alternatively they can be changed by calling a different set of files.
//
extern void fnEnterUserFiles(USER_FILE *ptrUserFileList)
{
ptrUserFiles = ptrUserFileList; // enter the reference to the user files
#ifdef _WINDOWS
user_files_not_in_code = 0; // {15}
#endif
}
// Search through user files for the file name
//
static MEMORY_RANGE_POINTER fnFilterUserFile(CHAR *file_name)
{
USER_FILE *ptrFiles = ptrUserFiles;
if (ptrFiles == 0) {
return 0; // no user files registered
}
#ifdef _WINDOWS
if (user_files_not_in_code != 0) { // {15}
ptrFiles = (USER_FILE *)fnGetFlashAdd((unsigned char *)ptrFiles);
}
#endif
while (ptrFiles->fileName != 0) {
const CHAR *ptrName = ptrFiles->fileName;
#ifdef _WINDOWS
if (user_files_not_in_code != 0) { // {15}
ptrName = (const CHAR *)fnGetFlashAdd((unsigned char *)ptrFiles->fileName);
}
#endif
if (uStrEquiv(file_name, ptrName) != 0) {
return (MEMORY_RANGE_POINTER)ptrFiles->file_content; // return the start of the file
}
ptrFiles++;
}
return 0; // no file found with that name
}
There is a global flag which the simulator uses so that it knows where its should be working from. It is also used at some other locations, including the FTP server, so you will need to make sure that you integrate all changes.
Good luck
regards
Mark