Skip to content

Commit d220204

Browse files
authored
Merge pull request #2499 from ARMmbed/release
Release mbed lib v124 + mbed os 5.1.2
2 parents 0993ae5 + ec15ee6 commit d220204

File tree

394 files changed

+131375
-14087
lines changed

Some content is hidden

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

394 files changed

+131375
-14087
lines changed

.pylintrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[Format]
2+
max-line-length=80

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ python:
33

44
script:
55
- PYTHONPATH=. python tools/test/config_test/config_test.py
6+
- python tools/test/pylint.py
67
- py.test tools/test/toolchains/api.py
78
- python tools/build_travis.py
89
before_install:
@@ -17,3 +18,4 @@ install:
1718
- sudo pip install prettytable
1819
- sudo pip install jinja2
1920
- sudo pip install pytest
21+
- sudo pip install pylint

TESTS/mbedmicro-mbed/attributes/attributes.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,17 @@ int testDeprecatedUsed() {
137137
return 0;
138138
}
139139

140+
MBED_DEPRECATED_SINCE("mbed-os-3.14", "this message should not be displayed")
141+
void testDeprecatedSinceUnused();
142+
void testDeprecatedSinceUnused() { }
143+
144+
MBED_DEPRECATED_SINCE("mbed-os-3.14", "this message should be displayed")
145+
int testDeprecatedSinceUsed();
146+
int testDeprecatedSinceUsed() {
147+
return 0;
148+
}
149+
140150
int testDeprecated() {
141-
return testDeprecatedUsed();
151+
return testDeprecatedUsed() + testDeprecatedSinceUsed();
142152
}
143153

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#include "mbed.h"
2+
#include "test_env.h"
3+
#include "rtos.h"
4+
5+
#if defined(MBED_RTOS_SINGLE_THREAD)
6+
#error [NOT_SUPPORTED] test not supported
7+
#endif
8+
9+
#define NUM_THREADS 5
10+
#define THREAD_STACK_SIZE 256
11+
12+
DigitalOut led1(LED1);
13+
volatile bool should_exit = false;
14+
volatile bool allocation_failure = false;
15+
16+
void task_using_malloc(void)
17+
{
18+
void* data;
19+
while (1) {
20+
// Repeatedly allocate and free memory
21+
data = malloc(100);
22+
if (data != NULL) {
23+
memset(data, 0, 100);
24+
} else {
25+
allocation_failure = true;
26+
}
27+
free(data);
28+
29+
if (should_exit) {
30+
return;
31+
}
32+
}
33+
}
34+
35+
int main()
36+
{
37+
Thread *thread_list[NUM_THREADS];
38+
int test_time = 15;
39+
GREENTEA_SETUP(20, "default_auto");
40+
41+
// Allocate threads for the test
42+
for (int i = 0; i < NUM_THREADS; i++) {
43+
thread_list[i] = new Thread(osPriorityNormal, THREAD_STACK_SIZE);
44+
if (NULL == thread_list[i]) {
45+
allocation_failure = true;
46+
}
47+
thread_list[i]->start(task_using_malloc);
48+
}
49+
50+
// Give the test time to run
51+
while (test_time) {
52+
led1 = !led1;
53+
Thread::wait(1000);
54+
test_time--;
55+
}
56+
57+
// Join and delete all threads
58+
should_exit = 1;
59+
for (int i = 0; i < NUM_THREADS; i++) {
60+
if (NULL == thread_list[i]) {
61+
continue;
62+
}
63+
thread_list[i]->join();
64+
delete thread_list[i];
65+
}
66+
67+
GREENTEA_TESTSUITE_RESULT(!allocation_failure);
68+
}

features/net/FEATURE_IPV6/sal-stack-nanostack/TOOLCHAIN_ARM/TARGET_CORTEX_M/TARGET_M7/error_nanostack.c

Lines changed: 0 additions & 1 deletion
This file was deleted.

features/net/FEATURE_IPV6/sal-stack-nanostack/TOOLCHAIN_GCC/TARGET_CORTEX_M/TARGET_M7/error_nanostack.c

Lines changed: 0 additions & 1 deletion
This file was deleted.

features/net/FEATURE_IPV6/sal-stack-nanostack/TOOLCHAIN_IAR/TARGET_CORTEX_M/TARGET_M7/error_nanostack.c

Lines changed: 0 additions & 1 deletion
This file was deleted.

hal/api/FunctionPointer.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ namespace mbed {
2929
template <typename R, typename A1>
3030
class FunctionPointerArg1 : public Callback<R(A1)> {
3131
public:
32-
MBED_DEPRECATED("FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>")
32+
MBED_DEPRECATED_SINCE("mbed-os-5.1",
33+
"FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>")
3334
FunctionPointerArg1(R (*function)(A1) = 0)
3435
: Callback<R(A1)>(function) {}
3536

3637
template<typename T>
37-
MBED_DEPRECATED("FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>")
38+
MBED_DEPRECATED_SINCE("mbed-os-5.1",
39+
"FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>")
3840
FunctionPointerArg1(T *object, R (T::*member)(A1))
3941
: Callback<R(A1)>(object, member) {}
4042

@@ -46,12 +48,14 @@ class FunctionPointerArg1 : public Callback<R(A1)> {
4648
template <typename R>
4749
class FunctionPointerArg1<R, void> : public Callback<R()> {
4850
public:
49-
MBED_DEPRECATED("FunctionPointer has been replaced by Callback<void()>")
51+
MBED_DEPRECATED_SINCE("mbed-os-5.1",
52+
"FunctionPointer has been replaced by Callback<void()>")
5053
FunctionPointerArg1(R (*function)() = 0)
5154
: Callback<R()>(function) {}
5255

5356
template<typename T>
54-
MBED_DEPRECATED("FunctionPointer has been replaced by Callback<void()>")
57+
MBED_DEPRECATED_SINCE("mbed-os-5.1",
58+
"FunctionPointer has been replaced by Callback<void()>")
5559
FunctionPointerArg1(T *object, R (T::*member)())
5660
: Callback<R()>(object, member) {}
5761

hal/api/mbed.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#ifndef MBED_H
1717
#define MBED_H
1818

19-
#define MBED_LIBRARY_VERSION 123
19+
#define MBED_LIBRARY_VERSION 124
2020

2121
#if MBED_CONF_RTOS_PRESENT
2222
#include "rtos/rtos.h"

hal/api/toolchain.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
* Mark a function declaration as deprecated, if it used then a warning will be
208208
* issued by the compiler possibly including the provided message. Note that not
209209
* all compilers are able to display the message.
210-
*
210+
*
211211
* @code
212212
* #include "toolchain.h"
213213
*
@@ -225,6 +225,21 @@
225225
#endif
226226
#endif
227227

228+
/** MBED_DEPRECATED_SINCE("version", "message string")
229+
* Mark a function declaration as deprecated, noting that the declaration was
230+
* deprecated on the specified version. If the function is used then a warning
231+
* will be issued by the compiler possibly including the provided message.
232+
* Note that not all compilers are able to display this message.
233+
*
234+
* @code
235+
* #include "toolchain.h"
236+
*
237+
* MBED_DEPRECATED_SINCE("mbed-os-5.1", "don't foo any more, bar instead")
238+
* void foo(int arg);
239+
* @endcode
240+
*/
241+
#define MBED_DEPRECATED_SINCE(D, M) MBED_DEPRECATED(M " [since " D "]")
242+
228243

229244
// FILEHANDLE declaration
230245
#if defined(TOOLCHAIN_ARM)

hal/common/retarget.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include "mbed_interface.h"
2424
#include "SingletonPtr.h"
2525
#include "PlatformMutex.h"
26+
#include "mbed_error.h"
27+
#include <stdlib.h>
2628
#if DEVICE_STDIO_MESSAGES
2729
#include <stdio.h>
2830
#endif
@@ -68,6 +70,10 @@ extern const char __stdout_name[] = "/stdout";
6870
extern const char __stderr_name[] = "/stderr";
6971
#endif
7072

73+
// Heap limits - only used if set
74+
unsigned char *mbed_heap_start = 0;
75+
uint32_t mbed_heap_size = 0;
76+
7177
/* newlib has the filehandle field in the FILE struct as a short, so
7278
* we can't just return a Filehandle* from _open and instead have to
7379
* put it in a filehandles array and return the index into that array
@@ -596,6 +602,12 @@ extern "C" caddr_t _sbrk(int incr) {
596602
return (caddr_t)-1;
597603
}
598604

605+
// Additional heap checking if set
606+
if (mbed_heap_size && (new_heap >= mbed_heap_start + mbed_heap_size)) {
607+
errno = ENOMEM;
608+
return (caddr_t)-1;
609+
}
610+
599611
heap = new_heap;
600612
return (caddr_t) prev_heap;
601613
}
@@ -714,3 +726,34 @@ extern "C" void __env_unlock( struct _reent *_r )
714726
#endif
715727

716728
} // namespace mbed
729+
730+
void *operator new(std::size_t count)
731+
{
732+
void *buffer = malloc(count);
733+
if (NULL == buffer) {
734+
error("Operator new out of memory\r\n");
735+
}
736+
return buffer;
737+
}
738+
739+
void *operator new[](std::size_t count)
740+
{
741+
void *buffer = malloc(count);
742+
if (NULL == buffer) {
743+
error("Operator new[] out of memory\r\n");
744+
}
745+
return buffer;
746+
}
747+
748+
void operator delete(void *ptr)
749+
{
750+
if (ptr != NULL) {
751+
free(ptr);
752+
}
753+
}
754+
void operator delete[](void *ptr)
755+
{
756+
if (ptr != NULL) {
757+
free(ptr);
758+
}
759+
}

0 commit comments

Comments
 (0)