zephyr/samples/application_development/code_relocation_nocopy
Pete Johanson 3821e5db62 drivers: flash: Support XIP for MAX32 SPIXF flash
Properly configure the MAX32 SPIXF peripheral to use the SPIXF controller
for transparent memory mapped reads, and enable the SPIXF main controller
and use it for writes.

Add support for testing XIP support to the nocopy sample, which requires
flashing with OpenOCD with MAX32690 QSPI flash support.

Signed-off-by: Pete Johanson <pete.johanson@analog.com>
2025-07-19 10:08:46 +02:00
..
boards drivers: flash: Support XIP for MAX32 SPIXF flash 2025-07-19 10:08:46 +02:00
src
CMakeLists.txt
linker_arm_nocopy.ld drivers: flash: Support XIP for MAX32 SPIXF flash 2025-07-19 10:08:46 +02:00
prj.conf boards: samples: remove CONFIG_BUILD_NO_GAP_FILL=y and similar 2024-12-02 11:14:09 +01:00
README.rst
sample.yaml tests: fix various test ids and use existing scheme 2025-04-07 11:22:36 +02:00

.. zephyr:code-sample:: code_relocation_nocopy
   :name: Code relocation nocopy

   Relocate code, data, or bss sections using a custom linker script.

Overview
********
A simple example that demonstrates how relocation of code, data or bss sections
using a custom linker script.

Differently from the code relocation sample, this sample is relocating the
content of the ext_code.c file to a different FLASH section and the code is XIP
directly from there without the need to copy / relocate the code. All other code
(e.g. main(), Zephyr kernel) stays in the internal flash.

nRF5340 DK platform instructions
********************************

The nRF5340 DK has a 64 Mb external flash memory supporting Quad SPI. It is
mapped to 0x10000000.

To build and flash the application (including the external memory part):

.. zephyr-app-commands::
   :zephyr-app: samples/application_development/code_relocation_nocopy
   :board: nrf5340dk/nrf5340/cpuapp
   :goals: build flash
   :compact:

STM32F769I-Discovery platform instructions
******************************************

The stm32f769i_disco has 64MB of external flash attached via QSPI. It is mapped
to 0x90000000.

.. zephyr-app-commands::
   :zephyr-app: samples/application_development/code_relocation_nocopy
   :board: stm32f769i_disco
   :goals: build flash
   :compact:

STM32 b_u585i_iot02a Discovery kit instructions
***********************************************

The b_u585i_iot02a has 64MB of external flash attached via OSPI. It is mapped
to 0x70000000.

.. zephyr-app-commands::
   :zephyr-app: samples/application_development/code_relocation_nocopy
   :board: b_u585i_iot02a
   :goals: build flash
   :compact:

Execution output
****************

.. code-block:: console

  *** Booting Zephyr OS build v3.0.0-rc3-25-g0df32cec1ff2  ***
  Address of main function 0x4f9
  Address of function_in_ext_flash 0x10000001
  Address of var_ext_sram_data 0x200000a0 (10)
  Address of function_in_sram 0x20000001
  Address of var_sram_data 0x200000a4 (10)
  Hello World! nrf5340dk/nrf5340/cpuapp