Skip to content

Add spm for tinyx4 tiny2313 tiny2313a and tiny4313 #550

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

Merged
merged 2 commits into from
May 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions simavr/cores/sim_tiny2313.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "avr_eeprom.h"
#include "avr_watchdog.h"
#include "avr_extint.h"
#include "avr_flash.h"
#include "avr_ioport.h"
#include "avr_uart.h"
#include "avr_timer.h"
Expand All @@ -44,6 +45,7 @@ static const struct mcu_t {
avr_t core;
avr_eeprom_t eeprom;
avr_watchdog_t watchdog;
avr_flash_t selfprog;
avr_extint_t extint;
avr_ioport_t porta, portb, portd;
avr_uart_t uart;
Expand All @@ -60,6 +62,15 @@ static const struct mcu_t {
},
AVR_EEPROM_DECLARE_8BIT(EEPROM_READY_vect),
AVR_WATCHDOG_DECLARE(WDTCSR, WDT_OVERFLOW_vect),
.selfprog = {
.flags = 0,
.r_spm = SPMCSR,
.spm_pagesize = SPM_PAGESIZE,
.selfprgen = AVR_IO_REGBIT(SPMCSR, SPMEN),
.pgers = AVR_IO_REGBIT(SPMCSR, PGERS),
.pgwrt = AVR_IO_REGBIT(SPMCSR, PGWRT),
.blbset = AVR_IO_REGBIT(SPMCSR, RFLB),
},
.extint = {
AVR_EXTINT_TINY_DECLARE(0, 'D', 2, EIFR),
AVR_EXTINT_TINY_DECLARE(1, 'D', 3, EIFR),
Expand Down Expand Up @@ -251,6 +262,7 @@ static void init(struct avr_t * avr)

avr_eeprom_init(avr, &mcu->eeprom);
avr_watchdog_init(avr, &mcu->watchdog);
avr_flash_init(avr, &mcu->selfprog);
avr_extint_init(avr, &mcu->extint);
avr_ioport_init(avr, &mcu->porta);
avr_ioport_init(avr, &mcu->portb);
Expand Down
12 changes: 12 additions & 0 deletions simavr/cores/sim_tiny2313a.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "avr_eeprom.h"
#include "avr_watchdog.h"
#include "avr_extint.h"
#include "avr_flash.h"
#include "avr_ioport.h"
#include "avr_uart.h"
#include "avr_timer.h"
Expand All @@ -44,6 +45,7 @@ static const struct mcu_t {
avr_t core;
avr_eeprom_t eeprom;
avr_watchdog_t watchdog;
avr_flash_t selfprog;
avr_extint_t extint;
avr_ioport_t porta, portb, portd;
avr_uart_t uart;
Expand All @@ -60,6 +62,15 @@ static const struct mcu_t {
},
AVR_EEPROM_DECLARE_8BIT(EEPROM_Ready_vect),
AVR_WATCHDOG_DECLARE(WDTCR, WDT_OVERFLOW_vect),
.selfprog = {
.flags = 0,
.r_spm = SPMCSR,
.spm_pagesize = SPM_PAGESIZE,
.selfprgen = AVR_IO_REGBIT(SPMCSR, SPMEN),
.pgers = AVR_IO_REGBIT(SPMCSR, PGERS),
.pgwrt = AVR_IO_REGBIT(SPMCSR, PGWRT),
.blbset = AVR_IO_REGBIT(SPMCSR, RFLB),
},
.extint = {
AVR_EXTINT_TINY_DECLARE(0, 'D', 2, GIFR),
AVR_EXTINT_TINY_DECLARE(1, 'D', 3, GIFR),
Expand Down Expand Up @@ -237,6 +248,7 @@ static void init(struct avr_t * avr)

avr_eeprom_init(avr, &mcu->eeprom);
avr_watchdog_init(avr, &mcu->watchdog);
avr_flash_init(avr, &mcu->selfprog);
avr_extint_init(avr, &mcu->extint);
avr_ioport_init(avr, &mcu->porta);
avr_ioport_init(avr, &mcu->portb);
Expand Down
12 changes: 12 additions & 0 deletions simavr/cores/sim_tiny4313.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "avr_eeprom.h"
#include "avr_watchdog.h"
#include "avr_extint.h"
#include "avr_flash.h"
#include "avr_ioport.h"
#include "avr_uart.h"
#include "avr_timer.h"
Expand All @@ -44,6 +45,7 @@ static const struct mcu_t {
avr_t core;
avr_eeprom_t eeprom;
avr_watchdog_t watchdog;
avr_flash_t selfprog;
avr_extint_t extint;
avr_ioport_t porta, portb, portd;
avr_uart_t uart;
Expand All @@ -60,6 +62,15 @@ static const struct mcu_t {
},
AVR_EEPROM_DECLARE_8BIT(EEPROM_Ready_vect),
AVR_WATCHDOG_DECLARE(WDTCR, WDT_OVERFLOW_vect),
.selfprog = {
.flags = 0,
.r_spm = SPMCSR,
.spm_pagesize = SPM_PAGESIZE,
.selfprgen = AVR_IO_REGBIT(SPMCSR, SPMEN),
.pgers = AVR_IO_REGBIT(SPMCSR, PGERS),
.pgwrt = AVR_IO_REGBIT(SPMCSR, PGWRT),
.blbset = AVR_IO_REGBIT(SPMCSR, RFLB),
},
.extint = {
AVR_EXTINT_TINY_DECLARE(0, 'D', 2, GIFR),
AVR_EXTINT_TINY_DECLARE(1, 'D', 3, GIFR),
Expand Down Expand Up @@ -237,6 +248,7 @@ static void init(struct avr_t * avr)

avr_eeprom_init(avr, &mcu->eeprom);
avr_watchdog_init(avr, &mcu->watchdog);
avr_flash_init(avr, &mcu->selfprog);
avr_extint_init(avr, &mcu->extint);
avr_ioport_init(avr, &mcu->porta);
avr_ioport_init(avr, &mcu->portb);
Expand Down
1 change: 1 addition & 0 deletions simavr/cores/sim_tinyx4.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ void tx4_init(struct avr_t * avr)
struct mcu_t * mcu = (struct mcu_t*)avr;

avr_eeprom_init(avr, &mcu->eeprom);
avr_flash_init(avr, &mcu->selfprog);
avr_watchdog_init(avr, &mcu->watchdog);
avr_extint_init(avr, &mcu->extint);
avr_ioport_init(avr, &mcu->porta);
Expand Down
11 changes: 11 additions & 0 deletions simavr/cores/sim_tinyx4.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "avr_eeprom.h"
#include "avr_watchdog.h"
#include "avr_extint.h"
#include "avr_flash.h"
#include "avr_ioport.h"
#include "avr_adc.h"
#include "avr_timer.h"
Expand All @@ -44,6 +45,7 @@ struct mcu_t {
avr_t core;
avr_eeprom_t eeprom;
avr_watchdog_t watchdog;
avr_flash_t selfprog;
avr_extint_t extint;
avr_ioport_t porta, portb;
avr_acomp_t acomp;
Expand Down Expand Up @@ -71,6 +73,15 @@ const struct mcu_t SIM_CORENAME = {
},
AVR_EEPROM_DECLARE(EE_RDY_vect),
AVR_WATCHDOG_DECLARE(WDTCSR, WDT_vect),
.selfprog = {
.flags = 0,
.r_spm = SPMCSR,
.spm_pagesize = SPM_PAGESIZE,
.selfprgen = AVR_IO_REGBIT(SPMCSR, SPMEN),
.pgers = AVR_IO_REGBIT(SPMCSR, PGERS),
.pgwrt = AVR_IO_REGBIT(SPMCSR, PGWRT),
.blbset = AVR_IO_REGBIT(SPMCSR, RFLB),
},
.extint = {
AVR_EXTINT_TINY_DECLARE(0, 'B', PB2, GIFR),
},
Expand Down
Loading