kendryte / kendryte-freertos-sdk

This project is no longer maintained Not recommended for product development.
Apache License 2.0
201 stars 67 forks source link

A way to unmount SD Cards and handle failed initialization #52

Open feldim2425 opened 5 years ago

feldim2425 commented 5 years ago

FEATURE REQUEST

Missing feature

A way to handle failed SD Card initialization and unmount the SD Card when using sdcard.h. If for example I try to initialize the SD card without the SD Card plugged in, if will fail and halt the program instead of giving me a null handle for the SD Card driver. There is also no way to unmount a SD Card and remove the driver.

Justification

The current way makes (in my opinion) sdcard.h not suitable for applications where the SD Card is not strictly needed and might even be removed after unmounting it.

Workarounds

Pretty much nothing. Other than not using the builtin sd driver and filesystem there isn't much. The on_first_open method in sdcard.cpp uses a FreeRTOS assert with locks up as soon as the initialization fails. And unmount is currently only supported in the third party fat library.