FX_DRIVER_BOOT_WRITE bug in fx_stm32_sd_driver.c
Hello,
I ran into a bug in fx_stm32_sd_driver function.
Our firmware was calling fx_media_volume_set on a partitioned card and we found it was corrupting the disk. The issue is that the FX_DRIVER_BOOT_WRITE case statement hardcodes the boot sector to be at sector number 0. This works for unpartitioned (superfloppy) layouts, but does not work on partitioned SD cards with a master boot record. Calling fx_media_volume_set on a partitioned drive overwrites the MBR instead of the boot sector and corrupts the disk.
Note that the FX_DRIVER_BOOT_READ, which also has to manage this problem correctly calculates the offset using the _fx_partition_offset_calculate function.
Regards,
Mike
