Skip to content

Add ATtiny port with avr25 CPU support and fix AVR vector tables#923

Open
mattnite wants to merge 4 commits intomainfrom
attiny
Open

Add ATtiny port with avr25 CPU support and fix AVR vector tables#923
mattnite wants to merge 4 commits intomainfrom
attiny

Conversation

@mattnite
Copy link
Copy Markdown
Contributor

Add a new port for Microchip ATtiny (ATtiny85, ATtiny84) with HAL, board definitions (Digispark, Adafruit Trinket, Adafruit Gemma), and blinky examples including an interrupt handler example.

Also fix the AVR startup logic for both avr25 and avr5:

  • Place vector table in microzig_flash_start section so it lands at address 0x0 where the hardware expects it
  • Emit full vector table with entries for all interrupt vectors, not just the reset vector
  • Add InterruptOptions so users can specify interrupt handlers via microzig_options, which get wired into the vector table
  • Update calling convention names for zig 0.15.2 compatibility (.avr_signal/.avr_interrupt/.auto, .@"fn")

mattnite and others added 4 commits April 27, 2026 23:04
Add a new port for Microchip ATtiny (ATtiny85, ATtiny84) with HAL,
board definitions (Digispark, Adafruit Trinket, Adafruit Gemma),
and blinky examples including an interrupt handler example.

Also fix the AVR startup logic for both avr25 and avr5:
- Place vector table in microzig_flash_start section so it lands at
  address 0x0 where the hardware expects it
- Emit full vector table with entries for all interrupt vectors, not
  just the reset vector
- Add InterruptOptions so users can specify interrupt handlers via
  microzig_options, which get wired into the vector table
- Update calling convention names for zig 0.15.2 compatibility
  (.avr_signal/.avr_interrupt/.auto, .@"fn")

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
const gpio = microzig.hal.gpio;

// ATtiny84: use PA0 as the LED pin
const led_pin = gpio.pin(.a, 0);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can't we put this in the board config so that we can use the same blinky.zig for multiple boards?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants