This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Run ncs v.1.6.0 samples on arduino_nano_33_ble

Hi,

sounds odd but is not,  I try to run samples and my own project on a nano 33 ble, and with the first upload
of blinky it seams that the system start and crash (ttyACM0 is coming and going).
Quick search in the Arduino SDK give me a hint that the memory layout differ from what it defined in
the ncs.

linker script of Arduino:

MEMORY
{  
 FLASH (rx) : ORIGIN = 0x10000, LENGTH = 0xf0000
 RAM_NVIC (rwx) : ORIGIN = 0x20000000, LENGTH = 0x100
 RAM_CRASH_DATA (rwx) : ORIGIN = (0x20000000 + 0x100), LENGTH = 0x100
 RAM (rwx) : ORIGIN = ((0x20000000 + 0x100) + 0x100), LENGTH = (0x40000 - (0x100 + 0x100))
}

there is a nvic and crash data reserved in the memory and the program loaded at offset of 0x200

I make that in my overlay
&sram0 {
       reg = <0x20000200 0x3fe00>;  /* 0x40000 - 0x200 */
};
and the generated linker script becomes

MEMORY
   {
   FLASH (rx) : ORIGIN = (0x0 + 0x10000), LENGTH = 0xe8000
   SRAM (wx) : ORIGIN = 0x20000200, LENGTH = (255 * 1K)
   IDT_LIST (wx) : ORIGIN = (0x20000200 + (255 * 1K)), LENGTH = 2K
   }

Fine! 
The crash stops, but blinky is not blinking Disappointed

Where is the missing link?

Chris :wq

Parents
  • Hi All,

    I found the problem, not at all linker.script related.

    "west flash" make it wrong and add an offset to the command line.
    This result that bossac flash the binary at 0x20000 not 0x10000 where it belongs.

    Here is the command line which works for me finally.

    bossac -p /dev/ttyACM1  -i -e -w ../arduino33shadow/zephyr/zephyr.bin -R


    Just an other hint: The new Arduino IDE , install the nano_33_ble support and it comes with
    a new bootloader/Software device scatch. So if you looking to run your software device related with nano 33 ble
    that is what you looking for!

    Happy Hacking

    Chris :wq

  • Hi Chris,

    I am glad to hear that you got it to work!

    Please be aware that the Arduino Nano 33 BLE requires the Arduino variant of bossac, and not the bossac included in the zephyr-sdk.

    ChrisRu said:
    "west flash" make it wrong and add an offset to the command line.

     Is this for the Arduino variant or the one included in zephyr-sdk? According to the board's documentation in Zephyr, after getting the correct variant of bossac, you should be able to pass it as an argument to west:

    west flash --bossac="<path to the arduino version of bossac>"

    Best regards,

    Marte

  • Hi Marte,

    yes, the documentation told to copy the bossac from the Arduino or build from source. I tried both and it makes no difference.

    Below the log from how Arduino IDE call:

    /home/chris/.arduino15/packages/arduino/tools/bossac/1.9.1-arduino2/bossac -d --port=ttyACM1 -U -i -e -w /tmp/arduino_build_954637/MultiSerial.ino.bin -R

    no offset.

    "west" tool add -o 65536 to the bossac

    -- west flash: using runner bossac
    runners.bossac: stty -F /dev/ttyACM0 raw ispeed 115200 ospeed 115200 cs8 -cstopb ignpar eol 255 eof 255                                                                      
    runners.bossac: /usr/local/bin/bossac --help
    runners.bossac: /usr/local/bin/bossac -p /dev/ttyACM0 -R -e -w -v -b ../arduino33shadow/zephyr/zephyr.bin -o 65536

    and this is wrong and take me days to find out.

    Happy hacking.

    Chris :wq

Reply
  • Hi Marte,

    yes, the documentation told to copy the bossac from the Arduino or build from source. I tried both and it makes no difference.

    Below the log from how Arduino IDE call:

    /home/chris/.arduino15/packages/arduino/tools/bossac/1.9.1-arduino2/bossac -d --port=ttyACM1 -U -i -e -w /tmp/arduino_build_954637/MultiSerial.ino.bin -R

    no offset.

    "west" tool add -o 65536 to the bossac

    -- west flash: using runner bossac
    runners.bossac: stty -F /dev/ttyACM0 raw ispeed 115200 ospeed 115200 cs8 -cstopb ignpar eol 255 eof 255                                                                      
    runners.bossac: /usr/local/bin/bossac --help
    runners.bossac: /usr/local/bin/bossac -p /dev/ttyACM0 -R -e -w -v -b ../arduino33shadow/zephyr/zephyr.bin -o 65536

    and this is wrong and take me days to find out.

    Happy hacking.

    Chris :wq

Children
  • I experienced the same issue. Flashing ~/ncs/zephyr/samples/basic/blinky using west didn't work (LED does not blink):

    west flash --bossac="~/.arduino15/packages/arduino/tools/bossac/1.9.1-arduino2/bossac"

    Using ChrisRu's suggestion did give the expected result (the LED blinks):

    ~/.arduino15/packages/arduino/tools/bossac/1.9.1-arduino2/bossac -p /dev/ttyACM0 -i -e -w build/zephyr/zephyr.bin -R

Related