1Nordic nRF5340 2============== 3 4The nRF5340 development kit (DK) is a single-board development kit for 5the evaluation and development on the Nordic nRF5340 System-on-Chip (SoC). 6 7The nRF5340 is a dual-core SoC based on the Arm® Cortex®-M33 architecture, with: 8 9* a full-featured ARM Cortex-M33F core with DSP instructions, FPU, and 10 ARMv8-M Security Extension, running at up to 128 MHz, referred to as 11 the **Application MCU** 12* a secondary ARM Cortex-M33 core, with a reduced feature set, running at 13 a fixed 64 MHz, referred to as the **Network MCU**. 14 15The nRF5340 Application MCU supports the Armv8m Security Extension. 16 17Documentation 18------------- 19 20The following links provide useful information about the nRF5340 21 22nRF5340 DK website: 23 https://www.nordicsemi.com/Software-and-tools/Development-Kits/nRF5340-DK 24 25Nordic Semiconductor TechDocs: https://docs.nordicsemi.com 26 27 28Building TF-M on nRF5340 Application MCU 29---------------------------------------- 30 31To build an S and NS application image for the nRF5340 Application MCU run the 32following commands: 33 34 35.. code-block:: bash 36 37 cmake -S <TF-M base folder> -B build_spe \ 38 -DTFM_PLATFORM=nordic_nrf/nrf5340dk_nrf5340_cpuapp \ 39 -DTFM_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake \ 40 cmake --build build_spe -- install 41 42 cmake -S <Application base folder> -B build_app \ 43 -DCONFIG_SPE_PATH<Absolute path to TF-M base folder>/build_spe/api_ns 44 -DTFM_TOOLCHAIN_FILE=cmake/toolchain_ns_GNUARM.cmake 45 cmake --build 46 47.. note:: 48 Currently, applications can only be built using GCC (GNU ARM Embedded 49 toolchain). 50 51.. note:: 52 BL2 (MCUBoot) logging output to be available, the project needs to be built 53 with Debug configuration (CMAKE_BUILD_TYPE=Debug). 54 55Flashing and debugging with Nordic nRF Segger J-Link 56----------------------------------------------------- 57 58nRF5340 DK is equipped with a Debug IC (Atmel ATSAM3U2C) which provides the 59following functionality: 60 61* Segger J-Link firmware and desktop tools 62* SWD debug for the nRF5340 IC 63* Mass Storage device for drag-and-drop image flashing 64* USB CDC ACM Serial Port bridged to the nRFx UART peripheral 65* Segger RTT Console 66* Segger Ozone Debugger 67 68To install the J-Link Software and documentation pack, follow the steps below: 69 70#. Download the appropriate package from the `J-Link Software and documentation pack`_ website 71#. Depending on your platform, install the package or run the installer 72#. When connecting a J-Link-enabled board such as an nRF5340 DK, a drive 73 corresponding to a USB Mass Storage device as well as a serial port should come up 74 75nRF Util Installation 76********************* 77 78nRF Util allows you to control your nRF5340 device from the command line, 79including resetting it, erasing or programming the flash memory and more. 80 81To install nRF Util: 82 831. Visit `nRF Util product page`_. 842. Download the executable. 853. Follow the `nRF Util installation instructions`_. 864. Install ``nrfutil device`` subcommand for programming, flashing, and erasing devices: 87 88 .. code-block:: console 89 90 nrfutil install device 91 92After installing, make sure that ``nrfutil.exe`` is somewhere in your executable 93path to be able to invoke it from anywhere. 94 95BL2, S, and NS application images can be flashed into nRF5340 separately or may be merged 96together into a single binary. 97 98Flashing the nRF5340 DK 99************************ 100 101To program the flash with a compiled TF-M image (i.e. S, NS or both) after having 102followed the instructions to install the Segger J-Link Software and the nRF 103Command-Line Tools, follow the steps below: 104 105Generate Intel hex files from the output binary (bin) files as follows: 106 107.. code-block:: console 108 109 srec_cat build_app/tfm_s_ns_signed.bin -binary --offset 0x10000 \ 110 -o build_app/tfm_s_ns_signed.hex -intel 111 112* Connect the micro-USB cable to the nRF5340 DK and to your computer 113* Erase the flash memory in the nRF5340 IC: 114 115.. code-block:: console 116 117 nrfutil device erase --all --x-family nrf53 118 119* (Optionally) Erase the flash memory and reset flash protection and disable 120 the read back protection mechanism if enabled. 121 122.. code-block:: console 123 124 nrfutil device recover --x-family nrf53 125 126* Flash the BL2 and the TF-M image binaries from the sample folder of your choice: 127 128.. code-block:: console 129 130 nrfutil device program --x-family nrf53 --firmware build_spe/bin/bl2.hex --options chip_erase_mode=ERASE_RANGES_TOUCHED_BY_FIRMWARE 131 nrfutil device program --x-family nrf53 --firmware build_app/tfm_s_ns_signed.hex --options chip_erase_mode=ERASE_RANGES_TOUCHED_BY_FIRMWARE 132 133* Reset and start TF-M: 134 135.. code-block:: console 136 137 nrfutil device reset --x-family nrf53 138 139 140Secure UART Console on nRF5340 DK 141********************************** 142 143SECURE_UART1 is enabled by default when building TF-M on nRF5340 DK, so the secure firmware console output 144is available via USART1. 145When using the nRF5340 network MCU make sure to configure different UART pins or disable SECURE_UART1. 146 147Non-Secure console output is available via USART0. 148 149.. note:: 150 By default USART0 and USART1 outputs are routed to separate serial ports. 151 152.. _nRF Util product page: https://www.nordicsemi.com/Products/Development-tools/nRF-Util/ 153 154.. _nRF Util installation instructions: https://docs.nordicsemi.com/bundle/nrfutil/page/guides/installing.html 155 156.. _J-Link Software and documentation pack: https://www.segger.com/jlink-software.html 157 158-------------- 159 160*Copyright (c) 2020, Nordic Semiconductor. All rights reserved.* 161