71
µTasker general / How to configure SPI_FILE_SYSTEM to work with serial loader
« Last post by Ray on September 01, 2023, 10:43:58 PM »Hi Mark
On a main application, the SPI_FILE_SYSTEM based on SPI_FLASH_W25Q128 devices (16MB) seems to work perfectly as a USB MSD.
(I needed to commented out // #define ACTIVE_FILE_SYSTEM which appeared to mess with my FAT32 format)
Reading and writing files and dragging folders to the DISK seems to be fully operational.
I've had the serial loader with the SDCARD working, but flash chips are a whole lot better solution for me.
It's time for me to tackle the problem with the serial loader. First, just treating it as a USB MSD doesn't seem to work. with the #defines set like this, it seems to lockup.
loader.h
#define UTASKER_APP_START (36 * 1024)
#define UTASKER_APP_END (unsigned char *)(UTASKER_APP_START + (476 * 1024))
#define _UTASKER_APP_START_ (UTASKER_APP_START + (ROOT_FILE_ENTRIES * 32))
config.h of serial loader
#define USB_INTERFACE // enable USB driver interface
#define USB_MSD_DEVICE_LOADER // USB-MSD device mode (the board appears as a hard-drive to the host)
#define USB_DEVICE_SUPPORT
#define USB_MSD_TIMEOUT
#define SPI_FLASH_FAT // SPI flash
#define SIMPLE_FLASH // don't perform block management and wear-leveling
#define FLASH_FAT_MANAGEMENT_ADDRESS (SIZE_OF_FLASH)
#define DELETE_SDCARD_FILE_AFTER_UPDATE
#define UTFAT_WRITE
#define UTFAT_LFN_READ // enable long file name read support
#define STR_EQUIV_ON // ensure that this routine is available
#define UTFAT_LFN_WRITE
#define UTFAT_LFN_WRITE_PATCH
#define RANDOM_NUMBER_GENERATOR
#define UTFAT_RETURN_FILE_CREATION_TIME
Nothing works, it locks up, but creates a USB_MSD
UPLOAD_DISK(F:) 1.31 MB free of 1.32MB
This is incorrect because the flash chip is fully formatted with a folder f:\web and it's lone file when I run the application code.
I think the problem is it's not correctly configured for what it is.
I have it configured with #define USB_MSD_DEVICE_LOADER
however I don't think this is the proper way for it to be implemented for my use-case.
For the initial programming of a new board, the serial loader should fail with this: #define _DISPLAY_SD_CARD_NOT_PRESENT() fnDebugMsg("SD-Card not present\r\n")
Jump to the main application, and then the main application has a initialization with formats the new device...and all is well.
I'm confused as to how exactly I configure SPI_FLASH as a MSD for the serial loader? Is it an "SD Card" or USB Device?
It seems to to walk the line and be a little bit of both?
I noticed I can't just use USB_MSD and SDCARD_SUPPORT
FYI - when I have a properly formatted W25QXXX.ini the UART3.txt indicates
> SD-Card presentAndFormatted
No Application
I'd like it to act like a SDCARD and the USB doesn't need to do anything until it jumps to the main application.
Debug is fine with just the UART
Oh, some other details are the linker edits, although I feel I have them correctly setup.
and my K_512_128_BM.ld uses:
MEMORY
{
FLASH (rx) : ORIGIN = 0x00009080, LENGTH = 0x00080000-0x9080 /* 512k Flash - boot loader */
SRAM (wx) : ORIGIN = 0x1fff01f0, LENGTH = 0x00020000-0x1f0 /* 128k RAM with vector size 0x1f0 (488 bytes - maximum for all processors) */
}
SECTIONS
{
__SRAM_segment_start__ = 0x1fff01f0;
__SRAM_segment_end__ = 0x2000ffff;
__Vector_segment_start__ = 0x00009080; /* application start address */
__Vector_segment_end__ = 0x0000908f;
__FLASH_segment_start__ = 0x00009090;
__FLASH_segment_end__ = 0x0007ffff;
Thanks
Ray
On a main application, the SPI_FILE_SYSTEM based on SPI_FLASH_W25Q128 devices (16MB) seems to work perfectly as a USB MSD.
(I needed to commented out // #define ACTIVE_FILE_SYSTEM which appeared to mess with my FAT32 format)
Reading and writing files and dragging folders to the DISK seems to be fully operational.
I've had the serial loader with the SDCARD working, but flash chips are a whole lot better solution for me.
It's time for me to tackle the problem with the serial loader. First, just treating it as a USB MSD doesn't seem to work. with the #defines set like this, it seems to lockup.
loader.h
#define UTASKER_APP_START (36 * 1024)
#define UTASKER_APP_END (unsigned char *)(UTASKER_APP_START + (476 * 1024))
#define _UTASKER_APP_START_ (UTASKER_APP_START + (ROOT_FILE_ENTRIES * 32))
config.h of serial loader
#define USB_INTERFACE // enable USB driver interface
#define USB_MSD_DEVICE_LOADER // USB-MSD device mode (the board appears as a hard-drive to the host)
#define USB_DEVICE_SUPPORT
#define USB_MSD_TIMEOUT
#define SPI_FLASH_FAT // SPI flash
#define SIMPLE_FLASH // don't perform block management and wear-leveling
#define FLASH_FAT_MANAGEMENT_ADDRESS (SIZE_OF_FLASH)
#define DELETE_SDCARD_FILE_AFTER_UPDATE
#define UTFAT_WRITE
#define UTFAT_LFN_READ // enable long file name read support
#define STR_EQUIV_ON // ensure that this routine is available
#define UTFAT_LFN_WRITE
#define UTFAT_LFN_WRITE_PATCH
#define RANDOM_NUMBER_GENERATOR
#define UTFAT_RETURN_FILE_CREATION_TIME
Nothing works, it locks up, but creates a USB_MSD
UPLOAD_DISK(F:) 1.31 MB free of 1.32MB
This is incorrect because the flash chip is fully formatted with a folder f:\web and it's lone file when I run the application code.
I think the problem is it's not correctly configured for what it is.
I have it configured with #define USB_MSD_DEVICE_LOADER
however I don't think this is the proper way for it to be implemented for my use-case.
For the initial programming of a new board, the serial loader should fail with this: #define _DISPLAY_SD_CARD_NOT_PRESENT() fnDebugMsg("SD-Card not present\r\n")
Jump to the main application, and then the main application has a initialization with formats the new device...and all is well.
I'm confused as to how exactly I configure SPI_FLASH as a MSD for the serial loader? Is it an "SD Card" or USB Device?
It seems to to walk the line and be a little bit of both?
I noticed I can't just use USB_MSD and SDCARD_SUPPORT
FYI - when I have a properly formatted W25QXXX.ini the UART3.txt indicates
> SD-Card presentAndFormatted
No Application
I'd like it to act like a SDCARD and the USB doesn't need to do anything until it jumps to the main application.
Debug is fine with just the UART
Oh, some other details are the linker edits, although I feel I have them correctly setup.
and my K_512_128_BM.ld uses:
MEMORY
{
FLASH (rx) : ORIGIN = 0x00009080, LENGTH = 0x00080000-0x9080 /* 512k Flash - boot loader */
SRAM (wx) : ORIGIN = 0x1fff01f0, LENGTH = 0x00020000-0x1f0 /* 128k RAM with vector size 0x1f0 (488 bytes - maximum for all processors) */
}
SECTIONS
{
__SRAM_segment_start__ = 0x1fff01f0;
__SRAM_segment_end__ = 0x2000ffff;
__Vector_segment_start__ = 0x00009080; /* application start address */
__Vector_segment_end__ = 0x0000908f;
__FLASH_segment_start__ = 0x00009090;
__FLASH_segment_end__ = 0x0007ffff;
Thanks
Ray
Recent Posts