Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame] | 1 | ## XMC7000 boot configuration description |
| 2 | MCUBoot application supports `overwrite` and `swap` upgrade modes for XMC7200 and XMC7100 platforms. |
| 3 | |
Roman Okhrimenko | 409941a | 2023-11-20 02:18:09 +0200 | [diff] [blame] | 4 | __NOTE__: In case of `swap` upgrade mode and when swap status partition area is located in `work flash` its required to fill the status partition with **0xFF** before flashing the MCUBootApp.hex. As shown on the example below. |
| 5 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame] | 6 | Following commands can be used as an example to build a project |
| 7 | - Overwrite mode |
| 8 | |
| 9 | make clean app APP_NAME=MCUBootApp PLATFORM=XMC7200 BUILDCFG=Debug FLASH_MAP=platforms/memory/XMC7000/flashmap/xmc7000_overwrite_single.json PLATFORM_CONFIG=platforms/memory/XMC7000/flashmap/xmc7200_platform.json CORE=CM0P APP_CORE=CM7 APP_CORE_ID=0 |
| 10 | |
| 11 | make clean_boot app APP_NAME=BlinkyApp PLATFORM=XMC7200 BUILDCFG=Debug FLASH_MAP=platforms/memory/XMC7000/flashmap/xmc7000_overwrite_single.json PLATFORM_CONFIG=platforms/memory/XMC7000/flashmap/xmc7200_platform.json CORE=CM7 CORE_ID=0 IMG_TYPE=BOOT IMG_ID=1 |
| 12 | |
| 13 | make clean_upgrade app APP_NAME=BlinkyApp PLATFORM=XMC7200 BUILDCFG=Debug FLASH_MAP=platforms/memory/XMC7000/flashmap/xmc7000_overwrite_single.json PLATFORM_CONFIG=platforms/memory/XMC7000/flashmap/xmc7200_platform.json CORE=CM7 CORE_ID=0 IMG_TYPE=UPGRADE IMG_ID=1 |
| 14 | |
| 15 | - Swap mode |
| 16 | |
| 17 | make clean app APP_NAME=MCUBootApp PLATFORM=XMC7200 BUILDCFG=Debug FLASH_MAP=platforms/memory/XMC7000/flashmap/xmc7000_swap_single.json PLATFORM_CONFIG=platforms/memory/XMC7000/flashmap/xmc7200_platform.json CORE=CM0P APP_CORE=CM7 APP_CORE_ID=0 |
| 18 | |
| 19 | make clean_boot app APP_NAME=BlinkyApp PLATFORM=XMC7200 BUILDCFG=Debug FLASH_MAP=platforms/memory/XMC7000/flashmap/xmc7000_swap_single.json PLATFORM_CONFIG=platforms/memory/XMC7000/flashmap/xmc7200_platform.json CORE=CM7 CORE_ID=0 IMG_TYPE=BOOT IMG_ID=1 |
| 20 | |
| 21 | make clean_upgrade app APP_NAME=BlinkyApp PLATFORM=XMC7200 BUILDCFG=Debug FLASH_MAP=platforms/memory/XMC7000/flashmap/xmc7000_swap_single.json PLATFORM_CONFIG=platforms/memory/XMC7000/flashmap/xmc7200_platform.json CORE=CM7 CORE_ID=0 IMG_TYPE=UPGRADE IMG_ID=1 |
| 22 | |
| 23 | Build parameters description: |
| 24 | ` |
| 25 | |
| 26 | ## XMC7000 Secure boot configuration description |
| 27 | XMC7000 internal flash boot module can be used in secure configuration. |
| 28 | A complete description and instructions for configuring a secure boot can be found in reference manual `AN234802`. |
| 29 | |
| 30 | MCUBoot makefile supports secure image build configuration for XMC7200 and XMC7100 devices. |
| 31 | To prepare a secure MCUBoot image, the user must configure the public key and specify the appropriate parameters for the TOC2 structure in the `cy_si_config.c`, `cy_si_key.c` files and execute the make command with the additional variables `USE_SECURE_MODE=1`, `SECURE_MODE_KEY_NAME=<name>`. |
| 32 | |
| 33 | - Step to generate custom RSA2048 keys: |
| 34 | cysecuretools -t xmc7200 create-key --key-type RSA2048 -o ./keys/cypress-test-rsa2k.pem ./keys/cypress-test-rsa2k.pub --format PEM |
| 35 | |
| 36 | - Step to generate `cy_si_key.c` file: |
| 37 | cysecuretools convert-key -k ./keys/cypress-test-rsa2k.pub -o ./platforms/utils/XMC7000/cy_si_key.c --fmt secure_boot --endian little |
| 38 | |
| 39 | Previous two steps can be executed with single Makefile command. |
| 40 | make gen_secure_cfgs PLATFORM=XMC7200 SECURE_MODE_KEY_TYPE=RSA2048 KEY_NAME=cypress-test-rsa2k |
| 41 | |
| 42 | - Step to run MCUBootApp build with secure flash boot config |
| 43 | make clean app APP_NAME=MCUBootApp PLATFORM=XMC7200 BUILDCFG=Debug FLASH_MAP=platforms/memory/XMC7000/flashmap/xmc7000_overwrite_single.json PLATFORM_CONFIG=platforms/memory/XMC7000/flashmap/xmc7200_platform.json CORE=CM0P APP_CORE=CM7 APP_CORE_ID=0 USE_SECURE_MODE=1 SECURE_MODE_KEY_NAME=cypress-test-rsa2k |
| 44 | |
| 45 | - Example how to configure openocd script: |
| 46 | |
| 47 | set QSPI_FLASHLOADER platforms/BSP/XMC7000/CAT1C_SMIF.FLM |
| 48 | source [find interface/kitprog3.cfg] |
| 49 | set ENABLE_ACQUIRE 0 |
| 50 | set ACQUIRE_TIMEOUT 2000 |
| 51 | |
| 52 | transport select swd |
| 53 | source [find target/cat1c.cfg] |
| 54 | cat1c sflash_restrictions 1 |
| 55 | |
| 56 | targets |
| 57 | |
| 58 | init; reset init; |
| 59 | |
| 60 | flash erase_address 0x17007C00 0x00000200 |
| 61 | flash erase_address 0x17006400 0x00000C00 |
Roman Okhrimenko | 409941a | 2023-11-20 02:18:09 +0200 | [diff] [blame] | 62 | flash fillb 0x14030000 0xFF 0x00002800 |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame] | 63 | |
| 64 | program `./MCUBootApp/out/XMC7200/Debug/MCUBootApp.hex` |
| 65 | |
| 66 | resume; |
| 67 | reset; |
| 68 | shutdown |