stm32/main: Add board config option to enable/disable mounting SD card.
The new option MICROPY_HW_SDCARD_MOUNT_AT_BOOT can now be defined to 0 in mpconfigboard.h to allow SD hardware to be enabled but not auto-mounted at boot. This feature is enabled by default to retain previous behaviour. Previously, if an SD card is enabled in hardware it is also used to boot from. While this can be disabled with a SKIPSD file on internal flash, this wont be available at first boot or if the internal flash gets corrupted.
This commit is contained in:
parent
5ed578e5b4
commit
ce0c581179
@ -268,7 +268,7 @@ MP_NOINLINE STATIC bool init_flash_fs(uint reset_mode) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MICROPY_HW_HAS_SDCARD
|
#if MICROPY_HW_SDCARD_MOUNT_AT_BOOT
|
||||||
STATIC bool init_sdcard_fs(void) {
|
STATIC bool init_sdcard_fs(void) {
|
||||||
bool first_part = true;
|
bool first_part = true;
|
||||||
for (int part_num = 1; part_num <= 4; ++part_num) {
|
for (int part_num = 1; part_num <= 4; ++part_num) {
|
||||||
@ -620,7 +620,7 @@ soft_reset:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool mounted_sdcard = false;
|
bool mounted_sdcard = false;
|
||||||
#if MICROPY_HW_HAS_SDCARD
|
#if MICROPY_HW_SDCARD_MOUNT_AT_BOOT
|
||||||
// if an SD card is present then mount it on /sd/
|
// if an SD card is present then mount it on /sd/
|
||||||
if (sdcard_is_present()) {
|
if (sdcard_is_present()) {
|
||||||
// if there is a file in the flash called "SKIPSD", then we don't mount the SD card
|
// if there is a file in the flash called "SKIPSD", then we don't mount the SD card
|
||||||
|
@ -97,6 +97,11 @@
|
|||||||
#define MICROPY_HW_HAS_SDCARD (0)
|
#define MICROPY_HW_HAS_SDCARD (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Whether to automatically mount (and boot from) the SD card if it's present
|
||||||
|
#ifndef MICROPY_HW_SDCARD_MOUNT_AT_BOOT
|
||||||
|
#define MICROPY_HW_SDCARD_MOUNT_AT_BOOT (MICROPY_HW_HAS_SDCARD)
|
||||||
|
#endif
|
||||||
|
|
||||||
// Whether to enable the MMA7660 driver, exposed as pyb.Accel
|
// Whether to enable the MMA7660 driver, exposed as pyb.Accel
|
||||||
#ifndef MICROPY_HW_HAS_MMA7660
|
#ifndef MICROPY_HW_HAS_MMA7660
|
||||||
#define MICROPY_HW_HAS_MMA7660 (0)
|
#define MICROPY_HW_HAS_MMA7660 (0)
|
||||||
|
Loading…
Reference in New Issue
Block a user