Upgrading NRFCONNECT SDK v2.0.0 to v2.5.0 build issue with PINCTRL Driver compiling common.c

Hi,

I've been working on upgrading our SDK 2.0.0 code to SDK 2.5.0.  There are numerous things to do so I have been fixing things to get to the point where I can get a good hex build.  Of the many things to be done I have implemented the PINCTRL in the device tree and am trying to get past those fixes.  The issue I am having at the moment appears to be the build not compiling common.c which is in the zephyr drivers/pinctrl/ directory.  According to the CMakeList.txt file the common.c should be compiled if the proj.conf has the CONFIG_PINCTRL=y set.  But I am getting some issues with undeclared functions which appear to need common.c to be there to work:

../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v8-m.main+fp/hard" -LC:/Users/lindh/Desktop/wt-sdk-25/wt_app/signetik_client/build/mcuboot/zephyr -lgcc zephyr/arch/common/libisr_tables.a -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mfp16-format=ieee -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -Wl,-no-pie C:/Users/lindh/Desktop/wt-sdk-25/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m33/hard-float/no-interrupts/libnrf_cc310_platform_0.9.18.a C:/Users/lindh/Desktop/wt-sdk-25/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m33/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a && cmd.exe /C "cd /D C:\Users\lindh\Desktop\wt-sdk-25\wt_app\signetik_client\build\mcuboot\zephyr && C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.exe -E true""
c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/serial/libdrivers__serial.a(uart_nrfx_uarte.c.obj): in function `pinctrl_apply_state':
C:\Users\lindh\Desktop\wt-sdk-25\zephyr\include\zephyr\drivers\pinctrl.h:348: undefined reference to `pinctrl_lookup_state'
c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/serial/libdrivers__serial.a(uart_nrfx_uarte.c.obj): in function `pinctrl_apply_state_direct':
C:\Users\lindh\Desktop\wt-sdk-25\zephyr\include\zephyr\drivers\pinctrl.h:329: undefined reference to `pinctrl_configure_pins'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

The routines in red appear to have the source in the zepher drivers/pinctrl/common.c file which is compiled in the CMakelist.txt file in the drivers/pinctrl directory.  And I believe I have the config setup in proj.conf that should be building it, unless I have something else missing:

CONFIG_BUILD_WITH_TFM=n
####CONFIG_SPM=y    # removed v250
#CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_BASE64=y
CONFIG_PINCTRL=y
#CONFIG_PM_DEVICE=y
#CONFIG_PINCTRL_NRF=y
CONFIG_PM_PARTITION_SIZE_NVS_STORAGE=0x5000
This is just an excerpt from the proj.conf section that the CONFIG_PINCTRL=y is in.  Other entries in the proj.conf which appeared to have an issue I have commented out with 4 "#"'s.  Config entries I have put into proj.conf since the start of the conversion are:
# NEW PARAMETERS FOR v250:
CONFIG_MBEDTLS=y
CONFIG_DFU_TARGET_MCUBOOT=y
CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_FLASH_MAP=y
CONFIG_STREAM_FLASH=y
As I said, I am not through getting everything converted.  Just hit this roadblock and it seems like the common.c of PINCTRL is not being built so those routines that are prototyped in pinctrl.h are missing.
Thanks for your help and let me know if you need anything else to figure it out.  I will continue looking at it as well.
h.
Parents
  • Naeem,

    Thanks for the response on my issue.  I had actually tried that before and it probably doesn't hurt to have it defined either way.  But having dynamic in there does't change the routines not being defined (pinctrl_lookup_state & pinctrl_configure_pins).  It looks like the common.c is still not being built.  Is there a way to debug the build process to see what all is being built or which CMakefile.txt's are being processed and what is or isn't built/triggered as a result?  Or any other config parameters in proj.conf that might be negating it.  It seems strange.  I would think that it should build.

    Thanks,

    h.

  • Hi Harold,

    Sorry for the delayed response.

    Is there any update at your end?

    I started with a dynamic-pincontrol sample in ncs 2.5.0,

    and then added the configurations you have shown

    there were some issues with the secure firmware, as with these configs the source code or header files were not included / working properly.

    I had to enable BUILD_WITH_TFM, and now I can build the project with your configs.

    Attaching the snapshot to show the build and the configs.

    /BR, Naeem

  • Hi Naeem,

    I checked and we actually had BUILD_WITH_TFM set to n.  I tried it both ways, but we are still geting the same error:

    c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/serial/libdrivers__serial.a(uart_nrfx_uarte.c.obj): in function `pinctrl_apply_state':
    C:\Users\lindh\Desktop\wt-sdk-25\zephyr\include\zephyr\drivers\pinctrl.h:348: undefined reference to `pinctrl_lookup_state'
    c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/serial/libdrivers__serial.a(uart_nrfx_uarte.c.obj): in function `pinctrl_apply_state_direct':
    C:\Users\lindh\Desktop\wt-sdk-25\zephyr\include\zephyr\drivers\pinctrl.h:329: undefined reference to `pinctrl_configure_pins'
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.

    As I said before it seems to be related to the common.c routine in the pinctrl driver directory not getting built for whatever reason.  The two missing references above seem to be defined in there.

    Thanks,

    h.

  • In our original code which is running SDK version 2.0.0, it doesn't look like pinctrl is defined in proj.conf at all.  There is an entry for CONFIG_PINCTRL=n, but it is defined to "N".  And none of the specific driver configs are defined either.  I tried that as well (building with no pinctrl config parameters set like the original code) but am still getting the same error (see above message).  So not sure if maybe some other config is set that shouldn't be or what.  Here is the complete proj.conf file:

    #
    # Copyright (c) 2019 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
    #
    # General config
    CONFIG_BUILD_WITH_TFM=n
    ####CONFIG_SPM=y    # removed v250
    #CONFIG_TEST_RANDOM_GENERATOR=y
    CONFIG_BASE64=y
    ####CONFIG_PINCTRL=y
    #CONFIG_PM_DEVICE=y
    ####CONFIG_PINCTRL_NRF=y
    CONFIG_PM_PARTITION_SIZE_NVS_STORAGE=0x5000
    
    # Heap and stacks
    CONFIG_HEAP_MEM_POOL_SIZE=16384
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=1536
    
    # LTE link control
    CONFIG_LTE_LINK_CONTROL=y
    # Disable autoconnect
    CONFIG_LTE_AUTO_INIT_AND_CONNECT=n
    
    CONFIG_LTE_NETWORK_TIMEOUT=60
    
    # LwM2M carrier is only compiled for hard-float
    CONFIG_FPU=y
    CONFIG_FP_HARDABI=y
    CONFIG_FPU_SHARING=y
    
    # LWM2M
    CONFIG_LWM2M=n
    CONFIG_LWM2M_CARRIER=n
    ####CONFIG_NEWLIB_LIBC=y
    ####CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    CONFIG_MPU_ALLOW_FLASH_WRITE=y
    CONFIG_NVS=y
    CONFIG_REBOOT=y
    
    # Modem library
    CONFIG_NRF_MODEM_LIB=y
    ####CONFIG_NRF_MODEM_LIB_SYS_INIT=y #deprecated v250
    CONFIG_MODEM_KEY_MGMT=y
    CONFIG_MODEM_INFO=y
    CONFIG_MODEM_INFO_ADD_NETWORK=y
    
    # GPS Location
    CONFIG_LOCATION=y
    ####CONFIG_LOCATION_METHOD_GNSS_AGPS_EXTERNAL=y # removed v250
    CONFIG_LTE_NETWORK_MODE_LTE_M_GPS=y
    CONFIG_NRF_CLOUD_REST=y
    ####CONFIG_NRF_CLOUD_AGPS=y # removed v250
    CONFIG_MODEM_JWT=y
    CONFIG_NRF_CLOUD_REST_AUTOGEN_JWT=y
    CONFIG_NRF_CLOUD_REST_AUTOGEN_JWT_VALID_TIME_S=300
    ####CONFIG_MULTICELL_LOCATION_SERVICE_NRF_CLOUD=y   # removed v250
    
    # PDN library
    CONFIG_PDN=y
    ####CONFIG_PDN_CONTEXTS_MAX=3   # removed v250
    
    # GCC Optimization Flags
    CONFIG_SIZE_OPTIMIZATIONS=n   # -Os
    CONFIG_SPEED_OPTIMIZATIONS=y  # -O2
    CONFIG_DEBUG_OPTIMIZATIONS=n  # -Og
    
    # Watchdog Timer (WDT)
    CONFIG_WATCHDOG=y
    CONFIG_WDT_DISABLE_AT_BOOT=n
    CONFIG_WDT_LOG_LEVEL_DBG=y
    
    # Networking
    CONFIG_NETWORKING=y
    CONFIG_NET_NATIVE=n
    CONFIG_NET_SOCKETS_OFFLOAD=y
    CONFIG_NET_SOCKETS=y
    CONFIG_NET_SOCKETS_POSIX_NAMES=y
    CONFIG_TLS_CREDENTIALS=y
    CONFIG_TLS_CREDENTIAL_FILENAMES=y
    ####CONFIG_NET_SOCKETS_SOCKOPT_TLS=y    #experimental v250
    CONFIG_MBEDTLS_PEM_CERTIFICATE_FORMAT=y
    #CONFIG_TINYCBOR=y
    
    # Disable native network stack to save some memory
    CONFIG_NET_IPV4=n
    CONFIG_NET_IPV6=n
    ####CONFIG_NET_UDP=n
    ####CONFIG_NET_TCP=n
    
    # CoAP
    CONFIG_COAP=n
    
    # In order to correctly tune the stack sizes for the threads the following
    # Configurations can enabled to print the current use:
    CONFIG_THREAD_NAME=y
    CONFIG_THREAD_ANALYZER=n
    
    # Main thread
    #CONFIG_MAIN_STACK_SIZE=1024
    CONFIG_MAIN_STACK_SIZE=4096
    
    # Devices
    CONFIG_SERIAL=y
    CONFIG_STDOUT_CONSOLE=y
    CONFIG_UART_INTERRUPT_DRIVEN=n
    CONFIG_I2C=y
    ####CONFIG_GPIO=y
    CONFIG_NRFX_GPIOTE=y
    CONFIG_NRFX_GPIOTE_NUM_OF_EVT_HANDLERS=7
    CONFIG_NRFX_I2S=y
    CONFIG_SPI=y
    
    # Sensors
    
    # Logs
    CONFIG_LOG=y
    CONFIG_LOG_DEFAULT_LEVEL=3
    CONFIG_LOG_OVERRIDE_LEVEL=0
    CONFIG_LOG_MAX_LEVEL=4
    #CONFIG_LOG_STRDUP_MAX_STRING=512
    
    #  Make console input immediate
    CONFIG_LOG_MODE_IMMEDIATE=y
    
    # SNTP
    CONFIG_SNTP=y
    #CONFIG_SNTP_LOG_LEVEL=0
    
    # AT Host UART
    CONFIG_AT_CMD_PARSER=y
    CONFIG_AT_MONITOR=y
    CONFIG_AT_MONITOR_HEAP_SIZE=320
    CONFIG_AT_HOST_LIBRARY=n
    ####CONFIG_AT_HOST_UART_1=y # removed v250
    ####CONFIG_CR_TERMINATION=y
    
    # MQTT
    CONFIG_MQTT_LIB=y
    CONFIG_MQTT_LIB_TLS=y
    
    # RTT Debug
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    ####CONFIG_UART_RTT=y
    
    # MCU_BOOT
    CONFIG_BOOTLOADER_MCUBOOT=y
    
    # Image manager
    CONFIG_IMG_MANAGER=y
    CONFIG_FLASH=y
    CONFIG_IMG_ERASE_PROGRESSIVELY=y
    
    # DFU Target
    CONFIG_DFU_TARGET=y
    
    # Download Client
    CONFIG_DOWNLOAD_CLIENT=y
    CONFIG_DOWNLOAD_CLIENT_BUF_SIZE=2048
    CONFIG_DOWNLOAD_CLIENT_SOCK_TIMEOUT_MS=30000
    
    
    # GPS
    CONFIG_LTE_NETWORK_MODE_LTE_M_GPS=y
    
    # WearTech Device
    CONFIG_WEARTECH_DEVICE=y
    
    # UART
    CONFIG_NRFX_UARTE1=y
    CONFIG_UART_ASYNC_API=y
    
    CONFIG_OPERATING_MODE_DATA_CAPTURE_AI=n
    
    # SMS
    CONFIG_SMS=y
    
    # nRF Cloud Device ID
    CONFIG_NRF_CLOUD_CLIENT_ID_PREFIX="wt-"
    
    # Sensor addons
    CONFIG_SENSOR_NONE=y
    
    # NEW PARAMETERS FOR v250:
    CONFIG_MBEDTLS=y
    CONFIG_DFU_TARGET_MCUBOOT=y
    CONFIG_MCUBOOT_IMG_MANAGER=y
    CONFIG_FLASH_MAP=y
    CONFIG_STREAM_FLASH=y
    #CONFIG_PINCTRL_DYNAMIC=y
    
    # Other new stuff to consider or explore:
    CONFIG_PARTITION_MANAGER_ENABLED=y
    #CONFIG_PM=y    //  Kernel power management?  v250
    #CONFIG_BUILD_WITH_TFM=y

    Thanks,

    h.

  • Here's a little more of the build error.  I've been comparing a pristine build on sdk v250 to our working v200.  Here's the entire section that blips:

    [21/28] Linking C static library zephyr\libzephyr.a
    [22/28] Linking C static library app\libapp.a
    [23/28] Linking C executable zephyr\zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map
    cmd.exe /C "cd . && C:\ncs\toolchains\c57af46cb7\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr\zephyr_pre0.elf -fuse-ld=bfd -T zephyr/linker_zephyr_pre0.cmd -Wl,-Map=C:/Users/lindh/Desktop/wt-sdk-25/wt_app/signetik_client/build/mcuboot/zephyr/zephyr_pre0.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a zephyr/arch/arch/arm/core/aarch32/cortex_m/cmse/libarch__arm__core__aarch32__cortex_m__cmse.a zephyr/lib/libc/minimal/liblib__libc__minimal.a zephyr/lib/libc/common/liblib__libc__common.a zephyr/drivers/clock_control/libdrivers__clock_control.a zephyr/drivers/flash/libdrivers__flash.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/serial/libdrivers__serial.a zephyr/drivers/timer/libdrivers__timer.a modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.a modules/mcuboot/boot/bootutil/zephyr/libmcuboot_util.a modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -L"c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v8-m.main+fp/hard" -LC:/Users/lindh/Desktop/wt-sdk-25/wt_app/signetik_client/build/mcuboot/zephyr -lgcc zephyr/arch/common/libisr_tables.a -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mfp16-format=ieee -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -Wl,-X -Wl,-N -Wl,--orphan-handling=warn -Wl,-no-pie C:/Users/lindh/Desktop/wt-sdk-25/nrfxlib/crypto/nrf_cc310_platform/lib/cortex-m33/hard-float/no-interrupts/libnrf_cc310_platform_0.9.18.a C:/Users/lindh/Desktop/wt-sdk-25/nrfxlib/crypto/nrf_cc310_bl/lib/cortex-m33/hard-float/no-interrupts/libnrf_cc310_bl_0.9.12.a && cmd.exe /C "cd /D C:\Users\lindh\Desktop\wt-sdk-25\wt_app\signetik_client\build\mcuboot\zephyr && C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.exe -E true""
    c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/serial/libdrivers__serial.a(uart_nrfx_uarte.c.obj): in function `pinctrl_apply_state':
    C:\Users\lindh\Desktop\wt-sdk-25\zephyr\include\zephyr\drivers\pinctrl.h:348: undefined reference to `pinctrl_lookup_state'
    c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/drivers/serial/libdrivers__serial.a(uart_nrfx_uarte.c.obj): in function `pinctrl_apply_state_direct':
    C:\Users\lindh\Desktop\wt-sdk-25\zephyr\include\zephyr\drivers\pinctrl.h:329: undefined reference to `pinctrl_configure_pins'
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.

    Thanks,

    h.

  • So after comparing the SDK 200 and 250 applications (same one), it looks like we may not need those pinctrl routines, but somehow after copying the sdk 200 app to use the 250 sdk, it is trying to use the pinctrl routines and can't find them, which I don't think we need...

    Thanks,

    h.

  • Hi,

    It looks like I have finally figured out what the issue is with the build problems I am having around the pinctrl facility.  I found an article ((+) 'pin' is marked as deprecated in 'properties:' - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com)) that had a similar issue and the suggestion from DevZone was to add CONIFG_PINCTRL=y to the proj.conf file.  That didn't work for the developer who then found a hint in a GIT project I believe that did work.

    It appears that the CONFIG_PINCTRL=y added to the proj.conf does not cause the /drivers/pinctrl common.c to be added to the project and leads to the missing functions.  But, as suggested in the above ticket, adding the CONIFG_PINCTRL=y to the defconfig files in the board files causes it to build them.

    After adding the config to the defconfig board files I was able to get past that build issue and stopped at another issue (I'm upgrading from SDK 2.0.0 to 2.5.0).  But at least I am past that point.

    So there may be some kind of bug or something that is causing this.  If you can figure out what the deal is, I would be interested since this has delayed my efforts for weeks and others should know about this so they don't fall down this hole.

    Please advise,

    Thanks,

    h.

Reply
  • Hi,

    It looks like I have finally figured out what the issue is with the build problems I am having around the pinctrl facility.  I found an article ((+) 'pin' is marked as deprecated in 'properties:' - Nordic Q&A - Nordic DevZone - Nordic DevZone (nordicsemi.com)) that had a similar issue and the suggestion from DevZone was to add CONIFG_PINCTRL=y to the proj.conf file.  That didn't work for the developer who then found a hint in a GIT project I believe that did work.

    It appears that the CONFIG_PINCTRL=y added to the proj.conf does not cause the /drivers/pinctrl common.c to be added to the project and leads to the missing functions.  But, as suggested in the above ticket, adding the CONIFG_PINCTRL=y to the defconfig files in the board files causes it to build them.

    After adding the config to the defconfig board files I was able to get past that build issue and stopped at another issue (I'm upgrading from SDK 2.0.0 to 2.5.0).  But at least I am past that point.

    So there may be some kind of bug or something that is causing this.  If you can figure out what the deal is, I would be interested since this has delayed my efforts for weeks and others should know about this so they don't fall down this hole.

    Please advise,

    Thanks,

    h.

Children
Related