ESP32: "user C modules" should be able to add components to the build
Right now the list of components is hard coded in
https://github.com/micropython/micropython/blob/97a7cc243b028833bdcb8ce0bc19b2bce7545851/ports/esp32/main/CMakeLists.txt#L96
USer C modules should be able to add new components without having to modify the above file
My current use case is a user module that adds support for the esp32-camera
Fixing this will help others extend micropython with minimal modifications in the core files
Keeping user c module build self contained.
I am going to do my best to explain this and I hope I am able to get it right. This could be a bug and is not working the way it should be or it could be a feature request if it wasn't done this way.
The objective here is to be able to add C code to be compiled as part of MicroPython without the need to alter any of the MicroPython build system. This would be an ideal thing to be able to do for someone wanting to extend functionality.
In my use case I need to have access to the esp_lcd component of the ESP-IDF from the python interpreter. When building MicroPython for the ESP32 the esp32_common.cmake file gets used and inside of that file is the following
list(APPEND IDF_COMPONENTS
app_update
bootloader_support
bt
driver
esp_adc
esp_app_format
esp_common
esp_eth
esp_event
esp_hw_support
esp_netif
esp_partition
esp_pm
esp_psram
esp_ringbuf
esp_rom
esp_system
esp_timer
esp_wifi
freertos
hal
heap
log
lwip
mbedtls
newlib
nvs_flash
sdmmc
soc
spi_flash
ulp
vfs
)
Now if I wanted to have access to the esp_lcd component I would think that I should be able to do the following in the micropython.cmake file that is in my user c module
list(APPEND IDF_COMPONENTS esp_lcd)
This does not work. I am forced to edit the esp32_common.cmake file and add the esp_lcd component.
It would be nice to not have to modify the MicroPython build system at all to be able to add the needed component to the list. Keeping the user c module completely self contained would make distributing the module a whole lot easier to do. This same idea would need to work across all of the different boards/SDK's that are used when building.
I am aware this has been mentioned before in #8041 But I think it needs to be brought up again seeing as how that was back in 2021 and it has not been done.