Skip to content

Commit dfbfa54

Browse files
committed
Use words for main task stack size config.
* Update readme * Update platform.json
1 parent a743a0c commit dfbfa54

File tree

6 files changed

+29
-15
lines changed

6 files changed

+29
-15
lines changed

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,28 @@ This Arduino Core does **not** contain any BLE functionality. It has been design
6969

7070
## Installing
7171

72-
### Board Manager
72+
### Platformio
73+
1. [Install PlatformIO](https://platformio.org)
74+
2. Create PlatformIO project and configure a platform option in [platformio.ini](http://docs.platformio.org/page/projectconf.html) file:
75+
76+
```ini
77+
[env]
78+
platform = https://github.com/h2zero/platform-n-able.git
79+
framework = arduino
80+
lib_deps = h2zero/NimBLE-Arduino@^1.4.0
81+
board = ...
82+
...
83+
```
84+
85+
### Arduino Board Manager
7386
1. [Download and install the Arduino IDE](https://www.arduino.cc/en/Main/Software) (At least v1.6.12)
7487
2. Start the Arduino IDE
7588
3. Go into Preferences
7689
4. Add ```https://h2zero.github.io/n-able-Arduino/package_n-able_boards_index.json``` as an "Additional Board Manager URL"
7790
5. Open the Boards Manager from the Tools -> Board menu and install "Arm BLE Boards"
7891
6. Select your board from the Tools -> Board menu
7992

80-
### From git (for core development)
93+
#### From git (for core development)
8194
1. Follow steps from Board Manager section above
8295
2. ```cd <SKETCHBOOK>```, where ```<SKETCHBOOK>``` is your Arduino Sketch folder:
8396
* OS X: ```~/Documents/Arduino```
@@ -109,10 +122,10 @@ This Arduino Core does **not** contain any BLE functionality. It has been design
109122
## Configuration (optional)
110123
You can change the configuration for many settings by creating a `build_opt.h` file in your sketch folder.
111124
In here you can set compile time definitions for settings that will be included directly on the command line.
112-
For example: `'-DCONFIG_MAIN_TASK_STACK_SIZE=2048'` This will set the main task stack size to 2048 bytes.
125+
For example: `'-DCONFIG_MAIN_TASK_STACK_SIZE=512'` This will set the main task stack size to 512 words (2048 bytes).
113126

114127
### Configuration option list
115-
* `CONFIG_MAIN_TASK_STACK_SIZE` - sets the size **in bytes** of the main loop task.
128+
* `CONFIG_MAIN_TASK_STACK_SIZE` - sets the size **in 32bit words** of the main loop task.
116129
* `CONFIG_RTOS_TICK_RATE_HZ` - set the tick rate for FreeRTOS (default 1024).
117130
* `CONFIG_RTOS_MAX_PRIORITIES` - set the maximum priority level for FreeRTOS tasks.
118131
* `CONFIG_RTOS_MIN_TASK_STACK_SIZE` - set the minimum task stack size.

cores/nRF5/main.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
# define MAIN_TASK_STACK_SIZE CONFIG_MAIN_TASK_STACK_SIZE
2727
#elif defined(DEVICE_RAM_SIZE)
2828
# if DEVICE_RAM_SIZE < 32
29-
# define MAIN_TASK_STACK_SIZE 1024
29+
# define MAIN_TASK_STACK_SIZE 256
3030
# else
31-
# define MAIN_TASK_STACK_SIZE 2048
31+
# define MAIN_TASK_STACK_SIZE 512
3232
# endif
3333
#else
34-
# define MAIN_TASK_STACK_SIZE 2048
34+
# define MAIN_TASK_STACK_SIZE 512
3535
#endif
3636

3737
// Weak empty variant initialization function.
@@ -40,7 +40,7 @@ void initVariant() __attribute__((weak));
4040
void initVariant() { }
4141

4242
static TaskHandle_t _loopTaskHandle = NULL;
43-
static StackType_t _mainStack[ (MAIN_TASK_STACK_SIZE / 4) ];
43+
static StackType_t _mainStack[ MAIN_TASK_STACK_SIZE ];
4444
static StaticTask_t _mainTaskBuffer;
4545

4646
void loopTask(void *pvParameters)
@@ -67,8 +67,8 @@ int main( void )
6767
Adafruit_TinyUSB_Core_init();
6868
#endif
6969

70-
_loopTaskHandle = xTaskCreateStatic(loopTask, "mlt", (MAIN_TASK_STACK_SIZE / 4),
71-
NULL, 1, _mainStack, &_mainTaskBuffer);
70+
_loopTaskHandle = xTaskCreateStatic(loopTask, "mlt", MAIN_TASK_STACK_SIZE,
71+
NULL, 1, _mainStack, &_mainTaskBuffer);
7272

7373
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
7474

libraries/n-able/examples/BLE_Advertiser/build_opt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'-DCONFIG_MAIN_TASK_STACK_SIZE=512'
1+
'-DCONFIG_MAIN_TASK_STACK_SIZE=128'
22
'-DCONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=1024'
33
'-DCONFIG_BT_NIMBLE_ROLE_CENTRAL_DISABLED'
44
'-DCONFIG_BT_NIMBLE_ROLE_OBSERVER_DISABLED'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'-DCONFIG_MAIN_TASK_STACK_SIZE=512'
1+
'-DCONFIG_MAIN_TASK_STACK_SIZE=128'
22
'-DCONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE=1024'
33
'-DCONFIG_BT_NIMBLE_ROLE_PERIPHERAL_DISABLED'
44
'-DCONFIG_BT_NIMBLE_ROLE_BROADCASTER_DISABLED'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
'-DCONFIG_MAIN_TASK_STACK_SIZE=256'
1+
'-DCONFIG_MAIN_TASK_STACK_SIZE=64'

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
"framework",
77
"Arduino",
88
"BLE",
9-
"nRF5",
9+
"nRF51",
10+
"nRF52",
1011
"ARM"
1112
],
1213
"license": "LGPL-2.1-or-later",
1314
"repository": {
1415
"type": "git",
15-
"url": "https://github.com/h2zero/n-able.git"
16+
"url": "https://github.com/h2zero/n-able-Arduino.git"
1617
}
1718
}

0 commit comments

Comments
 (0)