Ok, I've managed to solve the problem by myself, but thanks anyway. It seems that those 128k additional flash memory in the Pico do not exist in the STM32F4Discovery, but I found some usable flash in the last two sectors, by changing the the first line in your example to:
var addr = (process.memory().flash_start + process.memory().flash_length-(2*2047))&~2047;
Now mbedtls understands the certificates, but still fails with Not enough memory during handshake phase:
>reset();
=undefined
_____ _
| __|___ ___ ___ _ _|_|___ ___
| __|_ -| . | _| | | | | . |
|_____|___| _|_| |___|_|_|_|___|
|_| http://espruino.com
1v84.238 Copyright 2016 G.Williams
>echo(0);
=undefined
Connecting to WiFi
192.168.0.29
Connecting to Google
Connecting with TLS...
Loading the CA root certificate...
Loading the Client certificate...
Loading the Client Key...
Performing the SSL/TLS handshake...
ERROR: Failed! mbedtls_ssl_handshake returned Not enough memory
ERROR: Failed! mbedtls_ssl_handshake returned -0x6d00
Connecting to Google
Connecting with TLS...
Loading the CA root certificate...
Loading the Client certificate...
Loading the Client Key...
Performing the SSL/TLS handshake...
ERROR: Failed! mbedtls_ssl_handshake returned -0x3b10
ERROR: Failed! mbedtls_ssl_handshake returned -0x4290
Connecting to Google
Connecting with TLS...
Loading the CA root certificate...
Loading the Client certificate...
Loading the Client Key...
Performing the SSL/TLS handshake...
ERROR: Failed! mbedtls_ssl_handshake returned -0x3b10
ERROR: Failed! mbedtls_ssl_handshake returned -0x4290
Connecting to Google
Connecting with TLS...
Loading the CA root certificate...
Loading the Client certificate...
Loading the Client Key...
Performing the SSL/TLS handshake...
ERROR: Failed! mbedtls_ssl_handshake returned -0x3b10
ERROR: Failed! mbedtls_ssl_handshake returned -0x4290
Connecting to Google
Connecting with TLS...
Loading the CA root certificate...
Loading the Client certificate...
Loading the Client Key...
Performing the SSL/TLS handshake...
ERROR: Failed! mbedtls_ssl_handshake returned -0x3b10
ERROR: Failed! mbedtls_ssl_handshake returned -0x4290
I also tried to generate my own client certificates, as sugested to profra, but still the same out of memory error.
By the way, I'm using ESP8266 as my network interface. Any idea on how to get it to work?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Ok, I've managed to solve the problem by myself, but thanks anyway. It seems that those 128k additional flash memory in the Pico do not exist in the STM32F4Discovery, but I found some usable flash in the last two sectors, by changing the the first line in your example to:
Now mbedtls understands the certificates, but still fails with Not enough memory during handshake phase:
I also tried to generate my own client certificates, as sugested to profra, but still the same out of memory error.
By the way, I'm using ESP8266 as my network interface. Any idea on how to get it to work?