Smooth icon indicating copy to clipboard operation
Smooth copied to clipboard

MMCSDCard.cpp fails to compile for esp32-c3

Open paulftw opened this issue 3 years ago • 1 comments

I have a ESP32-C3 module. After setting this chip as a target:

idf.py set-target esp32c3

I'm running into a compilation error:

/Users/paul/smoothoperator/externals/smooth/lib/smooth/core/filesystem/MMCSDCard.cpp: In member function 'virtual bool smooth::core::filesystem::MMCSDCard::init(const smooth::core::filesystem::SDCardMount&, bool, int)':
/Users/paul/smoothoperator/externals/smooth/lib/smooth/core/filesystem/MMCSDCard.cpp:44:36: error: 'SDMMC_HOST_DEFAULT' was not declared in this scope
         sdmmc_host = (sdmmc_host_t)SDMMC_HOST_DEFAULT();
                                    ^~~~~~~~~~~~~~~~~~
/Users/paul/smoothoperator/externals/smooth/lib/smooth/core/filesystem/MMCSDCard.cpp:44:36: note: suggested alternative: 'SDSPI_HOST_DEFAULT'
         sdmmc_host = (sdmmc_host_t)SDMMC_HOST_DEFAULT();
                                    ^~~~~~~~~~~~~~~~~~
                                    SDSPI_HOST_DEFAULT

The culprit appears to be SOC_SDMMC_HOST_SUPPORTED - this symbol is not defined in the C3 soc_caps.h. As a result sdmmc_host.h does nothing and breaks MMCSDCard.cpp.

Workaround

Adding

#define SOC_SDMMC_HOST_SUPPORTED 1

to the top of the smooth/lib/smooth/include/smooth/core/filesystem/MMCSDCard.h fixes the error. But that's a dirty hack.

Expected behavior

Build system should be aware of chip specific Smooth configurations and either provide documentation on how to disable unsupported libraries or use error-throwing mocks when underlying hardware/firmware aren't available.

Similar problems may probably arise with other compile target / library combinations.

paulftw avatar Jun 18 '22 12:06 paulftw

Hello @paulftw

I'm no longer actively using Smooth (my project is completed) so I'm not actively keeping up with the development of the ESP32/IDF at this point. I do however accept pull requests to address issues. As such, feel free to propose a proper solution to the issue at hand and we'll discuss it.

PerMalmberg avatar Jun 18 '22 12:06 PerMalmberg