Migrating from 2.6 to 2.9 error

Im trying to migrate my firmware from SDK from 2.6 to 2.9 but Im getting this error 

In file included from C:/ncs/v2.9.0/zephyr/include/zephyr/storage/flash_map.h:300,
                 from C:/ncs/v2.9.0/zephyr/subsys/dfu/img_util/flash_img.c:13:
C:/ncs/v2.9.0/zephyr/subsys/dfu/img_util/flash_img.c: In function 'flash_img_init':
C:/ncs/v2.9.0/nrf/include/flash_map_pm.h:47:22: error: 'PM_mcuboot_primary_ID' undeclared (first use in this function)
   47 | #define PM_ID(label) PM_##label##_ID
      |                      ^~~
C:/ncs/v2.9.0/nrf/include/flash_map_pm.h:52:35: note: in expansion of macro 'PM_ID'
   52 | #define FIXED_PARTITION_ID(label) PM_ID(label)
      |                                   ^~~~~
C:/ncs/v2.9.0/zephyr/subsys/dfu/img_util/flash_img.c:33:30: note: in expansion of macro 'FIXED_PARTITION_ID'
   33 | #define UPLOAD_FLASH_AREA_ID FIXED_PARTITION_ID(UPLOAD_FLASH_AREA_LABEL)
      |                              ^~~~~~~~~~~~~~~~~~
C:/ncs/v2.9.0/zephyr/subsys/dfu/img_util/flash_img.c:150:39: note: in expansion of macro 'UPLOAD_FLASH_AREA_ID'
  150 |         return flash_img_init_id(ctx, UPLOAD_FLASH_AREA_ID);
      |                                       ^~~~~~~~~~~~~~~~~~~~
C:/ncs/v2.9.0/nrf/include/flash_map_pm.h:47:22: note: each undeclared identifier is reported only once for each function it appears in
   47 | #define PM_ID(label) PM_##label##_ID
      |                      ^~~
C:/ncs/v2.9.0/nrf/include/flash_map_pm.h:52:35: note: in expansion of macro 'PM_ID'
   52 | #define FIXED_PARTITION_ID(label) PM_ID(label)
      |                                   ^~~~~
C:/ncs/v2.9.0/zephyr/subsys/dfu/img_util/flash_img.c:33:30: note: in expansion of macro 'FIXED_PARTITION_ID'
   33 | #define UPLOAD_FLASH_AREA_ID FIXED_PARTITION_ID(UPLOAD_FLASH_AREA_LABEL)
      |                              ^~~~~~~~~~~~~~~~~~
C:/ncs/v2.9.0/zephyr/subsys/dfu/img_util/flash_img.c:150:39: note: in expansion of macro 'UPLOAD_FLASH_AREA_ID'
  150 |         return flash_img_init_id(ctx, UPLOAD_FLASH_AREA_ID);
      |                                       ^~~~~~~~~~~~~~~~~~~~
C:/ncs/v2.9.0/zephyr/subsys/dfu/img_util/flash_img.c:151:1: warning: control reaches end of non-void function [-Wreturn-type]
  151 | }
      | ^
      
      
In file included from C:/ncs/v2.9.0/zephyr/include/zephyr/storage/flash_map.h:300,
                 from C:/ncs/v2.9.0/zephyr/subsys/usb/device/class/dfu/usb_dfu.c:46:
C:/ncs/v2.9.0/nrf/include/flash_map_pm.h:47:22: error: 'PM_mcuboot_primary_ID' undeclared here (not in a function)
   47 | #define PM_ID(label) PM_##label##_ID
      |                      ^~~
C:/ncs/v2.9.0/nrf/include/flash_map_pm.h:52:35: note: in expansion of macro 'PM_ID'
   52 | #define FIXED_PARTITION_ID(label) PM_ID(label)
      |                                   ^~~~~
C:/ncs/v2.9.0/zephyr/subsys/usb/device/class/dfu/usb_dfu.c:333:40: note: in expansion of macro 'FIXED_PARTITION_ID'
  333 |         #define DOWNLOAD_FLASH_AREA_ID FIXED_PARTITION_ID(SLOT0_PARTITION)
      |                                        ^~~~~~~~~~~~~~~~~~
C:/ncs/v2.9.0/zephyr/subsys/usb/device/class/dfu/usb_dfu.c:340:26: note: in expansion of macro 'DOWNLOAD_FLASH_AREA_ID'
  340 |         .flash_area_id = DOWNLOAD_FLASH_AREA_ID,
      |                          ^~~~~~~~~~~~~~~~~~~~~~
[71/326] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/settings/src/settings_line.c.obj
ninja: build stopped: subcommand failed.

It compiles fine in 2.6

Regards

  • Hello,

    It looks like you have not updated the application to use sysbuild, which was introduced in 2.7.0. 

    Sysbuild is a new building system, where we went away from the traditional child image configuration, to using sysbuild. 

    One option, is to add this to disable sysbuild. If you are using command line, just add --no-sysbuild, as an argument, and if you use VS Code, there is a choise in the botttom of the "add build configuration" tab, where you can choose between "Use sysbuild" and "No sysbuild". 

    For debugging purposes, you can see if this alone lets you build the application, and if it runs as expected. 

    However, if you plan to port to NCS v3.0.0 when that is released, you need to use sysbuild, becaue the "no sysbuild" option, and the old child image build configuration will be deprecated. 

    In that case, I suggest that you read the migration guides for all the major releases between 2.6.0 and 2.9.0 (and eventually 3.0.0).

    You can find them here:

    https://docs.nordicsemi.com/bundle/ncs-2.9.0/page/nrf/releases_and_maturity/migration_guides.html

    And let me know if you have any follow-up questions.

    Best regards,

    Edvin

  • Than you ! managed to compile it. looks like issue was just adding sb_ infront of mcuboot option and moving it to sysbuild.conf

Related