Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] elf-loader for RISC-V based ESP32 (like C6) (IDFGH-14086) (AEGHB-880) #428

Open
martinssense opened this issue Nov 16, 2024 · 3 comments

Comments

@martinssense
Copy link

Is your feature request related to a problem?

Dynamically loading code during runtime can be useful.
There already is an elf-loader for Xtensa based ESP32, I cannot find a working solution for RISC-V based ESP32 (like C6 or H2) though.

Describe the solution you'd like.

A working elf-loader for RISC-V based ESP32 would be awesome.
This way we could load "program modules" on RISC-V based ESP32 during runtime, without having to flash the firmware.

Describe alternatives you've considered.

Zephyr has something called LLEXT which is basically an elf-loader. Using Zephyr is not the same as having the luxury of FreeRTOS though - as I understand there are also limitations of using Zephyr on ESP32.
There is also embedded wasm, but its overhead is huge, so it's not a viable solution for concurrent dynamically loaded code.
There are always interpreters like MicroPython, but be real: it's not the same.

Additional context.

No response

@github-actions github-actions bot changed the title [Feature request] elf-loader for RISC-V based ESP32 (like C6) [Feature request] elf-loader for RISC-V based ESP32 (like C6) (IDFGH-14086) Nov 16, 2024
@igrr
Copy link
Member

igrr commented Nov 18, 2024

Thanks for the request, I will transfer your issue to https://github.com/espressif/esp-iot-solution/ since the elf-loader component is developed there. AFAIK, support for RISC-V (e.g. ESP32-P4) is in progress.

@igrr igrr transferred this issue from espressif/esp-idf Nov 18, 2024
@github-actions github-actions bot changed the title [Feature request] elf-loader for RISC-V based ESP32 (like C6) (IDFGH-14086) [Feature request] elf-loader for RISC-V based ESP32 (like C6) (IDFGH-14086) (AEGHB-880) Nov 18, 2024
@metarutaiga
Copy link

metarutaiga commented Nov 22, 2024

I finish it this week for ESP32-C3.
I changed some functions that I can run it from file.
the CONFIG_ESP_SYSTEM_MEMPROT_FEATURE must be disabled

https://github.com/NyankoLab/esp32c3-elf/blob/extra/elf_loader/src/esp_elf.c
https://github.com/NyankoLab/esp32c3-elf/blob/extra/elf_loader/src/arch/esp_elf_riscv.c

And I have a relocation executable to strip unneeded symbol for Relocatable ELF.
Yes, I use the Relocatable ELF instead of the Static ELF.

https://github.com/NyankoLab/esp32c3-elf/blob/extra/build/relocation.c

@martinssense
Copy link
Author

That's awesome! I'll take it as reference and try it out on C6 the upcoming days. Thanks a lot for the work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants