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

  • 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.

  • Hi,

    Haven't heard back.  You guys are probably busy.  You can close this out since I have figured out the problem as explained in the above.  The only question I had was if it was considered a bug that I had to put the CONFIG_PINCTRL=y in the device tree defconfig files to get it to work, rather than just putting it in the pros.conf file like normal.

    Thanks,

    h.

  • Just want to thank you for solving my similar issue.

    I'm designing a custom board, using the VSCode DeviceTree, and I also got stuck at this point with the pinctrl. 

    Adding the CONFIG_PINCTRL=y into my board defconfig file solved the issue. 

Reply Children
No Data
Related