This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

About Flashing firmware of nrf5340 with nrfjprog.exe

I used mergehex.exe to generate a merge.hex with firmware appcore.hex and firmware netcore.hex.

and use nrfjprog.exe flash merge.hex to nrf5340.

mergehex.exe -m TxAppCore/build_nrf5340dk_nrf5340_cpuapp/zephyr/zephyr.hex TxNetCore/build_nrf5340dk_nrf5340_cpunet/zephyr/zephyr.hex -o mergehex.hex

nrfjprog.exe -f NRF53 --program mergehex.hex --chiperase --log 

Prompt error:

ERROR: [ Worker] - Address 0x01000000 does not map to a known memory.
ERROR: The file specified is not a valid hex file, has data outside valid areas
ERROR: or does not have data in valid areas.

How to solve the error.

Parents
  • Hi,

    You cannot use nrfjprog to program multi-image builds for different cores. You must either use west, or you must program the cores separately with nrfjprog:

    nrfjprog -f NRF53 --coprocessor CP_NETWORK --program zephyr/zephyr.hex --chiperase
    nrfjprog -f NRF53 --program zephyr/zephyr.hex --chiperase

    Best regards,

    Marte

  • Flash using West is also completed by calling nrfjprog, so the firmware flashing of nrf5340 must be carried out separately from two cores, and one merge hex cannot be used for flash at one time. Is that right?

Reply Children
  • Hi,

    West flash does use nrfjprog to program the nRF5340, but the command is not equivalent with nrfjprog --program as it does some more handling before running nrfjprog --program.  So it is possible to use west flash to flash a merged hex file, as you can see in Working with nRF5340 DK » Multi-image builds and under Multi-image build in Working with nRF5340 DK » Building and programming a sample.

    but when you use it to program multi-image builds to the different cores it actually runs nrfjprog --program for each core just as in my previous reply.

    When you run west commands you are actually executing scripts located in zephy/scripts/west_commands. These will parse information and use this information when running nrfjprog --program. However, when the device family is NRF53 it will do some extra handling before creating and running nrfjprog --program in order to handle the two cores. What it does is actually to generate two new hex files, one for each core, based on the input hex file and then flash them individually. So it flashes both cores separately just as you would do yourself with nrfjprog. If you are curious and want to know more about this you can look at the function program_hex_nrf53() in west_commands/runners/nrfjprog.py.

    Best regards,

    Marte

  • Thank you very much for your patient and professional reply. I have understood it. Thank you.

Related