-
Notifications
You must be signed in to change notification settings - Fork 400
Add ATtiny1634 core support #568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
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
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
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
|
Strange, 2 USARTS and a USI. Why did they do that? Is there something unusual about USARTs and AC that explains their omission? |
|
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. |
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.