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 | |
| 4 | Following commands can be used as an example to build a project |
| 5 | - Overwrite mode |
| 6 | |
| 7 | 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 |
| 8 | |
| 9 | 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 |
| 10 | |
| 11 | 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 |
| 12 | |
| 13 | - Swap mode |
| 14 | |
| 15 | 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 |
| 16 | |
| 17 | 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 |
| 18 | |
| 19 | 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 |
| 20 | |
| 21 | Build parameters description: |
| 22 | ` |
| 23 | |
| 24 | ## XMC7000 Secure boot configuration description |
| 25 | XMC7000 internal flash boot module can be used in secure configuration. |
| 26 | A complete description and instructions for configuring a secure boot can be found in reference manual `AN234802`. |
| 27 | |
| 28 | MCUBoot makefile supports secure image build configuration for XMC7200 and XMC7100 devices. |
| 29 | 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>`. |
| 30 | |
| 31 | - Step to generate custom RSA2048 keys: |
| 32 | cysecuretools -t xmc7200 create-key --key-type RSA2048 -o ./keys/cypress-test-rsa2k.pem ./keys/cypress-test-rsa2k.pub --format PEM |
| 33 | |
| 34 | - Step to generate `cy_si_key.c` file: |
| 35 | cysecuretools convert-key -k ./keys/cypress-test-rsa2k.pub -o ./platforms/utils/XMC7000/cy_si_key.c --fmt secure_boot --endian little |
| 36 | |
| 37 | Previous two steps can be executed with single Makefile command. |
| 38 | make gen_secure_cfgs PLATFORM=XMC7200 SECURE_MODE_KEY_TYPE=RSA2048 KEY_NAME=cypress-test-rsa2k |
| 39 | |
| 40 | - Step to run MCUBootApp build with secure flash boot config |
| 41 | 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 |
| 42 | |
| 43 | - Example how to configure openocd script: |
| 44 | |
| 45 | set QSPI_FLASHLOADER platforms/BSP/XMC7000/CAT1C_SMIF.FLM |
| 46 | source [find interface/kitprog3.cfg] |
| 47 | set ENABLE_ACQUIRE 0 |
| 48 | set ACQUIRE_TIMEOUT 2000 |
| 49 | |
| 50 | transport select swd |
| 51 | source [find target/cat1c.cfg] |
| 52 | cat1c sflash_restrictions 1 |
| 53 | |
| 54 | targets |
| 55 | |
| 56 | init; reset init; |
| 57 | |
| 58 | flash erase_address 0x17007C00 0x00000200 |
| 59 | flash erase_address 0x17006400 0x00000C00 |
| 60 | |
| 61 | program `./MCUBootApp/out/XMC7200/Debug/MCUBootApp.hex` |
| 62 | |
| 63 | resume; |
| 64 | reset; |
| 65 | shutdown |