From 109faa113f6243d2712345976b06a1fe01be7979 Mon Sep 17 00:00:00 2001 From: jaenrig-ifx Date: Mon, 23 Mar 2026 09:38:46 +0100 Subject: [PATCH 1/3] lib/mtb-psoc6-libs: Update MTB PSOC6 libs. Signed-off-by: jaenrig-ifx --- lib/mtb-psoc6-libs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mtb-psoc6-libs b/lib/mtb-psoc6-libs index ae6b5d031b5ba..4454ba2184e66 160000 --- a/lib/mtb-psoc6-libs +++ b/lib/mtb-psoc6-libs @@ -1 +1 @@ -Subproject commit ae6b5d031b5ba77052e8a1d1d76a367134bbcf4e +Subproject commit 4454ba2184e662fcd22ef713cd982c2dba0c0ccd From 70412f6ea5ed8577adaa7b522f6c743353bab63d Mon Sep 17 00:00:00 2001 From: jaenrig-ifx Date: Mon, 23 Mar 2026 09:39:58 +0100 Subject: [PATCH 2/3] psoc6: Updated changes on mbedtls extmod. Signed-off-by: jaenrig-ifx --- ports/psoc6/Makefile | 2 +- .../{mbedtls_config.h => mbedtls_config_port.h} | 0 ports/psoc6/mphalport.c | 16 ++++++++++++++++ ports/psoc6/mphalport.h | 3 +++ 4 files changed, 20 insertions(+), 1 deletion(-) rename ports/psoc6/mbedtls/{mbedtls_config.h => mbedtls_config_port.h} (100%) diff --git a/ports/psoc6/Makefile b/ports/psoc6/Makefile index 4cdaafb0af51a..03064e2c407b5 100644 --- a/ports/psoc6/Makefile +++ b/ports/psoc6/Makefile @@ -56,7 +56,7 @@ CFLAGS += -Wno-error=double-promotion -Wno-error=overflow -Wno-error=analyzer-n ifeq ($(MICROPY_PSOC6_SSL_MBEDTLS),1) INC += -I$(TOP)/extmod/mbedtls - CFLAGS += -DMBEDTLS_CONFIG_FILE=\"mbedtls/mbedtls_config.h\" + CFLAGS += -DMBEDTLS_CONFIG_FILE=\"mbedtls/mbedtls_config_port.h\" CFLAGS += -DMICROPY_SSL_MBEDTLS=1 endif diff --git a/ports/psoc6/mbedtls/mbedtls_config.h b/ports/psoc6/mbedtls/mbedtls_config_port.h similarity index 100% rename from ports/psoc6/mbedtls/mbedtls_config.h rename to ports/psoc6/mbedtls/mbedtls_config_port.h diff --git a/ports/psoc6/mphalport.c b/ports/psoc6/mphalport.c index 0a9e21432a0f2..1770e87b1436a 100644 --- a/ports/psoc6/mphalport.c +++ b/ports/psoc6/mphalport.c @@ -174,3 +174,19 @@ void mp_hal_pin_input(mp_hal_pin_obj_t pin) { mp_hal_pin_obj_t mp_hal_get_pin_obj(mp_obj_t obj) { return pin_addr_by_name(obj); } + +void mp_hal_get_random(size_t n, uint8_t *buf) { + uint32_t r = 0; + cyhal_trng_t trng_obj; + + cyhal_trng_init(&trng_obj); + + for (int i = 0; i < n; i++) { + if ((i & 3) == 0) { + r = cyhal_trng_generate(&trng_obj); // returns 32-bit hardware random number + } + buf[i] = r; + r >>= 8; + } + cyhal_trng_free(&trng_obj); +} diff --git a/ports/psoc6/mphalport.h b/ports/psoc6/mphalport.h index aaf7d992d7027..f97de397fb34c 100644 --- a/ports/psoc6/mphalport.h +++ b/ports/psoc6/mphalport.h @@ -95,3 +95,6 @@ static inline void mp_hal_pin_config(mp_hal_pin_obj_t pin, uint32_t mode, uint32 // gpio_set_dir(pin, mode); // gpio_set_pulls(pin, pull == MP_HAL_PIN_PULL_UP, pull == MP_HAL_PIN_PULL_DOWN); } + + +void mp_hal_get_random(size_t n, uint8_t *buf); From ce8f10bdf49e415146c58b215bb35a28722c22d5 Mon Sep 17 00:00:00 2001 From: jaenrig-ifx Date: Mon, 23 Mar 2026 10:23:53 +0100 Subject: [PATCH 3/3] lib/mtb-psoc6-libs: Update MTB PSOC6 libs. Signed-off-by: jaenrig-ifx --- lib/mtb-psoc6-libs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mtb-psoc6-libs b/lib/mtb-psoc6-libs index 4454ba2184e66..4d5f7fb645385 160000 --- a/lib/mtb-psoc6-libs +++ b/lib/mtb-psoc6-libs @@ -1 +1 @@ -Subproject commit 4454ba2184e662fcd22ef713cd982c2dba0c0ccd +Subproject commit 4d5f7fb6453854f5690d95a3479f1706a4174dae