Skip to content

Commit 78d6018

Browse files
author
Cruz Monrreal
authored
Merge pull request #8745 from kfnta/feature-new-target-future-sequana-psa
Add new target future sequana PSA
2 parents 8301325 + c4c21d2 commit 78d6018

File tree

39 files changed

+37740
-32
lines changed

39 files changed

+37740
-32
lines changed

TESTS/mbed_hal/spm/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
#error [NOT_SUPPORTED] this test is supported on GCC only
2424
#endif
2525

26+
#if defined(TARGET_FUTURE_SEQUANA_PSA)
27+
#error [NOT_SUPPORTED] Disable this Test until FUTURE_SEQUANA_PSA enables Memory protection
28+
#endif
29+
2630
#include "utest/utest.h"
2731
#include "unity/unity.h"
2832
#include "greentea-client/test_env.h"

TESTS/mbed_hal/trng/main.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,33 @@
6666

6767
using namespace utest::v1;
6868

69+
#if (defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))
70+
#include "entropy.h"
71+
#include "entropy_poll.h"
72+
#include "crypto.h"
73+
#if !defined(MAX)
74+
#define MAX(a,b) (((a)>(b))?(a):(b))
75+
#endif
76+
77+
/* Calculating the minimum allowed entropy size in bytes */
78+
#define MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE \
79+
MAX(MBEDTLS_ENTROPY_MIN_PLATFORM, MBEDTLS_ENTROPY_BLOCK_SIZE)
80+
81+
void inject_entropy_for_psa()
82+
{
83+
if (psa_crypto_init() == PSA_ERROR_INSUFFICIENT_ENTROPY) {
84+
uint8_t seed[MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE] = {0};
85+
/* inject some a seed for test*/
86+
for (int i = 0; i < MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE; ++i) {
87+
seed[i] = i;
88+
}
89+
90+
/* don't really care if this succeed this is just to make crypto init pass*/
91+
mbedtls_psa_inject_entropy(seed, MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE);
92+
}
93+
}
94+
#endif // (defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))
95+
6996
static int fill_buffer_trng(uint8_t *buffer, trng_t *trng_obj, size_t trng_len)
7097
{
7198
size_t temp_size = 0, output_length = 0;
@@ -241,7 +268,13 @@ Specification specification(greentea_test_setup, cases, greentea_test_teardown_h
241268

242269
int main()
243270
{
271+
#if (defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))
272+
inject_entropy_for_psa();
273+
#endif
244274
bool ret = !Harness::run(specification);
245275

246276
return ret;
247277
}
278+
279+
280+

TESTS/mbedmicro-rtos-mbed/mail/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ using namespace utest::v1;
3333
#define THREAD_STACK_SIZE 512
3434
#elif defined(__ARM_FM)
3535
#define THREAD_STACK_SIZE 512
36+
#elif defined(TARGET_FUTURE_SEQUANA_PSA)
37+
#define THREAD_STACK_SIZE 512
3638
#else
3739
#define THREAD_STACK_SIZE 320 /* larger stack cause out of heap memory on some 16kB RAM boards in multi thread test*/
3840
#endif

TESTS/mbedmicro-rtos-mbed/malloc/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ volatile bool thread_should_continue = true;
4141
#define THREAD_STACK_SIZE 512
4242
#elif defined(__ARM_FM)
4343
#define THREAD_STACK_SIZE 512
44+
#elif defined(TARGET_FUTURE_SEQUANA_PSA)
45+
#define THREAD_STACK_SIZE 512
4446
#else
4547
#define THREAD_STACK_SIZE 256
4648
#endif

TESTS/mbedmicro-rtos-mbed/threads/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
#define PARALLEL_THREAD_STACK_SIZE 512
3737
#elif defined(__ARM_FM)
3838
#define PARALLEL_THREAD_STACK_SIZE 512
39+
#elif defined(TARGET_FUTURE_SEQUANA_PSA)
40+
#define PARALLEL_THREAD_STACK_SIZE 512
3941
#else
4042
#define PARALLEL_THREAD_STACK_SIZE 384
4143
#endif

TESTS/mbedtls/selftest/main.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,32 @@ Case cases[] = {
8484
#endif /* MBEDTLS_SELF_TEST */
8585
};
8686

87+
#if (defined(MBEDTLS_ENTROPY_C) && defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))
88+
#include "crypto.h"
89+
#if !defined(MAX)
90+
#define MAX(a,b) (((a)>(b))?(a):(b))
91+
#endif
92+
93+
/* Calculating the minimum allowed entropy size in bytes */
94+
#define MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE \
95+
MAX(MBEDTLS_ENTROPY_MIN_PLATFORM, MBEDTLS_ENTROPY_BLOCK_SIZE)
96+
97+
void inject_entropy_for_psa()
98+
{
99+
if (psa_crypto_init() == PSA_ERROR_INSUFFICIENT_ENTROPY) {
100+
uint8_t seed[MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE] = {0};
101+
/* inject some a seed for test*/
102+
for (int i = 0; i < MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE; ++i) {
103+
seed[i] = i;
104+
}
105+
106+
/* don't really care if this succeed this is just to make crypto init pass*/
107+
mbedtls_psa_inject_entropy(seed, MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE);
108+
}
109+
}
110+
#endif // (defined(MBEDTLS_ENTROPY_C) && defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))
111+
112+
87113
utest::v1::status_t test_setup(const size_t num_cases)
88114
{
89115
GREENTEA_SETUP(120, "default_auto");
@@ -101,6 +127,11 @@ int main()
101127
return 1;
102128
}
103129
#endif
130+
131+
#if (defined(MBEDTLS_ENTROPY_C) && defined(TARGET_PSA) && defined(COMPONENT_PSA_SRV_IPC) && defined(MBEDTLS_PSA_CRYPTO_C))
132+
inject_entropy_for_psa();
133+
#endif
134+
104135
ret = (Harness::run(specification) ? 0 : 1);
105136
#if defined(MBEDTLS_PLATFORM_C)
106137
mbedtls_platform_teardown(NULL);

TESTS/psa/crypto_init/TARGET_FUTURE_SEQUANA_PSA/crypto_init.hex

Lines changed: 4566 additions & 0 deletions
Large diffs are not rendered by default.

TESTS/psa/entropy_inject/TARGET_FUTURE_SEQUANA_PSA/entropy_inject.hex

Lines changed: 4578 additions & 0 deletions
Large diffs are not rendered by default.

TESTS/psa/prot_internal_storage/TARGET_FUTURE_SEQUANA_PSA/prot_internal_storage.hex

Lines changed: 4578 additions & 0 deletions
Large diffs are not rendered by default.

TESTS/psa/spm_client/TARGET_FUTURE_SEQUANA_PSA/spm_client.hex

Lines changed: 4582 additions & 0 deletions
Large diffs are not rendered by default.

TESTS/psa/spm_server/TARGET_FUTURE_SEQUANA_PSA/spm_server.hex

Lines changed: 4682 additions & 0 deletions
Large diffs are not rendered by default.

TESTS/psa/spm_smoke/TARGET_FUTURE_SEQUANA_PSA/spm_smoke.hex

Lines changed: 4590 additions & 0 deletions
Large diffs are not rendered by default.

features/storage/kvstore/conf/mbed_lib.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"K64F": {
1515
"storage_type": "FILESYSTEM"
1616
},
17+
"FUTURE_SEQUANA_M0_PSA": {
18+
"storage_type": "TDB_INTERNAL"
19+
},
1720
"K66F": {
1821
"storage_type": "TDB_INTERNAL"
1922
}

features/storage/kvstore/conf/tdb_internal/mbed_lib.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,11 @@
99
"help": "If default, the base address is set to the first sector after the application code ends.",
1010
"value": "0"
1111
}
12+
},
13+
"target_overrides": {
14+
"FUTURE_SEQUANA_M0_PSA": {
15+
"internal_size": "0x8000",
16+
"internal_base_address": "0x10078000"
17+
}
1218
}
1319
}

features/storage/nvstore/mbed_lib.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@
4343
"area_1_size": 16384,
4444
"area_2_address": "0x1007C000",
4545
"area_2_size": 16384
46+
},
47+
"FUTURE_SEQUANA_PSA": {
48+
"enabled" : false
49+
},
50+
"FUTURE_SEQUANA_M0_PSA": {
51+
"enabled" : false
4652
}
4753
}
4854
}

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8C63XX/TARGET_MCU_PSOC6_M0/device/TOOLCHAIN_ARM_STD/cy8c6xx7_cm0plus.sct

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,22 @@
3030
;* SPDX-License-Identifier: Apache-2.0
3131
;******************************************************************************/
3232

33+
#if !defined(MBED_ROM_START)
34+
#define MBED_ROM_START 0x10000000
35+
#endif
36+
37+
#if !defined(MBED_ROM_SIZE)
38+
#define MBED_ROM_SIZE 0x80000
39+
#endif
40+
41+
#if !defined(MBED_RAM_START)
42+
#define MBED_RAM_START 0x08000000
43+
#endif
44+
45+
#if !defined(MBED_RAM_SIZE)
46+
#define MBED_RAM_SIZE 0x10000
47+
#endif
48+
3349
; The defines below describe the location and size of blocks of memory in the target.
3450
; Use these defines to specify the memory regions available for allocation.
3551

@@ -39,14 +55,14 @@
3955
; where 'xx' is the device group; for example, 'cy8c6xx7_cm4_dual.scat'.
4056
; RAM
4157
; RAM
42-
#define RAM_START 0x08000000
43-
#define RAM_SIZE 0x00010000
58+
#define RAM_START MBED_RAM_START
59+
#define RAM_SIZE MBED_RAM_SIZE
4460
; Flash
4561
; Flash
46-
#define FLASH_START 0x10000000
47-
#define FLASH_SIZE 0x00078000
62+
#define FLASH_START MBED_ROM_START
63+
#define FLASH_SIZE MBED_ROM_SIZE
4864

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

86102

87-
LR_IROM1 FLASH_START FLASH_SIZE
103+
LR_IROM1 FLASH_START (FLASH_SIZE - 0x8000)
88104
{
89105
.cy_app_header +0
90106
{

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8C63XX/TARGET_MCU_PSOC6_M0/device/TOOLCHAIN_GCC_ARM/cy8c6xx7_cm0plus.ld

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ SEARCH_DIR(.)
2828
GROUP(-lgcc -lc -lnosys)
2929
ENTRY(Reset_Handler)
3030

31+
#if !defined(MBED_ROM_START)
32+
#define MBED_ROM_START 0x10000000
33+
#endif
34+
35+
#if !defined(MBED_ROM_SIZE)
36+
#define MBED_ROM_SIZE 0x80000
37+
#endif
38+
39+
#if !defined(MBED_RAM_START)
40+
#define MBED_RAM_START 0x08000000
41+
#endif
42+
43+
#if !defined(MBED_RAM_SIZE)
44+
#define MBED_RAM_SIZE 0x10000
45+
#endif
3146

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

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

336-
351+
337352
/* Supervisory Flash: Table of Content # 2 Copy */
338353
.cy_rtoc_part2 :
339354
{

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8C63XX/TARGET_MCU_PSOC6_M0/device/TOOLCHAIN_IAR/cy8c6xx7_cm0plus.icf

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@
2929
/*-Specials-*/
3030
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
3131

32+
if (!isdefinedsymbol(MBED_ROM_START)) {
33+
define symbol MBED_ROM_START = 0x10000000;
34+
}
35+
36+
if (!isdefinedsymbol(MBED_ROM_SIZE)) {
37+
define symbol MBED_ROM_SIZE = 0x80000;
38+
}
39+
40+
if (!isdefinedsymbol(MBED_RAM_START)) {
41+
define symbol MBED_RAM_START = 0x08000000;
42+
}
43+
44+
if (!isdefinedsymbol(MBED_RAM_SIZE)) {
45+
define symbol MBED_RAM_SIZE = 0x10000;
46+
}
47+
3248
/* The symbols below define the location and size of blocks of memory in the target.
3349
* Use these symbols to specify the memory regions available for allocation.
3450
*/
@@ -39,11 +55,11 @@ define symbol __ICFEDIT_intvec_start__ = 0x00000000;
3955
* where 'xx' is the device group; for example, 'cy8c6xx7_cm4_dual.icf'.
4056
*/
4157
/* RAM */
42-
define symbol __ICFEDIT_region_IRAM1_start__ = 0x08000000;
43-
define symbol __ICFEDIT_region_IRAM1_end__ = 0x08010000;
58+
define symbol __ICFEDIT_region_IRAM1_start__ = MBED_RAM_START;
59+
define symbol __ICFEDIT_region_IRAM1_end__ = (MBED_RAM_START + MBED_RAM_SIZE);
4460
/* Flash */
45-
define symbol __ICFEDIT_region_IROM1_start__ = 0x10000000;
46-
define symbol __ICFEDIT_region_IROM1_end__ = 0x10078000;
61+
define symbol __ICFEDIT_region_IROM1_start__ = MBED_ROM_START;
62+
define symbol __ICFEDIT_region_IROM1_end__ = (MBED_ROM_START + MBED_ROM_SIZE - 0x8000);
4763

4864
/* The following symbols define a 32K flash region used for EEPROM emulation.
4965
* This region can also be used as the general purpose flash.

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8C63XX/TARGET_MCU_PSOC6_M0/system_psoc63_cm0plus.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ void mbed_sdk_init(void)
153153
ipcrpc_init();
154154
}
155155

156+
#if defined(COMPONENT_SPM_MAILBOX)
157+
void mailbox_init(void);
158+
#endif
156159

157160
/*******************************************************************************
158161
* Function Name: SystemInit
@@ -189,6 +192,10 @@ void SystemInit(void)
189192
Cy_SystemInit();
190193
SystemCoreClockUpdate();
191194

195+
#if defined(COMPONENT_SPM_MAILBOX)
196+
mailbox_init();
197+
#endif
198+
192199
#if defined(CY_DEVICE_PSOC6ABLE2)
193200
#if !defined(CY_IPC_DEFAULT_CFG_DISABLE)
194201
/* Allocate and initialize semaphores for the system operations. */

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8C63XX/TARGET_MCU_PSOC6_M4/device/TOOLCHAIN_ARM_STD/cy8c6xx7_cm4_dual.sct

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,22 @@
3030
;* SPDX-License-Identifier: Apache-2.0
3131
;******************************************************************************/
3232

33+
#if !defined(MBED_ROM_START)
34+
#define MBED_ROM_START 0x10080000
35+
#endif
36+
37+
#if !defined(MBED_ROM_SIZE)
38+
#define MBED_ROM_SIZE 0x78000
39+
#endif
40+
41+
#if !defined(MBED_RAM_START)
42+
#define MBED_RAM_START 0x08010000
43+
#endif
44+
45+
#if !defined(MBED_RAM_SIZE)
46+
#define MBED_RAM_SIZE 0x37800
47+
#endif
48+
3349
; The defines below describe the location and size of blocks of memory in the target.
3450
; Use these defines to specify the memory regions available for allocation.
3551

@@ -41,12 +57,12 @@
4157
; where 'xx' is the device group; for example, 'cy8c6xx7_cm0plus.scat'.
4258
; RAM
4359
; RAM
44-
#define RAM_START 0x08010000
45-
#define RAM_SIZE 0x00037800
60+
#define RAM_START MBED_RAM_START
61+
#define RAM_SIZE MBED_RAM_SIZE
4662
; Flash
4763
; Flash
48-
#define FLASH_START 0x10080000
49-
#define FLASH_SIZE 0x00078000
64+
#define FLASH_START MBED_ROM_START
65+
#define FLASH_SIZE MBED_ROM_SIZE
5066

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

0 commit comments

Comments
 (0)