Skip to content

Commit a30abf4

Browse files
author
Offir Kochalsky
committed
Merge remote-tracking branch 'upstream/master' into offir-mbed-qspif
2 parents 794d150 + 365d61e commit a30abf4

File tree

1,560 files changed

+197450
-27040
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,560 files changed

+197450
-27040
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,9 @@ tags
8888
.vscode/
8989

9090
features/FEATURE_BLE/targets/TARGET_CORDIO/stack_backup/
91+
92+
.pytest_cache
93+
log
94+
95+
# Icetea related file
96+
test_suite.json

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ matrix:
162162
- python tools/make.py -t GCC_ARM -m K64F --source=. --build=BUILD/K64F/GCC_ARM -j0
163163
# Check that example compiles without rtos
164164
- sed -n '/``` cpp/,/```/{/```$/Q;/```/d;p;}' $EVENTS/README.md > main.cpp
165-
- rm -r rtos features/cellular features/netsocket features/nanostack features/lwipstack features/frameworks/greentea-client features/frameworks/utest features/frameworks/unity BUILD
165+
- rm -r rtos features/cellular features/netsocket features/nanostack features/lwipstack features/frameworks/greentea-client features/frameworks/utest features/frameworks/unity components BUILD
166166
- python tools/make.py -t GCC_ARM -m DISCO_F401VC --source=. --build=BUILD/DISCO_F401VC/GCC_ARM -j0
167167
# Run local equeue tests
168168
- make -C $EVENTS/equeue test
@@ -187,12 +187,11 @@ matrix:
187187

188188
- env:
189189
- NAME=littlefs
190-
- LITTLEFS=features/filesystem/littlefs
190+
- LITTLEFS=features/storage/filesystem/littlefs
191191
install:
192192
# Install dependencies
193193
- sudo apt-get install gcc-arm-embedded fuse libfuse-dev
194194
- pip install -r requirements.txt
195-
- git clone https://github.com/armmbed/spiflash-driver.git
196195
# Print versions
197196
- arm-none-eabi-gcc --version
198197
- gcc --version
@@ -268,3 +267,4 @@ matrix:
268267
script:
269268
- echo 'Checking that there is no GPL licence text in code'
270269
- ! git grep -q --ignore-case "gnu general public";
270+
- ! git grep -q --ignore-case "gnu library general public";

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ We have a [developer website](https://os.mbed.com) for asking questions, engagin
3333
## Getting started for contributors
3434

3535
We also have a [contributing and publishing guide](https://os.mbed.com/contributing/) that covers licensing, contributor agreements and style guidelines.
36+
37+
## Documentation
38+
39+
For more information about Mbed OS, please see [our published documentation](https://os.mbed.com/docs/latest). It includes published Doxygen for our APIs, step-by-step tutorials, porting information and background reference materials about our architecture and tools.
40+
41+
To contribute to this documentation, please see the [mbed-os-5-docs repo](https://github.com/ARMmbed/mbed-os-5-docs).

TESTS/host_tests/system_reset.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ class SystemResetTest(BaseHostTest):
3636
def __init__(self):
3737
super(SystemResetTest, self).__init__()
3838
self.reset = False
39-
cycle_s = self.get_config_item('program_cycle_s')
40-
self.program_cycle_s = cycle_s if cycle_s is not None else DEFAULT_CYCLE_PERIOD
41-
4239
self.test_steps_sequence = self.test_steps()
4340
# Advance the coroutine to it's first yield statement.
4441
self.test_steps_sequence.send(None)
@@ -61,16 +58,18 @@ def test_steps(self):
6158
"""Reset the device and check the status
6259
"""
6360
system_reset = yield
64-
6561
self.reset = False
62+
63+
wait_after_reset = self.get_config_item('forced_reset_timeout')
64+
wait_after_reset = wait_after_reset if wait_after_reset is not None else DEFAULT_CYCLE_PERIOD
65+
6666
self.send_kv(MSG_KEY_DEVICE_RESET, MSG_VALUE_DUMMY)
67-
time.sleep(self.program_cycle_s)
67+
time.sleep(wait_after_reset)
6868
self.send_kv(MSG_KEY_SYNC, MSG_VALUE_DUMMY)
6969

7070
system_reset = yield
71-
7271
if self.reset == False:
7372
raise RuntimeError('Platform did not reset as expected.')
7473

7574
# The sequence is correct -- test passed.
76-
yield True
75+
yield True

TESTS/host_tests/trng_reset.py

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
"""
2+
Copyright (c) 2018 ARM Limited
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
"""
15+
16+
"""
17+
This script is the host script for trng test sequence, it send the
18+
step signaling sequence and receive and transmit data to the device after
19+
reset if necesarry (default loading and storing mechanism while reseting the device
20+
is NVstore, in case NVstore isn't enabled we'll use current infrastructure,
21+
for more details see main.cpp file)
22+
"""
23+
24+
import time
25+
from mbed_host_tests import BaseHostTest
26+
from mbed_host_tests.host_tests_runner.host_test_default import DefaultTestSelector
27+
from time import sleep
28+
29+
DEFAULT_CYCLE_PERIOD = 1.0
30+
MSG_VALUE_DUMMY = '0'
31+
MSG_TRNG_READY = 'ready'
32+
MSG_TRNG_BUFFER = 'buffer'
33+
MSG_TRNG_TEST_STEP1 = 'check_step1'
34+
MSG_TRNG_TEST_STEP2 = 'check_step2'
35+
MSG_KEY_SYNC = '__sync'
36+
MSG_KEY_RESET_COMPLETE = 'reset_complete'
37+
MSG_KEY_TEST_SUITE_ENDED = 'Test_suite_ended'
38+
MSG_KEY_EXIT = 'exit'
39+
40+
class TRNGResetTest(BaseHostTest):
41+
"""Test for the TRNG API.
42+
"""
43+
44+
def __init__(self):
45+
super(TRNGResetTest, self).__init__()
46+
self.did_reset = False
47+
self.ready = False
48+
self.suite_ended = False
49+
self.buffer = 0
50+
self.test_steps_sequence = self.test_steps()
51+
# Advance the coroutine to it's first yield statement.
52+
self.test_steps_sequence.send(None)
53+
54+
#define callback functions for msg handling
55+
def setup(self):
56+
self.register_callback(MSG_TRNG_READY, self.cb_device_ready)
57+
self.register_callback(MSG_TRNG_BUFFER, self.cb_trng_buffer)
58+
self.register_callback(MSG_KEY_TEST_SUITE_ENDED, self.cb_device_test_suit_ended)
59+
self.register_callback(MSG_KEY_RESET_COMPLETE, self.cb_reset_complete)
60+
61+
#receive sent data from device before reset
62+
def cb_trng_buffer(self, key, value, timestamp):
63+
"""Acknowledge device rebooted correctly and feed the test execution
64+
"""
65+
self.buffer = value
66+
67+
try:
68+
if self.test_steps_sequence.send(value):
69+
self.notify_complete(True)
70+
except (StopIteration, RuntimeError) as exc:
71+
self.notify_complete(False)
72+
73+
def cb_device_ready(self, key, value, timestamp):
74+
"""Acknowledge device rebooted correctly and feed the test execution
75+
"""
76+
self.ready = True
77+
78+
try:
79+
if self.test_steps_sequence.send(value):
80+
self.notify_complete(True)
81+
except (StopIteration, RuntimeError) as exc:
82+
self.notify_complete(False)
83+
84+
def cb_reset_complete(self, key, value, timestamp):
85+
"""Acknowledge reset complete
86+
"""
87+
self.did_reset = True
88+
89+
try:
90+
if self.test_steps_sequence.send(value):
91+
self.notify_complete(True)
92+
except (StopIteration, RuntimeError) as exc:
93+
self.notify_complete(False)
94+
95+
def cb_device_test_suit_ended(self, key, value, timestamp):
96+
"""Acknowledge device finished a test step correctly and feed the test execution
97+
"""
98+
self.suite_ended = True
99+
100+
try:
101+
if self.test_steps_sequence.send(value):
102+
self.notify_complete(True)
103+
except (StopIteration, RuntimeError) as exc:
104+
self.notify_complete(False)
105+
106+
#define test steps and actions
107+
def test_steps(self):
108+
"""Test step 1
109+
"""
110+
wait_for_communication = yield
111+
112+
self.ready = False
113+
self.did_reset = False
114+
self.suite_ended = False
115+
self.send_kv(MSG_TRNG_TEST_STEP1, MSG_VALUE_DUMMY)
116+
wait_for_communication = yield
117+
if self.buffer == 0:
118+
raise RuntimeError('Phase 1: No buffer received.')
119+
120+
self.reset()
121+
122+
"""Test step 2 (After reset)
123+
"""
124+
wait_for_communication = yield
125+
if self.did_reset == False:
126+
raise RuntimeError('Phase 1: Platform did not reset as expected.')
127+
128+
self.send_kv(MSG_KEY_SYNC, MSG_VALUE_DUMMY)
129+
130+
wait_for_communication = yield
131+
132+
if self.ready == False:
133+
raise RuntimeError('Phase 1: Platform not ready as expected.')
134+
135+
self.send_kv(MSG_TRNG_TEST_STEP2, self.buffer)
136+
137+
wait_for_communication = yield
138+
139+
if self.suite_ended == False:
140+
raise RuntimeError('Test failed.')
141+
142+
self.send_kv(MSG_KEY_EXIT, MSG_VALUE_DUMMY)
143+
144+
# The sequence is correct -- test passed.
145+
yield

TESTS/mbed_drivers/crc/main.cpp

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,41 @@ void test_any_polynomial()
125125
}
126126
}
127127

128+
void test_thread(void)
129+
{
130+
char test[] = "123456789";
131+
uint32_t crc;
132+
MbedCRC<POLY_32BIT_ANSI, 32> ct;
133+
TEST_ASSERT_EQUAL(0, ct.compute((void *)test, strlen((const char*)test), &crc));
134+
TEST_ASSERT_EQUAL(0xCBF43926, crc);
135+
}
136+
137+
void test_thread_safety()
138+
{
139+
char test[] = "123456789";
140+
uint32_t crc;
141+
142+
MbedCRC<POLY_16BIT_IBM, 16> ct;
143+
144+
TEST_ASSERT_EQUAL(0, ct.compute_partial_start(&crc));
145+
TEST_ASSERT_EQUAL(0, ct.compute_partial((void *)&test, 4, &crc));
146+
147+
Thread t1(osPriorityNormal1, 320);
148+
t1.start(callback(test_thread));
149+
TEST_ASSERT_EQUAL(0, ct.compute_partial((void *)&test[4], 5, &crc));
150+
TEST_ASSERT_EQUAL(0, ct.compute_partial_stop(&crc));
151+
TEST_ASSERT_EQUAL(0xBB3D, crc);
152+
153+
// Wait for the thread to finish
154+
t1.join();
155+
}
156+
128157
Case cases[] = {
129158
Case("Test supported polynomials", test_supported_polynomials),
130159
Case("Test partial CRC", test_partial_crc),
131160
Case("Test SD CRC polynomials", test_sd_crc),
132-
Case("Test not supported polynomials", test_any_polynomial)
161+
Case("Test not supported polynomials", test_any_polynomial),
162+
Case("Test thread safety", test_thread_safety)
133163
};
134164

135165
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)

TESTS/mbed_drivers/mem_trace/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
#include <stdio.h>
2525
#include <stdarg.h>
2626

27-
#ifndef MBED_MEM_TRACING_ENABLED
28-
#error [NOT_SUPPORTED] test not supported
27+
#if !MBED_MEM_TRACING_ENABLED
28+
#error [NOT_SUPPORTED] test not supported
2929
#endif
3030

3131
using utest::v1::Case;

TESTS/mbed_hal/common_tickers/main.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,14 @@ void ticker_speed_test(void)
473473

474474
/* ---- Test fire_interrupt function. ---- */
475475
counter = NUM_OF_CALLS;
476+
/* Disable ticker interrupt which would interfere with speed test */
477+
core_util_critical_section_enter();
476478
start = us_ticker_read();
477479
while (counter--) {
478480
intf->fire_interrupt();
479481
}
480482
stop = us_ticker_read();
483+
core_util_critical_section_exit();
481484

482485
TEST_ASSERT(diff_us(start, stop, us_ticker_info) < (NUM_OF_CALLS * (MAX_FUNC_EXEC_TIME_US + DELTA_FUNC_EXEC_TIME_US)));
483486

@@ -569,7 +572,7 @@ utest::v1::status_t lp_ticker_teardown(const Case *const source, const size_t pa
569572

570573
utest::v1::status_t test_setup(const size_t number_of_cases)
571574
{
572-
GREENTEA_SETUP(30, "default_auto");
575+
GREENTEA_SETUP(80, "default_auto");
573576
return verbose_test_setup_handler(number_of_cases);
574577
}
575578

0 commit comments

Comments
 (0)