README.rst
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 Infocenter: https://infocenter.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 Command-Line Tools Installation
76*************************************
77
78The nRF Command-line Tools allow you to control your nRF5340 device from the command line,
79including resetting it, erasing or programming the flash memory and more.
80
81To install them, visit `nRF Command-Line Tools`_ and select your operating
82system.
83
84After installing, make sure that ``nrfjprog`` is somewhere in your executable path
85to be able to invoke it from anywhere.
86
87BL2, S, and NS application images can be flashed into nRF5340 separately or may be merged
88together into a single binary.
89
90Flashing the nRF5340 DK
91************************
92
93To program the flash with a compiled TF-M image (i.e. S, NS or both) after having
94followed the instructions to install the Segger J-Link Software and the nRF
95Command-Line Tools, follow the steps below:
96
97Generate Intel hex files from the output binary (bin) files as follows:
98
99.. code-block:: console
100
101 srec_cat build_app/tfm_s_ns_signed.bin -binary --offset 0x10000 \
102 -o build_app/tfm_s_ns_signed.hex -intel
103
104* Connect the micro-USB cable to the nRF5340 DK and to your computer
105* Erase the flash memory in the nRF5340 IC:
106
107.. code-block:: console
108
109 nrfjprog --eraseall -f nrf53
110
111* (Optionally) Erase the flash memory and reset flash protection and disable
112 the read back protection mechanism if enabled.
113
114.. code-block:: console
115
116 nrfjprog --recover -f nrf53
117
118* Flash the BL2 and the TF-M image binaries from the sample folder of your choice:
119
120.. code-block:: console
121
122 nrfjprog --program build_spe/bin/bl2.hex -f nrf53 --sectorerase
123 nrfjprog --program build_app/tfm_s_ns_signed.hex -f nrf53 --sectorerase
124
125* Reset and start TF-M:
126
127.. code-block:: console
128
129 nrfjprog --reset -f nrf53
130
131
132Secure UART Console on nRF5340 DK
133**********************************
134
135SECURE_UART1 is enabled by default when building TF-M on nRF5340 DK, so the secure firmware console output
136is available via USART1.
137When using the nRF5340 network MCU make sure to configure different UART pins or disable SECURE_UART1.
138
139Non-Secure console output is available via USART0.
140
141.. note::
142 By default USART0 and USART1 outputs are routed to separate serial ports.
143
144.. _nRF Command-Line Tools: https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Command-Line-Tools
145
146.. _J-Link Software and documentation pack: https://www.segger.com/jlink-software.html
147
148--------------
149
150*Copyright (c) 2020, Nordic Semiconductor. All rights reserved.*
151