diff --git a/arch/stm32/stm32.ini b/arch/stm32/stm32.ini
index 8b7d256b3..7732533c9 100644
--- a/arch/stm32/stm32.ini
+++ b/arch/stm32/stm32.ini
@@ -37,6 +37,9 @@ build_flags =
-DRADIOLIB_EXCLUDE_LR11X0=1
-DHAL_DAC_MODULE_ONLY
-DHAL_RNG_MODULE_ENABLED
+ -Wl,--wrap=__assert_func
+ -Wl,--wrap=strerror
+ -Wl,--wrap=_tzset_unlocked_r
build_src_filter =
${arduino_base.build_src_filter} - - - - - - - - - - - - - -
diff --git a/src/platform/stm32wl/main-stm32wl.cpp b/src/platform/stm32wl/main-stm32wl.cpp
index 3eddbb3cf..e841f8f29 100644
--- a/src/platform/stm32wl/main-stm32wl.cpp
+++ b/src/platform/stm32wl/main-stm32wl.cpp
@@ -26,3 +26,31 @@ void getMacAddr(uint8_t *dmac)
}
void cpuDeepSleep(uint32_t msecToWake) {}
+
+// Hacks to force more code and data out.
+
+// By default __assert_func uses fiprintf which pulls in stdio.
+extern "C" void __wrap___assert_func(const char *, int, const char *, const char *)
+{
+ while (true)
+ ;
+ return;
+}
+
+// By default strerror has a lot of strings we probably don't use. Make it return an empty string instead.
+char empty = 0;
+extern "C" char *__wrap_strerror(int)
+{
+ return ∅
+}
+
+#ifdef MESHTASTIC_EXCLUDE_TZ
+struct _reent;
+
+// Even if you don't use timezones, mktime will try to set the timezone anyway with _tzset_unlocked(), which pulls in scanf and
+// friends. The timezone is initialized to UTC by default.
+extern "C" void __wrap__tzset_unlocked_r(struct _reent *reent_ptr)
+{
+ return;
+}
+#endif
\ No newline at end of file