Skip to content

Commit 6b98a59

Browse files
committed
Merge remote-tracking branch 'refs/remotes/ARMmbed/master'
2 parents a7248c3 + 24e1218 commit 6b98a59

File tree

274 files changed

+21931
-3603
lines changed

Some content is hidden

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

274 files changed

+21931
-3603
lines changed

.github/issue_template.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Note: This is just a template, so feel free to use/remove the unnecessary things
2+
3+
### 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+
**meed-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
47+
48+
**How to?**

.github/pull_request_template.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Notes:
2+
* Pull requests will not be accepted until the submitter has agreed to the [contributer agreement](https://github.com/ARMmbed/mbed-os/blob/master/CONTRIBUTING.md).
3+
* This is just a template, so feel free to use/remove the unnecessary things
4+
5+
## Description
6+
A few sentences describing the overall goals of the pull request's commits.
7+
8+
9+
## Status
10+
**READY/IN DEVELOPMENT/HOLD**
11+
12+
13+
## Migrations
14+
If this PR changes any APIs or behaviors, give a short description of what *API users* should do when this PR is merged.
15+
16+
YES | NO
17+
18+
19+
## Related PRs
20+
List related PRs against other branches:
21+
22+
branch | PR
23+
------ | ------
24+
other_pr_production | [link]()
25+
other_pr_master | [link]()
26+
27+
28+
## Todos
29+
- [ ] Tests
30+
- [ ] Documentation
31+
32+
33+
## Deploy notes
34+
Notes regarding the deployment of this PR. These should note any
35+
required changes in the build environment, tools, compilers, etc.
36+
37+
38+
## Steps to test or reproduce
39+
Outline the steps to test or reproduce the PR here.

TESTS/mbed_drivers/lp_timeout/main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,15 @@ void lp_timeout_1s_deepsleep(void)
4343
{
4444
complete = false;
4545

46-
timestamp_t start = us_ticker_read();
46+
/*
47+
* We use here lp_ticker_read() instead of us_ticker_read() for start and
48+
* end because the microseconds timer might be disable during deepsleep.
49+
*/
50+
timestamp_t start = lp_ticker_read();
4751
lpt.attach(&cb_done, 1);
4852
deepsleep();
4953
while (!complete);
50-
timestamp_t end = us_ticker_read();
54+
timestamp_t end = lp_ticker_read();
5155

5256
/* It takes longer to wake up from deep sleep */
5357
TEST_ASSERT_UINT32_WITHIN(LONG_TIMEOUT, 1000000, end - start);

TESTS/mbed_drivers/race_test/main.cpp

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
/*
2+
* Copyright (c) 2016-2016, ARM Limited, All Rights Reserved
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
* 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, WITHOUT
13+
* 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+
#include "mbed.h"
18+
#include "rtos.h"
19+
#include "greentea-client/test_env.h"
20+
#include "unity/unity.h"
21+
#include "utest/utest.h"
22+
#include "SingletonPtr.h"
23+
#include <stdio.h>
24+
25+
using namespace utest::v1;
26+
27+
#define TEST_STACK_SIZE 1024
28+
static uint32_t instance_count = 0;
29+
30+
class TestClass {
31+
public:
32+
TestClass() {
33+
printf("TestClass ctor start\r\n");
34+
Thread::wait(500);
35+
instance_count++;
36+
printf("TestClass ctor end\r\n");
37+
}
38+
39+
void do_something() {
40+
printf("Do something called\r\n");
41+
}
42+
43+
~TestClass() {
44+
instance_count--;
45+
}
46+
};
47+
48+
static TestClass* get_test_class()
49+
{
50+
static TestClass tc;
51+
return &tc;
52+
}
53+
54+
static SingletonPtr<TestClass> test_class;
55+
56+
static void main_func_race()
57+
{
58+
get_test_class();
59+
}
60+
61+
static void main_class_race()
62+
{
63+
test_class->do_something();
64+
}
65+
66+
void test_case_func_race()
67+
{
68+
printf("Running function race test\r\n");
69+
Callback<void()> cb(main_func_race);
70+
Thread *t1 = new Thread(osPriorityNormal, TEST_STACK_SIZE);
71+
Thread *t2 = new Thread(osPriorityNormal, TEST_STACK_SIZE);
72+
73+
// Start start first thread
74+
t1->start(cb);
75+
// Start second thread while the first is inside the constructor
76+
Thread::wait(250);
77+
t2->start(cb);
78+
79+
// Wait for the threads to finish
80+
t1->join();
81+
t2->join();
82+
83+
delete t1;
84+
delete t2;
85+
86+
TEST_ASSERT_EQUAL_UINT32(1, instance_count);
87+
88+
// Reset instance count
89+
instance_count = 0;
90+
}
91+
92+
void test_case_class_race()
93+
{
94+
printf("Running class race test\r\n");
95+
Callback<void()> cb(main_class_race);
96+
Thread *t1 = new Thread(osPriorityNormal, TEST_STACK_SIZE);
97+
Thread *t2 = new Thread(osPriorityNormal, TEST_STACK_SIZE);
98+
99+
// Start start first thread
100+
t1->start(cb);
101+
// Start second thread while the first is inside the constructor
102+
Thread::wait(250);
103+
t2->start(cb);
104+
105+
// Wait for the threads to finish
106+
t1->join();
107+
t2->join();
108+
109+
delete t1;
110+
delete t2;
111+
112+
TEST_ASSERT_EQUAL_UINT32(1, instance_count);
113+
114+
// Reset instance count
115+
instance_count = 0;
116+
}
117+
118+
Case cases[] = {
119+
Case("function init race", test_case_func_race),
120+
Case("class init race", test_case_class_race),
121+
};
122+
123+
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
124+
{
125+
GREENTEA_SETUP(20, "default_auto");
126+
return greentea_test_setup_handler(number_of_cases);
127+
}
128+
129+
Specification specification(greentea_test_setup, cases, greentea_test_teardown_handler);
130+
131+
int main()
132+
{
133+
Harness::run(specification);
134+
}

0 commit comments

Comments
 (0)