diff --git a/components/micropython/vendor/py/mkrules.cmake b/components/micropython/vendor/py/mkrules.cmake
index 7eb5fcf01837c302373dbb374e66efc69e20106a..ba4c4c1a46828a21d858156f1e31f1a5d6dcbe1b 100644
--- a/components/micropython/vendor/py/mkrules.cmake
+++ b/components/micropython/vendor/py/mkrules.cmake
@@ -42,6 +42,10 @@ foreach(_arg ${MICROPY_CPP_DEF})
     list(APPEND MICROPY_CPP_FLAGS ${_prefix}${_arg})
 endforeach()
 list(APPEND MICROPY_CPP_FLAGS ${MICROPY_CPP_FLAGS_EXTRA})
+foreach(_arg ${CMAKE_C_FLAGS})
+    string(STRIP "${_arg}" _arg_stripped)
+    list(APPEND MICROPY_CPP_FLAGS "${_arg_stripped}")
+endforeach()
 
 find_package(Python3 REQUIRED COMPONENTS Interpreter)