Skip to content

Commit 49044df

Browse files
author
Hasnain Virk
committed
Doc update and using PlatformMutex for tracing
We have updated the doc to reflect that 6K size can be achieved if you drop RTOS and use new-lib-nano. Instead of using mutex directly, we should use PlatformMutex so that if RTOS is not being used, adding trace may not end up in error.
1 parent 7507a35 commit 49044df

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,19 @@ Mbed LoRaWANStack initialized
141141
142142
```
143143

144+
## [Optional] Adding trace library
145+
To enable Mbed trace, add to your `mbed_app.json` the following fields:
146+
147+
```json
148+
"target_overrides": {
149+
"*": {
150+
"target.features_add": ["COMMON_PAL"],
151+
"mbed-trace.enable": true
152+
}
153+
}
154+
```
155+
The trace is disabled by default to save RAM.
156+
144157
## [Optional] Memory optimization
145158

146159
Using `Arm CC compiler` instead of `GCC` reduces `3K` of RAM. Currently the application takes about `15K` of static RAM with Arm CC, which spills over for the platforms with `20K` of RAM because you need to leave space, about `5K`, for dynamic allocation. So if you reduce the application stack size, you can barely fit into the 20K platforms.
@@ -153,6 +166,7 @@ For example, add the following into `config` section in your `mbed_app.json`:
153166
}
154167
```
155168

156-
Essentially you can make the whole application with Mbed LoRaWAN stack in 6K if you drop the RTOS from Mbed OS.
169+
Essentially you can make the whole application with Mbed LoRaWAN stack in 6K if you drop the RTOS from Mbed OS and use a smaller standard C/C++ library like new-lib-nano. Please find instructions [here](https://os.mbed.com/blog/entry/Reducing-memory-usage-with-a-custom-prin/).
170+
157171

158172
For more information, please follow this [blog post](https://os.mbed.com/blog/entry/Reducing-memory-usage-by-tuning-RTOS-con/).

trace_helper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ mbed::Serial pc(USBTX, USBRX, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
2929
*/
3030
#if defined(FEATURE_COMMON_PAL)
3131

32-
#include "rtos/Mutex.h"
32+
#include "platform/PlatformMutex.h"
3333
#include "mbed_trace.h"
3434

3535
/**
3636
* Local mutex object for synchronization
3737
*/
38-
static rtos::Mutex mutex;
38+
static PlatformMutex mutex;
3939

4040
static void serial_lock();
4141
static void serial_unlock();

0 commit comments

Comments
 (0)