Exclude jtag3 classic jtag prodsig memories

This commit is contained in:
Stefan Rueger
2024-08-09 02:32:34 +01:00
parent 28ebfa0a4b
commit c00321dd52
2 changed files with 46 additions and 2 deletions

View File

@@ -1599,10 +1599,18 @@ Memtable avr_mem_order[100] = {
{"sib", MEM_SIB | MEM_READONLY},
};
#include "dryrun.h"
#include "jtag3.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) {
return // Classic part usersig memories cannot be read/written using ISP
mem_is_usersig(mem) && (p->prog_modes&PM_Classic) && (pgm->prog_modes&p->prog_modes&PM_ISP);
return
is_type(pgm, dryrun)? 0: // Never exclude dryrun memories
// jtag3 cannot read beyond addr 6 on classic prodsig, so excluse memories in prodsig/sigrow
(is_type(pgm, jtag3) && mem_is_in_sigrow(mem) && 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));
}
int avr_get_mem_type(const char *str) {

View File

@@ -233,6 +233,42 @@ typedef struct opcode {
#define PM_Classic (PM_TPI | PM_ISP | PM_HVSP | PM_HVPP | PM_debugWIRE | PM_JTAG | PM_JTAGmkI)
#define PM_ALL 0x1fff // All programming interfaces
// Shortcut test for programmers and parts
#define is_spm(x) (!!((x)->prog_modes & PM_SPM))
#define is_tpi(x) (!!((x)->prog_modes & PM_TPI))
#define is_isp(x) (!!((x)->prog_modes & PM_ISP))
#define is_pdi(x) (!!((x)->prog_modes & PM_PDI))
#define is_updi(x) (!!((x)->prog_modes & PM_UPDI))
#define is_hvsp(x) (!!((x)->prog_modes & PM_HVSP))
#define is_hvpp(x) (!!((x)->prog_modes & PM_HVPP))
#define is_debugwire(x) (!!((x)->prog_modes & PM_debugWIRE))
#define is_jtag(x) (!!((x)->prog_modes & PM_JTAG))
#define is_jtagmki(x) (!!((x)->prog_modes & PM_JTAGmkI))
#define is_xmegajtag(x) (!!((x)->prog_modes & PM_XMEGAJTAG))
#define is_avr32jtag(x) (!!((x)->prog_modes & PM_AVR32JTAG))
#define is_awire(x) (!!((x)->prog_modes & PM_aWire))
#define is_classic(x) (!!((x)->prog_modes & PM_Classic))
// Set of overlapping programming modes of programmer and part
#define joint_pm(pgm, p) ((pgm)->prog_modes & (p)->prog_modes)
// Shortcut test whether both programmer and part have that programming mode
#define both_spm(pgm, p) (!!(joint_pm(pgm, p) & PM_SPM))
#define both_tpi(pgm, p) (!!(joint_pm(pgm, p) & PM_TPI))
#define both_isp(pgm, p) (!!(joint_pm(pgm, p) & PM_ISP))
#define both_pdi(pgm, p) (!!(joint_pm(pgm, p) & PM_PDI))
#define both_updi(pgm, p) (!!(joint_pm(pgm, p) & PM_UPDI))
#define both_hvsp(pgm, p) (!!(joint_pm(pgm, p) & PM_HVSP))
#define both_hvpp(pgm, p) (!!(joint_pm(pgm, p) & PM_HVPP))
#define both_debugwire(pgm, p) (!!(joint_pm(pgm, p) & PM_debugWIRE))
#define both_jtag(pgm, p) (!!(joint_pm(pgm, p) & PM_JTAG))
#define both_jtagmki(pgm, p) (!!(joint_pm(pgm, p) & PM_JTAGmkI))
#define both_xmegajtag(pgm, p) (!!(joint_pm(pgm, p) & PM_XMEGAJTAG))
#define both_avr32jtag(pgm, p) (!!(joint_pm(pgm, p) & PM_AVR32JTAG))
#define both_awire(pgm, p) (!!(joint_pm(pgm, p) & PM_aWire))
#define both_classic(pgm, p) (!!(joint_pm(pgm, p) & PM_Classic))
#define HV_UPDI_VARIANT_0 0 /* Shared UPDI/GPIO/RESET pin, HV on UPDI pin (tinyAVR0/1/2)*/
#define HV_UPDI_VARIANT_1 1 /* Dedicated UPDI pin, no HV (megaAVR0/AVR-Dx) */
#define HV_UPDI_VARIANT_2 2 /* Shared UPDI pin, HV on _RESET (AVR-DD/AVR-Ex) */