Initial commit
Initial commit.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Open Source Foundries Limited
|
||||
*
|
||||
* Copyright (c) 2020 Embedded Planet
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the Licens
|
||||
*/
|
||||
|
||||
#include "platform/mbed_assert.h"
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Open Source Foundries Limited
|
||||
* Copyright (c) 2019-2020 Arm Limited
|
||||
* Copyright (c) 2019-2020 Linaro Limited
|
||||
* Copyright (c) 2020 Embedded Planet
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __MCUBOOT_CONFIG_H__
|
||||
#define __MCUBOOT_CONFIG_H__
|
||||
|
||||
/*
|
||||
* For available configurations and their explanations,
|
||||
* see mbed_lib.json.
|
||||
*/
|
||||
|
||||
#define SIGNATURE_TYPE_RSA 0
|
||||
#define SIGNATURE_TYPE_EC256 1
|
||||
#define SIGNATURE_TYPE_ED25519 2
|
||||
#define SIGNATURE_TYPE_NONE 3
|
||||
|
||||
/*
|
||||
* Signature algorithm
|
||||
*/
|
||||
#if (MCUBOOT_SIGNATURE_ALGORITHM == SIGNATURE_TYPE_RSA)
|
||||
#define MCUBOOT_SIGN_RSA
|
||||
# if (MCUBOOT_RSA_SIGNATURE_LENGTH != 2048 && \
|
||||
MCUBOOT_RSA_SIGNATURE_LENGTH != 3072)
|
||||
# error "Invalid RSA key size (must be 2048 or 3072)"
|
||||
# else
|
||||
# define MCUBOOT_SIGN_RSA_LEN MCUBOOT_RSA_SIGNATURE_LENGTH
|
||||
# endif
|
||||
#elif (MCUBOOT_SIGNATURE_ALGORITHM == SIGNATURE_TYPE_EC256)
|
||||
#define MCUBOOT_SIGN_EC256
|
||||
#elif (MCUBOOT_SIGNATURE_ALGORITHM == SIGNATURE_TYPE_ED25519)
|
||||
#define MCUBOOT_SIGN_ED25519
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Crypto backend
|
||||
*/
|
||||
#define MBEDTLS 0
|
||||
#define TINYCRYPT 1
|
||||
|
||||
#if (MCUBOOT_CRYPTO_BACKEND == MBEDTLS)
|
||||
#define MCUBOOT_USE_MBED_TLS
|
||||
#elif (MCUBOOT_CRYPTO_BACKEND == TINYCRYPT)
|
||||
/**
|
||||
* XXX TinyCrypt is currently not supported by Mbed-OS due to build conflicts.
|
||||
* See https://github.com/AGlass0fMilk/mbed-mcuboot-blinky/issues/2
|
||||
*/
|
||||
#error TinyCrypt is currently not supported by Mbed-OS due to build conflicts.
|
||||
#define MCUBOOT_USE_TINYCRYPT
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Only one image (two slots) supported for now
|
||||
*/
|
||||
#define MCUBOOT_IMAGE_NUMBER 1
|
||||
|
||||
/*
|
||||
* Currently there is no configuration option, for this platform,
|
||||
* that enables the system specific mcumgr commands in mcuboot
|
||||
*/
|
||||
#define MCUBOOT_PERUSER_MGMT_GROUP_ENABLED 0
|
||||
|
||||
/*
|
||||
* Encrypted Images
|
||||
*/
|
||||
#if defined(MCUBOOT_ENCRYPT_RSA) || defined(MCUBOOT_ENCRYPT_EC256) || defined(MCUBOOT_ENCRYPT_X25519)
|
||||
#define MCUBOOT_ENC_IMAGES
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enabling this option uses newer flash map APIs. This saves RAM and
|
||||
* avoids deprecated API usage.
|
||||
*/
|
||||
#define MCUBOOT_USE_FLASH_AREA_GET_SECTORS
|
||||
|
||||
/*
|
||||
* No watchdog integration for now
|
||||
*/
|
||||
#define MCUBOOT_WATCHDOG_FEED() \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* No direct idle call implemented
|
||||
*/
|
||||
#define MCUBOOT_CPU_IDLE() \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
#endif /* __MCUBOOT_CONFIG_H__ */
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 Runtime Inc
|
||||
* Copyright (c) 2020 Cypress Semiconductor Corporation
|
||||
* Copyright (c) 2020 Embedded Planet
|
||||
* Copyright (c) 2020 ARM Limited
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the Licens.
|
||||
*/
|
||||
|
||||
#ifndef __MCUBOOT_LOGGING_H__
|
||||
#define __MCUBOOT_LOGGING_H__
|
||||
|
||||
#define MCUBOOT_LOG_LEVEL_OFF 0
|
||||
#define MCUBOOT_LOG_LEVEL_ERROR 1
|
||||
#define MCUBOOT_LOG_LEVEL_WARNING 2
|
||||
#define MCUBOOT_LOG_LEVEL_INFO 3
|
||||
#define MCUBOOT_LOG_LEVEL_DEBUG 4
|
||||
|
||||
/*
|
||||
* The compiled log level determines the maximum level that can be
|
||||
* printed.
|
||||
*/
|
||||
#ifndef MCUBOOT_LOG_LEVEL
|
||||
#define MCUBOOT_LOG_LEVEL MCUBOOT_LOG_LEVEL_OFF
|
||||
#endif
|
||||
|
||||
#if MCUBOOT_LOG_LEVEL == MCUBOOT_LOG_LEVEL_ERROR
|
||||
#define MBED_TRACE_MAX_LEVEL TRACE_LEVEL_ERROR
|
||||
#elif MCUBOOT_LOG_LEVEL == MCUBOOT_LOG_LEVEL_WARNING
|
||||
#define MBED_TRACE_MAX_LEVEL TRACE_LEVEL_WARN
|
||||
#elif MCUBOOT_LOG_LEVEL == MCUBOOT_LOG_LEVEL_INFO
|
||||
#define MBED_TRACE_MAX_LEVEL TRACE_LEVEL_INFO
|
||||
#elif MCUBOOT_LOG_LEVEL == MCUBOOT_LOG_LEVEL_DEBUG
|
||||
#define MBED_TRACE_MAX_LEVEL TRACE_LEVEL_DEBUG
|
||||
#endif
|
||||
|
||||
#define TRACE_GROUP "MCUb"
|
||||
#include "mbed-trace/mbed_trace.h"
|
||||
#include "bootutil/ignore.h"
|
||||
|
||||
#define MCUBOOT_LOG_MODULE_DECLARE(domain) /* ignore */
|
||||
#define MCUBOOT_LOG_MODULE_REGISTER(domain) /* ignore */
|
||||
|
||||
#if MCUBOOT_LOG_LEVEL >= MCUBOOT_LOG_LEVEL_ERROR
|
||||
#define MCUBOOT_LOG_ERR tr_error
|
||||
#else
|
||||
#define MCUBOOT_LOG_ERR(...) IGNORE(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if MCUBOOT_LOG_LEVEL >= MCUBOOT_LOG_LEVEL_WARNING
|
||||
#define MCUBOOT_LOG_WRN tr_warn
|
||||
#else
|
||||
#define MCUBOOT_LOG_WRN(...) IGNORE(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if MCUBOOT_LOG_LEVEL >= MCUBOOT_LOG_LEVEL_INFO
|
||||
#define MCUBOOT_LOG_INF tr_info
|
||||
#else
|
||||
#define MCUBOOT_LOG_INF(...) IGNORE(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if MCUBOOT_LOG_LEVEL >= MCUBOOT_LOG_LEVEL_DEBUG
|
||||
#define MCUBOOT_LOG_DBG tr_debug
|
||||
#else
|
||||
#define MCUBOOT_LOG_DBG(...) IGNORE(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#endif /* __MCUBOOT_LOGGING_H__ */
|
||||
Reference in New Issue
Block a user