From c31f8d5014f3ec2065ceb66eb1803989d87b457d Mon Sep 17 00:00:00 2001 From: Martin Jaeger <17674105+martinjaeger@users.noreply.github.com> Date: Wed, 5 Feb 2020 17:28:30 +0100 Subject: [PATCH] Fix PlatformIO debug error in ext.cpp Without this dummy implementation of std::__throw_bad_alloc() the linker was throwing errors. --- platformio.ini | 2 +- src/ext/ext.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 7ef14d5..07dd907 100644 --- a/platformio.ini +++ b/platformio.ini @@ -42,7 +42,7 @@ framework = mbed upload_protocol = stlink #upload_protocol = jlink -debug_tool = jlink +#debug_tool = jlink # Custom upload tools (overwrites upload_protocol) #upload_command = st-flash write $SOURCE 0x8000000 diff --git a/src/ext/ext.cpp b/src/ext/ext.cpp index 4efdbce..3326682 100644 --- a/src/ext/ext.cpp +++ b/src/ext/ext.cpp @@ -8,6 +8,11 @@ #include +// necessary for PlatformIO debug session +void std::__throw_bad_alloc() { + while (1) {} +} + // we use code to self register objects at construction time. // It relies on the fact that initially this pointer will be initialized // with NULL ! This is only true for global variables or static members of classes