diff --git a/cyassl/ctaocrypt/settings.h b/cyassl/ctaocrypt/settings.h index 36141a6bc..89c7abd33 100644 --- a/cyassl/ctaocrypt/settings.h +++ b/cyassl/ctaocrypt/settings.h @@ -93,6 +93,12 @@ /* Uncomment next line if using TI-RTOS settings */ /* #define CYASSL_TIRTOS */ +/* Uncomment next line if building with PicoTCP */ +/* #define CYASSL_PICOTCP */ + +/* Uncomment next line if building for PicoTCP demo bundle */ +/* #define CYASSL_PICOTCP_DEMO */ + #include #ifdef IPHONE @@ -228,6 +234,24 @@ #define NO_MAIN_DRIVER #endif +#ifdef CYASSL_PICOTCP + #define errno pico_err + #include "pico_defines.h" + #include "pico_stack.h" + #include "pico_constants.h" + #include "pico_bsd_sockets.h" + #define CUSTOM_RAND_GENERATE pico_rand +#endif + +#ifdef CYASSL_PICOTCP_DEMO + #define CYASSL_STM32 + #define FREERTOS + #define USE_FAST_MATH + #define TFM_TIMING_RESISTANT + #define XMALLOC(s, h, type) pvPortMalloc((s)) + #define XFREE(p, h, type) vPortFree((p)) +#endif + #ifdef FREERTOS_WINSIM #define FREERTOS #define USE_WINDOWS_API diff --git a/src/io.c b/src/io.c index 10e18fb17..d0645875c 100644 --- a/src/io.c +++ b/src/io.c @@ -80,7 +80,8 @@ #include #endif #include - #if !(defined(DEVKITPRO) || defined(HAVE_RTP_SYS) || defined(EBSNET)) + #if !(defined(DEVKITPRO) || defined(HAVE_RTP_SYS) || defined(EBSNET)) \ + || defined(CYASSL_PICOTCP) #include #include #include @@ -153,6 +154,14 @@ #define SOCKET_ECONNREFUSED SCK_ERROR #define SOCKET_ECONNABORTED SCK_ERROR #endif +#elif defined(CYASSL_PICOTCP) + #define SOCKET_EWOULDBLOCK PICO_ERR_EAGAIN + #define SOCKET_EAGAIN PICO_ERR_EAGAIN + #define SOCKET_ECONNRESET PICO_ERR_ECONNRESET + #define SOCKET_EINTR PICO_ERR_EINTR + #define SOCKET_EPIPE PICO_ERR_EIO + #define SOCKET_ECONNREFUSED PICO_ERR_ECONNREFUSED + #define SOCKET_ECONNABORTED PICO_ERR_ESHUTDOWN #else #define SOCKET_EWOULDBLOCK EWOULDBLOCK #define SOCKET_EAGAIN EAGAIN @@ -173,6 +182,9 @@ #elif defined(CYASSL_LWIP) #define SEND_FUNCTION lwip_send #define RECV_FUNCTION lwip_recv +#elif defined(CYASSL_PICOTCP) + #define SEND_FUNCTION pico_send + #define RECV_FUNCTION pico_recv #else #define SEND_FUNCTION send #define RECV_FUNCTION recv