Skip to content

llext: xtensa: improvements for xtensa platform#1

Open
andreagilardoni wants to merge 2263 commits intopillo79:mainfrom
andreagilardoni:llext-xtensa-improvements
Open

llext: xtensa: improvements for xtensa platform#1
andreagilardoni wants to merge 2263 commits intopillo79:mainfrom
andreagilardoni:llext-xtensa-improvements

Conversation

@andreagilardoni
Copy link

@andreagilardoni andreagilardoni commented Nov 26, 2025

This PR aims to improve the integration with the xtensa platform, in particular for espressif based boards, like esp32s3 soc.

Main changes:

  • redefining arch_elf_relocate with zephyr llext standard flow, optionally available
  • little code optimizations
  • code refactoring for Harvard based architectures

@andreagilardoni andreagilardoni force-pushed the llext-xtensa-improvements branch from 8e5963a to 3022f69 Compare November 26, 2025 16:29
Copy link
Owner

@pillo79 pillo79 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General first review comments:

  • Zephyr needs to support bisecting so every commit needs to be self-supporting. Support for something must come before or together with the first users of something.

  • merge similar commits describing the overall goal: for example [llext: xtensa: harvard based architectures address check] and [llext: xtensa: fixing text section reuse check] must become one, also [arc: llext: custom settings for arc architecture] should be merged or before [llext: heap: section attribute customization].

  • we need to understand how to add the information in arch/arc/include/llext_arch_custom.h file in a way that is hierarchical. 🤔 ⚙️ 💭

Comment on lines +17 to +19
#if CONFIG_HARVARD && CONFIG_ARC
#include <llext_arch_custom.h>
#endif
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how to fix this, but we can't have this kind of per-arch or per-soc logic in llext.

Comment on lines +33 to +37
#include <memory.h>

#define INSTR_FETCHABLE(base_addr, alloc) \
(IN_RANGE((uintptr_t)(base_addr), SRAM1_IRAM_START, SRAM1_IRAM_START + SRAM1_SIZE) && \
IN_RANGE((uintptr_t)(base_addr) + alloc, SRAM1_IRAM_START, SRAM1_IRAM_START + SRAM1_SIZE))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (and the above) need to be moved to the same place as the stuff in arc_custom - where ❓ .

@andreagilardoni andreagilardoni force-pushed the llext-xtensa-improvements branch 2 times, most recently from 2e19a35 to d04c782 Compare December 1, 2025 15:49
@github-actions
Copy link

github-actions bot commented Dec 1, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
hal_afbr zephyrproject-rtos/hal_afbr@4e1eea7 zephyrproject-rtos/hal_afbr@1abf694 (zephyr) zephyrproject-rtos/hal_afbr@4e1eea7e..1abf6947
hal_bouffalolab zephyrproject-rtos/hal_bouffalolab@4d6677b zephyrproject-rtos/hal_bouffalolab@6236ecf (main) zephyrproject-rtos/hal_bouffalolab@4d6677b8..6236ecf4
hal_espressif zephyrproject-rtos/hal_espressif@af6cfa2 zephyrproject-rtos/hal_espressif@1980701 (main) zephyrproject-rtos/hal_espressif@af6cfa2e..19807014
hal_infineon zephyrproject-rtos/hal_infineon@26ccd68 zephyrproject-rtos/hal_infineon@470f874 (master) zephyrproject-rtos/hal_infineon@26ccd682..470f874c
hal_microchip zephyrproject-rtos/hal_microchip@89754d8 zephyrproject-rtos/hal_microchip@dbbff4a (master) zephyrproject-rtos/hal_microchip@89754d87..dbbff4a0
hal_nordic zephyrproject-rtos/hal_nordic@7858281 zephyrproject-rtos/hal_nordic@248eadc zephyrproject-rtos/hal_nordic@7858281d..248eadca
hal_nxp zephyrproject-rtos/hal_nxp@a7f64ac zephyrproject-rtos/hal_nxp@1fecd5a zephyrproject-rtos/hal_nxp@a7f64ac2..1fecd5a1
hal_realtek 🆕 N/A (Added) zephyrproject-rtos/hal_realtek@4f8703e N/A
hal_renesas zephyrproject-rtos/hal_renesas@a279c14 zephyrproject-rtos/hal_renesas@69c3df1 zephyrproject-rtos/hal_renesas@a279c14e..69c3df17
hal_silabs zephyrproject-rtos/hal_silabs@5d75cba zephyrproject-rtos/hal_silabs@6bde23d (main) zephyrproject-rtos/hal_silabs@5d75cba8..6bde23d6
hal_stm32 zephyrproject-rtos/hal_stm32@286dd28 zephyrproject-rtos/hal_stm32@9325b43 zephyrproject-rtos/hal_stm32@286dd285..9325b437
hal_tdk zephyrproject-rtos/hal_tdk@6727477 zephyrproject-rtos/hal_tdk@60708f2 zephyrproject-rtos/hal_tdk@6727477a..60708f2c
hostap zephyrproject-rtos/hostap@51698b0 zephyrproject-rtos/hostap@5af8b17 zephyrproject-rtos/hostap@51698b0f..5af8b179
libmetal zephyrproject-rtos/libmetal@91d3863 zephyrproject-rtos/libmetal@66e0842 (main) zephyrproject-rtos/libmetal@91d38634..66e08429
lora-basics-modem zephyrproject-rtos/lora-basics-modem@9a14f67 zephyrproject-rtos/lora-basics-modem@a8ddc54 (master) zephyrproject-rtos/lora-basics-modem@9a14f677..a8ddc544
mcuboot zephyrproject-rtos/mcuboot@f3cc947 zephyrproject-rtos/mcuboot@9ac7296 (main,upstream-sync) zephyrproject-rtos/mcuboot@f3cc9476..9ac72969
nrf_hw_models zephyrproject-rtos/nrf_hw_models@26ed181 zephyrproject-rtos/nrf_hw_models@0f0c437 zephyrproject-rtos/nrf_hw_models@26ed1811..0f0c4374
nrf_wifi zephyrproject-rtos/nrf_wifi@a39e9b1 zephyrproject-rtos/nrf_wifi@9f09f07 zephyrproject-rtos/nrf_wifi@a39e9b15..9f09f078
open-amp zephyrproject-rtos/open-amp@c30a6d8 zephyrproject-rtos/open-amp@5efe797 (main) zephyrproject-rtos/open-amp@c30a6d8b..5efe7974
psa-arch-tests zephyrproject-rtos/psa-arch-tests@87b0868 (zephyr_psa-arch-tests_v1.6_tf-m_v2.2.0) zephyrproject-rtos/psa-arch-tests@941cd84 (zephyr_psa-arch-tests_v1.6) zephyrproject-rtos/psa-arch-tests@87b08682..941cd843
segger zephyrproject-rtos/segger@9f08435 zephyrproject-rtos/segger@7c843ea (master) zephyrproject-rtos/segger@9f08435a..7c843ea2
tf-m-tests zephyrproject-rtos/tf-m-tests@a90702b (zephyr_tf-m-tests_v2.2.0) zephyrproject-rtos/tf-m-tests@cde5b6e (zephyr_tf-m-tests_v2.2.2) zephyrproject-rtos/tf-m-tests@a90702bc..cde5b6ed
trusted-firmware-m zephyrproject-rtos/trusted-firmware-m@04aa724 zephyrproject-rtos/trusted-firmware-m@e9ea674 zephyrproject-rtos/trusted-firmware-m@04aa7243..e9ea674e
uoscore-uedhoc zephyrproject-rtos/uoscore-uedhoc@54abc10 zephyrproject-rtos/uoscore-uedhoc@ac80c3b (zephyr) zephyrproject-rtos/uoscore-uedhoc@54abc109..ac80c3bf

Additional metadata changed:

Name URL Submodules West cmds module.yml Blobs
hal_afbr 2x 🆕
nrf_wifi 5x ✏
tf-m-tests

DNM label due to: 1 added project, 3 projects with metadata changes and 7 blob changes

Note: This message is automatically posted and updated by the Manifest GitHub Action.

haduongquang and others added 13 commits January 6, 2026 13:37
Enable api and looback test for S32K5 PWM(eMIOS)

Signed-off-by: Ha Duong Quang <ha.duongquang@nxp.com>
… in v1

Commit e7f222a fixed the bug where a data size mismatch produces unexpected
behavior with the DMA on V1 devices. However, this limitation is only valid
for the STM32 series with V1 DMA, V2 doesn't have this. The STM32CubeMX
configuration tool correctly implements this limitation in the UI,
it is a good way to cross-check.

Signed-off-by: Benedek Kupper <kupper.benedek@gmail.com>
Updates the time slicing image in the associated documentation to ...

1. Show the resetting of a time slice after scheduling a new thread
2. Indicate that it is specific for UP scheduler

It also adds a note to the documentation describing how the ordering
of the threads would change with the SMP scheduler.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Adds a short section explaining how thread ordering between UP and
SMP systems differ.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Until now transmission FIFO was not used.
With this chamge the FIFO will be filled up, until it is full.

Signed-off-by: Daniel Fladerer <d.fladerer@gmx.de>
Since e150ffb, Zephyr only really
supports native_simulator based targets when building native/posix
arch based targets.
So this comment is not relevant anymore. Let's remove it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The debug/stack.h header uses k_thread types and APIs such as
struct k_thread, k_thread_stack_space_get(), and k_thread_name_get(),
but does not include <zephyr/kernel.h>.

This makes the header rely on transitive includes, which can lead to
build failures depending on include order.

Add an explicit include of <zephyr/kernel.h> to make the header
self-contained.

Signed-off-by: Michele Sardo <msmttchr@gmail.com>
Add a trailing space to the Ruff error message string in the compliance
checking script. Previously, the error message concatenated the URL and
the description with a colon (e.g., ".../unsorted-imports:Import").
This caused the terminal to interpret the description as part of the URL,
resulting in a 404 error when clicked.

Signed-off-by: Thamaraimanalan M <devthamaraimanalan.m@gmail.com>
Tested with the commands mentioned in index.rst

Product photo from https://www.cytron.io/p-motion-2350-pro

Signed-off-by: Jonas Berg <jonas.s.t.berg@gmail.com>
Enabled servo port GP0. Added commented-out entries for the other ports,
as is done for the other overlay files.

Signed-off-by: Jonas Berg <jonas.s.t.berg@gmail.com>
Add Framework Computer Inc

Signed-off-by: Daniel Schaefer <dhs@frame.work>
The following examples build and work as expected.

Blink backlight using PWM on white backlight keyboard or numpad:
> west build -p -b framework_laptop16_keyboard samples/basic/blinky_pwm

Blink capslock on keyboard (not numpad or macropad):
> west build -p -b framework_laptop16_keyboard samples/basic/blinky_pwm

> west build -p -b framework_laptop16_keyboard samples/subsys/usb/console
> west build -p -b framework_laptop16_keyboard samples/subsys/usb/cdc_acm
> west build -p -b framework_laptop16_keyboard samples/drivers/adc/adc_dt

Signed-off-by: Daniel Schaefer <dhs@frame.work>
Update Zephyr fork of MCUboot to revision:
  9ac72969f281491d677e669d053281fc2d538ed4

Brings following Zephyr relevant fixes:

  - 9ac72969 boot: bootutil: loader: Fix bootstrap copying in
    swap move mode
  - 3f69203f bootutil: ed25519 psa: Merge bootutil_verify_sig and
    bootutil_verify
  - 7f354916 bootutil: Remove bootutil_verify_img
  - 7cec4af1 bootutil: Replace bootutil_verify_img with
    bootutil_verify_sig
  - 4a57d03d boot: zephyr: socs: stm32h7s3xx: Add support for
    ext_flash_app variant
  - a21fd276 bootutil: Small logging improvements
  - 0acc9806 bootutil: boot_read_enc_key now returns boolean
  - 553be8b0 readme: Update for next dev release
  - eecc3f7d Release v2.3.0

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
andreagilardoni and others added 17 commits January 19, 2026 14:32
Adding support for arduino nano esp32

Signed-off-by: Andrea Gilardoni <a.gilardoni@arduino.cc>
Harvard architecture refers to a CPU architecture with separate storage
and signal pathways for instructions and data. This is in contrast with
the more common von Neumann architecture, where program instructions and
data share the same address maps.

This is already used in the ARC architecture, so this patch adds a
common HARVARD config option in arch/Kconfig, and makes ARC's existing
HARVARD config option user-selectable.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This change marks the Xtensa architecture as having separate code and
data paths. This is necessary for proper handling of llext buffers.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
A valid elf file may contain a relocation section with no relocation to
perform, skipping its relocation

Signed-off-by: Andrea Gilardoni <a.gilardoni@arduino.cc>
This change aligns xtensa llext link procedure to follow the other
architecures linkage flow in favor of code reuse

Signed-off-by: Andrea Gilardoni <a.gilardoni@arduino.cc>
This options allows to select the relocation method to perform on xtensa
platform. If disable this allows to use the common flow used by other
platforms

Signed-off-by: Andrea Gilardoni <a.gilardoni@arduino.cc>
llext_loaded_sect_ptr result is not being usend anywhere

Signed-off-by: Andrea Gilardoni <a.gilardoni@arduino.cc>
memory.h file in esp32s3 soc definition is missing SRAM1_SIZE

Signed-off-by: Andrea Gilardoni <a.gilardoni@arduino.cc>
This commit adds the missing definition of INSTR_FETCHABLE macro that is
required for Harvard architectures in order to properly check that the
address of an instruction is being accessed on the proper instruction
bus

Signed-off-by: Andrea Gilardoni <a.gilardoni@arduino.cc>
This commit adds arch_d2i_address and arch_i2d_address which can be used
in an harvard based architecture to convert an address from being
accessed through the data bus to the instruction bus and vicevers

Signed-off-by: Andrea Gilardoni <a.gilardoni@arduino.cc>
The extracted section name is only used when CONFIG_LLEXT_XTENSA_PLT=y
or debug logging is enabled

Signed-off-by: Andrea Gilardoni <a.gilardoni@arduino.cc>
Adding a file that contains ARC specific customization for llext, i.e.
data and instruction heap section attributes definition

Signed-off-by: Andrea Gilardoni <a.gilardoni@arduino.cc>
This commit add the possibility of using externally defined section
attributes for instr and data heaps for Harvard based architectures

Signed-off-by: Andrea Gilardoni <a.gilardoni@arduino.cc>
using arch_d2i_address function for llext to check init function
addresess correctly in the ibus space

Signed-off-by: Andrea Gilardoni <a.gilardoni@arduino.cc>
converting text section addess to instruction space in order to check
correclty for reuse for xtensa architecture

Signed-off-by: Andrea Gilardoni <a.gilardoni@arduino.cc>
Added LLEXT_SEPARATE_HEAPS option to disable heap separation on harvard
architectures, the default value is enabled

Signed-off-by: Andrea Gilardoni <a.gilardoni@arduino.cc>
Nano esp32 board needs specific settings fot llext to work:
- LLEXT_XTESA_PLT=n: it has been tested to use the normal flow shared
  among other architectures instead of xtensa specific PLT
- LLEXT_SEPARATE_HEAPS=n: depite being an Harvard architecture a
  nano esp32 could use a single heap for both data and intructions, in
  order to improve memory usage
@andreagilardoni andreagilardoni force-pushed the llext-xtensa-improvements branch from 548e71e to 7189a79 Compare January 19, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment