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

Building modified code then flashing with ninja flash flashes the old version of the application in a multi-image build

This has been happening for a very long time when building nRF connect SDK applications on a windows 10 machine via the command line with cmake and ninja. In an application whereby it only runs on one core e.g. application core, if a program is built, flashed, modified, built again (without removing build directory) and flashing again then the image flashed is correct, however if the same procedure is followed on a multi-image build e.g. on an nRF5340 bluetooth application where there is an application image and network core image, on the second flash it flashes the old application, not the version it just built (the network core configuration hasn't been modified in these instances, it's only ever the application image). This can also be confirmed by doing a verify check on the output zephyr.hex file in the build folder whereby verification fails. It seems all .hex files must be manually deleted before each ninja flash operation

Parents
  • Hello!

    Thanks for reaching out. This is very similar to a known bug that we're working on getting fixed. Though, I haven't seen it happening with ninja+cmake, only with the "west" tool, so this is interesting. I will report your findings internally. Could you describe the procedure exactly (the chain of commands), so that I can try to reproduce?

    Best regards,
    Carl Richard

Reply
  • Hello!

    Thanks for reaching out. This is very similar to a known bug that we're working on getting fixed. Though, I haven't seen it happening with ninja+cmake, only with the "west" tool, so this is interesting. I will report your findings internally. Could you describe the procedure exactly (the chain of commands), so that I can try to reproduce?

    Best regards,
    Carl Richard

Children
  • Hi Carl,

    Sure. I just got the latest version by using: west init -m github.com/.../sdk-nrf --mr master

    I then used zephyr\samples\bluetooth\peripheral_csc as a sample app, built as follows:
    set GNUARMEMB_TOOLCHAIN_PATH=C:\gcc-arm
    set ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
    zephyr-env.cmd
    cd samples\bluetooth\peripheral_csc
    mkdir build
    cd build
    cmake -GNinja -DBOARD=nrf5340dk_nrf5340_cpuapp ..
    ninja

    I flashed it to the board using: ninja flash, it ran as expected.

    I then changed the main.c file to add this in main(): printk("boom\n");

    I then built it again using ninja and flashed using ninja flash and the output was as follows:
    *** Booting Zephyr OS build v2.4.99-ncs1-3519-g5585355dde0c ***
    Bluetooth initialized

    Advertising successfully started

    The output is not there, so I verified it using nrfjprog:

    nrfjprog -f NRF53 --verify .\zephyr.hex
    Parsing image file.
    Verifying programming.
    ERROR: Write verify failed.

    I then erased all the .hex files in the zephyr directory, did ninja and ninja flash again and the output was:

    *** Booting Zephyr OS build v2.4.99-ncs1-3519-g5585355dde0c ***

    Bluetooth initialized

    Advertising successfully started

    boom

    Thanks,
    Jamie

  • Thank you, Jamie! We have reproduced this on our side and are investigating. I'll report back to you as soon as I know more. Thank you for your patience!

    Could you try to use the "west" tool instead and see if the same issues are present for you there? Version 0.11 was recently released, so you might need to update it.

    Best regards,
    Carl Richard

Related