PSOC6 mbedtls with CY8C6247FDI-D32 that does not have crypto hardware: errors linking trng related functions

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
mark_ennamorato
Level 3
Level 3
5 questions asked 25 sign-ins First like given

Hi,

I am trying to use MTB wifi example projects on my hardware that uses an MCU that does not have crypto hardware like the devkit MCU has (devkit is CY8CKIT-062-WiFi-BT)  but I immediately run into an issue with mbedtls and secure-sockets with undefined references to functions that use the trng hardware during linking phase:

For example:

/Applications/ModusToolbox/tools_3.0/gcc/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: /Users/mark.ennamorato/xxxxxxx/Wi-Fi_Scan//../mtb_shared/secure-sockets/release-v3.1.0/source/COMPONENT_MBEDTLS/cy_tls.c:404: undefined reference to `cyhal_trng_generate'

 

How do I solve this? Is there a way to use software library instead of hardware engine?  Also.. I need to use SDIO interface to 4343W WiFi/BT sip

 

Thanks

0 Likes
1 Solution

@Qi_Colin ok thank you for your excellent help and if we see anything strange I will let you know! I will mark this solved

View solution in original post

20 Replies
ChiP_16
Employee
Employee
5 questions asked 5 likes given 5 solutions authored

Hi Mark,

Try adding below to makefile.

DEFINES+=DISABLE_MBEDTLS_ACCELERATION

Refer to wifi-mw-core for details.

https://github.com/Infineon/wifi-mw-core

Regards,

Pong

0 Likes

Hi Pong

thanks for suggestion but same error and i did look thru that..I was actually going to try it.

/Applications/ModusToolbox/tools_3.0/gcc/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: /Users/mark.ennamorato/xxxx/Wi-Fi_Scan/build/APP_CY8CKIT-062-WIFI-BT/Debug/ext/mtb_shared/secure-sockets/release-v3.1.0/source/COMPONENT_MBEDTLS/cy_tls.o: in function `trng_get_bytes':

One thing that did seem to work but may be causing other problems:

DEFINES+=COMPONENT_43907

Now... we are using a 4343W NOT a 43907.  And SDIO port comes up then fails with weird message about

SDIO firmware download error, whd_bus_sdio_init failed at 470

because there is no firmware to download into the 4343W that I know of.

 

 

0 Likes

Hi @mark_ennamorato :

Which code example you're working on?

CYW43907 is a WiFi SoC chip, and I don't think it should appear in the DEFINES.

Best Regards,

Colin

0 Likes

The WiFi_Scan example.

On the kit mentioned above.

It has a 4343W wifi chip.

But without the COMPONENT _43907 added to the makefile, mbedtls fails the linker with missing functions as described above

0 Likes

Hi @mark_ennamorato :

After you change the device to CY8C6247FDI-D32, did you modify the custom configuration of SDIO ports in Device Configurator tool? 

It's related to the hardware's schematic. 

Best Regard,

Colin

0 Likes

Yes I changed the BSP SDIO port, the pins in Device Configurator, the cyreservedresources.list file and makefile

0 Likes

Hi @mark_ennamorato :

Could you share more about your modifications of the pins in Device Configurator, the cyreservedresources.list file and makefile?

According to your error "whd_bus_sdio_init failed at 470", it may be caused by SDIO communication between CY8C6247FDI-D32 and 4343W module.

Best Regards,

Colin

0 Likes

Hi Colin, ok so good news.. .the SDIO port is working and the WiFi is now working *after* I realized there was no 32kHz clock to the LPO_IN(32k) pin on the 4343W.   Once I added that 32kHz clock the SDIO was able to talk to the 4343W.  It was not clear from some information whether or not this clock was needed for the interface or if it was just for low power modes...  regardless , back to my original question:  what does COMPONENT_43907 actually do?  I see in the wifi driver (somewhere..) that it uses a 'prng' instead of the 'trng'.

This 'prng' I am assuming is a pseudo-random number generator instead the hardware true-random-number-generator in the D54 PSOC (that does not exist in the D32 PSOC).

But what bothers me is I do not *really* understand what DEFINES+=COMPONENT_43907 does besides this.   I also see firmware for all the 'Wiced' WiFi devices and this is just one of them, so I am thinking the 4343W is getting loaded with some firmware from the wifi driver (?) and if so is it getting loaded with the correct firmware?

Maybe this is another thread....

It is just very unsettling why I need to add this whole DEFINES+=COMPONENT_43907 in the first place when the board uses a 4343W...

0 Likes

Hi @mark_ennamorato :

"DEFINES+=COMPONENT_43907" means enable the feature of CYW43907 wifi SoC chip.

I don't think you should use this define in your project.

Best Regards,

Colin

0 Likes

Hi Colin..well we are at the root of the issue now! I tend to agree I should not need that 43907 define BUT if I don't ok include it I get those mbedtls errors I listed at the top of this thread! And nobody seems to be able to explain that..

0 Likes

Hi @mark_ennamorato :

Could you share me your modifications in the project or share your custom project?

I'm not sure the reason of your errors, so I want to check the code with you.

Best Regards,

Colin

0 Likes

Hi @Qi_Colin  sure I can either send you a zip archive or you can do it yourself !

1) use Project Creator and pick the CY8CKIT-062-WiFi-BT kit and pick the WiFi_Scan app

2) go to the Device Configurator and move the SDIO pins from P2 to P12 at the correct order: P12_0 = SDIO_CLK, P12_1...4 = SDIO_D0..3, P12_5 = SDIO_CMD

3) remove all signals from P8 *** OR ELSE BSP ASSISTANT WILL COMPLAIN ***

4) save and exit the Device Configurator file

5) open the BSP Assistant and change the device to the CY8C6247FDI-D32 

6) change the SDIO port to P12

7) save and exit the BSP assistant

😎 Open the project top level makefile and add this to the COMPONENTS: UDB_SDIO_P12

9) save and exit the makefile

10) open the 'cyreservedresources.list' file in Wi-Fi_Scan->bsps->TARGET_APP_CY8CKIT-062-WIFI-BT->config folder and change the SDIO port from P2 to P12 as described at the top of the file

11) save the file

12) build the project

13) you will get mbedtls errors as I have shown at the top of this thread

10)

0 Likes

Hi @mark_ennamorato :

Ok, I will check it and feedback to you.

Best Regards,

Colin

0 Likes

Hi @Qi_Colin here is the project zip file but with the DEFINE+=COMPONENT_43907 in the top-level makefile. it should compile and link with no errors.  If you take out that DEFINE+= you will get the mbedtls error. ignore the name..;-)

0 Likes

Hi @mark_ennamorato :

I'm still checking it.

I find that APIs (related to TRNG) in these errors are requiring the HW CRYPTO supported, and CY8C6247FDI-D32 don't have this module.

I'm checking how to solve this problem.

Best Regards,

Colin

0 Likes
Qi_Colin
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 5 questions asked

Hi @mark_ennamorato :

Just like above talked, these errors caused by no HW CRYPTO supported in CY8C6247FDI-D32.

In current situation, I think you can add DEFINE+=COMPONENT_43907 in MAKEFILE temporarily.

As you found before, this define will use PRNG to generate a random number from "cy_lwip.c" instead of TRNG from HW.

Best Regards,

Colin

0 Likes

Hi@Qi_Colin ,

Ok glad you see same. I just wonder if there is any other side effects from this, like wrong firmware getting downloaded into the 4343W.

Seems like driver should be fixed to allow turning on/off hardware RNG independent of what WiFi chip is being used!

Thanks for your help

0 Likes

Hi @mark_ennamorato :

For side effects, I think this need to do more test and get the conclusion.

Just from the code, COMPONENT_43907 is only related to PRNG feature.

Best Regards,

Colin

0 Likes

@Qi_Colin ok thank you for your excellent help and if we see anything strange I will let you know! I will mark this solved