Skip to content

Add new target future sequana PSA #8745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions TESTS/mbed_hal/spm/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#error [NOT_SUPPORTED] this test is supported on GCC only
#endif

#if defined(TARGET_FUTURE_SEQUANA_PSA)
#error [NOT_SUPPORTED] Disable this Test until FUTURE_SEQUANA_PSA enables Memory protection
#endif

#include "utest/utest.h"
#include "unity/unity.h"
#include "greentea-client/test_env.h"
Expand Down
33 changes: 33 additions & 0 deletions TESTS/mbed_hal/trng/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,33 @@

using namespace utest::v1;

#if (defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))
#include "entropy.h"
#include "entropy_poll.h"
#include "crypto.h"
#if !defined(MAX)
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif

/* Calculating the minimum allowed entropy size in bytes */
#define MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE \
MAX(MBEDTLS_ENTROPY_MIN_PLATFORM, MBEDTLS_ENTROPY_BLOCK_SIZE)

void inject_entropy_for_psa()
{
if (psa_crypto_init() == PSA_ERROR_INSUFFICIENT_ENTROPY) {
uint8_t seed[MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE] = {0};
/* inject some a seed for test*/
for (int i = 0; i < MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE; ++i) {
seed[i] = i;
}

/* don't really care if this succeed this is just to make crypto init pass*/
mbedtls_psa_inject_entropy(seed, MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE);
}
}
#endif // (defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))

static int fill_buffer_trng(uint8_t *buffer, trng_t *trng_obj, size_t trng_len)
{
size_t temp_size = 0, output_length = 0;
Expand Down Expand Up @@ -241,7 +268,13 @@ Specification specification(greentea_test_setup, cases, greentea_test_teardown_h

int main()
{
#if (defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))
inject_entropy_for_psa();
#endif
bool ret = !Harness::run(specification);

return ret;
}



2 changes: 2 additions & 0 deletions TESTS/mbedmicro-rtos-mbed/mail/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ using namespace utest::v1;
#define THREAD_STACK_SIZE 512
#elif defined(__ARM_FM)
#define THREAD_STACK_SIZE 512
#elif defined(TARGET_FUTURE_SEQUANA_PSA)
#define THREAD_STACK_SIZE 512
#else
#define THREAD_STACK_SIZE 320 /* larger stack cause out of heap memory on some 16kB RAM boards in multi thread test*/
#endif
Expand Down
2 changes: 2 additions & 0 deletions TESTS/mbedmicro-rtos-mbed/malloc/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ volatile bool thread_should_continue = true;
#define THREAD_STACK_SIZE 512
#elif defined(__ARM_FM)
#define THREAD_STACK_SIZE 512
#elif defined(TARGET_FUTURE_SEQUANA_PSA)
#define THREAD_STACK_SIZE 512
#else
#define THREAD_STACK_SIZE 256
#endif
Expand Down
2 changes: 2 additions & 0 deletions TESTS/mbedmicro-rtos-mbed/threads/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#define PARALLEL_THREAD_STACK_SIZE 512
#elif defined(__ARM_FM)
#define PARALLEL_THREAD_STACK_SIZE 512
#elif defined(TARGET_FUTURE_SEQUANA_PSA)
#define PARALLEL_THREAD_STACK_SIZE 512
#else
#define PARALLEL_THREAD_STACK_SIZE 384
#endif
Expand Down
31 changes: 31 additions & 0 deletions TESTS/mbedtls/selftest/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,32 @@ Case cases[] = {
#endif /* MBEDTLS_SELF_TEST */
};

#if (defined(MBEDTLS_ENTROPY_C) && defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))
#include "crypto.h"
#if !defined(MAX)
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif

/* Calculating the minimum allowed entropy size in bytes */
#define MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE \
MAX(MBEDTLS_ENTROPY_MIN_PLATFORM, MBEDTLS_ENTROPY_BLOCK_SIZE)

void inject_entropy_for_psa()
{
if (psa_crypto_init() == PSA_ERROR_INSUFFICIENT_ENTROPY) {
uint8_t seed[MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE] = {0};
/* inject some a seed for test*/
for (int i = 0; i < MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE; ++i) {
seed[i] = i;
}

/* don't really care if this succeed this is just to make crypto init pass*/
mbedtls_psa_inject_entropy(seed, MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE);
}
}
#endif // (defined(MBEDTLS_ENTROPY_C) && defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))


utest::v1::status_t test_setup(const size_t num_cases)
{
GREENTEA_SETUP(120, "default_auto");
Expand All @@ -101,6 +127,11 @@ int main()
return 1;
}
#endif

#if (defined(MBEDTLS_ENTROPY_C) && defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))
inject_entropy_for_psa();
#endif

ret = (Harness::run(specification) ? 0 : 1);
#if defined(MBEDTLS_PLATFORM_C)
mbedtls_platform_teardown(NULL);
Expand Down
4,566 changes: 4,566 additions & 0 deletions TESTS/psa/crypto_init/TARGET_FUTURE_SEQUANA_PSA/crypto_init.hex

Large diffs are not rendered by default.

4,578 changes: 4,578 additions & 0 deletions TESTS/psa/entropy_inject/TARGET_FUTURE_SEQUANA_PSA/entropy_inject.hex

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4,582 changes: 4,582 additions & 0 deletions TESTS/psa/spm_client/TARGET_FUTURE_SEQUANA_PSA/spm_client.hex

Large diffs are not rendered by default.

4,682 changes: 4,682 additions & 0 deletions TESTS/psa/spm_server/TARGET_FUTURE_SEQUANA_PSA/spm_server.hex

Large diffs are not rendered by default.

4,590 changes: 4,590 additions & 0 deletions TESTS/psa/spm_smoke/TARGET_FUTURE_SEQUANA_PSA/spm_smoke.hex

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions features/storage/kvstore/conf/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"K64F": {
"storage_type": "TDB_INTERNAL"
},
"FUTURE_SEQUANA_M0_PSA": {
"storage_type": "TDB_INTERNAL"
},
"K66F": {
"storage_type": "TDB_INTERNAL"
}
Expand Down
6 changes: 6 additions & 0 deletions features/storage/kvstore/conf/tdb_internal/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,11 @@
"help": "If default, the base address is set to the first sector after the application code ends.",
"value": "0"
}
},
"target_overrides": {
"FUTURE_SEQUANA_M0_PSA": {
"internal_size": "0x8000",
"internal_base_address": "0x10078000"
}
}
}
6 changes: 6 additions & 0 deletions features/storage/nvstore/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
"area_1_size": 16384,
"area_2_address": "0x1007C000",
"area_2_size": 16384
},
"FUTURE_SEQUANA_PSA": {
"enabled" : false
},
"FUTURE_SEQUANA_M0_PSA": {
"enabled" : false
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@
;* SPDX-License-Identifier: Apache-2.0
;******************************************************************************/

#if !defined(MBED_ROM_START)
#define MBED_ROM_START 0x10000000
#endif

#if !defined(MBED_ROM_SIZE)
#define MBED_ROM_SIZE 0x80000
#endif

#if !defined(MBED_RAM_START)
#define MBED_RAM_START 0x08000000
#endif

#if !defined(MBED_RAM_SIZE)
#define MBED_RAM_SIZE 0x10000
#endif

; The defines below describe the location and size of blocks of memory in the target.
; Use these defines to specify the memory regions available for allocation.

Expand All @@ -39,14 +55,14 @@
; where 'xx' is the device group; for example, 'cy8c6xx7_cm4_dual.scat'.
; RAM
; RAM
#define RAM_START 0x08000000
#define RAM_SIZE 0x00010000
#define RAM_START MBED_RAM_START
#define RAM_SIZE MBED_RAM_SIZE
; Flash
; Flash
#define FLASH_START 0x10000000
#define FLASH_SIZE 0x00078000
#define FLASH_START MBED_ROM_START
#define FLASH_SIZE MBED_ROM_SIZE

; The following defines describe a 32K flash region used for EEPROM emulation.
; The following defines describe a 32K flash region used for EEPROM emulation.
; This region can also be used as the general purpose flash.
; You can assign sections to this memory region for only one of the cores.
; Note some middleware (e.g. BLE, Emulated EEPROM) can place their data into this memory region.
Expand Down Expand Up @@ -84,7 +100,7 @@
#define EFUSE_SIZE 0x100000


LR_IROM1 FLASH_START FLASH_SIZE
LR_IROM1 FLASH_START (FLASH_SIZE - 0x8000)
{
.cy_app_header +0
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
ENTRY(Reset_Handler)

#if !defined(MBED_ROM_START)
#define MBED_ROM_START 0x10000000
#endif

#if !defined(MBED_ROM_SIZE)
#define MBED_ROM_SIZE 0x80000
#endif

#if !defined(MBED_RAM_START)
#define MBED_RAM_START 0x08000000
#endif

#if !defined(MBED_RAM_SIZE)
#define MBED_RAM_SIZE 0x10000
#endif

/* Force symbol to be entered in the output file as an undefined symbol. Doing
* this may, for example, trigger linking of additional modules from standard
Expand All @@ -47,8 +62,8 @@ MEMORY
* Your changes must be aligned with the corresponding memory regions for the CM4 core in 'xx_cm4_dual.ld',
* where 'xx' is the device group; for example, 'cy8c6xx7_cm4_dual.ld'.
*/
ram (rwx) : ORIGIN = 0x08000000, LENGTH = 0x10000
flash (rx) : ORIGIN = 0x10000000, LENGTH = 0x78000
ram (rwx) : ORIGIN = MBED_RAM_START, LENGTH = MBED_RAM_SIZE
flash (rx) : ORIGIN = MBED_ROM_START, LENGTH = (MBED_ROM_SIZE - 0x8000)

/* This is a 32K flash region used for EEPROM emulation. This region can also be used as the general purpose flash.
* You can assign sections to this memory region for only one of the cores.
Expand Down Expand Up @@ -333,7 +348,7 @@ SECTIONS
KEEP(*(.cy_toc_part2))
} > sflash_toc_2


/* Supervisory Flash: Table of Content # 2 Copy */
.cy_rtoc_part2 :
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x00000000;

if (!isdefinedsymbol(MBED_ROM_START)) {
define symbol MBED_ROM_START = 0x10000000;
}

if (!isdefinedsymbol(MBED_ROM_SIZE)) {
define symbol MBED_ROM_SIZE = 0x80000;
}

if (!isdefinedsymbol(MBED_RAM_START)) {
define symbol MBED_RAM_START = 0x08000000;
}

if (!isdefinedsymbol(MBED_RAM_SIZE)) {
define symbol MBED_RAM_SIZE = 0x10000;
}

/* The symbols below define the location and size of blocks of memory in the target.
* Use these symbols to specify the memory regions available for allocation.
*/
Expand All @@ -39,11 +55,11 @@ define symbol __ICFEDIT_intvec_start__ = 0x00000000;
* where 'xx' is the device group; for example, 'cy8c6xx7_cm4_dual.icf'.
*/
/* RAM */
define symbol __ICFEDIT_region_IRAM1_start__ = 0x08000000;
define symbol __ICFEDIT_region_IRAM1_end__ = 0x08010000;
define symbol __ICFEDIT_region_IRAM1_start__ = MBED_RAM_START;
define symbol __ICFEDIT_region_IRAM1_end__ = (MBED_RAM_START + MBED_RAM_SIZE);
/* Flash */
define symbol __ICFEDIT_region_IROM1_start__ = 0x10000000;
define symbol __ICFEDIT_region_IROM1_end__ = 0x10078000;
define symbol __ICFEDIT_region_IROM1_start__ = MBED_ROM_START;
define symbol __ICFEDIT_region_IROM1_end__ = (MBED_ROM_START + MBED_ROM_SIZE - 0x8000);

/* The following symbols define a 32K flash region used for EEPROM emulation.
* This region can also be used as the general purpose flash.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ void mbed_sdk_init(void)
ipcrpc_init();
}

#if defined(COMPONENT_SPM_MAILBOX)
void mailbox_init(void);
#endif

/*******************************************************************************
* Function Name: SystemInit
Expand Down Expand Up @@ -189,6 +192,10 @@ void SystemInit(void)
Cy_SystemInit();
SystemCoreClockUpdate();

#if defined(COMPONENT_SPM_MAILBOX)
mailbox_init();
#endif

#if defined(CY_DEVICE_PSOC6ABLE2)
#if !defined(CY_IPC_DEFAULT_CFG_DISABLE)
/* Allocate and initialize semaphores for the system operations. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@
;* SPDX-License-Identifier: Apache-2.0
;******************************************************************************/

#if !defined(MBED_ROM_START)
#define MBED_ROM_START 0x10080000
#endif

#if !defined(MBED_ROM_SIZE)
#define MBED_ROM_SIZE 0x78000
#endif

#if !defined(MBED_RAM_START)
#define MBED_RAM_START 0x08010000
#endif

#if !defined(MBED_RAM_SIZE)
#define MBED_RAM_SIZE 0x37800
#endif

; The defines below describe the location and size of blocks of memory in the target.
; Use these defines to specify the memory regions available for allocation.

Expand All @@ -41,12 +57,12 @@
; where 'xx' is the device group; for example, 'cy8c6xx7_cm0plus.scat'.
; RAM
; RAM
#define RAM_START 0x08010000
#define RAM_SIZE 0x00037800
#define RAM_START MBED_RAM_START
#define RAM_SIZE MBED_RAM_SIZE
; Flash
; Flash
#define FLASH_START 0x10080000
#define FLASH_SIZE 0x00078000
#define FLASH_START MBED_ROM_START
#define FLASH_SIZE MBED_ROM_SIZE

; The following defines describe a 32K flash region used for EEPROM emulation.
; This region can also be used as the general purpose flash.
Expand Down
Loading