Patch to fix SPI flash writing in VS1010D

Designing hardware and software for systems that use the VS1010 MP3 Audio DSP Microcontroller.
Post Reply
User avatar
Panu
VSDSP Expert
Posts: 2818
Joined: Tue 2010-06-22 13:43

Patch to fix SPI flash writing in VS1010D

Post by Panu »

Dear VS1010D users!

Here's a patch that fixes inconsistencies we discovered with a Linux PC writing to the SPI flash of VS1010D using USB mass storage in runlevel 4. The problem may occur in other operating systems also, so this patch should be applied to all VS1010D boards that have an SPI flash installed.

To install the patch, place the patch file "boot.dlx" into the root of your system disk, typically the SPI flash itself. It's a good idea to have this patch both in the root of the SD card you use for development, and in the root of the SPI flash, so the patch is loaded no matter which device the VS1010D uses as the system disk.

Please note that the SPI flash is used as the system disk only if it contains a SYS folder in the root. If the SPI flash does not have the "SYS" folder, then the boot.dlx patch is still loaded from the SD card, not from the SPI flash.

When the patch is succesfully loaded, you will see a console notification like the one below:
VS1010D VSOS 4.20
Files:6. Buffers:3.
Runlevel 4
SPIF:c217, 16384K
SD:No ID.
VS1010D patch SPI flash write
Relocked (3007)
For more information, please see the source code of the patch inside the .zip package.

[Edit]
Updated 2020-11-02, version 2.

Thanks for your support!
-Panu
Attachments
boot.dlx
SPI flash writing patch for VS100D, version 2. Place in root of SPI flash. Put also a SYS folder into root of SPI flash.
(1.15 KiB) Downloaded 109 times
arch-bootspifd-2020-11-02-12-43-VS1000D-FixSpiFlashWrite-V2.zip
SPI flash writing patch for VS100D. Version 2. VSIDE solution with source code
(20.54 KiB) Downloaded 75 times
User avatar
Henrik
VLSI Staff
Posts: 1215
Joined: Tue 2010-06-22 14:10

Re: Patch to fix SPI flash writing in VS1010D

Post by Henrik »

Panu wrote: Mon 2020-10-26 13:00 Here's a patch that fixes inconsistencies we discovered with a Linux PC writing to the SPI flash of VS1010D using USB mass storage in runlevel 4. The problem may occur in other operating systems also, so this patch should be applied to all VS1010D boards that have an SPI flash installed.
One thing worth noticing is that, at least for now, you cannot use Linux to copy this Write Patch to the SPI Flash in USB Mass Storage mode because the bug that this patch fixes may mess up the file system. So, better use Windows to copy the patch to the SPI flash. After the patch has been installed, writing to SPI Flash through USB works fine under Linux.

Kind regards,
- Henrik
Good signatures never die. They just fade away.
User avatar
Panu
VSDSP Expert
Posts: 2818
Joined: Tue 2010-06-22 13:43

Re: Patch to fix SPI flash writing in VS1010D

Post by Panu »

Henrik wrote: Thu 2020-10-29 20:38One thing worth noticing is that, at least for now, you cannot use Linux to copy this Write Patch to the SPI Flash in USB Mass Storage mode because the bug that this patch fixes may mess up the file system. So, better use Windows to copy the patch to the SPI flash. After the patch has been installed, writing to SPI Flash through USB works fine under Linux.
If you also have an SD card in your system, you can put the boot.dlx file to the root of the SD card. Then the patch is loaded from the SD card when you boot your VS1010D board for writing the system files to the SPI flash.

The patch is loaded from the SD card because at that time, the SPI flash doesn't contain a SYS folder, which would make the SPI flash become the system disk. After writing the SYS folder to the SPI flash, the SPI flash becomes the system disk. Then the patch can be loaded from the SPI flash.

Make sure that you write both the SYS folder and the boot.dlx patch file to the root of the SPI flash.

-Panu
Arek
Senior User
Posts: 111
Joined: Thu 2016-09-01 10:58

Re: Patch to fix SPI flash writing in VS1010D

Post by Arek »

Hi Panu,
my firmware has already "bootx.dlx" in SYS folder.
Have you also -x version of this patch?
Hannu
Senior User
Posts: 176
Joined: Mon 2016-05-30 11:54

Re: Patch to fix SPI flash writing in VS1010D

Post by Hannu »

Boot.dlx is executed from S:boot.dlx, not from S:SYS

You can save the SPI flash write patch for example as s:patchspi.dlx and then write another boot.dlx
which calls first shellcmd(s:spipatch.dlx, ""); then shellcmd("yourplayer.dlx", "");
The thing is however that with that kind of construction, your new boot.dlx can't leave from memory as the spipatch.dlx would leave and loading and dropping libraries are on vs1010 stack (LIFO) kind of orperations. So if you have many libraries to run, keep the launcher boot.dlx small.

So your new boot.dlx would look something like this:

Code: Select all

DLLIMPORT(thisLib) extern u_int16 thisLib[];

ioresult main (char *params) {
	thisLib[1] = 0xfffe;  // Stay resident and do not call fini() at exit
	shellcmd(s:spipatch.dlx, "");
	/* Uncomment the loop to let the program exit to console */
	//while(1)
	    if (runlevel == YOUR_RUNLEVEL)shellcmd("yourplayer.dlx", "");
}
In your player software, you can load and drop libraries as much you want. Just remember the correct order.

Another way to start your own program is through s:config.txt
Post Reply