How to switch to https://github.com/nrfconnect/sdk-zephyr main branch in ncs/v2.0.2?

After 

west init -m github.com/.../sdk-nrf --mr v2.0.2
west update

I notice ncs/v2.0.2/zephyr has huge difference with github.com/.../sdk-zephyr main

Like there is no 52840 overlay in ncs/v2.0.2/zephyr/sample/driver/adc/board.

I try to delete ncs/v2.0.2/zephyr and git clone https://github.com/nrfconnect/sdk-zephy.

But not working still got message:

=== updating zephyr (zephyr):
Updating files: 100% (10642/10642), done.
HEAD is now at be360e7db2 [nrf fromtree] net: openthread: enable default software tx security in 1.3
WARNING: left behind zephyr branch "main"; to rebase onto the new HEAD:
git -C zephyr rebase be360e7db2db7e1f0e9fcac686a08e62e350bf55 main

How can I switch to sdk-zephyr main?

  • Solved, but got another error.
    Just use checkout in ncs/v2.0.2/zephyr, and dont west update again.
        $ git checkout main

    After this I add CONFIG_LOG=y , I got this error and still looking for reason.

    undefined reference to `log_strdup'

    Building C object modules/nrf/subsys/mpsl/init/CMakeFiles/..__nrf__subsys__mpsl__init.dir/mpsl_init.c.obj
    In file included from C:\Users\canic\ncs\v2.0.2\zephyr\include\zephyr\logging\log.h:11,
                     from C:\Users\canic\ncs\v2.0.2\nrf\subsys\mpsl\init\mpsl_init.c:10:
    C:/Users/canic/ncs/v2.0.2/nrf/subsys/mpsl/init/mpsl_init.c: In function 'm_assert_handler':
    C:\Users\canic\ncs\v2.0.2\nrf\subsys\mpsl\init\mpsl_init.c:122:33: warning: implicit declaration of function 'log_strdup' [-Wimplicit-function-declaration]
      122 |  LOG_ERR("MPSL ASSERT: %s, %d", log_strdup(file), line);
          |                                 ^~~~~~~~~~
    C:\Users\canic\ncs\v2.0.2\zephyr\include\zephyr\logging\log_core.h:167:11: note: in definition of macro 'Z_LOG_TO_PRINTK'
      167 |         ##__VA_ARGS__); \
          |           ^~~~~~~~~~~
    C:\Users\canic\ncs\v2.0.2\zephyr\include\zephyr\logging\log_core.h:252:2: note: in expansion of macro 'Z_LOG2'
      252 |  Z_LOG2(_level, 0, __log_current_const_data, __log_current_dynamic_data, __VA_ARGS__)
          |  ^~~~~~
    C:\Users\canic\ncs\v2.0.2\zephyr\include\zephyr\logging\log.h:40:25: note: in expansion of macro 'Z_LOG'
       40 | #define LOG_ERR(...)    Z_LOG(LOG_LEVEL_ERR, __VA_ARGS__)
          |                         ^~~~~
    C:\Users\canic\ncs\v2.0.2\nrf\subsys\mpsl\init\mpsl_init.c:122:2: note: in expansion of macro 'LOG_ERR'
      122 |  LOG_ERR("MPSL ASSERT: %s, %d", log_strdup(file), line);
          |  ^~~~~~~
    C:\Users\canic\ncs\v2.0.2\nrf\subsys\mpsl\init\mpsl_init.c:122:10: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'int' [-Wformat=]
      122 |  LOG_ERR("MPSL ASSERT: %s, %d", log_strdup(file), line);
          |          ^~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~
          |                                 |
          |                                 int
    C:\Users\canic\ncs\v2.0.2\zephyr\include\zephyr\logging\log_core.h:247:28: note: in definition of macro 'Z_LOG2'
      247 |   z_log_printf_arg_checker(__VA_ARGS__); \
          |                            ^~~~~~~~~~~
    C:\Users\canic\ncs\v2.0.2\zephyr\include\zephyr\logging\log.h:40:25: note: in expansion of macro 'Z_LOG'
       40 | #define LOG_ERR(...)    Z_LOG(LOG_LEVEL_ERR, __VA_ARGS__)
          |                         ^~~~~
    C:\Users\canic\ncs\v2.0.2\nrf\subsys\mpsl\init\mpsl_init.c:122:2: note: in expansion of macro 'LOG_ERR'
      122 |  LOG_ERR("MPSL ASSERT: %s, %d", log_strdup(file), line);
          |  ^~~~~~~
    C:\Users\canic\ncs\v2.0.2\nrf\subsys\mpsl\init\mpsl_init.c:122:25: note: format string is defined here
      122 |  LOG_ERR("MPSL ASSERT: %s, %d", log_strdup(file), line);
          |                        ~^
          |                         |
          |                         char *
          |                        %d

  • Hello,

    You can unfortunately not mix-and-match different nRF Connect SDK versions and different Zephyr versions - each nRF Connect SDK release is made using a specific Zephyr release, and so it will expect to find everything as it was in this Zephyr release.

    In your case, if you are missing a single file - such as a board file - from the Zephyr main branch, I would instead incorporate this specific file into your nRF Connect SDK, rather than changing the entire Zephyr version that the nRF Connect SDK is using.
    This should also avoid the issue you are encountering now, where something has changed somewhere else in the Zephyr release that the nRF Connect SDK does not expect.

    Best regards,
    Karl

  • Hi Karl,

    Thanks, that is the problem that I face. 

    Like I can build SDK/zephyr/samples/drivers/led_ws2812 on ubuntu.

    But on Windows and Mac, Ban... always miss some file. etc. zephyr/drivers/adc.h

    And when I copy adc.h from Linux to Windows, another error again.

    In file included from C:\Users\canic\ncs\v2.0.2\zephyr\include\zephyr\toolchain.h:50,
                     from C:\Users\canic\ncs\v2.0.2\zephyr\include\zephyr\init.h:10,
                     from C:\Users\canic\ncs\v2.0.2\zephyr\include\zephyr\device.h:29,
                     from C:\Users\canic\ncs\v2.0.2\zephyr\include\zephyr\drivers\adc.h:16,
                     from C:\Users\canic\ncs\v2.0.2\boards\arm\furry_project\furry_project.dts:9,
                     from <command-line>:
    C:\Users\canic\ncs\v2.0.2\zephyr\include\zephyr\toolchain\gcc.h:89:10: fatal error: stdbool.h: No such file or directory
       89 | #include <stdbool.h>
          | 

  • Hello again,

    Wols said:
    that is the problem that I face. 

    Could you clarify - are you now switching to working with an official nRF Connect SDK release, as downloaded through the Toolchain Manager application (which will have the correct Zephyr version too), or are you still trying to incorporate a particular file from upstream into your current Zephyr installation?

    Furthermore, it seems very strange to me that you are missing files such as 'adc.h' and 'stdbool.h' - in fact, I would think that this points to the Zephyr installation having failed / been incomplete. Did you use the Toolchain Manager to perform the installation of the SDK you are working with right now, or did you install it manually?

    Could you perform a reinstallation of the toolchain (use toolchain manager to download and install nRF Connect SDK >= v2.0.0, and see if you see this same issue with the fresh install?

    Best regards,
    Karl

  • Hi Karl,

    Sorry for the late reply.

    It's really confusing me that I can't find the correct ncs SDK for useing ADC example on nrf52840dk_nrf52840.

    I think that beacause in page 
    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/zephyr/samples/drivers/adc/README.html

    This sample does not work on Nordic platforms where there is a distinction between channel and analog input that requires additional configuration.
    See samples/boards/nrf/battery for an example of using the ADC infrastructure on Nordic hardware.

    So again I have no idea why i can build om linux, but ncs SDK do not suppout zephyr ADC example.

    I think I have to rewrite my adc code.

Related