arch: fall back to the kernel heap when there is no separate text heap#19256
Open
ricardgb wants to merge 1 commit into
Open
arch: fall back to the kernel heap when there is no separate text heap#19256ricardgb wants to merge 1 commit into
ricardgb wants to merge 1 commit into
Conversation
linguini1
requested changes
Jul 4, 2026
linguini1
left a comment
Contributor
There was a problem hiding this comment.
Waiting for consensus about fully generated PRs.
ricardgb
force-pushed
the
rp23xx-textheap
branch
from
July 23, 2026 15:52
a17aa54 to
e17c0f1
Compare
Contributor
Author
|
Rebased onto the latest master (patch unchanged) and updated the commit trailer to the |
When an architecture does not provide a separate text heap (CONFIG_ARCH_USE_TEXT_HEAP is not selected), redirect the text heap API to the normal kernel heap in include/nuttx/arch.h. On flat-memory architectures the kernel heap is executable, so code written against the portable API (up_textheap_memalign() and friends) now works on every such port without per-arch stubs that just wrap kmm_memalign(). Suggested by review on the previous revision of this change, which added exactly such a stub for rp23xx. up_textheap_data_address() and up_textheap_data_sync() identity fallbacks become available unconditionally as well. Gate the sim implementation on CONFIG_ARCH_USE_TEXT_HEAP: it was compiled unconditionally (harmless before, but it would now collide with the fallback macros), matching how every other implementation is already gated in its Make.defs/CMakeLists. Assisted-by: Claude (Anthropic Claude Code) Signed-off-by: Ricard Rosson <ricard@groundbits.com>
ricardgb
force-pushed
the
rp23xx-textheap
branch
from
July 24, 2026 06:48
e17c0f1 to
0a7171b
Compare
xiaoxiang781216
approved these changes
Jul 24, 2026
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
Reworked per review: instead of adding a per-arch text-heap stub for rp23xx, the text heap API now falls back to the normal kernel heap at the common layer, as suggested by @xiaoxiang781216.
include/nuttx/arch.h: whenCONFIG_ARCH_USE_TEXT_HEAPis not set,up_textheap_memalign()/up_textheap_free()/up_textheap_heapmember()redirect tokmm_memalign()/kmm_free()/kmm_heapmember(), and theup_textheap_data_address()/up_textheap_data_sync()identity fallbacks become available unconditionally. On flat-memory architectures the kernel heap is executable, so code written against the portable text-heap API works on every such port (rp23xx included) with no per-arch boilerplate.arch/sim/src/sim/sim_sectionheap.c: gate the sim text-heap implementation onCONFIG_ARCH_USE_TEXT_HEAP— it was compiled unconditionally (harmless before, but it would collide with the fallback macros), and every other implementation is already gated this way in its Make.defs/CMakeLists.up_textheap_*stub from the previous revision is dropped entirely.Existing common consumers (
libs/libc/elf) are unchanged — they already carry their ownlib_memalign()fallbacks whenCONFIG_ARCH_USE_TEXT_HEAPis unset.Impact
Direct callers of the text-heap API now build and work on flat-memory ports without the architecture claiming
ARCH_HAVE_TEXT_HEAP. No change in behavior whereCONFIG_ARCH_USE_TEXT_HEAPis enabled.Testing
sim:nshbuilds clean both with and withoutCONFIG_ARCH_USE_TEXT_HEAP(both sides of the new gating).raspberrypi-pico-2:nshbuilds clean.up_textheap_memalign(),up_textheap_heapmember(),up_textheap_data_address(),up_textheap_data_sync()andup_textheap_free()through the fallback macros compiles clean for Cortex-M33 (arm-none-eabi-gcc,-Wall -Werror).checkpatch.shclean.Disclosure: this change was developed with an AI agent (Claude Code, Anthropic) and human-reviewed before submission.