blob: 074d6aa15affd5e882cbe031f3aaab32353eef38 [file] [log] [blame]
Jan Kiszkaa2db09e2021-09-18 08:17:53 +02001.. SPDX-License-Identifier: GPL-2.0+
2.. sectionauthor:: Jan Kiszka <jan.kiszka@siemens.com>
3
4SIMATIC IOT2050 BASIC and ADVANCED
5==================================
6
7The SIMATIC IOT2050 is an open industrial IoT gateway that is using the TI
8AM6528 GP (Basic variant) or the AM6548 HS (Advanced variant). The Advanced
chao zenged57c402023-02-28 19:19:22 +01009variant is prepared for secure boot. M.2 Variant also uses the AM6548 HS.
10Instead of a MiniPCI connector, it comes with two M.2 connectors and can
11support 5G/WIFI/BT applications or connect an SSD.
Jan Kiszkaa2db09e2021-09-18 08:17:53 +020012
13The IOT2050 starts only from OSPI. It loads a Siemens-provided bootloader
14called SE-Boot for the MCU domain (R5F cores), then hands over to ATF and
15OP-TEE, before booting U-Boot on the A53 cores. This describes how to build all
16open artifacts into a flashable image for the OSPI flash. The flash image will
17work on both variants.
18
19Dependencies
20------------
21
22ATF: Upstream release 2.4 or newer
23OP-TEE: Upstream release 3.10.0 or newer
24
25Binary dependencies can be found in
26https://github.com/siemens/meta-iot2050/tree/master/recipes-bsp/u-boot/files/prebuild.
27The following binaries from that source need to be present in the build folder:
28
Su Baochengea0f45d2023-02-28 19:19:09 +010029 - seboot_pg1.bin
Su Baochengea0f45d2023-02-28 19:19:09 +010030 - seboot_pg2.bin
Jan Kiszkaa2db09e2021-09-18 08:17:53 +020031
Jan Kiszka7b5cfe32023-02-28 19:19:19 +010032When using the watchdog, a related firmware for the R5 core(s) is needed, e.g.
33https://github.com/siemens/k3-rti-wdt. The name and location of the image is
34configured via CONFIG_WDT_K3_RTI_FW_FILE.
35
Jan Kiszka367b1bf2023-02-28 19:19:18 +010036For building an image containing the OTP key provisioning data, below binary
37needs to be present in the build folder:
38
39 - otpcmd.bin
40
41Regarding how to generating this otpcmd.bin, please refer to:
42https://github.com/siemens/meta-iot2050/tree/master/recipes-bsp/secure-boot-otp-provisioning/files/make-otpcmd.sh
43
Jan Kiszkaa2db09e2021-09-18 08:17:53 +020044Building
45--------
46
47Make sure that CROSS_COMPILE is set appropriately:
48
49.. code-block:: text
50
51 $ export CROSS_COMPILE=aarch64-linux-gnu-
52
53ATF:
54
55.. code-block:: text
56
57 $ make PLAT=k3 SPD=opteed K3_USART=1
58
59OP-TEE:
60
61.. code-block:: text
62
Ivan Mikhaylov2f7c7ae2021-11-28 21:57:01 +000063 $ make PLATFORM=k3-am65x CFG_ARM64_core=y CFG_TEE_CORE_LOG_LEVEL=2 CFG_CONSOLE_UART=1 CFG_USER_TA_TARGETS="ta_arm64"
Jan Kiszkaa2db09e2021-09-18 08:17:53 +020064
65U-Boot:
66
67.. code-block:: text
68
69 $ export ATF=/path/to/bl31.bin
70 $ export TEE=/path/to/tee-pager_v2.bin
Su Baochengea0f45d2023-02-28 19:19:09 +010071
72 # configure for PG1
73 $ make iot2050_pg1_defconfig
74
chao zenged57c402023-02-28 19:19:22 +010075 # or configure for PG2 or the M.2 variant
Su Baochengea0f45d2023-02-28 19:19:09 +010076 $ make iot2050_pg2_defconfig
77
Jan Kiszkaa2db09e2021-09-18 08:17:53 +020078 $ make
79
80Flashing
81--------
82
83Via U-Boot:
84
85.. code-block:: text
86
87 IOT2050> sf probe
88 IOT2050> load mmc 0:1 $loadaddr /path/to/flash.bin
89 IOT2050> sf update $loadaddr 0x0 $filesize
90
91Via external programmer Dediprog SF100 or SF600:
92
93.. code-block:: text
94
95 $ dpcmd --vcc 2 -v -u flash.bin
Jan Kiszka033ab462023-02-28 19:19:17 +010096
97Signing (optional)
98------------------
99
100To enable verified boot for the firmware artifacts after the Siemens-managed
101first-stage loader (seboot_pg*.bin), the following steps need to be taken
102before and after the build:
103
104Generate dtsi holding the public key
105^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
106
107.. code-block:: text
108
109 tools/key2dtsi.py -c -s key.pem public-key.dtsi
110
111This will be used to embed the public key into U-Boot SPL and main so that each
112step can validate signatures of the succeeding one.
113
114Adjust U-Boot configuration
115^^^^^^^^^^^^^^^^^^^^^^^^^^^
116
117Enabled at least the following options in U-Boot:
118
119.. code-block:: text
120
121 CONFIG_SPL_FIT_SIGNATURE=y
122 CONFIG_DEVICE_TREE_INCLUDES="/path/to/public-key.dtsi"
123 CONFIG_RSA=y
124
125Note that there are more configuration changes needed in order to lock-down
126the command line and the boot process of U-Boot for secure scenarios. These are
127not in scope here.
128
129Build U-Boot
130^^^^^^^^^^^^
131
132See related section above.
133
134Sign flash.bin
135^^^^^^^^^^^^^^
136
137In the build folder still containing artifacts from step 3, invoke:
138
139.. code-block:: text
140
141 tools/iot2050-sign-fw.sh /path/to/key.pem
142
143Flash signed flash.bin
144^^^^^^^^^^^^^^^^^^^^^^
145
146The signing has happen in-place in flash.bin, thus the flashing procedure
147described above.
Jan Kiszka352ed652023-02-28 19:19:23 +0100148
149M.2 slot configuration
150----------------------
151
152The M.2 variant of the IOT2050 comes with one B-keyed and one E-keyed slot.
153These are configured by U-Boot depending on the detected usage (auto
154configuration). The device tree loaded later on for the OS will be fixed up
155by U-Boot according to this configuration.
156
157For the case auto configuration does not work reliably, it is possible to set
158the U-Boot environment variable "m2_manual_config" to select the mode manually:
159
160"0" - B-key: PCIe x2, USB 2.0
161 E-key: USB 2.0
162"1" - B-key: PCIe, USB 2.0
163 E-key: PCIe, USB 2.0
164"2" - B-key: USB 3.0,
165 E-key: PCIe, USB 2.0