Merge pull request #11685 from jainvikas8/IOTSEC-1246

Check-in PSA related auto-generated files to support online compiler.
pull/11844/head
Martin Kojtal 2019-11-11 18:22:19 +01:00 committed by GitHub
commit 78d26a7d05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 2065 additions and 52 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
/* Copyright (c) 2017-2019 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 License.
*/
/*******************************************************************************
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT.
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* Template Version 1.0
* Generated by tools/psa/generate_partition_code.py Version 1.1
******************************************************************************/
#ifndef __TFM_PARTITION_DEFS_INC__
#define __TFM_PARTITION_DEFS_INC__
/*************************** Service Partitions *******************************/
#define ATTEST_SRV_ID (TFM_SP_BASE + 0)
#define CRYPTO_SRV_ID (TFM_SP_BASE + 1)
#define PLATFORM_ID (TFM_SP_BASE + 2)
#define ITS_ID (TFM_SP_BASE + 3)
/*************************** Test Partitions **********************************/
#ifdef USE_PSA_TEST_PARTITIONS
#ifdef USE_CRYPTO_ACL_TEST
#define CRYPTO_ACL_TEST_ID (TFM_SP_BASE + 4 + 0)
#endif
#ifdef USE_CLIENT_TESTS_PART1
#define CLIENT_TESTS_PART1_ID (TFM_SP_BASE + 4 + 1)
#endif
#ifdef USE_SERVER_TESTS_PART1
#define SERVER_TESTS_PART1_ID (TFM_SP_BASE + 4 + 2)
#endif
#ifdef USE_SERVER_TESTS_PART2
#define SERVER_TESTS_PART2_ID (TFM_SP_BASE + 4 + 3)
#endif
#ifdef USE_SMOKE_TESTS_PART1
#define SMOKE_TESTS_PART1_ID (TFM_SP_BASE + 4 + 4)
#endif
#endif // USE_PSA_TEST_PARTITIONS
#ifdef USE_PSA_TEST_PARTITIONS
#define TFM_MAX_USER_PARTITIONS (4 + 5)
#else
#define TFM_MAX_USER_PARTITIONS (4)
#endif
#endif // __TFM_PARTITION_DEFS_INC__

View File

@ -0,0 +1,107 @@
/*
* Copyright (c) 2018-2019, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
/*******************************************************************************
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT.
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* Template Version 1.0
* Generated by tools/psa/generate_partition_code.py Version 1.1
******************************************************************************/
#ifndef __TFM_PARTITION_LIST_INC__
#define __TFM_PARTITION_LIST_INC__
/*************************** Service Partitions *******************************/
/* -----------------------------------------------------------------------------
* ATTEST_SRV
* -------------------------------------------------------------------------- */
PARTITION_DECLARE(ATTEST_SRV, 0
| SPM_PART_FLAG_IPC
, "APPLICATION-ROT", 37, NORMAL, 8192);
PARTITION_ADD_INIT_FUNC(ATTEST_SRV, attest_main);
/* -----------------------------------------------------------------------------
* CRYPTO_SRV
* -------------------------------------------------------------------------- */
PARTITION_DECLARE(CRYPTO_SRV, 0
| SPM_PART_FLAG_IPC
, "APPLICATION-ROT", 35, NORMAL, 16384);
PARTITION_ADD_INIT_FUNC(CRYPTO_SRV, crypto_main);
/* -----------------------------------------------------------------------------
* PLATFORM
* -------------------------------------------------------------------------- */
PARTITION_DECLARE(PLATFORM, 0
| SPM_PART_FLAG_IPC
, "APPLICATION-ROT", 8, NORMAL, 1024);
PARTITION_ADD_INIT_FUNC(PLATFORM, platform_partition_entry);
/* -----------------------------------------------------------------------------
* ITS
* -------------------------------------------------------------------------- */
PARTITION_DECLARE(ITS, 0
| SPM_PART_FLAG_IPC
, "APPLICATION-ROT", 10, NORMAL, 2048);
PARTITION_ADD_INIT_FUNC(ITS, its_entry);
/*************************** Test Partitions **********************************/
#ifdef USE_PSA_TEST_PARTITIONS
#ifdef USE_CRYPTO_ACL_TEST
/* -----------------------------------------------------------------------------
* CRYPTO_ACL_TEST
* -------------------------------------------------------------------------- */
PARTITION_DECLARE(CRYPTO_ACL_TEST, 0
| SPM_PART_FLAG_IPC
, "APPLICATION-ROT", 128, NORMAL, 512);
PARTITION_ADD_INIT_FUNC(CRYPTO_ACL_TEST, test_partition_main);
#endif // USE_CRYPTO_ACL_TEST
#ifdef USE_CLIENT_TESTS_PART1
/* -----------------------------------------------------------------------------
* CLIENT_TESTS_PART1
* -------------------------------------------------------------------------- */
PARTITION_DECLARE(CLIENT_TESTS_PART1, 0
| SPM_PART_FLAG_IPC
, "APPLICATION-ROT", 1, NORMAL, 1024);
PARTITION_ADD_INIT_FUNC(CLIENT_TESTS_PART1, client_part_main);
#endif // USE_CLIENT_TESTS_PART1
#ifdef USE_SERVER_TESTS_PART1
/* -----------------------------------------------------------------------------
* SERVER_TESTS_PART1
* -------------------------------------------------------------------------- */
PARTITION_DECLARE(SERVER_TESTS_PART1, 0
| SPM_PART_FLAG_IPC
, "APPLICATION-ROT", 2, NORMAL, 1024);
PARTITION_ADD_INIT_FUNC(SERVER_TESTS_PART1, server_part1_main);
#endif // USE_SERVER_TESTS_PART1
#ifdef USE_SERVER_TESTS_PART2
/* -----------------------------------------------------------------------------
* SERVER_TESTS_PART2
* -------------------------------------------------------------------------- */
PARTITION_DECLARE(SERVER_TESTS_PART2, 0
| SPM_PART_FLAG_IPC
, "APPLICATION-ROT", 3, NORMAL, 1024);
PARTITION_ADD_INIT_FUNC(SERVER_TESTS_PART2, server_part2_main);
#endif // USE_SERVER_TESTS_PART2
#ifdef USE_SMOKE_TESTS_PART1
/* -----------------------------------------------------------------------------
* SMOKE_TESTS_PART1
* -------------------------------------------------------------------------- */
PARTITION_DECLARE(SMOKE_TESTS_PART1, 0
| SPM_PART_FLAG_IPC
, "APPLICATION-ROT", 4, NORMAL, 512);
PARTITION_ADD_INIT_FUNC(SMOKE_TESTS_PART1, smoke_part_main);
#endif // USE_SMOKE_TESTS_PART1
#endif // USE_PSA_TEST_PARTITIONS
#endif // __TFM_PARTITION_LIST_INC__

View File

@ -0,0 +1,107 @@
/*
* Copyright (c) 2018-2019, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
/*******************************************************************************
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT.
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* Template Version 1.0
* Generated by tools/psa/generate_partition_code.py Version 1.1
******************************************************************************/
#ifndef __TFM_SERVICE_LIST_INC__
#define __TFM_SERVICE_LIST_INC__
/*************************** Service Partitions *******************************/
/* -----------------------------------------------------------------------------
* ATTEST_SRV Services
* -------------------------------------------------------------------------- */
{"PSA_ATTEST_GET_TOKEN_ID", ATTEST_SRV_ID, PSA_ATTEST_GET_TOKEN, 0x00000F10, true, 1, TFM_VERSION_POLICY_STRICT},
{"PSA_ATTEST_GET_TOKEN_SIZE_ID", ATTEST_SRV_ID, PSA_ATTEST_GET_TOKEN_SIZE, 0x00000F11, true, 1, TFM_VERSION_POLICY_STRICT},
{"PSA_ATTEST_INJECT_KEY_ID", ATTEST_SRV_ID, PSA_ATTEST_INJECT_KEY, 0x00000F12, true, 1, TFM_VERSION_POLICY_STRICT},
/* -----------------------------------------------------------------------------
* CRYPTO_SRV Services
* -------------------------------------------------------------------------- */
{"PSA_CRYPTO_INIT_ID", CRYPTO_SRV_ID, PSA_CRYPTO_INIT, 0x00000F00, true, 1, TFM_VERSION_POLICY_STRICT},
{"PSA_MAC_ID", CRYPTO_SRV_ID, PSA_MAC, 0x00000F01, true, 1, TFM_VERSION_POLICY_STRICT},
{"PSA_HASH_ID", CRYPTO_SRV_ID, PSA_HASH, 0x00000F02, true, 1, TFM_VERSION_POLICY_STRICT},
{"PSA_ASYMMETRIC_ID", CRYPTO_SRV_ID, PSA_ASYMMETRIC, 0x00000F03, true, 1, TFM_VERSION_POLICY_STRICT},
{"PSA_SYMMETRIC_ID", CRYPTO_SRV_ID, PSA_SYMMETRIC, 0x00000F04, true, 1, TFM_VERSION_POLICY_STRICT},
{"PSA_AEAD_ID", CRYPTO_SRV_ID, PSA_AEAD, 0x00000F05, true, 1, TFM_VERSION_POLICY_STRICT},
{"PSA_KEY_MNG_ID", CRYPTO_SRV_ID, PSA_KEY_MNG, 0x00000F06, true, 1, TFM_VERSION_POLICY_STRICT},
{"PSA_RNG_ID", CRYPTO_SRV_ID, PSA_RNG, 0x00000F07, true, 1, TFM_VERSION_POLICY_STRICT},
{"PSA_CRYPTO_FREE_ID", CRYPTO_SRV_ID, PSA_CRYPTO_FREE, 0x00000F08, true, 1, TFM_VERSION_POLICY_STRICT},
{"PSA_KEY_DERIVATION_ID", CRYPTO_SRV_ID, PSA_KEY_DERIVATION, 0x00000F09, true, 1, TFM_VERSION_POLICY_STRICT},
{"PSA_ENTROPY_ID", CRYPTO_SRV_ID, PSA_ENTROPY_INJECT, 0x00000F0A, true, 1, TFM_VERSION_POLICY_STRICT},
/* -----------------------------------------------------------------------------
* PLATFORM Services
* -------------------------------------------------------------------------- */
{"PSA_PLATFORM_LC_GET", PLATFORM_ID, PSA_PLATFORM_LC_GET_MSK, 0x00011000, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_PLATFORM_LC_SET", PLATFORM_ID, PSA_PLATFORM_LC_SET_MSK, 0x00011001, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_PLATFORM_SYSTEM_RESET", PLATFORM_ID, PSA_PLATFORM_SYSTEM_RESET_MSK, 0x00011002, true, 1, TFM_VERSION_POLICY_RELAXED},
/* -----------------------------------------------------------------------------
* ITS Services
* -------------------------------------------------------------------------- */
{"PSA_ITS_GET", ITS_ID, PSA_ITS_GET_MSK, 0x00011A00, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_ITS_SET", ITS_ID, PSA_ITS_SET_MSK, 0x00011A01, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_ITS_INFO", ITS_ID, PSA_ITS_INFO_MSK, 0x00011A02, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_ITS_REMOVE", ITS_ID, PSA_ITS_REMOVE_MSK, 0x00011A03, true, 1, TFM_VERSION_POLICY_RELAXED},
{"PSA_ITS_RESET", ITS_ID, PSA_ITS_RESET_MSK, 0x00011A04, false, 1, TFM_VERSION_POLICY_RELAXED},
/*************************** Test Partitions **********************************/
#ifdef USE_PSA_TEST_PARTITIONS
#ifdef USE_CRYPTO_ACL_TEST
/* -----------------------------------------------------------------------------
* CRYPTO_ACL_TEST Services
* -------------------------------------------------------------------------- */
{"CRYPTO_GENERATE_KEY", CRYPTO_ACL_TEST_ID, CRYPTO_GENERATE_KEY_MSK, 0x00000201, true, 1, TFM_VERSION_POLICY_RELAXED},
{"CRYPTO_OPEN_KEY", CRYPTO_ACL_TEST_ID, CRYPTO_OPEN_KEY_MSK, 0x00000202, true, 1, TFM_VERSION_POLICY_RELAXED},
{"CRYPTO_CLOSE_KEY", CRYPTO_ACL_TEST_ID, CRYPTO_CLOSE_KEY_MSK, 0x00000203, true, 1, TFM_VERSION_POLICY_RELAXED},
{"CRYPTO_DESTROY_KEY", CRYPTO_ACL_TEST_ID, CRYPTO_DESTROY_KEY_MSK, 0x00000205, true, 1, TFM_VERSION_POLICY_RELAXED},
{"CRYPTO_GET_KEY_ATTRIBUTES", CRYPTO_ACL_TEST_ID, CRYPTO_GET_KEY_ATTRIBUTES_MSK, 0x00000206, true, 1, TFM_VERSION_POLICY_RELAXED},
{"CRYPTO_IMPORT_KEY", CRYPTO_ACL_TEST_ID, CRYPTO_IMPORT_KEY_MSK, 0x00000208, true, 1, TFM_VERSION_POLICY_RELAXED},
#endif // USE_CRYPTO_ACL_TEST
#ifdef USE_CLIENT_TESTS_PART1
/* -----------------------------------------------------------------------------
* CLIENT_TESTS_PART1 Services
* -------------------------------------------------------------------------- */
{"CLIENT_TESTS_PART1_ROT_SRV1", CLIENT_TESTS_PART1_ID, PART1_ROT_SRV1_MSK, 0x00001A05, true, 5, TFM_VERSION_POLICY_RELAXED},
{"CLIENT_TESTS_PART1_DROP_CONN", CLIENT_TESTS_PART1_ID, DROP_CONN_MSK, 0x00001A06, true, 5, TFM_VERSION_POLICY_RELAXED},
{"CLIENT_TESTS_PART1_SECURE_CLIENTS_ONLY", CLIENT_TESTS_PART1_ID, SECURE_CLIENTS_ONLY_MSK, 0x00001A07, false, 5, TFM_VERSION_POLICY_RELAXED},
#endif // USE_CLIENT_TESTS_PART1
#ifdef USE_SERVER_TESTS_PART1
/* -----------------------------------------------------------------------------
* SERVER_TESTS_PART1 Services
* -------------------------------------------------------------------------- */
{"SERVER_TESTS_PART1_CONTROL", SERVER_TESTS_PART1_ID, CONTROL_MSK, 0x00001A01, true, 5, TFM_VERSION_POLICY_RELAXED},
{"SERVER_TESTS_PART1_TEST", SERVER_TESTS_PART1_ID, TEST_MSK, 0x00001A02, true, 12, TFM_VERSION_POLICY_STRICT},
#endif // USE_SERVER_TESTS_PART1
#ifdef USE_SERVER_TESTS_PART2
/* -----------------------------------------------------------------------------
* SERVER_TESTS_PART2 Services
* -------------------------------------------------------------------------- */
{"SERVER_TESTS_PART2_ROT_SRV_REVERSE", SERVER_TESTS_PART2_ID, ROT_SRV_REVERSE_MSK, 0x00001A03, false, 5, TFM_VERSION_POLICY_STRICT},
{"SERVER_TESTS_PART2_ROT_SRV_DB_TST", SERVER_TESTS_PART2_ID, ROT_SRV_DB_TST_MSK, 0x00001A04, false, 5, TFM_VERSION_POLICY_STRICT},
#endif // USE_SERVER_TESTS_PART2
#ifdef USE_SMOKE_TESTS_PART1
/* -----------------------------------------------------------------------------
* SMOKE_TESTS_PART1 Services
* -------------------------------------------------------------------------- */
{"SMOKE_TESTS_PART1_ROT_SRV1", SMOKE_TESTS_PART1_ID, ROT_SRV1_MSK, 0x00001A00, true, 5, TFM_VERSION_POLICY_RELAXED},
#endif // USE_SMOKE_TESTS_PART1
#endif // USE_PSA_TEST_PARTITIONS
#endif // __TFM_SERVICE_LIST_INC__

View File

@ -0,0 +1,143 @@
/*
* Copyright (c) 2018-2019, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
/*******************************************************************************
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT.
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* Template Version 1.0
* Generated by tools/psa/generate_partition_code.py Version 1.1
******************************************************************************/
#ifndef __TFM_SPM_SIGNAL_DEFS_H__
#define __TFM_SPM_SIGNAL_DEFS_H__
/*************************** Service Partitions *******************************/
/* -----------------------------------------------------------------------------
* ATTEST_SRV Signals
* -------------------------------------------------------------------------- */
#define PSA_ATTEST_GET_TOKEN_POS (4UL)
#define PSA_ATTEST_GET_TOKEN (1UL << PSA_ATTEST_GET_TOKEN_POS)
#define PSA_ATTEST_GET_TOKEN_SIZE_POS (5UL)
#define PSA_ATTEST_GET_TOKEN_SIZE (1UL << PSA_ATTEST_GET_TOKEN_SIZE_POS)
#define PSA_ATTEST_INJECT_KEY_POS (6UL)
#define PSA_ATTEST_INJECT_KEY (1UL << PSA_ATTEST_INJECT_KEY_POS)
/* -----------------------------------------------------------------------------
* CRYPTO_SRV Signals
* -------------------------------------------------------------------------- */
#define PSA_CRYPTO_INIT_POS (4UL)
#define PSA_CRYPTO_INIT (1UL << PSA_CRYPTO_INIT_POS)
#define PSA_MAC_POS (5UL)
#define PSA_MAC (1UL << PSA_MAC_POS)
#define PSA_HASH_POS (6UL)
#define PSA_HASH (1UL << PSA_HASH_POS)
#define PSA_ASYMMETRIC_POS (7UL)
#define PSA_ASYMMETRIC (1UL << PSA_ASYMMETRIC_POS)
#define PSA_SYMMETRIC_POS (8UL)
#define PSA_SYMMETRIC (1UL << PSA_SYMMETRIC_POS)
#define PSA_AEAD_POS (9UL)
#define PSA_AEAD (1UL << PSA_AEAD_POS)
#define PSA_KEY_MNG_POS (10UL)
#define PSA_KEY_MNG (1UL << PSA_KEY_MNG_POS)
#define PSA_RNG_POS (11UL)
#define PSA_RNG (1UL << PSA_RNG_POS)
#define PSA_CRYPTO_FREE_POS (12UL)
#define PSA_CRYPTO_FREE (1UL << PSA_CRYPTO_FREE_POS)
#define PSA_KEY_DERIVATION_POS (13UL)
#define PSA_KEY_DERIVATION (1UL << PSA_KEY_DERIVATION_POS)
#define PSA_ENTROPY_INJECT_POS (14UL)
#define PSA_ENTROPY_INJECT (1UL << PSA_ENTROPY_INJECT_POS)
/* -----------------------------------------------------------------------------
* PLATFORM Signals
* -------------------------------------------------------------------------- */
#define PSA_PLATFORM_LC_GET_MSK_POS (4UL)
#define PSA_PLATFORM_LC_GET_MSK (1UL << PSA_PLATFORM_LC_GET_MSK_POS)
#define PSA_PLATFORM_LC_SET_MSK_POS (5UL)
#define PSA_PLATFORM_LC_SET_MSK (1UL << PSA_PLATFORM_LC_SET_MSK_POS)
#define PSA_PLATFORM_SYSTEM_RESET_MSK_POS (6UL)
#define PSA_PLATFORM_SYSTEM_RESET_MSK (1UL << PSA_PLATFORM_SYSTEM_RESET_MSK_POS)
/* -----------------------------------------------------------------------------
* ITS Signals
* -------------------------------------------------------------------------- */
#define PSA_ITS_GET_MSK_POS (4UL)
#define PSA_ITS_GET_MSK (1UL << PSA_ITS_GET_MSK_POS)
#define PSA_ITS_SET_MSK_POS (5UL)
#define PSA_ITS_SET_MSK (1UL << PSA_ITS_SET_MSK_POS)
#define PSA_ITS_INFO_MSK_POS (6UL)
#define PSA_ITS_INFO_MSK (1UL << PSA_ITS_INFO_MSK_POS)
#define PSA_ITS_REMOVE_MSK_POS (7UL)
#define PSA_ITS_REMOVE_MSK (1UL << PSA_ITS_REMOVE_MSK_POS)
#define PSA_ITS_RESET_MSK_POS (8UL)
#define PSA_ITS_RESET_MSK (1UL << PSA_ITS_RESET_MSK_POS)
/*************************** Test Partitions **********************************/
#ifdef USE_PSA_TEST_PARTITIONS
#ifdef USE_CRYPTO_ACL_TEST
/* -----------------------------------------------------------------------------
* CRYPTO_ACL_TEST Signals
* -------------------------------------------------------------------------- */
#define CRYPTO_GENERATE_KEY_MSK_POS (4UL)
#define CRYPTO_GENERATE_KEY_MSK (1UL << CRYPTO_GENERATE_KEY_MSK_POS)
#define CRYPTO_OPEN_KEY_MSK_POS (5UL)
#define CRYPTO_OPEN_KEY_MSK (1UL << CRYPTO_OPEN_KEY_MSK_POS)
#define CRYPTO_CLOSE_KEY_MSK_POS (6UL)
#define CRYPTO_CLOSE_KEY_MSK (1UL << CRYPTO_CLOSE_KEY_MSK_POS)
#define CRYPTO_DESTROY_KEY_MSK_POS (7UL)
#define CRYPTO_DESTROY_KEY_MSK (1UL << CRYPTO_DESTROY_KEY_MSK_POS)
#define CRYPTO_GET_KEY_ATTRIBUTES_MSK_POS (8UL)
#define CRYPTO_GET_KEY_ATTRIBUTES_MSK (1UL << CRYPTO_GET_KEY_ATTRIBUTES_MSK_POS)
#define CRYPTO_IMPORT_KEY_MSK_POS (9UL)
#define CRYPTO_IMPORT_KEY_MSK (1UL << CRYPTO_IMPORT_KEY_MSK_POS)
#endif // USE_CRYPTO_ACL_TEST
#ifdef USE_CLIENT_TESTS_PART1
/* -----------------------------------------------------------------------------
* CLIENT_TESTS_PART1 Signals
* -------------------------------------------------------------------------- */
#define PART1_ROT_SRV1_MSK_POS (4UL)
#define PART1_ROT_SRV1_MSK (1UL << PART1_ROT_SRV1_MSK_POS)
#define DROP_CONN_MSK_POS (5UL)
#define DROP_CONN_MSK (1UL << DROP_CONN_MSK_POS)
#define SECURE_CLIENTS_ONLY_MSK_POS (6UL)
#define SECURE_CLIENTS_ONLY_MSK (1UL << SECURE_CLIENTS_ONLY_MSK_POS)
#endif // USE_CLIENT_TESTS_PART1
#ifdef USE_SERVER_TESTS_PART1
/* -----------------------------------------------------------------------------
* SERVER_TESTS_PART1 Signals
* -------------------------------------------------------------------------- */
#define CONTROL_MSK_POS (4UL)
#define CONTROL_MSK (1UL << CONTROL_MSK_POS)
#define TEST_MSK_POS (5UL)
#define TEST_MSK (1UL << TEST_MSK_POS)
#endif // USE_SERVER_TESTS_PART1
#ifdef USE_SERVER_TESTS_PART2
/* -----------------------------------------------------------------------------
* SERVER_TESTS_PART2 Signals
* -------------------------------------------------------------------------- */
#define ROT_SRV_REVERSE_MSK_POS (4UL)
#define ROT_SRV_REVERSE_MSK (1UL << ROT_SRV_REVERSE_MSK_POS)
#define ROT_SRV_DB_TST_MSK_POS (5UL)
#define ROT_SRV_DB_TST_MSK (1UL << ROT_SRV_DB_TST_MSK_POS)
#endif // USE_SERVER_TESTS_PART2
#ifdef USE_SMOKE_TESTS_PART1
/* -----------------------------------------------------------------------------
* SMOKE_TESTS_PART1 Signals
* -------------------------------------------------------------------------- */
#define ROT_SRV1_MSK_POS (4UL)
#define ROT_SRV1_MSK (1UL << ROT_SRV1_MSK_POS)
#endif // USE_SMOKE_TESTS_PART1
#endif // USE_PSA_TEST_PARTITIONS
#endif // __TFM_SPM_SIGNAL_DEFS_H__

View File

@ -0,0 +1,110 @@
/* Copyright (c) 2019 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 License.
*/
/*******************************************************************************
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT.
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* Template Version 1.0
* Generated by tools/psa/generate_partition_code.py Version 1.1
******************************************************************************/
/****************** Service Partitions ****************************************/
/* -----------------------------------------------------------------------------
* ATTEST_SRV Service IDs
* -------------------------------------------------------------------------- */
#define PSA_ATTEST_GET_TOKEN_ID 0x00000F10
#define PSA_ATTEST_GET_TOKEN_SIZE_ID 0x00000F11
#define PSA_ATTEST_INJECT_KEY_ID 0x00000F12
/* -----------------------------------------------------------------------------
* CRYPTO_SRV Service IDs
* -------------------------------------------------------------------------- */
#define PSA_CRYPTO_INIT_ID 0x00000F00
#define PSA_MAC_ID 0x00000F01
#define PSA_HASH_ID 0x00000F02
#define PSA_ASYMMETRIC_ID 0x00000F03
#define PSA_SYMMETRIC_ID 0x00000F04
#define PSA_AEAD_ID 0x00000F05
#define PSA_KEY_MNG_ID 0x00000F06
#define PSA_RNG_ID 0x00000F07
#define PSA_CRYPTO_FREE_ID 0x00000F08
#define PSA_KEY_DERIVATION_ID 0x00000F09
#define PSA_ENTROPY_ID 0x00000F0A
/* -----------------------------------------------------------------------------
* PLATFORM Service IDs
* -------------------------------------------------------------------------- */
#define PSA_PLATFORM_LC_GET 0x00011000
#define PSA_PLATFORM_LC_SET 0x00011001
#define PSA_PLATFORM_SYSTEM_RESET 0x00011002
/* -----------------------------------------------------------------------------
* ITS Service IDs
* -------------------------------------------------------------------------- */
#define PSA_ITS_GET 0x00011A00
#define PSA_ITS_SET 0x00011A01
#define PSA_ITS_INFO 0x00011A02
#define PSA_ITS_REMOVE 0x00011A03
#define PSA_ITS_RESET 0x00011A04
/****************** Test Partitions *******************************************/
/* -----------------------------------------------------------------------------
* CRYPTO_ACL_TEST Service IDs
* -------------------------------------------------------------------------- */
#define CRYPTO_GENERATE_KEY 0x00000201
#define CRYPTO_OPEN_KEY 0x00000202
#define CRYPTO_CLOSE_KEY 0x00000203
#define CRYPTO_DESTROY_KEY 0x00000205
#define CRYPTO_GET_KEY_ATTRIBUTES 0x00000206
#define CRYPTO_IMPORT_KEY 0x00000208
/* -----------------------------------------------------------------------------
* CLIENT_TESTS_PART1 Service IDs
* -------------------------------------------------------------------------- */
#define CLIENT_TESTS_PART1_ROT_SRV1 0x00001A05
#define CLIENT_TESTS_PART1_DROP_CONN 0x00001A06
#define CLIENT_TESTS_PART1_SECURE_CLIENTS_ONLY 0x00001A07
/* -----------------------------------------------------------------------------
* SERVER_TESTS_PART1 Service IDs
* -------------------------------------------------------------------------- */
#define SERVER_TESTS_PART1_CONTROL 0x00001A01
#define SERVER_TESTS_PART1_TEST 0x00001A02
/* -----------------------------------------------------------------------------
* SERVER_TESTS_PART2 Service IDs
* -------------------------------------------------------------------------- */
#define SERVER_TESTS_PART2_ROT_SRV_REVERSE 0x00001A03
#define SERVER_TESTS_PART2_ROT_SRV_DB_TST 0x00001A04
/* -----------------------------------------------------------------------------
* SMOKE_TESTS_PART1 Service IDs
* -------------------------------------------------------------------------- */
#define SMOKE_TESTS_PART1_ROT_SRV1 0x00001A00

View File

@ -0,0 +1,307 @@
/* Copyright (c) 2017-2019 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 License.
*/
/*******************************************************************************
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* THIS FILE IS AN AUTO-GENERATED FILE - DO NOT MODIFY IT.
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* Template Version 1.0
* Generated by tools/psa/generate_partition_code.py Version 1.1
******************************************************************************/
#ifndef __MBED_SPM_PARTITIONS_H___
#define __MBED_SPM_PARTITIONS_H___
/****************** Common definitions ****************************************/
/* PSA reserved event flags */
#define PSA_RESERVED1_POS (1UL)
#define PSA_RESERVED1_MSK (1UL << PSA_RESERVED1_POS)
#define PSA_RESERVED2_POS (2UL)
#define PSA_RESERVED2_MSK (1UL << PSA_RESERVED2_POS)
/****************** Service Partitions ****************************************/
/* -----------------------------------------------------------------------------
* ATTEST_SRV defines
* -------------------------------------------------------------------------- */
#define ATTEST_SRV_ID 37
#define ATTEST_SRV_ROT_SRV_COUNT (3UL)
#define ATTEST_SRV_EXT_ROT_SRV_COUNT (7UL)
#define ATTEST_SRV_WAIT_ANY_IRQ_MSK (0)
#define PSA_ATTEST_GET_TOKEN_POS (4UL)
#define PSA_ATTEST_GET_TOKEN (1UL << PSA_ATTEST_GET_TOKEN_POS)
#define PSA_ATTEST_GET_TOKEN_SIZE_POS (5UL)
#define PSA_ATTEST_GET_TOKEN_SIZE (1UL << PSA_ATTEST_GET_TOKEN_SIZE_POS)
#define PSA_ATTEST_INJECT_KEY_POS (6UL)
#define PSA_ATTEST_INJECT_KEY (1UL << PSA_ATTEST_INJECT_KEY_POS)
#define ATTEST_SRV_WAIT_ANY_SID_MSK (\
PSA_ATTEST_GET_TOKEN | \
PSA_ATTEST_GET_TOKEN_SIZE | \
PSA_ATTEST_INJECT_KEY)
/* -----------------------------------------------------------------------------
* CRYPTO_SRV defines
* -------------------------------------------------------------------------- */
#define CRYPTO_SRV_ID 35
#define CRYPTO_SRV_ROT_SRV_COUNT (11UL)
#define CRYPTO_SRV_EXT_ROT_SRV_COUNT (4UL)
#define CRYPTO_SRV_WAIT_ANY_IRQ_MSK (0)
#define PSA_CRYPTO_INIT_POS (4UL)
#define PSA_CRYPTO_INIT (1UL << PSA_CRYPTO_INIT_POS)
#define PSA_MAC_POS (5UL)
#define PSA_MAC (1UL << PSA_MAC_POS)
#define PSA_HASH_POS (6UL)
#define PSA_HASH (1UL << PSA_HASH_POS)
#define PSA_ASYMMETRIC_POS (7UL)
#define PSA_ASYMMETRIC (1UL << PSA_ASYMMETRIC_POS)
#define PSA_SYMMETRIC_POS (8UL)
#define PSA_SYMMETRIC (1UL << PSA_SYMMETRIC_POS)
#define PSA_AEAD_POS (9UL)
#define PSA_AEAD (1UL << PSA_AEAD_POS)
#define PSA_KEY_MNG_POS (10UL)
#define PSA_KEY_MNG (1UL << PSA_KEY_MNG_POS)
#define PSA_RNG_POS (11UL)
#define PSA_RNG (1UL << PSA_RNG_POS)
#define PSA_CRYPTO_FREE_POS (12UL)
#define PSA_CRYPTO_FREE (1UL << PSA_CRYPTO_FREE_POS)
#define PSA_KEY_DERIVATION_POS (13UL)
#define PSA_KEY_DERIVATION (1UL << PSA_KEY_DERIVATION_POS)
#define PSA_ENTROPY_INJECT_POS (14UL)
#define PSA_ENTROPY_INJECT (1UL << PSA_ENTROPY_INJECT_POS)
#define CRYPTO_SRV_WAIT_ANY_SID_MSK (\
PSA_CRYPTO_INIT | \
PSA_MAC | \
PSA_HASH | \
PSA_ASYMMETRIC | \
PSA_SYMMETRIC | \
PSA_AEAD | \
PSA_KEY_MNG | \
PSA_RNG | \
PSA_CRYPTO_FREE | \
PSA_KEY_DERIVATION | \
PSA_ENTROPY_INJECT)
/* -----------------------------------------------------------------------------
* PLATFORM defines
* -------------------------------------------------------------------------- */
#define PLATFORM_ID 8
#define PLATFORM_ROT_SRV_COUNT (3UL)
#define PLATFORM_EXT_ROT_SRV_COUNT (1UL)
#define PLATFORM_WAIT_ANY_IRQ_MSK (0)
#define PSA_PLATFORM_LC_GET_MSK_POS (4UL)
#define PSA_PLATFORM_LC_GET_MSK (1UL << PSA_PLATFORM_LC_GET_MSK_POS)
#define PSA_PLATFORM_LC_SET_MSK_POS (5UL)
#define PSA_PLATFORM_LC_SET_MSK (1UL << PSA_PLATFORM_LC_SET_MSK_POS)
#define PSA_PLATFORM_SYSTEM_RESET_MSK_POS (6UL)
#define PSA_PLATFORM_SYSTEM_RESET_MSK (1UL << PSA_PLATFORM_SYSTEM_RESET_MSK_POS)
#define PLATFORM_WAIT_ANY_SID_MSK (\
PSA_PLATFORM_LC_GET_MSK | \
PSA_PLATFORM_LC_SET_MSK | \
PSA_PLATFORM_SYSTEM_RESET_MSK)
/* -----------------------------------------------------------------------------
* ITS defines
* -------------------------------------------------------------------------- */
#define ITS_ID 10
#define ITS_ROT_SRV_COUNT (5UL)
#define ITS_EXT_ROT_SRV_COUNT (0UL)
#define ITS_WAIT_ANY_IRQ_MSK (0)
#define PSA_ITS_GET_MSK_POS (4UL)
#define PSA_ITS_GET_MSK (1UL << PSA_ITS_GET_MSK_POS)
#define PSA_ITS_SET_MSK_POS (5UL)
#define PSA_ITS_SET_MSK (1UL << PSA_ITS_SET_MSK_POS)
#define PSA_ITS_INFO_MSK_POS (6UL)
#define PSA_ITS_INFO_MSK (1UL << PSA_ITS_INFO_MSK_POS)
#define PSA_ITS_REMOVE_MSK_POS (7UL)
#define PSA_ITS_REMOVE_MSK (1UL << PSA_ITS_REMOVE_MSK_POS)
#define PSA_ITS_RESET_MSK_POS (8UL)
#define PSA_ITS_RESET_MSK (1UL << PSA_ITS_RESET_MSK_POS)
#define ITS_WAIT_ANY_SID_MSK (\
PSA_ITS_GET_MSK | \
PSA_ITS_SET_MSK | \
PSA_ITS_INFO_MSK | \
PSA_ITS_REMOVE_MSK | \
PSA_ITS_RESET_MSK)
/****************** Test Partitions *******************************************/
#ifdef USE_PSA_TEST_PARTITIONS
#ifdef USE_CRYPTO_ACL_TEST
/* -----------------------------------------------------------------------------
* CRYPTO_ACL_TEST defines
* -------------------------------------------------------------------------- */
#define CRYPTO_ACL_TEST_ID 128
#define CRYPTO_ACL_TEST_ROT_SRV_COUNT (6UL)
#define CRYPTO_ACL_TEST_EXT_ROT_SRV_COUNT (1UL)
#define CRYPTO_ACL_TEST_WAIT_ANY_IRQ_MSK (0)
#define CRYPTO_GENERATE_KEY_MSK_POS (4UL)
#define CRYPTO_GENERATE_KEY_MSK (1UL << CRYPTO_GENERATE_KEY_MSK_POS)
#define CRYPTO_OPEN_KEY_MSK_POS (5UL)
#define CRYPTO_OPEN_KEY_MSK (1UL << CRYPTO_OPEN_KEY_MSK_POS)
#define CRYPTO_CLOSE_KEY_MSK_POS (6UL)
#define CRYPTO_CLOSE_KEY_MSK (1UL << CRYPTO_CLOSE_KEY_MSK_POS)
#define CRYPTO_DESTROY_KEY_MSK_POS (7UL)
#define CRYPTO_DESTROY_KEY_MSK (1UL << CRYPTO_DESTROY_KEY_MSK_POS)
#define CRYPTO_GET_KEY_ATTRIBUTES_MSK_POS (8UL)
#define CRYPTO_GET_KEY_ATTRIBUTES_MSK (1UL << CRYPTO_GET_KEY_ATTRIBUTES_MSK_POS)
#define CRYPTO_IMPORT_KEY_MSK_POS (9UL)
#define CRYPTO_IMPORT_KEY_MSK (1UL << CRYPTO_IMPORT_KEY_MSK_POS)
#define CRYPTO_ACL_TEST_WAIT_ANY_SID_MSK (\
CRYPTO_GENERATE_KEY_MSK | \
CRYPTO_OPEN_KEY_MSK | \
CRYPTO_CLOSE_KEY_MSK | \
CRYPTO_DESTROY_KEY_MSK | \
CRYPTO_GET_KEY_ATTRIBUTES_MSK | \
CRYPTO_IMPORT_KEY_MSK)
#endif // USE_CRYPTO_ACL_TEST
#ifdef USE_CLIENT_TESTS_PART1
/* -----------------------------------------------------------------------------
* CLIENT_TESTS_PART1 defines
* -------------------------------------------------------------------------- */
#define CLIENT_TESTS_PART1_ID 1
#define CLIENT_TESTS_PART1_ROT_SRV_COUNT (3UL)
#define CLIENT_TESTS_PART1_EXT_ROT_SRV_COUNT (0UL)
#define CLIENT_TESTS_PART1_WAIT_ANY_IRQ_MSK (0)
#define PART1_ROT_SRV1_MSK_POS (4UL)
#define PART1_ROT_SRV1_MSK (1UL << PART1_ROT_SRV1_MSK_POS)
#define DROP_CONN_MSK_POS (5UL)
#define DROP_CONN_MSK (1UL << DROP_CONN_MSK_POS)
#define SECURE_CLIENTS_ONLY_MSK_POS (6UL)
#define SECURE_CLIENTS_ONLY_MSK (1UL << SECURE_CLIENTS_ONLY_MSK_POS)
#define CLIENT_TESTS_PART1_WAIT_ANY_SID_MSK (\
PART1_ROT_SRV1_MSK | \
DROP_CONN_MSK | \
SECURE_CLIENTS_ONLY_MSK)
#endif // USE_CLIENT_TESTS_PART1
#ifdef USE_SERVER_TESTS_PART1
/* -----------------------------------------------------------------------------
* SERVER_TESTS_PART1 defines
* -------------------------------------------------------------------------- */
#define SERVER_TESTS_PART1_ID 2
#define SERVER_TESTS_PART1_ROT_SRV_COUNT (2UL)
#define SERVER_TESTS_PART1_EXT_ROT_SRV_COUNT (2UL)
#define SERVER_TESTS_PART1_WAIT_ANY_IRQ_MSK (0)
#define CONTROL_MSK_POS (4UL)
#define CONTROL_MSK (1UL << CONTROL_MSK_POS)
#define TEST_MSK_POS (5UL)
#define TEST_MSK (1UL << TEST_MSK_POS)
#define SERVER_TESTS_PART1_WAIT_ANY_SID_MSK (\
CONTROL_MSK | \
TEST_MSK)
#endif // USE_SERVER_TESTS_PART1
#ifdef USE_SERVER_TESTS_PART2
/* -----------------------------------------------------------------------------
* SERVER_TESTS_PART2 defines
* -------------------------------------------------------------------------- */
#define SERVER_TESTS_PART2_ID 3
#define SERVER_TESTS_PART2_ROT_SRV_COUNT (2UL)
#define SERVER_TESTS_PART2_EXT_ROT_SRV_COUNT (0UL)
#define SERVER_TESTS_PART2_WAIT_ANY_IRQ_MSK (0)
#define ROT_SRV_REVERSE_MSK_POS (4UL)
#define ROT_SRV_REVERSE_MSK (1UL << ROT_SRV_REVERSE_MSK_POS)
#define ROT_SRV_DB_TST_MSK_POS (5UL)
#define ROT_SRV_DB_TST_MSK (1UL << ROT_SRV_DB_TST_MSK_POS)
#define SERVER_TESTS_PART2_WAIT_ANY_SID_MSK (\
ROT_SRV_REVERSE_MSK | \
ROT_SRV_DB_TST_MSK)
#endif // USE_SERVER_TESTS_PART2
#ifdef USE_SMOKE_TESTS_PART1
/* -----------------------------------------------------------------------------
* SMOKE_TESTS_PART1 defines
* -------------------------------------------------------------------------- */
#define SMOKE_TESTS_PART1_ID 4
#define SMOKE_TESTS_PART1_ROT_SRV_COUNT (1UL)
#define SMOKE_TESTS_PART1_EXT_ROT_SRV_COUNT (0UL)
#define SMOKE_TESTS_PART1_WAIT_ANY_IRQ_MSK (0)
#define ROT_SRV1_MSK_POS (4UL)
#define ROT_SRV1_MSK (1UL << ROT_SRV1_MSK_POS)
#define SMOKE_TESTS_PART1_WAIT_ANY_SID_MSK (\
ROT_SRV1_MSK)
#endif // USE_SMOKE_TESTS_PART1
#endif // USE_PSA_TEST_PARTITIONS
#endif // __MBED_SPM_PARTITIONS_H___

View File

@ -44,7 +44,7 @@ from tools.utils import argparse_filestring_type, args_error, argparse_many
from tools.utils import argparse_dir_not_parent from tools.utils import argparse_dir_not_parent
from tools.utils import NoValidToolchainException from tools.utils import NoValidToolchainException
from tools.utils import print_end_warnings from tools.utils import print_end_warnings
from tools.psa import generate_psa_sources, clean_psa_autogen from tools.psa import generate_psa_sources
from tools.resources import OsAndSpeResourceFilter from tools.resources import OsAndSpeResourceFilter
def main(): def main():
@ -166,9 +166,6 @@ def main():
skipped = [] skipped = []
end_warnings = [] end_warnings = []
if options.clean:
clean_psa_autogen()
for toolchain in toolchains: for toolchain in toolchains:
for target_name in targets: for target_name in targets:
target = Target.get_target(target_name) target = Target.get_target(target_name)
@ -191,14 +188,12 @@ def main():
profile = extract_profile(parser, options, internal_tc_name) profile = extract_profile(parser, options, internal_tc_name)
if options.source_dir: if options.source_dir:
if target.is_PSA_target: resource_filter = None
if target.is_PSA_secure_target:
generate_psa_sources( generate_psa_sources(
source_dirs=options.source_dir, source_dirs=options.source_dir,
ignore_paths=[options.build_dir] ignore_paths=[options.build_dir]
) )
resource_filter = None
if target.is_PSA_secure_target:
resource_filter = OsAndSpeResourceFilter() resource_filter = OsAndSpeResourceFilter()
lib_build_res = build_library( lib_build_res = build_library(

View File

@ -55,7 +55,7 @@ from tools.utils import print_end_warnings
from tools.utils import print_large_string from tools.utils import print_large_string
from tools.settings import ROOT from tools.settings import ROOT
from tools.targets import Target from tools.targets import Target
from tools.psa import generate_psa_sources, clean_psa_autogen from tools.psa import generate_psa_sources
from tools.resources import OsAndSpeResourceFilter from tools.resources import OsAndSpeResourceFilter
def default_args_dict(options): def default_args_dict(options):
@ -305,10 +305,6 @@ def main():
elif options.list_tests is True: elif options.list_tests is True:
print('\n'.join(map(str, sorted(TEST_MAP.values())))) print('\n'.join(map(str, sorted(TEST_MAP.values()))))
else: else:
if options.clean:
clean_psa_autogen()
# Target # Target
if options.mcu is None: if options.mcu is None:
args_error(parser, "argument -m/--mcu is required") args_error(parser, "argument -m/--mcu is required")
@ -339,14 +335,12 @@ def main():
args_error(parser, str(e)) args_error(parser, str(e))
if options.source_dir is not None: if options.source_dir is not None:
if target.is_PSA_target: resource_filter = None
if target.is_PSA_secure_target:
generate_psa_sources( generate_psa_sources(
source_dirs=options.source_dir, source_dirs=options.source_dir,
ignore_paths=[options.build_dir] ignore_paths=[options.build_dir]
) )
resource_filter = None
if target.is_PSA_secure_target:
resource_filter = OsAndSpeResourceFilter() resource_filter = OsAndSpeResourceFilter()
wrapped_build_project( wrapped_build_project(

View File

@ -53,7 +53,7 @@ from tools.utils import print_large_string
from tools.utils import NotSupportedException from tools.utils import NotSupportedException
from tools.options import extract_profile, list_profiles, extract_mcus from tools.options import extract_profile, list_profiles, extract_mcus
from tools.notifier.term import TerminalNotifier from tools.notifier.term import TerminalNotifier
from tools.psa import generate_psa_sources, clean_psa_autogen from tools.psa import generate_psa_sources
from tools.resources import OsAndSpeResourceFilter from tools.resources import OsAndSpeResourceFilter
""" The CLI entry point for exporting projects from the mbed tools to any of the """ The CLI entry point for exporting projects from the mbed tools to any of the
@ -380,7 +380,6 @@ def main():
if options.clean: if options.clean:
clean(options.source_dir) clean(options.source_dir)
clean_psa_autogen()
ide = resolve_exporter_alias(options.ide) ide = resolve_exporter_alias(options.ide)
exporter, toolchain_name = get_exporter_toolchain(ide) exporter, toolchain_name = get_exporter_toolchain(ide)
@ -391,13 +390,11 @@ def main():
try: try:
target = Target.get_target(mcu) target = Target.get_target(mcu)
if target.is_PSA_target: resource_filter = None
if target.is_PSA_secure_target:
generate_psa_sources(source_dirs=options.source_dir, generate_psa_sources(source_dirs=options.source_dir,
ignore_paths=[] ignore_paths=[]
) )
resource_filter = None
if target.is_PSA_secure_target:
resource_filter = OsAndSpeResourceFilter() resource_filter = OsAndSpeResourceFilter()
export( export(

View File

@ -57,7 +57,8 @@ optional arguments:
* When `MCU ` is not specified, the script compiles all the images for all the targets. * When `MCU ` is not specified, the script compiles all the images for all the targets.
* When `-t/--tc` is not specified, the script compiles with the default_toolchain speciified in targets.json. * When `-t/--tc` is not specified, the script compiles with the default_toolchain speciified in targets.json.
* When `-d/--debug` is not specified, the script compiles the images using the release profile. * When `-d/--debug` is not specified, the script compiles the images using the release profile.
* When `--commit` is not specified, the script will not commit the images to git. * When `--commit` is not specified, the script will not commit the images to git and
any auto-generated PSA related components and services.
* A user can specify additional commands that will be passed on to the build commands (Ex. -D for compilation defines). * A user can specify additional commands that will be passed on to the build commands (Ex. -D for compilation defines).
This script should be run in following scenarios: This script should be run in following scenarios:

View File

@ -57,23 +57,11 @@ def find_secure_image(notify, resources, ns_image_path,
return secure_image return secure_image
def _get_psa_autogen_dir():
return os.path.join(ROOT, 'PSA_AUTOGEN')
def clean_psa_autogen():
psa_out_dir = _get_psa_autogen_dir()
if os.path.isdir(psa_out_dir):
shutil.rmtree(psa_out_dir)
def generate_psa_sources(source_dirs, ignore_paths): def generate_psa_sources(source_dirs, ignore_paths):
services, apps = manifests_discovery(root_dirs=source_dirs, services, apps = manifests_discovery(root_dirs=source_dirs,
ignore_paths=ignore_paths + ['.git']) ignore_paths=ignore_paths + ['.git'])
assert len(services + apps), 'PSA manifest discovery failed' assert len(services + apps), 'PSA manifest discovery failed'
psa_out_dir = _get_psa_autogen_dir() psa_out_dir = os.path.join(ROOT, 'components', 'TARGET_PSA')
generate_spm_code(services, apps, psa_out_dir) generate_spm_code(services, apps, psa_out_dir)
return psa_out_dir return psa_out_dir

View File

@ -48,7 +48,7 @@ PSA_TESTS = {
'*psa-crypto_access_control': ['USE_PSA_TEST_PARTITIONS', '*psa-crypto_access_control': ['USE_PSA_TEST_PARTITIONS',
'USE_CRYPTO_ACL_TEST'] 'USE_CRYPTO_ACL_TEST']
} }
PSA_AUTOGEN_LOCATION = os.path.join(ROOT, 'components', 'TARGET_PSA')
def _psa_backend(target): def _psa_backend(target):
""" """
@ -247,6 +247,34 @@ def commit_binaries(target, delivery_dir, toolchain):
else: else:
logger.info("No changes detected in {}, Skipping commit".format(target)) logger.info("No changes detected in {}, Skipping commit".format(target))
def commit_psa_autogen():
"""
Commit changes related to auto-generated PSA components and services
"""
changes_made = verbose_check_call([
'git',
'-C', ROOT,
'diff', '--exit-code', '--quiet',
PSA_AUTOGEN_LOCATION], check_call=False)
if changes_made:
logger.info("Change in PSA auto-generated files has been detected")
verbose_check_call([
'git',
'-C', ROOT,
'add', PSA_AUTOGEN_LOCATION])
logger.info("Committing changes...")
commit_message = ('--message=Update PSA auto-generated components and '
'services')
verbose_check_call([
'git',
'-C', ROOT,
'commit',
commit_message])
else:
logger.info("No changes has been detected for PSA autogen, "
"Skipping commit")
def build_psa_platform(target, toolchain, delivery_dir, debug, git_commit, def build_psa_platform(target, toolchain, delivery_dir, debug, git_commit,
skip_tests, args): skip_tests, args):
@ -268,6 +296,7 @@ def build_psa_platform(target, toolchain, delivery_dir, debug, git_commit,
build_default_image(target, toolchain, profile, args) build_default_image(target, toolchain, profile, args)
if git_commit: if git_commit:
commit_binaries(target, delivery_dir, toolchain) commit_binaries(target, delivery_dir, toolchain)
commit_psa_autogen()
def get_parser(): def get_parser():

View File

@ -2,36 +2,36 @@
{ {
"name": "Secure Partition ID definitions", "name": "Secure Partition ID definitions",
"template": "tools/psa/templates/tfm_partition_defs.inc.tpl", "template": "tools/psa/templates/tfm_partition_defs.inc.tpl",
"output": "COMPONENT_SPE/TARGET_TFM/tfm_partition_defs.inc" "output": "TARGET_TFM/COMPONENT_SPE/inc/tfm_partition_defs.inc"
}, },
{ {
"name": "Secure Partition declarations", "name": "Secure Partition declarations",
"template": "tools/psa/templates/tfm_partition_list.inc.tpl", "template": "tools/psa/templates/tfm_partition_list.inc.tpl",
"output": "COMPONENT_SPE/TARGET_TFM/tfm_partition_list.inc" "output": "TARGET_TFM/COMPONENT_SPE/inc/tfm_partition_list.inc"
}, },
{ {
"name": "Secure Service list", "name": "Secure Service list",
"template": "tools/psa/templates/tfm_service_list.inc.tpl", "template": "tools/psa/templates/tfm_service_list.inc.tpl",
"output": "COMPONENT_SPE/TARGET_TFM/tfm_service_list.inc" "output": "TARGET_TFM/COMPONENT_SPE/inc/tfm_service_list.inc"
}, },
{ {
"name": "Secure Service signals list", "name": "Secure Service signals list",
"template": "tools/psa/templates/tfm_spm_signal_defs.h.tpl", "template": "tools/psa/templates/tfm_spm_signal_defs.h.tpl",
"output": "COMPONENT_SPE/TARGET_TFM/tfm_spm_signal_defs.h" "output": "TARGET_TFM/COMPONENT_SPE/inc/tfm_spm_signal_defs.h"
}, },
{ {
"name": "mbed-SPM database", "name": "mbed-SPM database",
"template": "tools/psa/templates/psa_setup.c.tpl", "template": "tools/psa/templates/psa_setup.c.tpl",
"output": "COMPONENT_SPE/TARGET_MBED_SPM/psa_setup.c" "output": "TARGET_MBED_SPM/COMPONENT_SPE/psa_setup.c"
}, },
{ {
"name": "Mappings from RoT Service names to SIDs", "name": "Mappings from RoT Service names to SIDs",
"template": "tools/psa/templates/sid.h.tpl", "template": "tools/psa/templates/sid.h.tpl",
"output": "autogen_sid.h" "output": "services/inc/autogen_sid.h"
}, },
{ {
"name": "Details partition defines and structures", "name": "Details partition defines and structures",
"template": "tools/psa/templates/mbed_spm_partitions.h.tpl", "template": "tools/psa/templates/mbed_spm_partitions.h.tpl",
"output": "mbed_spm_partitions.h" "output": "services/inc/mbed_spm_partitions.h"
} }
] ]

View File

@ -43,7 +43,7 @@ from tools.utils import argparse_dir_not_parent
from tools.utils import print_end_warnings from tools.utils import print_end_warnings
from tools.settings import ROOT from tools.settings import ROOT
from tools.targets import Target from tools.targets import Target
from tools.psa import generate_psa_sources, clean_psa_autogen from tools.psa import generate_psa_sources
from tools.resources import OsAndSpeResourceFilter, SpeOnlyResourceFilter from tools.resources import OsAndSpeResourceFilter, SpeOnlyResourceFilter
def main(): def main():
@ -220,10 +220,6 @@ def main():
print_tests(tests, options.format) print_tests(tests, options.format)
sys.exit(0) sys.exit(0)
else: else:
if options.clean:
clean_psa_autogen()
# Build all tests # Build all tests
if not options.build_dir: if not options.build_dir:
args_error(parser, "argument --build is required") args_error(parser, "argument --build is required")
@ -243,8 +239,6 @@ def main():
resource_filter = None resource_filter = None
if target.is_PSA_secure_target: if target.is_PSA_secure_target:
resource_filter = OsAndSpeResourceFilter() resource_filter = OsAndSpeResourceFilter()
if target.is_PSA_target:
generate_psa_sources( generate_psa_sources(
source_dirs=base_source_paths, source_dirs=base_source_paths,
ignore_paths=[options.build_dir] ignore_paths=[options.build_dir]