Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Nicla Sense ME Large Array Crash

    Nicla Sense ME Large Array Crash

    maxlo
    Member

    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.
    }

    19 REPLIES 19

    zgg
    Long-established Member

    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.

     

     

     

     

    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.

    zgg
    Long-established Member

    @hkayan

    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. 

     

    zgg
    Long-established Member

    @hkayan

    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

    This is useful if the user wants to custom the mbed-os and apply the changes to Arduino core.

    • Prerequisites
      • python 3.x: as a reference, I used 3.9.6
      • mbed CLI (1.x): as a reference, I used 1.10.5
    • Step 1 - Clone the repos
      • Clone the ArduinoCore-mbed 

        mkdir -p ~/Arduino/hardware/arduino

        cd ~/Arduino/hardware/arduino

        git clone https://github.com/arduino/ArduinoCore-mbed.git

        cd ArduinoCore-mbed

      • Clone the Arduino-API repo

        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 .

      • Clone mbed-os repo

        export mbed_os_repo=~/prj/mbed-os
        mkdir -p ~/prj
        cd ~/prj
        git clone https://github.com/ARMmbed/mbed-os.git

    • Step 2 - mbed-os-to-arduino [optional]
    This step is optional and can be tried when something goes wrong in the build process.
    change the "set -ef" to "set -xf" in file mbed-to-arduino
    • Step 3 - Preparation
    export arduino_core=~/Arduino/hardware/arduino/ArduinoCore-mbed
    cd $arduino_core
    ./mbed-os-to-arduino -a -r $mbed_os_repo NICLA:NICLA
    Note: in this step, the script  tries to apply some patches to the mbed-os repo, and this might cause some trivial failures (errors such as patches that cannot be applied), and this kind of errors could be ignored.
    • Step 4 - Make Configuration Changes if needed
    edit the file ./variants/NICLA/conf/mbed_app.json
    Changes such as stack size etc could be changed.
    This would affect the libmbed.a generated
    • Step 5 - Build the core (including the libmbed.a)
    ./mbed-os-to-arduino -r $mbed_os_repo NICLA:NICLA
    • Step 6 - Check result
    The script should say: "exit 0" at the end of the process, otherwise some errors have occured and should be fixed accordingly. Check the build environement (mbed CLI, python version etc)
    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

    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.

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist