Skip to content

Commit edaba68

Browse files
committed
Test merge of feature-emac with master
This is a dummy test merge - operation was actually performed as a rebase, and will be pushed as such. This contains the same final tree contents as my current proposed rebase, and hopefully gitk will show a semi-legible diff for the bits touched in the merge commit.
2 parents ea912d5 + 11901f1 commit edaba68

File tree

1,674 files changed

+259065
-24319
lines changed

Some content is hidden

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

1,674 files changed

+259065
-24319
lines changed

.astyleignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
BUILD
2+
cmsis
3+
features/mbedtls
4+
features/FEATURE_LWIP/lwip
5+
rtos/TARGET_CORTEX/rtx4
6+
features/filesystem/littlefs/littlefs
7+
features/filesystem/fat/ChaN
8+
features/frameworks
9+
features/FEATURE_BLE/targets
10+
features/FEATURE_LWIP/lwip-interface/lwip
11+
features/unsupported/
12+
features/FEATURE_COMMON_PAL/
13+
FEATURE_NANOSTACK/coap-service
14+
FEATURE_NANOSTACK/sal-stack-nanostack
15+
rtos/TARGET_CORTEX/rtx5
16+
targets
17+
tools

.astylerc

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Mbed OS code style definition file for astyle
2+
3+
# Don't create backup files, let git handle it
4+
suffix=none
5+
6+
# K&R style
7+
style=kr
8+
9+
# 1 TBS addition to k&r, add braces to one liners
10+
# Use -j as it was changed in astyle from brackets to braces, this way it is compatible with older astyle versions
11+
-j
12+
13+
# 4 spaces, convert tabs to spaces
14+
indent=spaces=4
15+
convert-tabs
16+
17+
# Indent switches and cases
18+
indent-switches
19+
indent-cases
20+
21+
# Remove spaces in and around parentheses
22+
unpad-paren
23+
24+
# Insert a space after if, while, for, and around operators
25+
pad-header
26+
pad-oper
27+
28+
# Pointer/reference operators go next to the name (on the right)
29+
align-pointer=name
30+
align-reference=name
31+
32+
# Attach { for classes and namespaces
33+
attach-namespaces
34+
attach-classes

.github/issue_template.md

Lines changed: 29 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,31 @@
1-
Note: This is just a template, so feel free to use/remove the unnecessary things
2-
31
### Description
4-
- Type: Bug | Enhancement | Question
5-
- Related issue: `#abc`
6-
- Priority: Blocker | Major | Minor
7-
8-
---------------------------------------------------------------
9-
## Bug
10-
11-
**Target**
12-
K64F|??
13-
14-
**Toolchain:**
15-
GCC_ARM|ARM|IAR
16-
17-
**Toolchain version:**
18-
19-
**mbed-cli version:**
20-
(`mbed --version`)
21-
22-
**mbed-os sha:**
23-
(`git log -n1 --oneline`)
24-
25-
**DAPLink version:**
26-
27-
**Expected behavior**
28-
29-
**Actual behavior**
30-
31-
**Steps to reproduce**
32-
33-
----------------------------------------------------------------
34-
## Enhancement
35-
36-
**Reason to enhance or problem with existing solution**
37-
38-
**Suggested enhancement**
39-
40-
**Pros**
41-
42-
**Cons**
43-
44-
-----------------------------------------------------------------
45-
46-
## Question
2+
<!--
3+
Required
4+
Add detailed description of what you are reporting.
5+
Good example: https://os.mbed.com/docs/latest/reference/workflow.html
6+
Things to consider sharing:
7+
- What target does this relate to?
8+
- What toolchain (name + version) are you using?
9+
- What tools (name + version - is it mbed-cli, online compiler or IDE) are you using?
10+
- What is the SHA of Mbed OS (git log -n1 --oneline)?
11+
- Steps to reproduce. (Did you publish code or a test case that exhibits the problem?)
12+
-->
13+
14+
15+
### Issue request type
16+
<!--
17+
Required
18+
Please add only one X to one of the following types. Do not fill multiple types. (Split the issue otherwise.)
19+
Please note this is not a GitHub task list; indenting the boxes or changing the format to add a '.' or '*' in front
20+
of them changes the meaning incorrectly. The only changes to make are to add a description under the
21+
description heading and to add an 'x' to the correct box.
22+
23+
[X] Question
24+
[ ] Enhancement
25+
[ ] Bug
26+
-->
27+
28+
[ ] Question
29+
[ ] Enhancement
30+
[ ] Bug
4731

48-
**How to?**

.github/pull_request_template.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,22 @@
33
<!--
44
Required
55
Add here detailed changes summary, testing results, dependencies
6-
Good example: https://os.mbed.com/docs/latest/reference/guidelines.html#workflow (Pull request template)
6+
Good example: https://os.mbed.com/docs/latest/reference/workflow.html (Pull request template)
77
-->
88

99

1010
### Pull request type
1111

1212
<!--
1313
Required
14-
Please add only one X to one of the following types. Do not fill multiple types (split the pull request otherwise) or
15-
change the layout.
16-
17-
[X] Fix
14+
Please add only one X to one of the following types. Do not fill multiple types (split the pull request otherwise).
15+
Please note this is not a GitHub task list, indenting the boxes or changing the format to add a '.' or '*' in front
16+
of them would change the meaning incorrectly. The only changes to be made are to add a description text under the
17+
description heading and to add a 'x' to the correct box.
18+
-->
19+
[ ] Fix
1820
[ ] Refactor
1921
[ ] New target
2022
[ ] Feature
2123
[ ] Breaking change
22-
-->
2324

24-
[ ] Fix
25-
[ ] Refactor
26-
[ ] New target
27-
[ ] Feature
28-
[ ] Breaking change

.travis.yml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,45 @@ matrix:
9494
# Report success since we have overridden default behaviour
9595
- bash -c "$STATUS" success "Local $NAME testing has passed"
9696

97+
- env:
98+
- NAME=astyle
99+
install:
100+
- wget https://downloads.sourceforge.net/project/astyle/astyle/astyle%203.1/astyle_3.1_linux.tar.gz;
101+
mkdir -p BUILD && tar xf astyle_3.1_linux.tar.gz -C BUILD;
102+
pushd BUILD/astyle/build/gcc;
103+
make;
104+
export PATH=$PWD/bin:$PATH;
105+
popd;
106+
- astyle --version
107+
script:
108+
# only changed files this time
109+
- git diff --name-only $TRAVIS_BRANCH | grep '.*\.\(h\|c\|hpp\|cpp\)' | fgrep -v -f .astyleignore | xargs -n 100 -I {} bash -c "astyle -n --options=.astylerc \"{}\"" > astyle-files-changed.out;
110+
if [ $(cat astyle-files-changed.out | grep Formatted | wc -l) -ne 0 ]; then
111+
git --no-pager diff;
112+
echo "Please fix style issues as shown above";
113+
else
114+
echo "Coding style check OK";
115+
fi
116+
after_success:
117+
# run astyle for all files on the branch
118+
- git checkout -- .
119+
- find -regex '.*\.\(h\|c\|hpp\|cpp\)' -type f | fgrep -v -f .astyleignore | xargs -n 100 -I {} bash -c "astyle -n --options=.astylerc \"{}\"" > astyle-branch.out;
120+
# update status if we succeeded, compare with master if possible
121+
- |
122+
CURR=$(cat astyle-branch.out | grep Formatted | wc -l)
123+
PREV=$(curl https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \
124+
| jq -re "select(.sha != \"$TRAVIS_COMMIT\")
125+
| .statuses[] | select(.context == \"travis-ci/$NAME\").description
126+
| capture(\", (?<warnings>[0-9]+) warnings\").warnings" \
127+
|| echo 0)
128+
129+
STATUSM="Passed, ${CURR} warnings"
130+
if [ "$PREV" -ne 0 ]
131+
then
132+
STATUSM="$STATUSM ($(python -c "print '%+d' % ($CURR-$PREV)") warnings)"
133+
fi
134+
- bash -c "$STATUS" success "$STATUSM"
135+
97136
- env:
98137
- NAME=events
99138
- EVENTS=events
@@ -111,7 +150,7 @@ matrix:
111150
- python tools/make.py -t GCC_ARM -m K64F --source=. --build=BUILD/K64F/GCC_ARM -j0
112151
# Check that example compiles without rtos
113152
- sed -n '/``` cpp/,/```/{/```$/Q;/```/d;p;}' $EVENTS/README.md > main.cpp
114-
- rm -r rtos features/cellular features/netsocket features/frameworks BUILD
153+
- rm -r rtos features/cellular features/netsocket features/nanostack features/frameworks BUILD
115154
- python tools/make.py -t GCC_ARM -m DISCO_F401VC --source=. --build=BUILD/DISCO_F401VC/GCC_ARM -j0
116155
# Run local equeue tests
117156
- make -C $EVENTS/equeue test

TESTS/host_tests/device_echo.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
mbed SDK
3+
Copyright (c) 2011-2016 ARM Limited
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
"""
17+
18+
19+
import uuid
20+
from mbed_host_tests import BaseHostTest
21+
22+
class Device_Echo(BaseHostTest):
23+
24+
def _callback_repeat(self, key, value, _):
25+
self.send_kv(key, value)
26+
27+
def setup(self):
28+
self.register_callback("echo", self._callback_repeat)
29+
self.register_callback("echo_count", self._callback_repeat)
30+
31+
def teardown(self):
32+
pass

TESTS/mbed_drivers/echo/main.cpp

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,49 @@
2121
#include "unity/unity.h"
2222
#include "utest/utest.h"
2323

24+
#define PAYLOAD_LENGTH 36
25+
2426
using namespace utest::v1;
2527

28+
// Fill a buffer with a slice of the ASCII alphabet.
29+
void fill_buffer(char* buffer, unsigned int length, unsigned int index) {
30+
unsigned int start = length * index;
31+
for (int i = 0; i < length - 1; i++) {
32+
buffer[i] = 'a' + ((start + i) % 26);
33+
}
34+
buffer[length - 1] = '\0';
35+
}
36+
2637
// Echo server (echo payload to host)
2738
template<int N>
2839
void test_case_echo_server_x() {
2940
char _key[11] = {};
30-
char _value[128] = {};
41+
char _tx_value[PAYLOAD_LENGTH + 1] = {};
42+
char _rx_value[PAYLOAD_LENGTH + 1] = {};
3143
const int echo_count = N;
32-
const char _key_const[] = "echo_count";
44+
const char _echo_count_key_const[] = "echo_count";
45+
const char _echo_key_const[] = "echo";
3346
int expected_key = 1;
3447

35-
greentea_send_kv(_key_const, echo_count);
48+
// Send up the echo count
49+
greentea_send_kv(_echo_count_key_const, echo_count);
3650
// Handshake with host
3751
do {
38-
greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
39-
expected_key = strcmp(_key_const, _key);
52+
greentea_parse_kv(_key, _rx_value, sizeof(_key), sizeof(_rx_value));
53+
// Ensure the key received is "echo_count" and not some old data
54+
expected_key = strcmp(_echo_count_key_const, _key);
4055
} while (expected_key);
41-
TEST_ASSERT_EQUAL_INT(echo_count, atoi(_value));
56+
TEST_ASSERT_EQUAL_INT(echo_count, atoi(_rx_value));
4257

4358
for (int i=0; i < echo_count; ++i) {
44-
greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
45-
greentea_send_kv(_key, _value);
59+
fill_buffer(_tx_value, PAYLOAD_LENGTH, i);
60+
greentea_send_kv(_echo_key_const, _tx_value);
61+
do {
62+
greentea_parse_kv(_key, _rx_value, sizeof(_key), sizeof(_rx_value));
63+
// Ensure the key received is "echo" and not some old data
64+
expected_key = strcmp(_echo_key_const, _key);
65+
} while (expected_key);
66+
TEST_ASSERT(strncmp(_tx_value, _rx_value, PAYLOAD_LENGTH) == 0);
4667
}
4768
}
4869

@@ -56,7 +77,7 @@ Case cases[] = {
5677
};
5778

5879
utest::v1::status_t greentea_test_setup(const size_t number_of_cases) {
59-
GREENTEA_SETUP(30, "echo");
80+
GREENTEA_SETUP(30, "device_echo");
6081
return greentea_test_setup_handler(number_of_cases);
6182
}
6283

TESTS/mbed_hal/critical_section/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "greentea-client/test_env.h"
2121
#include "mbed.h"
2222
#include "cmsis.h"
23-
#ifdef TARGET_NRF5 // for all NRF5x targets
23+
#if defined(TARGET_NRF5) || defined(TARGET_NRF5x) // for all NRF5x targets
2424
#include "nrf_nvic.h" // for __NRF_NVIC_APP_IRQS_0 / __NRF_NVIC_APP_IRQS_1
2525
#endif
2626

@@ -30,7 +30,7 @@ bool test_are_interrupts_enabled(void)
3030
{
3131
// NRF5x targets don't disable interrupts when in critical section, instead they mask application interrupts this is due to BLE stack
3232
// (BLE to be operational requires some interrupts to be always enabled)
33-
#ifdef TARGET_NRF52_DK
33+
#ifdef TARGET_NRF52
3434
// check if APP interrupts are masked for NRF52_DK board
3535
return (((NVIC->ISER[0] & __NRF_NVIC_APP_IRQS_0) != 0) || ((NVIC->ISER[1] & __NRF_NVIC_APP_IRQS_1) != 0));
3636
#elif TARGET_NRF5

TESTS/mbed_hal/flash/functional_tests/main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@
2828
using namespace utest::v1;
2929

3030
#define TEST_CYCLES 10000000
31+
32+
#ifdef TARGET_NRF52
33+
/* The increased tolerance is to account for the imprecise timers on the NRF52. */
34+
#define ALLOWED_DRIFT_PPM (1000000/50000) //5.0%
35+
#else
3136
#define ALLOWED_DRIFT_PPM (1000000/5000) //0.5%
37+
#endif
3238

3339
/*
3440
return values to be checked are documented at:
@@ -279,9 +285,7 @@ Case cases[] = {
279285
Case("Flash - erase sector", flash_erase_sector_test),
280286
Case("Flash - program page", flash_program_page_test),
281287
Case("Flash - buffer alignment test", flash_buffer_alignment_test),
282-
#ifndef MCU_NRF52
283288
Case("Flash - clock and cache test", flash_clock_and_cache_test),
284-
#endif
285289
};
286290

287291
utest::v1::status_t greentea_test_setup(const size_t number_of_cases) {

0 commit comments

Comments
 (0)