Hello Interrupt Community,
I am currently engaged in a firmware project for Cortex-M microcontrollers (NXP RT1175). As per a specific client request, I need to implement a “plugin” functionality, similar (I guess) to the Linkable Loadable Extensions (LLEXT) subsystem in Zephyr OS (Linkable Loadable Extensions (LLEXT) — Zephyr Project Documentation), which provides a dynamic way to extend application functionality with linkable loadable code. However, I am constrained to use FreeRTOS for this project.
My development stack includes FreeRTOS, LittleFS, and the gcc-arm-none-eabi toolchain. The core firmware is not compiled as Position-Independent Code (PIC) at the moment, but the plugins developed by the client could be PIC. A significant requirement is that these plugins might need to manage their code and data in different RAM locations, utilizing both fast memory (DTCM) and standard SRAM.
I am seeking advice on several fronts:
- Plugin File Format and Loading Strategy: Considering the diverse memory requirements and the non-PIC nature of the main firmware, what would be the most suitable file format for these plugins? Additionally, how should the system load and execute them?
- Function Entry Points for Non-PIC Firmware: How can I effectively manage the entry points for the plugins to interact with the non-PIC firmware, especially considering potential changes in function addresses upon recompilation?
- Handling Different Types of Memory: Are there best practices for allocating and managing different types of memory (DTCM and SRAM) for plugin code and data in a FreeRTOS environment?
- Security and Stability: What measures can I take to ensure the security and stability of the system when dynamically loading third-party plugins?
- Compilation and Linking Details: A fundamental aspect is understanding how both my firmware and the plugins should be compiled and linked. What parameters are useful or necessary for compiling and linking? Is there a need for an additional post-linking step for the plugin, as suggested by resources like udynlink?
I am intrigued by the LLEXT approach in Zephyr OS and am looking for ways to implement a similar plugin system in FreeRTOS. Any insights, suggestions, or references to similar projects would be immensely helpful.
Thank you for your time and assistance!