Closed megari closed 3 years ago
The delta to the previous userdata export PR works out to 546 or 548 bytes. Not a whole lot, but can probably be reduced further.
Previous PR post-build statistics:
text data bss dec hex filename
31956 2936 2652 37544 92a8 sys_controller.elf
riscv32-unknown-elf-objcopy --change-addresses -0x10000 -O binary --gap-fill 0 sys_controller.elf mem_init/sys_onchip_memory2_0.bin
../../tools/bin2hex 4 mem_init/sys_onchip_memory2_0.bin mem_init/sys_onchip_memory2_0.hex
size: 34892 bytes
The current post-build statistics:
text data bss dec hex filename
32502 2936 2652 38090 94ca sys_controller.elf
riscv32-unknown-elf-objcopy --change-addresses -0x10000 -O binary --gap-fill 0 sys_controller.elf mem_init/sys_onchip_memory2_0.bin
../../tools/bin2hex 4 mem_init/sys_onchip_memory2_0.bin mem_init/sys_onchip_memory2_0.hex
size: 35440 bytes
personally I'd rather save the space for features than file export which I have little expectation to use... but I don't have a sense on how tight space is at this point.
personally I'd rather save the space for features than file export which I have little expectation to use... but I don't have a sense on how tight space is at this point.
After some optimization, this feature now requires 446 bytes. This is unlikely to go substantially lower. This leaves a margin of about 2 kB. This may be enough for a few small features in addition to any bugfixes. Let's see how this fits in the roadmap.
This PR implements exporting userdata in an easier-to-use manner, by creating a 16 MiB FAT16 volume on the SD card, with the userdata dump as a file in the root directory.
The code could probably be made smaller by taking additional liberties with regard to the FAT16 specification. Currently, the only violation I know of is that only the first sector of the root directory is zeroed out, apart from the directory entry for the userdata dump.