Nuttx flash configuration - nrf52840dk

I recently got the nrf52840dk board and I am trying to use it with the Nuttx embedded OS. However, I am having some issues flashing the nuttx binary on my board.

this is the instruction on the nuttx page: 

openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -c 'init' \
  -c 'program nuttx/nuttx.bin verify reset' -c 'shutdown'

Would appreciate some help with this. I am a beginner with both nuttx and the nordic semi-conductors. Need this for some research implementation.

Thanks

  • Hi, 

    Nordic does not officially support Nuttx OS. It seems like the support of nRF52832 only through ssparkfun's STLink debugger interface. Please take this question to the Nuttx support page to get more help on this.

  • Thanks for the feedback. I am using openocd to flash the nrf52840dk board. I have tried 2 instances but facing some issues. Here are the error messages. I tried with jlink and stlink. 

    When I use jlink,

    openocd -f interface/jlink.cfg -f target/nrf52.cfg -c 'init' -c 'program nuttx/nuttx.bin verify reset' -c 'shutdown'
    Open On-Chip Debugger 0.11.0+dev-00551-gaad871805 (2022-01-10-14:22)
    Licensed under GNU GPL v2
    For bug reports, read
    openocd.org/.../bugs.html
    Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
    /usr/local/bin/../share/openocd/scripts/target/swj-dp.tcl:28: Error: newtap: nrf52.cpu missing IR length
    in procedure 'script'
    at file "embedded:startup.tcl", line 26
    in procedure 'swj_newdap' called at file "/usr/local/bin/../share/openocd/scripts/target/nrf52.cfg", line 27
    at file "/usr/local/bin/../share/openocd/scripts/target/swj-dp.tcl", line 28

    When I use stlink,

    openocd -f interface/stlink.cfg -f target/nrf52.cfg -c 'init' -c 'program nuttx/nuttx.bin verify' -c 'shutdown'
    Open On-Chip Debugger 0.11.0+dev-00551-gaad871805 (2022-01-10-14:22)
    Licensed under GNU GPL v2
    For bug reports, read
    openocd.org/.../bugs.html
    Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
    Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD

    nRF52 device has a CTRL-AP dedicated to recover the device from AP lock.
    A high level adapter (like a ST-Link) you are currently using cannot access
    the CTRL-AP so 'nrf52_recover' command will not work.
    Do not enable UICR APPROTECT.

    Info : clock speed 1000 kHz
    Error: open failed

    Can you provide some assistance on how to resolve these?

  • We do not use STLink or openocd for debugging, almost everyone here in Nordic use JLink and I tested this which seems to work.

    sunu@SUNU-7080 C:\Users\sunu\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\sunu\nuttxspace\nuttx
    $ "C:\Program Files (x86)\SEGGER\JLink\JLink.exe"
    SEGGER J-Link Commander V7.52d (Compiled Aug 17 2021 17:11:43)
    DLL version V7.52d, compiled Aug 17 2021 17:10:23
    
    Connecting to J-Link via USB...O.K.
    Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Feb  2 2021 16:47:20
    Hardware version: V1.00
    S/N: 683103831
    License(s): RDI, FlashBP, FlashDL, JFlash, GDB
    VTref=3.300V
    
    
    Type "connect" to establish a target connection, '?' for help
    J-Link>loadbin
    Target connection not established yet but required for command.
    Please specify device / core. <Default>: NRF52840_XXAA
    Type '?' for selection dialog
    Device>?
    Please specify target interface:
      J) JTAG (Default)
      S) SWD
      T) cJTAG
    TIF>S
    Specify target interface speed [kHz]. <Default>: 4000 kHz
    Speed>
    Device "NRF52840_XXAA" selected.
    
    
    Connecting to target via SWD
    InitTarget() start
    InitTarget() end
    Found SW-DP with ID 0x2BA01477
    DPIDR: 0x2BA01477
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011)
    AP[1]: JTAG-AP (IDR: 0x02880000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Core found
    AP[0]: AHB-AP ROM base: 0xE00FF000
    CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
    Found Cortex-M4 r0p1, Little endian.
    FPUnit: 6 code (BP) slots and 2 literal slots
    CoreSight components:
    ROMTbl[0] @ E00FF000
    ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
    ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
    ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
    ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
    ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
    ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
    Cortex-M4 identified.
    Syntax: loadbin <filename>, <addr>
    J-Link>loadbin
    Syntax: loadbin <filename>, <addr>
    J-Link>loadbin nuttx.bin,0
    Halting CPU for downloading file.
    Downloading file [nuttx.bin]...
    J-Link: Flash download: Bank 0 @ 0x00000000: 1 range affected (77824 bytes)
    J-Link: Flash download: Total: 3.089s (Prepare: 0.138s, Compare: 0.022s, Erase: 1.577s, Program & Verify: 1.268s, Restore: 0.083s)
    J-Link: Flash download: Program & Verify speed: 60 KiB/s
    O.K.
    J-Link>exit

    I would request you to take this to the Nuttx forum , as we have not played around with this and not many here are confident in the underlying details of this subject. Sorry for that and hope you get better response in those forums..

Related