[AVR] Fix $(ELFSIZE) in Makefiles Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
User avatar
teknoman117
Posts: 8
Joined: Tue Aug 19, 2025 1:00 am

[AVR] Fix $(ELFSIZE) in Makefiles  Topic is solved

Postby teknoman117 » Sat Aug 23, 2025 3:39 am

Binutils 2.26 (released in 2016) removed support for the "--mcu=$(MCU) --format=avr" options from the avr-size command.

Here's a patch to remove those options from the definition of ELFSIZE for AVR demos and tests.

Code: Select all

From 998d169f4436a5da3510f2d6a12d9ba7d25ca120 Mon Sep 17 00:00:00 2001
From: Nathan Lewis <git@nrlewis.dev>
Date: Fri, 22 Aug 2025 19:17:16 -0700
Subject: [PATCH 1/2] AVR: remove "--mcu=$(MCU) --format=avr" from ELFSIZE.
 These options were removed in binutils 2.26.

---
 demos/AVR/NIL-ARDUINO-MEGA/Makefile                   | 2 +-
 demos/AVR/NIL-ARDUINO-MINI/Makefile                   | 2 +-
 demos/AVR/NIL-ARDUINO-NANO/Makefile                   | 2 +-
 demos/AVR/NIL-ARDUINO-UNO/Makefile                    | 2 +-
 demos/AVR/NIL-DIGISPARK-ATTINY-167/Makefile           | 2 +-
 demos/AVR/NIL-MT-DB-X4/Makefile                       | 2 +-
 demos/AVR/RT-ARDUINO-LEONARDO/Makefile                | 2 +-
 demos/AVR/RT-ARDUINO-MEGA/Makefile                    | 2 +-
 demos/AVR/RT-ARDUINO-MINI/Makefile                    | 2 +-
 demos/AVR/RT-ARDUINO-NANO/Makefile                    | 2 +-
 demos/AVR/RT-ARDUINO-UNO-G++/Makefile                 | 2 +-
 demos/AVR/RT-ARDUINO-UNO/Makefile                     | 2 +-
 demos/AVR/RT-DIGISPARK-ATTINY-167/Makefile            | 2 +-
 demos/AVR/RT-MT-DB-X4/Makefile                        | 2 +-
 demos/AVR/RT-PRO-MICRO/Makefile                       | 2 +-
 demos/AVR/RT-TEENSY2-USB/Makefile                     | 2 +-
 demos/AVR/TEST-SUITE-NIL/Makefile                     | 2 +-
 demos/AVR/TEST-SUITE-OSLIB/Makefile                   | 2 +-
 demos/AVR/TEST-SUITE-RT/Makefile                      | 2 +-
 testhal/AVR/MEGA/ADC/Makefile                         | 2 +-
 testhal/AVR/MEGA/GPT/Makefile                         | 2 +-
 testhal/AVR/MEGA/I2C/Makefile                         | 2 +-
 testhal/AVR/MEGA/ICU/Makefile                         | 2 +-
 testhal/AVR/MEGA/PWM/Makefile                         | 2 +-
 testhal/AVR/MEGA/SPI/Makefile                         | 2 +-
 testhal/AVR/XMEGA/CRC/Makefile                        | 2 +-
 testhal/AVR/XMEGA/CRYPTO/Makefile                     | 2 +-
 testhal/AVR/XMEGA/SERIAL/Makefile                     | 2 +-
 testhal/AVR/XMEGA/SPI/Makefile                        | 2 +-
 testhal/AVR/XMEGA/TEST-SUITE-OSLIB/Makefile           | 2 +-
 testhal/AVR/XMEGA/USART/Makefile                      | 2 +-
 testhal/AVR/XMEGA/WDT/Makefile                        | 2 +-
 testhal/AVR/multi/PAL/make/Makefile-arduino_mega.make | 2 +-
 testhal/AVR/multi/PAL/make/Makefile-arduino_mini.make | 2 +-
 testhal/AVR/multi/PAL/make/Makefile-arduino_nano.make | 2 +-
 testhal/AVR/multi/PAL/make/Makefile-arduino_uno.make  | 2 +-
 36 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/demos/AVR/NIL-ARDUINO-MEGA/Makefile b/demos/AVR/NIL-ARDUINO-MEGA/Makefile
index d3f940a96..60060e943 100644
--- a/demos/AVR/NIL-ARDUINO-MEGA/Makefile
+++ b/demos/AVR/NIL-ARDUINO-MEGA/Makefile
@@ -157,7 +157,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/NIL-ARDUINO-MINI/Makefile b/demos/AVR/NIL-ARDUINO-MINI/Makefile
index ffe6b026b..324dadc8f 100644
--- a/demos/AVR/NIL-ARDUINO-MINI/Makefile
+++ b/demos/AVR/NIL-ARDUINO-MINI/Makefile
@@ -157,7 +157,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/NIL-ARDUINO-NANO/Makefile b/demos/AVR/NIL-ARDUINO-NANO/Makefile
index b35fdecd3..ea780153a 100644
--- a/demos/AVR/NIL-ARDUINO-NANO/Makefile
+++ b/demos/AVR/NIL-ARDUINO-NANO/Makefile
@@ -157,7 +157,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/NIL-ARDUINO-UNO/Makefile b/demos/AVR/NIL-ARDUINO-UNO/Makefile
index 30615ca40..de9e23e2f 100644
--- a/demos/AVR/NIL-ARDUINO-UNO/Makefile
+++ b/demos/AVR/NIL-ARDUINO-UNO/Makefile
@@ -157,7 +157,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/NIL-DIGISPARK-ATTINY-167/Makefile b/demos/AVR/NIL-DIGISPARK-ATTINY-167/Makefile
index 08d8e1c13..ab767b847 100644
--- a/demos/AVR/NIL-DIGISPARK-ATTINY-167/Makefile
+++ b/demos/AVR/NIL-DIGISPARK-ATTINY-167/Makefile
@@ -157,7 +157,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/NIL-MT-DB-X4/Makefile b/demos/AVR/NIL-MT-DB-X4/Makefile
index f745a7242..b3d82a86b 100644
--- a/demos/AVR/NIL-MT-DB-X4/Makefile
+++ b/demos/AVR/NIL-MT-DB-X4/Makefile
@@ -157,7 +157,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/RT-ARDUINO-LEONARDO/Makefile b/demos/AVR/RT-ARDUINO-LEONARDO/Makefile
index 84e9ccb17..ee2f9b38d 100644
--- a/demos/AVR/RT-ARDUINO-LEONARDO/Makefile
+++ b/demos/AVR/RT-ARDUINO-LEONARDO/Makefile
@@ -158,7 +158,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/RT-ARDUINO-MEGA/Makefile b/demos/AVR/RT-ARDUINO-MEGA/Makefile
index c78e08e1e..07dcf183c 100644
--- a/demos/AVR/RT-ARDUINO-MEGA/Makefile
+++ b/demos/AVR/RT-ARDUINO-MEGA/Makefile
@@ -157,7 +157,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/RT-ARDUINO-MINI/Makefile b/demos/AVR/RT-ARDUINO-MINI/Makefile
index d3d73de3c..68514e9d0 100644
--- a/demos/AVR/RT-ARDUINO-MINI/Makefile
+++ b/demos/AVR/RT-ARDUINO-MINI/Makefile
@@ -157,7 +157,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/RT-ARDUINO-NANO/Makefile b/demos/AVR/RT-ARDUINO-NANO/Makefile
index 11ea23ed1..cd3661a22 100644
--- a/demos/AVR/RT-ARDUINO-NANO/Makefile
+++ b/demos/AVR/RT-ARDUINO-NANO/Makefile
@@ -157,7 +157,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/RT-ARDUINO-UNO-G++/Makefile b/demos/AVR/RT-ARDUINO-UNO-G++/Makefile
index 67ba41f46..a6c40e8a1 100644
--- a/demos/AVR/RT-ARDUINO-UNO-G++/Makefile
+++ b/demos/AVR/RT-ARDUINO-UNO-G++/Makefile
@@ -158,7 +158,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/RT-ARDUINO-UNO/Makefile b/demos/AVR/RT-ARDUINO-UNO/Makefile
index ee4b448b7..abb067358 100644
--- a/demos/AVR/RT-ARDUINO-UNO/Makefile
+++ b/demos/AVR/RT-ARDUINO-UNO/Makefile
@@ -157,7 +157,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/RT-DIGISPARK-ATTINY-167/Makefile b/demos/AVR/RT-DIGISPARK-ATTINY-167/Makefile
index 6afbee426..d0c344313 100644
--- a/demos/AVR/RT-DIGISPARK-ATTINY-167/Makefile
+++ b/demos/AVR/RT-DIGISPARK-ATTINY-167/Makefile
@@ -157,7 +157,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/RT-MT-DB-X4/Makefile b/demos/AVR/RT-MT-DB-X4/Makefile
index 4cdafadbb..be09e027c 100644
--- a/demos/AVR/RT-MT-DB-X4/Makefile
+++ b/demos/AVR/RT-MT-DB-X4/Makefile
@@ -157,7 +157,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/RT-PRO-MICRO/Makefile b/demos/AVR/RT-PRO-MICRO/Makefile
index f50f328e0..f197ce004 100644
--- a/demos/AVR/RT-PRO-MICRO/Makefile
+++ b/demos/AVR/RT-PRO-MICRO/Makefile
@@ -158,7 +158,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/RT-TEENSY2-USB/Makefile b/demos/AVR/RT-TEENSY2-USB/Makefile
index a3e1137aa..ecc765484 100644
--- a/demos/AVR/RT-TEENSY2-USB/Makefile
+++ b/demos/AVR/RT-TEENSY2-USB/Makefile
@@ -162,7 +162,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/TEST-SUITE-NIL/Makefile b/demos/AVR/TEST-SUITE-NIL/Makefile
index 2ed10373c..bc8018d01 100644
--- a/demos/AVR/TEST-SUITE-NIL/Makefile
+++ b/demos/AVR/TEST-SUITE-NIL/Makefile
@@ -162,7 +162,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/TEST-SUITE-OSLIB/Makefile b/demos/AVR/TEST-SUITE-OSLIB/Makefile
index 1281a1c61..1966849b3 100644
--- a/demos/AVR/TEST-SUITE-OSLIB/Makefile
+++ b/demos/AVR/TEST-SUITE-OSLIB/Makefile
@@ -162,7 +162,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/demos/AVR/TEST-SUITE-RT/Makefile b/demos/AVR/TEST-SUITE-RT/Makefile
index c28bf3f1a..77174f5b2 100644
--- a/demos/AVR/TEST-SUITE-RT/Makefile
+++ b/demos/AVR/TEST-SUITE-RT/Makefile
@@ -162,7 +162,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/testhal/AVR/MEGA/ADC/Makefile b/testhal/AVR/MEGA/ADC/Makefile
index df2169daf..d94121a0c 100644
--- a/testhal/AVR/MEGA/ADC/Makefile
+++ b/testhal/AVR/MEGA/ADC/Makefile
@@ -160,7 +160,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/testhal/AVR/MEGA/GPT/Makefile b/testhal/AVR/MEGA/GPT/Makefile
index a2b04f709..535e08837 100644
--- a/testhal/AVR/MEGA/GPT/Makefile
+++ b/testhal/AVR/MEGA/GPT/Makefile
@@ -160,7 +160,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/testhal/AVR/MEGA/I2C/Makefile b/testhal/AVR/MEGA/I2C/Makefile
index a2b04f709..535e08837 100644
--- a/testhal/AVR/MEGA/I2C/Makefile
+++ b/testhal/AVR/MEGA/I2C/Makefile
@@ -160,7 +160,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/testhal/AVR/MEGA/ICU/Makefile b/testhal/AVR/MEGA/ICU/Makefile
index a2b04f709..535e08837 100644
--- a/testhal/AVR/MEGA/ICU/Makefile
+++ b/testhal/AVR/MEGA/ICU/Makefile
@@ -160,7 +160,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/testhal/AVR/MEGA/PWM/Makefile b/testhal/AVR/MEGA/PWM/Makefile
index a2b04f709..535e08837 100644
--- a/testhal/AVR/MEGA/PWM/Makefile
+++ b/testhal/AVR/MEGA/PWM/Makefile
@@ -160,7 +160,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/testhal/AVR/MEGA/SPI/Makefile b/testhal/AVR/MEGA/SPI/Makefile
index a2b04f709..535e08837 100644
--- a/testhal/AVR/MEGA/SPI/Makefile
+++ b/testhal/AVR/MEGA/SPI/Makefile
@@ -160,7 +160,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/testhal/AVR/XMEGA/CRC/Makefile b/testhal/AVR/XMEGA/CRC/Makefile
index 9da0c326a..ebbcb92e7 100644
--- a/testhal/AVR/XMEGA/CRC/Makefile
+++ b/testhal/AVR/XMEGA/CRC/Makefile
@@ -162,7 +162,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/testhal/AVR/XMEGA/CRYPTO/Makefile b/testhal/AVR/XMEGA/CRYPTO/Makefile
index 8d991b118..90c8c05c2 100644
--- a/testhal/AVR/XMEGA/CRYPTO/Makefile
+++ b/testhal/AVR/XMEGA/CRYPTO/Makefile
@@ -161,7 +161,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/testhal/AVR/XMEGA/SERIAL/Makefile b/testhal/AVR/XMEGA/SERIAL/Makefile
index 8d991b118..90c8c05c2 100644
--- a/testhal/AVR/XMEGA/SERIAL/Makefile
+++ b/testhal/AVR/XMEGA/SERIAL/Makefile
@@ -161,7 +161,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/testhal/AVR/XMEGA/SPI/Makefile b/testhal/AVR/XMEGA/SPI/Makefile
index 8d991b118..90c8c05c2 100644
--- a/testhal/AVR/XMEGA/SPI/Makefile
+++ b/testhal/AVR/XMEGA/SPI/Makefile
@@ -161,7 +161,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/testhal/AVR/XMEGA/TEST-SUITE-OSLIB/Makefile b/testhal/AVR/XMEGA/TEST-SUITE-OSLIB/Makefile
index 5205d6135..63cca7670 100644
--- a/testhal/AVR/XMEGA/TEST-SUITE-OSLIB/Makefile
+++ b/testhal/AVR/XMEGA/TEST-SUITE-OSLIB/Makefile
@@ -163,7 +163,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/testhal/AVR/XMEGA/USART/Makefile b/testhal/AVR/XMEGA/USART/Makefile
index fa04f05b7..94b4481cc 100644
--- a/testhal/AVR/XMEGA/USART/Makefile
+++ b/testhal/AVR/XMEGA/USART/Makefile
@@ -157,7 +157,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/testhal/AVR/XMEGA/WDT/Makefile b/testhal/AVR/XMEGA/WDT/Makefile
index 16786366b..ccc69f2ae 100644
--- a/testhal/AVR/XMEGA/WDT/Makefile
+++ b/testhal/AVR/XMEGA/WDT/Makefile
@@ -160,7 +160,7 @@ HEX   = $(CP) -O ihex
 BIN   = $(CP) -O binary
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/testhal/AVR/multi/PAL/make/Makefile-arduino_mega.make b/testhal/AVR/multi/PAL/make/Makefile-arduino_mega.make
index 41e9dcf82..ec9d6d239 100644
--- a/testhal/AVR/multi/PAL/make/Makefile-arduino_mega.make
+++ b/testhal/AVR/multi/PAL/make/Makefile-arduino_mega.make
@@ -146,7 +146,7 @@ BIN   = $(CP) -O binary
 AVRDUDE = avrdude
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/testhal/AVR/multi/PAL/make/Makefile-arduino_mini.make b/testhal/AVR/multi/PAL/make/Makefile-arduino_mini.make
index 140ce5126..930c86db5 100644
--- a/testhal/AVR/multi/PAL/make/Makefile-arduino_mini.make
+++ b/testhal/AVR/multi/PAL/make/Makefile-arduino_mini.make
@@ -146,7 +146,7 @@ BIN   = $(CP) -O binary
 AVRDUDE = avrdude
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/testhal/AVR/multi/PAL/make/Makefile-arduino_nano.make b/testhal/AVR/multi/PAL/make/Makefile-arduino_nano.make
index 9c3893e2a..3e7a42540 100644
--- a/testhal/AVR/multi/PAL/make/Makefile-arduino_nano.make
+++ b/testhal/AVR/multi/PAL/make/Makefile-arduino_nano.make
@@ -145,7 +145,7 @@ BIN   = $(CP) -O binary
 AVRDUDE = avrdude
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
diff --git a/testhal/AVR/multi/PAL/make/Makefile-arduino_uno.make b/testhal/AVR/multi/PAL/make/Makefile-arduino_uno.make
index 02476b1e5..45557a4b9 100644
--- a/testhal/AVR/multi/PAL/make/Makefile-arduino_uno.make
+++ b/testhal/AVR/multi/PAL/make/Makefile-arduino_uno.make
@@ -146,7 +146,7 @@ BIN   = $(CP) -O binary
 AVRDUDE = avrdude
 
 # Size of the elf binary file.
-ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf
+ELFSIZE = $(SZ) $(BUILDDIR)/$(PROJECT).elf
 
 # MCU specific options here.
 MOPT =
--
2.50.1


However, when building for AVR targets, you so get the size of the resulting ELF file displayed twice

Code: Select all

Linking build/ch.elf
Creating build/ch.hex
Creating build/ch.eep
Creating build/ch.bin
Creating build/ch.lss
Creating build/ch.sym

   text      data       bss       dec       hex   filename
   6584         0       696      7280      1c70   build/ch.elf


   text      data       bss       dec       hex   filename
   6584         0       696      7280      1c70   ./build/ch.elf

Done


This could be fixed with a simple change to the AVR compiler rules, as the rule for %.sym already calls $(SZ) on the resulting elf file.

Code: Select all

From 216f59b871f8e4b8a7e478bea8d8404c1564e739 Mon Sep 17 00:00:00 2001
From: Nathan Lewis <git@nrlewis.dev>
Date: Fri, 22 Aug 2025 19:38:10 -0700
Subject: [PATCH 2/2] AVR: remove duplicate avr-size call

---
 os/common/ports/AVR/compilers/GCC/rules.mk | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/os/common/ports/AVR/compilers/GCC/rules.mk b/os/common/ports/AVR/compilers/GCC/rules.mk
index a14bb0e7b..07433c2ab 100644
--- a/os/common/ports/AVR/compilers/GCC/rules.mk
+++ b/os/common/ports/AVR/compilers/GCC/rules.mk
@@ -260,16 +260,13 @@ ifeq ($(USE_VERBOSE_COMPILE),yes)
    $(NM) -n $< > $@
    $(SZ) $<
    @echo
-   if test -f $(BUILDDIR)/$(PROJECT).elf; then echo; echo $(MSG_SIZE_AFTER); \
-   $(ELFSIZE); 2>/dev/null; echo; fi
    @echo Done
 else
    @echo Creating $@
    @$(NM) -n $< > $@
    @echo
    @$(SZ) $<
-   @if test -f $(BUILDDIR)/$(PROJECT).elf; then echo; echo $(MSG_SIZE_AFTER); \
-   $(ELFSIZE); 2>/dev/null; echo; fi
+   @echo
    @echo Done
 endif
 
--
2.50.1

User avatar
Giovanni
Site Admin
Posts: 14704
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1146 times
Been thanked: 960 times

Re: [AVR] Fix $(ELFSIZE) in Makefiles

Postby Giovanni » Sat Aug 23, 2025 5:08 am

Hi,

Thanks, the AVR maintainer is very busy in RL now, I was about to move all the AVR stuff on the community repository because I cannot maintain it.

Interested in taking it under your wing for a while?

Giovanni

User avatar
teknoman117
Posts: 8
Joined: Tue Aug 19, 2025 1:00 am

Re: [AVR] Fix $(ELFSIZE) in Makefiles

Postby teknoman117 » Sat Aug 23, 2025 6:04 pm

I don't have a ton of time on my hands, but I could take some AVR work under my wing for at least a few months.

My goal was to bring the AVR HAL closer to feature parity with some of the other platforms. My main focus was going to be writing a new EXTI driver that uses the AVR's PCINT pins so that PAL pad events work, and writing a SIO driver so that for custom serial protocols the overhead of the Serial driver can be avoided.

I don't do any AVR professionally, but a few of my personal projects still have Arduinos in them. Admittedly I have been replacing them with RP2040/RP2350 and slowly learning STM32.

I don't have any of the newer parts (XMEGA, megaAVR 0-series, AVR Dx, etc.), but I do have some of the older AVRs in my parts bin (ATmega8, ATmega32, ATmega162, ATmega644, ATmega48, ATmega168P, and a few ATtiny85s), along with the ATmega328P and ATmega2560 based Arduinos (Uno R3, Mega).

I do have an AVR JTAG debugger, so if some nasty bugs come up, it is debuggable.

User avatar
Giovanni
Site Admin
Posts: 14704
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1146 times
Been thanked: 960 times

Re: [AVR] Fix $(ELFSIZE) in Makefiles

Postby Giovanni » Sun Aug 24, 2025 5:12 am

Do you have a sourceforge account? I can enable you to access the repository directly so you can commit all the small fixes required.

Giovanni

User avatar
teknoman117
Posts: 8
Joined: Tue Aug 19, 2025 1:00 am

Re: [AVR] Fix $(ELFSIZE) in Makefiles

Postby teknoman117 » Sun Aug 24, 2025 7:27 am

I went and created a sourceforge account. Same username as here, "teknoman117".

If you want to DM me about maintenance rules / maintainer policy, please do so.

User avatar
Giovanni
Site Admin
Posts: 14704
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1146 times
Been thanked: 960 times

Re: [AVR] Fix $(ELFSIZE) in Makefiles

Postby Giovanni » Sun Aug 24, 2025 8:08 am

Hi,

You should have access to the repository now, do you know subversion?

Few recommendations: operate in your area (AVR), if there is need of changes in shared code then we need to discuss it first, try to not break backward compatibility if possible, look at the style guidelines, complex changes are best done in a branch -> keep the trunk code functional, make changes on both trunk and 21.11.x stable branch, feel free to ask anytime.

You may also join our discord, the other AVR maintainer should still be around but he is more busy with work now, name on discord is "tfateba", you may try to contact him.

BTW, for some reason the integration server Jenkins fails on some AVR demos, perhaps there something wrong with the compiler, in case of errors confirm by compiling locally.

Giovanni

User avatar
teknoman117
Posts: 8
Joined: Tue Aug 19, 2025 1:00 am

Re: [AVR] Fix $(ELFSIZE) in Makefiles

Postby teknoman117 » Sun Aug 24, 2025 7:36 pm

In my 15 years in the tech industry thus far I've never actually had to use subversion =P. I'm sure I'll figure it out pretty quick. I do see that I have access now on Sourceforge.

I just joined the Discord, user "teknoman117" as well. I'll ping the current maintainer and work on contributing the small AVR specific fixes I shared in the forums. Are there any instructions on accessing the Jenkins server / CI logs so that I can see if I can fix the AVR integration tests?

Also, I did read about the GitHub mirrors and how your development is primarily done through SVN on Sourceforge and also posting patchsets in this forum. It looks like PR's are occasionally accepted into the ChibiOS-Contrib repository on GitHub? What are the relationships between the "upstream" on Sourceforge and the main and contrib repos on GitHub?

User avatar
Giovanni
Site Admin
Posts: 14704
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1146 times
Been thanked: 960 times

Re: [AVR] Fix $(ELFSIZE) in Makefiles

Postby Giovanni » Sun Aug 24, 2025 8:09 pm

Actually I think it is simpler than git lol, you need few commands initially: checkout, update, add, revert and commit. On windows I recommend using TortoiseSVN.

Giovanni

User avatar
teknoman117
Posts: 8
Joined: Tue Aug 19, 2025 1:00 am

Re: [AVR] Fix $(ELFSIZE) in Makefiles

Postby teknoman117 » Sun Aug 24, 2025 9:43 pm

Okay, I committed my small patches to trunk, figured I'd ask if you wanted me to push them to stable_21.11.x before I touched it :)

User avatar
Giovanni
Site Admin
Posts: 14704
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1146 times
Been thanked: 960 times

Re: [AVR] Fix $(ELFSIZE) in Makefiles

Postby Giovanni » Mon Aug 25, 2025 6:36 am

Good :-)

Please also update 21.11.x, the HAL should be kept aligned until the 21.11.4 release.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 135 guests