-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Mbed bootloader application
- Loading branch information
Showing
9 changed files
with
251 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
build-*/ | ||
dist/ | ||
imgtool* | ||
mcuboot | ||
signing* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright (c) 2021 ARM Limited. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) | ||
|
||
set(MBED_PATH ${MBED_OS_PATH} CACHE INTERNAL "") | ||
set(MCUBOOT_PATH ${MBED_MCU_BOOT_PATH} CACHE INTERNAL "") | ||
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "") | ||
set(APP_TARGET chip-mbed-bootloader) | ||
|
||
include(${MBED_PATH}/tools/cmake/app.cmake) | ||
|
||
project(${APP_TARGET}) | ||
|
||
add_subdirectory(${MBED_PATH} ./mbed_build) | ||
add_subdirectory(${MCUBOOT_PATH}/boot/bootutil/ ./mbed_mcu_boot_util) | ||
add_subdirectory(${MCUBOOT_PATH}/boot/mbed/ ./mbed_mcu_boot) # Mbed-MCUboot Port | ||
|
||
add_executable(${APP_TARGET}) | ||
|
||
target_sources(${APP_TARGET} | ||
PUBLIC | ||
default_bd.cpp | ||
signing_keys.c | ||
) | ||
|
||
target_link_libraries(${APP_TARGET} | ||
PUBLIC | ||
bootutil | ||
mbed-mcuboot | ||
mbed-storage-spif | ||
mbed-storage-qspif | ||
mbed-baremetal | ||
) | ||
|
||
mbed_set_post_build(${APP_TARGET}) | ||
|
||
option(VERBOSE_BUILD "Have a verbose build process") | ||
if(VERBOSE_BUILD) | ||
set(CMAKE_VERBOSE_MAKEFILE ON) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* default_bd.cpp | ||
* | ||
* Created on: Jul 30, 2020 | ||
* Author: gdbeckstein | ||
*/ | ||
|
||
#include "BlockDevice.h" | ||
|
||
#include "SlicingBlockDevice.h" | ||
|
||
#if COMPONENT_SPIF | ||
#include "SPIFBlockDevice.h" | ||
#endif | ||
|
||
#if COMPONENT_QSPIF | ||
#include "QSPIFBlockDevice.h" | ||
#endif | ||
|
||
#if COMPONENT_DATAFLASH | ||
#include "DataFlashBlockDevice.h" | ||
#endif | ||
|
||
#if COMPONENT_SD | ||
#include "SDBlockDevice.h" | ||
|
||
#if (STATIC_PINMAP_READY) | ||
const spi_pinmap_t static_spi_pinmap = get_spi_pinmap(MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, NC); | ||
#endif | ||
#endif | ||
|
||
BlockDevice * BlockDevice::get_default_instance() | ||
{ | ||
#if COMPONENT_SPIF | ||
|
||
static SPIFBlockDevice default_bd; | ||
|
||
return &default_bd; | ||
|
||
#elif COMPONENT_QSPIF | ||
|
||
static QSPIFBlockDevice default_bd; | ||
|
||
return &default_bd; | ||
|
||
#elif COMPONENT_DATAFLASH | ||
|
||
static DataFlashBlockDevice default_bd; | ||
|
||
return &default_bd; | ||
|
||
#elif COMPONENT_SD | ||
|
||
#if (STATIC_PINMAP_READY) | ||
static SDBlockDevice default_bd(static_spi_pinmap, MBED_CONF_SD_SPI_CS); | ||
#else | ||
static SDBlockDevice default_bd; | ||
#endif | ||
|
||
return &default_bd; | ||
|
||
#else | ||
|
||
return NULL; | ||
|
||
#endif | ||
} | ||
|
||
/** | ||
* You can override this function to suit your hardware/memory configuration | ||
* By default it simply returns what is returned by BlockDevice::get_default_instance(); | ||
*/ | ||
mbed::BlockDevice * get_secondary_bd(void) | ||
{ | ||
mbed::BlockDevice * default_bd = mbed::BlockDevice::get_default_instance(); | ||
static mbed::SlicingBlockDevice sliced_bd(default_bd, 0x0, MCUBOOT_SLOT_SIZE); | ||
return &sliced_bd; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"requires": ["bare-metal", "mbedtls", "mcuboot", "flashiap-block-device", "spif-driver", "qspif", "mbed-trace"], | ||
"config": { | ||
"serial-bootloader-enable": { | ||
"help": "Build bootloader with serial update support", | ||
"value": 0 | ||
} | ||
}, | ||
"target_overrides": { | ||
"*": { | ||
"platform.stdio-baud-rate": 115200, | ||
"target.restrict_size": "0x20000", | ||
"target.c_lib": "small", | ||
"mcuboot.log-level": "MCUBOOT_LOG_LEVEL_DEBUG", | ||
"mbed-trace.enable": true, | ||
"mbed-trace.max-level": "TRACE_LEVEL_DEBUG", | ||
"mbed-trace.fea-ipv6": false | ||
}, | ||
"CY8CPROTO_062_4343W": { | ||
"target.network-default-interface-type": "WIFI", | ||
"target.macros_add": [ | ||
"MXCRYPTO_DISABLED", | ||
"NL_ASSERT_LOG=NL_ASSERT_LOG_DEFAULT", | ||
"NL_ASSERT_EXPECT_FLAGS=NL_ASSERT_FLAG_LOG", | ||
"WHD_PRINT_DISABLE" | ||
], | ||
"mcuboot.primary-slot-address": "0x10020000", | ||
"mcuboot.slot-size": "0xC0000", | ||
"mcuboot.scratch-address": "0x100E0000", | ||
"mcuboot.scratch-size": "0x20000", | ||
"mcuboot.max-img-sectors": "0x180", | ||
"mcuboot.read-granularity": 512 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters