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

Add Cross-Platform avrdude Download + Upload UX Improvements#15

Merged
StrongTheDev merged 1 commit intoStrongTheDev:mainfrom
Alireza-Jahanbakhshi:main
Apr 7, 2025
Merged

Add Cross-Platform avrdude Download + Upload UX Improvements#15
StrongTheDev merged 1 commit intoStrongTheDev:mainfrom
Alireza-Jahanbakhshi:main

Conversation

@Alireza-Jahanbakhshi
Copy link
Copy Markdown
Collaborator

✨ Description

This pull request enhances the AVR upload experience by expanding the list of supported programmer types and improving the overall configuration flow. It adds robust cross-platform support, better UX, and thoughtful developer conveniences.


✅ Changes

  • 🔽 Expanded Programmer Options
    Added 13+ popular avrdude programmer types:

    usbasp, avrisp2, stk500v1, stk500v2,
    arduino, wiring, avrisp, usbtiny,
    dragon_isp, dragon_dw, jtag1, jtag2, pickit2, ponyser
    

    Includes "Custom..." entry for flexibility.

  • 🧠 Improved Upload UX

    • Cleaner, descriptive QuickPick interface for programmer, MCU, and port.
    • Saves and reuses user preferences between sessions.
  • 📦 Download Enhancements

    • Platform-aware avrdude auto-download (Windows, Linux, macOS).
    • Archive format detection (.zip, .tar.gz) with correct extract logic.
    • Grants executable permissions on Unix systems using chmod.
  • 🛡️ Stability & Debugging

    • Fallback to system avrdude if download declined.
    • Verifies binary exists after extraction.
    • Console logging added to help trace issues.
  • 🧼 Refactoring

    • Helper functions organized and cleaned up for clarity.

🧪 Testing

  • ✅ New programmer options confirmed in dropdown menu.
  • ✅ Saved upload settings verified across sessions.
  • ✅ Auto-download tested with GitHub redirects.
  • ✅ Upload functionality confirmed on Windows and Linux.

🔗 Related To

Builds on:
Add Automatic avrdude Download Feature with Redirect Handling


🙏 Personal Note

I'd love to be credited on the extension page:
https://marketplace.visualstudio.com/items?itemName=agani-ds.avr-utils

I plan to recommend this extension to my students — it's a huge productivity win for AVR devs in VSCode.


💡 Optional Enhancements (Future Consideration)

  • 🔌 Auto-detect serial ports instead of using a static list.
  • 🧹 Add a "Reset Upload Settings" command to the UI.
  • 🧠 Cache downloaded avrdude version to prevent re-downloading.

✅ Final Checklist

Feature ✅ Status Notes
Platform-specific avrdude URLs Windows, Linux, macOS covered
Archive format detection zip vs tar handled properly
Extract logic Clean switch between decompress and tar.x
🔐 chmod for Unix binaries Correctly placed and scoped
Saved upload settings prompt Great UX with fallback to manual config
System avrdude fallback Gracefully handled
Temporary file naming path.basename() used for temp files
Redirect handling followRedirects() used to resolve GitHub redirects
Binary check post-extraction Verifies avrdude exists before continuing
Console logging for debug Helpful logs for troubleshooting
All helper functions in place Modular and maintainable structure

- Supports avrdude auto-download for Windows, Linux, and macOS
- Detects and extracts zip/tar archives based on platform
- Applies chmod for Unix avrdude binary post-extraction
- Adds fallback to system avrdude if toolchain install skipped
- Adds persistent upload settings with "Use Saved" prompt
- Expands programmer dropdown (13+ avrdude types + "Custom...")
- Handles 302 redirects via followRedirects()
- Validates binary presence after extraction
- Adds debug logging for troubleshooting
- Refactors helpers for clarity and maintainability
- Updates README.md with full documentation and final checklist

✅ Final Checklist:
✔ Platform-specific URLs & archive detection
✔ Clean decompress/tar extraction logic
✔ chmod support for Unix
✔ Fallback to system avrdude
✔ Upload settings UX prompt
✔ Post-install binary validation
✔ followRedirects() for GitHub
✔ Helpful console logs
✔ Modular, readable helper structure
Copy link
Copy Markdown
Owner

@StrongTheDev StrongTheDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are my comments for this PR 👍

About crediting you on the page at the extension marketplace, just make a PR adding yourself to the authors tag in package.json, and I'll merge it.

"authors": [
    {
      "name": "Agani Daniel Strong",
      "email": "aganidanielstrong@gmail.com",
      "url": "https://github.com/StrongTheDev"
    },
    {
      "name": "Alireza....",
      "email": "alireza@example.com",
      "url": "https://alireza.com"
    }
  ],

let avrdudeUrl, archiveType;

if (platform === 'win32') {
avrdudeUrl = 'https://github.com/avrdudes/avrdude/releases/download/v8.0/avrdude-v8.0-windows-x64.zip';
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good for the start. I'll work on an improvement soon. (to the downloading functionality, that is.)

console.log(`Extracting ${tempPath} to ${targetDir}`);
const files = await decompress(tempPath, targetDir, { strip: 1 });
if (archiveType === 'zip') {
const files = await decompress(tempPath, targetDir, { strip: 1 });
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will also update this code later to modularize it, since I had the same functions already (at the bottom of getToolchain.js)
And also, thanks for these. These are great additions to the extension

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy you like the additions! Modularizing getToolchain.js duplicates is a great call for cleaner code.

@StrongTheDev StrongTheDev merged commit 444effe into StrongTheDev:main Apr 7, 2025
3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants