Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 1 | ### Port of MCUBoot library for evaluation with Cypress PSoC 6 chips |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 2 | |
Roman Okhrimenko | 6ea44be | 2020-09-24 17:20:15 +0300 | [diff] [blame] | 3 | ### Disclaimer |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 4 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 5 | Given solution is included in `MCUboot` repository with purpose to demonstrate basic consepts and features of MCUboot library on Cypress PSoC 6 device. Applications are created per MCUboot library maintainers requirements. Implemetation differs from conventional and recomended by Cypress Semiconductors development flow for PSoC 6 devices. These applications are not recomended as a starting point for development and should not be considered as supported examples for PSoC 6 devices. |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 6 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 7 | Examples provided to use with **ModusToolbox® Software Environment** are a recommended reference point to start development of MCUboot based bootloaders for PSoC 6 devices. |
Roman Okhrimenko | 6ea44be | 2020-09-24 17:20:15 +0300 | [diff] [blame] | 8 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 9 | Refer to **Cypress Semiconductors** [github](https://github.com/cypresssemiconductorco) page to find examples. |
Roman Okhrimenko | 6ea44be | 2020-09-24 17:20:15 +0300 | [diff] [blame] | 10 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 11 | 1. MCUboot-Based Basic Bootloader [mtb-example-psoc6-mcuboot-basic](https://github.com/cypresssemiconductorco/mtb-example-psoc6-mcuboot-basic) |
| 12 | 2. MCUboot-Based Bootloader with Rollback to Factory App in External Flash [mtb-example-anycloud-mcuboot-rollback](https://github.com/cypresssemiconductorco/mtb-example-anycloud-mcuboot-rollback) |
Roman Okhrimenko | 6ea44be | 2020-09-24 17:20:15 +0300 | [diff] [blame] | 13 | |
Roman Okhrimenko | 977b375 | 2022-03-31 14:40:48 +0300 | [diff] [blame] | 14 | ### Solution description |
Roman Okhrimenko | 6ea44be | 2020-09-24 17:20:15 +0300 | [diff] [blame] | 15 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 16 | There are two applications implemented: |
| 17 | * MCUBootApp - PSoC6 MCUboot-based bootloading application; |
| 18 | * BlinkyApp - simple PSoC6 blinking LED application which is a target of BOOT/UPGRADE; |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 19 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 20 | The default flash map for MCUBootApp implemented is next: |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 21 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 22 | * [0x10000000, 0x10018000] - MCUBootApp (bootloader) area; |
| 23 | * [0x10018000, 0x10028000] - primary slot for BlinkyApp; |
| 24 | * [0x10028000, 0x10038000] - secondary slot for BlinkyApp; |
| 25 | * [0x10038000, 0x10039000] - scratch area; |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 26 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 27 | The flash map is defined through sysflash.h and memory.c. |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 28 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 29 | It is also possible to place secondary (upgrade) slots in external memory module. In this case primary slot can be doubled in size. |
| 30 | For more details about External Memory usage, please refer to separate guiding document `MCUBootApp/ExternalMemory.md`. |
Roman Okhrimenko | 13f79ed | 2021-03-11 19:05:41 +0200 | [diff] [blame] | 31 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 32 | 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 Mbed TLS Library. |
Roman Okhrimenko | 13f79ed | 2021-03-11 19:05:41 +0200 | [diff] [blame] | 33 | |
Roman Okhrimenko | 977b375 | 2022-03-31 14:40:48 +0300 | [diff] [blame] | 34 | ### Downloading solution's assets |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 35 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 36 | There is a set assets required: |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 37 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 38 | * MCUBooot Library (root repository) |
| 39 | * PSoC6 Peripheral Drivers Library (PDL) |
| 40 | * Mbed TLS Cryptographic Library |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 41 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 42 | Those are represented as submodules. |
| 43 | |
| 44 | To retrieve source code with subsequent submodules pull: |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 45 | |
Fabio Utzig | de1d72d | 2020-11-10 12:35:04 -0300 | [diff] [blame] | 46 | git clone --recursive https://github.com/mcu-tools/mcuboot.git |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 47 | |
| 48 | Submodules can also be updated and initialized separately: |
| 49 | |
Christian Daudt | e1960a9 | 2020-03-04 14:20:33 -0800 | [diff] [blame] | 50 | cd mcuboot |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 51 | git submodule update --init --recursive |
| 52 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 53 | |
| 54 | |
Roman Okhrimenko | 977b375 | 2022-03-31 14:40:48 +0300 | [diff] [blame] | 55 | ### Building solution |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 56 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 57 | Root directory for build is **boot/cypress.** |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 58 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 59 | This folder contains make files infrastructure for building both MCUboot Bootloader and sample BlinkyApp application used for Bootloader demo functionality. |
Roman Okhrimenko | aa7c021 | 2020-03-24 23:33:00 +0200 | [diff] [blame] | 60 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 61 | Instructions on how to build and upload MCUBootApp bootloader application and sample user applocation are located in `Readme.md` files in corresponding folders. |
Roman Okhrimenko | 13f79ed | 2021-03-11 19:05:41 +0200 | [diff] [blame] | 62 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 63 | Supported platforms for `MCUboot`, `BlinkyApp`: |
Roman Okhrimenko | 13f79ed | 2021-03-11 19:05:41 +0200 | [diff] [blame] | 64 | |
Roman Okhrimenko | 977b375 | 2022-03-31 14:40:48 +0300 | [diff] [blame] | 65 | **GCC_ARM** is only supported (built and verified on GCC 9.3.1). |
Roman Okhrimenko | 13f79ed | 2021-03-11 19:05:41 +0200 | [diff] [blame] | 66 | |
Dovhal Artem (CSUKR CSS ICW SW FW 1) | f7a3d1b | 2022-04-01 15:07:37 +0000 | [diff] [blame] | 67 | It is included with [ModusToolbox™ Software Environment](https://www.cypress.com/products/modustoolbox). |
Roman Okhrimenko | 13f79ed | 2021-03-11 19:05:41 +0200 | [diff] [blame] | 68 | |
Roman Okhrimenko | 977b375 | 2022-03-31 14:40:48 +0300 | [diff] [blame] | 69 | The default installation folder is expected by the makefile build system. |
Roman Okhrimenko | 13f79ed | 2021-03-11 19:05:41 +0200 | [diff] [blame] | 70 | |
Roman Okhrimenko | 977b375 | 2022-03-31 14:40:48 +0300 | [diff] [blame] | 71 | To use another installation folder, version of **ModusToolbox™ IDE** or another GCC Compiler, specify the path to a toolchain using the **TOOLCHAIN_PATH** parameter. |
Roman Okhrimenko | 13f79ed | 2021-03-11 19:05:41 +0200 | [diff] [blame] | 72 | |
Dovhal Artem (CSUKR CSS ICW SW FW 1) | f7a3d1b | 2022-04-01 15:07:37 +0000 | [diff] [blame] | 73 | Below is an example on how to set toolchin path to the latest include with **ModusToolbox™ IDE 3.0**: |
| 74 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 75 | make clean app APP_NAME=MCUBootApp PLATFORM=PSOC_062_2M BUILDCFG=Debug FLASH_MAP=platforms/memory/PSOC6/flashmap/psoc6_swap_single.json TOOLCHAIN_PATH=c:/Users/${USERNAME}/ModusToolbox/tools_3.0/gcc |
Dovhal Artem (CSUKR CSS ICW SW FW 1) | f7a3d1b | 2022-04-01 15:07:37 +0000 | [diff] [blame] | 76 | |
Roman Okhrimenko | 977b375 | 2022-03-31 14:40:48 +0300 | [diff] [blame] | 77 | ### Build environment troubleshooting |
Roman Okhrimenko | 13f79ed | 2021-03-11 19:05:41 +0200 | [diff] [blame] | 78 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 79 | Following CLI / IDE are supported for project build: |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 80 | |
| 81 | * Cygwin on Windows systems |
Christian Daudt | e1960a9 | 2020-03-04 14:20:33 -0800 | [diff] [blame] | 82 | * unix style shells on *nix systems |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 83 | * Eclipse / ModusToolbox ("makefile project from existing source") |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 84 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 85 | *Make* - make sure it is added to system's `PATH` variable and correct path is first in the list; |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 86 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 87 | *Python/Python3* - make sure you have correct path referenced in `PATH`; |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 88 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame^] | 89 | *Msys2* - to use systems PATH navigate to msys2 folder, open `msys2_shell.cmd`, uncomment set `MSYS2_PATH_TYPE=inherit`, restart MSYS2 shell. |
| 90 | |
| 91 | This will inherit system's PATH so should find `python3.7` installed in regular way as well as imgtool and its dependencies. |
| 92 | |