Compare commits
129 Commits
91be527265
...
15fe12b1a9
Author | SHA1 | Date |
---|---|---|
Marius Greuel | 15fe12b1a9 | |
Marius Greuel | b8420ee52d | |
Marius Greuel | 6ebbd4e162 | |
Marius Greuel | 4b2bf38849 | |
Marius Greuel | 9d6420e723 | |
Marius Greuel | bc9b67a153 | |
Marius Greuel | 93b2a56c0e | |
Joerg Wunsch | a855692d97 | |
Joerg Wunsch | ec50337434 | |
Joerg Wunsch | a2e456ca8a | |
Joerg Wunsch | 43ddea9102 | |
Joerg Wunsch | a4c9fcdcd7 | |
Joerg Wunsch | 28ccd82edc | |
Jörg Wunsch | ca16fc2ce6 | |
Jörg Wunsch | d7c59ca2f9 | |
Joerg Wunsch | 4bcd0eaa1d | |
Joerg Wunsch | 08ad5ea445 | |
Joerg Wunsch | 5a3ff78844 | |
Joerg Wunsch | 74a92d7991 | |
MCUdude | 9d025e6a70 | |
Tomasz 'CeDeROM' CEDRO | b99a145b9f | |
Joerg Wunsch | 60960ba590 | |
Jörg Wunsch | 99a75701b1 | |
Jörg Wunsch | abe7180bb8 | |
per1234 | 157b6a63c1 | |
MCUdude | 1363c7fe76 | |
Joerg Wunsch | 7e26a15375 | |
Jörg Wunsch | e84210c6b0 | |
MCUdude | 08bd5fa938 | |
MCUdude | 17b67da03e | |
MCUdude | 795dd91575 | |
MCUdude | 8f100f5df3 | |
MCUdude | f0f9059ade | |
Nav | e069871c8e | |
Joerg Wunsch | 0aa43968a0 | |
Hans | f22bc62b06 | |
Hans | d09a4e93a2 | |
Hans | aa7ae7bb87 | |
Hans | 1d0cbc2246 | |
Joerg Wunsch | 79c4137289 | |
Joerg Wunsch | 8697f6def7 | |
Joerg Wunsch | 981a6f1f20 | |
Joerg Wunsch | c64db5fb76 | |
Joerg Wunsch | 50c373bf71 | |
Jörg Wunsch | 0c722bf288 | |
Jörg Wunsch | 28d1442fc8 | |
Jörg Wunsch | 75e4d06463 | |
Jörg Wunsch | 99f191a0ca | |
Joerg Wunsch | 33bace0cee | |
Joerg Wunsch | 0c912a201f | |
Joerg Wunsch | 31feb9ff75 | |
Joerg Wunsch | c5a28eedc0 | |
Joerg Wunsch | 29a01c1047 | |
MCUdude | 426ea1fa78 | |
MCUdude | 6a5988ad64 | |
MCUdude | dcf771424b | |
Joerg Wunsch | 67b56d322b | |
Joerg Wunsch | 27d201acb1 | |
Joerg Wunsch | ded30f86bc | |
Joerg Wunsch | 9bc4a2463d | |
Joerg Wunsch | 8ad55e07ac | |
Joerg Wunsch | d89817ddb9 | |
Joerg Wunsch | fc6a71a142 | |
Joerg Wunsch | da1271642e | |
Joerg Wunsch | 0e441013e9 | |
Joerg Wunsch | c5f7939fca | |
Joerg Wunsch | 297d81818a | |
Joerg Wunsch | 7391e569b3 | |
Joerg Wunsch | 67ab74cd6a | |
Joerg Wunsch | 631f671fe8 | |
MCUdude | 248b554e8d | |
MCUdude | 40e3aa1790 | |
MCUdude | dca5fc92bf | |
MCUdude | 4e05a8fa41 | |
MCUdude | 1299d6b8bd | |
MCUdude | da315d7323 | |
Joerg Wunsch | 416c465ec0 | |
MCUdude | 41f524c1ba | |
MCUdude | 5ebb9047be | |
MCUdude | fde7881611 | |
MCUdude | 1c94c95f1c | |
Joerg Wunsch | e2995857ac | |
Joerg Wunsch | a4cbd5c6fc | |
Joerg Wunsch | 87b39637ff | |
Joerg Wunsch | 34168759b0 | |
Joerg Wunsch | c746c9bc9e | |
Joerg Wunsch | 65618ed655 | |
Joerg Wunsch | 00ea962abe | |
Joerg Wunsch | d62f309a00 | |
Joerg Wunsch | 92a5ae20a6 | |
Joerg Wunsch | 5cbc9c37fc | |
Jörg Wunsch | 0f4b5b223b | |
Jörg Wunsch | 0b82b5c573 | |
Jörg Wunsch | 9355d67e0f | |
MCUdude | d9c52249a9 | |
MCUdude | c7174d7678 | |
MCUdude | df6e2eea12 | |
Joerg Wunsch | 0d58adb10a | |
Jörg Wunsch | ebb1849724 | |
Jan Egil Ruud | 0c8b42524e | |
MCUdude | b688b1f601 | |
MCUdude | d89f695c31 | |
MCUdude | 1f2b570216 | |
Joerg Wunsch | 64cc54ac35 | |
Jörg Wunsch | e2e5e44bab | |
MCUdude | 07ea8f5e09 | |
Joerg Wunsch | 0269817217 | |
Joerg Wunsch | fe6290072a | |
Jörg Wunsch | 008f95f6ff | |
MCUdude | a73567893b | |
MCUdude | fa706f0d01 | |
MCUdude | 3532c567ac | |
Joerg Wunsch | 14f646822c | |
Jörg Wunsch | bb73ade70b | |
MCUdude | bb99a36a14 | |
Joerg Wunsch | 0d7d034d24 | |
MCUdude | a9b756e5c7 | |
Dawid Buchwald | cf67a76c23 | |
MCUdude | 0e29b43bd0 | |
MCUdude | 4b9219edee | |
MCUdude | 62f3b84eee | |
Dawid Buchwald | 066f54fbfa | |
Hans | c345985928 | |
MCUdude | 6e7f38e81f | |
MCUdude | 10e05eed21 | |
MCUdude | 551046052e | |
MCUdude | 2a92b8cce4 | |
MCUdude | c007dc7d24 | |
MCUdude | 2589b17640 |
|
@ -20,7 +20,11 @@ name: Build
|
|||
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- 'onlinedocs'
|
||||
pull_request:
|
||||
branches-ignore:
|
||||
- 'onlinedocs'
|
||||
workflow_call:
|
||||
|
||||
env:
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
# cmake --build build
|
||||
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
project(avrdude VERSION 6.99)
|
||||
project(avrdude VERSION 7.0)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED True)
|
||||
|
|
46
NEWS
46
NEWS
|
@ -5,7 +5,7 @@ Approximate change log for AVRDUDE by version.
|
|||
(For detailed changes, see the version control system logs.)
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Changes since version 6.4:
|
||||
Changes in version 7.0:
|
||||
|
||||
* Major changes compared to the previous version:
|
||||
|
||||
|
@ -18,6 +18,12 @@ Changes since version 6.4:
|
|||
programmers on parallel or serial ports) virtually doesn't exist
|
||||
anymore, and the fuse combination that was covered by it do not
|
||||
match the fuses of modern AVR devices anyway.
|
||||
- avrdude.conf is now being looked up in the location of the
|
||||
executable file first, before considering the configured default
|
||||
location; this eases a "portable use" where the entire suite is
|
||||
not installed into its configured default location. (Basically
|
||||
only relevant for unixoid systems; on Windows, this search order
|
||||
has been used for many years already.)
|
||||
|
||||
* New devices supported:
|
||||
|
||||
|
@ -35,6 +41,7 @@ Changes since version 6.4:
|
|||
- ATtiny3224, ATtiny3226 and ATtiny3227
|
||||
- AVR16DD14/20/28/32, AVR32DD14/20/28/32 and AVR64DD14/20/28/32
|
||||
- AVR8EA28/32, AVR16EA28/32/48, AVR32EA28/32/48 and AVR64EA28/32/64
|
||||
- ATmega16U4
|
||||
|
||||
|
||||
* New programmers supported:
|
||||
|
@ -45,6 +52,8 @@ Changes since version 6.4:
|
|||
- Teensy bootloader (PR #802)
|
||||
- Micronucleus bootloader (PR #786)
|
||||
- ft232h (generic variant, PR #842)
|
||||
- Kristech KT-LINK FT2232H interface with IO switching and voltage
|
||||
buffers (PR #930)
|
||||
|
||||
* Issues fixed:
|
||||
|
||||
|
@ -70,6 +79,20 @@ Changes since version 6.4:
|
|||
- Compiler warnings #856
|
||||
- Can't get serialupdi to work #874
|
||||
- Rework HID support for Windows #881
|
||||
- List of signing keys? #884
|
||||
- Pickit4 UPDI is writing at offset 0x4000 into flash instead of 0x0000. #892
|
||||
- SerialUPDI programmer can't write to usersig/userrow in terminal mode #889
|
||||
- Signature read command for ATmega165* was wrong (no-id)
|
||||
- Cannot use non-standard baud rates for uploading on MacOS #771
|
||||
- Wrong values in avrdude.conf #897
|
||||
- AVR-Eclipse plugin broken by missing -u commandline option #890
|
||||
- Timeout passed to hid_read_timeout() is too short for instances
|
||||
where the EDBG AVRISP 'Enter Programming Mode' command fails #900
|
||||
- Terminal write mode doesn't support string input (yet) #913
|
||||
- Terminal mode: memory fill with strings may cause Avrdude to crash. #922
|
||||
- Some parts have wrong or missing ISP commands #915
|
||||
- Incorrect -b conversion for linuxspi programmer #927
|
||||
- ATtiny43U calibration memory size #921
|
||||
|
||||
* Pull requests:
|
||||
|
||||
|
@ -138,6 +161,27 @@ Changes since version 6.4:
|
|||
- Fix Curiosity Nano target voltage #878
|
||||
- Smallest possible fix for PL2303HX #885
|
||||
- Add missing USBtiny derived programmers #873
|
||||
- Cleanup of POSIX serial init code #886
|
||||
- Avrdude terminal write improvements #880
|
||||
- Add userrow and usersig aliases #888
|
||||
- For UPDI devices do not add offset when accessing flash. #895
|
||||
- Support both userrow and usersig names #893
|
||||
- Fix ugly terminal write bug #896
|
||||
- Improve terminal read functionality #894
|
||||
- Macos nonstandard baudrates #898
|
||||
- Fix errors in Avrdude.conf #899
|
||||
- Minor terminal write improvements #902
|
||||
- Term docs #903
|
||||
- Add progressbar for read and write command #912
|
||||
- Add MacOS serial/parallel port note #908
|
||||
- Add ATmega16U4 to avrdude.conf #910
|
||||
- Mask out unused ATmega32U4 efuse bits #909
|
||||
- Increased timeout passed to hid_read_timeout() #901
|
||||
- Add terminal write string functionality #914
|
||||
- Update documentation link to new URL #929
|
||||
- Fix terminal write buffer overflow issue #924
|
||||
- Fix linuxspi baud to clock period calculation #931
|
||||
- Added KT-LINK FT2232H interface with IO switching and voltage buffers. #930
|
||||
|
||||
* Internals:
|
||||
|
||||
|
|
|
@ -16,6 +16,10 @@ with the help of [various contributors](./AUTHORS).
|
|||
The latest version of AVRDUDE is always available here:\
|
||||
<https://github.com/avrdudes/avrdude>
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation for current and previous releases is [on Github Pages](https://avrdudes.github.io/avrdude/).
|
||||
|
||||
## Getting AVRDUDE for Windows
|
||||
|
||||
To get AVRDUDE for Windows, install the latest version from the [Releases](http://download.savannah.gnu.org/releases/avrdude/) page.
|
||||
|
@ -57,4 +61,4 @@ avrdude -c arduino -P COM1 -b 115200 -p atmega328p -D -U flash:w:objs/blink.hex:
|
|||
|
||||
There are many different programmers and options that may be required for the programming to succeed.
|
||||
|
||||
For more information, refer to the [AVRDUDE documentation](http://download.savannah.gnu.org/releases/avrdude/avrdude-doc-6.4.pdf).
|
||||
For more information, refer to the [AVRDUDE documentation](https://avrdudes.github.io/avrdude/).
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[![Build Status](https://github.com/mariusgreuel/avrdude/actions/workflows/build.yml/badge.svg?branch=windows)](https://github.com/mariusgreuel/avrdude/actions/workflows/build.yml)
|
||||
|
||||
This is a fork of AVRDUDE 6.4 from <https://github.com/avrdudes/avrdude>.
|
||||
This is a fork of AVRDUDE 7.0 from <https://github.com/avrdudes/avrdude>.
|
||||
|
||||
The purpose of this fork is to add better support for Windows to bring it on par with the Linux version of AVRDUDE.
|
||||
|
||||
|
@ -19,7 +19,11 @@ Noteable changes include:
|
|||
- [Support Visual Studio](#support-visual-studio)
|
||||
- [Miscellaneous bug-fixes and patches](#miscellaneous-bug-fixes-and-patches)
|
||||
|
||||
The original AVRDUDE project homepage can be found here <https://savannah.nongnu.org/projects/avrdude>.
|
||||
The original AVRDUDE project homepage can be found here <https://github.com/avrdudes/avrdude>.
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation for current and previous releases is [on Github Pages](https://avrdudes.github.io/avrdude/).
|
||||
|
||||
## Download
|
||||
|
||||
|
|
|
@ -593,6 +593,38 @@ programmer
|
|||
reset = 3; # TMS 7
|
||||
;
|
||||
|
||||
# Kristech KT-LINK FT2232H interface with IO switching and voltage buffers.
|
||||
# Created on 20220410 by CeDeROM Tomasz CEDRO (www.cederom.io).
|
||||
# Interface DataSheet: https://kristech.pl/files/KT-LINK-UM-ENG.pdf
|
||||
# AVRDUDE FT2232H PIN NUMBER DECODE:
|
||||
# | 0 | 1 | .. | 7 | 8 | 9 | .. | 15 |
|
||||
# | ADBUS0 | ADBUS1 | .. | ADBUS7 | ACBUS0 | ACBUS1 | .. | ACBUS7 |
|
||||
# KT-LINK JTAG CONN:
|
||||
# 1=Vsense(->EXT13), 19=5V(EXT1->EXT3), 20=GND, 3=TPIRST, 9=TPICLK, 7=TPIDATA.
|
||||
# INTERNALS CONFIGURATION ("~" MEANS ACTIVE LOW):
|
||||
# ~TRST_EN=10(ACBUS2), ~CLK_EN=14(ACBUS6), ~MOSI_EN=13(ACBUS5),
|
||||
# TMS_SEL=5(ADBUS5), ~TMS_EN=12(ACBUS4), LED=~15(ACBUS7).
|
||||
# CONNECTION NOTES:
|
||||
# * Connect EXT connector pin 1 with 3 to get 5V on JTAG connector pin 19.
|
||||
# * Connect JTAG connector pin 1 to 5V (i.e. EXT pin 13 or JTAG pin 19).
|
||||
# * For TPI connection use resistors: TDO --[470R]-- TPIDATA --[470R]-- TDI.
|
||||
# * Powering target from JTAG pin 19 allows KT-LINK current measurement.
|
||||
programmer
|
||||
id = "ktlink";
|
||||
desc = "KT-LINK FT2232H interface with IO switching and voltage buffers.";
|
||||
type = "avrftdi";
|
||||
connection_type = usb;
|
||||
usbvid= 0x0403;
|
||||
usbpid= 0xBBE2;
|
||||
usbdev= "A";
|
||||
reset = 8;
|
||||
sck = 0;
|
||||
mosi = 1;
|
||||
miso = 2;
|
||||
buff = ~10,~14,~13,5;
|
||||
rdyled = ~15;
|
||||
;
|
||||
|
||||
programmer
|
||||
id = "serialupdi";
|
||||
desc = "SerialUPDI";
|
||||
|
@ -4741,16 +4773,79 @@ part parent "m324p"
|
|||
signature = 0x1e 0x94 0x0a;
|
||||
|
||||
memory "eeprom"
|
||||
paged = no; /* leave this "no" */
|
||||
size = 512;
|
||||
page_size = 4;
|
||||
;
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
readback_p1 = 0xff;
|
||||
readback_p2 = 0xff;
|
||||
read = " 1 0 1 0 0 0 0 0",
|
||||
" 0 0 x x x a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
write = " 1 1 0 0 0 0 0 0",
|
||||
" 0 0 x x x a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
loadpage_lo = " 1 1 0 0 0 0 0 1",
|
||||
" 0 0 0 0 0 0 0 0",
|
||||
" 0 0 0 0 0 0 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
writepage = " 1 1 0 0 0 0 1 0",
|
||||
" 0 0 x x x a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 0 0",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x41;
|
||||
delay = 10;
|
||||
blocksize = 128;
|
||||
readsize = 256;
|
||||
;
|
||||
|
||||
memory "flash"
|
||||
paged = yes;
|
||||
size = 16384;
|
||||
page_size = 128;
|
||||
num_pages = 128;
|
||||
min_write_delay = 4500;
|
||||
max_write_delay = 4500;
|
||||
readback_p1 = 0xff;
|
||||
readback_p2 = 0xff;
|
||||
read_lo = " 0 0 1 0 0 0 0 0",
|
||||
" 0 a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
read_hi = " 0 0 1 0 1 0 0 0",
|
||||
" 0 a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
loadpage_lo = " 0 1 0 0 0 0 0 0",
|
||||
" 0 0 x x x x x x",
|
||||
" x x a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
loadpage_hi = " 0 1 0 0 1 0 0 0",
|
||||
" 0 0 x x x x x x",
|
||||
" x x a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
writepage = " 0 1 0 0 1 1 0 0",
|
||||
" 0 a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 x x x x x x",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x21;
|
||||
delay = 6;
|
||||
blocksize = 256;
|
||||
readsize = 256;
|
||||
;
|
||||
|
||||
;
|
||||
|
||||
#------------------------------------------------------------
|
||||
|
@ -5907,7 +6002,7 @@ part
|
|||
" i i i i i i i i";
|
||||
|
||||
writepage = " 0 1 0 0 1 1 0 0",
|
||||
" x x x a12 a11 a10 a9 a8",
|
||||
" x a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 x x x x x x",
|
||||
" x x x x x x x x";
|
||||
|
||||
|
@ -5980,7 +6075,7 @@ part
|
|||
|
||||
part parent "m329"
|
||||
id = "m329a";
|
||||
desc = "ATmega329a";
|
||||
desc = "ATmega329A";
|
||||
;
|
||||
|
||||
#------------------------------------------------------------
|
||||
|
@ -6161,7 +6256,7 @@ part
|
|||
" i i i i i i i i";
|
||||
|
||||
writepage = " 0 1 0 0 1 1 0 0",
|
||||
" x x x a12 a11 a10 a9 a8",
|
||||
"a15 a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 x x x x x x x",
|
||||
" x x x x x x x x";
|
||||
|
||||
|
@ -8846,7 +8941,7 @@ part
|
|||
"a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o";
|
||||
|
||||
write = "1 1 0 0 0 0 0 0 0 0 x x x x x a8",
|
||||
"a8 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i";
|
||||
"a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i";
|
||||
|
||||
loadpage_lo = " 1 1 0 0 0 0 0 1",
|
||||
" 0 0 0 0 0 0 0 0",
|
||||
|
@ -8854,8 +8949,8 @@ part
|
|||
" i i i i i i i i";
|
||||
|
||||
writepage = " 1 1 0 0 0 0 1 0",
|
||||
" 0 0 x x x x x x",
|
||||
" 0 0 a5 a4 a3 a2 0 0",
|
||||
" 0 0 x x x x x a8",
|
||||
" a7 a6 a5 a4 a3 a2 0 0",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x41;
|
||||
|
@ -9033,7 +9128,7 @@ part
|
|||
"a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o";
|
||||
|
||||
write = "1 1 0 0 0 0 0 0 0 0 x x x x x a8",
|
||||
"a8 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i";
|
||||
"a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i";
|
||||
|
||||
loadpage_lo = " 1 1 0 0 0 0 0 1",
|
||||
" 0 0 0 0 0 0 0 0",
|
||||
|
@ -9041,8 +9136,8 @@ part
|
|||
" i i i i i i i i";
|
||||
|
||||
writepage = " 1 1 0 0 0 0 1 0",
|
||||
" 0 0 x x x x x x",
|
||||
" 0 0 a5 a4 a3 a2 0 0",
|
||||
" 0 0 x x x x x a8",
|
||||
" a7 a6 a5 a4 a3 a2 0 0",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x41;
|
||||
|
@ -9776,6 +9871,81 @@ part parent "m328"
|
|||
signature = 0x1e 0x96 0x84;
|
||||
bs2 = 0xe2;
|
||||
|
||||
memory "eeprom"
|
||||
paged = no;
|
||||
size = 2048;
|
||||
page_size = 8;
|
||||
min_write_delay = 3600;
|
||||
max_write_delay = 3600;
|
||||
readback_p1 = 0xff;
|
||||
readback_p2 = 0xff;
|
||||
read = " 1 0 1 0 0 0 0 0",
|
||||
" 0 0 0 x x a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
write = " 1 1 0 0 0 0 0 0",
|
||||
" 0 0 0 x x a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
loadpage_lo = " 1 1 0 0 0 0 0 1",
|
||||
" 0 0 0 0 0 0 0 0",
|
||||
" 0 0 0 0 0 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
writepage = " 1 1 0 0 0 0 1 0",
|
||||
" 0 0 x x x a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 0 0 0",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x41;
|
||||
delay = 20;
|
||||
blocksize = 4;
|
||||
readsize = 256;
|
||||
;
|
||||
|
||||
memory "flash"
|
||||
paged = yes;
|
||||
size = 65536;
|
||||
page_size = 256;
|
||||
num_pages = 256;
|
||||
min_write_delay = 4500;
|
||||
max_write_delay = 4500;
|
||||
readback_p1 = 0xff;
|
||||
readback_p2 = 0xff;
|
||||
read_lo = " 0 0 1 0 0 0 0 0",
|
||||
" a15 a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
read_hi = " 0 0 1 0 1 0 0 0",
|
||||
" a15 a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
loadpage_lo = " 0 1 0 0 0 0 0 0",
|
||||
" 0 0 0 x x x x x",
|
||||
" x a6 a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
loadpage_hi = " 0 1 0 0 1 0 0 0",
|
||||
" 0 0 0 x x x x x",
|
||||
" x a6 a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
writepage = " 0 1 0 0 1 1 0 0",
|
||||
" a15 a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 x x x x x x x",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x41;
|
||||
delay = 6;
|
||||
blocksize = 128;
|
||||
readsize = 256;
|
||||
|
||||
;
|
||||
|
||||
memory "efuse"
|
||||
size = 1;
|
||||
min_write_delay = 4500;
|
||||
|
@ -10247,7 +10417,7 @@ part
|
|||
" i i i i i i i i";
|
||||
|
||||
writepage = " 1 1 0 0 0 0 1 0",
|
||||
" 0 0 x x x x x x",
|
||||
" 0 0 x x x x x a8",
|
||||
" a7 a6 a5 a4 a3 a2 0 0",
|
||||
" x x x x x x x x";
|
||||
|
||||
|
@ -12115,7 +12285,7 @@ part
|
|||
|
||||
writepage = " 1 1 0 0 0 0 1 0",
|
||||
" 0 0 x x x x x x",
|
||||
" x a6 a5 a4 a3 a2 0 0",
|
||||
" a7 a6 a5 a4 a3 a2 0 0",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x41;
|
||||
|
@ -12307,8 +12477,8 @@ part
|
|||
" i i i i i i i i";
|
||||
|
||||
writepage = " 1 1 0 0 0 0 1 0",
|
||||
" 0 0 x x x x x x",
|
||||
" x a6 a5 a4 a3 a2 0 0",
|
||||
" 0 0 x x x x x a8",
|
||||
" a7 a6 a5 a4 a3 a2 0 0",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x41;
|
||||
|
@ -12549,7 +12719,7 @@ part parent "t84"
|
|||
|
||||
part
|
||||
id = "t43u";
|
||||
desc = "ATtiny43u";
|
||||
desc = "ATtiny43U";
|
||||
has_debugwire = yes;
|
||||
flash_instr = 0xB4, 0x07, 0x17;
|
||||
eeprom_instr = 0xBB, 0xFF, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D,
|
||||
|
@ -12609,7 +12779,7 @@ part
|
|||
readback_p1 = 0xff;
|
||||
readback_p2 = 0xff;
|
||||
read = "1 0 1 0 0 0 0 0 0 0 0 x x x x x",
|
||||
"0 0 a4 a3 a2 a1 a0 o o o o o o o o";
|
||||
"0 0 a5 a4 a3 a2 a1 a0 o o o o o o o o";
|
||||
|
||||
write = "1 1 0 0 0 0 0 0 0 0 0 x x x x x",
|
||||
"0 0 a5 a4 a3 a2 a1 a0 i i i i i i i i";
|
||||
|
@ -12678,6 +12848,8 @@ part
|
|||
size = 1;
|
||||
write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
|
||||
"x x x x x x x x 1 1 i i i i i i";
|
||||
read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
|
||||
"x x x x x x x x o o o o o o o o";
|
||||
min_write_delay = 4500;
|
||||
max_write_delay = 4500;
|
||||
;
|
||||
|
@ -12716,12 +12888,203 @@ part
|
|||
;
|
||||
|
||||
memory "calibration"
|
||||
size = 2;
|
||||
size = 1;
|
||||
read = "0 0 1 1 1 0 0 0 0 0 0 x x x x x",
|
||||
"0 0 0 0 0 0 0 a0 o o o o o o o o";
|
||||
;
|
||||
;
|
||||
|
||||
#------------------------------------------------------------
|
||||
# ATmega16u4
|
||||
#------------------------------------------------------------
|
||||
|
||||
part
|
||||
id = "m16u4";
|
||||
desc = "ATmega16U4";
|
||||
signature = 0x1e 0x94 0x88;
|
||||
usbpid = 0x2ff4;
|
||||
has_jtag = yes;
|
||||
# stk500_devcode = 0xB2;
|
||||
# avr910_devcode = 0x43;
|
||||
chip_erase_delay = 9000;
|
||||
pagel = 0xD7;
|
||||
bs2 = 0xA0;
|
||||
reset = dedicated;
|
||||
pgm_enable = "1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1",
|
||||
"x x x x x x x x x x x x x x x x";
|
||||
|
||||
chip_erase = "1 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0",
|
||||
"x x x x x x x x x x x x x x x x";
|
||||
|
||||
timeout = 200;
|
||||
stabdelay = 100;
|
||||
cmdexedelay = 25;
|
||||
synchloops = 32;
|
||||
bytedelay = 0;
|
||||
pollindex = 3;
|
||||
pollvalue = 0x53;
|
||||
predelay = 1;
|
||||
postdelay = 1;
|
||||
pollmethod = 1;
|
||||
|
||||
pp_controlstack =
|
||||
0x0E, 0x1E, 0x0F, 0x1F, 0x2E, 0x3E, 0x2F, 0x3F,
|
||||
0x4E, 0x5E, 0x4F, 0x5F, 0x6E, 0x7E, 0x6F, 0x7F,
|
||||
0x66, 0x76, 0x67, 0x77, 0x6A, 0x7A, 0x6B, 0x7B,
|
||||
0xBE, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00;
|
||||
hventerstabdelay = 100;
|
||||
progmodedelay = 0;
|
||||
latchcycles = 5;
|
||||
togglevtg = 1;
|
||||
poweroffdelay = 15;
|
||||
resetdelayms = 1;
|
||||
resetdelayus = 0;
|
||||
hvleavestabdelay = 15;
|
||||
chiperasepulsewidth = 0;
|
||||
chiperasepolltimeout = 10;
|
||||
programfusepulsewidth = 0;
|
||||
programfusepolltimeout = 5;
|
||||
programlockpulsewidth = 0;
|
||||
programlockpolltimeout = 5;
|
||||
|
||||
idr = 0x31;
|
||||
spmcr = 0x57;
|
||||
rampz = 0x3b;
|
||||
allowfullpagebitstream = no;
|
||||
|
||||
ocdrev = 3;
|
||||
|
||||
memory "eeprom"
|
||||
paged = no; /* leave this "no" */
|
||||
page_size = 4; /* for parallel programming */
|
||||
size = 512;
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
readback_p1 = 0x00;
|
||||
readback_p2 = 0x00;
|
||||
read = " 1 0 1 0 0 0 0 0",
|
||||
" x x x x x x x a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
write = " 1 1 0 0 0 0 0 0",
|
||||
" x x x x x x x a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
loadpage_lo = " 1 1 0 0 0 0 0 1",
|
||||
" 0 0 0 0 0 0 0 0",
|
||||
" 0 0 0 0 0 0 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
writepage = " 1 1 0 0 0 0 1 0",
|
||||
" 0 0 x x x x x a8",
|
||||
" a7 a6 a5 a4 a3 a2 0 0",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x41;
|
||||
delay = 20;
|
||||
blocksize = 4;
|
||||
readsize = 256;
|
||||
;
|
||||
|
||||
memory "flash"
|
||||
paged = yes;
|
||||
size = 16384;
|
||||
page_size = 128;
|
||||
num_pages = 128;
|
||||
min_write_delay = 4500;
|
||||
max_write_delay = 4500;
|
||||
readback_p1 = 0x00;
|
||||
readback_p2 = 0x00;
|
||||
read_lo = " 0 0 1 0 0 0 0 0",
|
||||
" 0 a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
read_hi = " 0 0 1 0 1 0 0 0",
|
||||
" 0 a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
loadpage_lo = " 0 1 0 0 0 0 0 0",
|
||||
" x x x x x x x x",
|
||||
" x x a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
loadpage_hi = " 0 1 0 0 1 0 0 0",
|
||||
" x x x x x x x x",
|
||||
" x x a5 a4 a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
writepage = " 0 1 0 0 1 1 0 0",
|
||||
" a15 a14 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 x x x x x x",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x41;
|
||||
delay = 6;
|
||||
blocksize = 128;
|
||||
readsize = 256;
|
||||
;
|
||||
|
||||
memory "lfuse"
|
||||
size = 1;
|
||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0",
|
||||
"x x x x x x x x i i i i i i i i";
|
||||
|
||||
read = "0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0",
|
||||
"x x x x x x x x o o o o o o o o";
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
;
|
||||
|
||||
memory "hfuse"
|
||||
size = 1;
|
||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0",
|
||||
"x x x x x x x x i i i i i i i i";
|
||||
|
||||
read = "0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0",
|
||||
"x x x x x x x x o o o o o o o o";
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
;
|
||||
|
||||
memory "efuse"
|
||||
size = 1;
|
||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
|
||||
"x x x x x x x x 1 1 1 1 i i i i";
|
||||
|
||||
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
|
||||
"x x x x x x x x o o o o o o o o";
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
;
|
||||
|
||||
memory "lock"
|
||||
size = 1;
|
||||
read = "0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0",
|
||||
"x x x x x x x x 0 0 o o o o o o";
|
||||
|
||||
write = "1 0 1 0 1 1 0 0 1 1 1 x x x x x",
|
||||
"x x x x x x x x 1 1 i i i i i i";
|
||||
min_write_delay = 9000;
|
||||
max_write_delay = 9000;
|
||||
;
|
||||
|
||||
memory "calibration"
|
||||
size = 1;
|
||||
read = "0 0 1 1 1 0 0 0 x x x x x x x x",
|
||||
"0 0 0 0 0 0 0 0 o o o o o o o o";
|
||||
;
|
||||
|
||||
memory "signature"
|
||||
size = 3;
|
||||
read = "0 0 1 1 0 0 0 0 x x x x x x x x",
|
||||
"x x x x x x a1 a0 o o o o o o o o";
|
||||
;
|
||||
;
|
||||
|
||||
#------------------------------------------------------------
|
||||
# ATmega32u4
|
||||
#------------------------------------------------------------
|
||||
|
@ -12802,12 +13165,12 @@ part
|
|||
|
||||
loadpage_lo = " 1 1 0 0 0 0 0 1",
|
||||
" 0 0 0 0 0 0 0 0",
|
||||
" 0 0 0 0 0 a2 a1 a0",
|
||||
" 0 0 0 0 0 0 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
writepage = " 1 1 0 0 0 0 1 0",
|
||||
" 0 0 x x x a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 0 0 0",
|
||||
" a7 a6 a5 a4 a3 a2 0 0",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x41;
|
||||
|
@ -12881,7 +13244,7 @@ part
|
|||
memory "efuse"
|
||||
size = 1;
|
||||
write = "1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0",
|
||||
"x x x x x x x x x x x x i i i i";
|
||||
"x x x x x x x x 1 1 1 1 i i i i";
|
||||
|
||||
read = "0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0",
|
||||
"x x x x x x x x o o o o o o o o";
|
||||
|
@ -13201,7 +13564,7 @@ part
|
|||
" i i i i i i i i";
|
||||
|
||||
writepage = " 1 1 0 0 0 0 1 0",
|
||||
" 0 0 x x x a10 a9 a8",
|
||||
" 0 0 x x a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 0 0 0",
|
||||
" x x x x x x x x";
|
||||
|
||||
|
@ -14263,7 +14626,7 @@ part
|
|||
part
|
||||
id = "m165";
|
||||
desc = "ATmega165";
|
||||
signature = 0x1e 0x94 0x07;
|
||||
signature = 0x1e 0x94 0x10;
|
||||
has_jtag = yes;
|
||||
# stk500_devcode = 0x??;
|
||||
# avr910_devcode = 0x??;
|
||||
|
@ -14437,7 +14800,7 @@ part
|
|||
|
||||
memory "signature"
|
||||
size = 3;
|
||||
read = "0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0",
|
||||
read = "0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0",
|
||||
"x x x x x x a1 a0 o o o o o o o o";
|
||||
;
|
||||
|
||||
|
@ -15445,6 +15808,13 @@ part parent "x128c3"
|
|||
id = "x128d4";
|
||||
desc = "ATxmega128D4";
|
||||
signature = 0x1e 0x97 0x47;
|
||||
|
||||
memory "flash"
|
||||
size = 0x22000;
|
||||
offset = 0x800000;
|
||||
page_size = 0x100;
|
||||
readsize = 0x100;
|
||||
;
|
||||
;
|
||||
|
||||
#------------------------------------------------------------
|
||||
|
@ -16253,28 +16623,28 @@ part
|
|||
readback_p1 = 0xff;
|
||||
readback_p2 = 0xff;
|
||||
read_lo = " 0 0 1 0 0 0 0 0",
|
||||
" 0 0 0 a12 a11 a10 a9 a8",
|
||||
" 0 0 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
read_hi = " 0 0 1 0 1 0 0 0",
|
||||
" 0 0 0 a12 a11 a10 a9 a8",
|
||||
" 0 0 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 a3 a2 a1 a0",
|
||||
" o o o o o o o o";
|
||||
|
||||
loadpage_lo = " 0 1 0 0 0 0 0 0",
|
||||
" 0 0 0 x x x x x",
|
||||
" x x a5 a4 a3 a2 a1 a0",
|
||||
" x x x x a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
loadpage_hi = " 0 1 0 0 1 0 0 0",
|
||||
" 0 0 0 x x x x x",
|
||||
" x x a5 a4 a3 a2 a1 a0",
|
||||
" x x x x a3 a2 a1 a0",
|
||||
" i i i i i i i i";
|
||||
|
||||
writepage = " 0 1 0 0 1 1 0 0",
|
||||
" 0 0 0 a12 a11 a10 a9 a8",
|
||||
" a7 a6 x x x x x x",
|
||||
" 0 0 a13 a12 a11 a10 a9 a8",
|
||||
" a7 a6 a5 a4 x x x x",
|
||||
" x x x x x x x x";
|
||||
|
||||
mode = 0x41;
|
||||
|
@ -16513,7 +16883,7 @@ part parent ".reduced_core_tiny"
|
|||
|
||||
part
|
||||
id = "m406";
|
||||
desc = "ATMEGA406";
|
||||
desc = "ATmega406";
|
||||
has_jtag = yes;
|
||||
signature = 0x1e 0x95 0x07;
|
||||
|
||||
|
@ -16748,12 +17118,16 @@ part parent ".avr8x"
|
|||
desc = "AVR8X tiny family common values";
|
||||
family_id = "tinyAVR";
|
||||
|
||||
memory "usersig"
|
||||
memory "userrow"
|
||||
size = 0x20;
|
||||
offset = 0x1300;
|
||||
page_size = 0x20;
|
||||
readsize = 0x100;
|
||||
;
|
||||
|
||||
memory "usersig"
|
||||
alias "userrow";
|
||||
;
|
||||
;
|
||||
|
||||
#------------------------------------------------------------
|
||||
|
@ -16765,12 +17139,16 @@ part parent ".avr8x"
|
|||
desc = "AVR8X mega family common values";
|
||||
family_id = "megaAVR";
|
||||
|
||||
memory "usersig"
|
||||
memory "userrow"
|
||||
size = 0x40;
|
||||
offset = 0x1300;
|
||||
page_size = 0x40;
|
||||
readsize = 0x100;
|
||||
;
|
||||
|
||||
memory "usersig"
|
||||
alias "userrow";
|
||||
;
|
||||
;
|
||||
|
||||
#------------------------------------------------------------
|
||||
|
@ -18001,6 +18379,10 @@ part
|
|||
readsize = 0x20;
|
||||
;
|
||||
|
||||
memory "usersig"
|
||||
alias "userrow";
|
||||
;
|
||||
|
||||
memory "data"
|
||||
# SRAM, only used to supply the offset
|
||||
offset = 0x1000000;
|
||||
|
@ -18837,6 +19219,10 @@ part parent ".avrdx"
|
|||
page_size = 0x40;
|
||||
readsize = 0x40;
|
||||
;
|
||||
|
||||
memory "usersig"
|
||||
alias "userrow";
|
||||
;
|
||||
;
|
||||
|
||||
#------------------------------------------------------------
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.60)
|
||||
AC_INIT(avrdude, 6.99-20211218, avrdude-dev@nongnu.org)
|
||||
AC_INIT(avrdude, 7.0, avrdude-dev@nongnu.org)
|
||||
|
||||
AC_CANONICAL_BUILD
|
||||
AC_CANONICAL_HOST
|
||||
|
|
|
@ -40,7 +40,7 @@ all-local: info html ps pdf
|
|||
html: avrdude-html/avrdude.html
|
||||
|
||||
avrdude-html/avrdude.html: $(srcdir)/$(info_TEXINFOS) $(GENERATED_TEXINFOS)
|
||||
texi2html -split_node $(srcdir)/$(info_TEXINFOS)
|
||||
texi2html --split=node --css-include=$(srcdir)/avrdude.css $(srcdir)/$(info_TEXINFOS)
|
||||
if [ -e ./avrdude.html -o -e ./avrdude_1.html ]; then \
|
||||
mkdir -p avrdude-html ; \
|
||||
mv -f *.html avrdude-html ; \
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
body { background-color: #ffd; }
|
||||
h1 { text-shadow: .05em .05em #ccc; }
|
||||
table {
|
||||
border: 3px solid #ccf;
|
||||
background-color: white;
|
||||
}
|
||||
div.smallexample {
|
||||
background-color: #dfd;
|
||||
border: 3px solid #cfc;
|
||||
}
|
||||
div.example {
|
||||
background-color: #dfd;
|
||||
border: 3px solid #cfc;
|
||||
}
|
||||
samp {
|
||||
color: blue;
|
||||
}
|
||||
code {
|
||||
color: green;
|
||||
}
|
|
@ -28,9 +28,7 @@ This file documents the avrdude program.
|
|||
|
||||
For avrdude version @value{VERSION}, @value{UPDATED}.
|
||||
|
||||
Copyright @copyright{} 2003, 2005 Brian Dean
|
||||
|
||||
Copyright @copyright{} 2006 - 2021 J@"org Wunsch
|
||||
Copyright @copyright{} Brian Dean, J@"org Wunsch
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
|
@ -64,13 +62,10 @@ the terms of the GNU Free Documentation License (FDL), version 1.3.
|
|||
@author by Brian S. Dean
|
||||
|
||||
@page
|
||||
Send comments on AVRDUDE to @w{@email{avrdude-dev@@nongnu.org}}.
|
||||
|
||||
Use @uref{http://savannah.nongnu.org/bugs/?group=avrdude} to report bugs.
|
||||
Use @uref{https://github.com/avrdudes/avrdude/issues} to report bugs and ask questions.
|
||||
|
||||
Copyright @copyright{} 2003,2005 Brian S. Dean
|
||||
|
||||
Copyright @copyright{} 2006 - 2013 J@"org Wunsch
|
||||
Copyright @copyright{} Brian S. Dean, J@"org Wunsch
|
||||
@sp 2
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
|
@ -102,13 +97,9 @@ programs to Atmel AVR microcontrollers.
|
|||
|
||||
For avrdude version @value{VERSION}, @value{UPDATED}.
|
||||
|
||||
Send comments on AVRDUDE to @w{@email{avrdude-dev@@nongnu.org}}.
|
||||
Use @uref{https://github.com/avrdudes/avrdude/issues} to report bugs and ask questions.
|
||||
|
||||
Use @uref{http://savannah.nongnu.org/bugs/?group=avrdude} to report bugs.
|
||||
|
||||
Copyright @copyright{} 2003,2005 Brian S. Dean
|
||||
|
||||
Copyright @copyright{} 2006 J@"org Wunsch
|
||||
Copyright @copyright{} Brian S. Dean, J@"org Wunsch
|
||||
@end ifinfo
|
||||
|
||||
@menu
|
||||
|
@ -119,6 +110,7 @@ Copyright @copyright{} 2006 J@"org Wunsch
|
|||
* Programmer Specific Information::
|
||||
* Platform Dependent Information::
|
||||
* Troubleshooting::
|
||||
* Index::
|
||||
@end menu
|
||||
|
||||
@c
|
||||
|
@ -127,7 +119,7 @@ Copyright @copyright{} 2006 J@"org Wunsch
|
|||
@node Introduction, Command Line Options, Top, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Introduction
|
||||
@cindex introduction
|
||||
@cindex Introduction
|
||||
|
||||
AVRDUDE - AVR Downloader Uploader - is a program for downloading and
|
||||
uploading the on-chip memories of Atmel's AVR microcontrollers. It can
|
||||
|
@ -145,6 +137,8 @@ from the contents of a file, while interactive mode is useful for
|
|||
exploring memory contents, modifying individual bytes of eeprom,
|
||||
programming fuse/lock bits, etc.
|
||||
|
||||
@cindex Programmers supported
|
||||
|
||||
AVRDUDE supports the following basic programmer types: Atmel's STK500,
|
||||
Atmel's AVRISP and AVRISP mkII devices,
|
||||
Atmel's STK600,
|
||||
|
@ -345,6 +339,7 @@ below for Teensy specific options.
|
|||
@c Node
|
||||
@c
|
||||
@node History, , Introduction, Introduction
|
||||
@cindex History
|
||||
@section History and Credits
|
||||
|
||||
AVRDUDE was written by Brian S. Dean under the name of AVRPROG to run on
|
||||
|
@ -353,13 +348,15 @@ AVRDUDE when interest grew in a Windows port of the software so that the
|
|||
name did not conflict with AVRPROG.EXE which is the name of Atmel's
|
||||
Windows programming software.
|
||||
|
||||
The AVRDUDE source now resides in the public CVS repository on
|
||||
savannah.gnu.org (@url{http://savannah.gnu.org/projects/avrdude/}),
|
||||
where it continues to be enhanced and ported to other systems. In
|
||||
For many years, the AVRDUDE source resided in public repositories on
|
||||
savannah.nongnu.org,
|
||||
where it continued to be enhanced and ported to other systems. In
|
||||
addition to FreeBSD, AVRDUDE now runs on Linux and Windows. The
|
||||
developers behind the porting effort primarily were Ted Roth, Eric
|
||||
Weddington, and Joerg Wunsch.
|
||||
|
||||
In 2022, the project moved to Github (@url{https://github.com/avrdudes/avrdude/}).
|
||||
|
||||
And in the spirit of many open source projects, this manual also draws
|
||||
on the work of others. The initial revision was composed of parts of
|
||||
the original Unix manual page written by Joerg Wunsch, the original web
|
||||
|
@ -374,7 +371,6 @@ Roth.
|
|||
@c
|
||||
@node Command Line Options, Terminal Mode Operation, Introduction, Top
|
||||
@chapter Command Line Options
|
||||
@cindex options
|
||||
|
||||
@menu
|
||||
* Option Descriptions::
|
||||
|
@ -386,6 +382,7 @@ Roth.
|
|||
@c Node
|
||||
@c
|
||||
@node Option Descriptions, Programmers accepting extended parameters, Command Line Options, Command Line Options
|
||||
@cindex Options (command-line)
|
||||
@section Option Descriptions
|
||||
|
||||
@noindent
|
||||
|
@ -410,6 +407,8 @@ but it can be added to the configuration file if you have the Atmel
|
|||
datasheet so that you can enter the programming specifications.
|
||||
Currently, the following MCU types are understood:
|
||||
|
||||
@cindex Device support
|
||||
|
||||
@multitable @columnfractions .15 .3
|
||||
@include parts.texi
|
||||
@end multitable
|
||||
|
@ -461,6 +460,8 @@ file without any code changes to AVRDUDE. Simply copy an existing entry
|
|||
and change the pin definitions to match that of the unknown programmer.
|
||||
Currently, the following programmer ids are understood and supported:
|
||||
|
||||
@cindex Programmer support
|
||||
|
||||
@multitable @columnfractions .2 .6
|
||||
@include programmers.texi
|
||||
@end multitable
|
||||
|
@ -838,7 +839,7 @@ accepting extended parameters.
|
|||
@c
|
||||
@node Programmers accepting extended parameters, Example Command Line Invocations, Option Descriptions, Command Line Options
|
||||
@section Programmers accepting extended parameters
|
||||
|
||||
@cindex @code{-x} AVR Dragon
|
||||
@table @code
|
||||
|
||||
@item JTAG ICE mkII/3
|
||||
|
@ -855,6 +856,7 @@ Each AVR unit within the chain shifts by 4 bits.
|
|||
Other JTAG units might require a different bit shift count.
|
||||
@end table
|
||||
|
||||
@cindex @code{-x} AVR910
|
||||
@item AVR910
|
||||
|
||||
The AVR910 programmer type accepts the following extended parameter:
|
||||
|
@ -875,13 +877,16 @@ Use
|
|||
programmer creates errors during initial sequence.
|
||||
@end table
|
||||
|
||||
@cindex @code{-x} Arduino
|
||||
@item Arduino
|
||||
|
||||
The Arduino programmer type accepts the following extended parameter:
|
||||
@table @code
|
||||
@item @samp{attemps=VALUE}
|
||||
Overide the default number of connection retry attempt by using @var{VALUE}.
|
||||
@end table
|
||||
|
||||
@cindex @code{-x} Buspirate
|
||||
@item BusPirate
|
||||
|
||||
The BusPirate programmer type accepts the following extended parameters:
|
||||
|
@ -971,6 +976,7 @@ The default value is 100ms. Using 10ms might work in most cases.
|
|||
|
||||
@end table
|
||||
|
||||
@cindex @code{-x} Micronucleus bootloader
|
||||
@item Micronucleus bootloader
|
||||
|
||||
When using the Micronucleus programmer type, the
|
||||
|
@ -983,6 +989,7 @@ If no time-out is specified, AVRDUDE will wait indefinitely until the
|
|||
device is plugged in.
|
||||
@end table
|
||||
|
||||
@cindex @code{-x} Teensy bootloader
|
||||
@item Teensy bootloader
|
||||
|
||||
When using the Teensy programmer type, the
|
||||
|
@ -995,6 +1002,7 @@ If no time-out is specified, AVRDUDE will wait indefinitely until the
|
|||
device is plugged in.
|
||||
@end table
|
||||
|
||||
@cindex @code{-x} Wiring
|
||||
@item Wiring
|
||||
|
||||
When using the Wiring programmer type, the
|
||||
|
@ -1006,6 +1014,7 @@ After performing the port open phase, AVRDUDE will wait/snooze for
|
|||
No toggling of DTR/RTS is performed if @var{snooze} > 0.
|
||||
@end table
|
||||
|
||||
@cindex @code{-x} PICkit2
|
||||
@item PICkit2
|
||||
Connection to the PICkit2 programmer:
|
||||
@multitable @columnfractions .05 .3
|
||||
|
@ -1026,6 +1035,7 @@ Sets the SPI clocking rate in Hz (default is 100kHz). Alternately the -B or -i o
|
|||
Sets the timeout for USB reads and writes in milliseconds (default is 1500 ms).
|
||||
@end table
|
||||
|
||||
@cindex @code{-x} USBasp
|
||||
@item USBasp
|
||||
Extended parameters:
|
||||
@table @code
|
||||
|
@ -1036,6 +1046,7 @@ rather than entire chip.
|
|||
Only applicable to TPI devices (ATtiny 4/5/9/10/20/40).
|
||||
@end table
|
||||
|
||||
@cindex @code{-x} xbee
|
||||
@item xbee
|
||||
Extended parameters:
|
||||
@table @code
|
||||
|
@ -1052,6 +1063,7 @@ The remaining two necessary XBee-to-MCU connections are not selectable
|
|||
the MCU's ‘TXD’ line.
|
||||
@end table
|
||||
|
||||
@cindex @code{-x} serialupdi
|
||||
@item serialupdi
|
||||
Extended parameters:
|
||||
@table @code
|
||||
|
@ -1254,6 +1266,7 @@ commands can be recalled and edited.
|
|||
@end menu
|
||||
|
||||
@node Terminal Mode Commands, Terminal Mode Examples, Terminal Mode Operation, Terminal Mode Operation
|
||||
@cindex Terminal Mode
|
||||
@section Terminal Mode Commands
|
||||
|
||||
@noindent
|
||||
|
@ -1261,20 +1274,83 @@ The following commands are implemented:
|
|||
|
||||
@table @code
|
||||
|
||||
@item dump @var{memtype} @var{addr} @var{nbytes}
|
||||
@item dump @var{memtype} [@var{start_addr} [@var{nbytes}]]
|
||||
Read @var{nbytes} from the specified memory area, and display them in
|
||||
the usual hexadecimal and ASCII form.
|
||||
|
||||
@item dump
|
||||
@item dump @var{memtype} [@var{start_addr}] @dots{}
|
||||
Start reading from @var{start_addr}, all the way to the last memory address.
|
||||
|
||||
@item dump @var{memtype}
|
||||
Continue dumping the memory contents for another @var{nbytes} where the
|
||||
previous dump command left off.
|
||||
|
||||
@item write @var{memtype} @var{addr} @var{byte1} @dots{} @var{byteN}
|
||||
Manually program the respective memory cells, starting at address addr,
|
||||
using the values @var{byte1} through @var{byteN}. This feature is not
|
||||
@item write @var{memtype} @var{start_addr} @var{data1} @var{data2} @dots{} @var{dataN}
|
||||
Manually program the respective memory cells, starting at address @var{start_addr},
|
||||
using the values @var{data1} through @var{dataN}. This feature is not
|
||||
implemented for bank-addressed memories such as the flash memory of
|
||||
ATMega devices.
|
||||
|
||||
Items @var{dataN} can have the following formats:
|
||||
|
||||
@multitable @columnfractions .3 .4 .3
|
||||
@item @strong{Type}
|
||||
@tab @strong{Example}
|
||||
@tab @strong{Size (bytes)}
|
||||
|
||||
@item Character
|
||||
@tab @code{'A'}
|
||||
@tab 1
|
||||
|
||||
@item Decimal integer
|
||||
@tab 12345
|
||||
@tab 1, 2, 4, or 8 (see below)
|
||||
|
||||
@item Octal integer
|
||||
@tab 012345
|
||||
@tab 1, 2, 4, or 8 (see below)
|
||||
|
||||
@item Hexadecimal integer
|
||||
@tab 0x12345
|
||||
@tab 1, 2, 4, or 8 (see below)
|
||||
|
||||
@item Float
|
||||
@tab 3.1415926
|
||||
@tab 4
|
||||
|
||||
@end multitable
|
||||
|
||||
Integer constants can be 1, 2, 4, or 8 bytes long.
|
||||
By default, the smallest possible size will be used where
|
||||
the specified number just fits into.
|
||||
A specific size can be denoted by appending one of these suffixes:
|
||||
|
||||
@table @code
|
||||
@item LL
|
||||
@itemx ll
|
||||
8 bytes / 64 bits
|
||||
@item L
|
||||
@itemx l
|
||||
4 bytes / 32 bits
|
||||
@item H
|
||||
@itemx h
|
||||
@itemx S
|
||||
@itemx s
|
||||
2 bytes / 16 bits
|
||||
@item HH
|
||||
@itemx hh
|
||||
1 byte / 8 bits
|
||||
@end table
|
||||
|
||||
Similarly, floating-point constants can have an @code{F} or @code{f}
|
||||
appended, but only 32-bit floating-point values are supported.
|
||||
|
||||
@item write @var{memtype} @var{start_addr} @var{length} @var{data1} @var{data2} @var{dataN} @dots{}
|
||||
|
||||
Similar to the above, but @var{length} byte of the memory are written.
|
||||
For that purpose, after writing the initial items, @var{dataN} is
|
||||
replicated as many times as needed.
|
||||
|
||||
@item erase
|
||||
Perform a chip erase.
|
||||
|
||||
|
@ -1367,6 +1443,7 @@ Display the current target supply voltage and JTAG bit clock rate/period.
|
|||
@c Node
|
||||
@c
|
||||
@node Terminal Mode Examples, , Terminal Mode Commands, Terminal Mode Operation
|
||||
@cindex Terminal Mode
|
||||
@section Terminal Mode Examples
|
||||
|
||||
@noindent
|
||||
|
@ -1378,7 +1455,6 @@ Display part parameters, modify eeprom cells, perform a chip erase:
|
|||
|
||||
avrdude: AVR device initialized and ready to accept instructions
|
||||
avrdude: Device signature = 0x1e9702
|
||||
avrdude: current erase-rewrite cycle count is 52 (if being tracked)
|
||||
avrdude> part
|
||||
>>> part
|
||||
|
||||
|
@ -1440,7 +1516,6 @@ display the factory defaults, then reprogram:
|
|||
|
||||
avrdude: AVR device initialized and ready to accept instructions
|
||||
avrdude: Device signature = 0x1e9702
|
||||
avrdude: current erase-rewrite cycle count is 52 (if being tracked)
|
||||
avrdude> d efuse
|
||||
>>> d efuse
|
||||
0000 fd |. |
|
||||
|
@ -1466,11 +1541,56 @@ avrdude>
|
|||
@end cartouche
|
||||
@end smallexample
|
||||
|
||||
@smallexample
|
||||
@cartouche
|
||||
% avrdude -c pkobn_updi -p avr128db48 -t
|
||||
|
||||
Vtarget : 4.71 V
|
||||
PDI/UPDI clock Xmega/megaAVR : 100 kHz
|
||||
|
||||
avrdude: AVR device initialized and ready to accept instructions
|
||||
|
||||
Reading | ################################################## | 100% 0.01s
|
||||
|
||||
avrdude: Device signature = 0x1e970c (probably avr128db48)
|
||||
avrdude> write eeprom 0 1234567890 'A' 'V' 'R' 2.718282 "Hello World!"
|
||||
>>> write eeprom 0 1234567890 'A' 'V' 'R' 2.718282 "Hello World!"
|
||||
Warning: no size suffix specified for "1234567890". Writing 4 byte(s)
|
||||
Info: Writing 24 bytes starting from address 0x00
|
||||
|
||||
avrdude> dump eeprom 0 32
|
||||
>>> dump eeprom 0 32
|
||||
|
||||
0000 d2 02 96 49 41 56 52 55 f8 2d 40 48 65 6c 6c 6f |...IAVRU.-@@Hello|
|
||||
0010 20 57 6f 72 6c 64 21 00 ff ff ff ff ff ff ff ff | World!.........|
|
||||
|
||||
avrdude> q
|
||||
@end cartouche
|
||||
@end smallexample
|
||||
|
||||
The following example demonstrates the second form of the @code{write}
|
||||
command where the last data value provided is used to fill up the
|
||||
indicated memory range.
|
||||
|
||||
@smallexample
|
||||
@cartouche
|
||||
avrdude> write eeprom 0x00 0x20 'a' 'b' 'c' 0x11 0xcafe 0x55 ...
|
||||
>>> write eeprom 0x00 0x20 'a' 'b' 'c' 0x11 0xcafe 0x55 ...
|
||||
|
||||
avrdude> dump eeprom 0 0x30
|
||||
>>> dump eeprom 0 0x30
|
||||
0000 61 62 63 11 fe ca 55 55 55 55 55 55 55 55 55 55 |abc...UUUUUUUUUU|
|
||||
0010 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 |UUUUUUUUUUUUUUUU|
|
||||
0020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
|
||||
@end cartouche
|
||||
@end smallexample
|
||||
|
||||
@c
|
||||
@c Node
|
||||
@c
|
||||
@node Configuration File, Programmer Specific Information, Terminal Mode Operation, Top
|
||||
@cindex Configuration File
|
||||
@cindex @code{avrdude.conf}
|
||||
@chapter Configuration File
|
||||
|
||||
@noindent
|
||||
|
@ -1833,6 +1953,7 @@ Reading fuse and lock bits is fully supported.
|
|||
@c Node
|
||||
@c
|
||||
@node Atmel STK600, Atmel DFU bootloader using FLIP version 1, Programmer Specific Information, Programmer Specific Information
|
||||
@cindex STK600
|
||||
@section Atmel STK600
|
||||
|
||||
@c
|
||||
|
@ -1929,6 +2050,7 @@ least 4.5 V in order to work. This can be done using
|
|||
@c Node
|
||||
@c
|
||||
@node Atmel DFU bootloader using FLIP version 1, SerialUPDI programmer , Atmel STK600, Programmer Specific Information
|
||||
@cindex DFU bootloader
|
||||
@section Atmel DFU bootloader using FLIP version 1
|
||||
|
||||
Bootloaders using the FLIP protocol version 1 experience some very
|
||||
|
@ -1957,6 +2079,7 @@ versions of the bootloader.
|
|||
@c Node
|
||||
@c
|
||||
@node SerialUPDI programmer, , Atmel DFU bootloader using FLIP version 1, Programmer Specific Information
|
||||
@cindex SerialUPDI
|
||||
@section SerialUPDI programmer
|
||||
|
||||
SerialUPDI programmer can be used for programming UPDI-only devices
|
||||
|
@ -2207,6 +2330,8 @@ configuration file will be always be @code{/etc/avrdude.conf}.
|
|||
|
||||
@noindent
|
||||
The parallel and serial port device file names are system specific.
|
||||
MacOS has no default serial or parallel port names, but available
|
||||
ports can be found under @code{/dev/cu.*}.
|
||||
The following table lists the default names for a given system.
|
||||
|
||||
@multitable @columnfractions .30 .30 .30
|
||||
|
@ -2439,13 +2564,13 @@ such as @option{--prefix} and @option{--datadir}.
|
|||
@c
|
||||
@c Node
|
||||
@c
|
||||
@node Troubleshooting, ,Platform Dependent Information ,Top
|
||||
@node Troubleshooting,Index ,Platform Dependent Information ,Top
|
||||
@appendix Troubleshooting
|
||||
|
||||
@noindent
|
||||
In general, please report any bugs encountered via
|
||||
@*
|
||||
@url{http://savannah.nongnu.org/bugs/?group=avrdude}.
|
||||
@url{https://github.com/avrdudes/avrdude/issues}.
|
||||
|
||||
|
||||
@itemize @bullet
|
||||
|
@ -2750,7 +2875,11 @@ erase cycle.
|
|||
|
||||
@end itemize
|
||||
|
||||
@node Index, , Troubleshooting, Top
|
||||
|
||||
@unnumbered Concept Index
|
||||
|
||||
@printindex cp
|
||||
|
||||
@bye
|
||||
|
||||
|
|
36
src/jtag3.c
36
src/jtag3.c
|
@ -1174,7 +1174,8 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p)
|
|||
u32_to_b4(xd.nvm_fuse_offset, m->offset & ~7);
|
||||
} else if (matches(m->desc, "lock")) {
|
||||
u32_to_b4(xd.nvm_lock_offset, m->offset);
|
||||
} else if (strcmp(m->desc, "usersig") == 0) {
|
||||
} else if (strcmp(m->desc, "usersig") == 0 ||
|
||||
strcmp(m->desc, "userrow") == 0) {
|
||||
u32_to_b4(xd.nvm_user_sig_offset, m->offset);
|
||||
} else if (strcmp(m->desc, "prodsig") == 0) {
|
||||
u32_to_b4(xd.nvm_prod_sig_offset, m->offset);
|
||||
|
@ -1225,7 +1226,8 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p)
|
|||
u16_to_b2(xd.eeprom_bytes, m->size);
|
||||
u16_to_b2(xd.eeprom_base, m->offset);
|
||||
}
|
||||
else if (strcmp(m->desc, "usersig") == 0)
|
||||
else if (strcmp(m->desc, "usersig") == 0 ||
|
||||
strcmp(m->desc, "userrow") == 0)
|
||||
{
|
||||
u16_to_b2(xd.user_sig_bytes, m->size);
|
||||
u16_to_b2(xd.user_sig_base, m->offset);
|
||||
|
@ -1265,7 +1267,7 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p)
|
|||
"xd->flash_page_size=%x\n\t"
|
||||
"xd->eeprom_page_size=%x\n\t"
|
||||
"xd->nvmctrl=%x %x\n\t"
|
||||
"xd->ocd=%x %x\n\t",
|
||||
"xd->ocd=%x %x\n\t"
|
||||
"xd->address_mode=%x\n",
|
||||
xd.prog_base_msb,
|
||||
xd.prog_base[0], xd.prog_base[1],
|
||||
|
@ -1686,9 +1688,10 @@ static int jtag3_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|||
cmd[3] = XMEGA_ERASE_BOOT_PAGE;
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
cmd[3] = XMEGA_ERASE_EEPROM_PAGE;
|
||||
} else if ( ( strcmp(m->desc, "usersig") == 0 ) ) {
|
||||
} else if (strcmp(m->desc, "usersig") == 0 ||
|
||||
strcmp(m->desc, "userrow") == 0) {
|
||||
cmd[3] = XMEGA_ERASE_USERSIG;
|
||||
} else if ( ( strcmp(m->desc, "boot") == 0 ) ) {
|
||||
} else if (strcmp(m->desc, "boot") == 0) {
|
||||
cmd[3] = XMEGA_ERASE_BOOT_PAGE;
|
||||
} else {
|
||||
cmd[3] = XMEGA_ERASE_APP_PAGE;
|
||||
|
@ -1760,9 +1763,10 @@ static int jtag3_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|||
}
|
||||
cmd[3] = ( p->flags & AVRPART_HAS_PDI ) ? MTYPE_EEPROM_XMEGA : MTYPE_EEPROM_PAGE;
|
||||
PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
|
||||
} else if ( ( strcmp(m->desc, "usersig") == 0 ) ) {
|
||||
} else if (strcmp(m->desc, "usersig") == 0 ||
|
||||
strcmp(m->desc, "userrow") == 0) {
|
||||
cmd[3] = MTYPE_USERSIG;
|
||||
} else if ( ( strcmp(m->desc, "boot") == 0 ) ) {
|
||||
} else if (strcmp(m->desc, "boot") == 0) {
|
||||
cmd[3] = MTYPE_BOOT_FLASH;
|
||||
} else if ( p->flags & AVRPART_HAS_PDI || p->flags & AVRPART_HAS_UPDI ) {
|
||||
cmd[3] = MTYPE_FLASH;
|
||||
|
@ -1849,11 +1853,12 @@ static int jtag3_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|||
cmd[3] = ( p->flags & AVRPART_HAS_PDI || p->flags & AVRPART_HAS_UPDI ) ? MTYPE_EEPROM : MTYPE_EEPROM_PAGE;
|
||||
if (pgm->flag & PGM_FL_IS_DW)
|
||||
return -1;
|
||||
} else if ( ( strcmp(m->desc, "prodsig") == 0 ) ) {
|
||||
} else if (strcmp(m->desc, "prodsig") == 0) {
|
||||
cmd[3] = MTYPE_PRODSIG;
|
||||
} else if ( ( strcmp(m->desc, "usersig") == 0 ) ) {
|
||||
} else if (strcmp(m->desc, "usersig") == 0 ||
|
||||
strcmp(m->desc, "userrow") == 0) {
|
||||
cmd[3] = MTYPE_USERSIG;
|
||||
} else if ( ( strcmp(m->desc, "boot") == 0 ) ) {
|
||||
} else if (strcmp(m->desc, "boot") == 0) {
|
||||
cmd[3] = MTYPE_BOOT_FLASH;
|
||||
} else if ( p->flags & AVRPART_HAS_PDI ) {
|
||||
cmd[3] = MTYPE_FLASH;
|
||||
|
@ -1965,7 +1970,8 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
|||
cmd[3] = MTYPE_FUSE_BITS;
|
||||
if (!(p->flags & AVRPART_HAS_UPDI))
|
||||
addr = mem->offset & 7;
|
||||
} else if (strcmp(mem->desc, "usersig") == 0) {
|
||||
} else if (strcmp(mem->desc, "usersig") == 0 ||
|
||||
strcmp(mem->desc, "userrow") == 0) {
|
||||
cmd[3] = MTYPE_USERSIG;
|
||||
} else if (strcmp(mem->desc, "prodsig") == 0) {
|
||||
cmd[3] = MTYPE_PRODSIG;
|
||||
|
@ -2126,7 +2132,8 @@ static int jtag3_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
|||
cmd[3] = MTYPE_FUSE_BITS;
|
||||
if (!(p->flags & AVRPART_HAS_UPDI))
|
||||
addr = mem->offset & 7;
|
||||
} else if (strcmp(mem->desc, "usersig") == 0) {
|
||||
} else if (strcmp(mem->desc, "usersig") == 0 ||
|
||||
strcmp(mem->desc, "userrow") == 0) {
|
||||
cmd[3] = MTYPE_USERSIG;
|
||||
} else if (strcmp(mem->desc, "prodsig") == 0) {
|
||||
cmd[3] = MTYPE_PRODSIG;
|
||||
|
@ -2465,7 +2472,10 @@ static unsigned int jtag3_memaddr(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, uns
|
|||
* Non-Xmega device.
|
||||
*/
|
||||
if (p->flags & AVRPART_HAS_UPDI) {
|
||||
if (m->size == 1) {
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
return addr;
|
||||
}
|
||||
else if (m->size == 1) {
|
||||
addr = m->offset;
|
||||
}
|
||||
else if (m->size > 1) {
|
||||
|
|
|
@ -1056,7 +1056,8 @@ static void jtagmkII_set_xmega_params(PROGRAMMER * pgm, AVRPART * p)
|
|||
u32_to_b4(sendbuf.dd.nvm_fuse_offset, m->offset & ~7);
|
||||
} else if (strncmp(m->desc, "lock", 4) == 0) {
|
||||
u32_to_b4(sendbuf.dd.nvm_lock_offset, m->offset);
|
||||
} else if (strcmp(m->desc, "usersig") == 0) {
|
||||
} else if (strcmp(m->desc, "usersig") == 0 ||
|
||||
strcmp(m->desc, "userrow") == 0) {
|
||||
u32_to_b4(sendbuf.dd.nvm_user_sig_offset, m->offset);
|
||||
} else if (strcmp(m->desc, "prodsig") == 0) {
|
||||
u32_to_b4(sendbuf.dd.nvm_prod_sig_offset, m->offset);
|
||||
|
@ -1933,9 +1934,10 @@ static int jtagmkII_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|||
cmd[1] = XMEGA_ERASE_BOOT_PAGE;
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
cmd[1] = XMEGA_ERASE_EEPROM_PAGE;
|
||||
} else if ( ( strcmp(m->desc, "usersig") == 0 ) ) {
|
||||
} else if (strcmp(m->desc, "usersig") == 0 ||
|
||||
strcmp(m->desc, "userrow") == 0) {
|
||||
cmd[1] = XMEGA_ERASE_USERSIG;
|
||||
} else if ( ( strcmp(m->desc, "boot") == 0 ) ) {
|
||||
} else if (strcmp(m->desc, "boot") == 0) {
|
||||
cmd[1] = XMEGA_ERASE_BOOT_PAGE;
|
||||
} else {
|
||||
cmd[1] = XMEGA_ERASE_APP_PAGE;
|
||||
|
@ -2044,13 +2046,14 @@ static int jtagmkII_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|||
free(cmd);
|
||||
return n_bytes;
|
||||
}
|
||||
cmd[1] = ( p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI) ) ? MTYPE_EEPROM : MTYPE_EEPROM_PAGE;
|
||||
cmd[1] = (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) ? MTYPE_EEPROM : MTYPE_EEPROM_PAGE;
|
||||
PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
|
||||
} else if ( ( strcmp(m->desc, "usersig") == 0 ) ) {
|
||||
} else if (strcmp(m->desc, "usersig") == 0 ||
|
||||
strcmp(m->desc, "userrow") == 0) {
|
||||
cmd[1] = MTYPE_USERSIG;
|
||||
} else if ( ( strcmp(m->desc, "boot") == 0 ) ) {
|
||||
} else if (strcmp(m->desc, "boot") == 0) {
|
||||
cmd[1] = MTYPE_BOOT_FLASH;
|
||||
} else if ( p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI) ) {
|
||||
} else if (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) {
|
||||
cmd[1] = MTYPE_FLASH;
|
||||
} else {
|
||||
cmd[1] = MTYPE_SPM;
|
||||
|
@ -2156,16 +2159,17 @@ static int jtagmkII_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|||
/* dynamically decide between flash/boot memtype */
|
||||
dynamic_memtype = 1;
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
cmd[1] = ( p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI) ) ? MTYPE_EEPROM : MTYPE_EEPROM_PAGE;
|
||||
cmd[1] = (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) ? MTYPE_EEPROM : MTYPE_EEPROM_PAGE;
|
||||
if (pgm->flag & PGM_FL_IS_DW)
|
||||
return -1;
|
||||
} else if ( ( strcmp(m->desc, "prodsig") == 0 ) ) {
|
||||
} else if (strcmp(m->desc, "prodsig") == 0) {
|
||||
cmd[1] = MTYPE_PRODSIG;
|
||||
} else if ( ( strcmp(m->desc, "usersig") == 0 ) ) {
|
||||
} else if (strcmp(m->desc, "usersig") == 0 ||
|
||||
strcmp(m->desc, "userrow") == 0) {
|
||||
cmd[1] = MTYPE_USERSIG;
|
||||
} else if ( ( strcmp(m->desc, "boot") == 0 ) ) {
|
||||
} else if (strcmp(m->desc, "boot") == 0) {
|
||||
cmd[1] = MTYPE_BOOT_FLASH;
|
||||
} else if ( p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI) ) {
|
||||
} else if (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) {
|
||||
cmd[1] = MTYPE_FLASH;
|
||||
} else {
|
||||
cmd[1] = MTYPE_SPM;
|
||||
|
@ -2291,7 +2295,8 @@ static int jtagmkII_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
|||
unsupp = 1;
|
||||
} else if (strncmp(mem->desc, "fuse", strlen("fuse")) == 0) {
|
||||
cmd[1] = MTYPE_FUSE_BITS;
|
||||
} else if (strcmp(mem->desc, "usersig") == 0) {
|
||||
} else if (strcmp(mem->desc, "usersig") == 0 ||
|
||||
strcmp(mem->desc, "userrow") == 0) {
|
||||
cmd[1] = MTYPE_USERSIG;
|
||||
} else if (strcmp(mem->desc, "prodsig") == 0) {
|
||||
cmd[1] = MTYPE_PRODSIG;
|
||||
|
@ -2460,7 +2465,8 @@ static int jtagmkII_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
|||
unsupp = 1;
|
||||
} else if (strncmp(mem->desc, "fuse", strlen("fuse")) == 0) {
|
||||
cmd[1] = MTYPE_FUSE_BITS;
|
||||
} else if (strcmp(mem->desc, "usersig") == 0) {
|
||||
} else if (strcmp(mem->desc, "usersig") == 0 ||
|
||||
strcmp(mem->desc, "userrow") == 0) {
|
||||
cmd[1] = MTYPE_USERSIG;
|
||||
} else if (strcmp(mem->desc, "prodsig") == 0) {
|
||||
cmd[1] = MTYPE_PRODSIG;
|
||||
|
|
|
@ -223,7 +223,7 @@ static int linuxspi_open(PROGRAMMER *pgm, char *port)
|
|||
avrdude_message(MSG_INFO,
|
||||
"%s: obsolete use of -b <clock> option for bit clock; use -B <clock>\n",
|
||||
progname);
|
||||
pgm->bitclock = 1E6 / pgm->baudrate;
|
||||
pgm->bitclock = 1.0 / pgm->baudrate;
|
||||
}
|
||||
if (pgm->bitclock == 0) {
|
||||
avrdude_message(MSG_NOTICE,
|
||||
|
|
|
@ -571,6 +571,11 @@ int main(int argc, char * argv [])
|
|||
terminal = 1;
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
avrdude_message(MSG_INFO, "%s: \"safemode\" feature no longer supported\n",
|
||||
progname);
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
upd = parse_op(optarg);
|
||||
if (upd == NULL) {
|
||||
|
|
136
src/ser_posix.c
136
src/ser_posix.c
|
@ -28,6 +28,7 @@
|
|||
#include "ac_cfg.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -42,6 +43,10 @@
|
|||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include <IOKit/serial/ioss.h>
|
||||
#endif
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "libavrdude.h"
|
||||
|
||||
|
@ -78,10 +83,12 @@ static struct baud_mapping baud_lookup_table [] = {
|
|||
static struct termios original_termios;
|
||||
static int saved_original_termios;
|
||||
|
||||
static speed_t serial_baud_lookup(long baud)
|
||||
static speed_t serial_baud_lookup(long baud, bool *nonstandard)
|
||||
{
|
||||
struct baud_mapping *map = baud_lookup_table;
|
||||
|
||||
*nonstandard = false;
|
||||
|
||||
while (map->baud) {
|
||||
if (map->baud == baud)
|
||||
return map->speed;
|
||||
|
@ -92,30 +99,20 @@ static speed_t serial_baud_lookup(long baud)
|
|||
* If a non-standard BAUD rate is used, issue
|
||||
* a warning (if we are verbose) and return the raw rate
|
||||
*/
|
||||
avrdude_message(MSG_NOTICE, "%s: serial_baud_lookup(): Using non-standard baud rate: %ld",
|
||||
avrdude_message(MSG_NOTICE, "%s: serial_baud_lookup(): Using non-standard baud rate: %ld\n",
|
||||
progname, baud);
|
||||
|
||||
return baud;
|
||||
}
|
||||
*nonstandard = true;
|
||||
|
||||
static tcflag_t translate_flags(unsigned long cflags)
|
||||
{
|
||||
return ((cflags & SERIAL_CS5) ? CS5 : 0) |
|
||||
((cflags & SERIAL_CS6) ? CS6 : 0) |
|
||||
((cflags & SERIAL_CS7) ? CS7 : 0) |
|
||||
((cflags & SERIAL_CS8) ? CS8 : 0) |
|
||||
((cflags & SERIAL_CSTOPB) ? CSTOPB : 0) |
|
||||
((cflags & SERIAL_CREAD) ? CREAD : 0) |
|
||||
((cflags & (SERIAL_PARENB | SERIAL_PARODD)) ? PARENB : 0) |
|
||||
((cflags & SERIAL_PARODD) ? PARODD : 0) |
|
||||
((cflags & SERIAL_CLOCAL) ? CLOCAL : 0) ;
|
||||
return baud;
|
||||
}
|
||||
|
||||
static int ser_setparams(union filedescriptor *fd, long baud, unsigned long cflags)
|
||||
{
|
||||
int rc;
|
||||
struct termios termios;
|
||||
speed_t speed = serial_baud_lookup (baud);
|
||||
bool nonstandard;
|
||||
speed_t speed = serial_baud_lookup (baud, &nonstandard);
|
||||
|
||||
if (!isatty(fd->ifd))
|
||||
return -ENOTTY;
|
||||
|
@ -137,15 +134,86 @@ static int ser_setparams(union filedescriptor *fd, long baud, unsigned long cfla
|
|||
original_termios = termios;
|
||||
}
|
||||
|
||||
termios.c_iflag = IGNBRK;
|
||||
termios.c_oflag = 0;
|
||||
termios.c_lflag = 0;
|
||||
termios.c_cflag = translate_flags(cflags);
|
||||
termios.c_cc[VMIN] = 1;
|
||||
termios.c_cc[VTIME] = 0;
|
||||
if (cflags & SERIAL_CREAD) {
|
||||
termios.c_cflag |= CREAD;
|
||||
}
|
||||
if (cflags & SERIAL_CLOCAL) {
|
||||
termios.c_cflag |= CLOCAL;
|
||||
}
|
||||
termios.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL | ISIG | IEXTEN);
|
||||
#ifdef ECHOCTL
|
||||
termios.c_lflag &= ~ECHOCTL;
|
||||
#endif /* ECHOCTL */
|
||||
#ifdef ECHOKE
|
||||
termios.c_lflag &= ~ECHOKE;
|
||||
#endif /* ECHOKE */
|
||||
termios.c_oflag &= ~(OPOST | ONLCR | OCRNL);
|
||||
termios.c_iflag &= ~(INLCR | IGNCR | ICRNL | IGNBRK);
|
||||
#ifdef IUCLC
|
||||
termios.c_iflag &= ~IUCLC;
|
||||
#endif /* IUCLC */
|
||||
#ifdef PARMRK
|
||||
termios.c_iflag &= ~PARMRK;
|
||||
#endif /* PARMRK */
|
||||
|
||||
// MacOS doesn't handle nonstandard baudrate values in
|
||||
// normal tcsetattr(), sigh.
|
||||
#ifdef __APPLE__
|
||||
if (!nonstandard) {
|
||||
#endif
|
||||
cfsetospeed(&termios, speed);
|
||||
cfsetispeed(&termios, speed);
|
||||
#ifdef __APPLE__
|
||||
}
|
||||
#endif
|
||||
|
||||
termios.c_cflag &= ~CSIZE;
|
||||
if (cflags & SERIAL_CS8) {
|
||||
termios.c_cflag |= CS8;
|
||||
}
|
||||
if (cflags & SERIAL_CS7) {
|
||||
termios.c_cflag |= CS7;
|
||||
}
|
||||
if (cflags & SERIAL_CS6) {
|
||||
termios.c_cflag |= CS6;
|
||||
}
|
||||
if (cflags & SERIAL_CS5) {
|
||||
termios.c_cflag |= CS5;
|
||||
}
|
||||
|
||||
if (cflags & SERIAL_CSTOPB) {
|
||||
termios.c_cflag |= CSTOPB;
|
||||
} else {
|
||||
termios.c_cflag &= ~CSTOPB;
|
||||
}
|
||||
|
||||
termios.c_iflag &= ~(INPCK | ISTRIP);
|
||||
|
||||
if (cflags & (SERIAL_PARENB | SERIAL_PARODD)) {
|
||||
termios.c_cflag |= PARENB;
|
||||
} else {
|
||||
termios.c_cflag &= ~PARENB;
|
||||
}
|
||||
|
||||
if (cflags & SERIAL_PARODD) {
|
||||
termios.c_cflag |= PARODD;
|
||||
} else {
|
||||
termios.c_cflag &= ~PARODD;
|
||||
}
|
||||
|
||||
#ifdef IXANY
|
||||
termios.c_iflag &= ~IXANY;
|
||||
#endif /* IXANY */
|
||||
termios.c_iflag &= ~(IXON | IXOFF);
|
||||
|
||||
#ifdef CRTSCTS
|
||||
termios.c_iflag &= ~CRTSCTS;
|
||||
#endif /* CRTSCTS */
|
||||
|
||||
#ifdef CNEW_RTSCTS
|
||||
termios.c_iflag &= ~CNEW_RTSCTS;
|
||||
#endif /* CRTSCTS */
|
||||
|
||||
cfsetospeed(&termios, speed);
|
||||
cfsetispeed(&termios, speed);
|
||||
|
||||
rc = tcsetattr(fd->ifd, TCSANOW, &termios);
|
||||
if (rc < 0) {
|
||||
|
@ -154,14 +222,19 @@ static int ser_setparams(union filedescriptor *fd, long baud, unsigned long cfla
|
|||
return -errno;
|
||||
}
|
||||
|
||||
/*
|
||||
* Everything is now set up for a local line without modem control
|
||||
* or flow control, so clear O_NONBLOCK again.
|
||||
*/
|
||||
rc = fcntl(fd->ifd, F_GETFL, 0);
|
||||
if (rc != -1)
|
||||
fcntl(fd->ifd, F_SETFL, rc & ~O_NONBLOCK);
|
||||
#ifdef __APPLE__
|
||||
// handle nonstandard speed values the MacOS way
|
||||
if (nonstandard) {
|
||||
if (ioctl(fd->ifd, IOSSIOSPEED, &speed) < 0) {
|
||||
avrdude_message(MSG_INFO, "%s: ser_setparams(): ioctrl(IOSSIOSPEED) failed\n",
|
||||
progname);
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
#endif // __APPLE__
|
||||
|
||||
tcflush(fd->ifd, TCIFLUSH);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -520,3 +593,4 @@ struct serial_device serial_serdev =
|
|||
struct serial_device *serdev = &serial_serdev;
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
|
|
@ -3869,7 +3869,8 @@ static int stk600_xprog_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
|||
* fuses.
|
||||
*/
|
||||
need_erase = 1;
|
||||
} else if (strcmp(mem->desc, "usersig") == 0) {
|
||||
} else if (strcmp(mem->desc, "usersig") == 0 ||
|
||||
strcmp(mem->desc, "userrow") == 0) {
|
||||
memcode = XPRG_MEM_TYPE_USERSIG;
|
||||
} else {
|
||||
avrdude_message(MSG_INFO, "%s: stk600_xprog_write_byte(): unknown memory \"%s\"\n",
|
||||
|
@ -3944,7 +3945,8 @@ static int stk600_xprog_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
|||
} else if (strcmp(mem->desc, "calibration") == 0 ||
|
||||
strcmp(mem->desc, "prodsig") == 0) {
|
||||
b[1] = XPRG_MEM_TYPE_FACTORY_CALIBRATION;
|
||||
} else if (strcmp(mem->desc, "usersig") == 0) {
|
||||
} else if (strcmp(mem->desc, "usersig") == 0 ||
|
||||
strcmp(mem->desc, "userrow") == 0) {
|
||||
b[1] = XPRG_MEM_TYPE_USERSIG;
|
||||
} else {
|
||||
avrdude_message(MSG_INFO, "%s: stk600_xprog_read_byte(): unknown memory \"%s\"\n",
|
||||
|
@ -4019,7 +4021,8 @@ static int stk600_xprog_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
|||
} else if (strcmp(mem->desc, "calibration") == 0 ||
|
||||
strcmp(mem->desc, "prodsig") == 0) {
|
||||
memtype = XPRG_MEM_TYPE_FACTORY_CALIBRATION;
|
||||
} else if (strcmp(mem->desc, "usersig") == 0) {
|
||||
} else if (strcmp(mem->desc, "usersig") == 0 ||
|
||||
strcmp(mem->desc, "userrow") == 0) {
|
||||
memtype = XPRG_MEM_TYPE_USERSIG;
|
||||
} else {
|
||||
avrdude_message(MSG_INFO, "%s: stk600_xprog_paged_load(): unknown paged memory \"%s\"\n",
|
||||
|
@ -4132,7 +4135,8 @@ static int stk600_xprog_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
|||
} else if (strcmp(mem->desc, "calibration") == 0) {
|
||||
memtype = XPRG_MEM_TYPE_FACTORY_CALIBRATION;
|
||||
writemode = (1 << XPRG_MEM_WRITE_WRITE);
|
||||
} else if (strcmp(mem->desc, "usersig") == 0) {
|
||||
} else if (strcmp(mem->desc, "usersig") == 0 ||
|
||||
strcmp(mem->desc, "userrow") == 0) {
|
||||
memtype = XPRG_MEM_TYPE_USERSIG;
|
||||
writemode = (1 << XPRG_MEM_WRITE_WRITE);
|
||||
} else {
|
||||
|
@ -4290,7 +4294,8 @@ static int stk600_xprog_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
|||
b[1] = XPRG_ERASE_BOOT_PAGE;
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
b[1] = XPRG_ERASE_EEPROM_PAGE;
|
||||
} else if (strcmp(m->desc, "usersig") == 0) {
|
||||
} else if (strcmp(m->desc, "usersig") == 0 ||
|
||||
strcmp(m->desc, "userrow") == 0) {
|
||||
b[1] = XPRG_ERASE_USERSIG;
|
||||
} else {
|
||||
avrdude_message(MSG_INFO, "%s: stk600_xprog_page_erase(): unknown paged memory \"%s\"\n",
|
||||
|
|
386
src/term.c
386
src/term.c
|
@ -23,6 +23,7 @@
|
|||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
|
@ -125,9 +126,15 @@ static int nexttok(char * buf, char ** tok, char ** next)
|
|||
q++;
|
||||
|
||||
/* isolate first token */
|
||||
n = q+1;
|
||||
while (*n && !isspace((int)*n))
|
||||
n = q;
|
||||
uint8_t quotes = 0;
|
||||
while (*n && (!isspace((int)*n) || quotes)) {
|
||||
if (*n == '\"')
|
||||
quotes++;
|
||||
else if (isspace((int)*n) && *(n-1) == '\"')
|
||||
break;
|
||||
n++;
|
||||
}
|
||||
|
||||
if (*n) {
|
||||
*n = 0;
|
||||
|
@ -148,12 +155,10 @@ static int nexttok(char * buf, char ** tok, char ** next)
|
|||
static int hexdump_line(char * buffer, unsigned char * p, int n, int pad)
|
||||
{
|
||||
char * hexdata = "0123456789abcdef";
|
||||
char * b;
|
||||
int i, j;
|
||||
char * b = buffer;
|
||||
int32_t i = 0;
|
||||
int32_t j = 0;
|
||||
|
||||
b = buffer;
|
||||
|
||||
j = 0;
|
||||
for (i=0; i<n; i++) {
|
||||
if (i && ((i % 8) == 0))
|
||||
b[j++] = ' ';
|
||||
|
@ -182,7 +187,7 @@ static int chardump_line(char * buffer, unsigned char * p, int n, int pad)
|
|||
int i;
|
||||
char b [ 128 ];
|
||||
|
||||
for (i=0; i<n; i++) {
|
||||
for (int32_t i = 0; i < n; i++) {
|
||||
memcpy(b, p, n);
|
||||
buffer[i] = '.';
|
||||
if (isalpha((int)(b[i])) || isdigit((int)(b[i])) || ispunct((int)(b[i])))
|
||||
|
@ -191,7 +196,7 @@ static int chardump_line(char * buffer, unsigned char * p, int n, int pad)
|
|||
buffer[i] = ' ';
|
||||
}
|
||||
|
||||
for (i=n; i<pad; i++)
|
||||
for (i = n; i < pad; i++)
|
||||
buffer[i] = ' ';
|
||||
|
||||
buffer[i] = 0;
|
||||
|
@ -202,16 +207,13 @@ static int chardump_line(char * buffer, unsigned char * p, int n, int pad)
|
|||
|
||||
static int hexdump_buf(FILE * f, int startaddr, unsigned char * buf, int len)
|
||||
{
|
||||
int addr;
|
||||
int n;
|
||||
unsigned char * p;
|
||||
char dst1[80];
|
||||
char dst2[80];
|
||||
|
||||
addr = startaddr;
|
||||
p = (unsigned char *)buf;
|
||||
int32_t addr = startaddr;
|
||||
unsigned char * p = (unsigned char *)buf;
|
||||
while (len) {
|
||||
n = 16;
|
||||
int32_t n = 16;
|
||||
if (n > len)
|
||||
n = len;
|
||||
hexdump_line(dst1, p, n, 48);
|
||||
|
@ -229,92 +231,99 @@ static int hexdump_buf(FILE * f, int startaddr, unsigned char * buf, int len)
|
|||
static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char * argv[])
|
||||
{
|
||||
static char prevmem[128] = {0};
|
||||
char * e;
|
||||
unsigned char * buf;
|
||||
int maxsize;
|
||||
unsigned long i;
|
||||
static unsigned long addr=0;
|
||||
static int len=64;
|
||||
AVRMEM * mem;
|
||||
char * memtype = NULL;
|
||||
int rc;
|
||||
|
||||
if (!((argc == 2) || (argc == 4))) {
|
||||
avrdude_message(MSG_INFO, "Usage: dump <memtype> [<addr> <len>]\n");
|
||||
return -1;
|
||||
if (argc < 2) {
|
||||
avrdude_message(MSG_INFO, "Usage: %s <memtype> [<start addr> <len>]\n"
|
||||
" %s <memtype> [<start addr> <...>]\n"
|
||||
" %s <memtype> <...>\n"
|
||||
" %s <memtype>\n",
|
||||
argv[0], argv[0], argv[0], argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memtype = argv[1];
|
||||
|
||||
if (strncmp(prevmem, memtype, strlen(memtype)) != 0) {
|
||||
addr = 0;
|
||||
len = 64;
|
||||
strncpy(prevmem, memtype, sizeof(prevmem)-1);
|
||||
prevmem[sizeof(prevmem)-1] = 0;
|
||||
}
|
||||
|
||||
mem = avr_locate_mem(p, memtype);
|
||||
enum { read_size = 256 };
|
||||
static char prevmem[128] = {0x00};
|
||||
char * memtype = argv[1];
|
||||
AVRMEM * mem = avr_locate_mem(p, memtype);
|
||||
if (mem == NULL) {
|
||||
avrdude_message(MSG_INFO, "\"%s\" memory type not defined for part \"%s\"\n",
|
||||
memtype, p->desc);
|
||||
return -1;
|
||||
}
|
||||
uint32_t maxsize = mem->size;
|
||||
|
||||
// Get start address if present
|
||||
char * end_ptr;
|
||||
static uint32_t addr = 0;
|
||||
if (argc == 4) {
|
||||
addr = strtoul(argv[2], &e, 0);
|
||||
if (*e || (e == argv[2])) {
|
||||
avrdude_message(MSG_INFO, "%s (dump): can't parse address \"%s\"\n",
|
||||
progname, argv[2]);
|
||||
addr = strtoul(argv[2], &end_ptr, 0);
|
||||
if (*end_ptr || (end_ptr == argv[2])) {
|
||||
avrdude_message(MSG_INFO, "%s (%s): can't parse address \"%s\"\n",
|
||||
progname, argv[0], argv[2]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
len = strtol(argv[3], &e, 0);
|
||||
if (*e || (e == argv[3])) {
|
||||
avrdude_message(MSG_INFO, "%s (dump): can't parse length \"%s\"\n",
|
||||
progname, argv[3]);
|
||||
} else if (addr >= maxsize) {
|
||||
avrdude_message(MSG_INFO, "%s (%s): address 0x%05lx is out of range for %s memory\n",
|
||||
progname, argv[0], addr, mem->desc);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
maxsize = mem->size;
|
||||
|
||||
if (addr >= maxsize) {
|
||||
if (argc == 2) {
|
||||
/* wrap around */
|
||||
// Get no. bytes to read if present
|
||||
static int32_t len = read_size;
|
||||
if (argc >= 3) {
|
||||
memset(prevmem, 0x00, sizeof(prevmem));
|
||||
if (strcmp(argv[argc - 1], "...") == 0) {
|
||||
if (argc == 3)
|
||||
addr = 0;
|
||||
len = maxsize - addr;
|
||||
} else if (argc == 4) {
|
||||
len = strtol(argv[3], &end_ptr, 0);
|
||||
if (*end_ptr || (end_ptr == argv[3])) {
|
||||
avrdude_message(MSG_INFO, "%s (%s): can't parse length \"%s\"\n",
|
||||
progname, argv[0], argv[3]);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
len = read_size;
|
||||
}
|
||||
}
|
||||
// No address or length specified
|
||||
else if (argc == 2) {
|
||||
if (strncmp(prevmem, memtype, strlen(memtype)) != 0) {
|
||||
addr = 0;
|
||||
len = read_size;
|
||||
strncpy(prevmem, memtype, sizeof(prevmem) - 1);
|
||||
prevmem[sizeof(prevmem) - 1] = 0;
|
||||
}
|
||||
else {
|
||||
avrdude_message(MSG_INFO, "%s (dump): address 0x%05lx is out of range for %s memory\n",
|
||||
progname, addr, mem->desc);
|
||||
return -1;
|
||||
}
|
||||
if (addr >= maxsize)
|
||||
addr = 0; // Wrap around
|
||||
}
|
||||
|
||||
/* trim len if nessary to not read past the end of memory */
|
||||
// Trim len if nessary to not read past the end of memory
|
||||
if ((addr + len) > maxsize)
|
||||
len = maxsize - addr;
|
||||
|
||||
buf = malloc(len);
|
||||
uint8_t * buf = malloc(len);
|
||||
if (buf == NULL) {
|
||||
avrdude_message(MSG_INFO, "%s (dump): out of memory\n", progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i=0; i<len; i++) {
|
||||
rc = pgm->read_byte(pgm, p, mem, addr+i, &buf[i]);
|
||||
report_progress(0, 1, "Reading");
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
int32_t rc = pgm->read_byte(pgm, p, mem, addr + i, &buf[i]);
|
||||
if (rc != 0) {
|
||||
avrdude_message(MSG_INFO, "error reading %s address 0x%05lx of part %s\n",
|
||||
mem->desc, addr+i, p->desc);
|
||||
mem->desc, addr + i, p->desc);
|
||||
if (rc == -1)
|
||||
avrdude_message(MSG_INFO, "read operation not supported on memory type \"%s\"\n",
|
||||
mem->desc);
|
||||
return -1;
|
||||
}
|
||||
report_progress(i, len, NULL);
|
||||
}
|
||||
report_progress(1, 1, NULL);
|
||||
|
||||
hexdump_buf(stdout, addr, buf, len);
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
free(buf);
|
||||
|
@ -328,35 +337,31 @@ static int cmd_dump(PROGRAMMER * pgm, struct avrpart * p,
|
|||
static int cmd_write(PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char * argv[])
|
||||
{
|
||||
char * e;
|
||||
int len, maxsize;
|
||||
char * memtype;
|
||||
unsigned long addr, i;
|
||||
unsigned char * buf;
|
||||
unsigned char b;
|
||||
int rc;
|
||||
int werror;
|
||||
AVRMEM * mem;
|
||||
|
||||
if (argc < 4) {
|
||||
avrdude_message(MSG_INFO, "Usage: write <memtype> <addr> <byte1> "
|
||||
"<byte2> ... <byteN>\n");
|
||||
avrdude_message(MSG_INFO,
|
||||
"Usage: write <memtype> <start addr> <data1> <data2> <dataN>\n"
|
||||
" write <memtype> <start addr> <no. bytes> <data1> <dataN> <...>\n\n"
|
||||
" Add a suffix to manually specify the size for each field:\n"
|
||||
" HH/hh: 8-bit, H/h/S/s: 16-bit, L/l: 32-bit, LL/ll: 64-bit, F/f: 32-bit float\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
memtype = argv[1];
|
||||
|
||||
mem = avr_locate_mem(p, memtype);
|
||||
int32_t i;
|
||||
uint8_t write_mode; // Operation mode, "standard" or "fill"
|
||||
uint8_t start_offset; // Which argc argument
|
||||
int32_t len; // Number of bytes to write to memory
|
||||
char * memtype = argv[1]; // Memory name string
|
||||
AVRMEM * mem = avr_locate_mem(p, memtype);
|
||||
if (mem == NULL) {
|
||||
avrdude_message(MSG_INFO, "\"%s\" memory type not defined for part \"%s\"\n",
|
||||
memtype, p->desc);
|
||||
return -1;
|
||||
}
|
||||
uint32_t maxsize = mem->size;
|
||||
|
||||
maxsize = mem->size;
|
||||
|
||||
addr = strtoul(argv[2], &e, 0);
|
||||
if (*e || (e == argv[2])) {
|
||||
char * end_ptr;
|
||||
int32_t addr = strtoul(argv[2], &end_ptr, 0);
|
||||
if (*end_ptr || (end_ptr == argv[2])) {
|
||||
avrdude_message(MSG_INFO, "%s (write): can't parse address \"%s\"\n",
|
||||
progname, argv[2]);
|
||||
return -1;
|
||||
|
@ -368,61 +373,228 @@ static int cmd_write(PROGRAMMER * pgm, struct avrpart * p,
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* number of bytes to write at the specified address */
|
||||
len = argc - 3;
|
||||
|
||||
if ((addr + len) > maxsize) {
|
||||
avrdude_message(MSG_INFO, "%s (write): selected address and # bytes exceed "
|
||||
"range for %s memory\n",
|
||||
progname, memtype);
|
||||
return -1;
|
||||
}
|
||||
|
||||
buf = malloc(len);
|
||||
// Allocate a buffer guaranteed to be large enough
|
||||
uint8_t * buf = calloc(mem->size + 0x10 + strlen(argv[argc - 2]), sizeof(uint8_t));
|
||||
if (buf == NULL) {
|
||||
avrdude_message(MSG_INFO, "%s (write): out of memory\n", progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i=3; i<argc; i++) {
|
||||
buf[i-3] = strtoul(argv[i], &e, 0);
|
||||
if (*e || (e == argv[i])) {
|
||||
avrdude_message(MSG_INFO, "%s (write): can't parse byte \"%s\"\n",
|
||||
progname, argv[i]);
|
||||
// Find the first argument to write to flash and how many arguments to parse and write
|
||||
if (strcmp(argv[argc - 1], "...") == 0) {
|
||||
write_mode = WRITE_MODE_FILL;
|
||||
start_offset = 4;
|
||||
len = strtoul(argv[3], &end_ptr, 0);
|
||||
if (*end_ptr || (end_ptr == argv[3])) {
|
||||
avrdude_message(MSG_INFO, "%s (write ...): can't parse address \"%s\"\n",
|
||||
progname, argv[3]);
|
||||
free(buf);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
write_mode = WRITE_MODE_STANDARD;
|
||||
start_offset = 3;
|
||||
len = argc - start_offset;
|
||||
}
|
||||
|
||||
pgm->err_led(pgm, OFF);
|
||||
for (werror=0, i=0; i<len; i++) {
|
||||
// Structure related to data that is being written to memory
|
||||
struct Data {
|
||||
// Data info
|
||||
int32_t bytes_grown;
|
||||
uint8_t size;
|
||||
bool is_float;
|
||||
bool is_signed;
|
||||
char * str_ptr;
|
||||
// Data union
|
||||
union {
|
||||
float f;
|
||||
int64_t ll;
|
||||
uint8_t a[8];
|
||||
};
|
||||
} data = {
|
||||
.bytes_grown = 0,
|
||||
.size = 0,
|
||||
.is_float = false,
|
||||
.is_signed = false,
|
||||
.str_ptr = NULL,
|
||||
.ll = 0
|
||||
};
|
||||
|
||||
rc = avr_write_byte(pgm, p, mem, addr+i, buf[i]);
|
||||
for (i = start_offset; i < len + start_offset; i++) {
|
||||
data.is_float = false;
|
||||
data.size = 0;
|
||||
|
||||
// Handle the next argument
|
||||
if (i < argc - start_offset + 3) {
|
||||
// Free string pointer if already allocated
|
||||
if(data.str_ptr) {
|
||||
free(data.str_ptr);
|
||||
data.str_ptr = NULL;
|
||||
}
|
||||
|
||||
// Get suffix if present
|
||||
char suffix = argv[i][strlen(argv[i]) - 1];
|
||||
char lsuffix = argv[i][strlen(argv[i]) - 2];
|
||||
if ((suffix == 'L' && lsuffix == 'L') || (suffix == 'l' && lsuffix == 'l')) {
|
||||
argv[i][strlen(argv[i]) - 2] = '\0';
|
||||
data.size = 8;
|
||||
} else if (suffix == 'L' || suffix == 'l') {
|
||||
argv[i][strlen(argv[i]) - 1] = '\0';
|
||||
data.size = 4;
|
||||
} else if ((suffix == 'F' || suffix == 'f') &&
|
||||
strncmp(argv[i], "0x", 2) != 0 && strncmp(argv[i], "-0x", 3) != 0) {
|
||||
argv[i][strlen(argv[i]) - 1] = '\0';
|
||||
data.size = 4;
|
||||
} else if ((suffix == 'H' && lsuffix == 'H') || (suffix == 'h' && lsuffix == 'h')) {
|
||||
argv[i][strlen(argv[i]) - 2] = '\0';
|
||||
data.size = 1;
|
||||
} else if (suffix == 'H' || suffix == 'h' || suffix == 'S' || suffix == 's') {
|
||||
argv[i][strlen(argv[i]) - 1] = '\0';
|
||||
data.size = 2;
|
||||
} else if (suffix == '\'') {
|
||||
data.size = 1;
|
||||
}
|
||||
|
||||
// Try integers
|
||||
data.ll = strtoll(argv[i], &end_ptr, 0);
|
||||
if (*end_ptr || (end_ptr == argv[i])) {
|
||||
// Try float
|
||||
data.f = strtof(argv[i], &end_ptr);
|
||||
data.is_float = true;
|
||||
if (*end_ptr || (end_ptr == argv[i])) {
|
||||
data.is_float = false;
|
||||
// Try single character
|
||||
if (argv[i][0] == '\'' && argv[i][2] == '\'') {
|
||||
data.ll = argv[i][1];
|
||||
} else {
|
||||
// Try string that starts and ends with quotes
|
||||
if (argv[i][0] == '\"' && argv[i][strlen(argv[i]) - 1] == '\"') {
|
||||
data.str_ptr = calloc(strlen(argv[i]), sizeof(char));
|
||||
if (data.str_ptr == NULL) {
|
||||
avrdude_message(MSG_INFO, "%s (write str): out of memory\n", progname);
|
||||
return -1;
|
||||
}
|
||||
// Strip start and end quotes
|
||||
strncpy(data.str_ptr, argv[i] + 1, strlen(argv[i]) - 2);
|
||||
} else {
|
||||
avrdude_message(MSG_INFO, "\n%s (write): can't parse data '%s'\n",
|
||||
progname, argv[i]);
|
||||
free(buf);
|
||||
if(data.str_ptr != NULL)
|
||||
free(data.str_ptr);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Print warning if data size might be ambiguous
|
||||
bool is_hex = (strncmp(argv[i], "0x", 2) == 0);
|
||||
bool is_neg_hex = (strncmp(argv[i], "-0x", 3) == 0);
|
||||
bool leading_zero = (strncmp(argv[i], "0x0", 3) == 0);
|
||||
int8_t hex_digits = (strlen(argv[i]) - 2);
|
||||
if(!data.size // No pre-defined size
|
||||
&& (is_neg_hex // Hex with - sign in front
|
||||
|| (is_hex && leading_zero && (hex_digits & (hex_digits - 1))) // Hex with 3, 5, 6 or 7 digits
|
||||
|| (!is_hex && !data.is_float && llabs(data.ll) > 0xFF && strlen(argv[i]) > 2))) // Base10 int greater than 255
|
||||
{
|
||||
avrdude_message(MSG_INFO, "Warning: no size suffix specified for \"%s\". "
|
||||
"Writing %d byte(s)\n",
|
||||
argv[i],
|
||||
llabs(data.ll) > UINT32_MAX ? 8 :
|
||||
llabs(data.ll) > UINT16_MAX || data.is_float ? 4 : \
|
||||
llabs(data.ll) > UINT8_MAX ? 2 : 1);
|
||||
}
|
||||
// Flag if signed integer and adjust size
|
||||
if (data.ll < 0 && !data.is_float) {
|
||||
data.is_signed = true;
|
||||
if (data.ll < INT32_MIN)
|
||||
data.size = 8;
|
||||
else if (data.ll < INT16_MIN)
|
||||
data.size = 4;
|
||||
else if (data.ll < INT8_MIN)
|
||||
data.size = 2;
|
||||
else
|
||||
data.size = 1;
|
||||
}
|
||||
}
|
||||
if(data.str_ptr) {
|
||||
for(int16_t j = 0; j < strlen(data.str_ptr); j++)
|
||||
buf[i - start_offset + data.bytes_grown++] = (uint8_t)data.str_ptr[j];
|
||||
} else {
|
||||
buf[i - start_offset + data.bytes_grown] = data.a[0];
|
||||
if (llabs(data.ll) > 0x000000FF || data.size >= 2 || data.is_float)
|
||||
buf[i - start_offset + ++data.bytes_grown] = data.a[1];
|
||||
if (llabs(data.ll) > 0x0000FFFF || data.size >= 4 || data.is_float) {
|
||||
buf[i - start_offset + ++data.bytes_grown] = data.a[2];
|
||||
buf[i - start_offset + ++data.bytes_grown] = data.a[3];
|
||||
}
|
||||
if (llabs(data.ll) > 0xFFFFFFFF || data.size == 8) {
|
||||
buf[i - start_offset + ++data.bytes_grown] = data.a[4];
|
||||
buf[i - start_offset + ++data.bytes_grown] = data.a[5];
|
||||
buf[i - start_offset + ++data.bytes_grown] = data.a[6];
|
||||
buf[i - start_offset + ++data.bytes_grown] = data.a[7];
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure buf does not overflow
|
||||
if (i - start_offset + data.bytes_grown > maxsize)
|
||||
break;
|
||||
}
|
||||
|
||||
// When in "fill" mode, the maximum size is already predefined
|
||||
if (write_mode == WRITE_MODE_FILL)
|
||||
data.bytes_grown = 0;
|
||||
|
||||
if ((addr + len + data.bytes_grown) > maxsize) {
|
||||
avrdude_message(MSG_INFO, "%s (write): selected address and # bytes exceed "
|
||||
"range for %s memory\n",
|
||||
progname, memtype);
|
||||
free(buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(data.str_ptr)
|
||||
free(data.str_ptr);
|
||||
|
||||
avrdude_message(MSG_NOTICE, "\nInfo: Writing %d bytes starting from address 0x%02x",
|
||||
len + data.bytes_grown, addr);
|
||||
if (write_mode == WRITE_MODE_FILL)
|
||||
avrdude_message(MSG_NOTICE, ". Remaining space filled with %s", argv[argc - 2]);
|
||||
avrdude_message(MSG_NOTICE, "\n");
|
||||
|
||||
pgm->err_led(pgm, OFF);
|
||||
bool werror = false;
|
||||
report_progress(0, 1, "Writing");
|
||||
for (i = 0; i < (len + data.bytes_grown); i++) {
|
||||
int32_t rc = avr_write_byte(pgm, p, mem, addr+i, buf[i]);
|
||||
if (rc) {
|
||||
avrdude_message(MSG_INFO, "%s (write): error writing 0x%02x at 0x%05lx, rc=%d\n",
|
||||
progname, buf[i], addr+i, rc);
|
||||
if (rc == -1)
|
||||
avrdude_message(MSG_INFO, "write operation not supported on memory type \"%s\"\n",
|
||||
mem->desc);
|
||||
werror = 1;
|
||||
werror = true;
|
||||
}
|
||||
|
||||
uint8_t b;
|
||||
rc = pgm->read_byte(pgm, p, mem, addr+i, &b);
|
||||
if (b != buf[i]) {
|
||||
avrdude_message(MSG_INFO, "%s (write): error writing 0x%02x at 0x%05lx cell=0x%02x\n",
|
||||
progname, buf[i], addr+i, b);
|
||||
werror = 1;
|
||||
werror = true;
|
||||
}
|
||||
|
||||
if (werror) {
|
||||
pgm->err_led(pgm, ON);
|
||||
}
|
||||
|
||||
report_progress(i, (len + data.bytes_grown), NULL);
|
||||
}
|
||||
report_progress(1, 1, NULL);
|
||||
|
||||
free(buf);
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,11 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
WRITE_MODE_STANDARD = 0,
|
||||
WRITE_MODE_FILL = 1,
|
||||
} mode;
|
||||
|
||||
int terminal_mode(PROGRAMMER * pgm, struct avrpart * p);
|
||||
char * terminal_get_input(const char *prompt);
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ static int usbhid_recv(union filedescriptor *fd, unsigned char *buf, size_t nbyt
|
|||
if (udev == NULL)
|
||||
return -1;
|
||||
|
||||
rv = i = hid_read_timeout(udev, buf, nbytes, 300);
|
||||
rv = i = hid_read_timeout(udev, buf, nbytes, 10000);
|
||||
if (i != nbytes)
|
||||
avrdude_message(MSG_INFO,
|
||||
"%s: Short read, read only %d out of %u bytes\n",
|
||||
|
|
Loading…
Reference in New Issue