Skip chaching when size of memory is 0.

This commit is contained in:
Jan Egil Ruud 2022-12-01 15:16:23 +01:00
parent e18b5c4fb0
commit bb808e8d5f
2 changed files with 12 additions and 12 deletions

View File

@ -343,7 +343,7 @@ int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p) {
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem || !cp->cont)
if(!mem || !cp->cont || !cp->size)
continue;
for(int pgno = 0, n = 0; n < cp->size; pgno++, n += cp->page_size) {
@ -367,6 +367,8 @@ int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!cp->size)
continue;
if(!cp->cont) // Ensure cache is initialised from now on
if(initCache(cp, pgm, p) < 0) {
if(quell_progress)
@ -419,7 +421,7 @@ int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p) {
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem)
if(!mem || !cp->size)
continue;
for(int pgno = 0, n = 0; n < cp->size; pgno++, n += cp->page_size)
@ -433,7 +435,7 @@ int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p) {
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem)
if(!mem || !cp->size)
continue;
for(int ird = 0, pgno = 0, n = 0; n < cp->size; pgno++, n += cp->page_size) {
@ -460,7 +462,7 @@ int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p) {
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem)
if(!mem || !cp->size)
continue;
if(mems[i].isflash) { // flash
@ -508,7 +510,7 @@ int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p) {
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem)
if(!mem || !cp->size)
continue;
for(int pgno = 0, n = 0; n < cp->size; pgno++, n += cp->page_size)
@ -522,7 +524,7 @@ int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p) {
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem || !cp->cont)
if(!mem || !cp->cont || !cp->size)
continue;
for(int iwr = 0, pgno = 0, n = 0; n < cp->size; pgno++, n += cp->page_size) {
@ -644,7 +646,7 @@ int avr_chip_erase_cached(const PROGRAMMER *pgm, const AVRPART *p) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem || !avr_has_paged_access(pgm, mem))
if(!mem || !cp->size || !avr_has_paged_access(pgm, mem))
continue;
if(!cp->cont) // Init cache if needed
@ -734,6 +736,8 @@ int avr_reset_cache(const PROGRAMMER *pgm, const AVRPART *p) {
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVR_Cache *cp = mems[i];
if(!cp->size)
continue;
if(cp->cont)
free(cp->cont);
if(cp->copy)

View File

@ -2509,10 +2509,6 @@ unsigned char tpi_get_memtype(const AVRMEM *mem) {
return memtype;
}
// void tpi_print_error_status(unsigned char error) {
// pmsg_error("error communicating with programmer, received status 0x%02x\n", error);
// }
/*
* Send the data as a JTAGICE3 encapsulated TPI packet.
*/
@ -2589,7 +2585,7 @@ int jtag3_command_tpi(const PROGRAMMER *pgm, unsigned char *cmd, unsigned int cm
* initialize the AVR device and prepare it to accept commands
*/
static int jtag3_initialize_tpi(const PROGRAMMER *pgm, const AVRPART *p) {
unsigned char cmd[4];
unsigned char cmd[3];
unsigned char* resp;
int status;