blob: 8227da62835eb88a6f58f9f5862d420d5f24b406 [file] [log] [blame] [view]
Roman Okhrimenko977b3752022-03-31 14:40:48 +03001## Port of MCUboot library for evaluation with Cypress PSoC™ 6 and CYW20829 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 Okhrimenko977b3752022-03-31 14:40:48 +03005This solution is included in the `MCUboot` repository in order to demonstrate the basic concepts and features of the MCUboot library on PSoC 6 and CYW20829 devices. Applications are created per MCUboot library maintainers requirements. The implementation differs from conventional and recommended by Cypress Semiconductors development flow for PSoC 6 and CYW20829 devices. These applications are not recommended as a starting point for development because they are not supported examples.
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +02006
Roman Okhrimenko977b3752022-03-31 14:40:48 +03007Examples provided to use with **ModusToolbox Software Environment** are a recommended reference point to start development of MCUboot based bootloaders for PSoC 6 and CYW20829 devices.
Roman Okhrimenko6ea44be2020-09-24 17:20:15 +03008
Roman Okhrimenko977b3752022-03-31 14:40:48 +03009For examples, refer to the **Infineon Technologies AG** [github](https://github.com/Infineon/Code-Examples-for-ModusToolbox-Software) page.
Roman Okhrimenko6ea44be2020-09-24 17:20:15 +030010
Roman Okhrimenko977b3752022-03-31 14:40:48 +0300111. MCUboot-based basic bootloader [mtb-example-psoc6-mcuboot-basic](https://github.com/Infineon/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/Infineon/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 Okhrimenko977b3752022-03-31 14:40:48 +030016The two applications implemented:
17* MCUBootApp - PSoC 6 and CYW20829 MCUboot-based bootloading application
18* BlinkyApp - a simple PSoC 6 and CYW20829 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 Okhrimenko977b3752022-03-31 14:40:48 +030022* The two types of upgrade operation supported:
23 * **Overwrite only** - The secondary image is only copied to the primary slot after validation.
24 * **Swap** - The secondary and primary slots images are swapped during the upgrade process. Upgrade operation can be reverted if the secondary image is bad. "Bad image" does not set the imageOK flag in the image trailer. If imageOK is not set, MCUBootApp does not turn off WatchDog Timer and WDT resets the device to start the REVERT procedure.
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020025
Roman Okhrimenko977b3752022-03-31 14:40:48 +030026* The two types of operation modes supported:
27 * Single image
28 * Multi image
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020029
Roman Okhrimenko977b3752022-03-31 14:40:48 +030030* Some or all partitions (slots) can be placed in external memory. For more details about external memory usage, refer to [ExternalMemory.md](MCUBootApp/ExternalMemory.md).
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020031
Roman Okhrimenko977b3752022-03-31 14:40:48 +030032* MCUBootApp checks the 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 on some platforms. The mbedTLS library is used in both cases.
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020034
Roman Okhrimenko977b3752022-03-31 14:40:48 +030035For more details on **MCUBootApp**, refer to [MCUBootApp.md](MCUBootApp/MCUBootApp.md).
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020036
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020037#### BlinkyApp
Roman Okhrimenko977b3752022-03-31 14:40:48 +030038* Can be built to use either primary or secondary image for both internal and external flash memory.
39* Primary and secondary images differ in text printed to the serial terminal and LED-blinking frequency.
40* The watchdog timer functionality is supported to confirm successful start/upgrade of the application.
41* The user-application side of MCUboot swap operation is demonstrated by two kinds of user images, compiled for the primary and secondary slot.
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020042
Roman Okhrimenko977b3752022-03-31 14:40:48 +030043For more details on **BlinkyApp**, refer to [BlinkyApp.md](BlinkyApp/BlinkyApp.md).
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020044
Roman Okhrimenko977b3752022-03-31 14:40:48 +030045### Downloading solution's assets
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020046
Roman Okhrimenko977b3752022-03-31 14:40:48 +030047The set of required libraries represented as submodules:
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020048
Roman Okhrimenko977b3752022-03-31 14:40:48 +030049* MCUBooot library (root repository)
50* Peripheral Drivers library (PDL)
51* mbedTLS Cryptographic library
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020052
Roman Okhrimenko977b3752022-03-31 14:40:48 +030053To retrieve source code with subsequent submodules, pull:
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020054
Fabio Utzigde1d72d2020-11-10 12:35:04 -030055 git clone --recursive https://github.com/mcu-tools/mcuboot.git
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020056
57Submodules can also be updated and initialized separately:
58
Christian Daudte1960a92020-03-04 14:20:33 -080059 cd mcuboot
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020060 git submodule update --init --recursive
61
Roman Okhrimenko977b3752022-03-31 14:40:48 +030062### Building solution
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020063
Roman Okhrimenko977b3752022-03-31 14:40:48 +030064The root directory for build is `boot/cypress`.
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020065
Roman Okhrimenko977b3752022-03-31 14:40:48 +030066The root folder contains a make-files infrastructure for building both MCUBootApp bootloading-application and BlinkyApp user-application.
Roman Okhrimenkoaa7c0212020-03-24 23:33:00 +020067
Roman Okhrimenko977b3752022-03-31 14:40:48 +030068For instructions on how to build and upload MCUBootApp bootloading-application and sample user-application, refer to the [MCUBootApp.md](MCUBootApp/MCUBootApp.md) and [BlinkyApp.md](BlinkyApp/BlinkyApp.md) files in corresponding folders.
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020069
70**Toolchain**
71
Roman Okhrimenko977b3752022-03-31 14:40:48 +030072**GCC_ARM** is only supported (built and verified on GCC 9.3.1).
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020073
Roman Okhrimenko977b3752022-03-31 14:40:48 +030074It is included with [ModusToolbox Software Environment](https://www.cypress.com/products/modustoolbox) and can be found in folder `./ModusToolbox/tools_2.4/gcc`.
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020075
Roman Okhrimenko977b3752022-03-31 14:40:48 +030076The default installation folder is expected by the makefile build system.
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020077
Roman Okhrimenko977b3752022-03-31 14:40:48 +030078To 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 +020079
Roman Okhrimenko977b3752022-03-31 14:40:48 +030080### Build environment troubleshooting
Roman Okhrimenko13f79ed2021-03-11 19:05:41 +020081
Roman Okhrimenko977b3752022-03-31 14:40:48 +030082The following CLI/IDE are supported for project build:
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020083
84* Cygwin on Windows systems
Christian Daudte1960a92020-03-04 14:20:33 -080085* unix style shells on *nix systems
Roman Okhrimenko977b3752022-03-31 14:40:48 +030086* Eclipse / ModusToolbox ("makefile project from existing source")
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020087
Roman Okhrimenko977b3752022-03-31 14:40:48 +030088*Make* - Ensure that it is added to the system's `PATH` variable and the correct path is the first on the list.
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020089
Roman Okhrimenko977b3752022-03-31 14:40:48 +030090*Python/Python3* - Ensure that you have the correct path referenced in `PATH`.
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020091
Roman Okhrimenko977b3752022-03-31 14:40:48 +030092*Msys2* - To use the system's path, navigate to the msys2 folder, open `msys2_shell.cmd`, uncomment set `MSYS2_PATH_TYPE=inherit`, restart the MSYS2 shell. This will inherit the system's path and find `python` installed in a regular way as well as `imgtool` and its dependencies.