µTasker Forum > µTasker general
How to configure SPI_FILE_SYSTEM to work with serial loader
mark:
Hi Ray
fnWriteParallelFlash() is only available in the Coldfire project so EXT_FLASH_FILE_SYSTEM should not be defined in the Kinetis project.
Regards
Mark
Ray:
Hi Mark,
Actually I'm not sure where that comment about EXT_FLASH_FILE_SYSTEM came from. Yes, that definitely has no place in the loading process.
I've taken a step back and tried to think logically where the problem might be coming from.
Except for disk_loader.c, serial_loader.c usb_application.c and usb_device_loader.c every other driver file for the serial loader is in the main application.
Except for config.h, loader.h and app_hw_kinetis.h
Clearly, config.h and loader.h are project specific, however, app_hw_kenitis.h has no reason to be different from the main application since it is essentially the glue between the drivers and the hardware layout. So I took the main application app_hw_kinetis.h, added about 4-5 preprocessor directives and a bunch of fnDebugMsg() and RESET_PEREPHIALS()
No, same problem.
I did find more issues usb_device_loader.c does not properly call FAT32. line 351
#if !defined FAT_EMULATION
#if !defined iMX_MAX_APPLICATION_SIZE || iMX_MAX_APPLICATION_SIZE <= (512 * 1024)
#define UTFAT12 *****causes all sorts of problems
#endif
#if defined UTFAT12
#define BOOT_SECTOR_LOCATION 1
#define BACKUP_ROOT_SECTOR 1
#define BYTES_PER_SECTOR 512
#define RESERVED_SECTION_COUNT 2
#define NUMBER_OF_FATS 1
#else // use FAT32 for large disk sizes
#define BOOT_SECTOR_LOCATION 63 // 0x3f
#define BACKUP_ROOT_SECTOR 6
#define BYTES_PER_SECTOR 512
#define RESERVED_SECTION_COUNT 32
#define NUMBER_OF_FATS 1
#endif
#endif
this also affects the default size, and why my MSD shows 2 mb size line 385:
#if defined UTFAT12
#define DISK_SIZE (2 * 1024 * 1024) // 16Meg (maximum with FAT12)
#define FAT_CLUSTER_MASK FAT12_CLUSTER_MASK // {46}
#else // FAT32 used with larger disk sizes
#define DISK_SIZE (8 * 1024 * 1024) // 8Meg
#define FAT_CLUSTER_MASK FAT32_CLUSTER_MASK // {46}
#define FAT_SECTOR_COUNT ((DISK_SIZE + ((4 * 1024 * 1024) - 1)) / (4 * 1024 * 1024))
#endif
This says the size of the MSD is hardcoded?
I'm convinced the USB MSD isn't gluing to the SPI. I'm going to drop a bunch of hardware debug uart codes to read on a logic analyzer tomorrow.
Just for clarity:
the proper configuration in config.h is:
#define SPI_FILE_SYSTEM // we have an external file system via SPI interface *** definitely need this
//#define FLASH_FILE_SYSTEM // we have an internal file system in FLASH *** Actually It seems we don't need this
#define FLASH_ROUTINES // supply flash routines *** definitely need this
#define SPI_FLASH_W25Q // internal QSPI flash *** needed to add this
#if defined (SPI_FILE_SYSTEM) || defined (FLASH_FILE_SYSTEM) || defined (NVRAM) || defined INTERNAL_USER_FILES
//#define ACTIVE_FILE_SYSTEM // Removed RJS 8/31/2023 // enable uFileSystem ***this seems to mess with the MSD in the main application, doesn't work with this defined
#endif
also, I'm pretty sure I've got this correct (config.h) starting 1693ish
#else
// #define SDCARD_SUPPORT // SD-card interface (only choose one of these options at a time) ** meaning either SDCARD OR SPI_FAT_FLASH
#endif
#define SPI_FLASH_FAT // SPI flash *** definitely need this
#define SIMPLE_FLASH // don't perform block management and wear-leveling *** definitely need this
// #define FLASH_FAT_MANAGEMENT_ADDRESS (SIZE_OF_FLASH) *** not used
#if (defined ST_MB997A_DISCOVERY && defined DEV11)
#define RENAME_SDCARD_FILE_AFTER_UPDATE // once new firmware has been copied from the SD card it will be automatically renamed
#else
//#define RENAME_SDCARD_FILE_AFTER_UPDATE // once new firmware has been copied from the SD card it will be automatically renamed
#define DELETE_SDCARD_FILE_AFTER_UPDATE // once new firmware has been copied from the SD card it will be automatically deleted from the card
#endif
#if (defined SERIAL_INTERFACE && !defined REMOVE_SREC_LOADING)
// #define UTFAT_DISABLE_DEBUG_OUT //9-1-2023 RJS removed // disable general mass-storage output so that the SREC loader is not disturbed
#endif
#if (defined DELETE_SDCARD_FILE_AFTER_UPDATE || defined USE_USB_MSD)
#define UTFAT_WRITE
#endif
Thanks,
Ray
mark:
Hi Ray
>> #define ACTIVE_FILE_SYSTEM
This is used to enable the uFileSystem which tends to be used with the FTP/HTTP interfaces. However when no Ethernet is enable in the serial loader
#define _NO_FILE_INTERFACE // code size optimisation
is set, which disables some of the support so that the size is optimised.
>> change line 217 from 64 to 476 #define UTASKER_APP_END (unsigned char *)(UTASKER_APP_START + (476 * 1024)) // use entire chip
You may need to reduce the size by the application's parameter system size so that the parameters are not deleted when loading new code.
Otherwise I haven't been able to reproduce the project so it would be simpler if you send me your config.h and app_hw_kinetis.h files.
If I have understood correctly you are using USE_USB_MSD in the application (a USB-MSD device to SD card / SPI Flash), with the following configuration note:
#define USE_USB_MSD // needs SD card to compile (or alternatives FLASH_FAT / SPI_FLASH_FAT / FAT_EMULATION)
In the serial loader the same can be set but it looks to be dedicated to the SD card:
#define USE_USB_MSD // full USB-MSD to SD card interface on USB (no emulated loader function) - requires SDCARD_SUPPORT (USB_MSD_DEVICE_LOADER can be disabled)
My initial feeling is that some addition code configuration may be required to allow the same operation.
If you send me the two header files it would be easier for me to check.
Regards
Mark
Navigation
[0] Message Index
[*] Previous page
Go to full version