@@ -415,10 +415,32 @@ jobs:
415415 -replace '#define U8G2_WITH_UNICODE', '//#define U8G2_WITH_UNICODE' |
416416 Set-Content -Encoding ASCII $u8g2Header
417417
418- Write-Host "DONE. Portable Arduino IDE for OSCR with updated AVR-GCC compiler is ready."
418+ ### Step 9: Optimize Compiler ###
419+ Write-Host "Step 9: Optimizing compiler..." -ForegroundColor Green
420+ $platformLocalPath = Join-Path $root 'Arduino IDE\hardware\arduino\avr\platform.local.txt'
421+
422+ # Ensure target directory exists
423+ $platformDir = Split-Path $platformLocalPath -Parent
424+ if (-not (Test-Path $platformDir)) {
425+ New-Item -Path $platformDir -ItemType Directory -Force | Out-Null
426+ }
427+
428+ # Desired content as array (preserves indentation)
429+ $platformLocalContent = @(
430+ 'compiler.c.extra_flags=-mcall-prologues'
431+ 'compiler.cpp.extra_flags=-mcall-prologues'
432+ 'compiler.S.extra_flags='
433+ 'compiler.ar.extra_flags='
434+ 'compiler.objcopy.eep.extra_flags='
435+ 'compiler.elf2hex.extra_flags='
436+ 'compiler.c.elf.extra_flags=-Wl,--relax'
437+ )
438+
439+ # Create / overwrite file with UTF-8 encoding
440+ $platformLocalContent | Set-Content -Path $platformLocalPath -Encoding UTF8 -Force
419441
420- ### Step 9 : README ###
421- Write-Host "Step 9 : Creating README.txt..."
442+ ### Step 10 : README ###
443+ Write-Host "Step 10 : Creating README.txt..."
422444 @"
423445 1) Install CH341 Drivers by running SETUP.exe in the "CH341 Drivers" folder
424446 2) Launch arduino.exe found in the "Arduino IDE" directory
@@ -434,8 +456,8 @@ jobs:
434456 More info: https://github.com/sanni/cartreader/wiki
435457 "@ | Set-Content -Encoding UTF8 -Path "$root\README.txt"
436458
437- ### Step 10 : Extracting version from OSCR.cpp ###
438- Write-Host "Step 10 : Extracting version from OSCR.cpp..."
459+ ### Step 11 : Extracting version from OSCR.cpp ###
460+ Write-Host "Step 11 : Extracting version from OSCR.cpp..."
439461
440462 $pattern = 'FSTRING_VERSION\[\] = "(.*)";'
441463 $cppPath = Join-Path $root "Arduino IDE\portable\sketchbook\Cart_Reader\OSCR.cpp"
@@ -456,8 +478,8 @@ jobs:
456478
457479 Add-Content -Path $githubEnv -Value "OSCR_VERSION=$version"
458480
459- ### Step 11 : Create zip ###
460- Write-Host "Step 11 : Create zip..."
481+ ### Step 12 : Create zip ###
482+ Write-Host "Step 12 : Create zip..."
461483 # Go up one directory
462484 Set-Location (Split-Path $root -Parent)
463485
0 commit comments