blob: ee3c5c958464619ab1e70eef4a880d1d4583ad7d [file] [log] [blame]
Jan Kiszka8ff2ff82021-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 zeng22750432023-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 Kiszka8ff2ff82021-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 Baocheng0dcd3372023-02-28 19:19:09 +010029 - seboot_pg1.bin
Su Baocheng0dcd3372023-02-28 19:19:09 +010030 - seboot_pg2.bin
Jan Kiszka8ff2ff82021-09-18 08:17:53 +020031
Jan Kiszka90ea2322023-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 Kiszkaaebb5b92023-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 Kiszka8ff2ff82021-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 Mikhaylov07bc02a2021-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 Kiszka8ff2ff82021-09-18 08:17:53 +020064
65U-Boot:
66
67.. code-block:: text
68
Jan Kiszkabe6052f2023-07-27 06:34:55 +020069 $ export BL31=/path/to/bl31.bin
70 $ export TEE=/path/to/tee-raw.bin
Jan Kiszkab2d24f92023-07-27 06:34:54 +020071 $ make iot2050_defconfig
Su Baocheng0dcd3372023-02-28 19:19:09 +010072
Jan Kiszka8ff2ff82021-09-18 08:17:53 +020073 $ make
74
Jan Kiszkab2d24f92023-07-27 06:34:54 +020075This will generate two different flash images: flash-p1.bin that targets the
76first generation of IOT2050 devices and flash-pg2.bin that runs on PG2
77including M.2 devices.
78
Jan Kiszka8ff2ff82021-09-18 08:17:53 +020079Flashing
80--------
81
82Via U-Boot:
83
84.. code-block:: text
85
86 IOT2050> sf probe
Jan Kiszkab2d24f92023-07-27 06:34:54 +020087 IOT2050> load mmc 0:1 $loadaddr /path/to/flash-pgX.bin
Jan Kiszka8ff2ff82021-09-18 08:17:53 +020088 IOT2050> sf update $loadaddr 0x0 $filesize
89
90Via external programmer Dediprog SF100 or SF600:
91
92.. code-block:: text
93
Jan Kiszkab2d24f92023-07-27 06:34:54 +020094 $ dpcmd --vcc 2 -v -u flash-pgX.bin
Jan Kiszka15bb43b2023-02-28 19:19:17 +010095
96Signing (optional)
97------------------
98
99To enable verified boot for the firmware artifacts after the Siemens-managed
Jan Kiszkab2d24f92023-07-27 06:34:54 +0200100first-stage loader (seboot_pgX.bin), the following steps need to be taken
Jan Kiszka15bb43b2023-02-28 19:19:17 +0100101before and after the build:
102
103Generate dtsi holding the public key
104^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
105
106.. code-block:: text
107
108 tools/key2dtsi.py -c -s key.pem public-key.dtsi
109
110This will be used to embed the public key into U-Boot SPL and main so that each
111step can validate signatures of the succeeding one.
112
113Adjust U-Boot configuration
114^^^^^^^^^^^^^^^^^^^^^^^^^^^
115
116Enabled at least the following options in U-Boot:
117
118.. code-block:: text
119
120 CONFIG_SPL_FIT_SIGNATURE=y
121 CONFIG_DEVICE_TREE_INCLUDES="/path/to/public-key.dtsi"
122 CONFIG_RSA=y
123
124Note that there are more configuration changes needed in order to lock-down
125the command line and the boot process of U-Boot for secure scenarios. These are
126not in scope here.
127
128Build U-Boot
129^^^^^^^^^^^^
130
131See related section above.
132
Jan Kiszkab2d24f92023-07-27 06:34:54 +0200133Sign flash-pgX.bin
134^^^^^^^^^^^^^^^^^^
Jan Kiszka15bb43b2023-02-28 19:19:17 +0100135
136In the build folder still containing artifacts from step 3, invoke:
137
138.. code-block:: text
139
140 tools/iot2050-sign-fw.sh /path/to/key.pem
141
Jan Kiszkab2d24f92023-07-27 06:34:54 +0200142Flash signed flash-pgX.bin
143^^^^^^^^^^^^^^^^^^^^^^^^^^
Jan Kiszka15bb43b2023-02-28 19:19:17 +0100144
Jan Kiszkab2d24f92023-07-27 06:34:54 +0200145The signing has happen in-place in flash-pgX.bin, thus the flashing procedure
Jan Kiszka15bb43b2023-02-28 19:19:17 +0100146described above.
Jan Kiszkae31f16c2023-02-28 19:19:23 +0100147
148M.2 slot configuration
149----------------------
150
151The M.2 variant of the IOT2050 comes with one B-keyed and one E-keyed slot.
152These are configured by U-Boot depending on the detected usage (auto
153configuration). The device tree loaded later on for the OS will be fixed up
154by U-Boot according to this configuration.
155
156For the case auto configuration does not work reliably, it is possible to set
157the U-Boot environment variable "m2_manual_config" to select the mode manually:
158
159"0" - B-key: PCIe x2, USB 2.0
160 E-key: USB 2.0
161"1" - B-key: PCIe, USB 2.0
162 E-key: PCIe, USB 2.0
163"2" - B-key: USB 3.0,
164 E-key: PCIe, USB 2.0