Merged
Conversation
ATtiny1634 specifications: - 16KB Flash, 1KB SRAM, 256B EEPROM - 3 GPIO ports (A: 8 pins, B: 4 pins, C: 6 pins) - Timer0: 8-bit with PWM on OC0A (PC0), OC0B (PA5) - Timer1: 16-bit with PWM on OC1A (PB3), OC1B (PA6) - 12-channel 10-bit ADC with temperature sensor - Watchdog timer, PCINT on all 3 ports Note: ATtiny1634 has no WDCE bit so watchdog is declared manually without the timed sequence requirement.
0ed4a0b to
aa9a8b8
Compare
ATtiny1634 has 16KB flash, which requires the use of 4-byte JMP instructions in the interrupt vector table (RJMP cannot reach the full address space). This was causing the emulator to jump to wrong addresses when servicing interrupts. Also improved the interrupt stack overflow error message to include the vector number for easier debugging.
GlassOnTin
added a commit
to GlassOnTin/anduril
that referenced
this pull request
Dec 10, 2025
Adds a cycle-accurate AVR emulator test infrastructure using simavr with ATtiny1634 support. Tests run actual compiled firmware hex files, providing true integration testing of the firmware. ## Test Framework (sim/tests/) - anduril-test.h/c: Test API with button simulation, PWM reading, timing - Macros: TEST_BEGIN, TEST_PASS, TEST_FAIL, ASSERT - Helpers: anduril_click(), anduril_multi_click(), anduril_get_pwm() ## Test Suites (18 tests total) - test_basic_ui.c (8 tests): on/off, hold, turbo, lockout - test_ramping.c (6 tests): ramp up/down, floor/ceiling, memory - test_channel_modes.c (4 tests): 3C switching, persistence, cycling ## ATtiny1634 Core (sim/simavr-core/) Custom simavr core for ATtiny1634 MCU used in Anduril flashlights: - 16KB Flash, 1KB SRAM, 256B EEPROM - Timer0 (8-bit), Timer1 (16-bit) with PWM - GPIO ports A, B, C ## Makefile Targets - make test: Run all 18 tests - make test-basic/ramping/channel: Run individual suites - make test-verbose: Debug output with button/interrupt traces ## Dependencies Requires simavr with ATtiny1634 core support: - Fork: https://github.com/GlassOnTin/simavr - Upstream PR: buserror/simavr#568
5 tasks
GlassOnTin
added a commit
to GlassOnTin/anduril
that referenced
this pull request
Dec 10, 2025
Adds a cycle-accurate AVR emulator test infrastructure using simavr with ATtiny1634 support. Tests run actual compiled firmware hex files, providing true integration testing of the firmware. ## Test Framework (sim/tests/) - anduril-test.h/c: Test API with button simulation, PWM reading, timing - Macros: TEST_BEGIN, TEST_PASS, TEST_FAIL, ASSERT - Helpers: anduril_click(), anduril_multi_click(), anduril_get_pwm() ## Test Suites (18 tests total) - test_basic_ui.c (8 tests): on/off, hold, turbo, lockout - test_ramping.c (6 tests): ramp up/down, floor/ceiling, memory - test_channel_modes.c (4 tests): 3C switching, persistence, cycling ## ATtiny1634 Core (sim/simavr-core/) Custom simavr core for ATtiny1634 MCU used in Anduril flashlights: - 16KB Flash, 1KB SRAM, 256B EEPROM - Timer0 (8-bit), Timer1 (16-bit) with PWM - GPIO ports A, B, C ## Makefile Targets - make test: Run all 18 tests - make test-basic/ramping/channel: Run individual suites - make test-verbose: Debug output with button/interrupt traces ## Dependencies Requires simavr with ATtiny1634 core support: - Fork: https://github.com/GlassOnTin/simavr - Upstream PR: buserror/simavr#568
GlassOnTin
added a commit
to GlassOnTin/anduril
that referenced
this pull request
Dec 10, 2025
Adds a cycle-accurate AVR emulator test infrastructure using simavr with ATtiny1634 support. Tests run actual compiled firmware hex files, providing true integration testing of the firmware. ## Test Framework (sim/tests/) - anduril-test.h/c: Test API with button simulation, PWM reading, timing - Macros: TEST_BEGIN, TEST_PASS, TEST_FAIL, ASSERT - Helpers: anduril_click(), anduril_multi_click(), anduril_get_pwm() ## Test Suites (18 tests total) - test_basic_ui.c (8 tests): on/off, hold, turbo, lockout - test_ramping.c (6 tests): ramp up/down, floor/ceiling, memory - test_channel_modes.c (4 tests): 3C switching, persistence, cycling ## ATtiny1634 Core (sim/simavr-core/) Custom simavr core for ATtiny1634 MCU used in Anduril flashlights: - 16KB Flash, 1KB SRAM, 256B EEPROM - Timer0 (8-bit), Timer1 (16-bit) with PWM - GPIO ports A, B, C ## Makefile Targets - make test: Run all 18 tests - make test-basic/ramping/channel: Run individual suites - make test-verbose: Debug output with button/interrupt traces ## Dependencies Requires simavr with ATtiny1634 core support: - Fork: https://github.com/GlassOnTin/simavr - Upstream PR: buserror/simavr#568
Collaborator
|
Strange, 2 USARTS and a USI. Why did they do that? Is there something unusual about USARTs and AC that explains their omission? |
Contributor
Author
|
Yeah, the 1634 is a bit of an oddball with the dual USARTs packed into such a small footprint! To be honest, I omitted them (and the AC) purely due to scope. My primary use case is flashlight firmware (Anduril) which relies heavily on the Timers, PWM, and ADC, but doesn't use the serial interfaces. I preferred to submit a core that is tested and working for my needs rather than adding untested serial logic. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for ATtiny1634 microcontroller.
ATtiny1634 specifications:
Implementation notes:
AVR_WATCHDOG_DECLAREmacroTesting:
sim_core_config.hUse case:
This MCU is used in flashlight firmware (Anduril) and having simavr support enables firmware development and testing without physical hardware.