Guidance on Plugin Architecture for CORTEX-M7 Firmware with FreeRTOS, Supporting PIC and Distinct RAM for Code and Data

I am working on an advanced firmware project for Cortex-M microcontrollers, leveraging FreeRTOS, and I'm exploring the implementation of a plugin system. My aim is to allow clients to independently develop and deploy their algorithms as plugins. Here are the key aspects of my current setup and requirements:

  • Firmware Base: The core firmware is not compiled as Position-Independent Code (PIC), but I am open to the possibility of having the plugins themselves be PIC.
  • Development Stack: The project uses LittleFS for file management and gcc-arm-none-eabi as the toolchain.
  • Memory Management: A unique requirement is that the plugins might have their code and data in different RAM locations. Additionally, I'm considering utilizing different types of memory for data - fast (DTCM) and standard SRAM.

Given this setup, I have several questions where I would greatly appreciate the community's input:

  1. Plugin File Format and Loading: What file format would be most suitable for these plugins, and how should I approach loading them into the system, considering the need for different memory locations for code and data?
  2. Function Entry Points in Non-PIC Firmware: How can I manage function entry points for the plugins to interact with the non-PIC firmware, especially with the possibility of address changes upon recompilation?
  3. Memory Allocation: Any best practices or recommendations for handling distinct memory types for plugin code and data, especially in the context of FreeRTOS?
  4. Security and Stability Considerations: How can I ensure the security and stability of the system, particularly when dealing with dynamic loading of third-party plugins?

Any insights, suggestions, or references to similar projects or implementations would be incredibly helpful.

Thank you in advance for your assistance and guidance!