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

flash nrf51822 using openocd giving error

Hi, I have install openocd on ubuntu. but i after running next line

openocd -f interface/stlink-v2.cfg cfg -f target/nrf51_stlink.tcl

i got these error.

Runtime Error: embedded:startup.tcl:47: Can't find target/nrf51_stlink.tcl
in procedure 'script' 
at file "embedded:startup.tcl", line 47

I have stlink2 connected. I will be using s120 softdevice. I think my start address will be

    APP_CODE_BASE 0x0001D000
    APP_RAM_BASE 0x20002800

So, i found following command,

 openocd -f interface/stlink-v2.cfg   -f target/nrf51_stlink.tcl -c "program output_directory/s120.hex 0x0001D000"

Is that right? Or am i missing something?

Parents
  • I had a custom nRF52832 board programmed with a patched OpenOCD 0.10.0-rc1 via st-link v2 with:

    $ openocd -s /usr/local/share/openocd/scripts -f ./openocd_nrf52.cfg -c "program myfirmware.hex verify reset exit"
    

    openocd_nrf52.cfg is as follows:

    #nRF52832 Target
    source [find interface/stlink-v2.cfg]
    transport select hla_swd
    source [find target/nrf52.cfg]
    

    Your point might be to tell openocd where ".tcl" scripts are located with "-s" option, addressing a "Can't find target/nrf51_stlink.tcl" message in "try 1".

    UPD1. Or try setting a transport to "swd" or "hla_swd" in "try 3", e.g.:

    $ openocd -f interface/stlink-v2.cfg -d2 -c "transport select hla_swd" -f src/target/nrf51.cfg
    

    UPD2. So putting all that together, try these steps:

    1. Create a config file, e.g. stlink2_nrf51.cfg, containing:

      #nRF51822 Target source [find interface/stlink-v2.cfg] transport select hla_swd source [find target/nrf51.cfg]

    2. Upload a hex file, specifying openocd scripts location and your config:

      $ openocd -s your/openocd/scripts/directory -f ./stlink2_nrf51.cfg -c "program yourfirmware.hex verify reset exit"

Reply
  • I had a custom nRF52832 board programmed with a patched OpenOCD 0.10.0-rc1 via st-link v2 with:

    $ openocd -s /usr/local/share/openocd/scripts -f ./openocd_nrf52.cfg -c "program myfirmware.hex verify reset exit"
    

    openocd_nrf52.cfg is as follows:

    #nRF52832 Target
    source [find interface/stlink-v2.cfg]
    transport select hla_swd
    source [find target/nrf52.cfg]
    

    Your point might be to tell openocd where ".tcl" scripts are located with "-s" option, addressing a "Can't find target/nrf51_stlink.tcl" message in "try 1".

    UPD1. Or try setting a transport to "swd" or "hla_swd" in "try 3", e.g.:

    $ openocd -f interface/stlink-v2.cfg -d2 -c "transport select hla_swd" -f src/target/nrf51.cfg
    

    UPD2. So putting all that together, try these steps:

    1. Create a config file, e.g. stlink2_nrf51.cfg, containing:

      #nRF51822 Target source [find interface/stlink-v2.cfg] transport select hla_swd source [find target/nrf51.cfg]

    2. Upload a hex file, specifying openocd scripts location and your config:

      $ openocd -s your/openocd/scripts/directory -f ./stlink2_nrf51.cfg -c "program yourfirmware.hex verify reset exit"

Children
No Data
Related