Here is a binary software package that adds support for AAC, WMA and OGG decoding in the VS1010D.
Please note that running decoders from RAM consumes most of VS1010 memory and CPU resources. There may not be much left for your own software while songs are playing.
The VS1010D contains hardware and software support for virtual memory, which is implemented with a Translate Look-aside Buffer type of cache controller in the 4 kiloword instruction RAM memory of VS1010D. The TLB allows VS1010D to run programs whose size is 16 kilowords instead of the 4 kilowords of RAM that is physically on the chip.
The TLB virtual memory controller arranges the instruction RAM memory into 64 stripes of 64 words each. When a fetch occurs to a nonpresent memory address, a non-maskable page fault interrupt is generated. The VS1010D ROM contains a handler that loads a stripe of instructions from a SPI NOR flash using SPI flash dual data read opcode 3B, which is supported in a wide variety of SPI NOR flashes. The stripe contains a simple checksum to protect against reading from corrupted or unprogrammed memory.
We have tested the functionality with the following flash ICs: Adesto 25SF321, Macronix MXIC 25L128 3SF, Winbond W25X32VSIG, Winbond 25Q32DWSIG, and Macronix MXIC 25L400. Additionally, SPI flash chips with 64K erase blocks such as Spansion S25FL127 can be used as virtual memory storage, but with 64K erase block size, there can never be any writable FAT partition on the flash, so they are not recommened.
Taking advantage of the virtual memory controller, binary images for AAC, WMA and OGG decoders have been compiled and are distributed here. Please download the package and extract it to the root of a microSD card. Then from the command line, run PROMX command to write the cache images to the SPI flash. Please beware, this operation will overwrite and corrupt any existing FAT partition in the SPI flash.
After promming the flash, you can reboot the VS1010D into a simplified command line mode that allows only limited amount of user code to be loaded into the RAM as most of the RAM is used to load the virtual decoder. The reboot can be done by command BOOTX S:BOOT.XVS1010>promx
Starting VS1010C external SPI Flash prommer v2014-01-14...
Serial Flash RDID: manufacturer c2, type 20, density 18
Serial Flash REMS: c217
Opened map file "s:external.map"
Programming file "s:sys/vr1.i" to address 0x010000 (65536)
Erase 4 KiB sector 16 ( 64 - 68 KiB), ok. Writing data .
Erase 4 KiB sector 17 ( 68 - 72 KiB), ok. Writing data .
Erase 4 KiB sector 18 ( 72 - 76 KiB), ok. Writing data .
Erase 4 KiB sector 19 ( 76 - 80 KiB), ok. Writing data .
Erase 4 KiB sector 20 ( 80 - 84 KiB), ok. Writing data .
Erase 4 KiB sector 21 ( 84 - 88 KiB), ok. Writing data .
Erase 4 KiB sector 22 ( 88 - 92 KiB), ok. Writing data .
Erase 4 KiB sector 23 ( 92 - 96 KiB), ok. Writing data .
Erase 4 KiB sector 24 ( 96 - 100 KiB), ok. Writing data .
Erase 4 KiB sector 25 ( 100 - 104 KiB), ok. Writing data .
Erase 4 KiB sector 26 ( 104 - 108 KiB), ok. Writing data .
Ok
Programming file "s:sys/vr2.i" to address 0x020000 (131072)
Erase 4 KiB sector 32 ( 128 - 132 KiB), ok. Writing data .
Erase 4 KiB sector 33 ( 132 - 136 KiB), ok. Writing data .
Erase 4 KiB sector 34 ( 136 - 140 KiB), ok. Writing data .
Erase 4 KiB sector 35 ( 140 - 144 KiB), ok. Writing data .
Erase 4 KiB sector 36 ( 144 - 148 KiB), ok. Writing data .
Erase 4 KiB sector 37 ( 148 - 152 KiB), ok. Writing data .
Erase 4 KiB sector 38 ( 152 - 156 KiB), ok. Writing data .
Ok
Programming file "s:sys/vr3.i" to address 0x030000 (196608)
Erase 4 KiB sector 48 ( 192 - 196 KiB), ok. Writing data .
Erase 4 KiB sector 49 ( 196 - 200 KiB), ok. Writing data .
Erase 4 KiB sector 50 ( 200 - 204 KiB), ok. Writing data .
Erase 4 KiB sector 51 ( 204 - 208 KiB), ok. Writing data .
Erase 4 KiB sector 52 ( 208 - 212 KiB), ok. Writing data .
Erase 4 KiB sector 53 ( 212 - 216 KiB), ok. Writing data .
Erase 4 KiB sector 54 ( 216 - 220 KiB), ok. Writing data .
Erase 4 KiB sector 55 ( 220 - 224 KiB), ok. Writing data .
Erase 4 KiB sector 56 ( 224 - 228 KiB), ok. Writing data .
Erase 4 KiB sector 57 ( 228 - 232 KiB), ok. Writing data .
Ok
Map file "s:external.map" closed
Note that the prompt changes from "VS1010>" to "S1010>" as a visual cue to note that the shell has changed to a "simplified" shell - only raw UART console transport is supported, there's no backspace and less memory is available for programs, but the virtual memory loader and extended audio format support is available.VS1010> bootx s:boot.x
Reset virtual memory
BootFromX(BOOT.X)
Loaded 746 bytes.
VLoad Ok.
S1010>
From this command prompt, MP3, WAV, AAC, OGG and WMA format music files can be played normally with the PLAY command:
This operation is supported in VS1010D devices, and at the moment the system disk S must be the SD card. We're working on being able to have all the firmware and decoders in the SPI flash, but at the moment, SD card must be used.S1010>play s:t*
TEST.WMA
TheRobotsA_192kbps.aac
TheRobotsM_192kbps.mp3 ok
TheRobotsO_270kbps.ogg
TheRobotsA_125kbps.aac
S1010>
All music files must be played from a microSD or SD card, since it's the only storage which is fast enough to feed the music data files to the system with the overhead of loading the cache pages from the SPI flash. SPI flash cannot be used for data storage during extended format playback as the page fault interrupt must have exclusive access to the SPI0 bus.
The system is suitable for UART controlled playback of AAC, OGG and WMA songs, as well as MP3 and WAV songs, from the SD card. For other types of applications please inquire case by case, as we must think about how much instruction RAM there is left for user code when the virtual decoders are running. This can actually be quite a lot if not all bitrates and variants of all WMA, OGG and AAC files need to be supported, potentially even more than in a normal VS1010 system without virtual memory. But especially to support all WMA variants - especially in very low bitrates - a lot of memory must be set aside for that.
As always, please experiment with the system and let us know how we can improve it and help you.
-Panu