Tx_MPU Application Description

This project is composed of two sub-projects:

At the module manager stage, the main entry function tx_application_define() is called by ThreadX during kernel start, the application creates 1 thread and 1 message queue:

ModuleManager thread uses the ThreadX Module Manager APIs to configure, load and start the expected module. ResidentQueue is used to synchronize operations between Module Manager and the loaded Module.

At the module stage, the main entry function default_module_start() is called by ThreadX during module start, the application creates 1 thread:

MainThread is expected to execute data read and write operations to/from user-defined Shared Memory regions. Memory protection is then demonstrated by trapping the Module’s attempt at writing to the shared Read Only region. A Memory Fault is then expected before the unload of the module and the module manager continues to run correctly.

Expected success behavior

Error behaviors

Assumptions if any

Known limitations

Notes

  1. By default ThreadX module configures the memory as shareable which not supported by stm32C0, the following flags should be overridden in the txm_module_user file as below :

The preprocessor flag “TXM_MODULE_INCLUDE_USER_DEFINE_FILE” should be added in the C preprocessor list to take into account the above change.

  1. A preamble is required with each Module to expose the module configuration to the Module Manager. Particularly the preamble contains information such as the module unique ID and attributes. Module Properties (attributes) is a 32bit word, laid out as:

For this application demonstrating MPU memory protection on modules, the attributes should be set as follows:

The above configuration results in an attributes word equals 0x00000007

  1. All C files in a module must #define TXM_MODULE prior to including txm_module.h. Doing so remaps the ThreadX API calls to the module-specific version of the API that invokes the dispatch function in the resident Module Manager to perform the call to the actual API function.

ThreadX usage hints

Keywords

Hardware and Software environment

How to use it ?