Skip to content

Commit 9ef7c59

Browse files
committed
Update mbed to mbed-os-5.4.0-rc1-15711-g869942da3c
1 parent 4be3c8e commit 9ef7c59

File tree

103 files changed

+33291
-2235
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+33291
-2235
lines changed

cores/arduino/mbed/TESTS/mbed_drivers/timeout/timeout_tests.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,9 @@ void test_deepsleep(void)
313313
314314
* This should be replaced with a better function that checks if the
315315
* hardware buffers are empty. However, such an API does not exist now,
316-
* so we'll use the wait_ms() function for now.
316+
* so we'll use the ThisThread::sleep_for() function for now.
317317
*/
318-
wait_ms(20);
318+
ThisThread::sleep_for(20);
319319

320320
timer.start();
321321
timeout.attach_callback(mbed::callback(sem_callback, &sem), delay_us);

cores/arduino/mbed/UNITTESTS/target_h/rtos/Mutex.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
#define __MUTEX_H__
1919

2020
#include <inttypes.h>
21-
#include "cmsis_os2.h"
21+
#include "mbed_rtos_types.h"
22+
#include "mbed_rtos1_types.h"
2223

2324
namespace rtos {
2425

cores/arduino/mbed/components/TARGET_PSA/inc/psa/protected_storage.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ extern "C" {
5454
* \retval PSA_ERROR_GENERIC_ERROR The operation failed because of an unspecified internal failure
5555
*/
5656
psa_status_t psa_ps_set(psa_storage_uid_t uid,
57-
uint32_t data_length,
57+
size_t data_length,
5858
const void *p_data,
5959
psa_storage_create_flags_t create_flags);
6060

@@ -65,22 +65,24 @@ psa_status_t psa_ps_set(psa_storage_uid_t uid,
6565
* \param[in] data_offset The offset within the data associated with the `uid` to start retrieving data
6666
* \param[in] data_length The amount of data to read (and the minimum allocated size of the `p_data` buffer)
6767
* \param[out] p_data The buffer where the data will be placed upon successful completion
68+
* \param[out] p_data_length The actual amount of data returned
6869
*
6970
* \return A status indicating the success/failure of the operation
7071
*
7172
* \retval PSA_SUCCESS The operation completed successfully
7273
* \retval PSA_ERROR_INVALID_ARGUMENT The operation failed because one or more of the given arguments were invalid (null pointer, wrong flags etc.)
7374
* \retval PSA_ERROR_DOES_NOT_EXIST The operation failed because the provided uid value was not found in the storage
74-
* \retval PSA_ERROR_BUFFER_TOO_SMALL The operation failed because the data associated with provided uid is not the same size as `data_size`
75+
* \retval PSA_ERROR_BUFFER_TOO_SMALL The operation failed because the data associated with provided uid does not fit `data_size`
7576
* \retval PSA_ERROR_STORAGE_FAILURE The operation failed because the physical storage has failed (Fatal error)
7677
* \retval PSA_ERROR_GENERIC_ERROR The operation failed because of an unspecified internal failure
7778
* \retval PSA_ERROR_DATA_CORRUPT The operation failed because of an authentication failure when attempting to get the key
7879
* \retval PSA_ERROR_INVALID_SIGNATURE The operation failed because the data associated with the UID failed authentication
7980
*/
8081
psa_status_t psa_ps_get(psa_storage_uid_t uid,
81-
uint32_t data_offset,
82-
uint32_t data_length,
83-
void *p_data);
82+
size_t data_offset,
83+
size_t data_length,
84+
void *p_data,
85+
size_t *p_data_length);
8486

8587
/**
8688
* \brief Retrieve the metadata about the provided uid
@@ -149,7 +151,7 @@ psa_status_t psa_ps_remove(psa_storage_uid_t uid);
149151
* \retval PSA_ERROR_GENERIC_ERROR The operation has failed due to an unspecified error
150152
*/
151153
psa_status_t psa_ps_create(psa_storage_uid_t uid,
152-
uint32_t size,
154+
size_t size,
153155
psa_storage_create_flags_t create_flags);
154156

155157
/**
@@ -179,8 +181,8 @@ psa_status_t psa_ps_create(psa_storage_uid_t uid,
179181
* \retval PSA_ERROR_INVALID_SIGNATURE The operation failed because the existing data failed authentication (MAC check failed)
180182
*/
181183
psa_status_t psa_ps_set_extended(psa_storage_uid_t uid,
182-
uint32_t data_offset,
183-
uint32_t data_length,
184+
size_t data_offset,
185+
size_t data_length,
184186
const void *p_data);
185187

186188
/**

cores/arduino/mbed/components/TARGET_PSA/inc/psa/storage_common.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ extern "C" {
3333
*/
3434
typedef uint32_t psa_storage_create_flags_t;
3535

36-
#define PSA_STORAGE_FLAG_NONE 0 /**< No flags to pass */
37-
#define PSA_STORAGE_FLAG_WRITE_ONCE (1 << 0) /**< The data associated with the uid will not be able to be modified or deleted. Intended to be used to set bits in `psa_storage_create_flags_t`*/
36+
#define PSA_STORAGE_FLAG_NONE 0 /**< No flags to pass */
37+
#define PSA_STORAGE_FLAG_WRITE_ONCE (1 << 0) /**< The data associated with the uid will not be able to be modified or deleted. Intended to be used to set bits in `psa_storage_create_flags_t`*/
38+
#define PSA_STORAGE_FLAG_NO_CONFIDENTIALITY (1 << 1) /**< The data associated with the uid is public and therefore does not require confidentiality. It therefore only needs to be integrity protected */
39+
#define PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION (1 << 2) /**< The data associated with the uid does not require replay protection. This may permit faster storage - but it permits an attecker with physical access to revert to an earlier version of the data. */
3840

3941
/** \brief A type for UIDs used for identifying data
4042
*/
@@ -44,7 +46,8 @@ typedef uint64_t psa_storage_uid_t;
4446
* \brief A container for metadata associated with a specific uid
4547
*/
4648
struct psa_storage_info_t {
47-
uint32_t size; /**< The size of the data associated with a uid **/
49+
size_t capacity; /**< The allocated capacity of the storage associated with a UID **/
50+
size_t size; /**< The size of the data associated with a uid **/
4851
psa_storage_create_flags_t flags; /**< The flags set when the uid was created **/
4952
};
5053

cores/arduino/mbed/components/TARGET_PSA/services/storage/common/psa_storage_common_impl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ typedef psa_status_t (*migrate_func_t)(mbed::KVStore *kvstore, const psa_storage
3636

3737
void psa_storage_handle_version(mbed::KVStore *kvstore, const char *version_key, const psa_storage_version_t *version,
3838
migrate_func_t migrate_func);
39-
psa_status_t psa_storage_set_impl(mbed::KVStore *kvstore, int32_t pid, psa_storage_uid_t uid, uint32_t data_length, const void *p_data, uint32_t kv_create_flags);
40-
psa_status_t psa_storage_get_impl(mbed::KVStore *kvstore, int32_t pid, psa_storage_uid_t uid, uint32_t data_offset, uint32_t data_length, void *p_data);
41-
psa_status_t psa_storage_get_info_impl(mbed::KVStore *kvstore, int32_t pid, psa_storage_uid_t uid, struct psa_storage_info_t *p_info);
39+
psa_status_t psa_storage_set_impl(mbed::KVStore *kvstore, int32_t pid, psa_storage_uid_t uid, size_t data_length, const void *p_data, uint32_t kv_create_flags);
40+
psa_status_t psa_storage_get_impl(mbed::KVStore *kvstore, int32_t pid, psa_storage_uid_t uid, size_t data_offset, size_t data_length, void *p_data, size_t *p_data_length);
41+
psa_status_t psa_storage_get_info_impl(mbed::KVStore *kvstore, int32_t pid, psa_storage_uid_t uid, struct psa_storage_info_t *p_info, uint32_t *kv_get_flags);
4242
psa_status_t psa_storage_remove_impl(mbed::KVStore *kvstore, int32_t pid, psa_storage_uid_t uid);
4343
psa_status_t psa_storage_reset_impl(mbed::KVStore *kvstore);
4444

cores/arduino/mbed/components/TARGET_PSA/services/storage/its/COMPONENT_PSA_SRV_IMPL/pits_impl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ extern "C"
2626
{
2727
#endif
2828

29-
psa_status_t psa_its_set_impl(int32_t pid, psa_storage_uid_t uid, uint32_t data_length, const void *p_data, psa_storage_create_flags_t create_flags);
30-
psa_status_t psa_its_get_impl(int32_t pid, psa_storage_uid_t uid, uint32_t data_offset, uint32_t data_length, void *p_data);
29+
psa_status_t psa_its_set_impl(int32_t pid, psa_storage_uid_t uid, size_t data_length, const void *p_data, psa_storage_create_flags_t create_flags);
30+
psa_status_t psa_its_get_impl(int32_t pid, psa_storage_uid_t uid, size_t data_offset, size_t data_length, void *p_data, size_t *p_data_length);
3131
psa_status_t psa_its_get_info_impl(int32_t pid, psa_storage_uid_t uid, struct psa_storage_info_t *p_info);
3232
psa_status_t psa_its_remove_impl(int32_t pid, psa_storage_uid_t uid);
3333
psa_status_t psa_its_reset_impl();

cores/arduino/mbed/components/TARGET_PSA/services/storage/its/psa_prot_internal_storage.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ MBED_DEPRECATED("PS specific types should not be used")
9797
* is invalid, for example is `NULL` or references memory the caller cannot access
9898
*/
9999
psa_status_t psa_its_set(psa_storage_uid_t uid,
100-
uint32_t data_length,
100+
size_t data_length,
101101
const void *p_data,
102102
psa_storage_create_flags_t create_flags);
103103

@@ -108,6 +108,7 @@ psa_status_t psa_its_set(psa_storage_uid_t uid,
108108
* \param[in] data_offset The starting offset of the data requested
109109
* \param[in] data_length the amount of data requested (and the minimum allocated size of the `p_data` buffer)
110110
* \param[out] p_data The buffer where the data will be placed upon successful completion
111+
* \param[out] p_data_length The actual amount of data returned
111112
112113
*
113114
* \return A status indicating the success/failure of the operation
@@ -120,9 +121,10 @@ psa_status_t psa_its_set(psa_storage_uid_t uid,
120121
* is invalid. For example is `NULL` or references memory the caller cannot access
121122
*/
122123
psa_status_t psa_its_get(psa_storage_uid_t uid,
123-
uint32_t data_offset,
124-
uint32_t data_length,
125-
void *p_data);
124+
size_t data_offset,
125+
size_t data_length,
126+
void *p_data,
127+
size_t *p_data_length);
126128

127129
/**
128130
* \brief Retrieve the metadata about the provided uid

cores/arduino/mbed/components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/test_utils.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ void find_ports(std::list<PortType> &matched_ports, std::list<PortType> &not_mat
115115
FormFactorType::pin_to_string(port.pins[i]), port.pins[i]);
116116
continue;
117117
}
118+
if (pinmap_list_has_peripheral(pinmap_restricted_peripherals(), port.peripheral)) {
119+
utest_printf("Skipping %s peripheral %i with pin %s (%i)\r\n", pin_type,
120+
port.peripheral, FormFactorType::pin_to_string(port.pins[i]), port.pins[i]);
121+
continue;
122+
}
118123
// skipp pin searching if single pin port type
119124
if (PortType::pin_count > 1) {
120125
find_port_pins<PortType, FormFactorType>(port);

cores/arduino/mbed/drivers/SPIMaster.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,15 +345,21 @@ class SPI : private NonCopyable<SPI> {
345345
enum SPIName { GlobalSPI };
346346
#endif
347347

348+
// All members of spi_peripheral_s must be initialized to make the structure
349+
// constant-initialized, and hence able to be omitted by the linker,
350+
// as SingletonPtr now relies on C++ constant-initialization. (Previously it
351+
// worked through C++ zero-initialization). And all the constants should be zero
352+
// to ensure it stays in the actual zero-init part of the image if used, avoiding
353+
// an initialized-data cost.
348354
struct spi_peripheral_s {
349355
/* Internal SPI name identifying the resources. */
350-
SPIName name;
356+
SPIName name = SPIName(0);
351357
/* Internal SPI object handling the resources' state. */
352-
spi_t spi;
358+
spi_t spi{};
353359
/* Used by lock and unlock for thread safety */
354360
SingletonPtr<PlatformMutex> mutex;
355361
/* Current user of the SPI */
356-
SPI *owner;
362+
SPI *owner = nullptr;
357363
#if DEVICE_SPI_ASYNCH && TRANSACTION_QUEUE_SIZE_SPI
358364
/* Queue of pending transfers */
359365
SingletonPtr<CircularBuffer<Transaction<SPI>, TRANSACTION_QUEUE_SIZE_SPI> > transaction_buffer;

cores/arduino/mbed/drivers/UARTSerial.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,6 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
255255

256256
private:
257257

258-
void wait_ms(uint32_t millisec);
259-
260258
/** SerialBase lock override */
261259
virtual void lock(void);
262260

cores/arduino/mbed/events/equeue/equeue_platform.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ extern "C" {
2626
#endif
2727

2828
#include <stdbool.h>
29+
#include <stdint.h>
2930

3031
// Currently supported platforms
3132
//
@@ -63,6 +64,7 @@ extern "C" {
6364
// limited by the accuracy of this tick.
6465
//
6566
// Must intentionally overflow to 0 after 2^32-1
67+
void equeue_tick_init(void);
6668
unsigned equeue_tick(void);
6769

6870

@@ -114,13 +116,19 @@ typedef struct equeue_sema {
114116
pthread_cond_t cond;
115117
bool signal;
116118
} equeue_sema_t;
117-
#elif defined(EQUEUE_PLATFORM_MBED) && defined(MBED_CONF_RTOS_PRESENT)
119+
#elif defined(EQUEUE_PLATFORM_MBED) && MBED_CONF_RTOS_API_PRESENT
118120
typedef struct equeue_sema {
119-
osEventFlagsId_t id;
120-
mbed_rtos_storage_event_flags_t mem;
121+
// We will actually store a C++ rtos:EventQueue in here;
122+
// attempt to match layout for storage, and assert size in equeue_mbed.cpp
123+
#if MBED_CONF_RTOS_PRESENT
124+
osEventFlagsId_t _id;
125+
mbed_rtos_storage_event_flags_t _obj_mem;
126+
#else
127+
uint32_t _flags;
128+
#endif
121129
} equeue_sema_t;
122130
#elif defined(EQUEUE_PLATFORM_MBED)
123-
typedef volatile int equeue_sema_t;
131+
typedef int equeue_sema_t;
124132
#endif
125133

126134
// Platform semaphore operations

cores/arduino/mbed/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include "AT_CellularStack.h"
2121
#include "CellularUtil.h"
22-
#include "mbed_wait_api.h"
22+
#include "rtos/ThisThread.h"
2323
#include "drivers/Timer.h"
2424

2525

cores/arduino/mbed/features/mbedtls/inc/mbedtls/platform.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ int mbedtls_platform_set_snprintf( int (*snprintf_func)( char * s, size_t n,
256256
* the destination buffer is too short.
257257
*/
258258
#if defined(MBEDTLS_PLATFORM_HAS_NON_CONFORMING_VSNPRINTF)
259+
#include <stdarg.h>
259260
/* For Older Windows (inc. MSYS2), we provide our own fixed implementation */
260261
int mbedtls_platform_win32_vsnprintf( char *s, size_t n, const char *fmt, va_list arg );
261262
#endif

cores/arduino/mbed/features/mbedtls/inc/mbedtls/version.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@
3939
* Major, Minor, Patchlevel
4040
*/
4141
#define MBEDTLS_VERSION_MAJOR 2
42-
#define MBEDTLS_VERSION_MINOR 17
42+
#define MBEDTLS_VERSION_MINOR 18
4343
#define MBEDTLS_VERSION_PATCH 0
4444

4545
/**
4646
* The single version number has the following structure:
4747
* MMNNPP00
4848
* Major version | Minor version | Patch version
4949
*/
50-
#define MBEDTLS_VERSION_NUMBER 0x02110000
51-
#define MBEDTLS_VERSION_STRING "2.17.0"
52-
#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.17.0"
50+
#define MBEDTLS_VERSION_NUMBER 0x02120000
51+
#define MBEDTLS_VERSION_STRING "2.18.0"
52+
#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.18.0"
5353

5454
#if defined(MBEDTLS_VERSION_C)
5555

cores/arduino/mbed/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto_its.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ psa_status_t psa_its_set(psa_storage_uid_t uid,
106106
psa_status_t psa_its_get(psa_storage_uid_t uid,
107107
uint32_t data_offset,
108108
uint32_t data_length,
109-
void *p_data);
109+
void *p_data,
110+
size_t *p_data_length);
110111

111112
/**
112113
* \brief Retrieve the metadata about the provided uid

cores/arduino/mbed/hal/gpio_api.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include <stdint.h>
2424
#include "device.h"
25+
#include "pinmap.h"
2526

2627
#ifdef __cplusplus
2728
extern "C" {
@@ -135,6 +136,18 @@ void gpio_init_out_ex(gpio_t *gpio, PinName pin, int value);
135136
*/
136137
void gpio_init_inout(gpio_t *gpio, PinName pin, PinDirection direction, PinMode mode, int value);
137138

139+
/** Get the pins that support all GPIO tests
140+
*
141+
* Return a PinMap array of pins that support GPIO. The
142+
* array is terminated with {NC, NC, 0}.
143+
*
144+
* Targets should override the weak implementation of this
145+
* function to provide the actual pinmap for GPIO testing.
146+
*
147+
* @return PinMap array
148+
*/
149+
const PinMap *gpio_pinmap(void);
150+
138151
/**@}*/
139152

140153
#ifdef __cplusplus

cores/arduino/mbed/hal/pinmap.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ typedef struct {
3838
const PinName *pins;
3939
} PinList;
4040

41+
typedef struct {
42+
uint32_t count;
43+
const int *peripheral;
44+
} PeripheralList;
45+
4146
void pin_function(PinName pin, int function);
4247
void pin_mode(PinName pin, PinMode mode);
4348

@@ -123,6 +128,15 @@ bool pinmap_find_peripheral_pins(const PinList *whitelist, const PinList *blackl
123128
*/
124129
bool pinmap_list_has_pin(const PinList *list, PinName pin);
125130

131+
/**
132+
* Check if the peripheral is in the list
133+
*
134+
* @param list peripheral list to check
135+
* @param peripheral peripheral to check for in the list
136+
* @return true if the peripheral is in the list, false otherwise
137+
*/
138+
bool pinmap_list_has_peripheral(const PeripheralList *list, int peripheral);
139+
126140
/**
127141
* Get the pin list of pins to avoid during testing
128142
*
@@ -139,6 +153,31 @@ bool pinmap_list_has_pin(const PinList *list, PinName pin);
139153
*/
140154
const PinList *pinmap_restricted_pins(void);
141155

156+
/**
157+
* Get the pin list of peripherals to avoid during testing
158+
*
159+
* The restricted peripheral list is used to indicate to testing
160+
* that a peripheral should be skipped due to some caveat about it.
161+
* For example, using the USB serial port during tests will interfere
162+
* with the test runner and should be avoided.
163+
*
164+
* Targets should override the weak implementation of this
165+
* function if they have peripherals which should be
166+
* skipped during testing.
167+
*
168+
* @note Some targets use the same value for multiple
169+
* different types of peripherals. For example SPI 0
170+
* and UART 0 may both be identified by the peripheral
171+
* value 0. If your target does this then do not
172+
* use this function to skip peripherals, as this will
173+
* unintentionally cause all peripherals with that value
174+
* to be skipped. Instead these entries should be removed
175+
* from the peripheral PinMap itself.
176+
*
177+
* @return Pointer to a peripheral list of peripheral to avoid
178+
*/
179+
const PeripheralList *pinmap_restricted_peripherals(void);
180+
142181
#ifdef TARGET_FF_ARDUINO
143182

144183
/**

cores/arduino/mbed/mbed.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "platform/mbed_version.h"
2020
#include "mbed_config.h"
2121

22-
#if MBED_CONF_RTOS_PRESENT
22+
#if MBED_CONF_RTOS_API_PRESENT
2323
#include "rtos/rtos.h"
2424
#endif
2525

@@ -88,8 +88,9 @@
8888
#include "platform/LocalFileSystem.h"
8989
#include "drivers/InterruptIn.h"
9090
#include "platform/mbed_wait_api.h"
91+
#include "platform/mbed_thread.h"
9192
#include "hal/sleep_api.h"
92-
#include "platform/Atomic.h"
93+
#include "platform/mbed_atomic.h"
9394
#include "platform/mbed_power_mgmt.h"
9495
#include "platform/mbed_rtc_time.h"
9596
#include "platform/mbed_poll.h"

0 commit comments

Comments
 (0)