Skip to content

Still needed for STM32CubeIDE v1.7.0 and later? #10

@g-mocken

Description

@g-mocken

At the time of writing, the current version of STM32CubeIDE is v.1.11.2. Its user manual has a section 2.7 stating:

Thread-safe wizard for empty projects and CDTTM projects
STM32CubeIDE includes a thread-safe wizard to generate files to support the use of resources that can be updated by application code and interrupts or when using a real-time operating system.

In this wizard one can select among several strategies, which are described as follows in the manual:

  1. User defined thread-safe implementation.
    User defined solution for handling thread-safety.
    NOTE: The stubs in stm32_lock_user.h needs to be implemented to gain
    thread-safety.

  2. Allow lock usage from interrupts.
    This implementation will ensure thread-safety by disabling all interrupts
    during e.g. calls to malloc.
    NOTE: Disabling all interrupts creates interrupt latency which
    might not be desired for this application!

  3. Deny lock usage from interrupts.
    This implementation assumes single thread of execution.
    Thread-safety dependent functions will enter an infinity loop
    if used in interrupt context.

  4. Allow lock usage from interrupts. Implemented using FreeRTOS locks.
    This implementation will ensure thread-safety by entering RTOS ISR capable
    critical sections during e.g. calls to malloc.
    By default this implementation supports 2 levels of recursive locking.
    Adding additional levels requires 4 bytes per lock per level of RAM.
    NOTE: Interrupts with high priority are not disabled. This implies
    that the lock is not thread-safe from high priority interrupts!

  5. Deny lock usage from interrupts. Implemented using FreeRTOS locks.
    This implementation will ensure thread-safety by suspending all tasks
    during e.g. calls to malloc.
    NOTE: Thread-safety dependent functions will enter an infinity loop
    if used in interrupt context.

I do not remember such options being present in releases earlier than 1.7.0, whose release notes and erratum list "Thread-safe malloc solution" for the first time.

While the above sounds very promising, does it really mean that Dave's excellent FreeRTOS helpers are no longer needed?
While they work very well, setup and usage together with STM32CubeIDE's code generation is somewhat tiring, so it would be nice to have an equivalent one-click replacement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions