diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-05-05 18:23:01 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-05-05 18:23:01 +0200 |
commit | 995d50998c42efeaef0095769178ac061e25cf3c (patch) | |
tree | 6f0e4c27ccd3d3d9552760ba41c1a386aecc1a5e /zumo | |
parent | a64f19ad176b83d1a1cd9736dd4e7f468c9ed14d (diff) |
try different compiler flags
Diffstat (limited to 'zumo')
-rw-r--r-- | zumo/makefile | 43 | ||||
-rw-r--r-- | zumo/zumo.mk | 78 |
2 files changed, 77 insertions, 44 deletions
diff --git a/zumo/makefile b/zumo/makefile index c388a28..08c01d7 100644 --- a/zumo/makefile +++ b/zumo/makefile @@ -2,33 +2,58 @@ PORT = /dev/ttyUSB0 C++ = avr-g++ CC = avr-gcc -LD = avr-ld +LD = avr-gcc RM = rm -f MCU = atmega32u4 TARGET = main SRCS += main.cpp -CFLAGS += -mcall-prologues -CFLAGS += -mmcu=$(MCU) -CFLAGS += -Os -CFLAGS += -g -CFLAGS += -Wl,-gc-sections -CFLAGS += -Wl,-relax +C_CPP_FLAGS += -mmcu=$(MCU) +C_CPP_FLAGS += -Wl,-gc-sections +SHARED_FLAGS += -Os + +C_CPP_FLAGS += -mcall-prologues +C_CPP_FLAGS += -g +C_CPP_FLAGS += -Wl,-relax +C_CPP_FLAGS += -MMD +C_CPP_FLAGS += -ffunction-sections +C_CPP_FLAGS += -fdata-sections + +LFLAGS += -flto +LFLAGS += -fuse-linker-plugin +LFLAGS += -lc -lm +# LFLAGS += -L/usr/avr/lib/avr5/ -L/usr/lib/gcc/avr/12.2.0/avr5 -lgcc -lm -lc -latmega32u4 +# LFLAGS += -flto -fuse-linker-plugin -mmcu=atmega32u4 -Wl,--gc-sections -Os -lc -lm + + +CFLAGS += -fno-fat-lto-objects +# CFLAGS += -std=gnu11 + +CPPFLAGS += -fpermissive +CPPFLAGS += -fno-exceptions +CPPFLAGS += -fno-threadsafe-statics +CPPFLAGS += -fno-devirtualize +# CPPFLAGS += -std=gnu++11 + + +LFLAGS += $(SHARED_FLAGS) +CFLAGS += $(C_CPP_FLAGS) $(SHARED_FLAGS) +CPPFLAGS += $(C_CPP_FLAGS) $(SHARED_FLAGS) include zumo.mk OBJS := $(patsubst %.c,%.o, $(SRCS)) OBJS := $(patsubst %.cpp,%.o, $(OBJS)) -MAKEFLAGS += -j4 +MAKEFLAGS += -j .PHONY: all clean flash all: $(TARGET).hex %.o: %.cpp - $(C++) $(CFLAGS) -o $@ -c $< + $(C++) $(CPPFLAGS) -o $@ -c $< %.o: %.c $(CC) $(CFLAGS) -o $@ -c $< diff --git a/zumo/zumo.mk b/zumo/zumo.mk index 3645513..f5ab84b 100644 --- a/zumo/zumo.mk +++ b/zumo/zumo.mk @@ -1,31 +1,39 @@ -CFLAGS += -DF_CPU=16000000 -CFLAGS += -I./lib/zumo-32u4-arduino-library/src -CFLAGS += -I./lib/fastgpio-arduino -CFLAGS += -I./lib/pushbutton-arduino -CFLAGS += -I./lib/usb-pause-arduino -CFLAGS += -I./lib/pololu-buzzer-arduino/src -CFLAGS += -I./lib/pololu-hd44780-arduino -CFLAGS += -I./lib/pololu-menu-arduino/src -CFLAGS += -I./lib/pololu-oled-arduino/src -CFLAGS += -I./lib/ArduinoCore-avr/cores/arduino -CFLAGS += -I./lib/ArduinoCore-avr/libraries/HID/src -CFLAGS += -I./lib/ArduinoCore-avr/libraries/SoftwareSerial/src -CFLAGS += -I./lib/ArduinoCore-avr/libraries/SPI/src -CFLAGS += -I./lib/ArduinoCore-avr/libraries/EEPROM/src -CFLAGS += -I./lib/ArduinoCore-avr/libraries/Wire/src -CFLAGS += -I./lib/ArduinoCore-avr/variants/circuitplay32u4 +C_CPP_FLAGS += -DF_CPU=16000000L +C_CPP_FLAGS += -D__PROG_TYPES_COMPAT__ +C_CPP_FLAGS += -DARDUINO=1819 +C_CPP_FLAGS += -DARDUINO_AVR_LEONARDO +C_CPP_FLAGS += -DARDUINO_ARCH_AVR +C_CPP_FLAGS += -DARDUINO_BOARD='"AVR_LEONARDO"' +C_CPP_FLAGS += -DARDUINO_VARIANT='"leonardo"' +C_CPP_FLAGS += -DUSB_VID=0x2341 +C_CPP_FLAGS += -DUSB_PID=0x8036 +C_CPP_FLAGS += -DUSB_PRODUCT='"Arduino Leonardo"' +C_CPP_FLAGS += -DUSB_MANUFACTURER='"Unknown"' -CFLAGS += -L/usr/avr/lib/avr5/ -L/usr/lib/gcc/avr/12.2.0/avr5 -lgcc -lm -lc -latmega32u4 -LFLAGS += -L/usr/avr/lib/avr5/ -L/usr/lib/gcc/avr/12.2.0/avr5 -lgcc -lm -lc -latmega32u4 +C_CPP_FLAGS += -I./lib/zumo-32u4-arduino-library/src +C_CPP_FLAGS += -I./lib/fastgpio-arduino +C_CPP_FLAGS += -I./lib/pushbutton-arduino +C_CPP_FLAGS += -I./lib/usb-pause-arduino +C_CPP_FLAGS += -I./lib/pololu-buzzer-arduino/src +C_CPP_FLAGS += -I./lib/pololu-hd44780-arduino +C_CPP_FLAGS += -I./lib/pololu-menu-arduino/src +C_CPP_FLAGS += -I./lib/pololu-oled-arduino/src +C_CPP_FLAGS += -I./lib/ArduinoCore-avr/cores/arduino +C_CPP_FLAGS += -I./lib/ArduinoCore-avr/libraries/HID/src +C_CPP_FLAGS += -I./lib/ArduinoCore-avr/libraries/SoftwareSerial/src +C_CPP_FLAGS += -I./lib/ArduinoCore-avr/libraries/SPI/src +C_CPP_FLAGS += -I./lib/ArduinoCore-avr/libraries/EEPROM/src +C_CPP_FLAGS += -I./lib/ArduinoCore-avr/libraries/Wire/src +C_CPP_FLAGS += -I./lib/ArduinoCore-avr/variants/leonardo -LIBS += lib/ArduinoCore-avr/cores/arduino/PluggableUSB.cpp +# LIBS += lib/ArduinoCore-avr/cores/arduino/PluggableUSB.cpp LIBS += lib/ArduinoCore-avr/cores/arduino/CDC.cpp LIBS += lib/ArduinoCore-avr/cores/arduino/HardwareSerial.cpp LIBS += lib/ArduinoCore-avr/cores/arduino/USBCore.cpp -# LIBS += lib/ArduinoCore-avr/cores/arduino/HardwareSerial0.cpp -# LIBS += lib/ArduinoCore-avr/cores/arduino/HardwareSerial1.cpp -# LIBS += lib/ArduinoCore-avr/cores/arduino/HardwareSerial2.cpp -# LIBS += lib/ArduinoCore-avr/cores/arduino/HardwareSerial3.cpp +LIBS += lib/ArduinoCore-avr/cores/arduino/HardwareSerial0.cpp +LIBS += lib/ArduinoCore-avr/cores/arduino/HardwareSerial1.cpp +LIBS += lib/ArduinoCore-avr/cores/arduino/HardwareSerial2.cpp +LIBS += lib/ArduinoCore-avr/cores/arduino/HardwareSerial3.cpp LIBS += lib/ArduinoCore-avr/cores/arduino/IPAddress.cpp LIBS += lib/ArduinoCore-avr/cores/arduino/Print.cpp LIBS += lib/ArduinoCore-avr/cores/arduino/Stream.cpp @@ -34,10 +42,20 @@ LIBS += lib/ArduinoCore-avr/cores/arduino/WString.cpp LIBS += lib/ArduinoCore-avr/cores/arduino/abi.cpp LIBS += lib/ArduinoCore-avr/cores/arduino/main.cpp LIBS += lib/ArduinoCore-avr/cores/arduino/new.cpp -LIBS += lib/ArduinoCore-avr/libraries/HID/src/HID.cpp -LIBS += lib/ArduinoCore-avr/libraries/SPI/src/SPI.cpp +# LIBS += lib/ArduinoCore-avr/libraries/HID/src/HID.cpp +# LIBS += lib/ArduinoCore-avr/libraries/SPI/src/SPI.cpp # LIBS += lib/ArduinoCore-avr/libraries/SoftwareSerial/src/SoftwareSerial.cpp LIBS += lib/ArduinoCore-avr/libraries/Wire/src/Wire.cpp +LIBS += lib/ArduinoCore-avr/cores/arduino/WInterrupts.c +LIBS += lib/ArduinoCore-avr/cores/arduino/hooks.c +LIBS += lib/ArduinoCore-avr/cores/arduino/wiring_shift.c +LIBS += lib/ArduinoCore-avr/cores/arduino/wiring_digital.c +LIBS += lib/ArduinoCore-avr/cores/arduino/wiring_analog.c +LIBS += lib/ArduinoCore-avr/cores/arduino/wiring_pulse.c +LIBS += lib/ArduinoCore-avr/cores/arduino/wiring.c +LIBS += lib/ArduinoCore-avr/cores/arduino/Tone.cpp +# LIBS += lib/ArduinoCore-avr/libraries/Wire/src/utility/twi.c + LIBS += lib/pololu-buzzer-arduino/src/PololuBuzzer.cpp LIBS += lib/pushbutton-arduino/Pushbutton.cpp LIBS += lib/zumo-32u4-arduino-library/src/QTRSensors.cpp @@ -50,16 +68,6 @@ LIBS += lib/usb-pause-arduino/USBPause.cpp LIBS += lib/pololu-hd44780-arduino/PololuHD44780.cpp LIBS += lib/fastgpio-arduino/FastGPIO.cpp LIBS += lib/pololu-oled-arduino/src/font.cpp -# LIBS += lib/ArduinoCore-avr/cores/arduino/Tone.cpp -# LIBS += lib/ArduinoCore-avr/libraries/Wire/src/utility/twi.c - -LIBS += lib/ArduinoCore-avr/cores/arduino/WInterrupts.c -LIBS += lib/ArduinoCore-avr/cores/arduino/hooks.c -LIBS += lib/ArduinoCore-avr/cores/arduino/wiring_shift.c -LIBS += lib/ArduinoCore-avr/cores/arduino/wiring_digital.c -LIBS += lib/ArduinoCore-avr/cores/arduino/wiring_analog.c -# LIBS += lib/ArduinoCore-avr/cores/arduino/wiring_pulse.c -LIBS += lib/ArduinoCore-avr/cores/arduino/wiring.c SRCS += $(LIBS) |