Skip to content

Commit

Permalink
Exclude all but flash/eeprom/sig from ALL in debugwire i/fce or -c ur…
Browse files Browse the repository at this point in the history
…clock
  • Loading branch information
stefanrueger committed Aug 12, 2024
1 parent 11f419f commit cd956e8
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/avr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1596,17 +1596,28 @@ Memtable avr_mem_order[100] = {
#include "dryrun.h"
#include "jtag3.h"
#include "jtagmkII.h"
#include "urclock.h"
#define is_type(pgm, what) ((pgm)->initpgm == what ## _initpgm)

// Whether a memory is an exception that shouldn't be there for this particular i/face
int avr_mem_exclude(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem) {
int avr_mem_exclude(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m) {
return
is_type(pgm, dryrun)? 0: // Never exclude dryrun memories
(mem_is_sib(mem) && is_type(pgm, jtagmkII_updi)) || // jtag2updi cannot deal with sib
// jtag3 cannot read beyond addr 6 on classic prodsig, so exclude memories in prodsig/sigrow
(is_type(pgm, jtag3) && mem_is_in_sigrow(mem) && is_classic(p) && both_jtag(pgm, p)) ||

// debugWIRE only allows eeprom/flash/signature
(both_debugwire(pgm, p) && !(mem_is_in_flash(m) || mem_is_eeprom(m) || mem_is_signature(m))) ||

// urclock type only allows eeprom/flash/signature
(both_spm(pgm, p) && is_type(pgm, urclock) && !(mem_is_in_flash(m) || mem_is_eeprom(m) || mem_is_signature(m))) ||

// jtag2updi cannot deal with sib
(mem_is_sib(m) && is_type(pgm, jtagmkII_updi)) ||

// jtag3 JTAG i/fce cannot read beyond addr 6 on classic prodsig, so exclude this
(is_type(pgm, jtag3) && mem_is_in_sigrow(m) && is_classic(p) && both_jtag(pgm, p)) ||

// Classic part usersig memories cannot be read/written using ISP
(mem_is_usersig(mem) && is_classic(p) && both_isp(pgm, p));
(mem_is_usersig(m) && is_classic(p) && both_isp(pgm, p));
}

int avr_get_mem_type(const char *str) {
Expand Down

0 comments on commit cd956e8

Please sign in to comment.