blob: 3ff581d9265ce91d764839f59269002215bb1017 [file] [log] [blame]
Gyorgy Szingdb9783c2019-04-17 21:08:48 +02001##############################
2Trusted Firmware M secure boot
3##############################
4For secure devices it is security critical to enforce firmware authenticity to
5protect against execution of malicious software. This is implemented by building
6a trust chain where each step in the execution chain authenticates the next
7step before execution. The chain of trust in based on a "Root of Trust" which
8is implemented using asymmetric cryptography. The Root of Trust is a combination
9of an immutable bootloader and a public key (ROTPK).
10
11*******************************
12Second stage bootloader in TF-M
13*******************************
14To implement secure boot functionality an external project MCUBoot has been
15integrated to TF-M. For further information please refer to the
David Vincze8a2a4e22019-05-24 10:14:23 +020016`MCUBoot homepage <https://www.mcuboot.com/>`__. Original source-code is
17available at `GitHub <https://github.com/JuulLabs-OSS/mcuboot>`__. This document
18contains information about MCUBoot modifications and how MCUBoot has been
19integrated to TF-M.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020020
21Bootloader is started when CPU is released from reset. It runs in secure mode.
22It authenticates the firmware image by hash (SHA-256) and digital signature
Tamas Ban7801ed42019-05-20 13:21:53 +010023(RSA-3072) validation. Public key, that the checks happens against, is built
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020024into the bootloader image. Metadata of the image is delivered together with the
25image itself in a header and trailer section. In case of successful
26authentication, bootloader passes execution to the secure image. Execution never
27returns to bootloader until next reset.
28
29A default RSA key pair is stored in the repository, public key is in ``keys.c``
Tamas Ban7801ed42019-05-20 13:21:53 +010030and private key is in ``root-rsa-3072.pem``.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020031
David Vincze8a2a4e22019-05-24 10:14:23 +020032.. Warning::
33 DO NOT use them in production code, they are exclusively for testing!
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020034
35Private key must be stored in a safe place outside of the repository.
36``Imgtool.py`` can be used to generate new key pairs.
37
38The bootloader handles the secure and non-secure images as a single blob which
39is contiguous in the device memory. At compile time these images are
Tamas Ban7801ed42019-05-20 13:21:53 +010040concatenated and signed with RSA-3072 digital signature. Preparation of payload
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020041is done by Python scripts: ``bl2/ext/mcuboot/scripts/``. At the end of a
David Vincze8a2a4e22019-05-24 10:14:23 +020042successful build signed TF-M payload can be found in:
43``<build_dir>/install/outputs/fvp/tfm_sign.bin``
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020044
45*********************
46Integration with TF-M
47*********************
48MCUBoot assumes a predefined memory layout which is described below (applicable
David Vincze8bdfc2d2019-03-18 15:49:23 +010049for AN521). It is mandatory to define the primary slot and the secondary slot
50partitions, but their size can be changed::
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020051
52 - 0x0000_0000 - 0x0007_FFFF: BL2 bootloader - MCUBoot
David Vincze8bdfc2d2019-03-18 15:49:23 +010053 - 0x0008_0000 - 0x000F_FFFF: Primary slot : Single binary blob:
54 Secure + Non-Secure image;
55 Primary memory partition
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020056 - 0x0008_0000 - 0x0008_03FF: Common image header
57 - 0x0008_0400 - 0x0008_xxxx: Secure image
58 - 0x0008_xxxx - 0x0010_03FF: Padding (with 0xFF)
59 - 0x0010_0400 - 0x0010_xxxx: Non-secure image
60 - 0x0010_xxxx - 0x0010_xxxx: Hash value(SHA256) and RSA signature
61 of combined image
David Vincze8a2a4e22019-05-24 10:14:23 +020062
David Vincze8bdfc2d2019-03-18 15:49:23 +010063 - 0x0018_0000 - 0x0027_FFFF: Secondary slot : Secure + Non-Secure image;
64 Secondary memory partition, structured
65 identically to the primary slot
David Vincze8a2a4e22019-05-24 10:14:23 +020066 - 0x0028_0000 - 0x0037_FFFF: Scratch area, only used during image swapping
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020067
68**************************
69Firmware upgrade operation
70**************************
71MCUBoot handles only the firmware authenticity check after start-up and the
72firmware switch part of the firmware update process. Downloading the new version
David Vincze8a2a4e22019-05-24 10:14:23 +020073of the firmware is out-of-scope for MCUBoot. MCUBoot supports three different
74ways to switch to the new firmware and it is assumed that firmware images are
75executed-in-place (XIP). The default behaviour is the overwrite-based image
David Vincze8bdfc2d2019-03-18 15:49:23 +010076upgrade. In this case the active firmware is always executed from the primary
77slot and the secondary slot is a staging area for new images. Before executing
78the new firmware image, the content of the primary slot must be overwritten with
79the content of the secondary slot (the new firmware image). The second option is
80the image swapping strategy when the content of the two memory slots must be
81physically swapped. This needs the scratch area to be defined in the memory
82layout. The third option is the non-swapping version, which eliminates the
83complexity of image swapping and its administration. Active image can be
84executed from either memory slot, but new firmware must be linked to the address
85space of the proper (currently inactive) memory slot.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020086
David Vincze8a2a4e22019-05-24 10:14:23 +020087Overwrite operation
Tamas Bane7efdc62019-06-05 13:14:52 +010088===================
David Vincze8bdfc2d2019-03-18 15:49:23 +010089Active image is stored in the primary slot, and this image is started always by
90the bootloader. Therefore images must be linked to the primary slot. If the
91bootloader finds a valid image in the secondary slot, which is marked for
92upgrade, then the content of the primary slot will be simply overwritten with
93the content of the secondary slot, before starting the new image from the
94primary slot. After the content of the primary slot has been successfully
95overwritten, the header and trailer of the new image in the secondary slot is
96erased to prevent the triggering of another unncessary image uprade after a
97restart. The overwrite operation is fail-safe and resistant to power-cut
98failures. For more details please refer to the MCUBoot
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020099`documentation <https://www.mcuboot.com/mcuboot/design.html>`__.
100
David Vincze8a2a4e22019-05-24 10:14:23 +0200101Swapping operation
102==================
103This operation can be set with the ``MCUBOOT_UPGRADE_STRATEGY`` compile time
104switch (see `Build time configuration`_). With swapping image upgrade strategy
David Vincze8bdfc2d2019-03-18 15:49:23 +0100105the active image is also stored in the primary slot and it will always be
106started by the bootloader. If the bootloader finds a valid image in the
107secondary slot, which is marked for upgrade, then contents of the primary slot
108and the secondary slot will be swapped, before starting the new image from the
109primary slot. Scratch area is used as a temporary storage place during image
110swapping. Update mark from the secondary slot is removed when the swapping is
David Vincze8a2a4e22019-05-24 10:14:23 +0200111successful. The boot loader can revert the swapping as a fall-back mechanism to
112recover the previous working firmware version after a faulty update. The swap
113operation is fail-safe and resistant to power-cut failures. For more details
114please refer to the MCUBoot
115`documentation <https://www.mcuboot.com/mcuboot/design.html>`__.
116
117.. Note::
118
119 After a successful image upgrade the firmware can mark itself as "OK" at
120 runtime by setting the image_ok flag in the flash. When this happens, the
121 swap is made "permanent" and MCUBoot will then still choose to run it
122 during the next boot. Currently TF-M does not set the image_ok flag,
123 therefore the bootloader will always perform a "revert" (swap the images
124 back) during the next boot.
125
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200126Non-swapping operation
127======================
David Vincze8a2a4e22019-05-24 10:14:23 +0200128This operation can be set with the ``MCUBOOT_UPGRADE_STRATEGY`` compile time
129switch (see `Build time configuration`_). When enabling non-swapping operation
130then the active image flag is moved between slots during firmware upgrade. If
131firmware is executed-in-place (XIP), then two firmware images must be generated.
David Vincze8bdfc2d2019-03-18 15:49:23 +0100132One of them is linked to be executed from the primary slot memory region and the
133other from the secondary slot. The firmware upgrade client, which downloads the
134new image, must be aware, which slot hosts the active firmware and which acts as
135a staging area and it is responsible for downloading the proper firmware image.
136At boot time MCUBoot inspects the version number in the image header and passes
137execution to the newer firmware version. New image must be marked for upgrade
138which is automatically done by Python scripts at compile time. Image
139verification is done the same way in all operational modes. If new image fails
140during authentication then MCUBoot erases the memory slot and starts the other
141image, after successful authentication.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200142
143At build time automatically two binaries are generated::
144
David Vincze8bdfc2d2019-03-18 15:49:23 +0100145 <build_dir>/install/outputs/fvp/tfm_s_ns_signed.bin : Image linked for the primary slot memory partition
David Vincze8a2a4e22019-05-24 10:14:23 +0200146
David Vincze8bdfc2d2019-03-18 15:49:23 +0100147 <build_dir>/install/outputs/fvp/tfm_s_ns_signed_1.bin : Image linked for the secondary slot memory partition
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200148
149RAM Loading firmware upgrade
150============================
David Vincze8a2a4e22019-05-24 10:14:23 +0200151Musca-A supports an image upgrade mode that is separate to the other (overwrite,
152swapping and non-swapping) modes. This is the ``RAM loading`` mode (please refer
153to the table below). Like the non-swapping mode, this selects the newest image
154by reading the image version numbers in the image headers, but instead of
155executing it in place, the newest image is copied to RAM for execution. The load
156address, the location in RAM where the image is copied to, is stored in the
157image header.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200158
159Summary of different modes for image upgrade
160============================================
161Different implementations of the image upgrade operation (whether through
David Vincze8a2a4e22019-05-24 10:14:23 +0200162overwriting, swapping, non-swapping or loading into RAM and executing from
163there) are supported by the platforms. The table below shows which of these
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200164modes are supported by which platforms:
165
David Vincze8a2a4e22019-05-24 10:14:23 +0200166+----------+-----------------+----------------------------------------------------------+
167| | Without BL2 [1]_| With BL2 [2]_ |
168+==========+=================+===============+==========+=============+=================+
169| | XIP | XIP | XIP | XIP | Not XIP |
170+----------+-----------------+---------------+----------+-------------+-----------------+
171| | | Overwrite [3]_| Swap [4]_| No-swap [5]_| RAM loading [6]_|
172+----------+-----------------+---------------+----------+-------------+-----------------+
173| AN521 | Yes | Yes | Yes | Yes | No |
174+----------+-----------------+---------------+----------+-------------+-----------------+
175| AN519 | Yes | Yes | Yes | Yes | No |
176+----------+-----------------+---------------+----------+-------------+-----------------+
177| Musca-A | No | No | No | No | Yes |
178+----------+-----------------+---------------+----------+-------------+-----------------+
179| Musca-B1 | Yes | No | No | Yes | No |
180+----------+-----------------+---------------+----------+-------------+-----------------+
Kevin Peng0a142112018-09-21 10:42:22 +0800181| AN524 | Yes | No | No | Yes | No |
182+----------+-----------------+---------------+----------+-------------+-----------------+
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200183
184.. [1] To disable BL2, please turn off the ``BL2`` compiler switch in the
David Vincze8a2a4e22019-05-24 10:14:23 +0200185 top-level configuration file or in the command line
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200186
187.. [2] BL2 is enabled by default
188
David Vincze8a2a4e22019-05-24 10:14:23 +0200189.. [3] The image executes in-place (XIP) and is in Overwrite mode for image
190 update by default
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200191
David Vincze8a2a4e22019-05-24 10:14:23 +0200192.. [4] To enable XIP Swap mode, assign the "SWAP" string to the
193 ``MCUBOOT_UPGRADE_STRATEGY`` configuration variable in the top-level
194 configuration file, or include this macro definition in the command line
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200195
David Vincze8a2a4e22019-05-24 10:14:23 +0200196.. [5] To enable XIP No-swap, assign the "NO_SWAP" string to the
197 ``MCUBOOT_UPGRADE_STRATEGY`` configuration variable in the top-level
198 configuration file, or include this macro definition in the command line
199
200.. [6] To enable RAM loading, assign the "RAM_LOADING" string to the
201 ``MCUBOOT_UPGRADE_STRATEGY`` configuration variable in the top-level
202 configuration file, or include this macro definition in the command line
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200203
Tamas Ban7801ed42019-05-20 13:21:53 +0100204********************
205Signature algorithms
206********************
207MbedTLS library is used to sign the images. The list of supported signing
208algorithms:
Tamas Bane7efdc62019-06-05 13:14:52 +0100209
210 - `RSA-2048`
211 - `RSA-3072`: default
212
Tamas Ban7801ed42019-05-20 13:21:53 +0100213Example keys stored in ``root-rsa-2048.pem`` and ``root-rsa-3072.pem``.
214
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200215************************
216Build time configuration
217************************
218MCUBoot related compile time switches can be set in the high level build
David Vincze8a2a4e22019-05-24 10:14:23 +0200219configuration file::
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200220
David Vincze8a2a4e22019-05-24 10:14:23 +0200221 CommonConfig.cmake
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200222
223Compile time switches:
224
225- BL2 (default: True):
226 - **True:** TF-M built together with bootloader. MCUBoot is executed after
227 reset and it authenticates TF-M and starts secure code.
228 - **False:** TF-M built without bootloader. Secure image linked to the
229 beginning of the device memory and executed after reset. If it is false
230 then using any of the further compile time switches are invalid.
David Vincze8a2a4e22019-05-24 10:14:23 +0200231- MCUBOOT_UPGRADE_STRATEGY (default: "OVERWRITE_ONLY"):
232 - **"OVERWRITE_ONLY":** Default firmware upgrade operation with overwrite.
233 - **"SWAP":** Activate swapping firmware upgrade operation.
234 - **"NO_SWAP":** Activate non-swapping firmware upgrade operation.
235 - **"RAM_LOADING":** Activate RAM loading firmware upgrade operation, where
236 latest image is copied to RAM and runs from there instead of being
237 executed in-place.
Tamas Ban7801ed42019-05-20 13:21:53 +0100238- MCUBOOT_SIGNATURE_TYPE (default: RSA-3072):
239 - **RSA-3072** Image is signed with RSA-3072 algorithm
240 - **RSA-2048** Image is signed with RSA-2048 algorithm
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200241
242Image versioning
243================
244An image version number is written to its header by one of the python scripts,
David Vincze8a2a4e22019-05-24 10:14:23 +0200245and this number is used by the bootloader when the non-swapping or RAM loading
246mode is enabled.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200247
248The version number of the image can manually be passed in through the command
249line in the cmake configuration step::
250
251 cmake -G"Unix Makefiles" -DTARGET_PLATFORM=AN521 -DCOMPILER=ARMCLANG -DIMAGE_VERSION=1.2.3+4 ../
252
253Alternatively, the version number can be less specific (e.g 1, 1.2, or 1.2.3),
254where the missing numbers are automatically set to zero. The image version
255number argument is optional, and if it is left out, then the version numbers of
256the image(s) being built in the same directory will automatically change. In
257this case, the last component (the build number) automatically increments from
258the previous one: 0.0.0+1 -> 0.0.0+2, for as many times as the build is re-ran,
259**until a number is explicitly provided**. If automatic versioning is in place
260and then an image version number is provided for the first time, the new number
261will take precedence and be used instead. All subsequent image versions are
262then set to the last number that has been specified, and the build number would
263stop incrementing. Any new version numbers that are provided will overwrite
264the previous one: 0.0.0+1 -> 0.0.0+2. Note: To re-apply automatic image
265versioning, please start a clean build without specifying the image version
266number at all.
267
David Vincze060968d2019-05-23 01:13:14 +0200268Security counter
269================
270Each signed image contains a security counter in its manifest. It is used by the
271bootloader and its aim is to have an independent (from the image version)
272counter to ensure rollback protection by comparing the new image's security
273counter against the original (currently active) image's security counter during
274the image upgrade process. It is added to the manifest (to the TLV area that is
275appended to the end of the image) by one of the python scripts when signing the
276image. The value of the security counter is security critical data and it is in
277the integrity protected part of the image. The last valid security counter is
278always stored in a non-volatile and trusted component of the device and its
279value should always be increased if a security flaw was fixed in the current
280image version. The value of the security counter can be specified at build time
281in the cmake configuration step::
282
283 cmake -G"Unix Makefiles" -DTARGET_PLATFORM=AN521 -DCOMPILER=ARMCLANG -DSECURITY_COUNTER=42 ../
284
285The security counter can be independent from the image version, but not
286necessarily. Alternatively, if it is not specified at build time with the
287``SECURITY_COUNTER`` option the python script will automatically generate it
288from the image version number (not including the build number) and this value
289will be added to the signed image.
290
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200291************************
292Testing firmware upgrade
293************************
294As downloading the new firmware image is out of scope for MCUBoot, the update
295process is started from a state where the original and the new image are already
296programmed to the appropriate memory slots. To generate the original and a new
297firmware package, TF-M is built twice with different build configurations.
298
David Vincze8a2a4e22019-05-24 10:14:23 +0200299Overwriting firmware upgrade
Tamas Bane7efdc62019-06-05 13:14:52 +0100300============================
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200301Run TF-M build twice with two different build configuration: default and
David Vincze8a2a4e22019-05-24 10:14:23 +0200302regression. Save the artifacts between builds, because second run can overwrite
David Vincze8bdfc2d2019-03-18 15:49:23 +0100303original binaries. Download default build to the primary slot and regression
304build to the secondary slot.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200305
306Executing firmware upgrade on FVP_MPS2_AEMv8M
307---------------------------------------------
308.. code-block:: bash
309
310 <DS5_PATH>/sw/models/bin/FVP_MPS2_AEMv8M \
311 --parameter fvp_mps2.platform_type=2 \
312 --parameter cpu0.baseline=0 \
313 --parameter cpu0.INITVTOR_S=0x10000000 \
314 --parameter cpu0.semihosting-enable=0 \
315 --parameter fvp_mps2.DISABLE_GATING=0 \
316 --parameter fvp_mps2.telnetterminal0.start_telnet=1 \
317 --parameter fvp_mps2.telnetterminal1.start_telnet=0 \
318 --parameter fvp_mps2.telnetterminal2.start_telnet=0 \
319 --parameter fvp_mps2.telnetterminal0.quiet=0 \
320 --parameter fvp_mps2.telnetterminal1.quiet=1 \
321 --parameter fvp_mps2.telnetterminal2.quiet=1 \
322 --application cpu0=<build_dir>/bl2/ext/mcuboot/mcuboot.axf \
323 --data cpu0=<default_build_dir>/install/outputs/fvp/tfm_s_ns_signed.bin@0x10080000 \
324 --data cpu0=<regresssion_build_dir>/install/outputs/fvp/tfm_s_ns_signed.bin@0x10180000
325
326Executing firmware upgrade on SSE 200 FPGA on MPS2 board
327--------------------------------------------------------
328
329::
330
331 TITLE: Versatile Express Images Configuration File
332 [IMAGES]
333 TOTALIMAGES: 3 ;Number of Images (Max: 32)
334 IMAGE0ADDRESS: 0x00000000
335 IMAGE0FILE: \Software\mcuboot.axf ; BL2 bootloader
336 IMAGE1ADDRESS: 0x10080000
David Vincze8a2a4e22019-05-24 10:14:23 +0200337 IMAGE1FILE: \Software\tfm_sig1.bin ; TF-M default test binary blob
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200338 IMAGE2ADDRESS: 0x10180000
339 IMAGE2FILE: \Software\tfm_sig2.bin ; TF-M regression test binary blob
340
David Vincze8a2a4e22019-05-24 10:14:23 +0200341The following message will be shown in case of successful firmware upgrade:
342
343::
344
345 [INF] Starting bootloader
346 [INF] Swap type: test
David Vincze8bdfc2d2019-03-18 15:49:23 +0100347 [INF] Image upgrade secondary slot -> primary slot
348 [INF] Erasing the primary slot
349 [INF] Copying the secondary slot to the primary slot: 0x100000 bytes
David Vincze8a2a4e22019-05-24 10:14:23 +0200350 [INF] Bootloader chainload address offset: 0x80000
351 [INF] Jumping to the first image slot
352 [Sec Thread] Secure image initializing!
353
354 #### Execute test suites for the Secure area ####
355 Running Test Suite PSA protected storage S interface tests (TFM_SST_TEST_2XXX)...
356 ...
357
358Swapping firmware upgrade
359=============================
360Follow the same instructions and platform related configurations as in case of
361overwriting build including these changes:
362
363- Set MCUBOOT\_SWAP compile time switch to true before build.
364
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200365The following message will be shown in case of successful firmware upgrade,
366``Swap type: test`` indicates that images were swapped:
367
368::
369
David Vincze8a2a4e22019-05-24 10:14:23 +0200370 [INF] Starting bootloader
371 [INF] Image 0: magic= good, copy_done=0x3, image_ok=0x3
372 [INF] Scratch: magic= bad, copy_done=0x0, image_ok=0x2
David Vincze8bdfc2d2019-03-18 15:49:23 +0100373 [INF] Boot source: primary slot
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200374 [INF] Swap type: test
375 [INF] Bootloader chainload address offset: 0x80000
376 [INF] Jumping to the first image slot
377 [Sec Thread] Secure image initializing!
378
David Vincze8a2a4e22019-05-24 10:14:23 +0200379 #### Execute test suites for the Secure area ####
380 Running Test Suite PSA protected storage S interface tests (TFM_SST_TEST_2XXX)...
381 ...
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200382
383Non-swapping firmware upgrade
384=============================
David Vincze8a2a4e22019-05-24 10:14:23 +0200385Follow the same instructions as in case of overwriting build including these
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200386changes:
387
David Vincze8a2a4e22019-05-24 10:14:23 +0200388- Set the ``MCUBOOT_UPGRADE_STRATEGY`` compile time switch to "NO_SWAP"
389 before build.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200390- Increase the image version number between the two build run.
391
392Executing firmware upgrade on FVP_MPS2_AEMv8M
393---------------------------------------------
394
395.. code-block:: bash
396
397 <DS5_PATH>/sw/models/bin/FVP_MPS2_AEMv8M \
398 --parameter fvp_mps2.platform_type=2 \
399 --parameter cpu0.baseline=0 \
400 --parameter cpu0.INITVTOR_S=0x10000000 \
401 --parameter cpu0.semihosting-enable=0 \
402 --parameter fvp_mps2.DISABLE_GATING=0 \
403 --parameter fvp_mps2.telnetterminal0.start_telnet=1 \
404 --parameter fvp_mps2.telnetterminal1.start_telnet=0 \
405 --parameter fvp_mps2.telnetterminal2.start_telnet=0 \
406 --parameter fvp_mps2.telnetterminal0.quiet=0 \
407 --parameter fvp_mps2.telnetterminal1.quiet=1 \
408 --parameter fvp_mps2.telnetterminal2.quiet=1 \
409 --application cpu0=<build_dir>/bl2/ext/mcuboot/mcuboot.axf \
Tamas Banbba85642019-06-06 09:31:59 +0100410 --data cpu0=<default_build_dir>/install/outputs/fvp/tfm_s_ns_signed.bin@0x10080000 \
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200411 --data cpu0=<regresssion_build_dir>/install/outputs/fvp/tfm_s_ns_signed_1.bin@0x10180000
412
413Executing firmware upgrade on SSE 200 FPGA on MPS2 board
414--------------------------------------------------------
415
416::
417
418 TITLE: Versatile Express Images Configuration File
419 [IMAGES]
420 TOTALIMAGES: 3 ;Number of Images (Max: 32)
421 IMAGE0ADDRESS: 0x00000000
422 IMAGE0FILE: \Software\mcuboot.axf ; BL2 bootloader
423 IMAGE1ADDRESS: 0x10080000
Tamas Banbba85642019-06-06 09:31:59 +0100424 IMAGE1FILE: \Software\tfm_sign.bin ; TF-M default test binary blob
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200425 IMAGE2ADDRESS: 0x10180000
426 IMAGE2FILE: \Software\tfm_sig1.bin ; TF-M regression test binary blob
427
428Executing firmware upgrade on Musca-B1 board
429--------------------------------------------
430After two images have been built, they can be concatenated to create the
431combined image using ``srec_cat``:
432
433- Linux::
David Vincze8a2a4e22019-05-24 10:14:23 +0200434
Tamas Banbba85642019-06-06 09:31:59 +0100435 srec_cat bl2/ext/mcuboot/mcuboot.bin -Binary -offset 0xA000000 tfm_sign.bin -Binary -offset 0xA020000 tfm_sign_1.bin -Binary -offset 0xA0E0000 -o tfm.hex -Intel
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200436
437- Windows::
David Vincze8a2a4e22019-05-24 10:14:23 +0200438
Tamas Banbba85642019-06-06 09:31:59 +0100439 srec_cat.exe bl2\ext\mcuboot\mcuboot.bin -Binary -offset 0xA000000 tfm_sign.bin -Binary -offset 0xA020000 tfm_sign_1.bin -Binary -offset 0xA0E0000 -o tfm.hex -Intel
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200440
441The following message will be shown in case of successful firmware upgrade,
442notice that image with higher version number (``version=1.2.3.5``) is executed:
443
444::
445
446 [INF] Starting bootloader
David Vincze8a2a4e22019-05-24 10:14:23 +0200447 [INF] Image 0: version=1.2.3.4, magic= good, image_ok=0x3
448 [INF] Image 1: version=1.2.3.5, magic= good, image_ok=0x3
David Vincze8bdfc2d2019-03-18 15:49:23 +0100449 [INF] Booting image from the secondary slot
David Vincze8a2a4e22019-05-24 10:14:23 +0200450 [INF] Bootloader chainload address offset: 0xa0000
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200451 [INF] Jumping to the first image slot
452 [Sec Thread] Secure image initializing!
453
David Vincze8a2a4e22019-05-24 10:14:23 +0200454 #### Execute test suites for the Secure area ####
455 Running Test Suite PSA protected storage S interface tests (TFM_SST_TEST_2XXX)...
456 ...
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200457
Kevin Peng0a142112018-09-21 10:42:22 +0800458Executing firmware upgrade on CoreLink SSE-200 Subsystem for MPS3 (AN524)
459-------------------------------------------------------------------------
460
461::
462
463 TITLE: Arm MPS3 FPGA prototyping board Images Configuration File
464
465 [IMAGES]
466 TOTALIMAGES: 3 ;Number of Images (Max: 32)
467
468 IMAGE0UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE
469 IMAGE0ADDRESS: 0x00000000
470 IMAGE0FILE: \SOFTWARE\mcuboot.bin ;BL2 bootloader
471 IMAGE1UPDATE: AUTO
472 IMAGE1ADDRESS: 0x00040000
473 IMAGE1FILE: \SOFTWARE\tfm_sig0.bin ;TF-M example application binary blob
474 IMAGE2UPDATE: AUTO
475 IMAGE2ADDRESS: 0x000C0000
476 IMAGE2FILE: \SOFTWARE\tfm_sig1.bin ;TF-M regression test binary blob
477
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200478RAM loading firmware upgrade
479============================
David Vincze8a2a4e22019-05-24 10:14:23 +0200480To enable RAM loading, please set ``MCUBOOT_UPGRADE_STRATEGY`` to "RAM_LOADING"
481(either in the configuration file or through the command line), and then specify
482a destination load address in RAM where the image can be copied to and executed
483from. The ``IMAGE_LOAD_ADDRESS`` macro must be specified in the target dependent
484files, for example with Musca-A, its ``flash_layout.h`` file in the ``platform``
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200485folder should include ``#define IMAGE_LOAD_ADDRESS #0x10020000``
486
David Vincze8a2a4e22019-05-24 10:14:23 +0200487Executing firmware upgrade on Musca-A board
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200488--------------------------------------------
489After two images have been built, they can be concatenated to create the
490combined image using ``srec_cat``:
491
David Vincze8a2a4e22019-05-24 10:14:23 +0200492- Linux::
493
494 srec_cat bl2/ext/mcuboot/mcuboot.bin -Binary -offset 0x200000 tfm_sign_old.bin -Binary -offset 0x220000 tfm_sign_new.bin -Binary -offset 0x320000 -o tfm.hex -Intel
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200495
496- Windows::
David Vincze8a2a4e22019-05-24 10:14:23 +0200497
498 srec_cat.exe bl2\ext\mcuboot\mcuboot.bin -Binary -offset 0x200000 tfm_sign_old.bin-Binary -offset 0x220000 tfm_sign_new.bin -Binary -offset 0x320000 -o tfm.hex -Intel
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200499
500The following message will be shown in case of successful firmware upgrade when,
501RAM loading is enabled, notice that image with higher version number
502(``version=0.0.0.2``) is executed:
503
504::
505
David Vincze8a2a4e22019-05-24 10:14:23 +0200506 [INF] Starting bootloader
507 [INF] Image 0: version=0.0.0.1, magic= good, image_ok=0x3
508 [INF] Image 1: version=0.0.0.2, magic= good, image_ok=0x3
David Vincze8bdfc2d2019-03-18 15:49:23 +0100509 [INF] Image has been copied from the secondary slot in flash to SRAM address 0x10020000
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200510 [INF] Booting image from SRAM at address 0x10020000
511 [INF] Bootloader chainload address offset: 0x20000
512 [INF] Jumping to the first image slot
513 [Sec Thread] Secure image initializing!
514
515--------------
516
517*Copyright (c) 2018-2019, Arm Limited. All rights reserved.*