Under Ubuntu 20.04 the udp sample application that we have modified that builds with no problem under nRF Connect SDK v2.0.0 fails to build when when its directory is copied to SDK v2.1.0.
There appear to be two problem areas.
This uart code builds and runs under v2.0.0 but fails under v2.1.0
baseuart= device_get_binding(DT_LABEL(DT_NODELABEL(uart2))); if (baseuart == NULL) { printk("Could not find %s!\n\r", DT_LABEL(DT_NODELABEL(uart2))); return; }
Errors as follows:
In file included from /media/sam/ncs21/zephyr/include/zephyr/arch/arm/aarch32/arch.h:20, from /media/sam/ncs21/zephyr/include/zephyr/arch/cpu.h:19, from /media/sam/ncs21/zephyr/include/zephyr/kernel_includes.h:33, from /media/sam/ncs21/zephyr/include/zephyr/kernel.h:17, from /media/sam/ncs21/nrf/samples/nrf9160/dtlsnbiot/src/main.c:8: /media/sam/ncs21/nrf/samples/nrf9160/dtlsnbiot/src/main.c: In function 'main': /media/sam/ncs21/nrf/samples/nrf9160/dtlsnbiot/build/zephyr/include/generated/devicetree_unfixed.h:9216:38: error: 'DT_N_S_soc_S_peripheral_40000000_S_uart_a000_P_label' undeclared (first use in this function); did you mean 'DT_N_S_soc_S_peripheral_40000000_S_uart_a000_P_reg'? 9216 | #define DT_N_NODELABEL_uart2 DT_N_S_soc_S_peripheral_40000000_S_uart_a000 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /media/sam/ncs21/zephyr/include/zephyr/devicetree.h:3068:24: note: in definition of macro 'DT_CAT' 3068 | #define DT_CAT(a1, a2) a1 ## a2 | ^~ /media/sam/ncs21/zephyr/include/zephyr/devicetree.h:715:27: note: in expansion of macro 'DT_PROP' 715 | #define DT_LABEL(node_id) DT_PROP(node_id, label) | ^~~~~~~ /media/sam/ncs21/nrf/samples/nrf9160/dtlsnbiot/src/main.c:918:31: note: in expansion of macro 'DT_LABEL' 918 | baseuart= device_get_binding(DT_LABEL(DT_NODELABEL(uart2))); | ^~~~~~~~ /media/sam/ncs21/zephyr/include/zephyr/devicetree.h:3068:24: note: in expansion of macro 'DT_N_NODELABEL_uart2' 3068 | #define DT_CAT(a1, a2) a1 ## a2 | ^~ /media/sam/ncs21/zephyr/include/zephyr/devicetree.h:177:29: note: in expansion of macro 'DT_CAT' 177 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label) | ^~~~~~ /media/sam/ncs21/nrf/samples/nrf9160/dtlsnbiot/src/main.c:918:40: note: in expansion of macro 'DT_NODELABEL' 918 | baseuart= device_get_binding(DT_LABEL(DT_NODELABEL(uart2))); | ^~~~~~~~~~~~ /media/sam/ncs21/nrf/samples/nrf9160/dtlsnbiot/build/zephyr/include/generated/devicetree_unfixed.h:9216:38: note: each undeclared identifier is reported only once for each function it appears in 9216 | #define DT_N_NODELABEL_uart2 DT_N_S_soc_S_peripheral_40000000_S_uart_a000 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /media/sam/ncs21/zephyr/include/zephyr/devicetree.h:3068:24: note: in definition of macro 'DT_CAT' 3068 | #define DT_CAT(a1, a2) a1 ## a2 | ^~ /media/sam/ncs21/zephyr/include/zephyr/devicetree.h:715:27: note: in expansion of macro 'DT_PROP' 715 | #define DT_LABEL(node_id) DT_PROP(node_id, label) | ^~~~~~~ /media/sam/ncs21/nrf/samples/nrf9160/dtlsnbiot/src/main.c:918:31: note: in expansion of macro 'DT_LABEL' 918 | baseuart= device_get_binding(DT_LABEL(DT_NODELABEL(uart2))); | ^~~~~~~~ /media/sam/ncs21/zephyr/include/zephyr/devicetree.h:3068:24: note: in expansion of macro 'DT_N_NODELABEL_uart2' 3068 | #define DT_CAT(a1, a2) a1 ## a2 | ^~ /media/sam/ncs21/zephyr/include/zephyr/devicetree.h:177:29: note: in expansion of macro 'DT_CAT' 177 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label) | ^~~~~~ /media/sam/ncs21/nrf/samples/nrf9160/dtlsnbiot/src/main.c:918:40: note: in expansion of macro 'DT_NODELABEL' 918 | baseuart= device_get_binding(DT_LABEL(DT_NODELABEL(uart2))); | ^~~~~~~~~~~~ ninja: build stopped: subcommand failed. FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /media/sam/ncs21/nrf/samples/nrf9160/dtlsnbiot/build
I think the uart aliases may have changed so that this initialisation needs coding differently but am unclear how to resolve.
There is also an overlay file with the following:
&uart2 { status = "okay"; current-speed = <115200>; pinctrl-0 = <&uart2_default>; pinctrl-1 = <&uart2_sleep>; // rx-pin = <14>; // tx-pin = <15>; };
This doesn't seem to be the only problem moving from v2.0.0 to v2.1.0
If the modem initialisation code is modified so that it compiles (but won't run), there are additional errors:
[113/292] Building C object zephyr/CMakeFiles/zephyr.dir/media/sam/ncs21/nrf/subsys/nonsecure/soc_secure.c.obj /media/sam/ncs21/nrf/subsys/nonsecure/soc_secure.c: In function 'soc_secure_mem_read': /media/sam/ncs21/nrf/subsys/nonsecure/soc_secure.c:19:2: warning: 'spm_request_read' is deprecated [-Wdeprecated-declarations] 19 | return spm_request_read(dst, (uint32_t)src, len); | ^~~~~~ In file included from /media/sam/ncs21/nrf/subsys/nonsecure/soc_secure.c:10: /media/sam/ncs21/nrf/include/secure_services.h:88:18: note: declared here 88 | __deprecated int spm_request_read(void *destination, uint32_t addr, size_t len); | ^~~~~~~~~~~~~~~~ [146/292] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/net/lib/sockets/sockets_tls.c.obj /media/sam/ncs21/zephyr/subsys/net/lib/sockets/sockets_tls.c: In function 'dtls_rx': /media/sam/ncs21/zephyr/subsys/net/lib/sockets/sockets_tls.c:804:11: warning: implicit declaration of function 'mbedtls_ssl_set_client_transport_id'; did you mean 'mbedtls_ssl_conf_transport'? [-Wimplicit-function-declaration] 804 | err = mbedtls_ssl_set_client_transport_id( | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | mbedtls_ssl_conf_transport /media/sam/ncs21/zephyr/subsys/net/lib/sockets/sockets_tls.c: In function 'tls_mbedtls_init': /media/sam/ncs21/zephyr/subsys/net/lib/sockets/sockets_tls.c:1236:3: warning: implicit declaration of function 'mbedtls_ssl_conf_handshake_timeout'; did you mean 'mbedtls_ssl_conf_read_timeout'? [-Wimplicit-function-declaration] 1236 | mbedtls_ssl_conf_handshake_timeout(&context->config, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | mbedtls_ssl_conf_read_timeout /media/sam/ncs21/zephyr/subsys/net/lib/sockets/sockets_tls.c:1249:4: warning: implicit declaration of function 'mbedtls_ssl_conf_dtls_cookies'; did you mean 'mbedtls_ssl_conf_sig_hashes'? [-Wimplicit-function-declaration] 1249 | mbedtls_ssl_conf_dtls_cookies(&context->config, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | mbedtls_ssl_conf_sig_hashes [210/292] Building C object zephyr/drivers/entropy/CMakeFiles/drivers__entropy.dir/media/sam/ncs21/nrf/drivers/entropy/entropy_cc3xx.c.obj /media/sam/ncs21/nrf/drivers/entropy/entropy_cc3xx.c: In function 'entropy_cc3xx_rng_get_entropy': /media/sam/ncs21/nrf/drivers/entropy/entropy_cc3xx.c:65:3: warning: 'spm_request_random_number' is deprecated [-Wdeprecated-declarations] 65 | ret = spm_request_random_number(buffer + offset, | ^~~ In file included from /media/sam/ncs21/nrf/drivers/entropy/entropy_cc3xx.c:18: /media/sam/ncs21/nrf/include/secure_services.h:75:18: note: declared here 75 | __deprecated int spm_request_random_number(uint8_t *output, size_t len, size_t *olen); | ^~~~~~~~~~~~~~~~~~~~~~~~~ [281/292] Linking C executable zephyr/zephyr_pre0.elf FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /media/sam/ncs21/nrf/samples/nrf9160/dtlsnbiot/build/zephyr/zephyr_pre0.map
Again these errors don't appear when building under v2.0.0
This looks like it could be some kind of new configuration option that needs asserting that affects conditional compilation of the functions not found (as they do exist), but have not been able to find anything new in the documentation, even though different version of sdk-mbedtls have been provided as appears in the two west.yaml files:
v3.0.0-ncs2 in nrf connect v2.0.0 and v3.1.0-ncs1 in nrf connect v2.1.0
The applications are being built from VSC after SDK installation via toolchain manager.
Any assistance would be very much appreciated. Cheers Ron.