08-20-2021 01:44 PM
Hi, when uploading the code below, which is using a "large" array, to the Arduino Nicla Sense ME, the following error message comes up:
++ MbedOS Error Info ++
Error Status: 0x80FF0144 Code: 324 Module: 255
Error Message: Assertion failed: _stack_buffer != NULL
Location: 0x430B9
File: ./mbed-os/connectivity/drivers/ble/FEATURE_BLE/TARGET_NORDIC/TARGET_NORDIC_CORDIO/TARGET_NRF5x/NRFCordioHCIDriver.cpp+186
Error Value: 0x0
Current Thread: main Id: 0x200051B4 Entry: 0x19E6F StackSize: 0xC00 StackMem: 0x20004590 SP: 0x2000508C
For more info, visit: https://mbed.com/s/error?error=0x80FF0144&tgt=NICLA
-- MbedOS Error Info --
This does not happen if the array is small (e.g. 2 instead of 800), or if the line "BHY2.begin();" is commented out. The example sketches work, but just adding a large array to the code leads to this error.
The Code:
#include "Arduino_BHY2.h"
int all_readings[800];
void setup() {
all_readings[0] = 0;
BHY2.begin(); // if this command is commented out: no error is thrown
}
void loop() {
BHY2.update(); // this line does not impact the error, so commenting it out has no effect on the error.
}
10-23-2023 06:26 AM
hi @hkayan
The mbed-os library could be compiled using the github repo: https://github.com/arduino/ArduinoCore-mbed
You could follow the documentation within the README. Hopefully this helps a little bit and you get a smooth build.
10-23-2023 09:36 AM
Thanks @zgg, I am trying that but confused how to build one for Nicla as it is not supported. The closest one seems like NFR52_DK, however when I generate my own library with that, it generates tons of error when trying to compile. The README states:
For boards not supported by mainline Mbed OS, the same applies but you should provide the path of your Mbed OS fork:
cd $sketchbook/hardware/arduino-git/mbed mkdir -p variants/$BRAND_NEW_BOARD_NAME/{libs,conf} ./mbed-os-to-arduino -r /path/to/mbed-os/fork/that/supports/new/board $BRAND_NEW_BOARD_NAME:$BRAND_NEW_BOARD_NAME
There is mbed-os-nicla provided by Arduino, when I use that fork with the following command,
./mbed-os-to-arduino
command still generates the Nicla is not supported error. I would be really grateful if you can explain the steps.
10-24-2023 05:55 AM - edited 10-24-2023 05:57 AM
When I was building the mbed-os lib last time, it was based on repo (same but private at that time) which has fallen behind the public repo quite a lot now.
I was basically running the script "./mbed-os-to-arduino " with proper arguments, with BOARD_NAME set as "NICLA".
```
./mbed-os-to-arduino -a -r ~/prj/mbed-os/ NICLA:NICLA
```
Since it has been a long time since my last build I am not sure the command still works with the public repo. When I get a chance I will see if I can build the lib with the latest public repo.
10-25-2023 06:02 AM - edited 10-25-2023 06:46 AM
some update to share with you, I tried to build the libmbed.a from the source based on the public repo of the mbed-os core, and it worked well w/o any issues.
Here are some details.
Compile mbed-os from source
mkdir -p ~/Arduino/hardware/arduino cd ~/Arduino/hardware/arduino git clone https://github.com/arduino/ArduinoCore-mbed.git cd ArduinoCore-mbed |
mkdir -p ~/Arduino cd ~/Arduino git clone git@github.com:arduino/ArduinoCore-API git clone git@github.com:arduino/ArduinoCore-API
cd ~/Arduino/hardware/arduino/ArduinoCore-mbed/cores/arduino ln -sf ~/Arduino/ArduinoCore-API/api . |
export mbed_os_repo=~/prj/mbed-os |
export arduino_core=~/Arduino/hardware/arduino/ArduinoCore-mbed cd $arduino_core ./mbed-os-to-arduino -a -r $mbed_os_repo NICLA:NICLA |
./mbed-os-to-arduino -r $mbed_os_repo NICLA:NICLA |
zg@ZG-TC:~/Arduino/hardware/arduino/ArduinoCore-mbed$ ls -lha variants/NICLA/libs/ total 5.3M drwxrwxr-x 2 zg zg 4.0K Oct 24 20:09 . drwxrwxr-x 4 zg zg 4.0K Oct 24 20:19 .. -rw-rw-r-- 1 zg zg 5.3M Oct 24 20:19 libmbed.a |
01-20-2024 12:42 AM
Many thanks for this @zgg , but sadly, I coudn't get that working even if customized libs deployed. I have done some tests and found this. We are only allowed to use the 70% of the ram.
RAM: [======= ] 70.9% (used 45608 bytes from 64288 bytes) -> If I pass 70% and activate both BLE and BHY sensors, I get memory error.
I would really appreciate any lead on how to make use of BHI260AP's RAM as you suggested in your earlier replies.