Flashing multi-core application over terminal

Hello,
I 'm trying to flash my multi-core application to the NRF5340DK using a terminal but having issues. 
The application uses both network and application CPUs. After building the application I end up with multiple .hex files inside `./build/zephyr` and `./build/hci_rpmsg` folders.
So far I m using NRF Connect SDK v2.2.0 and I have tried to flash the hex files using a batch script from terminal using the following commands:
For network CPU:

set hex_file=".\bin\cpu_net\zephyr.hex"
echo Unlock and erase network cpu...
nrfjprog.exe -f nrf53 --coprocessor CP_NETWORK --recover
nrfjprog.exe -f nrf53 --coprocessor CP_NETWORK --eraseall
nrfjprog.exe -f nrf53 --coprocessor CP_APPLICATION --eraseall
nrfjprog.exe -f nrf53 --coprocessor CP_NETWORK --recover
nrfjprog.exe -f nrf53 --coprocessor CP_NETWORK --program %hex_file% --sectorerase --verify
echo Network cpu flash finished.


For application CPU:

set hex_file=".\bin\cpu_app\zephyr.hex"
echo Unlock and erase cpu
nrfjprog.exe -f nrf53 --coprocessor CP_NETWORK --recover
nrfjprog.exe -f nrf53 --coprocessor CP_APPLICATION --eraseall
echo Flash application cpu...
nrfjprog.exe -f nrf53 --coprocessor CP_APPLICATION --program %hex_file% --sectorerase --verify
echo Application cpu flash finished.


I have tried to replace the `zephyr.hex` files with `merged_CPUNET.hex` for network CPU and `merged.hex` for application CPU buth that did not work either.
The output I m getting is something like this: 
...
[00:00:01.870,513] <err> bt_hci_driver: Endpoint binding failed with -11
[00:00:01.870,544] <err> bt_hci_core: HCI driver open failed (-11)
...

The application code seems to run fine if we exclude the BLE functionality.

If I try to flash the board using the vs code plugin then all runs smoothly and I notice that it splits the `merged_domains`.hex file into `GENERATED_CP_APPLICATION_merged_domains.hex` and `GENERATED_CP_NETWORK_merged_domains.hex` files and flash those to the board.
Question is how can I generate those files from the command line?
What files should I flash to network and application CPUs?
I would like to avoid the `west flash` command and make use of nrfjprog utility if possible.

Best regards,
Alex

Parents
  • Hi,

    I would like to avoid the `west flash` command and make use of nrfjprog utility if possible.

    Often times "west flash --erase --recover" does the trick for me. Can you try that and see if it works for you?
    Just to see if there is a difference.

    Maybe if you let me know why you would like to avoid west flash I can better understand your use-case here as well?

    Question is how can I generate those files from the command line?

    Build with "west -vvv build ...". Then you can read from the log how the files are generated, and replicate that.

    What files should I flash to network and application CPUs?

    Try "west -vvv flash" and see which files that uses

    Regards,
    Sigurd Hellesvik

  • Hello Sigurd,
    thank you for the reply.
    I m using a remote VM machine running a docker container with NCS for building my project and then syncing the hex / elf / map files to my local machine where the actual flashing and debugging takes place. The remote machine does not have access to USB peripherals, no JLink, no actual board connected to it, nothing. It just does the heavy building for me thus I m looking to avoid the "west flash" command. More over the remote machine does not have the JLink tools installed nor the, nrfUtil or nrf command line tools so trying the "west flash" command on that machine will probably fail but I can give it a try.
    Is is possible to run the "west flash" command from the local machine without having the whole "build" folder available? 
    What are the minimum set of files that "west flash" is expecting to find inside the "build" folder?
    If it only needs the hex/elf/map files along with some cmake ones then I could sync those from the remote machine to the local one and then use the "west flash" command locally.

    Best,
    Alex

  • No, I do not think you can use west then.

    So I think you have 3 alternatives:

    • nrfjprog as you try to. Use "west -vvv flash" to learn how.
    • Use pynrfjprog to script this in python
    • nrfutil device program etc
Reply Children
No Data
Related