|  | 
|  | 1 | +.. _hello_world_xip: | 
|  | 2 | + | 
|  | 3 | +Hello World in XiP | 
|  | 4 | +################## | 
|  | 5 | + | 
|  | 6 | +Overview | 
|  | 7 | +******** | 
|  | 8 | + | 
|  | 9 | +A simple sample that can be used with any :ref:`supported board <boards>` | 
|  | 10 | +which has an external NOR octo- or quad- flash and | 
|  | 11 | +prints "Hello World from external flash" to the console. | 
|  | 12 | +The application is built and linked and downloaded in the external flash | 
|  | 13 | +while the mcuboot is built and downloaded for the internal flash | 
|  | 14 | +There is an overlay to set the partition in the external flash | 
|  | 15 | + | 
|  | 16 | +.. code-block:: console | 
|  | 17 | +
 | 
|  | 18 | +    chosen { | 
|  | 19 | +        zephyr,flash = &mx25lm51245; | 
|  | 20 | +        zephyr,flash-controller = &mx25lm51245; | 
|  | 21 | +        zephyr,code-partition = &slot0_partition; | 
|  | 22 | +    }; | 
|  | 23 | +
 | 
|  | 24 | +
 | 
|  | 25 | +Building and Running | 
|  | 26 | +******************** | 
|  | 27 | + | 
|  | 28 | +This application can be built with | 
|  | 29 | +west build -p always -b b_u585i_iot02a samples/boards/st/hello_world_xip/ --sysbuild -- -DSB_CONFIG_BOOTLOADER_MCUBOOT=y | 
|  | 30 | +Download the build/mcuboot/zephyr/zephyr.bin at internal flash address 0x08000000 | 
|  | 31 | +Download the build/hello_world_xip/zephyr/zephyr.signed.bin at internal flash address 0x70000000 (chosen zephyr,code-partition) | 
|  | 32 | +and executed on b_u585i_iot02a as follows: | 
|  | 33 | + | 
|  | 34 | +.. zephyr-app-commands:: | 
|  | 35 | +   :zephyr-app: samples/boards/st/hello_world_xip | 
|  | 36 | +   :host-os: unix | 
|  | 37 | +   :board: b_u585i_iot02a | 
|  | 38 | +   :goals: run | 
|  | 39 | +   :compact: | 
|  | 40 | + | 
|  | 41 | +To build for another board, change "b_u585i_iot02a" above to that board's name. | 
|  | 42 | + | 
|  | 43 | +Sample Output | 
|  | 44 | +============= | 
|  | 45 | +Code is executed in the external flash which has been configured in Memory Mapped mode | 
|  | 46 | +by the mcuboot. | 
|  | 47 | + | 
|  | 48 | + | 
|  | 49 | +.. code-block:: console | 
|  | 50 | +
 | 
|  | 51 | +    Hello World! from external flash b_u585i_iot02a | 
|  | 52 | +    *** Booting MCUboot v2.1.0-rc1-275-g6d34ca2cfe4d *** | 
|  | 53 | +    *** Using Zephyr OS build v4.1.0-1733-ge706fceff985 *** | 
|  | 54 | +    I: Starting bootloader | 
|  | 55 | +    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 | 
|  | 56 | +    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 | 
|  | 57 | +    I: Boot source: none | 
|  | 58 | +    I: Image index: 0, Swap type: none | 
|  | 59 | +    I: Bootloader chainload address offset: 0x0 | 
|  | 60 | +    I: Image version: v0.0.0 | 
|  | 61 | +    I: Jumping to the first image slot | 
|  | 62 | +    *** Booting Zephyr OS build v4.1.0-1733-ge706fceff985 *** | 
|  | 63 | +    Hello World! from external flash  b_u585i_iot02a | 
|  | 64 | +    --> PC at 0x70000992 | 
|  | 65 | +
 | 
|  | 66 | +The PC shows that code is being executed in the external flash. | 
0 commit comments