Build and program two or more times in SDK v2.8.0

I have issue in newest SDK 2.8 of nRF Connect for VS Code.

When I change something in prj.conf or in the source code, I often have to build and compile two or more times to see the results of the changes. This is annoying.

After some testing, I found that if I change the version of the nRF SDK and toolchains (details below), the build and the program work correctly.

I used Flash option that builds image before program.

Setup with issue:

  • SDK: v2.8.0
  • Toolchains: v2.8.0
  • VS Code 1.95.3
    • nRF Connect for VS Code v2024.11.75
    • nRF DeviceTree v2024.11.36
    • nRF Kconfig v2024.11.16

Setup without issue, (previous nRF extensions):

  • SDK: v2.7.0
  • Toolchains: v2.7.0
  • VS Code 1.95.3
    • nRF Connect for VS Code v2024.11.75
    • nRF DeviceTree v2024.11.36
    • nRF Kconfig v2024.11.16

How to solve it?

Parents
  • Hello, what information does the build log provide each time? Does anything fail during build? 

    build and compile two or more times to see the results of the changes

    Could you elaborate more on this issue? What board are you building for? And with what sample?

    Have you looked through the migration guide?


    Kind regards,
    Øyvind

  • Hello, thank for reply and sorry for the delay.

    Does anything fail during build? 

    There are no error's, compilation and programming look correctly.

    I will upload the example project. (This is the copy of blink example from sdk 2.8, and i added the RTT logs)blink.zip

    The steps to reproduce:

    1. Make pristine build.
    2. Flash the devkit (in my case nrf52840dk).
    3. Open RTT.
      You should see this:
      [00:00:00.442,413] <inf> main: System start ...


    4. Close RTT terminal.
    5. Change the LOG_INF("System start ..."); to LOG_INF("System start ... 12345");
    6. Click Flash. (This first builds the code, next flash dk). The logs (in logs i deleted the .exe extension of cmd due to forum errors):

       *  Executing task: nRF Connect: Build: blink/blink (active) 
      
      Building blink
      C:\Windows\system32\cmd /d /s /c "west build --build-dir d:/examples/blink/build/blink d:/examples/blink"
      
      [7/7] Linking C executable zephyr\zephyr.elf
      Memory region         Used Size  Region Size  %age Used
                 FLASH:       32664 B         1 MB      3.12%
                   RAM:       25536 B       256 KB      9.74%
              IDT_LIST:          0 GB        32 KB      0.00%
      Generating files from D:/examples/blink/build/blink/zephyr/zephyr.elf for board: nrf52840dk
       *  Terminal will be reused by tasks, press any key to close it. 
      
       *  Executing task: nRF Connect: Flash: blink/blink (active) 
      
      Flashing blink to nRF52840 DK
      C:\Windows\system32\cmd /d /s /c "west flash -d d:\examples\blink\build\blink --skip-rebuild --dev-id 1050273178"
      
      -- west flash: using runner nrfjprog
      -- runners.nrfjprog: reset after flashing requested
      -- runners.nrfjprog: Flashing file: D:\examples\blink\build\merged.hex
      [ #################### ]   0.942s | Erase file - Done erasing                                                          
      [ #################### ]   0.223s | Program file - Done programming                                                    
      [ #################### ]   0.222s | Verify file - Done verifying                                                       
      Enabling pin reset.
      Applying pin reset.
      -- runners.nrfjprog: Board with serial number 1050273178 flashed successfully.
       *  Terminal will be reused by tasks, press any key to close it. 


    7. Open RTT.
      You should see this:
      [00:00:00.442,413] <inf> main: System start ... 12345

      But is:
      [00:00:00.250,854] <inf> main: System start ...


    8. Close RTT terminal.
    9. Click Flash. Logs:
       *  Executing task: nRF Connect: Build: blink/blink (active) 
      
      Building blink
      C:\Windows\system32\cmd /d /s /c "west build --build-dir d:/examples/blink/build/blink d:/examples/blink"
      
      ninja: no work to do.
       *  Terminal will be reused by tasks, press any key to close it. 
      
       *  Executing task: nRF Connect: Flash: blink/blink (active) 
      
      Flashing blink to nRF52840 DK
      C:\Windows\system32\cmd /d /s /c "west flash -d d:\examples\blink\build\blink --skip-rebuild --dev-id 1050273178"
      
      -- west flash: using runner nrfjprog
      -- runners.nrfjprog: reset after flashing requested
      -- runners.nrfjprog: Flashing file: D:\examples\blink\build\merged.hex
      [ #################### ]  11.099s | Erase file - Done erasing                                                          
      [ #################### ]   0.342s | Program file - Done programming                                                    
      [ #################### ]   0.235s | Verify file - Done verifying                                                       
      Enabling pin reset.
      Applying pin reset.
      -- runners.nrfjprog: Board with serial number 1050273178 flashed successfully.
       *  Terminal will be reused by tasks, press any key to close it.


    10. Open RTT.
      You should see this:
      [00:00:00.442,413] <inf> main: System start ... 12345

      But is:
      [00:00:00.250,854] <inf> main: System start ...


    11. You can repet the steps 9 and 10 until you see the results.

    To obtain the correct results i need make the pristine build, and flash.

  • By chance, I have noticed more correlations of this problem.

    The behaviour depends on the application build selection, in the image i marked differences.
    In short:
    For correct:    Executing task: nRF Connect: Build: blink/build (active) 
    For incorrect: Executing task: nRF Connect: Build: blink/blink (active) 

    1. Correct behaviour:



      Logs:
       *  Executing task: nRF Connect: Build: blink/build (active) 
      
      Building blink
      C:\Windows\system32\cmd /d /s /c "west build --build-dir d:/examples/blink/build d:/examples/blink"
      
      [0/5] Performing build step for 'blink'
      ninja: no work to do.
      [4/5] cmd /C "cd /D D:\examples\blink\build\_sysbuild && C:\ncs\toolchains\2d382dcd92\opt\bin\cmake.exe -E true"
       *  Terminal will be reused by tasks, press any key to close it. 
      
       *  Executing task: nRF Connect: Flash: blink/build (active) 
      
      Flashing build to nRF52840 DK
      C:\Windows\system32\cmd /d /s /c "west flash -d d:\examples\blink\build --skip-rebuild --dev-id 1050273178"
      
      -- west flash: using runner nrfjprog
      -- runners.nrfjprog: reset after flashing requested
      -- runners.nrfjprog: Flashing file: D:\examples\blink\build\merged.hex
      [ #################### ]   1.092s | Erase file - Done erasing                                                          
      [ #################### ]   0.221s | Program file - Done programming                                                    
      [ #################### ]   0.220s | Verify file - Done verifying                                                       
      Enabling pin reset.
      Applying pin reset.
      -- runners.nrfjprog: Board with serial number 1050273178 flashed successfully.


    2. Wrong behaviour:


      Logs:
       *  Executing task: nRF Connect: Build: blink/blink (active) 
      
      Building blink
      C:\Windows\system32\cmd /d /s /c "west build --build-dir d:/examples/blink/build/blink d:/examples/blink"
      
      [7/7] Linking C executable zephyr\zephyr.elf
      Memory region         Used Size  Region Size  %age Used
                 FLASH:       32664 B         1 MB      3.12%
                   RAM:       25536 B       256 KB      9.74%
              IDT_LIST:          0 GB        32 KB      0.00%
      Generating files from D:/examples/blink/build/blink/zephyr/zephyr.elf for board: nrf52840dk
       *  Terminal will be reused by tasks, press any key to close it. 
      
       *  Executing task: nRF Connect: Flash: blink/blink (active) 
      
      Flashing blink to nRF52840 DK
      C:\Windows\system32\cmd /d /s /c "west flash -d d:\examples\blink\build\blink --skip-rebuild --dev-id 1050273178"
      
      -- west flash: using runner nrfjprog
      -- runners.nrfjprog: reset after flashing requested
      -- runners.nrfjprog: Flashing file: D:\examples\blink\build\merged.hex
      [ #################### ]   1.099s | Erase file - Done erasing                                                          
      [ #################### ]   0.228s | Program file - Done programming                                                    
      [ #################### ]   0.219s | Verify file - Done verifying                                                       
      Enabling pin reset.
      Applying pin reset.
      -- runners.nrfjprog: Board with serial number 1050273178 flashed successfully.


      In this case i can obtain the behaviour what i describe in previous post.
Reply
  • By chance, I have noticed more correlations of this problem.

    The behaviour depends on the application build selection, in the image i marked differences.
    In short:
    For correct:    Executing task: nRF Connect: Build: blink/build (active) 
    For incorrect: Executing task: nRF Connect: Build: blink/blink (active) 

    1. Correct behaviour:



      Logs:
       *  Executing task: nRF Connect: Build: blink/build (active) 
      
      Building blink
      C:\Windows\system32\cmd /d /s /c "west build --build-dir d:/examples/blink/build d:/examples/blink"
      
      [0/5] Performing build step for 'blink'
      ninja: no work to do.
      [4/5] cmd /C "cd /D D:\examples\blink\build\_sysbuild && C:\ncs\toolchains\2d382dcd92\opt\bin\cmake.exe -E true"
       *  Terminal will be reused by tasks, press any key to close it. 
      
       *  Executing task: nRF Connect: Flash: blink/build (active) 
      
      Flashing build to nRF52840 DK
      C:\Windows\system32\cmd /d /s /c "west flash -d d:\examples\blink\build --skip-rebuild --dev-id 1050273178"
      
      -- west flash: using runner nrfjprog
      -- runners.nrfjprog: reset after flashing requested
      -- runners.nrfjprog: Flashing file: D:\examples\blink\build\merged.hex
      [ #################### ]   1.092s | Erase file - Done erasing                                                          
      [ #################### ]   0.221s | Program file - Done programming                                                    
      [ #################### ]   0.220s | Verify file - Done verifying                                                       
      Enabling pin reset.
      Applying pin reset.
      -- runners.nrfjprog: Board with serial number 1050273178 flashed successfully.


    2. Wrong behaviour:


      Logs:
       *  Executing task: nRF Connect: Build: blink/blink (active) 
      
      Building blink
      C:\Windows\system32\cmd /d /s /c "west build --build-dir d:/examples/blink/build/blink d:/examples/blink"
      
      [7/7] Linking C executable zephyr\zephyr.elf
      Memory region         Used Size  Region Size  %age Used
                 FLASH:       32664 B         1 MB      3.12%
                   RAM:       25536 B       256 KB      9.74%
              IDT_LIST:          0 GB        32 KB      0.00%
      Generating files from D:/examples/blink/build/blink/zephyr/zephyr.elf for board: nrf52840dk
       *  Terminal will be reused by tasks, press any key to close it. 
      
       *  Executing task: nRF Connect: Flash: blink/blink (active) 
      
      Flashing blink to nRF52840 DK
      C:\Windows\system32\cmd /d /s /c "west flash -d d:\examples\blink\build\blink --skip-rebuild --dev-id 1050273178"
      
      -- west flash: using runner nrfjprog
      -- runners.nrfjprog: reset after flashing requested
      -- runners.nrfjprog: Flashing file: D:\examples\blink\build\merged.hex
      [ #################### ]   1.099s | Erase file - Done erasing                                                          
      [ #################### ]   0.228s | Program file - Done programming                                                    
      [ #################### ]   0.219s | Verify file - Done verifying                                                       
      Enabling pin reset.
      Applying pin reset.
      -- runners.nrfjprog: Board with serial number 1050273178 flashed successfully.


      In this case i can obtain the behaviour what i describe in previous post.
Children
  • Hello, and thanks for your patience with this issue.

    The issues that you describe in this ticket are known, there will be a fix but I do not have a timeline at the moment.

    For the issue described in you last comment, the workaround, until a fix is introduced, is to manually select the sysbuild and then build. 

    I often have to build and compile two or more times to see the results of the changes. This is annoying.

    This is currently being worked with and will be fixed with the issue above.

    Kind regards,
    Øyvind

Related