Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
8e5a1d5
Copied in psoc filed
michaelthomasj Apr 21, 2020
631ce20
Replaced psoc files with musca_b1 files
Apr 27, 2020
b01808a
Created cmake file for ra6m4 and made changes for ra6m4
Apr 27, 2020
fdc151a
Successful build.
Apr 28, 2020
efd2b64
Removed PPC and MPC
May 11, 2020
4c6a841
Added BSP for RA6M4
May 14, 2020
6d9d7c0
Initial copy from ra6m4
michaelthomasj May 22, 2020
c44396d
Updated driver
michaelthomasj May 24, 2020
b942fa3
added files from ap
michaelthomasj Jun 3, 2020
0d137c3
More changes to get bl2 working
michaelthomasj Jun 8, 2020
77cb804
test update
michaelthomasj Jun 14, 2020
e54ca19
moving to appropriate folder structure
michaelthomasj Jun 16, 2020
19a2ba1
Updates
michaelthomasj Jun 18, 2020
bbb3512
removed header file
michaelthomasj Jun 18, 2020
a1ff592
Added cfg file
michaelthomasj Jun 22, 2020
e2df43d
Made SCI_UART use configurable
michaelthomasj Jun 22, 2020
c45ec39
Added cfg file to more src files
michaelthomasj Jun 23, 2020
e338a01
Updated memory layout
michaelthomasj Jun 30, 2020
e9f3890
Updated flash layout
Jul 4, 2020
43b9c02
Updates for RA6M4
michaelthomasj Jul 7, 2020
d83ab44
Added boot log config header
michaelthomasj Jul 13, 2020
d03d73c
disabled code that is not applicable
michaelthomasj Jul 13, 2020
4b706c8
Added config for dual image
michaelthomasj Jul 15, 2020
f710ac1
made flash area xml configurable
michaelthomasj Jul 16, 2020
72ada55
renamed cfg file
michaelthomasj Jul 17, 2020
e2de802
flash layout update
michaelthomasj Jul 17, 2020
f73cc4f
renamed target folder and deleted duplicates
michaelthomasj Jul 17, 2020
f3d62aa
undo uncrustify
michaelthomasj Jul 17, 2020
1da1c84
more uncrustify
michaelthomasj Jul 17, 2020
622358d
added target/c and h files
michaelthomasj Jul 17, 2020
0ff7c92
undid more unnecessary changes
michaelthomasj Jul 17, 2020
e6835df
more update
michaelthomasj Jul 17, 2020
4dfd933
updated ld file
Jul 17, 2020
da94211
Merge branch 'tfmv1.1' into add-ra6m4-support
Jul 17, 2020
8ec7d78
Mapped all port changes to relevant folders
michaelthomasj Jul 17, 2020
00747d6
more cleanup
michaelthomasj Jul 17, 2020
8336ff2
spacing
michaelthomasj Jul 17, 2020
1f9bf1b
updated files to v1.1
Jul 18, 2020
9a31697
Fixed the issue with unwanted init of PS
Jul 18, 2020
d2d1d22
Fixed the stack size issue
Jul 18, 2020
0786907
Fixed compatibility issue with mbed-crypto 3.1.0
Jul 20, 2020
eb66c84
Comment
michaelthomasj Jul 21, 2020
c92af1e
Updated to use standard uart driver
michaelthomasj Jul 21, 2020
7374813
Fixed error code
michaelthomasj Jul 21, 2020
acf934d
Made more items configurable
michaelthomasj Jul 21, 2020
6d411c5
removed VTOR setting in bootloader. This is done in BSP SystemInit now
michaelthomasj Jul 22, 2020
c4c01cd
whitespace
michaelthomasj Jul 22, 2020
0d08c30
Review comment
michaelthomasj Jul 22, 2020
3f6fe4a
updated to run successfully with crypto
Jul 23, 2020
685b5fc
updated with bsp clock init
Jul 26, 2020
197debb
Removed crypto init for testing
Jul 27, 2020
0ed08b6
Removed unnecessary change
michaelthomasj Jul 28, 2020
c165c35
Merge branch 'ra_tfm_v1_1_bl2_integration' into add_ra_bl2_support
michaelthomasj Jul 28, 2020
89ecf72
Changes to support tfm v1.1
michaelthomasj Jul 29, 2020
754f39e
Added attestation addresses
michaelthomasj Aug 3, 2020
a02f0d3
Added IAR support
michaelthomasj Aug 4, 2020
df6d6b1
Added support for ra6m4 psa test
lavanya-selvaraju Aug 7, 2020
712b9cd
Added support for RTT print and fixed flash issue
Aug 8, 2020
82515b8
Merge remote-tracking branch 'origin/add-ra6m4-support-psa-test' into…
Aug 8, 2020
7c81ae3
Upgraded crypto psa interface files
Aug 10, 2020
c8bfa44
Upgraded crypto psa interface files
Aug 13, 2020
2099bed
Fixed build issue caused by upgrade
Aug 15, 2020
f79c804
Merge branch 'add_ra_bl2_support' into add-ra6m4-support
Aug 15, 2020
0d356fa
Moved target specific files to rm_tfm_port
Aug 16, 2020
417204b
tfm build and run with bsp from fsp
Aug 31, 2020
808b907
Added tfm_common_config.h
Sep 10, 2020
aecbbf7
Added freertos wrapper
Sep 15, 2020
67adb02
Added back uart stdout
Sep 16, 2020
4a48bf0
Made uart debug optional
Sep 18, 2020
b418aad
BL2 update bug fix
Sep 19, 2020
4b5b3f9
Fixed boot data issue
Sep 19, 2020
94c6e86
Created tfm_crypto_include folder and fixed path issue for attestation
Sep 19, 2020
0ed4c0d
Fixed crypto include path issue
Sep 20, 2020
962792f
Reverted unwanted changes
Sep 20, 2020
1c05235
Undid stdout driver changes
michaelthomasj Sep 20, 2020
f8d9cef
space
michaelthomasj Sep 20, 2020
8177481
Changed include path for bl2
michaelthomasj Sep 21, 2020
361e061
Removed unused services
Sep 21, 2020
c4b9341
Branch for tfm with partly built as lib
Sep 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions app/os_wrapper_freertos.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* Copyright (c) 2019-2020, Arm Limited. All rights reserved.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file to be deleted

*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/

/*
* This file contains the implementation of APIs which are defined in
* os_wrapper/mutex.h by TF-M(tag: TF-Mv1.1). The implementation is based
* on FreeRTOS mutex type semaphore.
*/

#include "os_wrapper/mutex.h"

#include "FreeRTOS.h"
#include "semphr.h"
#include "mpu_wrappers.h"

#if( configSUPPORT_STATIC_ALLOCATION == 1 )
/*
* In the static allocation, the RAM is required to hold the semaphore's
* state.
*/
StaticSemaphore_t xSecureMutexBuffer;
#endif

void * os_wrapper_mutex_create( void )
{
SemaphoreHandle_t xMutexHandle = NULL;

#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
xMutexHandle = xSemaphoreCreateMutex();
#elif( configSUPPORT_STATIC_ALLOCATION == 1 )
xMutexHandle = xSemaphoreCreateMutexStatic( &xSecureMutexBuffer );
#endif
return ( void * ) xMutexHandle;
}
/*-----------------------------------------------------------*/

uint32_t os_wrapper_mutex_acquire( void * handle, uint32_t timeout )
{
BaseType_t xRet;

if( ! handle )
return OS_WRAPPER_ERROR;

xRet = xSemaphoreTake( ( SemaphoreHandle_t ) handle,
( timeout == OS_WRAPPER_WAIT_FOREVER ) ?
portMAX_DELAY : ( TickType_t ) timeout );

if( xRet != pdPASS )
return OS_WRAPPER_ERROR;
else
return OS_WRAPPER_SUCCESS;
}
/*-----------------------------------------------------------*/

uint32_t os_wrapper_mutex_release( void * handle )
{
BaseType_t xRet;

if( !handle )
return OS_WRAPPER_ERROR;

xRet = xSemaphoreGive( ( SemaphoreHandle_t ) handle );

if( xRet != pdPASS )
return OS_WRAPPER_ERROR;
else
return OS_WRAPPER_SUCCESS;
}
/*-----------------------------------------------------------*/

uint32_t os_wrapper_mutex_delete( void * handle )
{
vSemaphoreDelete( ( SemaphoreHandle_t ) handle );

return OS_WRAPPER_SUCCESS;
}
/*-----------------------------------------------------------*/
9 changes: 4 additions & 5 deletions bl2/ext/mcuboot/bl2_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ __asm(" .global __ARM_use_no_argv\n");
#endif

#if defined(__ARM_ARCH_8M_MAIN__) || defined(__ARM_ARCH_8M_BASE__)
REGION_DECLARE(Image$$, ARM_LIB_STACK, $$ZI$$Base);
extern uint32_t __StackLimit;
#endif

/* Flash device name must be specified by target */
Expand Down Expand Up @@ -94,18 +94,17 @@ static void do_boot(struct boot_rsp *rsp)
boot_platform_quit(vt);
}

int main(void)
int bl2_main (void)
{
#if defined(__ARM_ARCH_8M_MAIN__) || defined(__ARM_ARCH_8M_BASE__)
uint32_t msp_stack_bottom =
(uint32_t)&REGION_NAME(Image$$, ARM_LIB_STACK, $$ZI$$Base);
uint32_t msp_stack_bottom = (uint32_t) &__StackLimit;
#endif
struct boot_rsp rsp;
int rc;

#if defined(__ARM_ARCH_8M_MAIN__) || defined(__ARM_ARCH_8M_BASE__)
__set_MSPLIM(msp_stack_bottom);
#endif
#endif

/* Perform platform specific initialization */
if (boot_platform_init() != 0) {
Expand Down
4 changes: 2 additions & 2 deletions bl2/ext/mcuboot/bootutil/src/bootutil_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ _Static_assert(BOOT_IMAGE_NUMBER > 0, "Invalid value for BOOT_IMAGE_NUMBER");
(swap_info) = (image) << SWAP_INFO_IMAGE_NUM_POS \
| (type); \
}

#if BL2_TEMP_DIS
/*
* The current flashmap API does not check the amount of space allocated when
* loading sector data from the flash device, allowing for smaller counts here
Expand All @@ -163,7 +163,7 @@ _Static_assert(BOOT_IMAGE_NUMBER > 0, "Invalid value for BOOT_IMAGE_NUMBER");
#if BOOT_MAX_IMG_SECTORS < 32
#error "Too few sectors, please increase BOOT_MAX_IMG_SECTORS to at least 32"
#endif

#endif
/** Number of image slots in flash; currently limited to two. */
#define BOOT_NUM_SLOTS 2

Expand Down
1 change: 1 addition & 0 deletions bl2/ext/mcuboot/bootutil/src/image_rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/

#include <string.h>
#include "rm_bl2_cfg.h"

#include "mcuboot_config/mcuboot_config.h"

Expand Down
1 change: 1 addition & 0 deletions bl2/ext/mcuboot/bootutil/src/image_validate.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "bootutil/sha256.h"
#include "bootutil/sign_key.h"
#include "security_cnt.h"
#include "rm_bl2_cfg.h"

#include "mcuboot_config/mcuboot_config.h"

Expand Down
6 changes: 6 additions & 0 deletions bl2/ext/mcuboot/bootutil/src/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,10 @@ boot_read_status(struct boot_loader_state *state, struct boot_status *bs)
bs->swap_type = BOOT_SWAP_TYPE_NONE;

#ifdef MCUBOOT_OVERWRITE_ONLY
#if BL2_TEMP_EN
if(boot_data.imgs[BOOT_CURR_IMG(state)][BOOT_SECONDARY_SLOT].is_hdr_valid == true)
bs->swap_type = BOOT_SWAP_TYPE_PERM;
#endif
/* Overwrite-only doesn't make use of the swap status area. */
return 0;
#else
Expand Down Expand Up @@ -2353,6 +2357,7 @@ context_boot_go(struct boot_loader_state *state, struct boot_rsp *rsp)
}
}

#if defined(__ARM_ARCH_8M_MAIN__) || defined(__ARM_ARCH_8M_BASE__)
/* Save boot status to shared memory area */
#if (BOOT_IMAGE_NUMBER > 1)
rc = boot_save_boot_status((BOOT_CURR_IMG(state) == 0) ?
Expand All @@ -2370,6 +2375,7 @@ context_boot_go(struct boot_loader_state *state, struct boot_rsp *rsp)
BOOT_LOG_ERR("Failed to add Image %u data to shared area",
BOOT_CURR_IMG(state));
}
#endif
}

#if (BOOT_IMAGE_NUMBER > 1)
Expand Down
4 changes: 1 addition & 3 deletions bl2/ext/mcuboot/include/bl2_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
*/
#define IS_ARRAY(array) 0
#else
#define IS_ARRAY(array) \
ZERO_OR_COMPILE_ERROR(!__builtin_types_compatible_p(__typeof__(array), \
__typeof__(&(array)[0])))
#define IS_ARRAY(array) 0

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check this

#endif

#define ARRAY_SIZE(array) \
Expand Down
1 change: 1 addition & 0 deletions bl2/ext/mcuboot/include/config-rsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#ifndef MCUBOOT_MBEDTLS_CONFIG_RSA
#define MCUBOOT_MBEDTLS_CONFIG_RSA

#include "rm_bl2_cfg.h"
/* System support */
#define MBEDTLS_PLATFORM_C
#define MBEDTLS_PLATFORM_MEMORY
Expand Down
74 changes: 74 additions & 0 deletions bl2/ext/mcuboot/include/mcuboot_config/mcuboot_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright (c) 2018 Open Source Foundries Limited

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AjayN93 to check if necessary

* Copyright (c) 2019 Arm Limited
*
* SPDX-License-Identifier: Apache-2.0
*/

/*
* Original code taken from mcuboot project at:
* https://github.com/JuulLabs-OSS/mcuboot
* Git SHA of the original version: ac55554059147fff718015be9f4bd3108123f50a
*/

#ifndef __MCUBOOT_CONFIG_H__
#define __MCUBOOT_CONFIG_H__

#ifdef __cplusplus
extern "C" {
#endif

/*
* This file is also included by the simulator, but we don't want to
* define anything here in simulator builds.
*
* Instead of using mcuboot_config.h, the simulator adds MCUBOOT_xxx
* configuration flags to the compiler command lines based on the
* values of environment variables. However, the file still must
* exist, or bootutil won't build.
*/
#ifndef __BOOTSIM__

/*
* In TF-M most of the configuration flags (e.g. signature type,
* upgrade mode ...) are handled by the CMake-based buildsystem and
* added to the compiler command lines.
*/

/*
* Cryptographic settings
*/
#define MCUBOOT_USE_MBED_TLS

/*
* Logging
*/
#define MCUBOOT_HAVE_LOGGING 1

#endif /* !__BOOTSIM__ */

/*
* Maximum size of the measured boot record.
*
* Its size can be calculated based on the following aspects:
* - There are 5 allowed software component claims,
* - SHA256 is used as the measurement method for the other claims.
* Considering these aspects, the only claim which size can vary is the type
* of the software component with a maximum length of 12 bytes, which means
* the boot record size can be up to 100 bytes.
*/
#define MAX_BOOT_RECORD_SZ (100u)

/*
* Watchdog feeding
*/
#define MCUBOOT_WATCHDOG_FEED() \
do { \
/* Do nothing. */ \
} while (0)

#ifdef __cplusplus
}
#endif

#endif /* __MCUBOOT_CONFIG_H__ */
1 change: 1 addition & 0 deletions bl2/ext/mcuboot/include/mcuboot_config/mcuboot_logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "bootutil/ignore.h"
#include <stdio.h>
#include "rm_bl2_cfg.h"

#ifdef __cplusplus
extern "C" {
Expand Down
1 change: 1 addition & 0 deletions bl2/ext/mcuboot/keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <stddef.h>
#include <bootutil/sign_key.h>
#include "rm_bl2_cfg.h"
#include "mcuboot_config/mcuboot_config.h"
#include "platform/include/tfm_plat_crypto_keys.h"

Expand Down
3 changes: 3 additions & 0 deletions bl2/src/boot_record.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ boot_add_data_to_shared_area(uint8_t major_type,
size_t size,
const uint8_t *data)
{

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed.

#ifdef BOOT_DATA_AVAILABLE
struct shared_data_tlv_entry tlv_entry = {0};
struct tfm_boot_data *boot_data;
uint8_t *next_tlv;
Expand Down Expand Up @@ -120,6 +121,8 @@ boot_add_data_to_shared_area(uint8_t major_type,

boot_data->header.tlv_tot_len += tlv_entry.tlv_len;

#endif /* BOOT_DATA_AVAILABLE */

return SHARED_MEMORY_OK;
}

Expand Down
1 change: 1 addition & 0 deletions interface/include/psa/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <stddef.h>
#include <stdint.h>

#include "tfm_common_config.h"
#include "psa/error.h"

#ifdef __cplusplus
Expand Down
4 changes: 2 additions & 2 deletions interface/include/psa/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ psa_status_t psa_hash_compare(psa_algorithm_t alg,
const uint8_t *input,
size_t input_length,
const uint8_t *hash,
const size_t hash_length);
size_t hash_length);

/** The type of the state data structure for multipart hash operations.
*
Expand Down Expand Up @@ -1288,7 +1288,7 @@ psa_status_t psa_mac_verify(psa_key_handle_t handle,
const uint8_t *input,
size_t input_length,
const uint8_t *mac,
const size_t mac_length);
size_t mac_length);

/** The type of the state data structure for multipart MAC operations.
*
Expand Down
Loading