Skip to content

Commit

Permalink
specs: Add option to print memory usage
Browse files Browse the repository at this point in the history
  • Loading branch information
hankertrix committed Sep 3, 2024
1 parent fb72a14 commit c222e69
Show file tree
Hide file tree
Showing 17 changed files with 65 additions and 32 deletions.
6 changes: 4 additions & 2 deletions avr-specs/avr-atmega1280.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"no-default-libraries": false,
"pre-link-args": {
"gnu-cc": [
"-mmcu=atmega1280"
"-mmcu=atmega1280",
"-Wl,--as-needed,--print-memory-usage"
],
"gnu-lld-cc": [
"-mmcu=atmega1280"
"-mmcu=atmega1280",
"-Wl,--as-needed,--print-memory-usage"
]
},
"relocation-model": "static",
Expand Down
6 changes: 4 additions & 2 deletions avr-specs/avr-atmega1284p.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"no-default-libraries": false,
"pre-link-args": {
"gnu-cc": [
"-mmcu=atmega1284p"
"-mmcu=atmega1284p",
"-Wl,--as-needed,--print-memory-usage"
],
"gnu-lld-cc": [
"-mmcu=atmega1284p"
"-mmcu=atmega1284p",
"-Wl,--as-needed,--print-memory-usage"
]
},
"relocation-model": "static",
Expand Down
6 changes: 4 additions & 2 deletions avr-specs/avr-atmega128a.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"no-default-libraries": false,
"pre-link-args": {
"gnu-cc": [
"-mmcu=atmega128a"
"-mmcu=atmega128a",
"-Wl,--as-needed,--print-memory-usage"
],
"gnu-lld-cc": [
"-mmcu=atmega128a"
"-mmcu=atmega128a",
"-Wl,--as-needed,--print-memory-usage"
]
},
"relocation-model": "static",
Expand Down
6 changes: 4 additions & 2 deletions avr-specs/avr-atmega164pa.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"no-default-libraries": false,
"pre-link-args": {
"gnu-cc": [
"-mmcu=atmega164pa"
"-mmcu=atmega164pa",
"-Wl,--as-needed,--print-memory-usage"
],
"gnu-lld-cc": [
"-mmcu=atmega164pa"
"-mmcu=atmega164pa",
"-Wl,--as-needed,--print-memory-usage"
]
},
"relocation-model": "static",
Expand Down
6 changes: 4 additions & 2 deletions avr-specs/avr-atmega168.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"no-default-libraries": false,
"pre-link-args": {
"gnu-cc": [
"-mmcu=atmega168"
"-mmcu=atmega168",
"-Wl,--as-needed,--print-memory-usage"
],
"gnu-lld-cc": [
"-mmcu=atmega168"
"-mmcu=atmega168",
"-Wl,--as-needed,--print-memory-usage"
]
},
"relocation-model": "static",
Expand Down
6 changes: 4 additions & 2 deletions avr-specs/avr-atmega2560.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"no-default-libraries": false,
"pre-link-args": {
"gnu-cc": [
"-mmcu=atmega2560"
"-mmcu=atmega2560",
"-Wl,--as-needed,--print-memory-usage"
],
"gnu-lld-cc": [
"-mmcu=atmega2560"
"-mmcu=atmega2560",
"-Wl,--as-needed,--print-memory-usage"
]
},
"relocation-model": "static",
Expand Down
6 changes: 4 additions & 2 deletions avr-specs/avr-atmega328.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"no-default-libraries": false,
"pre-link-args": {
"gnu-cc": [
"-mmcu=atmega328"
"-mmcu=atmega328",
"-Wl,--as-needed,--print-memory-usage"
],
"gnu-lld-cc": [
"-mmcu=atmega328"
"-mmcu=atmega328",
"-Wl,--as-needed,--print-memory-usage"
]
},
"relocation-model": "static",
Expand Down
6 changes: 4 additions & 2 deletions avr-specs/avr-atmega328p.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"no-default-libraries": false,
"pre-link-args": {
"gnu-cc": [
"-mmcu=atmega328p"
"-mmcu=atmega328p",
"-Wl,--as-needed,--print-memory-usage"
],
"gnu-lld-cc": [
"-mmcu=atmega328p"
"-mmcu=atmega328p",
"-Wl,--as-needed,--print-memory-usage"
]
},
"relocation-model": "static",
Expand Down
6 changes: 4 additions & 2 deletions avr-specs/avr-atmega32a.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"no-default-libraries": false,
"pre-link-args": {
"gnu-cc": [
"-mmcu=atmega32a"
"-mmcu=atmega32a",
"-Wl,--as-needed,--print-memory-usage"
],
"gnu-lld-cc": [
"-mmcu=atmega32a"
"-mmcu=atmega32a",
"-Wl,--as-needed,--print-memory-usage"
]
},
"relocation-model": "static",
Expand Down
6 changes: 4 additions & 2 deletions avr-specs/avr-atmega32u4.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"no-default-libraries": false,
"pre-link-args": {
"gnu-cc": [
"-mmcu=atmega32u4"
"-mmcu=atmega32u4",
"-Wl,--as-needed,--print-memory-usage"
],
"gnu-lld-cc": [
"-mmcu=atmega32u4"
"-mmcu=atmega32u4",
"-Wl,--as-needed,--print-memory-usage"
]
},
"relocation-model": "static",
Expand Down
6 changes: 4 additions & 2 deletions avr-specs/avr-atmega48p.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"no-default-libraries": false,
"pre-link-args": {
"gnu-cc": [
"-mmcu=atmega48p"
"-mmcu=atmega48p",
"-Wl,--as-needed,--print-memory-usage"
],
"gnu-lld-cc": [
"-mmcu=atmega48p"
"-mmcu=atmega48p",
"-Wl,--as-needed,--print-memory-usage"
]
},
"relocation-model": "static",
Expand Down
6 changes: 4 additions & 2 deletions avr-specs/avr-atmega8.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"no-default-libraries": false,
"pre-link-args": {
"gnu-cc": [
"-mmcu=atmega8"
"-mmcu=atmega8",
"-Wl,--as-needed,--print-memory-usage"
],
"gnu-lld-cc": [
"-mmcu=atmega8"
"-mmcu=atmega8",
"-Wl,--as-needed,--print-memory-usage"
]
},
"relocation-model": "static",
Expand Down
6 changes: 4 additions & 2 deletions avr-specs/avr-attiny167.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"no-default-libraries": false,
"pre-link-args": {
"gnu-cc": [
"-mmcu=attiny167"
"-mmcu=attiny167",
"-Wl,--as-needed,--print-memory-usage"
],
"gnu-lld-cc": [
"-mmcu=attiny167"
"-mmcu=attiny167",
"-Wl,--as-needed,--print-memory-usage"
]
},
"relocation-model": "static",
Expand Down
6 changes: 4 additions & 2 deletions avr-specs/avr-attiny2313.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"no-default-libraries": false,
"pre-link-args": {
"gnu-cc": [
"-mmcu=attiny2313"
"-mmcu=attiny2313",
"-Wl,--as-needed,--print-memory-usage"
],
"gnu-lld-cc": [
"-mmcu=attiny2313"
"-mmcu=attiny2313",
"-Wl,--as-needed,--print-memory-usage"
]
},
"relocation-model": "static",
Expand Down
6 changes: 4 additions & 2 deletions avr-specs/avr-attiny85.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"no-default-libraries": false,
"pre-link-args": {
"gnu-cc": [
"-mmcu=attiny85"
"-mmcu=attiny85",
"-Wl,--as-needed,--print-memory-usage"
],
"gnu-lld-cc": [
"-mmcu=attiny85"
"-mmcu=attiny85",
"-Wl,--as-needed,--print-memory-usage"
]
},
"relocation-model": "static",
Expand Down
6 changes: 4 additions & 2 deletions avr-specs/avr-attiny88.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
"no-default-libraries": false,
"pre-link-args": {
"gnu-cc": [
"-mmcu=attiny88"
"-mmcu=attiny88",
"-Wl,--as-needed,--print-memory-usage"
],
"gnu-lld-cc": [
"-mmcu=attiny88"
"-mmcu=attiny88",
"-Wl,--as-needed,--print-memory-usage"
]
},
"relocation-model": "static",
Expand Down
1 change: 1 addition & 0 deletions avr-specs/sync-from-upstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def main():

for pre_link_args in spec["pre-link-args"].values():
pre_link_args[0] = f"-mmcu={settings['cpu']}"
pre_link_args.append("-Wl,--as-needed,--print-memory-usage")

with open(f"avr-specs/avr-{mcu}.json", "w") as f:
json.dump(spec, f, sort_keys=True, indent=2)
Expand Down

0 comments on commit c222e69

Please sign in to comment.