1Laird Connectivity BL5340
2=========================
3
4The BL5340 development kit (DVK, 750-03293) is a single-board development kit
5for the evaluation and development on the Laird Connectivity BL5340 module
6which contains a Nordic Semiconductor nRF5340 System-on-Chip (SoC).
7
8The BL5340 is a module with a dual-core nRF5340 SoC based on the Arm®
9Cortex®-M33 architecture, with:
10
11* a full-featured ARM Cortex-M33F core with DSP instructions, FPU, and
12  ARMv8-M Security Extension, running at up to 128 MHz, referred to as
13  the **Application MCU**
14* a secondary ARM Cortex-M33 core, with a reduced feature set, running at
15  a fixed 64 MHz, referred to as the **Network MCU**.
16
17The BL5340 Application MCU supports the Armv8m Security Extension.
18
19Documentation
20-------------
21
22The following links provide useful information about the BL5340
23
24BL5340 website:
25   https://www.lairdconnect.com/wireless-modules/bluetooth-modules/bluetooth-5-modules/bl5340-series-multi-core-bluetooth-52-802154-nfc-modules
26
27Nordic Semiconductor Infocenter: https://infocenter.nordicsemi.com
28
29Building TF-M on BL5340 Application MCU
30---------------------------------------
31
32To build an S and NS application image for the BL5340 Application MCU run the
33following commands:
34
35.. note::
36
37    On OS X change ``readlink`` to ``greadlink``, available by running
38    ``brew install coreutils``.
39
40.. code:: bash
41
42    $ mkdir build && cd build
43    $ cmake -DTFM_PLATFORM=lairdconnectivity/bl5340_dvk_cpuapp \
44            -DTFM_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake \
45            -G"Unix Makefiles" ../
46    $ make install
47
48.. note::
49
50    Currently, applications can only be built using GCC
51    (GNU ARM Embedded toolchain).
52
53.. note::
54
55    For BL2 (MCUBoot) logging output to be available, the project
56    needs to be built with Debug configuration (CMAKE_BUILD_TYPE=Debug).
57
58Flashing and debugging with on-board Segger J-Link
59--------------------------------------------------
60
61The BL5340 DVK is equipped with a Debug IC (Atmel ATSAM3U2C) which provides the
62following functionality:
63
64* Segger J-Link firmware and desktop tools
65* SWD debug for the BL5340 module
66* USB CDC ACM Serial Port bridged to the second UART peripheral
67* Segger RTT Console
68
69To install the J-Link Software and documentation pack, follow the steps below:
70
71#. Download the appropriate package from the
72`J-Link Software and documentation pack`_ website
73#. Depending on your platform, install the package or run the installer
74#. When connecting a J-Link-enabled board such as a BL5340 DVK, a serial port
75should come up
76
77nRF Command-Line Tools Installation
78***********************************
79
80The nRF Command-line Tools allow you to control your BL5340 module from the
81command line, including resetting it, erasing or programming the flash memory
82and more.
83
84To install them, visit `nRF Command-Line Tools`_ and select your operating
85system.
86
87After installing, make sure that ``nrfjprog`` is somewhere in your executable
88path to be able to invoke it from anywhere.
89
90BL2, S, and NS application images can be flashed into BL5340 separately or may
91be merged together into a single binary.
92
93Flashing the BL5340 DVK
94***********************
95
96To program the flash with a compiled TF-M image (i.e. S, NS or both) after
97having followed the instructions to install the Segger J-Link Software and the
98nRF Command-Line Tools, follow the steps below:
99
100Generate Intel hex files from the output binary (bin) files as follows:
101
102.. code-block:: console
103
104   srec_cat install/outputs/LAIRDCONNECTIVITY/BL5340_DVK_CPUAPP/tfm_s_ns_signed.bin -binary --offset=0x10000 -o install/outputs/LAIRDCONNECTIVITY/BL5340_DVK_CPUAPP/tfm_s_ns_signed.hex -intel
105
106* Connect the micro-USB cable to the BL5340 DVK and to your computer
107* Erase the flash memory in the BL5340 module:
108
109.. code-block:: console
110
111   nrfjprog --eraseall -f nrf53
112
113* Flash the BL2 and the TF-M image binaries from the sample folder of your choice:
114
115.. code-block:: console
116
117   nrfjprog --program <sample folder>/install/outputs/LAIRDCONNECTIVITY/BL5340_DVK_CPUAPP/bl2.hex -f nrf53 --sectorerase
118   nrfjprog --program <sample folder>/install/outputs/LAIRDCONNECTIVITY/BL5340_DVK_CPUAPP/tfm_s_ns_signed.hex -f nrf53 --sectorerase
119
120* Reset and start TF-M:
121
122.. code-block:: console
123
124   nrfjprog --reset -f nrf53
125
126Flashing the BL5340 DVK (Secondary slot in QSPI, with BL2)
127**********************************************************
128
129To program the flash with a compiled TF-M image (i.e. S, NS or both) after
130having followed the instructions to install the Segger J-Link Software and the
131nRF Command-Line Tools to the secondary , follow the steps below:
132
133Generate Intel hex files from the output binary (bin) files as follows:
134
135.. code-block:: console
136
137   srec_cat install/outputs/LAIRDCONNECTIVITY/BL5340_DVK_CPUAPP/tfm_s_ns_signed.bin -binary --offset=0x10000000 -o install/outputs/LAIRDCONNECTIVITY/BL5340_DVK_CPUAPP/tfm_s_ns_signed_qspi.hex -intel
138
139* Connect the micro-USB cable to the BL5340 DVK and to your computer
140* Erase the flash memory in the BL5340 module:
141
142.. code-block:: console
143
144   nrfjprog --eraseall -f nrf53
145
146* Flash the BL2 and the TF-M image binaries from the sample folder of your choice:
147
148.. code-block:: console
149
150   nrfjprog --program <sample folder>/install/outputs/LAIRDCONNECTIVITY/BL5340_DVK_CPUAPP/bl2.hex -f nrf53 --sectorerase
151   nrfjprog --program <sample folder>/install/outputs/LAIRDCONNECTIVITY/BL5340_DVK_CPUAPP/tfm_s_ns_signed.hex -f nrf53 --qspisectorerase
152
153* Reset and start TF-M:
154
155.. code-block:: console
156
157   nrfjprog --reset -f nrf53
158
159
160Secure UART Console on BL5340 DVK
161*********************************
162
163SECURE_UART1 is enabled by default when building TF-M on the BL5340 DVK, so the
164secure firmware console output is available via USART1.
165
166Non-Secure console output is available via USART0.
167
168.. note::
169
170    By default USART0 and USART1 outputs are routed to separate serial ports.
171
172.. _nRF Command-Line Tools: https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Command-Line-Tools
173
174.. _J-Link Software and documentation pack: https://www.segger.com/jlink-software.html
175
176--------------
177
178*Copyright (c) 2020, Nordic Semiconductor. All rights reserved.*
179*Copyright (c) 2021, Laird Connectivity. All rights reserved.*
180