Skip to content

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 ❓ .

nashif and others added 25 commits November 26, 2025 12:11
Fix reference to kernel.h and add zephyr namespace where it was missing.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Many include paths missing the zephyr namespace.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Fix nsec set and get

Signed-off-by: Qingsong Gou <gouqs@hotmail.com>
Similarly to what was present on L0, GPIO port indexes are not continuous
in EXTI configuration register and a dedicated treatment is required.
Deal with it case by case.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
Multiple submitted requests are getting merged to single cancelled
net_buf on endpoint dequeue. While MSC class was correctly decrementing
the usage counters, it was not freeing SCSI buffer pointed to by frags.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Removing references to infineon,cat1-spi-pdl from the device tree files.
Updates the driver bindings and driver file to look at the
infineon,cat1-spi binding and uses a Kconfig option to select Legacy HAL
implementation instead.

See zephyrproject-rtos#98035 for context.

Signed-off-by: John Batch <john.batch@infineon.com>
Removing references to infineon,cat1-spi-pdl.  Differentiation between
PDL and HAL drivers have been changed to use Kconfig options.

Signed-off-by: John Batch <john.batch@infineon.com>
Add support for heltec_wireless_tracker

Signed-off-by: Ilan Costa <ilan.costa@gmail.com>
When low-power mode timer is enabled, a counter alarm is set on the
idle timer before entering low-power mode. The counter API requires
a non-NULL callback function for the alarm. This commit adds a stub
callback function to satisfy the API requirement.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
This commit adds a prompt to the Kconfig file to make
CORTEX_M_SYSTICK_RESET_BY_LPM option more visible to users
configuring the driver.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
Move the existing "--no-load" argument from the OpenOCD and Intel Cyclone V
runners into an argument in the runners base class such that it can be used
by all runners. Also update the existing runners to work with the common
option instead of their own.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Add support for the --load/--no-load argument from the base runner class.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Allow flash devices to be accessed using the NVMEM API. Note that it simply
uses the read/write API functions. Erasing should be handled by the
application.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Add an overlay/config to test the NVMEM subsystem with a flash driver.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Add an entry with Kconfig options for NVMEM on flash devices.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
ATT is invoking user callbacks in its net_buf destroy function. It is
common practice that these callbacks can block on bt_hci_cmd_alloc().
This is a deadlock when the net_buf_unref() happens inside the HCI
driver, invoked from tx_processor.

Blocking callbacks like this appear in our own samples. See further down
about how this problem was detected.

tx_processor not protect against blocking callbacks so it is de-facto
forbidden. The Host should not equip net_bufs with dangerous destroy
callbacks.

This commit makes ATT defer its net_buf destruction and user callback
invocation to the system workqueue, so that net_buf_unref is safe to
call from non-blocking threads. In the case of the deadlock, the
net_buf_unref() was below the tx_processor in the call stack, which (at
the time of this commit) is on the system work queue, so defering it to
the system work queue is preserving the existing behavior.

Future improvement may be to allow the user to provide their own
workqueue for ATT callbacks.

This deadlock was detected because the following test was failing while
moving tx_processor to the bt_taskq:

    tests/bsim/bluetooth/ll/throughput/tests_scripts/gatt_write.sh

The above test has an ATT callback `write_cmd_cb` invokes
`bt_conn_le_param_update` can block waiting for `tx_processor`.

The reason it was not failing while tx_processor was on the system work
queue is that the GATT API has a special non-blocking behavior when
called from the system work queue.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Reduce BT_MAX_CONN from 62 to 61 to make it build on integration
platform qemu_cortex_m3/ti_lm3s6965 when we add bt_taskq in subsequent
commit.

The number 62 seems arbitrary here, so reducing it by one should not
have any practical impact.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
When thread that TX processor is used to send commands and data to
Controller is also used for sync commands sending and command buffer
allocation, a deadlock happens.

This thread is used to avoid such deadlocks by moving TX processor to
its own dedicated thread exclusively used by tx processor only.

Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
The workaround in bt_cmd_send_sync should no longer by needed when
tx_processor is not on the system work queue.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Add spi controller bingdings

Signed-off-by: Qingsong Gou <gouqs@hotmail.com>
Add spi for sf32lb platform

Signed-off-by: Qingsong Gou <gouqs@hotmail.com>
Add spi driver for sifli sf32lb platform

Signed-off-by: Qingsong Gou <gouqs@hotmail.com>
Enable spi1 on sf32lb52_devkit_lcd board

Signed-off-by: Qingsong Gou <gouqs@hotmail.com>
Add board sf32lb52_devkit_lcd support

Signed-off-by: Qingsong Gou <gouqs@hotmail.com>
Replace use of `select` with `depends on` in the LL_SW_SPLIT
Kconfig options.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
@andreagilardoni andreagilardoni force-pushed the llext-xtensa-improvements branch from 3022f69 to 2e19a35 Compare November 27, 2025 09:35
Updates hal version to have spi defines fixes.

Signed-off-by: Camille BAUD <mail@massdriver.space>
Removed unnecessary power management state lock calls since the DMA is
on a power domain that already handles state locking.
It will now managed directly pm_device which will active power_domain
and then block pm_state.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
This patch fix a reg write that needs to be done before calling the
callback. Since the user can start a new dma transfer in the callback,
it can miss the interrupt from the new transfer if the new transfer is
done before the interrupt bit is cleared.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
Removed conditional checks for device runtime put in DMA RX and
TX callbacks, ensuring that device runtime is always released
asynchronously.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
@andreagilardoni andreagilardoni force-pushed the llext-xtensa-improvements branch 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_bouffalolab zephyrproject-rtos/hal_bouffalolab@4d6677b zephyrproject-rtos/hal_bouffalolab@ebecd18 (main) zephyrproject-rtos/hal_bouffalolab@4d6677b8..ebecd183
hal_espressif zephyrproject-rtos/hal_espressif@af6cfa2 zephyrproject-rtos/hal_espressif@78f88d7 (main) zephyrproject-rtos/hal_espressif@af6cfa2e..78f88d79
hal_nordic zephyrproject-rtos/hal_nordic@7858281 zephyrproject-rtos/hal_nordic@564e754 (master,nrfx-4.0.1) zephyrproject-rtos/hal_nordic@7858281d..564e7541
hal_renesas zephyrproject-rtos/hal_renesas@a279c14 zephyrproject-rtos/hal_renesas@d010390 zephyrproject-rtos/hal_renesas@a279c14e..d0103907
hal_silabs zephyrproject-rtos/hal_silabs@5d75cba zephyrproject-rtos/hal_silabs@091a5bb (main) zephyrproject-rtos/hal_silabs@5d75cba8..091a5bbd
hal_tdk zephyrproject-rtos/hal_tdk@6727477 zephyrproject-rtos/hal_tdk@60708f2 (main) zephyrproject-rtos/hal_tdk@6727477a..60708f2c
mcuboot zephyrproject-rtos/mcuboot@f3cc947 zephyrproject-rtos/mcuboot@c11e845 (main,upstream-sync) zephyrproject-rtos/mcuboot@f3cc9476..c11e845e
nrf_hw_models zephyrproject-rtos/nrf_hw_models@26ed181 zephyrproject-rtos/nrf_hw_models@5eec7ac (main,nrf4.0.0) zephyrproject-rtos/nrf_hw_models@26ed1811..5eec7aca
trusted-firmware-m zephyrproject-rtos/trusted-firmware-m@04aa724 zephyrproject-rtos/trusted-firmware-m@c2f9edc (main) zephyrproject-rtos/trusted-firmware-m@04aa7243..c2f9edc7

All manifest checks OK

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

pillo79 and others added 14 commits December 1, 2025 17:25
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.