From 2e7864d3f5b741d7ccb89a897e43a659977503de Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 16 Jun 2023 17:11:33 +0200 Subject: [PATCH 1/2] C33: disable nano.specs --- boards.txt | 6 +++--- platform.txt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/boards.txt b/boards.txt index af1c7de2..faf4cdb8 100644 --- a/boards.txt +++ b/boards.txt @@ -77,7 +77,7 @@ minima.compiler.fsp.cxxflags=-mthumb "@{compiler.fsp.defines}" minima.compiler.tinyusb.cflags=-DCFG_TUSB_MCU=OPT_MCU_RAXXX minima.compiler.tinyusb.cxxflags=-DCFG_TUSB_MCU=OPT_MCU_RAXXX minima.compiler.fsp.includes={build.variant.path}/includes.txt -minima.compiler.fsp.extra_ldflags=-lstdc++ -lsupc++ -lm -lc -lgcc -lnosys +minima.compiler.fsp.extra_ldflags=--specs=nano.specs -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys minima.compiler.fsp="{build.variant.path}/libs/libfsp.a" minima.upload.tool=dfu-util @@ -125,7 +125,7 @@ unor4wifi.compiler.fsp.cxxflags=-mthumb "@{compiler.fsp.defines}" unor4wifi.compiler.tinyusb.cflags=-DCFG_TUSB_MCU=OPT_MCU_RAXXX unor4wifi.compiler.tinyusb.cxxflags=-DCFG_TUSB_MCU=OPT_MCU_RAXXX unor4wifi.compiler.fsp.includes={build.variant.path}/includes.txt -unor4wifi.compiler.fsp.extra_ldflags=-lstdc++ -lsupc++ -lm -lc -lgcc -lnosys +unor4wifi.compiler.fsp.extra_ldflags=--specs=nano.specs -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys unor4wifi.compiler.fsp="{build.variant.path}/libs/libfsp.a" unor4wifi.upload.tool=bossac @@ -171,7 +171,7 @@ muxto.compiler.fsp.cxxflags=-mthumb -D_RA_CORE=CM23 -D_RENESAS_RA_ muxto.compiler.tinyusb.cflags=-DCFG_TUSB_MCU=OPT_MCU_RAXXX muxto.compiler.tinyusb.cxxflags=-DCFG_TUSB_MCU=OPT_MCU_RAXXX muxto.compiler.fsp.includes={build.variant.path}/includes.txt -muxto.compiler.fsp.extra_ldflags=-lstdc++ -lsupc++ -lm -lc -lgcc -lnosys +muxto.compiler.fsp.extra_ldflags=--specs=nano.specs -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys muxto.compiler.fsp="{build.variant.path}/libs/libfsp.a" muxto.upload.tool=dfu-util diff --git a/platform.txt b/platform.txt index 6a5a4ad0..f8ab41fb 100644 --- a/platform.txt +++ b/platform.txt @@ -16,13 +16,13 @@ compiler.warning_flags.all=-Wall -Wextra compiler.path={build.compiler_path} compiler.c.cmd={build.crossprefix}gcc -compiler.c.flags=-c {compiler.warning_flags} -Os -g3 --specs=nano.specs -nostdlib {build.defines} -MMD -std=gnu11 -mcpu={build.mcu} {build.float-abi} {build.fpu} -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin +compiler.c.flags=-c {compiler.warning_flags} -Os -g3 -nostdlib {build.defines} -MMD -std=gnu11 -mcpu={build.mcu} {build.float-abi} {build.fpu} -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin compiler.c.elf.cmd={build.crossprefix}g++ -compiler.c.elf.flags=-Wl,--gc-sections --specs=nano.specs --specs=nosys.specs {compiler.warning_flags} -mcpu={build.mcu} {build.float-abi} {build.fpu} +compiler.c.elf.flags=-Wl,--gc-sections --specs=nosys.specs {compiler.warning_flags} -mcpu={build.mcu} {build.float-abi} {build.fpu} compiler.S.cmd={build.crossprefix}g++ compiler.S.flags=-c -g -x assembler-with-cpp -Os -mcpu={build.mcu} {build.float-abi} {build.fpu} -fsigned-char -ffunction-sections -fdata-sections compiler.cpp.cmd={build.crossprefix}g++ -compiler.cpp.flags=-c {compiler.warning_flags} -Os --specs=nano.specs -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -MMD -nostdlib {build.defines} -MMD -std=gnu++17 -mcpu={build.mcu} {build.float-abi} {build.fpu} -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin +compiler.cpp.flags=-c {compiler.warning_flags} -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -MMD -nostdlib {build.defines} -MMD -std=gnu++17 -mcpu={build.mcu} {build.float-abi} {build.fpu} -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin compiler.ar.cmd={build.crossprefix}ar compiler.ar.flags=rcs compiler.ar.extra_flags= From 2390eb2fe48fe53344395f6d08e66ebb147c78a0 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Mon, 19 Jun 2023 08:45:03 +0200 Subject: [PATCH 2/2] c33: weakly implement __cxa_pure_virtual to slim down build --- cores/arduino/main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cores/arduino/main.cpp b/cores/arduino/main.cpp index 5cce9e74..e600614e 100644 --- a/cores/arduino/main.cpp +++ b/cores/arduino/main.cpp @@ -134,3 +134,12 @@ extern "C" { //Declared weak in Arduino.h to allow user redefinitions. int atexit(void (*func)()) { return 0; } + +namespace __gnu_cxx { + void __verbose_terminate_handler() { } +} +extern "C" __attribute__((weak)) void __cxa_pure_virtual(void); +extern "C" __attribute__((weak)) void __cxa_pure_virtual(void) +{ + exit(1); +} \ No newline at end of file