Skip to content

Commit

Permalink
Merge pull request ARMmbed#8479 from ARMmbed/release-candidate
Browse files Browse the repository at this point in the history
Release candidate for mbed-os-5.10.2
  • Loading branch information
Cruz Monrreal authored Oct 19, 2018
2 parents c53d51f + 0b850b9 commit e1bea44
Show file tree
Hide file tree
Showing 654 changed files with 72,760 additions and 4,138 deletions.
25 changes: 11 additions & 14 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Description
<!--

<!--
Required
Add detailed description of what you are reporting.
Good example: https://os.mbed.com/docs/latest/reference/workflow.html
Expand All @@ -13,19 +14,15 @@


### Issue request type
<!--
Required
Please add only one X to one of the following types. Do not fill multiple types. (Split the issue otherwise.)
Please note this is not a GitHub task list; indenting the boxes or changing the format to add a '.' or '*' in front
of them changes the meaning incorrectly. The only changes to make are to add a description under the
description heading and to add an 'x' to the correct box.

[X] Question
[ ] Enhancement
[ ] Bug
<!--
Required
Please add only one X to one of the following types. Do not fill multiple types (split the issue otherwise.)
Please note this is not a GitHub task list, indenting the boxes or changing the format to add a '.' or '*' in front
of them would change the meaning incorrectly. The only changes to be made are to add a description text under the
description heading and to add a 'x' to the correct box.
-->

[ ] Question
[ ] Enhancement
[ ] Bug
[ ] Question
[ ] Enhancement
[ ] Bug

2 changes: 2 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ matrix:

- arm-none-eabi-gcc --version
- python --version
- pip list --verbose
script:
# Run local testing on tools
- PYTHONPATH=. coverage run -a -m pytest tools/test
Expand Down Expand Up @@ -132,10 +133,10 @@ matrix:
# update status if we succeeded, compare with master if possible
- |
CURR=$(cat astyle-branch.out | grep Formatted | wc -l)
PREV=$(curl https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \
PREV=$(curl -u "$MBED_BOT" https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \
| jq -re "select(.sha != \"$TRAVIS_COMMIT\")
| .statuses[] | select(.context == \"travis-ci/$NAME\").description
| capture(\", (?<files>[0-9]+) files\").warnings" \
| capture(\", (?<files>[0-9]+) files\").files" \
|| echo 0)
STATUSM="Passed, ${CURR} files"
Expand Down
2 changes: 1 addition & 1 deletion TESTS/host_tests/rtc_reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class RtcResetTest(BaseHostTest):
"""

"""Start of the RTC"""
START_TIME = 50000
START_TIME = 1537789823 # GMT: Monday, 24 September 2018 11:50:23
START_TIME_TOLERANCE = 10
"""Time to delay after sending reset"""
DELAY_TIME = 5.0
Expand Down
1 change: 1 addition & 0 deletions TESTS/lorawan/loraradio/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@


using namespace utest::v1;
using namespace mbed;

static LoRaRadio *radio = NULL;
rtos::Semaphore event_sem(0);
Expand Down
71 changes: 71 additions & 0 deletions TESTS/mbed_hal/minimum_requirements/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/* mbed Microcontroller Library
* Copyright (c) 2017 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;

/**
* This test is intended to gate devices that do not have enough RAM to run
* Mbed os. Devices passing this test should have enough RAM to run all
* other Mbed OS tests.
*
* If your device does not pass this test, then you should determine the
* cause of high memory usage and fix it. If you cannot free enough memory,
* then you should turn off Mbed OS support for this device.
*/

#define MIN_HEAP_SIZE 2048
#define MIN_DATA_SIZE 2048

volatile uint8_t test_buffer[MIN_DATA_SIZE];

static void minimum_heap_test()
{
void *mem = malloc(MIN_HEAP_SIZE);
TEST_ASSERT_NOT_EQUAL(NULL, mem);
free(mem);
}

static void minimum_data_test()
{
// Use test buffer so it is not optimized away
for (int i = 0; i < MIN_DATA_SIZE; i++) {
test_buffer[i] = i & 0xFF;
}
}


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

Case cases[] = {
Case("Minimum heap test", minimum_heap_test),
Case("Minimum data test", minimum_data_test),
};

Specification specification(greentea_test_setup, cases, greentea_test_teardown_handler);

int main() {
Harness::run(specification);
}
84 changes: 1 addition & 83 deletions TESTS/mbed_hal/sleep/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,9 @@
#include "greentea-client/test_env.h"
#include "mbed_lp_ticker_wrapper.h"

#include "sleep_test_utils.h"
#include "sleep_api_tests.h"

#define US_PER_S 1000000

/* Flush serial buffer before deep sleep
*
* Since deepsleep() may shut down the UART peripheral, we wait for some time
* to allow for hardware serial buffers to completely flush.
*
* Take NUMAKER_PFM_NUC472 as an example:
* Its UART peripheral has 16-byte Tx FIFO. With baud rate set to 9600, flush
* Tx FIFO would take: 16 * 8 * 1000 / 9600 = 13.3 (ms). So set wait time to
* 20ms here for safe.
*
* This should be replaced with a better function that checks if the
* hardware buffers are empty. However, such an API does not exist now,
* so we'll use the busy_wait_ms() function for now.
*/
#define SERIAL_FLUSH_TIME_MS 20

using namespace utest::v1;

static char info[512] = {0};
Expand All @@ -67,71 +50,6 @@ static const uint32_t sleep_mode_delta_us = (10 + 4 + 5);
* delta = default 10 ms + worst ticker resolution + extra time for code execution */
static const uint32_t deepsleep_mode_delta_us = (10000 + 125 + 5);

unsigned int ticks_to_us(unsigned int ticks, unsigned int freq)
{
return (unsigned int)((unsigned long long) ticks * US_PER_S / freq);
}

unsigned int us_to_ticks(unsigned int us, unsigned int freq)
{
return (unsigned int)((unsigned long long) us * freq / US_PER_S);
}

unsigned int overflow_protect(unsigned int timestamp, unsigned int ticker_width)
{
unsigned int counter_mask = ((1 << ticker_width) - 1);

return (timestamp & counter_mask);
}

bool compare_timestamps(unsigned int delta_ticks, unsigned int ticker_width, unsigned int expected, unsigned int actual)
{
const unsigned int counter_mask = ((1 << ticker_width) - 1);

const unsigned int lower_bound = ((expected - delta_ticks) & counter_mask);
const unsigned int upper_bound = ((expected + delta_ticks) & counter_mask);

if (lower_bound < upper_bound) {
if (actual >= lower_bound && actual <= upper_bound) {
return true;
} else {
return false;
}
} else {
if ((actual >= lower_bound && actual <= counter_mask) || (actual >= 0 && actual <= upper_bound)) {
return true;
} else {
return false;
}
}
}

void busy_wait_ms(int ms)
{
const ticker_info_t *info = us_ticker_get_info();
uint32_t mask = (1 << info->bits) - 1;
int delay = (int)((uint64_t)ms * info->frequency / 1000);

uint32_t prev = us_ticker_read();
while (delay > 0) {
uint32_t next = us_ticker_read();
delay -= (next - prev) & mask;
prev = next;
}
}

void us_ticker_isr(const ticker_data_t *const ticker_data)
{
us_ticker_clear_interrupt();
}

#ifdef DEVICE_LPTICKER
void lp_ticker_isr(const ticker_data_t *const ticker_data)
{
lp_ticker_clear_interrupt();
}
#endif

/* Test that wake-up time from sleep should be less than 10 us and
* high frequency ticker interrupt can wake-up target from sleep. */
void sleep_usticker_test()
Expand Down
114 changes: 114 additions & 0 deletions TESTS/mbed_hal/sleep/sleep_test_utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/* mbed Microcontroller Library
* Copyright (c) 2017 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.
*/

/**
* @addtogroup hal_sleep_test_utils
* @{
*/

#ifndef MBED_SLEEP_TEST_UTILS_H
#define MBED_SLEEP_TEST_UTILS_H

#include "hal/ticker_api.h"
#include "hal/us_ticker_api.h"
#include "hal/lp_ticker_api.h"

/* Flush serial buffer before deep sleep
*
* Since deepsleep() may shut down the UART peripheral, we wait for some time
* to allow for hardware serial buffers to completely flush.
*
* Take NUMAKER_PFM_NUC472 as an example:
* Its UART peripheral has 16-byte Tx FIFO. With baud rate set to 9600, flush
* Tx FIFO would take: 16 * 8 * 1000 / 9600 = 13.3 (ms). So set wait time to
* 20ms here for safe.
*
* This should be replaced with a better function that checks if the
* hardware buffers are empty. However, such an API does not exist now,
* so we'll use the busy_wait_ms() function for now.
*/
#define SERIAL_FLUSH_TIME_MS 20

#define US_PER_S 1000000

unsigned int ticks_to_us(unsigned int ticks, unsigned int freq)
{
return (unsigned int) ((unsigned long long) ticks * US_PER_S / freq);
}

unsigned int us_to_ticks(unsigned int us, unsigned int freq)
{
return (unsigned int) ((unsigned long long) us * freq / US_PER_S);
}

unsigned int overflow_protect(unsigned int timestamp, unsigned int ticker_width)
{
unsigned int counter_mask = ((1 << ticker_width) - 1);

return (timestamp & counter_mask);
}

bool compare_timestamps(unsigned int delta_ticks, unsigned int ticker_width, unsigned int expected, unsigned int actual)
{
const unsigned int counter_mask = ((1 << ticker_width) - 1);

const unsigned int lower_bound = ((expected - delta_ticks) & counter_mask);
const unsigned int upper_bound = ((expected + delta_ticks) & counter_mask);

if (lower_bound < upper_bound) {
if (actual >= lower_bound && actual <= upper_bound) {
return true;
} else {
return false;
}
} else {
if ((actual >= lower_bound && actual <= counter_mask) || (actual >= 0 && actual <= upper_bound)) {
return true;
} else {
return false;
}
}
}

void busy_wait_ms(int ms)
{
const ticker_info_t *info = us_ticker_get_info();
uint32_t mask = (1 << info->bits) - 1;
int delay = (int) ((uint64_t) ms * info->frequency / 1000);

uint32_t prev = us_ticker_read();
while (delay > 0) {
uint32_t next = us_ticker_read();
delay -= (next - prev) & mask;
prev = next;
}
}

void us_ticker_isr(const ticker_data_t * const ticker_data)
{
us_ticker_clear_interrupt();
}

#ifdef DEVICE_LPTICKER
void lp_ticker_isr(const ticker_data_t * const ticker_data)
{
lp_ticker_clear_interrupt();
}
#endif

#endif

/** @}*/
Loading

0 comments on commit e1bea44

Please sign in to comment.