Skip to content

Commit

Permalink
Merge pull request #30 from ARMmbed/release-2.1.0
Browse files Browse the repository at this point in the history
mbed-cloud-client-example 2.1.0
  • Loading branch information
teetak01 authored Dec 11, 2018
2 parents 528d3d5 + 5f00f24 commit ecedcd6
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Changelog for Pelion Device Management Client reference example application

## Release 2.0.1.1 (16.10.2018)
* No changes.
## Release 2.1.0 (11.12.2018)
* Updated to Mbed OS 5.10.3.

## Release 2.0.1 (12.10.2018)
* Application uses `wait_ms(int)` instead of `wait(float)`, this saves a bit on application size.
Expand Down
2 changes: 1 addition & 1 deletion mbed-cloud-client.lib
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://github.com/ARMmbed/mbed-cloud-client/#62de4b89d2350379278893f2f7a3ac937b4ae5f6
https://github.com/ARMmbed/mbed-cloud-client/#f84aeea5047569b5833caf84056e4b3aa429e12c
2 changes: 1 addition & 1 deletion mbed-os.lib
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
https://github.com/ARMmbed/mbed-os/#c53d51fe9220728bf8ed27afe7afc1ecc3f6f5d7
https://github.com/ARMmbed/mbed-os/#bf6f2c3c6434a6de9eb9511feffa5948b3d1f20f

18 changes: 17 additions & 1 deletion source/platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,23 @@ FILE(GLOB PLATFORM_SRC
"${CMAKE_CURRENT_SOURCE_DIR}/${OS_BRAND}/*.h"
"${CMAKE_CURRENT_SOURCE_DIR}/${OS_BRAND}/*.c"
"${CMAKE_CURRENT_SOURCE_DIR}/${OS_BRAND}/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/*.c"
)

# A source file which provides pal_plat_osGetRoTFromHW() implementation.
# By default the insecure version is used if PAL_USE_HW_ROT flag is set, so be warned.
# The compilation will also issue a warning, as will the first use of the insecure function.
# On "real" platform this needs to be replaced either here or in PAL with the platform specific one.
FILE(GLOB PLATFORM_ROT_SRC
"${CMAKE_CURRENT_SOURCE_DIR}/pal_plat_rot_insecure.c"
)


# Library for providing the mcc_* functions.
CREATE_LIBRARY(platformCommon "${PLATFORM_SRC}" "")

# Create a separate library from the ROT implementation. This is needed as
# the PAL's ROT module will need to be linked against some ROT implementation.
# This can be overridden either in PAL by setting PAL_USE_HW_ROT=0, which enables its own SOTP based
# ROT emulation, or by adding a platform specific pal_plat_rot.c code into PAL or by creating platformROT
# library and providing PAL_USE_PLATFORM_ROT_OVERRIDE flag to PAL's CMakeLists.txt.
CREATE_LIBRARY(platformCommonROT ${PLATFORM_ROT_SRC} "")
52 changes: 52 additions & 0 deletions source/platform/mbed-os/mcc_common_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ static bd_size_t mcc_platform_storage_size = 0;


/* local help functions. */
static void print_network_information(NetworkInterface *iface);
static int mcc_platform_reformat_partition(FileSystem *fs, BlockDevice* part);
static int mcc_platform_test_filesystem(FileSystem *fs, BlockDevice* part);
#if (MCC_PLATFORM_PARTITION_MODE == 1)
Expand Down Expand Up @@ -155,6 +156,7 @@ int mcc_platform_init_connection(void) {
nsapi_error_t e;
e = network_interface->connect();
if (e == NSAPI_ERROR_OK) {
print_network_information(network_interface);
return 0;
}
printf("Failed to connect! error=%d\n", e);
Expand All @@ -167,6 +169,7 @@ int mcc_platform_close_connection(void) {
if (network_interface) {
const nsapi_error_t err = network_interface->disconnect();
if (err == NSAPI_ERROR_OK) {
network_interface->attach(NULL);
network_interface = NULL;
return 0;
}
Expand Down Expand Up @@ -431,6 +434,36 @@ int mcc_platform_storage_init(void) {

int mcc_platform_init(void)
{
// On CortexM (3 and 4) the MCU has a write buffer, which helps in performance front,
// but has a side effect of making data access faults imprecise.
//
// So, if one gets a Mbed OS crash dump with following content, a re-build with
// "PLATFORM_DISABLE_WRITE_BUFFER=1" will help in getting the correct crash location.
//
// --8<---
// Crash Info:
// <..>
// Target and Fault Info:
// Forced exception, a fault with configurable priority has been escalated to HardFault
// Imprecise data access error has occurred
// --8<---
//
// This can't be enabled by default as then we would test with different system setup than customer
// and possible OS and driver issues might get pass the tests.
//
#if defined(PLATFORM_DISABLE_WRITE_BUFFER) && (PLATFORM_DISABLE_WRITE_BUFFER==1)

#if defined(TARGET_CORTEX_M)

SCnSCB->ACTLR |= SCnSCB_ACTLR_DISDEFWBUF_Msk;

tr_info("mcc_platform_init: disabled CPU write buffer, expect reduced performance");
#else
tr_info("mcc_platform_init: disabling CPU write buffer not possible or needed on this MCU");
#endif

#endif

return 0;
}

Expand Down Expand Up @@ -500,3 +533,22 @@ void mcc_platform_sw_build_info(void) {
printf("Mbed OS version <UNKNOWN>\n");
#endif
}

static void print_network_information(NetworkInterface *iface)
{
if (iface->ethInterface()) {
printf("Connected using Ethernet\n");
} else if (iface->wifiInterface()) {
printf("Connected using WiFi\n");
} else if (iface->meshInterface()) {
printf("Connected using Mesh\n");
} else if (iface->cellularBase()) {
printf("Connected using Cellular\n");
} else if (iface->emacInterface()) {
printf("Connected using Emac\n");
} else {
printf("Unknown interface\n");
}

printf("IP: %s\n", iface->get_ip_address());
}
4 changes: 4 additions & 0 deletions source/platform/pal_plat_rot_insecure.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@

#define TRACE_GROUP "ROT"

#if (PAL_USE_HW_ROT)

#define PAL_DEVICE_KEY_SIZE_IN_BYTES 16

//THIS CODE IS FOR TESTING PURPOSES ONLY. DO NOT USE IN PRODUCTION ENVIRONMENTS. REPLACE WITH A PROPER IMPLEMENTATION BEFORE USE
palStatus_t pal_plat_osGetRoTFromHW(uint8_t *keyBuf, size_t keyLenBytes)
{

#if defined (__CC_ARM) /* ARM compiler. */
#warning("PAL_INSECURE- You are using insecure Root Of Trust implementation, DO NOT USE IN PRODUCTION ENVIRONMENTS. REPLACE WITH A PROPER IMPLEMENTATION BEFORE USE")
#else
Expand Down Expand Up @@ -51,3 +54,4 @@ palStatus_t pal_plat_osGetRoTFromHW(uint8_t *keyBuf, size_t keyLenBytes)
return PAL_SUCCESS;
}

#endif

0 comments on commit ecedcd6

Please sign in to comment.