Skip to content

Mbed os 5.1 #2564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 85 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
a6895df
STM32F1 serial_api initialize failure message
evark Aug 3, 2016
4aaec8d
Alignment fixed
evark Aug 4, 2016
cde0575
Add ARDUINO to supported form factors of F429ZI
c1728p9 Aug 5, 2016
9625fde
Fix docs/BUILDING.md error command issue
kclin Aug 6, 2016
88f412f
uVisor: Update README
AlessandroA Aug 8, 2016
80b1ff1
uVisor: Update the RPC header files
AlessandroA Aug 8, 2016
e32b258
Fix joining a terminated thread
c1728p9 Aug 8, 2016
c9a7f73
Merge pull request #2413 from 0xc0170/fix_5.1.1
sg- Aug 11, 2016
f4aabc4
mbed lib revision - 123
0xc0170 Aug 9, 2016
fbbb64a
Rename cmsis K64F to MCU_K64F
0xc0170 Aug 11, 2016
0b36174
Target hexiwear - add mcu_k64f label
0xc0170 Aug 11, 2016
1310bd1
K64F - HAL common part prefixed with MCU_K64F
0xc0170 Aug 11, 2016
cd9b178
MTS Gambit - remove serial flow control
0xc0170 Aug 11, 2016
133d7b3
K64F serial - fix device macro for serial flow
0xc0170 Aug 11, 2016
f1fb66c
Merge pull request #2428 from 0xc0170/fix_k64f_mcu
0xc0170 Aug 12, 2016
0993ae5
Merge pull request #2436 from ARMmbed/release
sg- Aug 12, 2016
8d740d5
Add a test for thread-safe malloc
c1728p9 Jul 30, 2016
c88f282
Added the missing on-board SPI LSM303C sensor SPI pin definition to a…
Aug 1, 2016
3622e3a
Update analogin_api.c
peeyushpashine Aug 3, 2016
490d5e7
Clean pwm and analog definition
svastm Jul 21, 2016
0c12ad5
Clean pwm and analog definition
svastm Jul 21, 2016
ecd2945
Add Cortex-M7 Nanostack binaries
c1728p9 Aug 5, 2016
2190391
KL27Z: Fix duplicate define error
mmahadevan108 Aug 9, 2016
e913f49
Fix heap limit checking and make memory explicit
c1728p9 Jul 29, 2016
91a48a8
Adjust stack size for the nrf51
c1728p9 Aug 3, 2016
4ce977e
Override new and delete operators to trap errors
c1728p9 Aug 1, 2016
863eddb
Correctly set INITIAL_SP for K64F
c1728p9 Aug 3, 2016
0bd2573
Turn on main thread stack checking
c1728p9 Jul 29, 2016
59e4e81
Add a test for heap and stack layout
c1728p9 Jul 29, 2016
5dd5df2
Decrease NUC472 interrupt stack size
c1728p9 Aug 8, 2016
5046c2e
Fix nrf52 initial stack pointer in ARMCC
c1728p9 Aug 9, 2016
1a465d6
Increase interrupt stack size for K64F
c1728p9 Aug 9, 2016
fb70f79
Fix possible overflow of NRF51 os tick.
pan- Aug 10, 2016
cf09dce
Create MBED_A28 test in the common list
jeromecoutant Aug 10, 2016
7de28b5
Add Serial Flow Control pins
bcostm Aug 10, 2016
396f563
Add Serial Flow Control pins
bcostm Aug 10, 2016
6c872f3
Add Serial Flow Control pins
bcostm Aug 10, 2016
1e8e71e
Add Serial Flow Control pins
bcostm Aug 10, 2016
8091386
Add Serial Flow Control pins
bcostm Aug 10, 2016
2c1a790
Add Serial Flow Control pins
bcostm Aug 10, 2016
418e9f0
Activate SERIAL_FC in targets.json
bcostm Aug 10, 2016
3b9b2ec
Add missing serial flow control elements in serial structure
bcostm Aug 10, 2016
ed57495
build_mbed_libs is now aware of the configuration
Aug 10, 2016
ffcfc88
CAN loopback test: correct some NUCLEO pin
jeromecoutant Aug 11, 2016
70abacc
Add config data to build_lib in build_api.py
Aug 11, 2016
040ae6c
Remove argument from tool/project.py -b
theotherjimmy Aug 11, 2016
622347f
Add asynchronous serial
svastm Aug 8, 2016
ef1ffaf
Enable asynchronous serial
svastm Aug 8, 2016
c247f2f
Add tests for asynchronous serial
svastm Aug 8, 2016
a459e85
Improve error for missing name from mbed_lib.json
theotherjimmy Aug 11, 2016
61cd9eb
Add support for IAR compiler
fvincenzo Aug 11, 2016
5ddba77
Change release_version to 5
fvincenzo Aug 12, 2016
74de744
Add support for mbed OS 5
ytsuboi Aug 15, 2016
a007d91
Add support for KL43Z using KSDK 2.0
mmahadevan108 Aug 5, 2016
8753dd6
Add support for FRDM K66
mmahadevan108 Aug 9, 2016
2598daa
Fixed I2C bug.
jeremybrodt Aug 16, 2016
0f847f4
Fixed i2c_byte_write() return value.
jeremybrodt Aug 16, 2016
a135a9a
Fixed analogout bugs.
jeremybrodt Aug 16, 2016
0c59485
Updated bit-band macros to match latest MXC convention.
jeremybrodt Aug 16, 2016
2e786ba
Added missing register definitions.
jeremybrodt Aug 16, 2016
69d4a92
Synchronizing SPI drivers.
jeremybrodt Aug 16, 2016
5b4a0b4
Stylize utils.py
theotherjimmy Jul 27, 2016
899d8c5
Format bulid_api
theotherjimmy Aug 12, 2016
f65b6d3
Glorify config.py (passes pylint)
theotherjimmy Aug 12, 2016
7600a32
Edit the English of the docstrings
theotherjimmy Aug 12, 2016
5755127
Reveal cumulative attributes from Targets
theotherjimmy Aug 12, 2016
e40d95e
Format targets.py
theotherjimmy Aug 12, 2016
895d717
Expand docstrings in build_api
theotherjimmy Aug 15, 2016
7d733fe
Format and add docstrings to memmap
theotherjimmy Aug 15, 2016
de065ab
Format and document colorize
theotherjimmy Aug 15, 2016
4cdd267
Format paths python module
theotherjimmy Aug 15, 2016
d25230f
Add pylint configuration file
theotherjimmy Aug 15, 2016
c7bc655
Format and document libraries.py
theotherjimmy Aug 15, 2016
efb7cfb
Format detect_targets.py
theotherjimmy Aug 15, 2016
b12ad8e
Format and document hooks.py
theotherjimmy Aug 15, 2016
af5d35d
Format and document options.py
theotherjimmy Aug 15, 2016
6d70a7a
Add pylint testing to Travis
theotherjimmy Aug 15, 2016
26e7a35
Fix remaining issues in targets.py
theotherjimmy Aug 15, 2016
1dc77ac
Made linting a recommendation and raised the bar for printing
theotherjimmy Aug 16, 2016
aa9b5df
Added more well-defined garuntees on deprecation notices in mbed
geky Aug 8, 2016
7b02d53
Updated deprecation notices to match branch names
geky Aug 17, 2016
0b195e8
Added exporting support
ytsuboi Aug 17, 2016
5a78cf3
mbed lib revision - 124
0xc0170 Aug 18, 2016
ec15ee6
targets - KL27Z IAR removal
0xc0170 Aug 19, 2016
d220204
Merge pull request #2499 from ARMmbed/release
0xc0170 Aug 19, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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);
}
2 changes: 1 addition & 1 deletion docs/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ Build successes:
```
* We can print all 'programs' (test cases) ```make.py``` can build for us:
```
$ python make.py
$ python make.py -L
.
[ 0] MBED_A1: Basic
[ 1] MBED_A2: Semihost file system
Expand Down
27 changes: 16 additions & 11 deletions features/FEATURE_UVISOR/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,14 @@ In the code above we specified 3 elements:
1. Main box Access Control Lists (ACLs). Since with uVisor enabled everything runs in unprivileged mode, we need to make sure that peripherals that are accessed by the OS and the main box are allowed. These peripherals are specified using a list like the one in the snippet above. For the purpose of this example we provide you the list of all the ACLs that we know you will need. For other platforms or other applications you need to determine those ACLs following a process that is described in a [section](#the-main-box-acls) below.
1. App-specific uVisor configurations: `UVISOR_SET_MODE_ACL`. This macro sets the uVisor mode (enabled) and associates the list of ACLs we just created with the main box.

Before compiling, we need to add a custom target that inherits all the features of the original `K64F` target, and enables the uVisor feature. To do so, add the file `~/code/uvisor-example/mbed_app.json` with the following content:
Before compiling, we need to override the original `K64F` target to enable the uVisor feature. To do so, add the file `~/code/uvisor-example/mbed_app.json` with the following content:

```JSON
{
"custom_targets": {
"K64F_SECURE": {
"inherits": ["K64F"],
"extra_labels_add":["K64F", "UVISOR_SUPPORTED"],
"features_add": ["UVISOR"]
"target_overrides": {
"K64F": {
"target.features_add": ["UVISOR"],
"target.extra_labels_add": ["UVISOR_SUPPORTED"]
}
}
}
Expand All @@ -147,16 +146,16 @@ Before compiling, we need to add a custom target that inherits all the features

**Checkpoint**

Compile the application again, but this time targeting `K64F_SECURE`:
Compile the application again. This time the `K64F` target will include the new features and labels we provided in `mbed_app.json`;

```bash
$ mbed compile -m K64F_SECURE -t GCC_ARM
$ mbed compile -m K64F -t GCC_ARM
```

The binary will be located at:

```bash
~/code/uvisor-example/.build/K64F_SECURE/GCC_ARM/uvisor-example.bin
~/code/uvisor-example/.build/K64F/GCC_ARM/uvisor-example.bin
```

Re-flash the device and press the reset button. The device LED should be blinking as in the previous case.
Expand Down Expand Up @@ -290,7 +289,13 @@ A few things to note in the code above:

**Checkpoint**

Compile the application again, re-flash the device, and press the reset button. The device LED should be blinking as in the previous case.
Compile the application again:

```bash
$ mbed compile -m K64F -t GCC_ARM
```

Re-flash the device, and press the reset button. The device LED should be blinking as in the previous case.

If you don't see the LED blinking, it means that the application halted somewhere, probably because uVisor captured a fault. You can setup the uVisor debug messages to see if there is any problem. Follow the [Debugging uVisor on mbed OS](DEBUGGING.md) document for a step-by-step guide.

Expand Down Expand Up @@ -374,7 +379,7 @@ static const UvisorBoxAclItem g_main_box_acls[] = {
You now need to compile your application using uVisor in debug mode. This operation requires some more advanced steps, which are described in detail in the [Debugging uVisor on mbed OS](DEBUGGING.md) document. The main idea is that you compile the application in debug mode:

```bash
$ mbed compile -m K64F_SECURE -t GCC_ARM -o "debug-info"
$ mbed compile -m K64F -t GCC_ARM -o "debug-info"
```

and then use a GDB-compatible interface to flash the device, enable semihosting, and access the uVisor debug messages. Please read the [Debugging uVisor on mbed OS](DEBUGGING.md) document for the detailed instructions.
Expand Down
18 changes: 16 additions & 2 deletions features/FEATURE_UVISOR/includes/uvisor/api/inc/rpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
typedef uint32_t uvisor_rpc_result_t;

typedef uint32_t (*TFN_Ptr)(uint32_t, uint32_t, uint32_t, uint32_t);
typedef int (*TFN_RPC_Callback)(int);

/** Wait for incoming RPC.
*
Expand All @@ -43,6 +42,21 @@ typedef int (*TFN_RPC_Callback)(int);
* @param timeout_ms specifies how long to wait (in ms) for an incoming RPC
* message before returning
*/
int rpc_fncall_waitfor(const TFN_Ptr fn_ptr_array[], size_t fn_count, uint32_t timeout_ms);
UVISOR_EXTERN int rpc_fncall_waitfor(const TFN_Ptr fn_ptr_array[], size_t fn_count, uint32_t timeout_ms);

/** Wait for an outgoing RPC to finish.
*
* Wait for the result of a previously started asynchronous RPC. After this
* call, ret will contain the return value of the RPC. The return value of this
* function may indicate that there was an error or a timeout with non-zero.
*
* @param result[in] The token to wait on for the result of an asynchronous RPC
* @param timeout_ms[in] How long to wait (in ms) for the asynchronous RPC
* message to finish before returning
* @param ret[out] The return value resulting from the finished RPC to
* the target function
* @returns Non-zero on error or timeout, zero on successful wait
*/
UVISOR_EXTERN int rpc_fncall_wait(uvisor_rpc_result_t result, uint32_t timeout_ms, uint32_t * ret);

#endif /* __UVISOR_API_RPC_H__ */

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 122
#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