6 years, 8 months ago.

How To use mbedTLS with ESP8266-01 in NUCLEO-F401RE?

I want to use mbedTLS library with ESP8266-01 module in NUCLEO-F401RE. but if not use 'LWIP' at STM32 board, can't compile my project( this is mbedTLS & MQTT ) please help me anyone.

2 Answers

5 years, 8 months ago.

Hello

I'm also have same question. The solution is temtative because its "TESTING".

I want to know, can I use SW TRNG with any crupto library ? if possible, how to configure ?

Best Regards

6 years, 8 months ago.

I'm not sure what you're trying to do, but http-example uses F401RE with ESP8266 module and also includes mbed TLS, so maybe use it a starting point.

i want to test 'alexa-iot' example. and already test and work normally with DISCO-F746NG board. but this board has Ethernet(wired) only. so i change target board(F401RE) in my project and add 'ESP8266' library. but i can't compile. i saw error message( undefined reference mbedtls_ssl_init and other ).

posted by Jeon byungchul 03 Aug 2017

Where did you find the example? I can't find the 'alexa-iot' project...

posted by Jan Jongboom 03 Aug 2017

https://developer.mbed.org/users/peyo/code/AWS-test/ this is connect with AWS IoT.

posted by Jeon byungchul 03 Aug 2017

First, add the esp8266-driver library. Then, in the code, where it says EthernetInterface (and #include EthernetInterface.h) replace with:

#include "ESP8266Interface.h"
ESP8266Interface net(D8, D2, true);

And pass in SSID and password in the connect call.

But I can't compile the AWS-test program, so I can't verify if it actually works.

posted by Jan Jongboom 03 Aug 2017

thanks for your help. i will try to make my repository. but i don't know how to do. I will share my current project with you.

posted by Jeon byungchul 04 Aug 2017

my project uploaded in repository(https://developer.mbed.org/users/jeonbc/code/aws-iot-example). you have to export it( GCC_ARM/NUCLEO_F401RE ) first. then, add 'CXX_FLAGS += -std=gnu++11' at makefile. you can see error message.

posted by Jeon byungchul 04 Aug 2017

You'll need to set an entropy source, otherwise the ssl functions are not linked in. For TESTING you can define a NULL entropy source by declaring these macros:

MBEDTLS_TEST_NULL_ENTROPY and MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES

I've tested your code with these macros enabled and then the program compiles.

Side-note: you cannot use pin D1/D0 for UART on NUCLEO-F401RE because they are used by USB. Use D8/D2 instead.

posted by Jan Jongboom 04 Aug 2017

ASM_FLAGS += -DMBEDTLS_TEST_NULL_ENTROPY & ASM_FLAGS += -DMBEDTLS_NO_DEFAULT_ENTROPY_SOURCES. added in Makefile. but compile can't. please tell me detail.

posted by Jeon byungchul 07 Aug 2017

These macros need to be set under C_FLAGS and CXX_FLAGS, not under ASM_FLAGS. If you're building with mbed CLI you can also add them under the macros section in mbed_app.json

posted by Jan Jongboom 07 Aug 2017

I succeeded after I followed your instructions. thanks your help.

posted by Jeon byungchul 07 Aug 2017