Skip to content

Commit

Permalink
Handle SRAM r/w
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanrueger committed Nov 15, 2023
1 parent 1d2a36c commit 1b9d087
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ static int elf_mem_limits(const AVRMEM *mem, const AVRPART *p,
*lowbound = 0;
*highbound = 0x7Fffff; // Max 8 MiB
*fileoff = 0;
} else if (mem_is_sram(mem)) { // SRAM
} else if (mem_is_io(mem) || mem_is_sram(mem)) { // IO & SRAM in data space
*lowbound = 0x800000 + mem->offset;
*highbound = 0x80ffff;
*fileoff = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/jtag3.c
Original file line number Diff line number Diff line change
Expand Up @@ -2168,7 +2168,7 @@ static int jtag3_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM
cmd[3] = MTYPE_OSCCAL_BYTE;
if (pgm->flag & PGM_FL_IS_DW)
unsupp = 1;
} else if (mem_is_io(mem)) {
} else if (mem_is_io(mem) || mem_is_sram(mem)) {
cmd[3] = MTYPE_SRAM;
} else if (mem_is_sib(mem)) {
if(addr >= AVR_SIBLEN) {
Expand Down Expand Up @@ -2325,7 +2325,7 @@ static int jtag3_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRME
unsupp = 1;
} else if (mem_is_userrow(mem)) {
cmd[3] = MTYPE_USERSIG;
} else if (mem_is_io(mem))
} else if (mem_is_io(mem) || mem_is_sram(mem))
cmd[3] = MTYPE_SRAM;

// Read-only memories or unsupported by debugWire
Expand Down
4 changes: 2 additions & 2 deletions src/jtagmkII.c
Original file line number Diff line number Diff line change
Expand Up @@ -2222,7 +2222,7 @@ static int jtagmkII_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVR
} else if ((p->prog_modes & (PM_PDI | PM_UPDI)) && mem_is_in_sigrow(mem)) {
cmd[1] = MTYPE_PRODSIG;
pmsg_notice2("in_sigrow addr 0x%05lx\n", addr);
} else if (mem_is_io(mem)) {
} else if (mem_is_io(mem) || mem_is_sram(mem)) {
cmd[1] = MTYPE_FLASH;
addr += avr_data_offset(p);
} else {
Expand Down Expand Up @@ -2346,7 +2346,7 @@ static int jtagmkII_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AV
cmd[1] = MTYPE_LOCK_BITS;
if (pgm->flag & PGM_FL_IS_DW)
unsupp = 1;
} else if (mem_is_io(mem)) {
} else if (mem_is_io(mem) || mem_is_sram(mem)) {
cmd[1] = MTYPE_FLASH; // Works with jtag2updi, does not work with any xmega
addr += avr_data_offset(p);
} else if(mem_is_readonly(mem)) {
Expand Down
6 changes: 3 additions & 3 deletions src/stk500v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -4270,7 +4270,7 @@ static int stk600_xprog_write_byte(const PROGRAMMER *pgm, const AVRPART *p, cons
memcode = XPRG_MEM_TYPE_BOOT;
} else if (mem_is_eeprom(mem)) {
memcode = XPRG_MEM_TYPE_EEPROM;
} else if (mem_is_io(mem)) {
} else if (mem_is_io(mem) || mem_is_sram(mem)) {
memcode = XPRG_MEM_TYPE_APPL;
addr += avr_data_offset(p);
} else if (mem_is_lock(mem)) {
Expand Down Expand Up @@ -4347,7 +4347,7 @@ static int stk600_xprog_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const
b[1] = XPRG_MEM_TYPE_BOOT;
} else if (mem_is_eeprom(mem)) {
b[1] = XPRG_MEM_TYPE_EEPROM;
} else if (mem_is_io(mem)) {
} else if (mem_is_io(mem) || mem_is_sram(mem)) {
b[1] = XPRG_MEM_TYPE_APPL;
addr += avr_data_offset(p);
} else if (mem_is_signature(mem)) {
Expand Down Expand Up @@ -4421,7 +4421,7 @@ static int stk600_xprog_paged_load(const PROGRAMMER *pgm, const AVRPART *p, cons
use_ext_addr = (1UL << 31);
} else if (mem_is_eeprom(mem)) {
mtype = XPRG_MEM_TYPE_EEPROM;
} else if (mem_is_io(mem)) {
} else if (mem_is_io(mem) || mem_is_sram(mem)) {
mtype = XPRG_MEM_TYPE_APPL;
addr += avr_data_offset(p);
} else if (mem_is_signature(mem)) {
Expand Down

0 comments on commit 1b9d087

Please sign in to comment.