Skip to content

Commit

Permalink
Merge pull request #6579 from ARMmbed/release-candidate
Browse files Browse the repository at this point in the history
Release candidate for mbed-os-5.8.2
  • Loading branch information
0xc0170 committed Apr 10, 2018
2 parents addec7b + 153b137 commit f9ee4e8
Show file tree
Hide file tree
Showing 306 changed files with 35,760 additions and 3,563 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,9 @@ matrix:
STATUSM="$STATUSM ($(python -c "print '%+.2f' % (100*($CURR-$PREV)/$PREV.0)")%)"
fi
- bash -c "$STATUS" success "$STATUSM"

- env:
- NAME=gitattributestest
script:
# Check that no changes after clone. This check that .gitattributes is used right way.
- git diff --exit-code
144 changes: 144 additions & 0 deletions TESTS/mbed_drivers/crc/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@

/* mbed Microcontroller Library
* Copyright (c) 2018 ARM Limited
*
* 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.
*/

#include "utest/utest.h"
#include "unity/unity.h"
#include "greentea-client/test_env.h"

#include "mbed.h"

using namespace utest::v1;

void test_supported_polynomials()
{
char test[] = "123456789";
uint32_t crc;

{
MbedCRC<POLY_7BIT_SD, 7> ct;
TEST_ASSERT_EQUAL(0, ct.compute((void *)test, strlen((const char*)test), &crc));
TEST_ASSERT_EQUAL(0xEA, crc);
}
{
MbedCRC<POLY_8BIT_CCITT, 8> ct;
TEST_ASSERT_EQUAL(0, ct.compute((void *)test, strlen((const char*)test), &crc));
TEST_ASSERT_EQUAL(0xF4, crc);
}
{
MbedCRC<POLY_16BIT_CCITT, 16> ct;
TEST_ASSERT_EQUAL(0, ct.compute((void *)test, strlen((const char*)test), &crc));
TEST_ASSERT_EQUAL(0x29B1, crc);
}
{
MbedCRC<POLY_16BIT_IBM, 16> ct;
TEST_ASSERT_EQUAL(0, ct.compute((void *)test, strlen((const char*)test), &crc));
TEST_ASSERT_EQUAL(0xBB3D, crc);
}
{
MbedCRC<POLY_32BIT_ANSI, 32> ct;
TEST_ASSERT_EQUAL(0, ct.compute((void *)test, strlen((const char*)test), &crc));
TEST_ASSERT_EQUAL(0xCBF43926, crc);
}
}

void test_partial_crc()
{
char test[] = "123456789";
uint32_t crc;
{
MbedCRC<POLY_16BIT_CCITT, 16> ct;
TEST_ASSERT_EQUAL(0, ct.compute_partial_start(&crc));
TEST_ASSERT_EQUAL(0, ct.compute_partial((void *)&test, 4, &crc));
TEST_ASSERT_EQUAL(0, ct.compute_partial((void *)&test[4], 5, &crc));
TEST_ASSERT_EQUAL(0, ct.compute_partial_stop(&crc));

TEST_ASSERT_EQUAL(0x29B1, crc);
}
}

void test_sd_crc()
{
MbedCRC<POLY_7BIT_SD, 7> crc7;
uint32_t crc;
char test[512];

test[0] = 0x40;
test[1] = 0x00;
test[2] = 0x00;
test[3] = 0x00;
test[4] = 0x00;
TEST_ASSERT_EQUAL(0, crc7.compute((void *)test, 5, &crc));
crc = (crc | 0x1 ) & 0xFF;
TEST_ASSERT_EQUAL(0x95, crc);

test[0] = 0x48;
test[1] = 0x00;
test[2] = 0x00;
test[3] = 0x01;
test[4] = 0xAA;
TEST_ASSERT_EQUAL(0, crc7.compute((void *)test, 5, &crc));
crc = (crc | 0x1 ) & 0xFF;
TEST_ASSERT_EQUAL(0x87, crc);

test[0] = 0x51;
test[1] = 0x00;
test[2] = 0x00;
test[3] = 0x00;
test[4] = 0x00;
TEST_ASSERT_EQUAL(0, crc7.compute((void *)test, 5, &crc));
crc = (crc | 0x1 ) & 0xFF;
TEST_ASSERT_EQUAL(0x55, crc);

MbedCRC<POLY_16BIT_CCITT, 16> crc16(0, 0, false, false);
memset(test, 0xFF, 512);
TEST_ASSERT_EQUAL(0, crc16.compute((void *)test, 512, &crc));
TEST_ASSERT_EQUAL(0x7FA1, crc);
}

void test_any_polynomial()
{
char test[] = "123456789";
uint32_t crc;
{
MbedCRC<0x3D65, 16> ct(0x0, 0xFFFF, 0, 0);
TEST_ASSERT_EQUAL(0, ct.compute((void *)test, strlen((const char*)test), &crc));
TEST_ASSERT_EQUAL(0xC2B7, crc);
}
{
MbedCRC<0x1EDC6F41, 32> ct(0xFFFFFFFF, 0xFFFFFFFF, 1, 1);
TEST_ASSERT_EQUAL(0, ct.compute((void *)test, strlen((const char*)test), &crc));
TEST_ASSERT_EQUAL(0xE3069283, crc);
}
}

Case cases[] = {
Case("Test supported polynomials", test_supported_polynomials),
Case("Test partial CRC", test_partial_crc),
Case("Test SD CRC polynomials", test_sd_crc),
Case("Test not supported polynomials", test_any_polynomial)
};

utest::v1::status_t greentea_test_setup(const size_t number_of_cases) {
GREENTEA_SETUP(15, "default_auto");
return greentea_test_setup_handler(number_of_cases);
}

Specification specification(greentea_test_setup, cases, greentea_test_teardown_handler);

int main() {
Harness::run(specification);
}
3 changes: 2 additions & 1 deletion doxyfile_options
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,8 @@ EXCLUDE_PATTERNS = */tools/* \
*/features/FEATURE_COMMON_PAL/* \
*/features/FEATURE_LWIP/* \
*/features/FEATURE_UVISOR/* \
*/features/nanostack/* \
*/features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/* \
*/features/nanostack/FEATURE_NANOSTACK/coap-service/* \
*/ble/generic/* \
*/ble/pal/*

Expand Down
2 changes: 1 addition & 1 deletion doxygen_options.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"PREDEFINED": "DOXYGEN_ONLY DEVICE_ANALOGIN DEVICE_ANALOGOUT DEVICE_CAN DEVICE_ETHERNET DEVICE_EMAC DEVICE_FLASH DEVICE_I2C DEVICE_I2CSLAVE DEVICE_I2C_ASYNCH DEVICE_INTERRUPTIN DEVICE_ITM DEVICE_LOWPOWERTIMER DEVICE_PORTIN DEVICE_PORTINOUT DEVICE_PORTOUT DEVICE_PWMOUT DEVICE_RTC DEVICE_TRNG DEVICE_SERIAL DEVICE_SERIAL_ASYNCH DEVICE_SERIAL_FC DEVICE_SLEEP DEVICE_SPI DEVICE_SPI_ASYNCH DEVICE_SPISLAVE DEVICE_STORAGE \"MBED_DEPRECATED_SINCE(f, g)=\" \"MBED_ENABLE_IF_CALLBACK_COMPATIBLE(F, M)=\" \"MBED_DEPRECATED(s)=\"",
"EXPAND_AS_DEFINED": "",
"SKIP_FUNCTION_MACROS": "NO",
"EXCLUDE_PATTERNS": "*/tools/* */targets/* */features/mbedtls/* */features/storage/* */features/unsupported/* */BUILD/* */rtos/TARGET_CORTEX/rtx*/* */cmsis/* */features/FEATURE_COMMON_PAL/* */features/FEATURE_LWIP/* */features/FEATURE_UVISOR/* */features/nanostack/* */ble/generic/* */ble/pal/*"
"EXCLUDE_PATTERNS": "*/tools/* */targets/* */features/mbedtls/* */features/storage/* */features/unsupported/* */BUILD/* */rtos/TARGET_CORTEX/rtx*/* */cmsis/* */features/FEATURE_COMMON_PAL/* */features/FEATURE_LWIP/* */features/FEATURE_UVISOR/* */features/nanostack/FEATURE_NANOSTACK/sal-stack-nanostack/* */features/nanostack/FEATURE_NANOSTACK/coap-service/* */ble/generic/* */ble/pal/*"
}
16 changes: 16 additions & 0 deletions drivers/InterruptManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace mbed {
/** \addtogroup drivers */

/** Use this singleton if you need to chain interrupt handlers.
* @deprecated Do not use this class. This class is not part of the public API of mbed-os and is being removed in the future.
*
* @note Synchronization level: Thread safe
*
Expand Down Expand Up @@ -57,6 +58,8 @@ namespace mbed {
class InterruptManager : private NonCopyable<InterruptManager> {
public:
/** Get the instance of InterruptManager Class
* @deprecated
* Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.
*
* @return the only instance of this class
*/
Expand All @@ -65,12 +68,17 @@ class InterruptManager : private NonCopyable<InterruptManager> {
static InterruptManager* get();

/** Destroy the current instance of the interrupt manager
* @deprecated
* Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.
*
*/
MBED_DEPRECATED_SINCE("mbed-os-5.6", "This class is not part of the "
"public API of mbed-os and is being removed in the future.")
static void destroy();

/** Add a handler for an interrupt at the end of the handler list
* @deprecated
* Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.
*
* @param function the handler to add
* @param irq interrupt number
Expand All @@ -86,6 +94,8 @@ class InterruptManager : private NonCopyable<InterruptManager> {
}

/** Add a handler for an interrupt at the beginning of the handler list
* @deprecated
* Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.
*
* @param function the handler to add
* @param irq interrupt number
Expand All @@ -101,6 +111,8 @@ class InterruptManager : private NonCopyable<InterruptManager> {
}

/** Add a handler for an interrupt at the end of the handler list
* @deprecated
* Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.
*
* @param tptr pointer to the object that has the handler function
* @param mptr pointer to the actual handler function
Expand All @@ -118,6 +130,8 @@ class InterruptManager : private NonCopyable<InterruptManager> {
}

/** Add a handler for an interrupt at the beginning of the handler list
* @deprecated
* Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.
*
* @param tptr pointer to the object that has the handler function
* @param mptr pointer to the actual handler function
Expand All @@ -135,6 +149,8 @@ class InterruptManager : private NonCopyable<InterruptManager> {
}

/** Remove a handler from an interrupt
* @deprecated
* Do not use this function, this class is not part of the public API of mbed-os and is being removed in the future.
*
* @param handler the function object for the handler to remove
* @param irq the interrupt number
Expand Down
7 changes: 0 additions & 7 deletions drivers/MbedCRC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ namespace mbed {

/* Default values for different types of polynomials
*/
template <uint32_t polynomial, uint8_t width>
MbedCRC<polynomial, width>::MbedCRC(uint32_t initial_xor, uint32_t final_xor, bool reflect_data, bool reflect_remainder):
_initial_value(initial_xor), _final_xor(final_xor), _reflect_data(reflect_data), _reflect_remainder(reflect_remainder), _crc_table(NULL)
{
mbed_crc_ctor();
}

template<>
MbedCRC<POLY_32BIT_ANSI, 32>::MbedCRC(uint32_t initial_xor, uint32_t final_xor, bool reflect_data, bool reflect_remainder):
_initial_value(initial_xor), _final_xor(final_xor), _reflect_data(reflect_data), _reflect_remainder(reflect_remainder),
Expand Down
7 changes: 6 additions & 1 deletion drivers/MbedCRC.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,12 @@ class MbedCRC
* polynomials with different intial/final/reflect values
*
*/
MbedCRC(uint32_t initial_xor, uint32_t final_xor, bool reflect_data, bool reflect_remainder);
MbedCRC(uint32_t initial_xor, uint32_t final_xor, bool reflect_data, bool reflect_remainder) :
_initial_value(initial_xor), _final_xor(final_xor), _reflect_data(reflect_data),
_reflect_remainder(reflect_remainder), _crc_table(NULL)
{
mbed_crc_ctor();
}
MbedCRC();
virtual ~MbedCRC()
{
Expand Down
4 changes: 3 additions & 1 deletion drivers/Timeout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
namespace mbed {

void Timeout::handler() {
_function.call();
Callback<void()> local = _function;
detach();
local.call();
}

} // namespace mbed
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef PAL_MEMORY_SECURITY_DB_H_
#define PAL_MEMORY_SECURITY_DB_H_

#include "SecurityDB.h"
#include "SecurityDb.h"

namespace ble {
namespace pal {
Expand Down
4 changes: 2 additions & 2 deletions features/FEATURE_BLE/ble/pal/SecurityDb.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ struct SecurityEntryIdentity_t {
};

/**
* SecurityDB holds the state for active connections and bonded devices.
* SecurityDb holds the state for active connections and bonded devices.
* Keys can be stored in NVM and are returned via callbacks.
* SecurityDB is responsible for serialising any requests and keeping
* SecurityDb is responsible for serialising any requests and keeping
* the store in a consistent state.
* Active connections state must be returned immediately.
*/
Expand Down
2 changes: 1 addition & 1 deletion features/FEATURE_BLE/targets/TARGET_CORDIO/CordioBLE.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "CordioPalGenericAccessService.h"
#include "ble/generic/GenericGap.h"
#include "ble/generic/GenericSecurityManager.h"
#include "ble/pal/MemorySecurityDB.h"
#include "ble/pal/MemorySecurityDb.h"
#include "ble/pal/SimpleEventQueue.h"

namespace ble {
Expand Down
8 changes: 8 additions & 0 deletions features/FEATURE_COMMON_PAL/mbed-coap/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## [v4.4.1](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.4.1)
**Closed issues:**
- IOTCLT-2539 Block wise messaging call-backs not working logically

Improve TCP+TLS transport layer to allow send larger messages without blockwising.

-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v4.4.0...v4.4.1)

## [v4.4.0](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.4.0)
**New feature:**
- Make sn_coap_protocol_send_rst as public needed for CoAP ping sending
Expand Down
15 changes: 15 additions & 0 deletions features/FEATURE_COMMON_PAL/mbed-coap/mbed-coap/sn_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@
*/
#undef SN_COAP_MAX_INCOMING_MESSAGE_SIZE /* UINT16_MAX */

/**
* \def SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE
* \brief Sets the maximum payload size allowed before blockwising the message.
* This option should only be used when using TCP and TLS as transport
* with known maximum fragment size. This optimizes the number of messages
* if it is possible to send larger than 1kB messages without blockwise transfer.
* If payload length is larger than SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE
* it will be sent using blockwise transfer.
* By default, this feature is disabled, 0 disables the feature, set to positive
* value larger than SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE to enable.
* Note that value should be less than transport layer maximum fragment size.
* Note that value has no effect if blockwise transfer is disabled.
*/
#undef SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE /* 0 */

#ifdef MBED_CLIENT_USER_CONFIG_FILE
#include MBED_CLIENT_USER_CONFIG_FILE
#endif
Expand Down
2 changes: 1 addition & 1 deletion features/FEATURE_COMMON_PAL/mbed-coap/module.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mbed-coap",
"version": "4.4.0",
"version": "4.4.1",
"description": "COAP library",
"keywords": [
"coap",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ struct sn_coap_hdr_;
#define SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE 0 /**< Must be 2^x and x is at least 4. Suitable values: 0, 16, 32, 64, 128, 256, 512 and 1024 */
#endif

#ifndef SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE
#define SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE 0
#endif

#ifdef MBED_CONF_MBED_CLIENT_SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
#define SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED MBED_CONF_MBED_CLIENT_SN_COAP_BLOCKWISE_MAX_TIME_DATA_STORED
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,9 @@ uint16_t sn_coap_builder_calc_needed_packet_data_size_2(sn_coap_hdr_s *src_coap_
}
}
#if SN_COAP_MAX_BLOCKWISE_PAYLOAD_SIZE
if ((src_coap_msg_ptr->payload_len > blockwise_payload_size) && (blockwise_payload_size > 0)) {
if ((src_coap_msg_ptr->payload_len > SN_COAP_MAX_NONBLOCKWISE_PAYLOAD_SIZE) &&
(src_coap_msg_ptr->payload_len > blockwise_payload_size) &&
(blockwise_payload_size > 0)) {
returned_byte_count += blockwise_payload_size;
} else {
returned_byte_count += src_coap_msg_ptr->payload_len;
Expand Down
Loading

0 comments on commit f9ee4e8

Please sign in to comment.