WeActSTM32F411CEU6 uMail and ussl

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
davef
Posts: 21
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

WeActSTM32F411CEU6 uMail and ussl

Post by davef » Tue Jul 28, 2020 7:58 am

I have managed to talk to a ESP-01S with AT commands and connect to a Hotspot. Now I would like to send data using Gmail's SMTP server. So, I got uMail and following some other code (ESP-01S example.py) I found ... but I am stuck with:

Code: Select all

ImportError: cannot import name ussl
Found this:
https://github.com/micropython/micropyt ... issues/245

I put:

Code: Select all

#define MICROPY_PY_USSL (1)
l

in the mpconfigboard.h for this board and now get this error:

Code: Select all

In file included from ../../py/mpstate.h:35:0,
                 from ../../py/runtime.h:29,
                 from ../../extmod/moduhashlib.c:30:
../../extmod/moduhashlib.c:226:60: error: 'uhashlib_sha1_digest' undeclared here (not in a function)
 STATIC MP_DEFINE_CONST_FUN_OBJ_1(uhashlib_sha1_digest_obj, uhashlib_sha1_digest);
Any suggestions?

Thank you,
Dave
Last edited by davef on Wed Jul 29, 2020 10:22 pm, edited 1 time in total.

davef
Posts: 21
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: WeActSTM32F411CEU6 uMail and ussl

Post by davef » Thu Jul 30, 2020 10:42 am

OK, have made some progress. In /unix/mpconfigport.mk I see this:

Code: Select all

# ussl module requires one of the TLS libraries below
MICROPY_PY_USSL = 1
# axTLS has minimal size but implements only a subset of modern TLS
# functionality, so may have problems with some servers.
MICROPY_SSL_AXTLS = 1
# mbedTLS is more up to date and complete implementation, but also
# more bloated.
MICROPY_SSL_MBEDTLS = 0
Now when enable both MICROPY_PY_USSL and MICROPY_SSL_AXTL I get an error that it can't find ssl.h
but this file is in /lib/axtls/ssl/

If I now enable both MICROPY_PY_USSL and MICROPY_SSL_MBEDTLS I get an error that it can't find version.h
but this file is in /lib/mbedtls/include/mbedtls/

I don't understand the build process but it appears that the files are not being found.

Is there something else required to get this to build properly?

Just found this https://github.com/micropython/micropyt ... untu-16.04 and as I am getting the type of errors mentioned, it seems I might need a newer version of the compiler and a 64 bit Linux box. Correct?

Really appreciate any clues here.

Thanks,
Dave
Last edited by davef on Sat Aug 01, 2020 7:26 am, edited 1 time in total.

User avatar
jimmo
Posts: 1769
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: WeActSTM32F411CEU6 uMail and ussl

Post by jimmo » Fri Jul 31, 2020 1:41 am

The compile errors suggest that you don't have the submodules downloaded

Code: Select all

git submodule update --init lib/mbedtls lib/axtls

davef
Posts: 21
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: WeActSTM32F411CEU6 uMail and ussl

Post by davef » Fri Jul 31, 2020 8:58 am

Hi jimmo,

Thanks for the suggestion. Some probably quite useful things happened when I was able to run that command successfully (while in the micropython-1.12/micropython folder), ie it brought-in stm32lib. As well it asked to sort out mpy-cross.

Doing:

Code: Select all

git submodule status
I get:

Code: Select all

43a6e6bd3bbc03dc501e16b89fba0ef042ed3ea0 lib/axtls (heads/master-38-g43a6e6b)
3f8d78411a26e833db18d9fbde0e2f0baeda87f0 lib/mbedtls (mbedtls-2.17.0)
The errors are still there.

arm-none-eabi-gcc (15:4.9.3+svn231177-1) 4.9.3 20150529 (prerelease)

Cheers,
Dave

davef
Posts: 21
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: WeActSTM32F411CEU6 uMail and ussl

Post by davef » Sat Aug 01, 2020 10:14 am

Started from scratch except this time I made a virtual environment for Micropython, as per the Wiki, but end up getting the same errors.

I found I could get rid of the "files not found" by changing, for example moduhashlib.c:

Code: Select all

#include "mbedtls/version.h"
to

Code: Select all

#include "lib/mbedtls/include/mbedtls/version.h"

but now I get heaps of errors like:

Code: Select all

build-WEACT_F411CEU6/extmod/moduhashlib.o: In function `uhashlib_md5_digest':
moduhashlib.c:(.text.uhashlib_md5_digest+0x12): undefined reference to `mbedtls_md5_finish_ret'
moduhashlib.c:(.text.uhashlib_md5_digest+0x18): undefined reference to `mbedtls_md5_free'
build-WEACT_F411CEU6/extmod/moduhashlib.o: In function `uhashlib_md5_update':
moduhashlib.c:(.text.uhashlib_md5_update+0x14): undefined reference to `mbedtls_md5_update_ret'
Just curious, I thought <xyz.h> and "xyz.h" meant different things to the system.

Returning to the original moduhaslib.c I get the following:

Code: Select all

../../extmod/moduhashlib.c:35:29: fatal error: mbedtls/version.h: No such file or directory
 #include "mbedtls/version.h"

../../extmod/moducryptolib.c:64:25: fatal error: mbedtls/aes.h: No such file or directory
 #include <mbedtls/aes.h>
Xubuntu 14.04TLS and still arm-none-eabi-gcc4.9.3

davef
Posts: 21
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: WeActSTM32F411CEU6 uMail and ussl

Post by davef » Tue Aug 04, 2020 6:45 am

The solution ... after a suggestion by Peter Hinch to look at the mpconfigboard.mk for the PYBD_SF2, I added the following lines to the mpconfigboard.mk for this port:

Code: Select all

MICROPY_PY_USSL = 1
MICROPY_SSL_MBEDTLS = 1

Post Reply