Skip to content

Commit

Permalink
Merge pull request #2499 from ARMmbed/release
Browse files Browse the repository at this point in the history
Release mbed lib v124 + mbed os 5.1.2
  • Loading branch information
0xc0170 authored Aug 19, 2016
2 parents 0993ae5 + ec15ee6 commit d220204
Show file tree
Hide file tree
Showing 394 changed files with 131,375 additions and 14,087 deletions.
2 changes: 2 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Format]
max-line-length=80
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ python:

script:
- PYTHONPATH=. python tools/test/config_test/config_test.py
- python tools/test/pylint.py
- py.test tools/test/toolchains/api.py
- python tools/build_travis.py
before_install:
Expand All @@ -17,3 +18,4 @@ install:
- sudo pip install prettytable
- sudo pip install jinja2
- sudo pip install pytest
- sudo pip install pylint
12 changes: 11 additions & 1 deletion TESTS/mbedmicro-mbed/attributes/attributes.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,17 @@ int testDeprecatedUsed() {
return 0;
}

MBED_DEPRECATED_SINCE("mbed-os-3.14", "this message should not be displayed")
void testDeprecatedSinceUnused();
void testDeprecatedSinceUnused() { }

MBED_DEPRECATED_SINCE("mbed-os-3.14", "this message should be displayed")
int testDeprecatedSinceUsed();
int testDeprecatedSinceUsed() {
return 0;
}

int testDeprecated() {
return testDeprecatedUsed();
return testDeprecatedUsed() + testDeprecatedSinceUsed();
}

68 changes: 68 additions & 0 deletions TESTS/mbedmicro-rtos-mbed/malloc/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#include "mbed.h"
#include "test_env.h"
#include "rtos.h"

#if defined(MBED_RTOS_SINGLE_THREAD)
#error [NOT_SUPPORTED] test not supported
#endif

#define NUM_THREADS 5
#define THREAD_STACK_SIZE 256

DigitalOut led1(LED1);
volatile bool should_exit = false;
volatile bool allocation_failure = false;

void task_using_malloc(void)
{
void* data;
while (1) {
// Repeatedly allocate and free memory
data = malloc(100);
if (data != NULL) {
memset(data, 0, 100);
} else {
allocation_failure = true;
}
free(data);

if (should_exit) {
return;
}
}
}

int main()
{
Thread *thread_list[NUM_THREADS];
int test_time = 15;
GREENTEA_SETUP(20, "default_auto");

// Allocate threads for the test
for (int i = 0; i < NUM_THREADS; i++) {
thread_list[i] = new Thread(osPriorityNormal, THREAD_STACK_SIZE);
if (NULL == thread_list[i]) {
allocation_failure = true;
}
thread_list[i]->start(task_using_malloc);
}

// Give the test time to run
while (test_time) {
led1 = !led1;
Thread::wait(1000);
test_time--;
}

// Join and delete all threads
should_exit = 1;
for (int i = 0; i < NUM_THREADS; i++) {
if (NULL == thread_list[i]) {
continue;
}
thread_list[i]->join();
delete thread_list[i];
}

GREENTEA_TESTSUITE_RESULT(!allocation_failure);
}

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
12 changes: 8 additions & 4 deletions hal/api/FunctionPointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ namespace mbed {
template <typename R, typename A1>
class FunctionPointerArg1 : public Callback<R(A1)> {
public:
MBED_DEPRECATED("FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>")
MBED_DEPRECATED_SINCE("mbed-os-5.1",
"FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>")
FunctionPointerArg1(R (*function)(A1) = 0)
: Callback<R(A1)>(function) {}

template<typename T>
MBED_DEPRECATED("FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>")
MBED_DEPRECATED_SINCE("mbed-os-5.1",
"FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>")
FunctionPointerArg1(T *object, R (T::*member)(A1))
: Callback<R(A1)>(object, member) {}

Expand All @@ -46,12 +48,14 @@ class FunctionPointerArg1 : public Callback<R(A1)> {
template <typename R>
class FunctionPointerArg1<R, void> : public Callback<R()> {
public:
MBED_DEPRECATED("FunctionPointer has been replaced by Callback<void()>")
MBED_DEPRECATED_SINCE("mbed-os-5.1",
"FunctionPointer has been replaced by Callback<void()>")
FunctionPointerArg1(R (*function)() = 0)
: Callback<R()>(function) {}

template<typename T>
MBED_DEPRECATED("FunctionPointer has been replaced by Callback<void()>")
MBED_DEPRECATED_SINCE("mbed-os-5.1",
"FunctionPointer has been replaced by Callback<void()>")
FunctionPointerArg1(T *object, R (T::*member)())
: Callback<R()>(object, member) {}

Expand Down
2 changes: 1 addition & 1 deletion hal/api/mbed.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#ifndef MBED_H
#define MBED_H

#define MBED_LIBRARY_VERSION 123
#define MBED_LIBRARY_VERSION 124

#if MBED_CONF_RTOS_PRESENT
#include "rtos/rtos.h"
Expand Down
17 changes: 16 additions & 1 deletion hal/api/toolchain.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
* Mark a function declaration as deprecated, if it used then a warning will be
* issued by the compiler possibly including the provided message. Note that not
* all compilers are able to display the message.
*
*
* @code
* #include "toolchain.h"
*
Expand All @@ -225,6 +225,21 @@
#endif
#endif

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


// FILEHANDLE declaration
#if defined(TOOLCHAIN_ARM)
Expand Down
43 changes: 43 additions & 0 deletions hal/common/retarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include "mbed_interface.h"
#include "SingletonPtr.h"
#include "PlatformMutex.h"
#include "mbed_error.h"
#include <stdlib.h>
#if DEVICE_STDIO_MESSAGES
#include <stdio.h>
#endif
Expand Down Expand Up @@ -68,6 +70,10 @@ extern const char __stdout_name[] = "/stdout";
extern const char __stderr_name[] = "/stderr";
#endif

// Heap limits - only used if set
unsigned char *mbed_heap_start = 0;
uint32_t mbed_heap_size = 0;

/* newlib has the filehandle field in the FILE struct as a short, so
* we can't just return a Filehandle* from _open and instead have to
* put it in a filehandles array and return the index into that array
Expand Down Expand Up @@ -596,6 +602,12 @@ extern "C" caddr_t _sbrk(int incr) {
return (caddr_t)-1;
}

// Additional heap checking if set
if (mbed_heap_size && (new_heap >= mbed_heap_start + mbed_heap_size)) {
errno = ENOMEM;
return (caddr_t)-1;
}

heap = new_heap;
return (caddr_t) prev_heap;
}
Expand Down Expand Up @@ -714,3 +726,34 @@ extern "C" void __env_unlock( struct _reent *_r )
#endif

} // namespace mbed

void *operator new(std::size_t count)
{
void *buffer = malloc(count);
if (NULL == buffer) {
error("Operator new out of memory\r\n");
}
return buffer;
}

void *operator new[](std::size_t count)
{
void *buffer = malloc(count);
if (NULL == buffer) {
error("Operator new[] out of memory\r\n");
}
return buffer;
}

void operator delete(void *ptr)
{
if (ptr != NULL) {
free(ptr);
}
}
void operator delete[](void *ptr)
{
if (ptr != NULL) {
free(ptr);
}
}
Loading

0 comments on commit d220204

Please sign in to comment.