blob: f2db9910e3cfb21c0a51230397f5112ad8cc8be1 [file] [log] [blame] [view]
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +02001### 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 Okhrimenko6ea44be2020-09-24 17:20:15 +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 Okhrimenko6ea44be2020-09-24 17:20:15 +03007Examples provided to use with **ModusToolbox® Software Environment** are a recommended reference point to start development of MCUBoot based bootloaders for PSoC 6 devices.
8
9Refer to **Cypress Semiconductors** [github](https://github.com/cypresssemiconductorco) page to find examples.
10
111. 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)
13
14### Solution Description
15
16There are two applications implemented:
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020017* MCUBootApp - PSoC 6 MCUBoot-based bootloading application;
18* BlinkyApp - simple PSoC 6 blinking LED application which is a target of BOOT/UPGRADE;
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020019
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020020#### MCUBootApp
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020021
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020022* There are two types of upgrade operation supported:
23 * **Overwrite only** - secondady image is only copied to primary slot after validation
24 * **Swap** - seconrady and primary slots images are swapped in process of upgrade. Upgrade operation can be reverted in case of bad secondary image.
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020025
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020026* There are two types of operation modes supported:
27 * single image
28 * multi image
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020029
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020030* Secondary (upgrade) slot(s) can be placed in external memory. For more details about External Memory usage refer to separate guiding document `MCUBootApp/ExternalMemory.md`.
31
32* MCUBootApp checks image integrity with SHA256, image authenticity with EC256 digital signature verification
33* Cryptographic functions can be based on completely software implementation or be hardware accelerated. mbedTLS library is used in both cases.
34
35Detailed description of **MCUBootApp** is provided in `MCUBootApp/MCUBootApp.md`
Bohdan Kovalchuka333a452020-07-09 16:55:58 +030036
Roman Okhrimenko579b30c2021-03-24 13:35:59 +020037MCUBootApp 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.
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020038
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020039#### BlinkyApp
40* Can be built to use as primary or secondary image for both internal and external flash memory
41* Primary and secondary images differ in text printed to serial terminal and led blinking frequency.
42* Watchdog timer functionality is supported to confirm successful start/upgrade of application
43* User application side of mcuboot swap operation is demonstrated for secondary image build.
44
45Detailed description of **BlinkyApp** is provided in `BlinkyApp/BlinkyApp.md`
46
Roman Okhrimenko6ea44be2020-09-24 17:20:15 +030047### Downloading Solution's Assets
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020048
49There is a set assets required:
50
51* MCUBooot Library (root repository)
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020052* PSoC 6 Peripheral Drivers Library (PDL)
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020053* mbedTLS Cryptographic Library
54
55Those are represented as submodules.
56
57To retrieve source code with subsequent submodules pull:
58
Fabio Utzigde1d72d2020-11-10 12:35:04 -030059 git clone --recursive https://github.com/mcu-tools/mcuboot.git
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020060
61Submodules can also be updated and initialized separately:
62
Christian Daudte1960a92020-03-04 14:20:33 -080063 cd mcuboot
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020064 git submodule update --init --recursive
65
Roman Okhrimenko6ea44be2020-09-24 17:20:15 +030066### Building Solution
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020067
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020068Root directory for build is `boot/cypress`.
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020069
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020070Root folder contains make files infrastructure for building both MCUBootApp bootloading application and BlinkyApp user application.
Roman Okhrimenkoaa7c0212020-03-24 23:33:00 +020071
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020072Instructions on how to build and upload MCUBootApp bootloading application and sample user application are located in `MCUBootApp.md` and `BlinkyApp.md` files in corresponding folders.
73
74**Toolchain**
75
76**GCC_ARM** is the only supported (built and verified on GCC 7.2.1).
77
78It is inluded with [ModusToolbox® Software Environment](https://www.cypress.com/products/modustoolbox-software-environment) and can be found in folder `./ModusToolbox/tools_2.1/gcc-7.2.1`.
79
80Default installation folder is expected by makefile build system.
81
82In case of using another installation folder, version of **ModusToolbox IDE** or another GCC Compiler - path to a toolchain should be specified to a build system using **TOOLCHAIN_PATH** flag.
83
84**Example:**
85
86 make app APP_NAME=BlinkyApp PLATFORM=PSOC_062_2M IMG_TYPE=BOOT TOOLCHAIN_PATH=/home/fw-security/ModusToolbox/tools_2.0/gcc-7.2.1
Roman Okhrimenkoaa7c0212020-03-24 23:33:00 +020087
Roman Okhrimenko579b30c2021-03-24 13:35:59 +020088Supported platforms for `MCUBoot`, `BlinkyApp`:
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020089
Roman Okhrimenko579b30c2021-03-24 13:35:59 +020090* PSOC_062_2M
91* PSOC_062_1M
92* PSOC_062_512K
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020093
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020094### Build Environment Troubleshooting
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020095
96Following CLI / IDE are supported for project build:
97
98* Cygwin on Windows systems
Christian Daudte1960a92020-03-04 14:20:33 -080099* unix style shells on *nix systems
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +0200100* Eclipse / ModusToolbox ("makefile project from existing source")
101
102*Make* - make sure it is added to system's `PATH` variable and correct path is first in the list;
103
104*Python/Python3* - make sure you have correct path referenced in `PATH`;
105
106*Msys2* - to use systems PATH navigate to msys2 folder, open `msys2_shell.cmd`, uncomment set `MSYS2_PATH_TYPE=inherit`, restart MSYS2 shell.
107
108This will inherit system's PATH so should find `python3.7` installed in regular way as well as imgtool and its dependencies.
109