Repository navigation
PlatformIO library, RTOS lock options, printf stats - #1
Merged
Merged
Conversation
- Lock selected at compile time: XALLOC_LOCK_FREERTOS, _THREADX, _ZEPHYR, _CMSIS_RTOS2 (critical sections, ISR-safe), _USER, _NONE. Default is std::mutex where the C++ library provides it, otherwise no lock. DelegateMQ DMQ_THREAD_* options select the matching lock. - xalloc_stats() uses printf instead of iostream (smaller on MCUs). - library.json and examples/platformio/xallocator-demo (ESP32, ESP32-C3, Nucleo-F401RE, STM32F4 Discovery with FreeRTOS, Pico, native). - CI: PlatformIO board builds and RTOS lock compile checks. - README: PlatformIO section, lock options, license badge fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
XALLOC_LOCK_FREERTOSusestaskENTER_CRITICAL, or the_FROM_ISRform inside an interrupt on Cortex-M. On ESP32 it uses aportENTER_CRITICAL_SAFEspinlock. It takes no lock until the scheduler starts.XALLOC_LOCK_THREADXusestx_interrupt_control.XALLOC_LOCK_ZEPHYRusesirq_lock.XALLOC_LOCK_CMSIS_RTOS2uses Cortex-M PRIMASK.XALLOC_LOCK_USERcalls your ownxalloc_lock()/xalloc_unlock(), andXALLOC_LOCK_NONEtakes no lock.std::mutexwhere the C++ library provides it; no lock on bare-metal toolchains without thread support.DMQ_THREAD_*options select the matching lock.xalloc_stats()now usesprintfinstead of<iostream>. The ESP32 example went from 481 KB to 273 KB of flash.library.jsonand the exampleexamples/platformio/xallocator-demo. Boards: ESP32, ESP32-C3, Nucleo-F401RE, STM32F4 Discovery (two FreeRTOS tasks), Pico and native.platformio.ymlbuilds 6 boards and runs the native build.rtos_locks.ymlcompiles the ThreadX, CMSIS-RTOS2, USER and NONE options against the vendor headers, in both heap blocks and static pools modes.Testing
XALLOC_LOCK_FREERTOS.-Werror.🤖 Generated with Claude Code