Undefined references (e.g zbPlatCryptoRandomGet) when building DK006 SDK ZigBee examples

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Undefined references (e.g zbPlatCryptoRandomGet) when building DK006 SDK ZigBee examples

1,691件の閲覧回数
dstevens
Contributor II

I am unable to successfully build DK006 application note samples, such as JN-AN-1243 or JN-AN-1267.

MCUXpresso has been installed and configured in line with AN1260 and the versions are:

- MCUXpresso v.11.10.0_3148

- SDK_2.6.15_JN5189

I'm building for the JN5189 target.

The samples compile correctly, but linking fails for both samples with the same undefined references in the ZigBee middleware:

 

zbPlatCryptoAesMmoFinalUpdate
zbPlatCryptoAesHmacMmo
zbPlatCryptoAesMmoFinalUpdate
zbPlatCryptoRandom256Get
zbPlatCryptoRandomGet

 

 

Example linker output:

 

c:/nxp/MCUXpressoIDE_11.10.0_3148/ide/tools/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/nxp/SDKPackages/JN5189DK6/middleware/wireless/zigbee/platform/K32W0/libs\libZPSAPL.a(zps_apl_sec.o): in function `zps_pvAesGetKeyFromInstallCode':
zps_apl_sec.c:(.text.zps_pvAesGetKeyFromInstallCode+0x3c): undefined reference to `zbPlatCryptoAesMmoFinalUpdate'

c:/nxp/MCUXpressoIDE_11.10.0_3148/ide/tools/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/nxp/SDKPackages/JN5189DK6/middleware/wireless/zigbee/platform/K32W0/libs\libZPSAPL.a(zps_apl_sec.o): in function `vTransformKey':
zps_apl_sec.c:(.text.vTransformKey+0x36): undefined reference to `zbPlatCryptoAesHmacMmo'

c:/nxp/MCUXpressoIDE_11.10.0_3148/ide/tools/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe: zps_apl_sec.c:(.text.vTransformKey+0x5c): undefined reference to `zbPlatCryptoAesMmoFinalUpdate'

c:/nxp/MCUXpressoIDE_11.10.0_3148/ide/tools/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/nxp/SDKPackages/JN5189DK6/middleware/wireless/zigbee/platform/K32W0/libs\libZPSAPL.a(zps_apl_zdo_nwkmanager.o): in function `zps_vAplInitFactoryNewDistributedNetwork':
zps_apl_zdo_nwkmanager.c:(.text.zps_vAplInitFactoryNewDistributedNetwork+0x10c): undefined reference to `zbPlatCryptoRandom256Get'

c:/nxp/MCUXpressoIDE_11.10.0_3148/ide/tools/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/nxp/SDKPackages/JN5189DK6/middleware/wireless/zigbee/platform/K32W0/libs\libZPSAPL.a(zps_apl_zdo_nwkmanager.o): in function `vAplSecAuthTimerExpiry':
zps_apl_zdo_nwkmanager.c:(.text.vAplSecAuthTimerExpiry+0x48): undefined reference to `zbPlatCryptoRandomGet'

 

 

0 件の賞賛
返信
4 返答(返信)

1,662件の閲覧回数
dstevens
Contributor II

Okay, so it turns out these functions:

zbPlatCryptoAesMmoFinalUpdate
zbPlatCryptoAesHmacMmo
zbPlatCryptoAesMmoFinalUpdate
zbPlatCryptoRandom256Get
zbPlatCryptoRandomGet

are declared  in:

JNS5189DK6/middleware/wireless/zigbee/platform/zb_platform.h

and defined in:

JN5189DK6/middleware/wireless/zigbee/platform/K32W0/platform/crypto.c
JN5189DK6/middleware/wireless/zigbee/platform/NCP_HOST/platform/Posix/crypto.c

 

As far as I can tell, the source files are not included anywhere in the build.

The makefile config_ZBPro.mk seems to be responsible for the inclusion, as it adds the platform folder as a source folder and adds timer.c to the build.

config_ZBPro.mk from AN-1243

264 ifeq ($(FRAMEWORK_SWITCH),0)
265 ZIGBEE_BASE_DIR       = $(SDK2_BASE_DIR)/middleware/wireless/zigbee3.0
266 else
267 ZIGBEE_BASE_DIR       = $(SDK2_BASE_DIR)/middleware/wireless/zigbee
268 endif
...
385 ifeq ($(FRAMEWORK_SWITCH),1)
...
407    APPSRC += timer.c
...
654 ZIGBEE_BASE_src=$(OSA_BASE_SRC):$(ZIGBEE_COMMON_SRC):$(OS_ABSTRACT_SRC):$(GENERIC_LIST_SRC):$(BOARD_LEVEL_SRC)\
                  :$(CHIP_STARTUP_SRC):$(CHIP_SYSTEM_SRC):$(FSL_EXCEPTIONS_SRC):$(DEBUG_FIFO_SRC)\
                  :$(FRMWK_RNG_SRC):$(FRMWK_SECLIB_SRC):$(FRMWK_FUNCLIB_SRC):$(FRMWK_MSG_SRC)\
                  :$(ZIGBEE_COMMON_SRC)/../SelectiveOtaApp0/Source:$(FRMWK_MEMMGR_SRC)\
                  :$(FRMWK_TMRMGR_SRC):$(ZIGBEE_COMMON_SRC)/../SelectiveOtaApp1/Source\
                  :$(FSL_EEPROM_INT):$(FSL_OTA):$(FSL_EEPROM_GEN):$(FUNCTIONLIB):$(FRMWK_PANIC_SRC)\
                  :$(FRMWK_HEAP_SRC):$(FRMWK_LOWPOWER_SRC):$(FRMWK_GPIO_SRC):$(DEVICE_SP_DRIVERS)\
                  :$(FSL_COMPONENTS)/serial_manager:$(FSL_COMPONENTS)/uart:$(DEVICE_SP_UTILITIES)\
                  :$(DEVICE_SP_UTILITIES)/str:$(DEVICE_SP_UTILITIES)/debug_console:$(ZIGBEE_BASE_DIR)/platform/K32W0/platform

 

Adding crypto.c solves the problem and the build links correctly:

408    APPSRC += crypto.c

 

Could someone from NXP please comment on this? It seems unlikely that this is a bug in the examples as they are not new and I can't imagine that it would have gone undiscovered since it prevents building.

So it's more likely a problem with the current SDK or my setup. Were these functions precompiled and included the libs previously? Are there some environment setup steps that are needed aside from those detailed in AN1260? Any guidance would be appreciated.

Thanks

0 件の賞賛
返信

1,652件の閲覧回数
Ricardo_Zamora
NXP TechSupport
NXP TechSupport

Hello,

 

Hope you are doing well. Could you please clarify the version of the AN?

 

On the Release Notes of each AN, you can check the versions of IDE and SDK that were tested.

 

Best Regards,

Ricardo

0 件の賞賛
返信

1,627件の閲覧回数
dstevens
Contributor II

Hi Ricardo,

I've confirmed that it's an issue with SDK v2.6.15 (and possibly 2.6.14). The release notes for JN-AN-1257 rev.2.8 list v2.6.13 as the version it was tested on and that version builds correctly.

So:

  • SDK_2_6_13_JN5189DK6 builds correctly
  • SDK_2_6_15_JN5189DK6 suffers the linking problem previously described

I would recommend fixing the problem, as a change in SDK patch version only should not introduce new behavior.

Thanks for your help.

0 件の賞賛
返信

1,642件の閲覧回数
dstevens
Contributor II

Hi Ricardo,

For AN-1243, it's rev. 2.8 — 12 December 2023.

I see in the release notes that the SDK is v2.6..13.

I am using v2.6.15 SDK, but I'm wondering if the SDK itself is different as I'd selected the JN5189 SDK using the SDK Builder rather than the JN5189DK6, which I suspect is what I should be using.

I'll try later today with the JN5189DK6 SDK to see if this changes things.

Thanks.

0 件の賞賛
返信