Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add partial urclock support for parts with bootloaders in low flash #1208

Merged
merged 1 commit into from
Dec 14, 2022

Conversation

stefanrueger
Copy link
Collaborator

Supposed to fix Issue #1200

Turns out I was blindsided by the fact that UPDI parts have their bootloader in low flash. Hence, urclock.c needed more change than I thought. With a bit of fair wind there is no regression, though, and optiboot_x and optiboot_dx bootloader work now with -c urclock. The medadata should appear at FLASHEND for UPDI parts and -c urclock should protect the bootloader in low flash. Currently, the user needs to supply -xbootsize=...; support for bootloader hashes and the urprotocol for UPDI parts will come at a later point (after v7.1).

Would be grateful for extensive tests (both previously working parts and optiboot_x and optiboot_dx bootloading).

@stefanrueger stefanrueger linked an issue Dec 3, 2022 that may be closed by this pull request
@mcuee mcuee added the enhancement New feature or request label Dec 4, 2022
@mcuee
Copy link
Collaborator

mcuee commented Dec 4, 2022

This seems to work fine for optiboot_x with ATtiny817.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM23 -p t817 -xbootsize=512 
-U .\Blink_Pro817.ino.t817opti.20c0.mD0.v264.hex -q

avrdude_pr1208: AVR device initialized and ready to accept instructions
avrdude_pr1208: device signature = 0x1e9320 (probably t817)
avrdude_pr1208: Note: flash memory has been specified, an erase cycle will be performed.
                To disable this feature, specify the -D option.
avrdude_pr1208: erasing chip
avrdude_pr1208: reading input file .\Blink_Pro817.ino.t817opti.20c0.mD0.v264.hex for flash
                with 468 bytes in 1 section within [0x200, 0x3d3]
                using 8 pages and 44 pad bytes
avrdude_pr1208: preparing flash input for device bootloader
avrdude_pr1208: writing 468 bytes flash ...
avrdude_pr1208: 468 bytes of flash written
avrdude_pr1208: verifying flash memory against .\Blink_Pro817.ino.t817opti.20c0.mD0.v264.hex
avrdude_pr1208: 468 bytes of flash verified

avrdude_pr1208 done.  Thank you.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM23 -p t817 -xbootsize=512
 -qq -xshowall
0 2022-11-27 21.05 Blink_Pro817.ino.t817opti.20c0.mD0.v264.hex 980 store 7157 meta 55 boot 512 
x0.0 ......... vector 0 (RESET) ATtiny817

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude -c xplainedpro_updi -p t817 -qqt
avrdude> dump fuses
>>> dump fuses
0000  00 00 02 ff 00 c4 04 00  02                       |.........       |

avrdude> dump flash
>>> dump flash
0000  01 c0 d8 c0 11 24 80 91  40 00 88 23 69 f0 28 2f  |.....$..@..#i.(/|
0010  30 e0 83 fd 03 c0 2d 7f  23 2b 31 f4 80 93 40 00  |0.....-.#+1...@.|
0020  8c bb 80 e0 af d0 ec c0  a8 95 22 9a 2a 9a 10 92  |..........".*...|
0030  01 02 80 91 82 12 83 70  81 30 61 f5 8c e5 90 e0  |.......p.0a.....|
0040  80 93 08 08 90 93 09 08  81 e0 80 93 0b 08 83 e0  |...... ..... ...|
0050  80 93 07 08 10 92 05 08  80 ec 80 93 06 08 8b e0  |................|
0060  91 d0 07 9a 87 e0 81 50  c1 f4 a8 95 0d e9 83 e0  |.......P.... ...|
0070  d8 2e 7c d0 81 34 e9 f4  79 d0 18 2f 8c d0 81 e0  |..|..4..y../....|
0080  12 38 21 f0 89 e0 11 38  09 f0 83 e0 68 d0 80 e1  |.8!....8 ...h...|
0090  66 d0 ef cf 83 e7 90 e0  d3 cf 17 9a 2e ec 36 e5  |f.............6.|
00a0  a8 95 90 91 04 08 97 fd  e1 cf 21 50 31 09 c1 f7  |..........!P1 ..|
00b0  da cf 82 34 19 f4 84 e1  76 d0 e9 cf 85 34 11 f4  |...4....v....4..|
00c0  85 e0 fa cf 85 35 31 f4  51 d0 c8 2f 4f d0 d8 2f  |.....51.Q../O../|
00d0  62 d0 dd cf 86 35 21 f4  84 e0 65 d0 80 e0 d6 cf  |b....5!...e.....|
00e0  84 36 b9 f4 43 d0 42 d0  18 2f 40 d0 86 34 79 f4  |.6..C.B../@..4y.|
00f0  d0 58 3c d0 88 83 21 96  11 50 d9 f7 4c d0 04 bf  |.X<...!..P..L...|

avrdude> dump flash
>>> dump flash
0100  d0 92 00 10 80 91 02 10  83 70 e1 f7 c0 cf dc 5e  |.........p.....^|
0110  f0 cf 84 37 91 f4 2a d0  29 d0 18 2f 27 d0 f8 2e  |...7..*.)../'...|
0120  3a d0 86 e4 f8 12 07 c0  d0 58 88 81 21 96 17 d0  |:........X..!...|
0130  11 50 d9 f7 ac cf dc 5e  f8 cf 85 37 51 f4 2b d0  |.P.....^...7Q.+.|
0140  80 91 00 11 0c d0 80 91  01 11 09 d0 80 91 02 11  |.... ..... .....|
0150  9d cf 81 35 09 f0 bc cf  81 e0 14 d0 b9 cf 90 91  |...5 ...........|
0160  04 08 95 ff fc cf 80 93  02 08 08 95 80 91 04 08  |................|
0170  87 ff fc cf 90 91 01 08  80 91 00 08 92 fd 01 c0  |................|
0180  a8 95 08 95 90 91 01 01  90 fd fc cf 98 ed 94 bf  |................|
0190  80 93 00 01 08 95 ea df  80 32 19 f0 81 e0 f2 df  |.........2......|
01a0  ff cf 84 e1 dc cf cf 93  c8 2f e0 df c1 50 e9 f7  |........./...P..|
01b0  cf 91 f1 cf 68 30 48 f4  8d e9 84 bf 60 93 00 10  |....h0H.....`...|
01c0  80 91 02 10 83 70 e1 f7  08 95 fc 01 40 83 08 95  |.....p......@...|
01d0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
01e0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
01f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff 01 09  |............... |

avrdude> dump flash
>>> dump flash
0200  19 c0 34 c0 33 c0 32 c0  31 c0 30 c0 2f c0 2e c0  |..4.3.2.1.0./...|
0210  2d c0 2c c0 2b c0 2a c0  29 c0 28 c0 63 c0 26 c0  |-.,.+.*.).(.c.&.|
0220  25 c0 24 c0 23 c0 22 c0  21 c0 20 c0 1f c0 1e c0  |%.$.#.".!. .....|
0230  1d c0 1c c0 11 24 1f be  cf ef cd bf df e3 de bf  |.....$..........|
0240  80 91 40 00 80 93 40 00  81 11 05 c0 98 ed 21 e0  |..@...@.......!.|
0250  94 bf 20 93 41 00 8c bb  2e e3 a0 e0 be e3 01 c0  |.. .A...........|
0260  1d 92 aa 30 b2 07 e1 f7  77 d0 b2 c0 c9 cf 8f b7  |...0....w.......|
0270  f8 94 40 91 02 3e 50 91  03 3e 60 91 04 3e 70 91  |..@..>P..>`..>p.|
0280  05 3e 8f bf 2f b7 f8 94  80 91 02 3e 90 91 03 3e  |.>../......>...>|
0290  a0 91 04 3e b0 91 05 3e  2f bf 84 1b 95 0b a6 0b  |...>...>/.... . |
02a0  b7 0b 88 3e 93 40 a1 05  b1 05 60 f3 08 95 90 e1  |. .>.@....`.....|
02b0  81 11 11 c0 90 93 26 04  90 91 20 04 94 fd 0a c0  |......&... ... .|
02c0  9f b7 f8 94 81 11 0a c0  80 91 34 04 87 7f 80 93  |...... ...4.....|
02d0  34 04 9f bf 08 95 90 93  25 04 ee cf 80 91 34 04  |4.......%.....4.|
02e0  88 60 f5 cf ef 93 ff 93  e0 e0 fe e3 8f 93 8f b7  |.`..............|
02f0  8f 93 9f 93 7f 93 70 e0  80 81 91 81 80 5d 9c 4f  |......p......].O|

avrdude> dump flash
>>> dump flash
0300  80 83 91 83 88 5e 93 40  18 f0 80 83 91 83 7f 5f  |.....^.@......._|
0310  92 81 97 0f 92 83 80 e0  93 81 98 1f 93 83 94 81  |................|
0320  98 1f 94 83 95 81 98 1f  95 83 96 81 9f 5f 96 83  |............._..|
0330  97 81 9f 4f 97 83 90 85  9f 4f 90 87 91 85 9f 4f  |...O.....O.....O|
0340  91 87 81 e0 80 93 8d 0a  7f 91 9f 91 8f 91 8f bf  |....... ........|
0350  8f 91 ff 91 ef 91 18 95  88 ed 90 e0 84 bf 90 93  |................|
0360  61 00 83 e5 80 93 02 06  8d e0 80 93 05 06 80 e2  |a...............|
0370  80 93 03 06 e1 e0 e0 93  00 06 e0 93 03 0a 8e ef  |............. ..|
0380  80 93 26 0a 80 93 27 0a  8b e0 80 93 00 0a 8d ef  |..& ..' ..... ..|
0390  91 e0 80 93 ae 0a 90 93  af 0a 10 92 81 0a 80 e8  |..... ... ... ..|
03a0  80 93 82 0a e0 93 8c 0a  81 e1 80 93 80 0a 78 94  |... ... ..... x.|
03b0  e2 95 ee 0f f0 e0 f4 60  80 e1 81 83 84 89 87 7f  |.......`........|
03c0  84 8b 81 e0 74 df 53 df  80 e0 71 df 50 df f9 cf  |....t.S...q.P...|
03d0  f8 94 ff cf ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
03e0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
03f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

avrdude> dump flash 0x1f00
>>> dump flash 0x1f00
1f00  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1f10  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1f20  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1f30  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1f40  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1f50  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1f60  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1f70  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1f80  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1f90  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1fa0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1fb0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1fc0  ff ff ff ff ff ff ff ff  ff 42 6c 69 6e 6b 5f 50  |.........Blink_P|
1fd0  72 6f 38 31 37 2e 69 6e  6f 2e 74 38 31 37 6f 70  |ro817.ino.t817op|
1fe0  74 69 2e 32 30 63 30 2e  6d 44 30 2e 76 32 36 34  |ti.20c0.mD0.v264|
1ff0  2e 68 65 78 00 e6 07 0b  1b 15 05 d4 03 f5 1b 2c  |.hex... .......,|

avrdude> quit
>>> quit
avrdude>

@mcuee
Copy link
Collaborator

mcuee commented Dec 4, 2022

No regression for optiboot 8.3 either.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM1 -p m328p
 -U .\hex\Blink.ino.standard.hex

avrdude_pr1208: AVR device initialized and ready to accept instructions
avrdude_pr1208: device signature = 0x1e950f (probably m328p)
avrdude_pr1208: Note: flash memory has been specified, an erase cycle will be performed.
                To disable this feature, specify the -D option.
avrdude_pr1208: erasing chip
                delaying chip erase until first -U upload to flash
avrdude_pr1208: reading input file .\hex\Blink.ino.standard.hex for flash
                with 924 bytes in 1 section within [0, 0x39b]
                using 8 pages and 100 pad bytes
avrdude_pr1208: preparing flash input for device bootloader
avrdude_pr1208: writing 924 bytes flash ...

Writing | ################################################## | 100% 7.51 s

avrdude_pr1208: 924 bytes of flash written
avrdude_pr1208: verifying flash memory against .\hex\Blink.ino.standard.hex

Reading | ################################################## | 100% 5.05 s

avrdude_pr1208: 924 bytes of flash verified

avrdude_pr1208 done.  Thank you.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM1 -p m328p -xshowall

avrdude_pr1208: AVR device initialized and ready to accept instructions
0 2022-06-10 21.21 Blink.ino.standard.hex 924 store 31298 meta 34 boot 512 
o8.3 --s-h-r-- vector 0 (RESET) ATmega328P

@mcuee
Copy link
Collaborator

mcuee commented Dec 4, 2022

No issues with optiboot_x for ATmega4808 from @MCUdude's MegaCoreX, using Nano 4808 board.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c pickit4_updi -p m4808
 -U .\Optiboot_mega0_UART2_DEF_115200_C2.hex -qq && echo OK
OK

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c pickit4_updi -p m4808 -qqt
avrdude> dump fuses
>>> dump fuses
0000  00 54 02 ff 00 c4 07 00  00                       |.T.......       |

avrdude> write fuse8 0 0x02
>>> write fuse8 0 0x02
avrdude> flush
>>> flush
avrdude> dump fuses
>>> dump fuses
0000  00 54 02 ff 00 c4 07 00  02                       |.T.......       |

avrdude> quit
>>> quit
avrdude>

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM13 -p m4808
 -xbootsize=512 -xshowall

avrdude_pr1208: AVR device initialized and ready to accept instructions
0 0000-00-00 00.00  application 0 store 0 meta 0 boot 512 x0.0 ......... vector 0 (RESET) ATmega4808

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM13 -p m4808
 -xbootsize=512 -U .\Blink.ino_atmega4808_16000000L.hex -q

avrdude_pr1208: AVR device initialized and ready to accept instructions
avrdude_pr1208: device signature = 0x1e9650 (probably m4808)
avrdude_pr1208: Note: flash memory has been specified, an erase cycle will be performed.
                To disable this feature, specify the -D option.
avrdude_pr1208: erasing chip
avrdude_pr1208: reading input file .\Blink.ino_atmega4808_16000000L.hex for flash
                with 758 bytes in 1 section within [0x200, 0x4f5]
                using 6 pages and 10 pad bytes
avrdude_pr1208: preparing flash input for device bootloader
avrdude_pr1208: writing 758 bytes flash ...
avrdude_pr1208: 758 bytes of flash written
avrdude_pr1208: verifying flash memory against .\Blink.ino_atmega4808_16000000L.hex
avrdude_pr1208: 758 bytes of flash verified

avrdude_pr1208 done.  Thank you.

(unplug and plug to enter the bootloader -- only got 8s delay)

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM13 -p m4808
 -xbootsize=512 -xshowall

avrdude_pr1208: AVR device initialized and ready to accept instructions
0 2022-11-27 19.30 Blink.ino_atmega4808_16000000L.hex 1270 store 47836 meta 46 boot 512 
x0.0 ......... vector 0 (RESET) ATmega4808

@mcuee
Copy link
Collaborator

mcuee commented Dec 4, 2022

No issues with picoboot either.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c usbasp -p m328p
 -U .\picobootArduino328v3b2.hex -qq && echo OK
OK
PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM1 -b 250000
 -p m328p -xshowall -xstrict

avrdude_pr1208: AVR device initialized and ready to accept instructions
0 0000-00-00 00.00  application 0 store 0 meta 0 boot 512 x0.0 ......... vector 0 (RESET) ATmega328P

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM1 -b 250000
 -p m328p -xstrict -U .\hex\Blink.ino.standard.hex -q

avrdude_pr1208: AVR device initialized and ready to accept instructions
avrdude_pr1208: device signature = 0x1e950f (probably m328p)
avrdude_pr1208: Note: flash memory has been specified, an erase cycle will be performed.
                To disable this feature, specify the -D option.
avrdude_pr1208: erasing chip
avrdude_pr1208: reading input file .\hex\Blink.ino.standard.hex for flash
                with 924 bytes in 1 section within [0, 0x39b]
                using 8 pages and 100 pad bytes
avrdude_pr1208: preparing flash input for device bootloader
avrdude_pr1208: writing 924 bytes flash ...
avrdude_pr1208: 924 bytes of flash written
avrdude_pr1208: verifying flash memory against .\hex\Blink.ino.standard.hex
avrdude_pr1208: 924 bytes of flash verified

avrdude_pr1208 done.  Thank you.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM1 -b 250000
 -p m328p -xshowall -xstrict

avrdude_pr1208: AVR device initialized and ready to accept instructions
0 2022-06-10 21.21 Blink.ino.standard.hex 924 store 31298 meta 34 boot 512 
x0.0 ......... vector 0 (RESET) ATmega328P

@mcuee
Copy link
Collaborator

mcuee commented Dec 4, 2022

No issues with Optiboot 4.4 (Arduino version).

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c usbasp -p m328p
 -U .\optiboot_atmega328.hex  -qq && echo OK
OK

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM1 -p m328p -xshowall

avrdude_pr1208: AVR device initialized and ready to accept instructions
0 0000-00-00 00.00  application 0 store 0 meta 0 boot 512 o4.4 --s-h-r-- vector 0 (RESET) ATmega328P

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM1 -p m328p
 -U .\hex\Blink.ino.standard.hex

avrdude_pr1208: AVR device initialized and ready to accept instructions
avrdude_pr1208: device signature = 0x1e950f (probably m328p)
avrdude_pr1208: Note: flash memory has been specified, an erase cycle will be performed.
                To disable this feature, specify the -D option.
avrdude_pr1208: erasing chip
                delaying chip erase until first -U upload to flash
avrdude_pr1208: reading input file .\hex\Blink.ino.standard.hex for flash
                with 924 bytes in 1 section within [0, 0x39b]
                using 8 pages and 100 pad bytes
avrdude_pr1208: preparing flash input for device bootloader
avrdude_pr1208: writing 924 bytes flash ...

Writing | ################################################## | 100% 6.50 s

avrdude_pr1208: 924 bytes of flash written
avrdude_pr1208: verifying flash memory against .\hex\Blink.ino.standard.hex

Reading | ################################################## | 100% 5.00 s

avrdude_pr1208: 924 bytes of flash verified

avrdude_pr1208 done.  Thank you.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM1 -p m328p -xshowall

avrdude_pr1208: AVR device initialized and ready to accept instructions
0 2022-06-10 21.21 Blink.ino.standard.hex 924 store 31298 meta 34 boot 512 
o4.4 --s-h-r-- vector 0 (RESET) ATmega328P

@mcuee
Copy link
Collaborator

mcuee commented Dec 4, 2022

It is okay for Optiboot 8.0 version from @MCUdude's MiniCore.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c usbasp -p m328p
 -U .\optiboot_flash_atmega328p_UART0_115200_16000000L_B5.hex -qq && echo OK
OK

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM1 -p m328p
 -xshowall -xbootsize=512

avrdude_pr1208: AVR device initialized and ready to accept instructions
0 0000-00-00 00.00  application 0 store 0 meta 0 boot 512 o8.0 -?s-?-r-- vector 0 (RESET) ATmega328P

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM1 -p m328p
 -U .\hex\Blink.ino.standard.hex -xbootsize=512

avrdude_pr1208: AVR device initialized and ready to accept instructions
avrdude_pr1208: device signature = 0x1e950f (probably m328p)
avrdude_pr1208: Note: flash memory has been specified, an erase cycle will be performed.
                To disable this feature, specify the -D option.
avrdude_pr1208: erasing chip
                delaying chip erase until first -U upload to flash
avrdude_pr1208: reading input file .\hex\Blink.ino.standard.hex for flash
                with 924 bytes in 1 section within [0, 0x39b]
                using 8 pages and 100 pad bytes
avrdude_pr1208: preparing flash input for device bootloader
avrdude_pr1208: writing 924 bytes flash ...

Writing | ################################################## | 100% 7.58 s

avrdude_pr1208: 924 bytes of flash written
avrdude_pr1208: verifying flash memory against .\hex\Blink.ino.standard.hex

Reading | ################################################## | 100% 5.03 s

avrdude_pr1208: 924 bytes of flash verified

avrdude_pr1208 done.  Thank you.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM1 -p m328p
 -xshowall -xbootsize=512

avrdude_pr1208: AVR device initialized and ready to accept instructions
0 2022-06-10 21.21 Blink.ino.standard.hex 924 store 31298 meta 34 boot 512 
o8.0 -?s-?-r-- vector 0 (RESET) ATmega328P

@mcuee
Copy link
Collaborator

mcuee commented Dec 4, 2022

Today's last test with optiboot_dx.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM6 -p avr128db48
 -xshowall -xbootsize=512

avrdude_pr1208: AVR device initialized and ready to accept instructions
0 0000-00-00 00.00  application 0 store 0 meta 0 boot 512 x0.0 ......... vector 0 (RESET) AVR128DB48

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM6 -p avr128db48
 -xbootsize=512 -U .\Blink.ino.avr128db48opti.16c1.mB2.wO.v1410.hex

avrdude_pr1208: AVR device initialized and ready to accept instructions
avrdude_pr1208: device signature = 0x1e970c (probably avr128db48)
avrdude_pr1208: Note: flash memory has been specified, an erase cycle will be performed.
                To disable this feature, specify the -D option.
avrdude_pr1208: erasing chip
avrdude_pr1208: reading input file .\Blink.ino.avr128db48opti.16c1.mB2.wO.v1410.hex for flash
                with 1040 bytes in 1 section within [0x200, 0x60f]
                using 3 pages and 496 pad bytes
avrdude_pr1208: preparing flash input for device bootloader
avrdude_pr1208: writing 1040 bytes flash ...

Writing | ################################################## | 100% 0.25 s

avrdude_pr1208: 1040 bytes of flash written
avrdude_pr1208: verifying flash memory against .\Blink.ino.avr128db48opti.16c1.mB2.wO.v1410.hex

Reading | ################################################## | 100% 0.20 s

avrdude_pr1208: 1040 bytes of flash verified

avrdude_pr1208 done.  Thank you.

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c urclock -P COM6 -p avr128db48
 -xshowall -xbootsize=512

avrdude_pr1208: AVR device initialized and ready to accept instructions
0 2022-10-11 21.15 Blink.ino.avr128db48opti.16c1.mB2.wO.v1410.hex 1552 store 129458 meta 62 boot 512 
x0.0 ......... vector 0 (RESET) AVR128DB48

PS C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208 -c pkobn_updi -p avr128db48 -qqt
avrdude> dump flash 0 0x40
>>> dump flash 0 0x40
0000  11 24 80 91 40 00 81 11  05 c0 98 ed 21 e0 94 bf  |.$..@.......!...|
0010  20 93 41 00 83 fd 02 c0  82 30 21 f4 80 93 40 00  | .A......0!...@.|
0020  8c bb ee c0 8b e0 bf d0  20 9a 28 9a 10 92 e2 05  |........ .(.....|
0030  8a e8 80 93 68 08 83 e0  80 93 67 08 80 ec 80 93  |....h.....g.....|

avrdude> dump flash 0x200 0x40
>>> dump flash 0x200 0x40
0200  79 c0 00 00 87 c0 00 00  85 c0 00 00 2c c1 00 00  |y...........,...|
0210  81 c0 00 00 7f c0 00 00  7d c0 00 00 7b c0 00 00  |........}...{...|
0220  79 c0 00 00 77 c0 00 00  75 c0 00 00 73 c0 00 00  |y...w...u...s...|
0230  71 c0 00 00 6f c0 00 00  6d c0 00 00 6b c0 00 00  |q...o...m...k...|

>>> dump flash 0x1ff00
1ff00  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1ff10  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1ff20  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1ff30  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1ff40  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1ff50  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1ff60  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1ff70  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1ff80  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1ff90  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1ffa0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1ffb0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1ffc0  ff ff 42 6c 69 6e 6b 2e  69 6e 6f 2e 61 76 72 31  |..Blink.ino.avr1|
1ffd0  32 38 64 62 34 38 6f 70  74 69 2e 31 36 63 31 2e  |28db48opti.16c1.|
1ffe0  6d 42 32 2e 77 4f 2e 76  31 34 31 30 2e 68 65 78  |mB2.wO.v1410.hex|
1fff0  00 e6 07 0a 0b 15 0f 10  06 00 00 b2 f9 01 00 2f  |...  ........../|

avrdude> quit
>>> quit
avrdude>

@mcuee
Copy link
Collaborator

mcuee commented Dec 4, 2022

@stefanrueger

So far so good. And I think we are lucky that I do not need to use -xstrict or -xdelay with the exception for picoboot under Windows. That is nice.

@stefanrueger
Copy link
Collaborator Author

@mcuee Grazie mille for testing and checking against regression.

we are lucky that I do not need to use -xstrict or -xdelay with the exception for picoboot under Windows

Well, it was hard calibration work for which you carried out many a test! Without these it wouldn't have been possible :)

@mcuee
Copy link
Collaborator

mcuee commented Dec 6, 2022

BTW, I kind of figured out how to get GNU Readline to work with MSVC build. The binary seems to work fine (history, pipe and keep-alive) with a minor issue on the piping side.

C:\work\avr\avrdude_test\avrdude_bin> echo "dump flash 0x1f80 0x80" | .\avrdude_pr1208_msvc_readline
 -c urclock -P COM13
 -p t817 -xbootsize=512 -qqt
avrdude> dump flash 0x1f80 0x80
>>> dump flash 0x1f80 0x80
1f80  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1f90  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1fa0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1fb0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
1fc0  ff ff ff ff ff 42 6c 69  6e 6b 5f 38 31 37 70 72  |.....Blink_817pr|
1fd0  6f 2e 69 6e 6f 2e 69 6e  6f 2e 74 38 31 37 6f 70  |o.ino.ino.t817op|
1fe0  74 69 2e 32 30 63 30 2e  6d 44 30 2e 76 32 36 34  |ti.20c0.mD0.v264|
1ff0  2e 68 65 78 00 e6 07 0c  06 0b 18 bc 03 09 1c 30  |.hex... . ... .0|

avrdude>
(arg: 4) (need to hit CTRL-C to exit).

C:\work\avr\avrdude_test\avrdude_bin> .\avrdude_pr1208_msvc_readline -c urclock -P COM13 -p t817
 -xbootsize=512 -qq -xshowall
0 2022-12-06 11.24 Blink_817pro.ino.ino.t817opti.20c0.mD0.v264.hex 956 store 7177 meta 59 
boot 512 x0.0 ......... vector 0 (RESET) ATtiny817

avrdude_msvc_readline_pr1208.zip

@mcuee
Copy link
Collaborator

mcuee commented Dec 8, 2022

I have also done some tests under Linux and macOS and no issues found.
I think this PR can be merged now.

@stefanrueger
Copy link
Collaborator Author

Ok, thanks. Planning on a merge fest once the other PRs are finalised.

@stefanrueger stefanrueger merged commit bbd3ed2 into avrdudes:main Dec 14, 2022
@stefanrueger stefanrueger deleted the urclock-updi branch December 14, 2022 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

urclock support for optiboot_x and optiboot_dx
2 participants