Skip to content

Commit 797e259

Browse files
author
onuruhuru
authored
Merge pull request #2 from ARMmbed/master
リポのアップデート
2 parents 63eca29 + 3d4582b commit 797e259

File tree

1,101 files changed

+100924
-6302
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,101 files changed

+100924
-6302
lines changed

.github/issue_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<!--
2020
Required
2121
Add detailed description of what you are reporting.
22-
Good example: https://os.mbed.com/docs/latest/reference/workflow.html
22+
Good example: https://os.mbed.com/docs/mbed-os/latest/contributing/workflow.html
2323
Things to consider sharing:
2424
- What target does this relate to?
2525
- What toolchain (name + version) are you using?

.github/pull_request_template.md

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

99

.travis.yml

Lines changed: 63 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ before_install:
4646
# Setup ppa to make sure arm-none-eabi-gcc is correct version
4747
- sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
4848
- sudo add-apt-repository -y ppa:deadsnakes/ppa
49+
# workaround for https://travis-ci.community/t/then-sudo-apt-get-update-failed-public-key-is-not-available-no-pubkey-6b05f25d762e3157-in-ubuntu-xenial/1728
50+
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 762E3157
4951
# Loop until update succeeds (timeouts can occur)
5052
- travis_retry $(! sudo apt-get update 2>&1 |grep Failed)
5153

@@ -83,7 +85,6 @@ matrix:
8385
- doxygen doxyfile_options 2>&1
8486
# Once Mbed OS has been fixed, enable the full test by replacing the top line with this:
8587
# - ( ! doxygen doxyfile_options 2>&1 | grep . )
86-
8788
# Assert that all binary libraries are named correctly
8889
# The strange command below asserts that there are exactly 0 libraries
8990
# that do not start with lib
@@ -104,12 +105,20 @@ matrix:
104105
install:
105106
# Install dependencies
106107
- sudo apt-get install gcc-arm-embedded
107-
- pip install -r requirements.txt
108-
- pip install pytest pylint hypothesis mock coverage coveralls
109-
# Print versions we use
110-
111108
- arm-none-eabi-gcc --version
109+
# Add additional dependencies specific for testing
112110
- python --version
111+
- |-
112+
tr -d ' ' >> requirements.txt <<< "
113+
mock==2.0.0
114+
pytest==3.3.0
115+
pylint>=1.9,<2
116+
hypothesis>=3,<4
117+
coverage>=4.5,<5
118+
coveralls>=1.5,<2
119+
"
120+
# ... and install.
121+
- pip install -r requirements.txt
113122
- pip list --verbose
114123
script:
115124
# Run local testing on tools
@@ -120,16 +129,41 @@ matrix:
120129
after_success:
121130
# Coverage for tools
122131
- coveralls
123-
# Report success since we have overridden default behaviour
132+
# Report success since we have overridden default behavior
124133
- bash -c "$STATUS" success "Local $NAME testing has passed"
125134

126-
# - <<: *tools-pytest
127-
# env: NAME=tools-py3.5
128-
# python: 3.5
129-
#
130-
# - <<: *tools-pytest
131-
# env: NAME=tools-py3.6
132-
# python: 3.6
135+
- env:
136+
- NAME=doxy-spellcheck
137+
138+
install:
139+
- sudo apt-get install aspell
140+
141+
script:
142+
# Run local testing on header file doxy
143+
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh drivers
144+
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh platform
145+
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh events
146+
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh rtos
147+
- ./tools/test/travis-ci/doxy-spellchecker/spell.sh features/netsocket
148+
149+
after_success:
150+
# Coverage for tools
151+
- coveralls
152+
# Report success since we have overridden default behavior
153+
- bash -c "$STATUS" success "Local $NAME testing has passed"
154+
155+
- <<: *tools-pytest
156+
env: NAME=tools-py3.5
157+
python: 3.5
158+
159+
- <<: *tools-pytest
160+
env: NAME=tools-py3.6
161+
python: 3.6
162+
163+
- <<: *tools-pytest
164+
env: NAME=tools-py3.7
165+
python: 3.7
166+
dist: xenial
133167

134168
- env:
135169
- NAME=astyle
@@ -142,9 +176,12 @@ matrix:
142176
export PATH=$PWD/bin:$PATH;
143177
cd -
144178
- astyle --version
179+
# Fetch remaining information needed for branch comparison
180+
- git fetch --all --unshallow --tags
181+
- git fetch origin "${TRAVIS_BRANCH}"
145182
script:
146183
- >-
147-
git diff --name-only --diff-filter=d HEAD..${TRAVIS_BRANCH} \
184+
git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \
148185
| ( grep '.\(c\|cpp\|h\|hpp\)$' || true ) \
149186
| ( fgrep -v -f .astyleignore || true ) \
150187
| while read file; do astyle -n --options=.astylerc "${file}"; done
@@ -270,9 +307,18 @@ matrix:
270307
- env:
271308
- NAME=licence_check
272309
script:
273-
- echo 'Checking that there is no GPL licence text in code'
274-
- ! git grep -q --ignore-case "gnu general public";
275-
- ! git grep -q --ignore-case "gnu library general public";
310+
- >-
311+
! grep --recursive --max-count=100 --ignore-case --exclude .travis.yml \
312+
"gnu general\|gnu lesser\|lesser general\|public license"
313+
314+
- env:
315+
- NAME=include_check
316+
script:
317+
- echo 'Checking that there are no '#include "mbed.h"' in code where it should not be'
318+
- |
319+
! git grep '^#include\s["'"']mbed.h['"'"]$' -- '*.c' '*.h' '*.cpp' '*.hpp' \
320+
':!*platform_mbed.h' ':!*TESTS/*' ':!TEST_APPS/' ':!UNITTESTS/' \
321+
':!*tests/*' ':!*targets/*' ':!*TARGET_*' ':!*unsupported/*'
276322
277323
- env:
278324
- NAME=psa-autogen

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
Mbed OS is an open-source, device software platform for the Internet of Things. Contributions are an important part of the platform, and our goal is to make it as simple as possible to become a contributor.
44

5-
To encourage productive collaboration, as well as robust, consistent and maintainable code, we have a set of guidelines for [contributing to Mbed OS](https://os.mbed.com/docs/latest/reference/contributing.html).
5+
To encourage productive collaboration, as well as robust, consistent and maintainable code, we have a set of guidelines for [contributing to Mbed OS](https://os.mbed.com/docs/mbed-os/latest/contributing/index.html).

TESTS/host_tests/crash_reporting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_steps(self):
6060
wait_after_reset = wait_after_reset if wait_after_reset is not None else DEFAULT_CYCLE_PERIOD
6161

6262
#Wait 2 seconds for system to init
63-
time.sleep(2.0)
63+
time.sleep(7.0)
6464
#self.send_kv(MSG_KEY_SYNC, MSG_VALUE_DUMMY)
6565
self.send_kv(MSG_KEY_DEVICE_ERROR, MSG_VALUE_DUMMY)
6666
time.sleep(5.0)

TESTS/mbed_drivers/flashiap/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ void flashiap_cross_sector_program_test()
128128
agg_size += sector_size;
129129
address -= sector_size;
130130
}
131+
utest_printf("ROM ends at 0x%lx, test starts at 0x%lx\n", FLASHIAP_APP_ROM_END_ADDR, address);
131132
TEST_SKIP_UNLESS_MESSAGE(address >= FLASHIAP_APP_ROM_END_ADDR, "Test skipped. Test region overlaps code.");
132133
ret = flash_device.erase(address, agg_size);
133134
TEST_ASSERT_EQUAL_INT32(0, ret);
@@ -184,6 +185,7 @@ void flashiap_program_error_test()
184185
TEST_ASSERT_TRUE(address != 0UL);
185186

186187
// unaligned address
188+
utest_printf("ROM ends at 0x%lx, test starts at 0x%lx\n", FLASHIAP_APP_ROM_END_ADDR, address);
187189
TEST_SKIP_UNLESS_MESSAGE(address >= FLASHIAP_APP_ROM_END_ADDR, "Test skipped. Test region overlaps code.");
188190
ret = flash_device.erase(address + 1, sector_size);
189191
TEST_ASSERT_EQUAL_INT32(-1, ret);
@@ -220,6 +222,9 @@ void flashiap_timing_test()
220222
utest_printf("\nFlash timing:\n");
221223
uint32_t sector_size = flash_device.get_sector_size(end_address - 1UL);
222224
uint32_t base_address = end_address - sector_size;
225+
utest_printf("ROM ends at 0x%lx, test starts at 0x%lx\n", FLASHIAP_APP_ROM_END_ADDR, base_address);
226+
TEST_SKIP_UNLESS_MESSAGE(base_address >= FLASHIAP_APP_ROM_END_ADDR, "Test skipped. Test region overlaps code.");
227+
223228
timer.start();
224229
for (num_write_sizes = 0; num_write_sizes < max_write_sizes; num_write_sizes++) {
225230
if (write_size > sector_size) {

TESTS/mbed_hal/flash/functional_tests/main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ void flash_erase_sector_test()
175175
uint32_t last_sector_size = flash_get_sector_size(&test_flash, addr_after_last - 1);
176176
uint32_t last_sector = addr_after_last - last_sector_size;
177177
TEST_ASSERT_EQUAL_INT32(0, last_sector % last_sector_size);
178+
179+
utest_printf("ROM ends at 0x%lx, test starts at 0x%lx\n", FLASHIAP_APP_ROM_END_ADDR, last_sector);
180+
TEST_SKIP_UNLESS_MESSAGE(last_sector >= FLASHIAP_APP_ROM_END_ADDR, "Test skipped. Test region overlaps code.");
181+
178182
ret = flash_erase_sector(&test_flash, last_sector);
179183
TEST_ASSERT_EQUAL_INT32(0, ret);
180184

@@ -201,6 +205,9 @@ void flash_program_page_test()
201205

202206
// sector size might not be same as page size
203207
uint32_t erase_sector_boundary = ALIGN_DOWN(address, flash_get_sector_size(&test_flash, address));
208+
utest_printf("ROM ends at 0x%lx, test starts at 0x%lx\n", FLASHIAP_APP_ROM_END_ADDR, erase_sector_boundary);
209+
TEST_SKIP_UNLESS_MESSAGE(erase_sector_boundary >= FLASHIAP_APP_ROM_END_ADDR, "Test skipped. Test region overlaps code.");
210+
204211
ret = flash_erase_sector(&test_flash, erase_sector_boundary);
205212
TEST_ASSERT_EQUAL_INT32(0, ret);
206213

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2019-2019 ARM Limited
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
#include "mbed.h"
19+
#include "greentea-client/test_env.h"
20+
#include "unity.h"
21+
#include "utest.h"
22+
23+
#ifdef TARGET_RENESAS
24+
#error [NOT_SUPPORTED] Cortex-A target not supported for this test
25+
#endif
26+
27+
using namespace utest::v1;
28+
29+
extern osThreadAttr_t _main_thread_attr;
30+
extern uint32_t mbed_stack_isr_size;
31+
32+
/* Exception for Nordic boards - BLE requires 2KB ISR stack. */
33+
#if defined(TARGET_NRF5x)
34+
#define EXPECTED_ISR_STACK_SIZE (2048)
35+
#else
36+
#define EXPECTED_ISR_STACK_SIZE (1024)
37+
#endif
38+
39+
#if defined(TARGET_NUCLEO_F070RB) || defined(TARGET_NANO100) || defined(TARGET_STM32F072RB) || defined(TARGET_TMPM46B) || defined(TARGET_TMPM066)
40+
#define EXPECTED_MAIN_THREAD_STACK_SIZE (3072)
41+
#else
42+
#define EXPECTED_MAIN_THREAD_STACK_SIZE (4096)
43+
#endif
44+
45+
#define EXPECTED_USER_THREAD_DEFAULT_STACK_SIZE (4096)
46+
47+
/* Test sizes of ISR stack, main thread stack, default user thread stack.
48+
*
49+
* On some platforms with lower RAM size (e.g. NUCLEO_F070RB - 16 KB RAM) it is impossible
50+
* to create thread with default stack size to check its size, that is why we will
51+
* check only macro which specifies default user thread stack.
52+
*
53+
*/
54+
void stack_size_unification_test()
55+
{
56+
TEST_ASSERT_EQUAL(EXPECTED_ISR_STACK_SIZE, mbed_stack_isr_size);
57+
TEST_ASSERT_EQUAL(EXPECTED_MAIN_THREAD_STACK_SIZE, _main_thread_attr.stack_size);
58+
TEST_ASSERT_EQUAL(EXPECTED_USER_THREAD_DEFAULT_STACK_SIZE, OS_STACK_SIZE);
59+
}
60+
61+
utest::v1::status_t test_setup(const size_t number_of_cases)
62+
{
63+
GREENTEA_SETUP(10, "default_auto");
64+
return verbose_test_setup_handler(number_of_cases);
65+
}
66+
67+
Case cases[] = {
68+
Case("Stack size unification test", stack_size_unification_test)
69+
};
70+
71+
Specification specification(test_setup, cases);
72+
73+
int main()
74+
{
75+
return !Harness::run(specification);
76+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2019-2019 ARM Limited
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
/** \addtogroup hal_rtc_tests
20+
* @{
21+
*/
22+
23+
#ifndef MBED_STACK_SIZE_UNIFICATION_H
24+
#define MBED_STACK_SIZE_UNIFICATION_H
25+
26+
#ifdef __cplusplus
27+
extern "C" {
28+
#endif
29+
30+
/** Test sizes of ISR stack, main thread stack, default user thread stack.
31+
*
32+
* Given is Mbed OS configuration.
33+
* When ISR stack, main thread stack, default user thread stack sizes are defined.
34+
* Then ISR stack size is equal to 1 KB,
35+
* main thread stack size is equal to 4 KB,
36+
* default user thread stack size is equal to 4 KB.
37+
*
38+
* NOTE:
39+
* It is impossible to verify RTOS-less thread stack size since all tests are build with RTOS.
40+
*/
41+
void stack_size_unification_test(void);
42+
43+
/**@}*/
44+
45+
#ifdef __cplusplus
46+
}
47+
#endif
48+
49+
#endif
50+
51+
/** @}*/

TESTS/mbed_platform/crash_reporting/main.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,17 @@ void test_crash_reporting()
5353

5454
// Report readiness
5555
greentea_send_kv(MSG_KEY_DEVICE_READY, MSG_VALUE_DUMMY);
56+
printf("\nMessage sent: %s\n", MSG_KEY_DEVICE_READY);
5657

5758
static char _key[MSG_KEY_LEN + 1] = { };
5859
static char _value[MSG_VALUE_LEN + 1] = { };
5960

61+
printf("\nWaiting for crash inject error message: %s\n", MSG_KEY_DEVICE_ERROR);
6062
greentea_parse_kv(_key, _value, MSG_KEY_LEN, MSG_VALUE_LEN);
63+
printf("\nCrash inject error message received\n");
64+
6165
if (strcmp(_key, MSG_KEY_DEVICE_ERROR) == 0) {
66+
printf("\nForcing error\n");
6267
MBED_ERROR1(MBED_ERROR_OUT_OF_MEMORY, "Executing crash reporting test.", 0xDEADBAD);
6368
TEST_ASSERT_MESSAGE(0, "crash_reporting() error call failed.");
6469
}
@@ -67,7 +72,7 @@ void test_crash_reporting()
6772

6873
int main(void)
6974
{
70-
GREENTEA_SETUP(30, "crash_reporting");
75+
GREENTEA_SETUP(40, "crash_reporting");
7176
test_crash_reporting();
7277
GREENTEA_TESTSUITE_RESULT(0);
7378

TESTS/mbedmicro-rtos-mbed/systimer/main.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,10 @@ void test_handler_called_once(void)
245245
int32_t sem_slots = st.sem_wait(0);
246246
TEST_ASSERT_EQUAL_INT32(0, sem_slots);
247247

248-
sem_slots = st.sem_wait(osWaitForever);
248+
// Wait in a busy loop to prevent entering sleep or deepsleep modes.
249+
while (sem_slots != 1) {
250+
sem_slots = st.sem_wait(0);
251+
}
249252
us_timestamp_t t2 = st.get_time();
250253
TEST_ASSERT_EQUAL_INT32(1, sem_slots);
251254
TEST_ASSERT_EQUAL_UINT32(1, st.get_tick());

0 commit comments

Comments
 (0)