From 482837bf961ef42c6c2d68f8f706e0ab013b439d Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 29 Sep 2020 14:29:01 +0200 Subject: [PATCH 1/2] Link using g++ This ensures some C++-specific symbols, such as `std::_throw_bad_function_call` and probably others, are automatically included in the link, preventing linker errors when using some standard c++ library bits (such as `std::function`). This follows the same change done for SAMD: https://github.com/arduino/ArduinoCore-samd/pull/276 --- platform.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.txt b/platform.txt index 5a330240..904bdfd8 100644 --- a/platform.txt +++ b/platform.txt @@ -20,7 +20,7 @@ compiler.warning_flags.all=-Wall -Wextra compiler.path={runtime.tools.arm-none-eabi-gcc-4.8.3-2014q1.path}/bin/ compiler.c.cmd=arm-none-eabi-gcc compiler.c.flags=-c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf -MMD -compiler.c.elf.cmd=arm-none-eabi-gcc +compiler.c.elf.cmd=arm-none-eabi-g++ compiler.c.elf.flags=-Os -Wl,--gc-sections compiler.S.cmd=arm-none-eabi-gcc compiler.S.flags=-c -g -x assembler-with-cpp -MMD From 959950feade6a2926024236b36f4d3ae9de9f0bc Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 29 Sep 2020 14:53:48 +0200 Subject: [PATCH 2/2] Remove override printf define from c receipe This define would serve to use the integer-only version of printf rather than the default. In commit 46470a9 (Remove override printf define from cpp receipe), this was removed from the cpp recipe, probably because this define could cause problems in C++ code and because the Due has plenty of memory for this. However, this same override was still present in the c recipe, so this introduced an inconsistency between .c and .cpp files, where they would end up getting different versions of printf. This commit fixes this by also removing the override for .c files. --- platform.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.txt b/platform.txt index 904bdfd8..e59ea74b 100644 --- a/platform.txt +++ b/platform.txt @@ -19,7 +19,7 @@ compiler.warning_flags.all=-Wall -Wextra compiler.path={runtime.tools.arm-none-eabi-gcc-4.8.3-2014q1.path}/bin/ compiler.c.cmd=arm-none-eabi-gcc -compiler.c.flags=-c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -Dprintf=iprintf -MMD +compiler.c.flags=-c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD compiler.c.elf.cmd=arm-none-eabi-g++ compiler.c.elf.flags=-Os -Wl,--gc-sections compiler.S.cmd=arm-none-eabi-gcc