blob: cca2c2f31f635abde0062276527d4dd76e8fe30b [file] [log] [blame] [view]
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +03001### Port of MCUBoot library for evaluation with Cypress PSoC 6 chips
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +02002
Roman Okhrimenko6ea44be2020-09-24 17:20:15 +03003### Disclaimer
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +02004
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +03005Given 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 Okhrimenko89ecdac2020-02-28 17:05:55 +02006
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +03007Examples provided to use with **ModusToolbox® Software Environment** are a recommended reference point to start development of MCUboot based bootloaders for PSoC 6 devices.
Roman Okhrimenko6ea44be2020-09-24 17:20:15 +03008
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +03009Refer to **Cypress Semiconductors** [github](https://github.com/cypresssemiconductorco) page to find examples.
Roman Okhrimenko6ea44be2020-09-24 17:20:15 +030010
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +0300111. MCUboot-Based Basic Bootloader [mtb-example-psoc6-mcuboot-basic](https://github.com/cypresssemiconductorco/mtb-example-psoc6-mcuboot-basic)
122. 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 Okhrimenko6ea44be2020-09-24 17:20:15 +030013
Roman Okhrimenko977b3752022-03-31 14:40:48 +030014### Solution description
Roman Okhrimenko6ea44be2020-09-24 17:20:15 +030015
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030016There 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 Okhrimenko89ecdac2020-02-28 17:05:55 +020019
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030020The default flash map for MCUBootApp implemented is next:
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020021
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030022* [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 Okhrimenko89ecdac2020-02-28 17:05:55 +020026
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030027The flash map is defined through sysflash.h and memory.c.
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020028
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030029It is also possible to place secondary (upgrade) slots in external memory module. In this case primary slot can be doubled in size.
30For more details about External Memory usage, please refer to separate guiding document `MCUBootApp/ExternalMemory.md`.
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020031
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030032MCUBootApp 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 Okhrimenko13f79ed2021-03-11 19:05:41 +020033
Roman Okhrimenko977b3752022-03-31 14:40:48 +030034### Downloading solution's assets
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020035
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030036There is a set assets required:
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020037
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030038* MCUBooot Library (root repository)
39* PSoC6 Peripheral Drivers Library (PDL)
40* Mbed TLS Cryptographic Library
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020041
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030042Those are represented as submodules.
43
44To retrieve source code with subsequent submodules pull:
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020045
Fabio Utzigde1d72d2020-11-10 12:35:04 -030046 git clone --recursive https://github.com/mcu-tools/mcuboot.git
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020047
48Submodules can also be updated and initialized separately:
49
Christian Daudte1960a92020-03-04 14:20:33 -080050 cd mcuboot
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020051 git submodule update --init --recursive
52
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030053
54
Roman Okhrimenko977b3752022-03-31 14:40:48 +030055### Building solution
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020056
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030057Root directory for build is **boot/cypress.**
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020058
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030059This folder contains make files infrastructure for building both MCUboot Bootloader and sample BlinkyApp application used for Bootloader demo functionality.
Roman Okhrimenkoaa7c0212020-03-24 23:33:00 +020060
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030061Instructions on how to build and upload MCUBootApp bootloader application and sample user applocation are located in `Readme.md` files in corresponding folders.
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020062
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030063Supported platforms for `MCUboot`, `BlinkyApp`:
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020064
Roman Okhrimenko977b3752022-03-31 14:40:48 +030065**GCC_ARM** is only supported (built and verified on GCC 9.3.1).
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020066
Dovhal Artem (CSUKR CSS ICW SW FW 1)f7a3d1b2022-04-01 15:07:37 +000067It is included with [ModusToolbox Software Environment](https://www.cypress.com/products/modustoolbox).
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020068
Roman Okhrimenko977b3752022-03-31 14:40:48 +030069The default installation folder is expected by the makefile build system.
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020070
Roman Okhrimenko977b3752022-03-31 14:40:48 +030071To use another installation folder, version of **ModusToolbox IDE** or another GCC Compiler, specify the path to a toolchain using the **TOOLCHAIN_PATH** parameter.
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020072
Dovhal Artem (CSUKR CSS ICW SW FW 1)f7a3d1b2022-04-01 15:07:37 +000073Below is an example on how to set toolchin path to the latest include with **ModusToolbox IDE 3.0**:
74
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030075 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)f7a3d1b2022-04-01 15:07:37 +000076
Roman Okhrimenko977b3752022-03-31 14:40:48 +030077### Build environment troubleshooting
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020078
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030079Following CLI / IDE are supported for project build:
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020080
81* Cygwin on Windows systems
Christian Daudte1960a92020-03-04 14:20:33 -080082* unix style shells on *nix systems
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030083* Eclipse / ModusToolbox ("makefile project from existing source")
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020084
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030085*Make* - make sure it is added to system's `PATH` variable and correct path is first in the list;
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020086
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030087*Python/Python3* - make sure you have correct path referenced in `PATH`;
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020088
Roman Okhrimenkodc0ca082023-06-21 20:49:51 +030089*Msys2* - to use systems PATH navigate to msys2 folder, open `msys2_shell.cmd`, uncomment set `MSYS2_PATH_TYPE=inherit`, restart MSYS2 shell.
90
91This will inherit system's PATH so should find `python3.7` installed in regular way as well as imgtool and its dependencies.
92