Reorganize the and optimize the code to avoid redundant code and thus
reduce code size, while making sure to zero-initialize the used areas
on the SD card. These are the "clean" part of this change.
The "dirty" part:
Optimize the FAT16 export code further by introducing small deviations
from the FAT16 specification. These deviations should not be harmful
at all, unless the SD card is used for something requiring the jump
instruction and/or boot code in the boot sector to be valid. This is
typically only required when booting off the filesystem.
After these changes, a considerable reduction in code size can be
observed for sys_controller.elf and sys_onchip_memory2_0.bin:
sys_controller.elf:
text data bss dec hex filename
32392 2936 2652 37980 945c sys_controller.elf
sys_onchip_memory2_0.bin:
size: 35328 bytes
This reduces the cost of the FAT16 export feature to 446 bytes.