81
µTasker general / Re: How to configure SPI_FILE_SYSTEM to work with serial loader
« Last post by Ray on September 15, 2023, 04:12:11 AM »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
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
Recent Posts