zephyr/samples/application_development/code_relocation_nocopy
Andrzej Głąbek e3ee5c09f2 samples: code_relocation_nocopy: Make linker script more generic
Instead of depending on the nRF5340 DK, use a path specific to just
the nRF5340 SoC and get the size of the external flash in this case
from devicetree so that the sample could be easily run on other boards
based on the nRF5340 SoC (after just adding proper overlays).

On the occasion, correct the attributes of the EXTFLASH memory region.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-09-13 16:20:34 +02:00
..
boards samples: code_relocation_nocopy: Use nrf_qspi_nor driver to init XIP 2023-09-13 16:20:34 +02:00
src modules: cmsis: move glue code to modules/cmsis 2023-08-24 13:20:21 +02:00
CMakeLists.txt samples: code_relocation_nocopy: Use nrf_qspi_nor driver to init XIP 2023-09-13 16:20:34 +02:00
linker_arm_nocopy.ld samples: code_relocation_nocopy: Make linker script more generic 2023-09-13 16:20:34 +02:00
prj.conf samples: code_relocation_nocopy: Disable gap filling 2022-06-24 20:29:00 +02:00
README.rst samples: code_relocation_nocopy: Update documentation 2022-06-24 20:29:00 +02:00
sample.yaml samples, tests: convert string-based twister lists to YAML lists 2023-05-10 09:52:37 +02:00

.. _code_relocation_nocopy:

Code relocation nocopy
######################

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.

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

The nRF5340 DK has a 64 Mb external flash memory supporting Quad SPI. It is
possible to do XIP from the external flash memory.

The external flash memory is mapped to 0x10000000.

In this sample we relocate some of the code to the external flash memory with
the remaining Zephyr kernel in the internal flash.

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:

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