From b91c03d0e7210db289e359b002137dfb9791c394 Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Sat, 12 Aug 2023 23:26:42 +0100 Subject: [PATCH 1/3] Add memories on -p*/i if needed --- src/developer_opts.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/developer_opts.c b/src/developer_opts.c index 5f60784a4..7c4a45557 100644 --- a/src/developer_opts.c +++ b/src/developer_opts.c @@ -850,10 +850,12 @@ static void dev_part_strct(const AVRPART *p, bool tsv, const AVRPART *base, bool if(injct) for(size_t i=0; idesc) && str_match(meminj[i].mem, m->desc)) + if(meminj[i].mcu && str_casematch(meminj[i].mcu, p->desc)) + if(str_match(meminj[i].mem, m->desc)) { dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, meminj[i].var, cfg_strdup("meminj", meminj[i].value), NULL); + meminj[i].mcu = NULL; + } if(!tsv) { dev_cout(m->comments, ";", 0, 0); @@ -882,13 +884,25 @@ static void dev_part_strct(const AVRPART *p, bool tsv, const AVRPART *base, bool } } - if(injct) + if(injct) { for(size_t i=0; idesc)) dev_part_strct_entry(tsv, ".pt", p->desc, NULL, ptinj[i].var, cfg_strdup("ptinj", ptinj[i].value), NULL); + for(size_t i=0; idesc)) { + if(!tsv) + dev_info(" memory \"%s\"\n", meminj[i].mem); + dev_part_strct_entry(tsv, ".ptmm", p->desc, meminj[i].mem, + meminj[i].var, cfg_strdup("meminj", meminj[i].value), NULL); + meminj[i].mcu = NULL; + if(!tsv) + dev_info(" ;\n"); + } + } + if(!tsv) { dev_cout(p->comments, ";", 0, 0); dev_info(";\n"); From 867b546a5ed38746087d808b6fd93c57b953719e Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Sun, 13 Aug 2023 00:01:52 +0100 Subject: [PATCH 2/3] Add io memory for classic parts --- src/avr.c | 2 +- src/avrdude.conf.in | 384 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 385 insertions(+), 1 deletion(-) diff --git a/src/avr.c b/src/avr.c index 7e714283e..8cf3f6f15 100644 --- a/src/avr.c +++ b/src/avr.c @@ -1405,7 +1405,7 @@ const char *avr_mem_order[100] = { "tempsense", "signature", "prodsig", "sernum", "calibration", "osccal16", "osccal20", "osc16err", "osc20err", "usersig", "userrow", "data", - "sib", + "io", "sib", }; void avr_add_mem_order(const char *str) { diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 37d84bdf6..fcc8c2ff0 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -2980,6 +2980,10 @@ part memory "calibration" size = 1; ; + + memory "io" + size = 64; + ; ; #------------------------------------------------------------ @@ -3088,6 +3092,10 @@ part size = 1; read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 64; + ; ; #------------------------------------------------------------ @@ -3236,6 +3244,11 @@ part size = 2; read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -3376,6 +3389,10 @@ part size = 1; read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 64; + ; ; #------------------------------------------------------------ @@ -4513,6 +4530,11 @@ part size = 4; read = "0011.1000--xxxx.xxxx--0000.00aa--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -4678,6 +4700,11 @@ part size = 4; read = "0011.1000--xxxx.xxxx--0000.00aa--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -4837,6 +4864,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -4974,6 +5006,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -5111,6 +5148,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -5248,6 +5290,11 @@ part size = 4; read = "0011.1000--000x.xxxx--0000.00aa--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -5417,6 +5464,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -5724,6 +5776,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -5944,6 +6001,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -6129,6 +6191,11 @@ part size = 1; read = "0011.1000--00xx.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -6432,6 +6499,11 @@ part parent "m169" readback = 0x00 0x00; delay = 10; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -6474,6 +6546,11 @@ part parent "m169" readback = 0x00 0x00; delay = 10; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -6511,6 +6588,11 @@ part parent "m169" readback = 0x00 0x00; delay = 10; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -6651,6 +6733,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -6922,6 +7009,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -7138,6 +7230,11 @@ part size = 4; read = "0011.1000--00xx.xxxx--0000.00aa--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -7400,6 +7497,11 @@ part size = 4; read = "0011.1000--00xx.xxxx--0000.00aa--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -7550,6 +7652,11 @@ part size = 4; read = "0011.1000--00xx.xxxx--0000.00aa--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -7678,6 +7785,11 @@ part size = 4; read = "0011.1000--00xx.xxxx--0000.00aa--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -7804,6 +7916,11 @@ part size = 4; read = "0011.1000--xxxx.xxxx--0000.00aa--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -7946,6 +8063,11 @@ part size = 1; read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -8114,6 +8236,11 @@ part size = 1; read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -8278,6 +8405,11 @@ part size = 1; read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -8364,6 +8496,11 @@ part memory "calibration" size = 1; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -8516,6 +8653,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -8760,6 +8902,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -9008,6 +9155,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -9246,6 +9398,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -9404,6 +9561,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -9553,6 +9715,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -9699,6 +9866,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -9845,6 +10017,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -9990,6 +10167,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -10183,6 +10365,11 @@ part size = 1; read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -10692,6 +10879,11 @@ part size = 1; read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -10844,6 +11036,11 @@ part size = 1; read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -11029,6 +11226,11 @@ part size = 1; read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -11203,6 +11405,11 @@ part size = 2; read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -11374,6 +11581,11 @@ part size = 2; read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -11514,6 +11726,11 @@ part size = 1; read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -11684,6 +11901,11 @@ part parent "pwm2" readback = 0x00 0x00; delay = 10; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -11713,6 +11935,11 @@ part parent "pwm2" readback = 0x00 0x00; delay = 10; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -11869,6 +12096,11 @@ part size = 1; read = "0011.0000--000x.xxxx--xxxx.xxaa--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -12121,6 +12353,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -12281,6 +12518,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -12438,6 +12680,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -12580,6 +12827,11 @@ part size = 1; read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 480; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -12721,6 +12973,11 @@ part size = 1; read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 480; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -12886,6 +13143,11 @@ part size = 1; read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 480; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -13286,6 +13548,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -13466,6 +13733,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -13645,6 +13917,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -13711,6 +13988,10 @@ part parent "t44" bitmask = 0xff; write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; ; + + memory "io" + size = 224; + ; ; #------------------------------------------------------------ @@ -13753,6 +14034,10 @@ part parent "t84" bitmask = 0xff; write = "1010.1100--1010.0100--xxxx.xxxx--iiii.iiii"; ; + + memory "io" + size = 224; + ; ; #------------------------------------------------------------ @@ -13897,6 +14182,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.000a--oooo.oooo"; ; + + memory "io" + size = 64; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -14036,6 +14326,11 @@ part size = 1; read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -14177,6 +14472,11 @@ part size = 1; read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -14316,6 +14616,11 @@ part size = 1; read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -14473,6 +14778,11 @@ part size = 1; read = "0011.1000--xxxx.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -14633,6 +14943,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -14774,6 +15089,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -14916,6 +15236,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -15058,6 +15383,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -15200,6 +15530,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -15346,6 +15681,11 @@ part size = 1; read = "0011.1000--0000.0000--xxxx.xxxx--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -15545,6 +15885,11 @@ part size = 1; read = "0011.1000--0000.0000--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -15745,6 +16090,11 @@ part size = 1; read = "0011.1000--0000.0000--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -18152,6 +18502,11 @@ part size = 1; read = "0011.1000--000x.xxxx--0000.0000--oooo.oooo"; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ @@ -18229,6 +18584,10 @@ part parent ".reduced_core_tiny" offset = 0x4000; blocksize = 128; ; + + memory "io" + size = 64; + ; ; #------------------------------------------------------------ @@ -18268,6 +18627,10 @@ part parent ".reduced_core_tiny" offset = 0x4000; blocksize = 128; ; + + memory "io" + size = 64; + ; ; #------------------------------------------------------------ @@ -18319,6 +18682,10 @@ part parent ".reduced_core_tiny" bitmask = 0x77; n_word_writes = 2; ; + + memory "io" + size = 64; + ; ; #------------------------------------------------------------ @@ -18351,6 +18718,10 @@ part parent ".reduced_core_tiny" bitmask = 0x77; n_word_writes = 4; ; + + memory "io" + size = 64; + ; ; #------------------------------------------------------------ @@ -18384,6 +18755,10 @@ part parent ".reduced_core_tiny" bitmask = 0x0f; ; + memory "io" + size = 64; + ; + memory "sigrow" size = 16; page_size = 16; @@ -18418,6 +18793,10 @@ part parent ".reduced_core_tiny" bitmask = 0x0f; ; + memory "io" + size = 64; + ; + memory "sigrow" size = 16; page_size = 16; @@ -18501,6 +18880,11 @@ part memory "signature" size = 3; ; + + memory "io" + size = 224; + offset = 0x20; + ; ; #------------------------------------------------------------ From f4b2f694510725caa70d5de8ece74177de5f2d50 Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Sun, 13 Aug 2023 00:02:23 +0100 Subject: [PATCH 3/3] Document io memory --- src/avrdude.1 | 15 +++++++++++++++ src/doc/avrdude.texi | 13 ++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/avrdude.1 b/src/avrdude.1 index 0340c4a0c..b12d56f87 100644 --- a/src/avrdude.1 +++ b/src/avrdude.1 @@ -770,6 +770,10 @@ flash-type memories the -U option can only write 0-bits but not 1-bits. Hence, usersig needs to be erased before a file can be uploaded to this memory region, e.g., using -T "erase usersig" -U usersig:w:parameters.hex:i +.It io +Volatile register memory; it cannot be accessed by external programming +methods only by bootloaders, which has limited use unless the bootloader +jumps to the application directly, i.e., without a WDT reset .El .Pp ATxmega devices have the following memory types in addition to eeprom, flash, signature and lock: @@ -795,6 +799,10 @@ Production signature (calibration) area .It usersig Additional flash memory page that can be used for firmware settings; this memory is not erased during a chip erase +.It io +Volatile register memory; +.Nm +can read this memory but not write to it using external programming .El .Pp Modern 8-bit AVR devices have the following memory types in addition to eeprom, flash, signature and lock: @@ -837,6 +845,13 @@ Extra page of EEPROM memory that can be used for firmware settings; this memory is not erased during a chip erase .It sib Special system information block memory with information about AVR family, chip revision etc. +.It io +Volatile register memory; +.Nm +can program this memory but this is of limited utility because anything +written to the io memory will be undefined or lost after reset; writing to +individual registers in the terminal can still be used, e.g., to test I/O +ports .El .Pp The diff --git a/src/doc/avrdude.texi b/src/doc/avrdude.texi index b53bbfecf..a3803ae7d 100644 --- a/src/doc/avrdude.texi +++ b/src/doc/avrdude.texi @@ -814,6 +814,10 @@ memories the @code{-U} option can only write 0-bits but not 1-bits. Hence, usersig needs to be erased before a file can be uploaded to this memory region, e.g., using @code{-T "erase usersig" -U usersig:w:parameters.hex:i} +@item io +Volatile register memory; it cannot be accessed by external programming +methods only by bootloaders, which has limited use unless the bootloader +jumps to the application directly, i.e., without a WDT reset @end table ATxmega devices have the following memory types in addition to @@ -838,6 +842,9 @@ Production signature (calibration) area @item usersig Additional flash memory page that can be used for firmware settings; this memory is not erased during a chip erase +@item io +Volatile register memory; AVRDUDE can read this memory but not write to it +using external programming @end table Modern 8-bit AVR devices have the following memory types in addition to @@ -880,7 +887,11 @@ Extra page of EEPROM memory that can be used for firmware settings; this memory is not erased during a chip erase @item sib Special system information block memory with information about AVR family, chip revision etc. - +@item io +Volatile register memory; AVRDUDE can program this memory but this is of +limited utility because anything written to the io memory will be undefined or +lost after reset; writing to individual registers in the terminal can +still be used, e.g., to test I/O ports @end table The @var{op} field specifies what operation to perform: