Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ports/rp2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -532,12 +532,22 @@ target_compile_options(${MICROPY_TARGET} PRIVATE
-Wall
-Werror
-g # always include debug information in the ELF

# pico-sdk already passes --specs=nosys.specs to stub out syscall handlers,
# passing nano.specs as well means that newlib-nano libc functions will be used
# (note this is mostly a linker option, but should be passed to the compiler as
# well to add the newlib-nano header to the search path. Currently this happens
# inconsistently as pico-sdk files aren't built with this option.)
--specs=nano.specs
)

target_link_options(${MICROPY_TARGET} PRIVATE
-Wl,--defsym=__micropy_c_heap_size__=${MICROPY_C_HEAP_SIZE}
-Wl,--wrap=runtime_init_clocks
-Wl,--print-memory-usage
-Wl,--cref
# see note about nano.specs, above
--specs=nano.specs
)

if(DEFINED PICO_FLASH_SIZE_BYTES)
Expand Down
1 change: 1 addition & 0 deletions ports/rp2/mbedtls/mbedtls_config_port.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
time_t rp2_rtctime_seconds(time_t *timer);
#define MBEDTLS_PLATFORM_TIME_MACRO rp2_rtctime_seconds
#define MBEDTLS_PLATFORM_MS_TIME_ALT mbedtls_ms_time
#define MBEDTLS_PLATFORM_GMTIME_R_ALT 1

// Set MicroPython-specific options.
#define MICROPY_MBEDTLS_CONFIG_BARE_METAL (1)
Expand Down
9 changes: 9 additions & 0 deletions ports/rp2/mbedtls/mbedtls_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,13 @@ mbedtls_ms_time_t mbedtls_ms_time(void) {
current_ms = rp2_rtctime_seconds(tv) * 1000;
return current_ms;
}

struct tm *mbedtls_platform_gmtime_r(const mbedtls_time_t *tt, struct tm *tm_buf) {
// Default mbedTLS platform implementation calls gmtime() here. This is
// unnecessary as this function signature already matches gmtime_r(), and
// additionally on newlib-nano gmtime() tries to malloc the reent buffer on
// demand - which will fail.
return gmtime_r(tt, tm_buf);
}

#endif
Loading