Skip to content

Release candidate 2 for mbed-os-5.9.0 #7122

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Jun 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c181003
tests-mbed_hal-common_tickers: Fix increment test case implementation
mprse May 28, 2018
39a08f7
OS version is not available in code, need a fix for this in next patc…
May 30, 2018
8de0876
Removed test that needs to be rearchitected due to subprocess limitat…
cmonr May 31, 2018
b5789f3
Modified memap tests to perform file path comparisons agnostic of the…
cmonr May 31, 2018
03a51d6
Added windows path separator to list of alphabet characters to ignore…
cmonr May 31, 2018
2c750c4
Updated local variable in memap/parse_test.py to be lower case.
cmonr May 31, 2018
54e2bae
Remove redundant Cryptocell libraries
May 31, 2018
78de5c3
Edit warning about FEATURE_UVISOR being deprecated
May 31, 2018
ac03c12
Update uvisor_deprecation.h
orenc17 May 31, 2018
5c8236e
set the tolerance to 5% if NO_SYSTICK is enabled
ithinuel May 31, 2018
998b4b8
us_ticker is not yet initialised at this stage
ithinuel May 30, 2018
e2fe4fa
Fix for filename capture not working
SenRamakri May 31, 2018
19f2a73
Fix for error report not printing when calling error API
SenRamakri May 31, 2018
01f7a33
Do not capture filename for release builds
SenRamakri May 31, 2018
5aaca08
fix not updating size of array
paul-szczepanek-arm May 29, 2018
ab51109
check for invalid param
paul-szczepanek-arm May 29, 2018
bf4a804
fix erroneous assert
paul-szczepanek-arm Jun 1, 2018
3fc2d33
Nordic FIX: place observers sequentially in flash.
pan- Jun 1, 2018
f4089a0
BLE Nordic: Initialize and teardown tls platform context
pan- Jun 1, 2018
f84c74a
Encapsulated Windows file separator for proper regex parsing
cmonr May 31, 2018
a7f73de
Added basestring import for proper string concatenation in Py3
cmonr May 31, 2018
6daf367
Modified LazyDict to inherit from object instead of dict, and removed…
cmonr May 31, 2018
e8661f5
Sets module no longer needed to use set()
cmonr May 31, 2018
25c49f2
Modified memap path separator parsing to support Py3. Had to remove p…
Jun 1, 2018
cc5a36b
Modified IntelHex tofile parameter to use path. Py3 open(...) returns…
cmonr Jun 1, 2018
97028c5
Removed extraneous file open
cmonr Jun 4, 2018
babfb00
Use Notifier API when building mbed2
theotherjimmy Jun 5, 2018
d743f7f
Updated lines missed during Notifier API migration
cmonr Jun 5, 2018
3e8488a
build: fix notifier typo and passing to builds API
0xc0170 May 15, 2018
d3e48c2
test: remove verbose from buil libs calls
0xc0170 May 16, 2018
c9338d1
Fix RTOS-less build failed with cmsis/RTE_Components.h
ccli8 May 30, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions TESTS/mbed_drivers/timer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ extern uint32_t SystemCoreClock;
* 1000 ms delay: tolerance = 20500 us
*
* */
#define DELTA_US(delay_ms) (500 + (delay_ms) * US_PER_MSEC / 50)
#define DELTA_MS(delay_ms) (1 + ((delay_ms) * US_PER_MSEC / 50 / US_PER_MSEC))
#define DELTA_S(delay_ms) (0.000500f + (((float)(delay_ms)) / MSEC_PER_SEC / 50))
#ifdef NO_SYSTICK
#define TOLERANCE 5
#else
#define TOLERANCE 2
#endif

#define DELTA_US(delay_ms) (500 + (delay_ms) * US_PER_MSEC * TOLERANCE / 100)
#define DELTA_MS(delay_ms) (1 + (delay_ms) * TOLERANCE / 100)
#define DELTA_S(delay_ms) (0.000500f + ((float)(delay_ms)) * ((float)(TOLERANCE) / 100.f) / MSEC_PER_SEC)

#define TICKER_FREQ_1MHZ 1000000
#define TICKER_BITS 32
Expand Down
28 changes: 19 additions & 9 deletions TESTS/mbed_hal/common_tickers/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,20 +344,34 @@ void ticker_increment_test(void)
} else { // high frequency tickers

uint32_t num_of_cycles = NUM_OF_CYCLES;
const uint32_t repeat_count = 20;
const uint32_t max_inc_val = 100;

uint32_t base_tick_count = count_ticks(num_of_cycles, 1);
uint32_t next_tick_count = base_tick_count;
uint32_t inc_val = 0;
uint32_t repeat_cnt = 0;

while (inc_val < 100) {

while (inc_val < max_inc_val) {
next_tick_count = count_ticks(num_of_cycles + inc_val, 1);

if (next_tick_count == base_tick_count) {

/* Same tick count, so increase num of cycles. */
inc_val++;
/* Same tick count, so repeat 20 times and than
* increase num of cycles by 1.
*/
if (repeat_cnt == repeat_count) {
inc_val++;
repeat_cnt = 0;
}

repeat_cnt++;
} else {
/* Check if we got 1 tick diff. */
if (next_tick_count - base_tick_count == 1 ||
base_tick_count - next_tick_count == 1) {
break;
}

/* It is possible that the difference between base and next
* tick count on some platforms is greater that 1, in this case we need
Expand All @@ -366,12 +380,8 @@ void ticker_increment_test(void)
*/
num_of_cycles /= 2;
inc_val = 0;
repeat_cnt = 0;
base_tick_count = count_ticks(num_of_cycles, 1);

if (next_tick_count - base_tick_count == 1 ||
base_tick_count - next_tick_count == 1) {
break;
}
}
}

Expand Down
4 changes: 0 additions & 4 deletions TESTS/mbed_platform/stats_sys/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ void test_sys_info()
mbed_stats_sys_t stats;
mbed_stats_sys_get(&stats);

#if defined(MBED_VERSION)
TEST_ASSERT_NOT_EQUAL(0, stats.os_version);
#endif

#if defined(__CORTEX_M)
TEST_ASSERT_NOT_EQUAL(0, stats.cpu_id);
#endif
Expand Down
2 changes: 2 additions & 0 deletions cmsis/RTE_Components.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

#define CMSIS_device_header <cmsis.h>

#if defined(MBED_CONF_RTOS_PRESENT)
#include "mbed_rtx_conf.h"
#endif
#include "mbed_cmsis_conf.h"

#endif
26 changes: 15 additions & 11 deletions features/FEATURE_BLE/ble/generic/SecurityDb.h
Original file line number Diff line number Diff line change
Expand Up @@ -584,28 +584,32 @@ class SecurityDb {
WhitelistDbCb_t cb,
::Gap::Whitelist_t *whitelist
) {
for (size_t i = 0; i < get_entry_count() && i < whitelist->capacity; i++) {
for (size_t i = 0; i < get_entry_count() && whitelist->size < whitelist->capacity; i++) {
entry_handle_t db_handle = get_entry_handle_by_index(i);
SecurityDistributionFlags_t* flags = get_distribution_flags(db_handle);

if (!flags) {
continue;
}

SecurityEntryIdentity_t* identity = read_in_entry_peer_identity(db_handle);
if (!identity) {
continue;
}

memcpy(
whitelist->addresses[whitelist->size].address,
identity->identity_address.data(),
sizeof(BLEProtocol::AddressBytes_t)
);

if (flags->peer_address_is_public) {
whitelist->addresses[i].type = BLEProtocol::AddressType::PUBLIC;
whitelist->addresses[whitelist->size].type = BLEProtocol::AddressType::PUBLIC;
} else {
whitelist->addresses[i].type = BLEProtocol::AddressType::RANDOM_STATIC;
whitelist->addresses[whitelist->size].type = BLEProtocol::AddressType::RANDOM_STATIC;
}

SecurityEntryIdentity_t* identity = read_in_entry_peer_identity(db_handle);
if (identity) {
memcpy(
whitelist->addresses[i].address,
identity->identity_address.data(),
sizeof(BLEProtocol::AddressBytes_t)
);
}
whitelist->size++;
}

cb(whitelist);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ ble_error_t GenericSecurityManager::purgeAllBondingState(void) {
ble_error_t GenericSecurityManager::generateWhitelistFromBondTable(Gap::Whitelist_t *whitelist) const {
if (!_db) return BLE_ERROR_INITIALIZATION_INCOMPLETE;
if (eventHandler) {
if (!whitelist) {
return BLE_ERROR_INVALID_PARAM;
}
_db->generate_whitelist_from_bond_table(
mbed::callback(eventHandler, &::SecurityManager::EventHandler::whitelistFromBondTable),
whitelist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ void nRF5xGap::on_connection(Gap::Handle_t handle, const ble_gap_evt_connected_t
const resolving_list_entry_t* entry = get_sm().resolve_address(
evt.peer_addr.addr
);
MBED_ASSERT(entry == NULL);
MBED_ASSERT(entry != NULL);

peer_addr_type = convert_identity_address(entry->peer_identity_address_type);
peer_address = entry->peer_identity_address.data();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace vendor {
namespace nordic {

CryptoToolbox::CryptoToolbox() : _initialized(false) {
mbedtls_platform_setup(&_platform_context);
mbedtls_entropy_init(&_entropy_context);
mbedtls_ecp_group_init(&_group);
int err = mbedtls_ecp_group_load(
Expand All @@ -59,6 +60,7 @@ CryptoToolbox::CryptoToolbox() : _initialized(false) {
CryptoToolbox::~CryptoToolbox() {
mbedtls_ecp_group_free(&_group);
mbedtls_entropy_free(&_entropy_context);
mbedtls_platform_teardown(&_platform_context);
}

bool CryptoToolbox::generate_keys(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class CryptoToolbox : mbed::NonCopyable<CryptoToolbox> {
void swap_endian(uint8_t* buf, size_t len);

bool _initialized;
mbedtls_platform_context _platform_context;
mbedtls_entropy_context _entropy_context;
mbedtls_ecp_group _group;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
#define __UVISOR_DEPRECATION_H__

#if defined(UVISOR_PRESENT) && UVISOR_PRESENT == 1
#warning "Warning: You are using FEATURE_UVISOR, which is unsupported as of Mbed OS 5.9."
#warning "Warning: uVisor is superseded by the Secure Partition Manager (SPM) defined in the ARM Platform Security Architecture (PSA). \
uVisor is deprecated as of Mbed OS 5.10, and being replaced by a native PSA-compliant implementation of SPM."
#endif

#endif // __UVISOR_DEPRECATION_H__
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
38 changes: 17 additions & 21 deletions platform/mbed_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ static mbed_error_ctx first_error_ctx = {0};
static mbed_error_ctx last_error_ctx = {0};
static mbed_error_hook_t error_hook = NULL;
static void print_error_report(mbed_error_ctx *ctx, const char *);
static mbed_error_status_t handle_error(mbed_error_status_t error_status, unsigned int error_value, const char *filename, int line_number);

//Helper function to halt the system
static void mbed_halt_system(void)
Expand All @@ -72,20 +73,23 @@ WEAK void error(const char* format, ...) {
if (error_in_progress) {
return;
}

//Call handle_error/print_error_report permanently setting error_in_progress flag
handle_error(MBED_ERROR_UNKNOWN, 0, NULL, 0);
print_error_report(&last_error_ctx, "Fatal Run-time error");
error_in_progress = 1;

#ifndef NDEBUG
va_list arg;
va_start(arg, format);
mbed_error_vfprintf(format, arg);
MBED_ERROR(MBED_ERROR_UNKNOWN, "Fatal Run-time Error");
va_end(arg);
#endif
exit(1);
}

//Set an error status with the error handling system
mbed_error_status_t handle_error(mbed_error_status_t error_status, const char *error_msg, unsigned int error_value, const char *filename, int line_number)
static mbed_error_status_t handle_error(mbed_error_status_t error_status, unsigned int error_value, const char *filename, int line_number)
{
mbed_error_ctx current_error_ctx;

Expand Down Expand Up @@ -129,16 +133,10 @@ mbed_error_status_t handle_error(mbed_error_status_t error_status, const char *e

#ifdef MBED_CONF_ERROR_FILENAME_CAPTURE_ENABLED
//Capture filename/linenumber if provided
//Index for tracking error_filename
int idx = 0;

if(NULL != filename) {
while(idx < MBED_CONF_MAX_ERROR_FILENAME_LEN && (filename[idx] != '\0')) {
current_error_ctx.error_filename[idx] = filename[idx];
idx++;
}
current_error_ctx.error_line_number = line_number;
}
//Index for tracking error_filename
memset(&current_error_ctx.error_filename, 0, MBED_CONF_MAX_ERROR_FILENAME_LEN);
strncpy(current_error_ctx.error_filename, filename, MBED_CONF_MAX_ERROR_FILENAME_LEN);
current_error_ctx.error_line_number = line_number;
#endif

//Capture the fist system error and store it
Expand Down Expand Up @@ -188,14 +186,14 @@ int mbed_get_error_count(void)
//Sets a fatal error
mbed_error_status_t mbed_warning(mbed_error_status_t error_status, const char *error_msg, unsigned int error_value, const char *filename, int line_number)
{
return handle_error(error_status, error_msg, error_value, filename, line_number);
return handle_error(error_status, error_value, filename, line_number);
}

//Sets a fatal error
WEAK mbed_error_status_t mbed_error(mbed_error_status_t error_status, const char *error_msg, unsigned int error_value, const char *filename, int line_number)
{
//set the error reported and then halt the system
if( MBED_SUCCESS != handle_error(error_status, error_msg, error_value, filename, line_number) )
if( MBED_SUCCESS != handle_error(error_status, error_value, filename, line_number) )
return MBED_ERROR_FAILED_OPERATION;

//On fatal errors print the error context/report
Expand Down Expand Up @@ -359,7 +357,7 @@ static void print_error_report(mbed_error_ctx *ctx, const char *error_msg)
uint32_t error_code = MBED_GET_ERROR_CODE(ctx->error_status);
uint32_t error_module = MBED_GET_ERROR_MODULE(ctx->error_status);

mbed_error_printf("\n\n++ MbedOS Error Info ++\nError Status: 0x%x Code: %d Entity: %d\nError Message: ", ctx->error_status, error_code, error_module);
mbed_error_printf("\n\n++ MbedOS Error Info ++\nError Status: 0x%x Code: %d Module: %d\nError Message: ", ctx->error_status, error_code, error_module);

//Report error info based on error code, some errors require different
//error_vals[1] contains the error code
Expand Down Expand Up @@ -410,12 +408,10 @@ static void print_error_report(mbed_error_ctx *ctx, const char *error_msg)
}
mbed_error_printf(error_msg, NULL);
mbed_error_printf("\nLocation: 0x%x", ctx->error_address);
#ifdef MBED_CONF_ERROR_FILENAME_CAPTURE_ENABLED
if(NULL != error_ctx->error_filename) {
#if defined(MBED_CONF_ERROR_FILENAME_CAPTURE_ENABLED) && !defined(NDEBUG)
if(NULL != ctx->error_filename) {
//for string, we must pass address of a ptr which has the address of the string
uint32_t *file_name = (uint32_t *)&error_ctx->error_filename[0];
mbed_error_printf("\nFile:%s", &file_name);
mbed_error_printf("+0x%x", ctx->error_line_number);
mbed_error_printf("\nFile:%s+%d", ctx->error_filename, ctx->error_line_number);
}
#endif

Expand All @@ -429,7 +425,7 @@ static void print_error_report(mbed_error_ctx *ctx, const char *error_msg)
#endif //TARGET_CORTEX_M
}

mbed_error_printf("\n-- MbedOS Error Info --");
mbed_error_printf("\n-- MbedOS Error Info --\n");
}


Expand Down
32 changes: 21 additions & 11 deletions platform/mbed_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,17 @@ typedef int mbed_error_status_t;
* Since this macro is a wrapper for mbed_warning API callers should process the return value from this macro which is the return value from calling mbed_error API.
*
*/
#ifdef MBED_CONF_ERROR_FILENAME_CAPTURE_ENABLED
#define MBED_WARNING1( error_status, error_msg, error_value ) mbed_warning( error_status, (const char *)error_msg, (uint32_t)error_value, (const char *)MBED_FILENAME, __LINE__ )
#define MBED_WARNING( error_status, error_msg ) mbed_warning( error_status, (const char *)error_msg, (uint32_t)0 , (const char *)MBED_FILENAME, __LINE__ )
#ifdef NDEBUG
#define MBED_WARNING1( error_status, error_msg, error_value ) mbed_warning( error_status, (const char *)NULL, (uint32_t)error_value, NULL, 0 )
#define MBED_WARNING( error_status, error_msg ) mbed_warning( error_status, (const char *)NULL, (uint32_t)0, NULL, 0 )
#else
#define MBED_WARNING1( error_status, error_msg, error_value ) mbed_warning( error_status, (const char *)error_msg, (uint32_t)error_value, NULL, 0 )
#define MBED_WARNING( error_status, error_msg ) mbed_warning( error_status, (const char *)error_msg, (uint32_t)0, NULL, 0 )
#if defined(MBED_CONF_ERROR_FILENAME_CAPTURE_ENABLED)
#define MBED_WARNING1( error_status, error_msg, error_value ) mbed_warning( error_status, (const char *)error_msg, (uint32_t)error_value, (const char *)MBED_FILENAME, __LINE__ )
#define MBED_WARNING( error_status, error_msg ) mbed_warning( error_status, (const char *)error_msg, (uint32_t)0 , (const char *)MBED_FILENAME, __LINE__ )
#else
#define MBED_WARNING1( error_status, error_msg, error_value ) mbed_warning( error_status, (const char *)error_msg, (uint32_t)error_value, NULL, 0 )
#define MBED_WARNING( error_status, error_msg ) mbed_warning( error_status, (const char *)error_msg, (uint32_t)0, NULL, 0 )
#endif
#endif

/**
Expand All @@ -170,13 +175,18 @@ typedef int mbed_error_status_t;
* Since this macro is a wrapper for mbed_error API callers should process the return value from this macro which is the return value from calling mbed_error API.
*
*/
#ifdef MBED_CONF_ERROR_FILENAME_CAPTURE_ENABLED
#define MBED_ERROR1( error_status, error_msg, error_value ) mbed_error( error_status, (const char *)error_msg, (uint32_t)error_value, (const char *)MBED_FILENAME, __LINE__ )
#define MBED_ERROR( error_status, error_msg ) mbed_error( error_status, (const char *)error_msg, (uint32_t)0 , (const char *)MBED_FILENAME, __LINE__ )
#ifdef NDEBUG
#define MBED_ERROR1( error_status, error_msg, error_value ) mbed_error( error_status, (const char *)NULL, (uint32_t)error_value, NULL, 0 )
#define MBED_ERROR( error_status, error_msg ) mbed_error( error_status, (const char *)NULL, (uint32_t)0 , NULL, 0 )
#else
#define MBED_ERROR1( error_status, error_msg, error_value ) mbed_error( error_status, (const char *)error_msg, (uint32_t)error_value, NULL, 0 )
#define MBED_ERROR( error_status, error_msg ) mbed_error( error_status, (const char *)error_msg, (uint32_t)0 , NULL, 0 )
#endif
#if defined(MBED_CONF_ERROR_FILENAME_CAPTURE_ENABLED)
#define MBED_ERROR1( error_status, error_msg, error_value ) mbed_error( error_status, (const char *)error_msg, (uint32_t)error_value, (const char *)MBED_FILENAME, __LINE__ )
#define MBED_ERROR( error_status, error_msg ) mbed_error( error_status, (const char *)error_msg, (uint32_t)0 , (const char *)MBED_FILENAME, __LINE__ )
#else
#define MBED_ERROR1( error_status, error_msg, error_value ) mbed_error( error_status, (const char *)error_msg, (uint32_t)error_value, NULL, 0 )
#define MBED_ERROR( error_status, error_msg ) mbed_error( error_status, (const char *)error_msg, (uint32_t)0 , NULL, 0 )
#endif
#endif

//Error Type definition
/** mbed_error_type_t definition
Expand Down
3 changes: 0 additions & 3 deletions platform/mbed_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ void mbed_stats_sys_get(mbed_stats_sys_t *stats)
memset(stats, 0, sizeof(mbed_stats_sys_t));

#if defined(MBED_SYS_STATS_ENABLED)
#if defined(MBED_VERSION)
stats->os_version = MBED_VERSION;
#endif
#if defined(__CORTEX_M)
stats->cpu_id = SCB->CPUID;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE {
ER_IROM1 MBED_APP_START MBED_APP_SIZE {
*.o (RESET, +First)
*(InRoot$$Sections)
__start_sdh_soc_observers *(sdh_soc_observers) __stop_sdh_soc_observers
__start_sdh_stack_observers *(sdh_stack_observers) __stop_sdh_stack_observers
__start_sdh_req_observers *(sdh_req_observers) __stop_sdh_req_observers
__start_sdh_state_observers *(sdh_state_observers) __stop_sdh_state_observers
__start_sdh_ble_observers *(sdh_ble_observers) __stop_sdh_ble_observers
.ANY (+RO)
}
RW_IRAM0 MBED_RAM0_START UNINIT MBED_RAM0_SIZE { ;no init section
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE {
ER_IROM1 MBED_APP_START MBED_APP_SIZE {
*.o (RESET, +First)
*(InRoot$$Sections)
__start_sdh_soc_observers *(sdh_soc_observers) __stop_sdh_soc_observers
__start_sdh_stack_observers *(sdh_stack_observers) __stop_sdh_stack_observers
__start_sdh_req_observers *(sdh_req_observers) __stop_sdh_req_observers
__start_sdh_state_observers *(sdh_state_observers) __stop_sdh_state_observers
__start_sdh_ble_observers *(sdh_ble_observers) __stop_sdh_ble_observers
.ANY (+RO)
}
RW_IRAM0 MBED_RAM0_START UNINIT MBED_RAM0_SIZE { ;no init section
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void ublox_mdm_init(void)
// Can't use wait_ms() as RTOS isn't initialised yet
//wait_ms(50); // when USB cable is inserted the interface chip issues
// Here's the code from the non-RTOS version
us_ticker_init();
uint32_t start = us_ticker_read();
while ((us_ticker_read() - start) < 50000);
}
Expand Down
Loading