From 579b30c29999860f9f7d843a25ff5453b6542cce Mon Sep 17 00:00:00 2001 From: Roman Okhrimenko Date: Wed, 24 Mar 2021 13:35:59 +0200 Subject: [PATCH] cypress: Update docs with new platforms support info Signed-off-by: Roman Okhrimenko --- boot/cypress/BlinkyApp/Readme.md | 7 ++++-- boot/cypress/MCUBootApp/ExternalMemory.md | 2 +- boot/cypress/MCUBootApp/README.md | 26 +++++++++++++++-------- boot/cypress/README.md | 10 +++++---- 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/boot/cypress/BlinkyApp/Readme.md b/boot/cypress/BlinkyApp/Readme.md index 60ab3ce1..b10dda4e 100644 --- a/boot/cypress/BlinkyApp/Readme.md +++ b/boot/cypress/BlinkyApp/Readme.md @@ -15,6 +15,8 @@ Functionality: Currently supported platforms * PSOC_062_2M +* PSOC_062_1M +* PSOC_062_512K ### Hardware limitations @@ -31,7 +33,7 @@ These values are set by specifing following macros: `-DUSER_APP_SIZE`, `-DUSER_A Pre-build action calls GCC preprocessor which intantiates defines for particular values in `BlinkyApp_template.ld`. Default values set for currently supported targets: -* PSOC_062_2M in `BlinkyApp.mk` to `-DUSER_APP_START=0x10018000` +* `BlinkyApp.mk` to `-DUSER_APP_START=0x10018000` **Important**: make sure RAM areas of CM4-based BlinkyApp and CM0p-based MCUBootApp bootloader do not overlap. Memory (stack) corruption of CM0p application can cause failure if SystemCall-served operations invoked from CM4. @@ -40,7 +42,7 @@ Memory (stack) corruption of CM0p application can cause failure if SystemCall-se Root directory for build is **boot/cypress.** -The following command will build regular HEX file of a BlinkyApp for BOOT slot: +The following command will build regular HEX file of a BlinkyApp for BOOT slot. Substitute `PLATFORM=` to a paltform name you use in all following commands. make app APP_NAME=BlinkyApp PLATFORM=PSOC_062_2M IMG_TYPE=BOOT @@ -135,6 +137,7 @@ Files to use for programming are: - `MAKEINFO` - 0 (default) - less build info, 1 - verbose output of compilation. - `HEADER_OFFSET` - 0 (default) - no offset of output hex file, 0x%VALUE% - offset for output hex file. Value 0x10000 is slot size MCUBoot Bootloader in this example. - `IMG_TYPE` - `BOOT` (default) - build image for BOOT slot of MCUBoot Bootloader, `UPGRADE` - build image for UPGRADE slot of MCUBoot Bootloader. +- `ENC_IMG` - 0 (default) - build regular upgrade image, `1` - build encrypted upgrade image (MCUBootApp should also be built with this flash set 1) **NOTE**: In case of `UPGRADE` image `HEADER_OFFSET` should be set to MCUBoot Bootloader slot size. diff --git a/boot/cypress/MCUBootApp/ExternalMemory.md b/boot/cypress/MCUBootApp/ExternalMemory.md index 8cd7367b..e1281c84 100644 --- a/boot/cypress/MCUBootApp/ExternalMemory.md +++ b/boot/cypress/MCUBootApp/ExternalMemory.md @@ -62,7 +62,7 @@ Once valid upgrade image was accepted the image in external memory will be erase **How to enable external memory support:** -1. Seek for `CY_BOOT_USE_EXTERNAL_FLASH` in sources and define it in any: MCUBootApp.mk or any suitable header file. +1. Pass `USE_EXTERNAL_FLASH=1` flag to `make` command when building MCUBootApp. 2. Navigate to `cy_flash_map.c` and check if secondary slot start address and size meet the application's needs. 3. Define which slave select is used for external memory on a board by setting `smif_id` value in `main.c`. 4. Build MCUBootApp as described in `Readme.md`. diff --git a/boot/cypress/MCUBootApp/README.md b/boot/cypress/MCUBootApp/README.md index 931281d7..17a9786a 100644 --- a/boot/cypress/MCUBootApp/README.md +++ b/boot/cypress/MCUBootApp/README.md @@ -8,7 +8,10 @@ There are two applications implemented: * MCUBootApp - PSoC6 MCUBoot-based bootloading application; * BlinkyApp - simple PSoC6 blinking LED application which is a target of BOOT/UPGRADE; -The demonstration device is CY8CPROTO-062-4343W board which is PSoC6 device with 2M of Flash available. +Cypress boards, that can be used with this evaluation example: +- CY8CPROTO-062-4343W - PSoC 6 2M on board +- CY8CKIT-062-WIFI-BT - PSoC 6 1M on board +- CY8CPROTO-062S3-4343W - PSoC 6 512K on board The default flash map implemented is the following: Single-image mode. @@ -118,7 +121,7 @@ Since this application is created to demonstrate MCUBoot library features and no 1. `SCB5` used to configure serial port for debug prints. This is the most commonly used Serial Communication Block number among available Cypress PSoC 6 kits. If you try to use custom hardware with this application - change definition of `CYBSP_UART_HW` in `main.c` of MCUBootApp to SCB* that correspond to your design. -2. `CY_SMIF_SLAVE_SELECT_0` is used as definition SMIF driver API. This configuration is used on evaluation kit for this example CY8CPROTO-062-4343W. If you try to use custom hardware with this application - change value of `smif_id` in `main.c` of MCUBootApp to value that corresponds to your design. +2. `CY_SMIF_SLAVE_SELECT_0` is used as definition SMIF driver API. This configuration is used on evaluation kit for this example CY8CPROTO-062-4343W, CY8PROTO-062S3-4343W, CY8CKIT-062-4343W. If you try to use custom hardware with this application - change value of `smif_id` in `main.c` of MCUBootApp to value that corresponds to your design. ### Downloading Solution's Assets @@ -146,17 +149,24 @@ This folder contains make files infrastructure for building MCUBoot Bootloader. make app APP_NAME=MCUBootApp PLATFORM=PSOC_062_2M BUILDCFG=Release MCUBOOT_IMAGE_NUMBER=2 +* To Build MCUBootApp with external memory support - pass `USE_EXTERNAL_FLASH=1` flag to `make` command in examples above. In this case UPGRADE image will be located in external memory. Refer to ExternalMemory.md for additional details. + Root directory for build is **boot/cypress.** **Encrypted Image Support** -To protect user image from unwanted read Upgrade Image Encryption can be applied. The ECDH/HKDF with EC256 scheme is used in a given solution as well as mbedTLS as a crypto provider. +To protect user image from unwanted read - Upgrade Image Encryption can be applied. The ECDH/HKDF with EC256 scheme is used in a given solution as well as mbedTLS as a crypto provider. -To enable image encryption support `MCUBOOT_ENC_IMAGES` and `MCUBOOT_ENCRYPT_EC256` have to be defined (can be done by uncommenting in `mcuboot_config.h`). -User is also responsible on providing corresponding binary key data in `enc_priv_key[]` (file `\MCUBootApp\keys.c`). The public part will be used by imgtool when signing and encrypting upgrade image. Signing image with encryption is described in `\BlinkyApp\readme.md`. +To enable image encryption support use `ENC_IMG=1` build flag (BlinkyApp should also be built with this flash set 1). + +User is also responsible for providing corresponding binary key data in `enc_priv_key[]` (file `\MCUBootApp\keys.c`). The public part will be used by imgtool when signing and encrypting upgrade image. Signing image with encryption is described in `\BlinkyApp\Readme.md`. After MCUBootApp is built with these settings unencrypted and encrypted images will be accepted in secondary (upgrade) slot. +Example command: + + make app APP_NAME=MCUBootApp PLATFORM=PSOC_062_2M BUILDCFG=Debug MCUBOOT_IMAGE_NUMBER=1 ENC_IMG=1 + **Programming solution** There are couple ways of programming hex of MCUBootApp and BlinkyApp. Following instructions assume one of Cypress development kits, for example `CY8CPROTO_062_4343W`. @@ -186,6 +196,8 @@ Connect a board to your computer. Switch Kitprog3 to DAP-BULK mode by pressing ` **Currently supported platforms:** * PSOC_062_2M +* PSOC_062_1M +* PSOC_062_512K **Build environment troubleshooting:** @@ -205,9 +217,5 @@ Also IDE may be used: *Msys2* - to use systems PATH navigate to msys2 folder, open `msys2_shell.cmd`, uncomment set `MSYS2_PATH_TYPE=inherit`, restart MSYS2 shell. -*Cygwin* - add following to build command `CURDIR=pwd | cygpath --mixed -f -` so that build command looks like that: - - make app APP_NAME=MCUBootApp PLATFORM=PSOC_062_2M CURDIR=`pwd | cygpath --mixed -f -` - This will iherit system's PATH so should find `python3.7` installed in regular way as well as imgtool and its dependencies. diff --git a/boot/cypress/README.md b/boot/cypress/README.md index 9e140038..00c3c108 100644 --- a/boot/cypress/README.md +++ b/boot/cypress/README.md @@ -26,10 +26,10 @@ The default flash map for MCUBootApp implemented is next: The flash map is defined through sysflash.h and cy_flash_map.c. -It is also possible to place secondary (upgrade) slots in external memory module so resulting image size can be doubled. +It is also possible to place secondary (upgrade) slots in external memory module. In this case primary slot can be doubled in size. For more details about External Memory usage, please refer to separate guiding document `MCUBootApp/ExternalMemory.md`. -MCUBootApp checks image integrity with SHA256, image authenticity with EC256 digital signature verification and uses completely SW implementation of cryptographic functions based on mbedTLS Library. +MCUBootApp checks image integrity with SHA256, image authenticity with EC256 digital signature verification and uses either completely software implementation of cryptographic functions or accelerated by hardware - both based on mbedTLS Library. ### Downloading Solution's Assets @@ -60,9 +60,11 @@ This folder contains make files infrastructure for building both MCUBoot Bootloa Instructions on how to build and upload MCUBootApp bootloader application and sample user applocation are located in `Readme.md` files in corresponding folders. -Currently supported platforms: +Supported platforms for `MCUBoot`, `BlinkyApp`: -* PSOC_062_2M - for MCUBoot, BlinkyApp; +* PSOC_062_2M +* PSOC_062_1M +* PSOC_062_512K ### Build environment troubleshooting