summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt6
-rw-r--r--libcr/coroutine.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0c2a9e5..ce1a942 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,6 +16,12 @@ project(sbc_harness)
pico_sdk_init()
+if ((PICO_PLATFORM STREQUAL "host") AND (NOT PICO_NO_GC_SECTIONS))
+ # On non-host builds, this is done by `pico_standard_link`.
+ add_compile_options(-ffunction-sections -fdata-sections)
+ add_link_options("LINKER:--gc-sections")
+endif()
+
add_compile_options(-Wall -Wextra -Wswitch-enum -Werror)
string(TOUPPER "${CMAKE_BUILD_TYPE}" _upper_cmake_build_type)
diff --git a/libcr/coroutine.c b/libcr/coroutine.c
index 73460b7..708e2ea 100644
--- a/libcr/coroutine.c
+++ b/libcr/coroutine.c
@@ -647,7 +647,7 @@ void coroutine_main(void) {
coroutine_running = 0;
#if CONFIG_COROUTINE_GDB
/* Some pointless call to prevent cr_gdb_readjmp() from
- * getting pruned out of the firmware image. */
+ * getting pruned out by `ld --gc-sections`. */
if (coroutine_table[0].state != CR_NONE)
cr_gdb_readjmp(&coroutine_table[0].env);
#endif