Skip to content
This repository was archived by the owner on Mar 16, 2026. It is now read-only.

Commit 2a842fa

Browse files
committed
Optimize compiler flags (thx to bootsector)
1 parent 98e2ef9 commit 2a842fa

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tools/oscr_tool/oscr_tool.ps1

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,30 @@ try {
384384
-replace '#define U8G2_WITH_FONT_ROTATION', '//#define U8G2_WITH_FONT_ROTATION' `
385385
-replace '#define U8G2_WITH_UNICODE', '//#define U8G2_WITH_UNICODE' |
386386
Set-Content -Encoding ASCII $u8g2Header
387+
388+
### Step 9: Optimize Compiler ###
389+
Write-Host "Step 9: Optimizing compiler..." -ForegroundColor Green
390+
$platformLocalPath = Join-Path $root 'Arduino IDE\hardware\arduino\avr\platform.local.txt'
391+
392+
# Ensure target directory exists
393+
$platformDir = Split-Path $platformLocalPath -Parent
394+
if (-not (Test-Path $platformDir)) {
395+
New-Item -Path $platformDir -ItemType Directory -Force | Out-Null
396+
}
397+
398+
# Desired content as array (preserves indentation)
399+
$platformLocalContent = @(
400+
'compiler.c.extra_flags=-mcall-prologues'
401+
'compiler.cpp.extra_flags=-mcall-prologues'
402+
'compiler.S.extra_flags='
403+
'compiler.ar.extra_flags='
404+
'compiler.objcopy.eep.extra_flags='
405+
'compiler.elf2hex.extra_flags='
406+
'compiler.c.elf.extra_flags=-Wl,--relax'
407+
)
408+
409+
# Create / overwrite file with UTF-8 encoding
410+
$platformLocalContent | Set-Content -Path $platformLocalPath -Encoding UTF8 -Force
387411

388412
Write-Host "DONE. Portable Arduino IDE for OSCR with updated AVR-GCC compiler is ready."
389413
}

0 commit comments

Comments
 (0)