eurorack-blocks
eurorack-blocks copied to clipboard
SD/MMC data support
Add SD and MMC support for data location in memory.
Current State
- This overlaps with #238 so pause this feature for a bit
Overview
data represents an immutable piece of data, available as soon as the module is started.
For now the data itself was stored as static data in the program itself, but realistically, we need QSPI support (#219) to support this feature fully.
Alternatively, we can use the SD feature to provide basically the same thing, except the data is loaded from SD to SDRAM when the module is started.
Implementation
For now we have the following scheme, where the data is stored into the program.
data sample {
file "bla.wav"
type AudioSample
}
We can extend the data attributes with location which dictates where data is stored:
data sample {
file "foo.wav"
type AudioSample
location program // default if not specified
}
data sample2 {
file "bar.wav"
type AudioSample
location sdmmc // in SD or "back MMC" on board
}
For the sdmmc location, no program is generated. Instead we create a .bin file which is a byte per byte representation of what the program location does.
When starting the module, the data location in SDRAM is filled with the content of the .bin file. The data is either truncated or complemented with zeros if the file size doesn't match.
For this feature to work, the current types (like AudioSample) must have at most one dynamic length. As a result for AudioSample for example, we need to go from a planar representation to an interleaved one.
Finally, because the data is stored in SDRAM, we need to play nice with the system we already have in place, by either:
- Calculating the amount of space needed for data (and aligning appropriately) and remove it from the amount available from our
SdRamPtrsystem, - Use our
SdramPtrsystem.
Tasks
- [x] Make
AudioSampletype interleaved - [ ] Figure out how to integrate nicely with current
SdramPtrsystem - [ ] Add
locationattribute to language - [ ] Add
locationattribute documentation - [ ] Add
locationgenerator support - [ ] Test in simulator
- [ ] Test on target hardware