Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
mbed-cloud-client/mbed-client-pal/Source/PAL-Impl/Services-API/pal_configuration.h@0:276e7a263c35, 2018-07-02 (annotated)
- Committer:
- MACRUM
- Date:
- Mon Jul 02 06:30:39 2018 +0000
- Revision:
- 0:276e7a263c35
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MACRUM | 0:276e7a263c35 | 1 | /******************************************************************************* |
MACRUM | 0:276e7a263c35 | 2 | * Copyright 2016, 2017 ARM Ltd. |
MACRUM | 0:276e7a263c35 | 3 | * |
MACRUM | 0:276e7a263c35 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
MACRUM | 0:276e7a263c35 | 5 | * you may not use this file except in compliance with the License. |
MACRUM | 0:276e7a263c35 | 6 | * You may obtain a copy of the License at |
MACRUM | 0:276e7a263c35 | 7 | * |
MACRUM | 0:276e7a263c35 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
MACRUM | 0:276e7a263c35 | 9 | * |
MACRUM | 0:276e7a263c35 | 10 | * Unless required by applicable law or agreed to in writing, software |
MACRUM | 0:276e7a263c35 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
MACRUM | 0:276e7a263c35 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
MACRUM | 0:276e7a263c35 | 13 | * See the License for the specific language governing permissions and |
MACRUM | 0:276e7a263c35 | 14 | * limitations under the License. |
MACRUM | 0:276e7a263c35 | 15 | *******************************************************************************/ |
MACRUM | 0:276e7a263c35 | 16 | |
MACRUM | 0:276e7a263c35 | 17 | |
MACRUM | 0:276e7a263c35 | 18 | #ifndef _PAL_COFIGURATION_H |
MACRUM | 0:276e7a263c35 | 19 | #define _PAL_COFIGURATION_H |
MACRUM | 0:276e7a263c35 | 20 | #include "limits.h" |
MACRUM | 0:276e7a263c35 | 21 | |
MACRUM | 0:276e7a263c35 | 22 | |
MACRUM | 0:276e7a263c35 | 23 | #ifdef PAL_USER_DEFINED_CONFIGURATION |
MACRUM | 0:276e7a263c35 | 24 | #include PAL_USER_DEFINED_CONFIGURATION |
MACRUM | 0:276e7a263c35 | 25 | #else |
MACRUM | 0:276e7a263c35 | 26 | #include "sotp_fs.h" |
MACRUM | 0:276e7a263c35 | 27 | #endif |
MACRUM | 0:276e7a263c35 | 28 | |
MACRUM | 0:276e7a263c35 | 29 | |
MACRUM | 0:276e7a263c35 | 30 | /*! \brief If needed any board specific configuration please set this define |
MACRUM | 0:276e7a263c35 | 31 | */ |
MACRUM | 0:276e7a263c35 | 32 | #ifdef PAL_BOARD_SPECIFIC_CONFIG |
MACRUM | 0:276e7a263c35 | 33 | #include PAL_BOARD_SPECIFIC_CONFIG |
MACRUM | 0:276e7a263c35 | 34 | #endif |
MACRUM | 0:276e7a263c35 | 35 | |
MACRUM | 0:276e7a263c35 | 36 | |
MACRUM | 0:276e7a263c35 | 37 | /*! \brief let the user choose its platform configuration file. |
MACRUM | 0:276e7a263c35 | 38 | \note if the user does not specify a platform configuration file, |
MACRUM | 0:276e7a263c35 | 39 | \note PAL uses a default configuration set that can be found at \b Configs/pal_config folder |
MACRUM | 0:276e7a263c35 | 40 | */ |
MACRUM | 0:276e7a263c35 | 41 | |
MACRUM | 0:276e7a263c35 | 42 | #ifdef PAL_PLATFORM_DEFINED_CONFIGURATION |
MACRUM | 0:276e7a263c35 | 43 | #include PAL_PLATFORM_DEFINED_CONFIGURATION |
MACRUM | 0:276e7a263c35 | 44 | #elif defined(__LINUX__) |
MACRUM | 0:276e7a263c35 | 45 | #include "Linux_default.h" |
MACRUM | 0:276e7a263c35 | 46 | #elif defined(__FREERTOS__) |
MACRUM | 0:276e7a263c35 | 47 | #include "FreeRTOS_default.h" |
MACRUM | 0:276e7a263c35 | 48 | #elif defined(__MBED__) |
MACRUM | 0:276e7a263c35 | 49 | #include "mbedOS_default.h" |
MACRUM | 0:276e7a263c35 | 50 | #else |
MACRUM | 0:276e7a263c35 | 51 | #error "Please specify the platform PAL_PLATFORM_DEFINED_CONFIGURATION" |
MACRUM | 0:276e7a263c35 | 52 | #endif |
MACRUM | 0:276e7a263c35 | 53 | |
MACRUM | 0:276e7a263c35 | 54 | /*! \file pal_configuration.h |
MACRUM | 0:276e7a263c35 | 55 | * \brief PAL Configuration. |
MACRUM | 0:276e7a263c35 | 56 | * This file contains PAL configuration information including the following: |
MACRUM | 0:276e7a263c35 | 57 | * 1. The flags to enable or disable features. |
MACRUM | 0:276e7a263c35 | 58 | * 2. The configuration of the number of objects provided by PAL (such as the number of threads supported) or their sizes. |
MACRUM | 0:276e7a263c35 | 59 | * 3. The configuration of supported cipher suites. |
MACRUM | 0:276e7a263c35 | 60 | * 4. The configuration for flash memory usage. |
MACRUM | 0:276e7a263c35 | 61 | * 5. The configuration for the root of trust. |
MACRUM | 0:276e7a263c35 | 62 | */ |
MACRUM | 0:276e7a263c35 | 63 | |
MACRUM | 0:276e7a263c35 | 64 | |
MACRUM | 0:276e7a263c35 | 65 | /* |
MACRUM | 0:276e7a263c35 | 66 | * Network configuration |
MACRUM | 0:276e7a263c35 | 67 | */ |
MACRUM | 0:276e7a263c35 | 68 | //! PAL configuration options |
MACRUM | 0:276e7a263c35 | 69 | #ifndef PAL_NET_TCP_AND_TLS_SUPPORT |
MACRUM | 0:276e7a263c35 | 70 | #define PAL_NET_TCP_AND_TLS_SUPPORT true/* Add PAL support for TCP. */ |
MACRUM | 0:276e7a263c35 | 71 | #endif |
MACRUM | 0:276e7a263c35 | 72 | |
MACRUM | 0:276e7a263c35 | 73 | #ifndef PAL_NET_ASYNCHRONOUS_SOCKET_API |
MACRUM | 0:276e7a263c35 | 74 | #define PAL_NET_ASYNCHRONOUS_SOCKET_API true/* Add PAL support for asynchronous sockets. */ |
MACRUM | 0:276e7a263c35 | 75 | #endif |
MACRUM | 0:276e7a263c35 | 76 | |
MACRUM | 0:276e7a263c35 | 77 | #ifndef PAL_NET_DNS_SUPPORT |
MACRUM | 0:276e7a263c35 | 78 | #define PAL_NET_DNS_SUPPORT true/* Add PAL support for DNS lookup. */ |
MACRUM | 0:276e7a263c35 | 79 | #endif |
MACRUM | 0:276e7a263c35 | 80 | |
MACRUM | 0:276e7a263c35 | 81 | //values for PAL_NET_DNS_IP_SUPPORT |
MACRUM | 0:276e7a263c35 | 82 | #define PAL_NET_DNS_ANY 0 /* if PAL_NET_DNS_IP_SUPPORT is set to PAL_NET_DNS_ANY pal_getAddressInfo will return the first available IPV4 or IPV6 address*/ |
MACRUM | 0:276e7a263c35 | 83 | #define PAL_NET_DNS_IPV4_ONLY 2 /* if PAL_NET_DNS_IP_SUPPORT is set to PAL_NET_DNS_IPV4_ONLY pal_getAddressInfo will return the first available IPV4 address*/ |
MACRUM | 0:276e7a263c35 | 84 | #define PAL_NET_DNS_IPV6_ONLY 4 /* if PAL_NET_DNS_IP_SUPPORT is set to PAL_NET_DNS_IPV6_ONLY pal_getAddressInfo will return the first available IPV6 address*/ |
MACRUM | 0:276e7a263c35 | 85 | |
MACRUM | 0:276e7a263c35 | 86 | #ifndef PAL_NET_DNS_IP_SUPPORT |
MACRUM | 0:276e7a263c35 | 87 | #define PAL_NET_DNS_IP_SUPPORT 0 /* sets the type of IP addresses returned by pal_getAddressInfo*/ |
MACRUM | 0:276e7a263c35 | 88 | #endif |
MACRUM | 0:276e7a263c35 | 89 | |
MACRUM | 0:276e7a263c35 | 90 | //! The maximum number of interfaces that can be supported at a time. |
MACRUM | 0:276e7a263c35 | 91 | #ifndef PAL_MAX_SUPORTED_NET_INTERFACES |
MACRUM | 0:276e7a263c35 | 92 | #define PAL_MAX_SUPORTED_NET_INTERFACES 10 |
MACRUM | 0:276e7a263c35 | 93 | #endif |
MACRUM | 0:276e7a263c35 | 94 | |
MACRUM | 0:276e7a263c35 | 95 | //!< Stack size for thread created when calling pal_getAddressInfoAsync |
MACRUM | 0:276e7a263c35 | 96 | #ifndef PAL_NET_ASYNC_DNS_THREAD_STACK_SIZE |
MACRUM | 0:276e7a263c35 | 97 | #define PAL_NET_ASYNC_DNS_THREAD_STACK_SIZE (1024 * 2) |
MACRUM | 0:276e7a263c35 | 98 | #endif |
MACRUM | 0:276e7a263c35 | 99 | |
MACRUM | 0:276e7a263c35 | 100 | |
MACRUM | 0:276e7a263c35 | 101 | //! If you want PAL Not to perform a rollback/cleanup although main PAL init failed, please set this flag to `false` |
MACRUM | 0:276e7a263c35 | 102 | #ifndef PAL_CLEANUP_ON_INIT_FAILURE |
MACRUM | 0:276e7a263c35 | 103 | #define PAL_CLEANUP_ON_INIT_FAILURE true |
MACRUM | 0:276e7a263c35 | 104 | #endif |
MACRUM | 0:276e7a263c35 | 105 | |
MACRUM | 0:276e7a263c35 | 106 | /* |
MACRUM | 0:276e7a263c35 | 107 | * RTOS configuration |
MACRUM | 0:276e7a263c35 | 108 | */ |
MACRUM | 0:276e7a263c35 | 109 | //! This flag determines if PAL moudles are thread safe. 1 - thread safety is enabled, 0 - thread safety is disabled |
MACRUM | 0:276e7a263c35 | 110 | #ifndef PAL_THREAD_SAFETY |
MACRUM | 0:276e7a263c35 | 111 | #define PAL_THREAD_SAFETY 1 |
MACRUM | 0:276e7a263c35 | 112 | #endif |
MACRUM | 0:276e7a263c35 | 113 | |
MACRUM | 0:276e7a263c35 | 114 | #ifndef PAL_IGNORE_UNIQUE_THREAD_PRIORITY |
MACRUM | 0:276e7a263c35 | 115 | #define PAL_UNIQUE_THREAD_PRIORITY true |
MACRUM | 0:276e7a263c35 | 116 | #endif |
MACRUM | 0:276e7a263c35 | 117 | |
MACRUM | 0:276e7a263c35 | 118 | //! initial time until thread stack cleanup (mbedOs only). This is the amount of time we wait before checking that a thread has completed so we can free it's stack. |
MACRUM | 0:276e7a263c35 | 119 | #ifndef PAL_RTOS_THREAD_CLEANUP_TIMER_MILISEC |
MACRUM | 0:276e7a263c35 | 120 | #define PAL_RTOS_THREAD_CLEANUP_TIMER_MILISEC 200 |
MACRUM | 0:276e7a263c35 | 121 | #endif |
MACRUM | 0:276e7a263c35 | 122 | |
MACRUM | 0:276e7a263c35 | 123 | //! This define is used to determine the size of the initial random buffer (in bytes) held by PAL for random the algorithm. |
MACRUM | 0:276e7a263c35 | 124 | #ifndef PAL_INITIAL_RANDOM_SIZE |
MACRUM | 0:276e7a263c35 | 125 | #define PAL_INITIAL_RANDOM_SIZE 48 |
MACRUM | 0:276e7a263c35 | 126 | #endif |
MACRUM | 0:276e7a263c35 | 127 | |
MACRUM | 0:276e7a263c35 | 128 | #ifndef PAL_RTOS_WAIT_FOREVER |
MACRUM | 0:276e7a263c35 | 129 | #define PAL_RTOS_WAIT_FOREVER UINT_MAX |
MACRUM | 0:276e7a263c35 | 130 | #endif |
MACRUM | 0:276e7a263c35 | 131 | |
MACRUM | 0:276e7a263c35 | 132 | /* |
MACRUM | 0:276e7a263c35 | 133 | * TLS configuration |
MACRUM | 0:276e7a263c35 | 134 | */ |
MACRUM | 0:276e7a263c35 | 135 | //! The the maximum number of TLS contexts supported. |
MACRUM | 0:276e7a263c35 | 136 | #ifndef PAL_MAX_NUM_OF_TLS_CTX |
MACRUM | 0:276e7a263c35 | 137 | #define PAL_MAX_NUM_OF_TLS_CTX 1 |
MACRUM | 0:276e7a263c35 | 138 | #endif |
MACRUM | 0:276e7a263c35 | 139 | |
MACRUM | 0:276e7a263c35 | 140 | //! The maximum number of supported cipher suites. |
MACRUM | 0:276e7a263c35 | 141 | #ifndef PAL_MAX_ALLOWED_CIPHER_SUITES |
MACRUM | 0:276e7a263c35 | 142 | #define PAL_MAX_ALLOWED_CIPHER_SUITES 1 |
MACRUM | 0:276e7a263c35 | 143 | #endif |
MACRUM | 0:276e7a263c35 | 144 | |
MACRUM | 0:276e7a263c35 | 145 | //! This value is in milliseconds. 1000 = 1 second. |
MACRUM | 0:276e7a263c35 | 146 | #ifndef PAL_DTLS_PEER_MIN_TIMEOUT |
MACRUM | 0:276e7a263c35 | 147 | #define PAL_DTLS_PEER_MIN_TIMEOUT 1000 |
MACRUM | 0:276e7a263c35 | 148 | #endif |
MACRUM | 0:276e7a263c35 | 149 | |
MACRUM | 0:276e7a263c35 | 150 | //! The debug threshold for TLS API. |
MACRUM | 0:276e7a263c35 | 151 | #ifndef PAL_TLS_DEBUG_THRESHOLD |
MACRUM | 0:276e7a263c35 | 152 | #define PAL_TLS_DEBUG_THRESHOLD 5 |
MACRUM | 0:276e7a263c35 | 153 | #endif |
MACRUM | 0:276e7a263c35 | 154 | |
MACRUM | 0:276e7a263c35 | 155 | //! 32 or 48 (depends on the curve) bytes for the X,Y coordinates and 1 for the normalized/non-normalized |
MACRUM | 0:276e7a263c35 | 156 | #ifndef PAL_CERT_ID_SIZE |
MACRUM | 0:276e7a263c35 | 157 | #define PAL_CERT_ID_SIZE 33 |
MACRUM | 0:276e7a263c35 | 158 | #endif |
MACRUM | 0:276e7a263c35 | 159 | |
MACRUM | 0:276e7a263c35 | 160 | |
MACRUM | 0:276e7a263c35 | 161 | #ifndef PAL_ENABLE_PSK |
MACRUM | 0:276e7a263c35 | 162 | #define PAL_ENABLE_PSK 0 |
MACRUM | 0:276e7a263c35 | 163 | #endif |
MACRUM | 0:276e7a263c35 | 164 | |
MACRUM | 0:276e7a263c35 | 165 | #ifndef PAL_ENABLE_X509 |
MACRUM | 0:276e7a263c35 | 166 | #define PAL_ENABLE_X509 1 |
MACRUM | 0:276e7a263c35 | 167 | #endif |
MACRUM | 0:276e7a263c35 | 168 | |
MACRUM | 0:276e7a263c35 | 169 | //! Define the cipher suites for TLS (only one cipher suite per device available). |
MACRUM | 0:276e7a263c35 | 170 | #define PAL_TLS_PSK_WITH_AES_128_CBC_SHA256_SUITE 0x01 |
MACRUM | 0:276e7a263c35 | 171 | #define PAL_TLS_PSK_WITH_AES_128_CCM_8_SUITE 0x02 |
MACRUM | 0:276e7a263c35 | 172 | #define PAL_TLS_PSK_WITH_AES_256_CCM_8_SUITE 0x04 |
MACRUM | 0:276e7a263c35 | 173 | #define PAL_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8_SUITE 0x08 |
MACRUM | 0:276e7a263c35 | 174 | #define PAL_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256_SUITE 0x10 |
MACRUM | 0:276e7a263c35 | 175 | #define PAL_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384_SUITE 0x20 |
MACRUM | 0:276e7a263c35 | 176 | |
MACRUM | 0:276e7a263c35 | 177 | |
MACRUM | 0:276e7a263c35 | 178 | //! Use the default cipher suite for TLS/DTLS operations |
MACRUM | 0:276e7a263c35 | 179 | #if (PAL_ENABLE_X509 == 1) |
MACRUM | 0:276e7a263c35 | 180 | #ifndef PAL_TLS_CIPHER_SUITE |
MACRUM | 0:276e7a263c35 | 181 | #define PAL_TLS_CIPHER_SUITE PAL_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8_SUITE |
MACRUM | 0:276e7a263c35 | 182 | #endif |
MACRUM | 0:276e7a263c35 | 183 | #elif (PAL_ENABLE_PSK == 1) |
MACRUM | 0:276e7a263c35 | 184 | #ifndef PAL_TLS_CIPHER_SUITE |
MACRUM | 0:276e7a263c35 | 185 | #define PAL_TLS_CIPHER_SUITE PAL_TLS_PSK_WITH_AES_128_CCM_8_SUITE |
MACRUM | 0:276e7a263c35 | 186 | #endif |
MACRUM | 0:276e7a263c35 | 187 | #endif |
MACRUM | 0:276e7a263c35 | 188 | |
MACRUM | 0:276e7a263c35 | 189 | #ifndef PAL_CMAC_SUPPORT |
MACRUM | 0:276e7a263c35 | 190 | #define PAL_CMAC_SUPPORT true |
MACRUM | 0:276e7a263c35 | 191 | #endif |
MACRUM | 0:276e7a263c35 | 192 | |
MACRUM | 0:276e7a263c35 | 193 | //! Enable the CMAC functionality (This flag was targeted to let the bootloader to be compiled without CMAC) |
MACRUM | 0:276e7a263c35 | 194 | #ifndef PAL_CMAC_SUPPORT |
MACRUM | 0:276e7a263c35 | 195 | #define PAL_CMAC_SUPPORT 1 |
MACRUM | 0:276e7a263c35 | 196 | #endif //PAL_CMAC_SUPPORT |
MACRUM | 0:276e7a263c35 | 197 | |
MACRUM | 0:276e7a263c35 | 198 | /* |
MACRUM | 0:276e7a263c35 | 199 | * UPDATE configuration |
MACRUM | 0:276e7a263c35 | 200 | */ |
MACRUM | 0:276e7a263c35 | 201 | |
MACRUM | 0:276e7a263c35 | 202 | #define PAL_UPDATE_USE_FLASH 1 |
MACRUM | 0:276e7a263c35 | 203 | #define PAL_UPDATE_USE_FS 2 |
MACRUM | 0:276e7a263c35 | 204 | |
MACRUM | 0:276e7a263c35 | 205 | #ifndef PAL_UPDATE_IMAGE_LOCATION |
MACRUM | 0:276e7a263c35 | 206 | #define PAL_UPDATE_IMAGE_LOCATION PAL_UPDATE_USE_FS //!< Choose the storage correct Storage option, File System or Flash |
MACRUM | 0:276e7a263c35 | 207 | #endif |
MACRUM | 0:276e7a263c35 | 208 | |
MACRUM | 0:276e7a263c35 | 209 | //! Certificate date validation in Unix time format. |
MACRUM | 0:276e7a263c35 | 210 | #ifndef PAL_CRYPTO_CERT_DATE_LENGTH |
MACRUM | 0:276e7a263c35 | 211 | #define PAL_CRYPTO_CERT_DATE_LENGTH sizeof(uint64_t) |
MACRUM | 0:276e7a263c35 | 212 | #endif |
MACRUM | 0:276e7a263c35 | 213 | |
MACRUM | 0:276e7a263c35 | 214 | /* |
MACRUM | 0:276e7a263c35 | 215 | * FS configuration |
MACRUM | 0:276e7a263c35 | 216 | */ |
MACRUM | 0:276e7a263c35 | 217 | |
MACRUM | 0:276e7a263c35 | 218 | /* !\brief file system configurations |
MACRUM | 0:276e7a263c35 | 219 | * PAL_NUMBER_OF_PARTITIONS |
MACRUM | 0:276e7a263c35 | 220 | * 0 - Default behavior for the platform (Described by either 1 or 2 below). |
MACRUM | 0:276e7a263c35 | 221 | * 1 - There is a single partition in which the ARM client applications create and remove files (but do not format it). |
MACRUM | 0:276e7a263c35 | 222 | * 2 - There are two partitions in which ARM client applications may format or create and remove files, |
MACRUM | 0:276e7a263c35 | 223 | * depending on PAL_PRIMARY_PARTITION_PRIVATE and PAL_SECONDARY_PARTITION_PRIVATE |
MACRUM | 0:276e7a263c35 | 224 | */ |
MACRUM | 0:276e7a263c35 | 225 | #ifndef PAL_NUMBER_OF_PARTITIONS |
MACRUM | 0:276e7a263c35 | 226 | #define PAL_NUMBER_OF_PARTITIONS 1 // Default partitions |
MACRUM | 0:276e7a263c35 | 227 | #endif |
MACRUM | 0:276e7a263c35 | 228 | |
MACRUM | 0:276e7a263c35 | 229 | #if (PAL_NUMBER_OF_PARTITIONS > 2) |
MACRUM | 0:276e7a263c35 | 230 | #error "PAL_NUMBER_OF_PARTITIONS cannot be more then 2" |
MACRUM | 0:276e7a263c35 | 231 | #endif |
MACRUM | 0:276e7a263c35 | 232 | |
MACRUM | 0:276e7a263c35 | 233 | // PAL_PRIMARY_PARTITION_PRIVATE |
MACRUM | 0:276e7a263c35 | 234 | // 1 if the primary partition is exclusively dedicated to the ARM client applications. |
MACRUM | 0:276e7a263c35 | 235 | // 0 if the primary partition is used for storing other files as well. |
MACRUM | 0:276e7a263c35 | 236 | #ifndef PAL_PRIMARY_PARTITION_PRIVATE |
MACRUM | 0:276e7a263c35 | 237 | #define PAL_PRIMARY_PARTITION_PRIVATE 0 |
MACRUM | 0:276e7a263c35 | 238 | #endif |
MACRUM | 0:276e7a263c35 | 239 | |
MACRUM | 0:276e7a263c35 | 240 | //! PAL_SECONDARY_PARTITION_PRIVATE |
MACRUM | 0:276e7a263c35 | 241 | //! 1 if the secondary partition is exclusively dedicated to the ARM client applications. |
MACRUM | 0:276e7a263c35 | 242 | //! 0 if the secondary partition is used for storing other files as well. |
MACRUM | 0:276e7a263c35 | 243 | #ifndef PAL_SECONDARY_PARTITION_PRIVATE |
MACRUM | 0:276e7a263c35 | 244 | #define PAL_SECONDARY_PARTITION_PRIVATE 0 |
MACRUM | 0:276e7a263c35 | 245 | #endif |
MACRUM | 0:276e7a263c35 | 246 | |
MACRUM | 0:276e7a263c35 | 247 | //! This define is the location of the primary mount point for the file system |
MACRUM | 0:276e7a263c35 | 248 | #ifndef PAL_FS_MOUNT_POINT_PRIMARY |
MACRUM | 0:276e7a263c35 | 249 | #define PAL_FS_MOUNT_POINT_PRIMARY "" |
MACRUM | 0:276e7a263c35 | 250 | #endif |
MACRUM | 0:276e7a263c35 | 251 | |
MACRUM | 0:276e7a263c35 | 252 | //! This define is the location of the secondary mount point for the file system |
MACRUM | 0:276e7a263c35 | 253 | #ifndef PAL_FS_MOUNT_POINT_SECONDARY |
MACRUM | 0:276e7a263c35 | 254 | #define PAL_FS_MOUNT_POINT_SECONDARY "" |
MACRUM | 0:276e7a263c35 | 255 | #endif |
MACRUM | 0:276e7a263c35 | 256 | |
MACRUM | 0:276e7a263c35 | 257 | // Update |
MACRUM | 0:276e7a263c35 | 258 | |
MACRUM | 0:276e7a263c35 | 259 | #ifndef PAL_UPDATE_FIRMWARE_MOUNT_POINT |
MACRUM | 0:276e7a263c35 | 260 | #define PAL_UPDATE_FIRMWARE_MOUNT_POINT PAL_FS_MOUNT_POINT_PRIMARY |
MACRUM | 0:276e7a263c35 | 261 | #endif |
MACRUM | 0:276e7a263c35 | 262 | //! The location of the firmware update folder |
MACRUM | 0:276e7a263c35 | 263 | #ifndef PAL_UPDATE_FIRMWARE_DIR |
MACRUM | 0:276e7a263c35 | 264 | #define PAL_UPDATE_FIRMWARE_DIR PAL_UPDATE_FIRMWARE_MOUNT_POINT "/firmware" |
MACRUM | 0:276e7a263c35 | 265 | #endif |
MACRUM | 0:276e7a263c35 | 266 | |
MACRUM | 0:276e7a263c35 | 267 | /*\brief If flash existed set to 1 else 0, the flash is used for none volatile backup*/ |
MACRUM | 0:276e7a263c35 | 268 | #ifndef PAL_USE_INTERNAL_FLASH |
MACRUM | 0:276e7a263c35 | 269 | #define PAL_USE_INTERNAL_FLASH 0 |
MACRUM | 0:276e7a263c35 | 270 | #endif |
MACRUM | 0:276e7a263c35 | 271 | |
MACRUM | 0:276e7a263c35 | 272 | #ifndef PAL_INT_FLASH_NUM_SECTIONS |
MACRUM | 0:276e7a263c35 | 273 | #define PAL_INT_FLASH_NUM_SECTIONS 0 |
MACRUM | 0:276e7a263c35 | 274 | #endif |
MACRUM | 0:276e7a263c35 | 275 | |
MACRUM | 0:276e7a263c35 | 276 | #ifndef PAL_USE_HW_ROT |
MACRUM | 0:276e7a263c35 | 277 | #define PAL_USE_HW_ROT 1 |
MACRUM | 0:276e7a263c35 | 278 | #endif |
MACRUM | 0:276e7a263c35 | 279 | |
MACRUM | 0:276e7a263c35 | 280 | #ifndef PAL_USE_HW_RTC |
MACRUM | 0:276e7a263c35 | 281 | #define PAL_USE_HW_RTC 1 |
MACRUM | 0:276e7a263c35 | 282 | #endif |
MACRUM | 0:276e7a263c35 | 283 | |
MACRUM | 0:276e7a263c35 | 284 | #ifndef PAL_USE_HW_TRNG |
MACRUM | 0:276e7a263c35 | 285 | #define PAL_USE_HW_TRNG 1 |
MACRUM | 0:276e7a263c35 | 286 | #endif |
MACRUM | 0:276e7a263c35 | 287 | |
MACRUM | 0:276e7a263c35 | 288 | //! The number of valid priorities limits the number of concurrent running threads. |
MACRUM | 0:276e7a263c35 | 289 | #ifndef PAL_MAX_NUMBER_OF_THREADS |
MACRUM | 0:276e7a263c35 | 290 | #if PAL_USE_HW_TRNG |
MACRUM | 0:276e7a263c35 | 291 | #define PAL_MAX_NUMBER_OF_THREADS 9 |
MACRUM | 0:276e7a263c35 | 292 | #else |
MACRUM | 0:276e7a263c35 | 293 | #define PAL_MAX_NUMBER_OF_THREADS 8 |
MACRUM | 0:276e7a263c35 | 294 | #endif |
MACRUM | 0:276e7a263c35 | 295 | #endif |
MACRUM | 0:276e7a263c35 | 296 | |
MACRUM | 0:276e7a263c35 | 297 | #if PAL_USE_HW_TRNG |
MACRUM | 0:276e7a263c35 | 298 | //! Delay for TRNG noise collecting thread used between calls to TRNG |
MACRUM | 0:276e7a263c35 | 299 | #ifndef PAL_NOISE_TRNG_THREAD_DELAY_MILLI_SEC |
MACRUM | 0:276e7a263c35 | 300 | #define PAL_NOISE_TRNG_THREAD_DELAY_MILLI_SEC (1000 * 60) // one minute |
MACRUM | 0:276e7a263c35 | 301 | #endif |
MACRUM | 0:276e7a263c35 | 302 | //! Stack size for TRNG noise collecting thread |
MACRUM | 0:276e7a263c35 | 303 | #ifndef PAL_NOISE_TRNG_THREAD_STACK_SIZE |
MACRUM | 0:276e7a263c35 | 304 | #define PAL_NOISE_TRNG_THREAD_STACK_SIZE 1536 // 1.5K |
MACRUM | 0:276e7a263c35 | 305 | #endif |
MACRUM | 0:276e7a263c35 | 306 | #endif |
MACRUM | 0:276e7a263c35 | 307 | |
MACRUM | 0:276e7a263c35 | 308 | #ifndef PAL_USE_SECURE_TIME |
MACRUM | 0:276e7a263c35 | 309 | #define PAL_USE_SECURE_TIME 1 |
MACRUM | 0:276e7a263c35 | 310 | #endif |
MACRUM | 0:276e7a263c35 | 311 | |
MACRUM | 0:276e7a263c35 | 312 | #ifndef PAL_DEVICE_KEY_DERIVATION_BACKWARD_COMPATIBILITY_CALC |
MACRUM | 0:276e7a263c35 | 313 | #define PAL_DEVICE_KEY_DERIVATION_BACKWARD_COMPATIBILITY_CALC 0 |
MACRUM | 0:276e7a263c35 | 314 | #endif |
MACRUM | 0:276e7a263c35 | 315 | |
MACRUM | 0:276e7a263c35 | 316 | /*\brief Starting Address for section 1 Minimum requirement size is 1KB and section must be consecutive sectors*/ |
MACRUM | 0:276e7a263c35 | 317 | #ifndef PAL_INTERNAL_FLASH_SECTION_1_ADDRESS |
MACRUM | 0:276e7a263c35 | 318 | #define PAL_INTERNAL_FLASH_SECTION_1_ADDRESS 0 |
MACRUM | 0:276e7a263c35 | 319 | #endif |
MACRUM | 0:276e7a263c35 | 320 | /*\brief Starting Address for section 2 Minimum requirement size is 1KB and section must be consecutive sectors*/ |
MACRUM | 0:276e7a263c35 | 321 | #ifndef PAL_INTERNAL_FLASH_SECTION_2_ADDRESS |
MACRUM | 0:276e7a263c35 | 322 | #define PAL_INTERNAL_FLASH_SECTION_2_ADDRESS 0 |
MACRUM | 0:276e7a263c35 | 323 | #endif |
MACRUM | 0:276e7a263c35 | 324 | /*\brief Size for section 1*/ |
MACRUM | 0:276e7a263c35 | 325 | #ifndef PAL_INTERNAL_FLASH_SECTION_1_SIZE |
MACRUM | 0:276e7a263c35 | 326 | #define PAL_INTERNAL_FLASH_SECTION_1_SIZE 0 |
MACRUM | 0:276e7a263c35 | 327 | #endif |
MACRUM | 0:276e7a263c35 | 328 | /*\brief Size for section 2*/ |
MACRUM | 0:276e7a263c35 | 329 | #ifndef PAL_INTERNAL_FLASH_SECTION_2_SIZE |
MACRUM | 0:276e7a263c35 | 330 | #define PAL_INTERNAL_FLASH_SECTION_2_SIZE 0 |
MACRUM | 0:276e7a263c35 | 331 | #endif |
MACRUM | 0:276e7a263c35 | 332 | |
MACRUM | 0:276e7a263c35 | 333 | #ifndef PAL_SIMULATOR_TEST_ENABLE |
MACRUM | 0:276e7a263c35 | 334 | #define PAL_SIMULATOR_TEST_ENABLE 0 |
MACRUM | 0:276e7a263c35 | 335 | #endif |
MACRUM | 0:276e7a263c35 | 336 | |
MACRUM | 0:276e7a263c35 | 337 | |
MACRUM | 0:276e7a263c35 | 338 | |
MACRUM | 0:276e7a263c35 | 339 | #if (PAL_SIMULATOR_TEST_ENABLE == 1) |
MACRUM | 0:276e7a263c35 | 340 | |
MACRUM | 0:276e7a263c35 | 341 | #undef PAL_SIMULATE_RTOS_REBOOT |
MACRUM | 0:276e7a263c35 | 342 | #define PAL_SIMULATE_RTOS_REBOOT 1 |
MACRUM | 0:276e7a263c35 | 343 | |
MACRUM | 0:276e7a263c35 | 344 | #undef PAL_SIMULATOR_FLASH_OVER_FILE_SYSTEM |
MACRUM | 0:276e7a263c35 | 345 | #define PAL_SIMULATOR_FLASH_OVER_FILE_SYSTEM 1 |
MACRUM | 0:276e7a263c35 | 346 | |
MACRUM | 0:276e7a263c35 | 347 | /*\brief overwrite format command with remove all file and directory only for Linux*/ |
MACRUM | 0:276e7a263c35 | 348 | #undef PAL_SIMULATOR_FS_RM_INSTEAD_OF_FORMAT |
MACRUM | 0:276e7a263c35 | 349 | #define PAL_SIMULATOR_FS_RM_INSTEAD_OF_FORMAT 1 |
MACRUM | 0:276e7a263c35 | 350 | #endif //PAL_SIMULATOR_TEST_ENABLE |
MACRUM | 0:276e7a263c35 | 351 | |
MACRUM | 0:276e7a263c35 | 352 | #ifndef PAL_SIMULATOR_FLASH_OVER_FILE_SYSTEM |
MACRUM | 0:276e7a263c35 | 353 | #define PAL_SIMULATOR_FLASH_OVER_FILE_SYSTEM 0 |
MACRUM | 0:276e7a263c35 | 354 | #endif |
MACRUM | 0:276e7a263c35 | 355 | |
MACRUM | 0:276e7a263c35 | 356 | |
MACRUM | 0:276e7a263c35 | 357 | |
MACRUM | 0:276e7a263c35 | 358 | #if PAL_SIMULATOR_FLASH_OVER_FILE_SYSTEM |
MACRUM | 0:276e7a263c35 | 359 | |
MACRUM | 0:276e7a263c35 | 360 | |
MACRUM | 0:276e7a263c35 | 361 | #undef PAL_USE_INTERNAL_FLASH |
MACRUM | 0:276e7a263c35 | 362 | #define PAL_USE_INTERNAL_FLASH 1 |
MACRUM | 0:276e7a263c35 | 363 | |
MACRUM | 0:276e7a263c35 | 364 | #undef PAL_INT_FLASH_NUM_SECTIONS |
MACRUM | 0:276e7a263c35 | 365 | #define PAL_INT_FLASH_NUM_SECTIONS 2 |
MACRUM | 0:276e7a263c35 | 366 | |
MACRUM | 0:276e7a263c35 | 367 | #ifndef PAL_SIMULATOR_SOTP_AREA_SIZE |
MACRUM | 0:276e7a263c35 | 368 | #define PAL_SIMULATOR_SOTP_AREA_SIZE 4096 /*\brief must be power of two the can be divded to page size without reminder and must be a multiple of sector size*/ |
MACRUM | 0:276e7a263c35 | 369 | #endif |
MACRUM | 0:276e7a263c35 | 370 | |
MACRUM | 0:276e7a263c35 | 371 | #ifndef SIMULATE_FLASH_SECTOR_SIZE |
MACRUM | 0:276e7a263c35 | 372 | #define SIMULATE_FLASH_SECTOR_SIZE 4096 /*\brief Flash Sector size*/ |
MACRUM | 0:276e7a263c35 | 373 | #endif |
MACRUM | 0:276e7a263c35 | 374 | |
MACRUM | 0:276e7a263c35 | 375 | #ifndef SIMULATE_FLASH_DIR |
MACRUM | 0:276e7a263c35 | 376 | #define SIMULATE_FLASH_DIR "" /*\brief Directory that holds the flash simulator file*/ |
MACRUM | 0:276e7a263c35 | 377 | #endif |
MACRUM | 0:276e7a263c35 | 378 | |
MACRUM | 0:276e7a263c35 | 379 | #ifndef SIMULATE_FLASH_FILE_NAME |
MACRUM | 0:276e7a263c35 | 380 | #define SIMULATE_FLASH_FILE_NAME SIMULATE_FLASH_DIR"/flashSim" /*\brief File name and path to the flash simulator file*/ |
MACRUM | 0:276e7a263c35 | 381 | #endif |
MACRUM | 0:276e7a263c35 | 382 | |
MACRUM | 0:276e7a263c35 | 383 | #ifndef SIMULATE_FLASH_PAGE_SIZE |
MACRUM | 0:276e7a263c35 | 384 | #define SIMULATE_FLASH_PAGE_SIZE 8 /*\brief Minumum writing uint to flash (2, 4, 8, 16)*/ |
MACRUM | 0:276e7a263c35 | 385 | #endif |
MACRUM | 0:276e7a263c35 | 386 | |
MACRUM | 0:276e7a263c35 | 387 | #if PAL_SIMULATOR_SOTP_AREA_SIZE < 4096 |
MACRUM | 0:276e7a263c35 | 388 | #error Minimum Size of 4K |
MACRUM | 0:276e7a263c35 | 389 | #endif |
MACRUM | 0:276e7a263c35 | 390 | |
MACRUM | 0:276e7a263c35 | 391 | /*\brief Note - In simulator mode all flash areas are overriden with the simulation sizes and address*/ |
MACRUM | 0:276e7a263c35 | 392 | |
MACRUM | 0:276e7a263c35 | 393 | #undef PAL_INTERNAL_FLASH_SECTION_1_SIZE |
MACRUM | 0:276e7a263c35 | 394 | /*\brief Size for section 1*/ |
MACRUM | 0:276e7a263c35 | 395 | #define PAL_INTERNAL_FLASH_SECTION_1_SIZE PAL_SIMULATOR_SOTP_AREA_SIZE |
MACRUM | 0:276e7a263c35 | 396 | |
MACRUM | 0:276e7a263c35 | 397 | #undef PAL_INTERNAL_FLASH_SECTION_2_SIZE |
MACRUM | 0:276e7a263c35 | 398 | /*\brief Size for section 2*/ |
MACRUM | 0:276e7a263c35 | 399 | #define PAL_INTERNAL_FLASH_SECTION_2_SIZE PAL_SIMULATOR_SOTP_AREA_SIZE |
MACRUM | 0:276e7a263c35 | 400 | |
MACRUM | 0:276e7a263c35 | 401 | #undef PAL_INTERNAL_FLASH_SECTION_1_ADDRESS |
MACRUM | 0:276e7a263c35 | 402 | /*\brief Starting Address for section 1 Minimum requirement size is 1KB and section must be consecutive sectors*/ |
MACRUM | 0:276e7a263c35 | 403 | #define PAL_INTERNAL_FLASH_SECTION_1_ADDRESS 0 |
MACRUM | 0:276e7a263c35 | 404 | |
MACRUM | 0:276e7a263c35 | 405 | #undef PAL_INTERNAL_FLASH_SECTION_2_ADDRESS |
MACRUM | 0:276e7a263c35 | 406 | /*\brief Starting Address for section 2 Minimum requirement size is 1KB and section must be consecutive sectors*/ |
MACRUM | 0:276e7a263c35 | 407 | #define PAL_INTERNAL_FLASH_SECTION_2_ADDRESS PAL_INTERNAL_FLASH_SECTION_1_SIZE |
MACRUM | 0:276e7a263c35 | 408 | |
MACRUM | 0:276e7a263c35 | 409 | #endif //PAL_SIMULATOR_FLASH_OVER_FILE_SYSTEM |
MACRUM | 0:276e7a263c35 | 410 | |
MACRUM | 0:276e7a263c35 | 411 | |
MACRUM | 0:276e7a263c35 | 412 | #define VALUE_TO_STRING(x) #x |
MACRUM | 0:276e7a263c35 | 413 | #define VALUE(x) VALUE_TO_STRING(x) |
MACRUM | 0:276e7a263c35 | 414 | #define VAR_NAME_VALUE(var) #var " = " VALUE(var) |
MACRUM | 0:276e7a263c35 | 415 | |
MACRUM | 0:276e7a263c35 | 416 | #if ((!PAL_USE_INTERNAL_FLASH && (!PAL_USE_HW_ROT || !PAL_USE_HW_RTC || !PAL_USE_HW_TRNG)) \ |
MACRUM | 0:276e7a263c35 | 417 | || ((PAL_INT_FLASH_NUM_SECTIONS == 1) && PAL_USE_INTERNAL_FLASH && (!PAL_USE_HW_RTC || !PAL_USE_HW_TRNG)) \ |
MACRUM | 0:276e7a263c35 | 418 | || ((PAL_INT_FLASH_NUM_SECTIONS == 2) && PAL_USE_INTERNAL_FLASH && !PAL_USE_HW_TRNG)) |
MACRUM | 0:276e7a263c35 | 419 | #pragma message(VAR_NAME_VALUE(PAL_USE_INTERNAL_FLASH)) |
MACRUM | 0:276e7a263c35 | 420 | #pragma message(VAR_NAME_VALUE(PAL_USE_HW_ROT)) |
MACRUM | 0:276e7a263c35 | 421 | #pragma message(VAR_NAME_VALUE(PAL_USE_HW_RTC)) |
MACRUM | 0:276e7a263c35 | 422 | #pragma message(VAR_NAME_VALUE(PAL_USE_HW_TRNG)) |
MACRUM | 0:276e7a263c35 | 423 | #pragma message(VAR_NAME_VALUE(PAL_INT_FLASH_NUM_SECTIONS)) |
MACRUM | 0:276e7a263c35 | 424 | #error Minimum configuration setting does not meet the requirements |
MACRUM | 0:276e7a263c35 | 425 | #endif |
MACRUM | 0:276e7a263c35 | 426 | |
MACRUM | 0:276e7a263c35 | 427 | #if (((PAL_ENABLE_PSK == 1) && (PAL_ENABLE_X509 == 1)) && !(defined(__LINUX__))) |
MACRUM | 0:276e7a263c35 | 428 | #error "Please select only one option PSK/X509" |
MACRUM | 0:276e7a263c35 | 429 | #endif |
MACRUM | 0:276e7a263c35 | 430 | |
MACRUM | 0:276e7a263c35 | 431 | #if ((PAL_ENABLE_PSK == 0) && (PAL_ENABLE_X509 == 0)) |
MACRUM | 0:276e7a263c35 | 432 | #error "Please select one option PSK/X509" |
MACRUM | 0:276e7a263c35 | 433 | #endif |
MACRUM | 0:276e7a263c35 | 434 | |
MACRUM | 0:276e7a263c35 | 435 | |
MACRUM | 0:276e7a263c35 | 436 | |
MACRUM | 0:276e7a263c35 | 437 | #if ((PAL_ENABLE_PSK == 1) && (PAL_USE_SECURE_TIME == 1)) |
MACRUM | 0:276e7a263c35 | 438 | #error "PSK feature cannot be configured along with secure time" |
MACRUM | 0:276e7a263c35 | 439 | #endif |
MACRUM | 0:276e7a263c35 | 440 | |
MACRUM | 0:276e7a263c35 | 441 | |
MACRUM | 0:276e7a263c35 | 442 | |
MACRUM | 0:276e7a263c35 | 443 | //! Delay (in milliseconds) between calls to TRNG random buffer in case only partial data (PAL_ERR_RTOS_TRNG_PARTIAL_DATA) was generated for the function call |
MACRUM | 0:276e7a263c35 | 444 | #ifndef PAL_TRNG_COLLECT_DELAY_MILLI_SEC |
MACRUM | 0:276e7a263c35 | 445 | #define PAL_TRNG_COLLECT_DELAY_MILLI_SEC 1000 |
MACRUM | 0:276e7a263c35 | 446 | #endif // !PAL_TRNG_COLLECT_DELAY_MILLI_SEC |
MACRUM | 0:276e7a263c35 | 447 | |
MACRUM | 0:276e7a263c35 | 448 | //! define the number of images |
MACRUM | 0:276e7a263c35 | 449 | #ifndef IMAGE_COUNT_MAX |
MACRUM | 0:276e7a263c35 | 450 | #define IMAGE_COUNT_MAX 1 |
MACRUM | 0:276e7a263c35 | 451 | #endif |
MACRUM | 0:276e7a263c35 | 452 | |
MACRUM | 0:276e7a263c35 | 453 | #define PAL_NOISE_SIZE_BYTES 48 // max number of bytes for noise |
MACRUM | 0:276e7a263c35 | 454 | #define PAL_NOISE_SIZE_BITS (PAL_NOISE_SIZE_BYTES * CHAR_BIT) // max number of bits for noise |
MACRUM | 0:276e7a263c35 | 455 | #define PAL_NOISE_BUFFER_LEN (PAL_NOISE_SIZE_BYTES / sizeof(int32_t)) // length of the noise buffer |
MACRUM | 0:276e7a263c35 | 456 | |
MACRUM | 0:276e7a263c35 | 457 | #endif //_PAL_COFIGURATION_H |