mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-15 02:01:07 +00:00
Compare commits
538 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a855692d97 | ||
|
|
ec50337434 | ||
|
|
a2e456ca8a | ||
|
|
43ddea9102 | ||
|
|
a4c9fcdcd7 | ||
|
|
28ccd82edc | ||
|
|
ca16fc2ce6 | ||
|
|
d7c59ca2f9 | ||
|
|
4bcd0eaa1d | ||
|
|
08ad5ea445 | ||
|
|
5a3ff78844 | ||
|
|
74a92d7991 | ||
|
|
9d025e6a70 | ||
|
|
b99a145b9f | ||
|
|
60960ba590 | ||
|
|
99a75701b1 | ||
|
|
abe7180bb8 | ||
|
|
157b6a63c1 | ||
|
|
1363c7fe76 | ||
|
|
7e26a15375 | ||
|
|
e84210c6b0 | ||
|
|
08bd5fa938 | ||
|
|
17b67da03e | ||
|
|
795dd91575 | ||
|
|
8f100f5df3 | ||
|
|
f0f9059ade | ||
|
|
e069871c8e | ||
|
|
0aa43968a0 | ||
|
|
f22bc62b06 | ||
|
|
d09a4e93a2 | ||
|
|
aa7ae7bb87 | ||
|
|
1d0cbc2246 | ||
|
|
79c4137289 | ||
|
|
8697f6def7 | ||
|
|
981a6f1f20 | ||
|
|
c64db5fb76 | ||
|
|
50c373bf71 | ||
|
|
0c722bf288 | ||
|
|
28d1442fc8 | ||
|
|
75e4d06463 | ||
|
|
99f191a0ca | ||
|
|
33bace0cee | ||
|
|
0c912a201f | ||
|
|
31feb9ff75 | ||
|
|
c5a28eedc0 | ||
|
|
29a01c1047 | ||
|
|
426ea1fa78 | ||
|
|
6a5988ad64 | ||
|
|
dcf771424b | ||
|
|
67b56d322b | ||
|
|
27d201acb1 | ||
|
|
ded30f86bc | ||
|
|
9bc4a2463d | ||
|
|
8ad55e07ac | ||
|
|
d89817ddb9 | ||
|
|
fc6a71a142 | ||
|
|
da1271642e | ||
|
|
0e441013e9 | ||
|
|
c5f7939fca | ||
|
|
297d81818a | ||
|
|
7391e569b3 | ||
|
|
67ab74cd6a | ||
|
|
631f671fe8 | ||
|
|
248b554e8d | ||
|
|
40e3aa1790 | ||
|
|
dca5fc92bf | ||
|
|
4e05a8fa41 | ||
|
|
1299d6b8bd | ||
|
|
da315d7323 | ||
|
|
416c465ec0 | ||
|
|
41f524c1ba | ||
|
|
5ebb9047be | ||
|
|
fde7881611 | ||
|
|
1c94c95f1c | ||
|
|
e2995857ac | ||
|
|
a4cbd5c6fc | ||
|
|
87b39637ff | ||
|
|
34168759b0 | ||
|
|
c746c9bc9e | ||
|
|
65618ed655 | ||
|
|
00ea962abe | ||
|
|
d62f309a00 | ||
|
|
92a5ae20a6 | ||
|
|
5cbc9c37fc | ||
|
|
0f4b5b223b | ||
|
|
0b82b5c573 | ||
|
|
9355d67e0f | ||
|
|
d9c52249a9 | ||
|
|
c7174d7678 | ||
|
|
df6e2eea12 | ||
|
|
0d58adb10a | ||
|
|
ebb1849724 | ||
|
|
0c8b42524e | ||
|
|
b688b1f601 | ||
|
|
d89f695c31 | ||
|
|
1f2b570216 | ||
|
|
64cc54ac35 | ||
|
|
e2e5e44bab | ||
|
|
07ea8f5e09 | ||
|
|
0269817217 | ||
|
|
fe6290072a | ||
|
|
008f95f6ff | ||
|
|
a73567893b | ||
|
|
fa706f0d01 | ||
|
|
3532c567ac | ||
|
|
14f646822c | ||
|
|
bb73ade70b | ||
|
|
bb99a36a14 | ||
|
|
0d7d034d24 | ||
|
|
c7d1ebcf1f | ||
|
|
b891b7c64b | ||
|
|
a9b756e5c7 | ||
|
|
cf67a76c23 | ||
|
|
0e29b43bd0 | ||
|
|
4b9219edee | ||
|
|
428cd89e8d | ||
|
|
3efd3b2052 | ||
|
|
7c65adba26 | ||
|
|
75ab3c418e | ||
|
|
62f3b84eee | ||
|
|
066f54fbfa | ||
|
|
de19f203e0 | ||
|
|
d054c68b19 | ||
|
|
5c90fbbaae | ||
|
|
c2fe68ef7d | ||
|
|
c345985928 | ||
|
|
c1ec836fbd | ||
|
|
ba01fd7e30 | ||
|
|
59ecd4cc65 | ||
|
|
e31be88ce0 | ||
|
|
6e7f38e81f | ||
|
|
10e05eed21 | ||
|
|
551046052e | ||
|
|
2a92b8cce4 | ||
|
|
c007dc7d24 | ||
|
|
2589b17640 | ||
|
|
19e2cae053 | ||
|
|
932f68f24c | ||
|
|
b1d34a510c | ||
|
|
f2bdcbe977 | ||
|
|
7b79b72794 | ||
|
|
76a17be4d0 | ||
|
|
80f1d96e07 | ||
|
|
09fe08e51c | ||
|
|
f2c73c2bb8 | ||
|
|
b581d14823 | ||
|
|
354a1c4f1f | ||
|
|
23a09a6197 | ||
|
|
3fc39c47ad | ||
|
|
d6ccf7a3ff | ||
|
|
452f673f38 | ||
|
|
38a3af37e2 | ||
|
|
d134dc8fff | ||
|
|
ba314f23e9 | ||
|
|
a43f220ef9 | ||
|
|
1c0b70da89 | ||
|
|
b6a6c681df | ||
|
|
3eda1d15f9 | ||
|
|
c6438532f0 | ||
|
|
6fd68ed7fe | ||
|
|
36de84ab48 | ||
|
|
8c6c6a14ec | ||
|
|
7ed3632902 | ||
|
|
e28e28d7c3 | ||
|
|
a3868a8260 | ||
|
|
e0bc6a8bd6 | ||
|
|
69177dfe3f | ||
|
|
b84e6862a7 | ||
|
|
7144a9f2ae | ||
|
|
28be45d8b6 | ||
|
|
4ff72ac462 | ||
|
|
4ea4ff7fba | ||
|
|
7e7c4e630e | ||
|
|
39deb3a600 | ||
|
|
dd8c3ff830 | ||
|
|
ad6eff0f76 | ||
|
|
286c0f5e2a | ||
|
|
f6bbaadfa6 | ||
|
|
acee6afa4e | ||
|
|
42a154dddf | ||
|
|
de3d7c1659 | ||
|
|
a8f7e96222 | ||
|
|
37b0659951 | ||
|
|
4538d91091 | ||
|
|
6d762a835b | ||
|
|
cce7a934d6 | ||
|
|
490558049e | ||
|
|
512cce405c | ||
|
|
e5ac9e943c | ||
|
|
0b1db09daf | ||
|
|
1b8b1d69e7 | ||
|
|
d401b2224e | ||
|
|
950583323f | ||
|
|
0682af212c | ||
|
|
b1cbbfc9f0 | ||
|
|
dbac0ecf8c | ||
|
|
325604f970 | ||
|
|
8be18c788e | ||
|
|
090920298d | ||
|
|
fa58267643 | ||
|
|
44b0c0715f | ||
|
|
7b9f258806 | ||
|
|
0e451f73cf | ||
|
|
b3c76f3e54 | ||
|
|
54d143d4a5 | ||
|
|
4453d54296 | ||
|
|
9c08c0c164 | ||
|
|
628c48aff6 | ||
|
|
8e47768600 | ||
|
|
e5edecf95e | ||
|
|
b99687f33c | ||
|
|
153031d6d6 | ||
|
|
c31578cbbd | ||
|
|
310fe49b73 | ||
|
|
5c264992fc | ||
|
|
77a5703c5c | ||
|
|
822578cffd | ||
|
|
d1634e4d96 | ||
|
|
99d8fa5d88 | ||
|
|
cc77f89953 | ||
|
|
7064447378 | ||
|
|
77ed8b98c5 | ||
|
|
32232faa2b | ||
|
|
ab57f38387 | ||
|
|
90d0fa7346 | ||
|
|
956a274abd | ||
|
|
3fbac230b3 | ||
|
|
0ba4d2eaee | ||
|
|
1faa02b9cb | ||
|
|
dc2f5b25a2 | ||
|
|
65d5cfadc1 | ||
|
|
1049777283 | ||
|
|
4e1bbf07ac | ||
|
|
e72fa01073 | ||
|
|
60bda0bcc4 | ||
|
|
2d833e7ceb | ||
|
|
8374564665 | ||
|
|
b33709bc04 | ||
|
|
c7f7fcda8e | ||
|
|
6870417860 | ||
|
|
829425f246 | ||
|
|
22e6c4b325 | ||
|
|
a3bf6cc4c5 | ||
|
|
b1b80bfa4a | ||
|
|
0a4193f742 | ||
|
|
48bcc269e2 | ||
|
|
cf35b7fe32 | ||
|
|
fa8a31740f | ||
|
|
92a3eb1080 | ||
|
|
ea29434568 | ||
|
|
5746bb2670 | ||
|
|
f043e1b484 | ||
|
|
2fd967866c | ||
|
|
1a85e01b63 | ||
|
|
f67cb3c224 | ||
|
|
1297098eae | ||
|
|
40f0fae5a4 | ||
|
|
cffa6c7ca0 | ||
|
|
112b6edd1c | ||
|
|
8f16c2a1e4 | ||
|
|
a182ef5a26 | ||
|
|
a447673b07 | ||
|
|
a8de8b8b8f | ||
|
|
4a26aac5c8 | ||
|
|
b70fe0e956 | ||
|
|
e3338c428f | ||
|
|
f1dbb2aae8 | ||
|
|
b13c61893b | ||
|
|
d2ae6a824f | ||
|
|
21d7fc58b6 | ||
|
|
1631fc4dd8 | ||
|
|
c71fab0889 | ||
|
|
47b5d1af73 | ||
|
|
872f3a3a8d | ||
|
|
428f5828b4 | ||
|
|
b87b527b3a | ||
|
|
80d53839dd | ||
|
|
e1221e22ff | ||
|
|
7d574ccf0b | ||
|
|
366a368882 | ||
|
|
f2d6342d21 | ||
|
|
11f7692cc0 | ||
|
|
6a737a0c13 | ||
|
|
fc54ef5e59 | ||
|
|
fe6f08d48f | ||
|
|
d05c2db3fb | ||
|
|
1fb88c3040 | ||
|
|
c035c91db5 | ||
|
|
3a3250322d | ||
|
|
a91e389a5e | ||
|
|
f29b2a283a | ||
|
|
8c4c9d0090 | ||
|
|
539eec79e6 | ||
|
|
32d78cc9a0 | ||
|
|
5cbd6a5160 | ||
|
|
ac7a794b70 | ||
|
|
f20c4bd9e6 | ||
|
|
67df9b0782 | ||
|
|
118993a584 | ||
|
|
6cfdb3a04b | ||
|
|
fffbd09767 | ||
|
|
75fd2d5ea4 | ||
|
|
d5b2106644 | ||
|
|
a61707bb65 | ||
|
|
7bf9711392 | ||
|
|
3069105134 | ||
|
|
a6ad88d9c4 | ||
|
|
8c1c803fb2 | ||
|
|
97c34f7b26 | ||
|
|
1529277477 | ||
|
|
50e15a5cf8 | ||
|
|
48a8388b09 | ||
|
|
4b76ccc951 | ||
|
|
e27990bd54 | ||
|
|
b8c825c9af | ||
|
|
124ef7fe3d | ||
|
|
6a87a110cc | ||
|
|
374861f62e | ||
|
|
3747db516a | ||
|
|
dba89e7269 | ||
|
|
863f77d827 | ||
|
|
9c7bb3787d | ||
|
|
eff180353e | ||
|
|
f9ea588525 | ||
|
|
fa079bec8c | ||
|
|
3a77394d67 | ||
|
|
5c896992cd | ||
|
|
6aa65683ad | ||
|
|
ecca860972 | ||
|
|
dc1fed40bf | ||
|
|
4d5af6370d | ||
|
|
12a67554d9 | ||
|
|
aa2f132b24 | ||
|
|
e843db55ae | ||
|
|
f96b98e9df | ||
|
|
dcd5374ae9 | ||
|
|
b9f03b1377 | ||
|
|
f5bec43812 | ||
|
|
a2a276a8cc | ||
|
|
71d5dbec48 | ||
|
|
c69627a87c | ||
|
|
a6a06f47f6 | ||
|
|
69231d7ad0 | ||
|
|
2623e7a9fa | ||
|
|
302b6eb05a | ||
|
|
89c4ab0375 | ||
|
|
5246cf1750 | ||
|
|
65e3fe358a | ||
|
|
0a335e2f73 | ||
|
|
e3520aba9d | ||
|
|
4c3530e199 | ||
|
|
a369f9d28f | ||
|
|
fd276c1e88 | ||
|
|
805ca48ffa | ||
|
|
b14459dc04 | ||
|
|
a625db23e0 | ||
|
|
f531af70db | ||
|
|
5520bd6711 | ||
|
|
55251ea6f5 | ||
|
|
3840468e36 | ||
|
|
f391b7138b | ||
|
|
c48c5135d8 | ||
|
|
993b8d7792 | ||
|
|
b78170397a | ||
|
|
c60c5c4b83 | ||
|
|
d14bb02dca | ||
|
|
3d39f3f232 | ||
|
|
f2dc95ea01 | ||
|
|
025ebd4ae8 | ||
|
|
47947fb35c | ||
|
|
86cef2559f | ||
|
|
1f44ec5e0c | ||
|
|
2c0ccfed3a | ||
|
|
c093b21a67 | ||
|
|
291549d021 | ||
|
|
0bb1b758a4 | ||
|
|
cef773d17f | ||
|
|
764c0f6e19 | ||
|
|
60cb548075 | ||
|
|
89c345c6a6 | ||
|
|
e4ebfe420c | ||
|
|
fbdb6a98c0 | ||
|
|
868895e2e0 | ||
|
|
6454bd79a8 | ||
|
|
3a8af359f3 | ||
|
|
6404e78154 | ||
|
|
d1dddad896 | ||
|
|
c3100763cb | ||
|
|
dc846ba7e8 | ||
|
|
189f829c3f | ||
|
|
9ff14b7a42 | ||
|
|
e941d4d3f1 | ||
|
|
c6902553be | ||
|
|
8f67f9c50b | ||
|
|
748bee8ecf | ||
|
|
b6e72dce4c | ||
|
|
062fa8c77b | ||
|
|
e6427d3420 | ||
|
|
5633a6d88a | ||
|
|
d5959d27b8 | ||
|
|
5596d06d93 | ||
|
|
9d916b31a0 | ||
|
|
e85d112891 | ||
|
|
7015ebe0d6 | ||
|
|
02a2cab296 | ||
|
|
6264404cc1 | ||
|
|
2df2587155 | ||
|
|
202b6cab39 | ||
|
|
6f69ddb068 | ||
|
|
1214f99c2b | ||
|
|
eb7ccaf92b | ||
|
|
b376b6acdc | ||
|
|
f09f308ff8 | ||
|
|
53de300b6e | ||
|
|
03132d7338 | ||
|
|
15bd30d442 | ||
|
|
4396674aa7 | ||
|
|
c9a1405547 | ||
|
|
2aee540bfa | ||
|
|
dd1255b0c8 | ||
|
|
18fe8ef834 | ||
|
|
bd4f46b1ff | ||
|
|
6f183d427c | ||
|
|
d208503911 | ||
|
|
93767e0de1 | ||
|
|
711323e7cc | ||
|
|
6887f4f373 | ||
|
|
49e5f2451c | ||
|
|
2015a874e0 | ||
|
|
5bf24e4e96 | ||
|
|
105cebb389 | ||
|
|
7ff5652edc | ||
|
|
6de6c0ffce | ||
|
|
d947e5893f | ||
|
|
391439493d | ||
|
|
265aa3296b | ||
|
|
172fcb7c7e | ||
|
|
bd50422644 | ||
|
|
8004e38403 | ||
|
|
9a15fcb25f | ||
|
|
f821bfc03d | ||
|
|
e8c5ed0fcd | ||
|
|
ebea9b5237 | ||
|
|
5e6a662e8a | ||
|
|
3d1b0ff308 | ||
|
|
db7249bf57 | ||
|
|
10df0ff15a | ||
|
|
91948428a6 | ||
|
|
62a00cedc7 | ||
|
|
8841a9cd93 | ||
|
|
46628eb3c6 | ||
|
|
84af4b36a1 | ||
|
|
1b3afa4cef | ||
|
|
eb461f706f | ||
|
|
9cf4edf76f | ||
|
|
ea27bfef1e | ||
|
|
7c554b0035 | ||
|
|
8907155291 | ||
|
|
aedc3b0c2a | ||
|
|
b05e8af0a7 | ||
|
|
60f5885849 | ||
|
|
e074edf4cb | ||
|
|
c9aeaf8928 | ||
|
|
38e5aa33ea | ||
|
|
69a771317f | ||
|
|
1b650f594d | ||
|
|
c934f95f5e | ||
|
|
e98f9854b7 | ||
|
|
40b0b104d6 | ||
|
|
9b3762a812 | ||
|
|
1d2e4ef388 | ||
|
|
2c4f9d23b4 | ||
|
|
3f5e101f09 | ||
|
|
e35e8f414a | ||
|
|
4278300d8e | ||
|
|
34a1c8394c | ||
|
|
acd2aa6417 | ||
|
|
b23c506cbd | ||
|
|
60529b4e50 | ||
|
|
da0e437eaa | ||
|
|
785b0cea55 | ||
|
|
c34fb88844 | ||
|
|
ae24d7a284 | ||
|
|
e43c47a93f | ||
|
|
061406c602 | ||
|
|
4648eca956 | ||
|
|
bb7be5efe6 | ||
|
|
536816087b | ||
|
|
0a3faafd57 | ||
|
|
46e573cde6 | ||
|
|
f36484ed19 | ||
|
|
d4b40ef6ee | ||
|
|
9cb9f504ae | ||
|
|
7de935d3ad | ||
|
|
e5aca9db5b | ||
|
|
f8cbb6ddad | ||
|
|
0bd9e3e48b | ||
|
|
6543ee1df6 | ||
|
|
c3ec8d5229 | ||
|
|
7eb498992c | ||
|
|
7140312c17 | ||
|
|
845abf1d08 | ||
|
|
b46c10e661 | ||
|
|
2b9108b58f | ||
|
|
aab6f0bd35 | ||
|
|
df4cd5e8a2 | ||
|
|
4de2d7c8c4 | ||
|
|
6744c9e48a | ||
|
|
164ee65147 | ||
|
|
85a2eed129 | ||
|
|
47112a4734 | ||
|
|
6b57f3dc8b | ||
|
|
559c20f207 | ||
|
|
ecaaa1e1d5 | ||
|
|
7ac874ffe1 | ||
|
|
82dc3bf679 | ||
|
|
6e57e225e7 | ||
|
|
186656b855 | ||
|
|
492a7b6709 | ||
|
|
1c83889f8f | ||
|
|
9099352871 | ||
|
|
d6deb43957 | ||
|
|
f0c62a3ff8 | ||
|
|
7e32be2599 | ||
|
|
86ce06c189 | ||
|
|
b5b37c30f2 | ||
|
|
71be95b16a | ||
|
|
185b615245 | ||
|
|
02e6082312 | ||
|
|
a6dc66fb9e | ||
|
|
0634e4eb92 | ||
|
|
5dba081585 | ||
|
|
3afd51e7d5 | ||
|
|
9db53455a9 | ||
|
|
081b6fe229 | ||
|
|
45cdd4a906 | ||
|
|
aac9fc6365 | ||
|
|
8b6b83043a |
39
.editorconfig
Normal file
39
.editorconfig
Normal file
@@ -0,0 +1,39 @@
|
||||
# EditorConfig: https://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[{CMakeLists.txt,*.cmake}]
|
||||
charset = utf-8
|
||||
tab_width = 4
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[{bootstrap,configure.ac,avrdude.spec.in,Makefile.am}]
|
||||
charset = utf-8
|
||||
tab_width = 4
|
||||
indent_size = 4
|
||||
indent_style = tab
|
||||
|
||||
[avrdude.conf.in]
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
|
||||
[*.{c,h,cpp,y}]
|
||||
tab_width = 4
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
charset = utf-8
|
||||
tab_width = 2
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
||||
[*.yml]
|
||||
charset = utf-8
|
||||
tab_width = 2
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
4
.gitattributes
vendored
Normal file
4
.gitattributes
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
* text=auto eol=lf
|
||||
*.sln text eol=crlf
|
||||
*.vcxproj text eol=crlf
|
||||
*.vcxproj.filters text eol=crlf
|
||||
279
.github/workflows/build.yml
vendored
Normal file
279
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,279 @@
|
||||
#
|
||||
# build.yml - GitHub build action for AVRDUDE
|
||||
# Copyright (C) 2021 Marius Greuel
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- 'onlinedocs'
|
||||
pull_request:
|
||||
branches-ignore:
|
||||
- 'onlinedocs'
|
||||
workflow_call:
|
||||
|
||||
env:
|
||||
BUILD_TYPE: RelWithDebInfo
|
||||
|
||||
jobs:
|
||||
linux-x86_64:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install prerequisites
|
||||
run: >-
|
||||
sudo apt-get install -y
|
||||
build-essential
|
||||
cmake
|
||||
flex
|
||||
bison
|
||||
libelf-dev
|
||||
libusb-dev
|
||||
libusb-1.0-0-dev
|
||||
libhidapi-dev
|
||||
libftdi1-dev
|
||||
- name: Configure
|
||||
run: >-
|
||||
cmake
|
||||
-D DEBUG_CMAKE=1
|
||||
-D HAVE_LINUXGPIO=1
|
||||
-D HAVE_LINUXSPI=1
|
||||
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
-B build
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
- name: Archive build artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: build-linux-x86_64
|
||||
path: |
|
||||
build/
|
||||
!**/*.d
|
||||
!**/*.o
|
||||
- name: Archive executables
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: avrdude-linux-x86_64
|
||||
path: |
|
||||
build/src/avrdude
|
||||
build/src/avrdude.conf
|
||||
|
||||
linux:
|
||||
runs-on: ubuntu-latest
|
||||
container: debian:11
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- { arch: i386, processor: i686, prefix: i686-linux-gnu, inc-lib: i386-linux-gnu }
|
||||
- { arch: armhf, processor: armhf, prefix: arm-linux-gnueabihf, inc-lib: arm-linux-gnueabihf }
|
||||
- { arch: arm64, processor: aarch64, prefix: aarch64-linux-gnu, inc-lib: aarch64-linux-gnu }
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Add architecture
|
||||
run: |
|
||||
dpkg --add-architecture ${{matrix.arch}}
|
||||
apt-get update
|
||||
- name: Install prerequisites
|
||||
run: >-
|
||||
apt-get install -y
|
||||
git
|
||||
cmake
|
||||
flex
|
||||
bison
|
||||
crossbuild-essential-${{matrix.arch}}
|
||||
libelf-dev:${{matrix.arch}}
|
||||
libusb-dev:${{matrix.arch}}
|
||||
libusb-1.0-0-dev:${{matrix.arch}}
|
||||
libhidapi-dev:${{matrix.arch}}
|
||||
libftdi1-dev:${{matrix.arch}}
|
||||
- name: Configure
|
||||
run: >-
|
||||
cmake
|
||||
-D DEBUG_CMAKE=1
|
||||
-D HAVE_LINUXGPIO=1
|
||||
-D HAVE_LINUXSPI=1
|
||||
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
-D CMAKE_SYSTEM_NAME=Linux
|
||||
-D CMAKE_SYSTEM_PROCESSOR=${{matrix.processor}}
|
||||
-D CMAKE_C_COMPILER=${{matrix.prefix}}-gcc
|
||||
-D CMAKE_FIND_ROOT_PATH=/usr/${{matrix.prefix}}
|
||||
-D CMAKE_INCLUDE_PATH=/usr/include/${{matrix.inc-lib}}
|
||||
-D CMAKE_LIBRARY_PATH=/usr/lib/${{matrix.inc-lib}}
|
||||
-B build
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
- name: Archive build artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: build-linux-${{matrix.processor}}
|
||||
path: |
|
||||
build/
|
||||
!**/*.d
|
||||
!**/*.o
|
||||
- name: Archive executables
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: avrdude-linux-${{matrix.processor}}
|
||||
path: |
|
||||
build/src/avrdude
|
||||
build/src/avrdude.conf
|
||||
|
||||
macos-x86_64:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install prerequisites
|
||||
run: >-
|
||||
brew install
|
||||
cmake
|
||||
flex
|
||||
bison
|
||||
libelf
|
||||
libusb
|
||||
hidapi
|
||||
libftdi
|
||||
- name: Configure
|
||||
run: >-
|
||||
cmake
|
||||
-D CMAKE_C_FLAGS=-I/usr/local/include
|
||||
-D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/Cellar
|
||||
-D DEBUG_CMAKE=1
|
||||
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
-B build
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
- name: Archive build artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: build-macos-x86_64
|
||||
path: |
|
||||
build/
|
||||
!**/*.d
|
||||
!**/*.o
|
||||
- name: Archive executables
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: avrdude-macos-x86_64
|
||||
path: |
|
||||
build/src/avrdude
|
||||
build/src/avrdude.conf
|
||||
|
||||
msvc:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- { arch: x86, platform: Win32 }
|
||||
- { arch: x64, platform: x64 }
|
||||
- { arch: arm64, platform: ARM64 }
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install prerequisites
|
||||
# As Chocolatey is notoriously unreliable, install winflexbison3 directly from GitHub.
|
||||
# run: choco install winflexbison3
|
||||
run: |
|
||||
curl https://github.com/lexxmark/winflexbison/releases/download/v2.5.24/win_flex_bison-2.5.24.zip --location --output winflexbison.zip
|
||||
unzip winflexbison.zip -d ${{github.workspace}}\winflexbison
|
||||
echo "${{github.workspace}}\winflexbison" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||
- name: Configure
|
||||
run: >-
|
||||
cmake
|
||||
-A ${{matrix.platform}}
|
||||
-D DEBUG_CMAKE=1
|
||||
-D CMAKE_SYSTEM_VERSION=11
|
||||
-D CMAKE_C_FLAGS_RELWITHDEBINFO="/MT /GL /Zi /O2 /Ob1 /DNDEBUG"
|
||||
-D CMAKE_CXX_FLAGS_RELWITHDEBINFO="/MT /GL /Zi /O2 /Ob1 /DNDEBUG"
|
||||
-D CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO="/DEBUG /INCREMENTAL:NO /LTCG /OPT:REF /OPT:ICF"
|
||||
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
-D USE_EXTERNAL=1
|
||||
-B build
|
||||
- name: Build
|
||||
run: cmake --build build --config ${{env.BUILD_TYPE}}
|
||||
- name: Archive build artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: build-msvc-${{matrix.arch}}
|
||||
path: |
|
||||
build/
|
||||
!**/_deps/
|
||||
!**/*.obj
|
||||
- name: Move executables
|
||||
run: |
|
||||
mv build/src/RelWithDebInfo/avrdude.exe build/src
|
||||
mv build/src/RelWithDebInfo/avrdude.pdb build/src
|
||||
- name: Archive executables
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: avrdude-msvc-${{matrix.arch}}
|
||||
path: |
|
||||
build/src/avrdude.exe
|
||||
build/src/avrdude.pdb
|
||||
build/src/avrdude.conf
|
||||
|
||||
mingw:
|
||||
runs-on: windows-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- { sys: mingw32, env: i686 }
|
||||
- { sys: mingw64, env: x86_64 }
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: ${{matrix.sys}}
|
||||
update: true
|
||||
install: >-
|
||||
base-devel
|
||||
mingw-w64-${{matrix.env}}-gcc
|
||||
mingw-w64-${{matrix.env}}-cmake
|
||||
mingw-w64-${{matrix.env}}-libelf
|
||||
mingw-w64-${{matrix.env}}-libusb
|
||||
mingw-w64-${{matrix.env}}-libusb-compat-git
|
||||
mingw-w64-${{matrix.env}}-hidapi
|
||||
mingw-w64-${{matrix.env}}-libftdi
|
||||
- name: Configure
|
||||
run: >-
|
||||
cmake
|
||||
-G"MSYS Makefiles"
|
||||
-D DEBUG_CMAKE=1
|
||||
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||
-B build
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
- name: Archive build artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: build-mingw-${{matrix.env}}
|
||||
path: |
|
||||
build/
|
||||
- name: Archive executables
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: avrdude-mingw-${{matrix.env}}
|
||||
path: |
|
||||
build/src/avrdude.exe
|
||||
build/src/avrdude.conf
|
||||
85
.github/workflows/deploy.yml
vendored
Normal file
85
.github/workflows/deploy.yml
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
#
|
||||
# deploy.yml - GitHub deploy action for AVRDUDE
|
||||
# Copyright (C) 2021 Marius Greuel
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
name: Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
uses: avrdudes/avrdude/.github/workflows/build.yml@main
|
||||
|
||||
release:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
steps:
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
with:
|
||||
tag_name: ${{github.ref}}
|
||||
release_name: AVRDUDE ${{github.ref}}
|
||||
body: "See **[Release Notes](https://github.com/avrdudes/avrdude/blob/main/NEWS)** for changes"
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
asset-msvc:
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- { arch: x86 }
|
||||
- { arch: x64 }
|
||||
- { arch: arm64 }
|
||||
steps:
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: avrdude-msvc-${{matrix.arch}}
|
||||
|
||||
- name: Create release asset
|
||||
run: >-
|
||||
zip -j asset.zip
|
||||
avrdude.exe
|
||||
avrdude.pdb
|
||||
avrdude.conf
|
||||
|
||||
- name: Upload release asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
with:
|
||||
upload_url: ${{needs.release.outputs.upload_url}}
|
||||
asset_path: ./asset.zip
|
||||
asset_name: avrdude-${{github.ref_name}}-windows-${{matrix.arch}}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
#deploy:
|
||||
# needs: [asset-msvc]
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Create package (Chocolatey)
|
||||
# run: echo TODO
|
||||
38
.cvsignore → .gitignore
vendored
38
.cvsignore → .gitignore
vendored
@@ -1,3 +1,7 @@
|
||||
.DS_Store
|
||||
.deps/
|
||||
.libs/
|
||||
m4/
|
||||
*.diff
|
||||
*.patch
|
||||
y.output
|
||||
@@ -5,16 +9,16 @@ y.tab.h
|
||||
lexer.c
|
||||
config_gram.c
|
||||
config_gram.h
|
||||
.cvsignore
|
||||
.depend
|
||||
.deps
|
||||
INSTALL
|
||||
Makefile.in
|
||||
Makefile
|
||||
ac_cfg.h.in
|
||||
ac_cfg.h.in~
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
configure
|
||||
configure~
|
||||
depcomp
|
||||
install-sh
|
||||
compile
|
||||
@@ -31,3 +35,33 @@ config.log
|
||||
config.status
|
||||
config.sub
|
||||
avrdude
|
||||
libtool
|
||||
ltmain.sh
|
||||
ylwrap
|
||||
tags
|
||||
cscope.out
|
||||
|
||||
*.o
|
||||
*.lo
|
||||
*.a
|
||||
*.la
|
||||
|
||||
# CMake
|
||||
out/
|
||||
build/
|
||||
build_*/
|
||||
|
||||
# Visual Studio
|
||||
.vs/
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
x86/
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
*.log
|
||||
|
||||
# Visual Studio code
|
||||
.vscode/
|
||||
14
AUTHORS
14
AUTHORS
@@ -10,7 +10,7 @@ Contributors:
|
||||
Alex Shepherd <maillists@ajsystems.co.nz>
|
||||
Martin Thomas <mthomas@rhrk.uni-kl.de>
|
||||
Theodore A. Roth <troth@openavr.org>
|
||||
Michael Holzt <kju-avr@fqdn.org>
|
||||
Juliane Holzt <avrdude@juliane.holzt.de>
|
||||
Colin O'Flynn <coflynn@newae.com>
|
||||
Thomas Fischl <tfischl@gmx.de>
|
||||
David Hoerl <dhoerl@mac.com>
|
||||
@@ -23,6 +23,18 @@ Contributors:
|
||||
Brett Hagman <bhagman@roguerobotics.com>
|
||||
Rene Liebscher <r.liebscher@gmx.de>
|
||||
Jim Paris <jim@jtan.com>
|
||||
Jan Egil Ruud <janegil.ruud@microchip.com>
|
||||
David Mosberger <davidm@egauge.net>
|
||||
David Sainty
|
||||
Marius Greuel <greuelm@mgtek.com>
|
||||
Dawid Buchwald <dawid.buchwald@hotmail.com>
|
||||
Hans Eirik Bull
|
||||
|
||||
Contributors to code no longer present:
|
||||
|
||||
Dale Roberts for the giveio driver
|
||||
Paula Tomlinson for the loaddrv sources
|
||||
Chris Liechti for loaddrv modifications
|
||||
|
||||
For minor contributions, please see the ChangeLog files.
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
$Id$
|
||||
|
||||
How to build avrdude from SVN:
|
||||
|
||||
1. svn co svn://svn.savannah.nongnu.org/avrdude/trunk
|
||||
|
||||
2. cd trunk/avrdude
|
||||
|
||||
3. ./bootstrap
|
||||
|
||||
4. ./configure
|
||||
|
||||
5. make
|
||||
397
CMakeLists.txt
Normal file
397
CMakeLists.txt
Normal file
@@ -0,0 +1,397 @@
|
||||
#
|
||||
# CMakeLists.txt - CMake project for AVRDUDE
|
||||
# Copyright (C) 2021 Marius Greuel
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# Typical usage:
|
||||
# cmake -B build
|
||||
# cmake --build build
|
||||
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
project(avrdude VERSION 7.0)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED True)
|
||||
|
||||
option(BUILD_DOC "Enable building documents" OFF)
|
||||
option(HAVE_LINUXGPIO "Enable Linux sysfs GPIO support" OFF)
|
||||
option(HAVE_LINUXSPI "Enable Linux SPI support" OFF)
|
||||
option(HAVE_PARPORT "Enable parallel port support" OFF)
|
||||
option(USE_EXTERNAL "Use external libraries from AVRDUDE GitHub repositories" OFF)
|
||||
option(USE_LIBUSBWIN32 "Prefer libusb-win32 over libusb" OFF)
|
||||
option(DEBUG_CMAKE "Enable debugging output for this CMake project" OFF)
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||
|
||||
include(CheckIncludeFile)
|
||||
include(CheckSymbolExists)
|
||||
include(FetchContent)
|
||||
include(FindPackageMessage)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(CONFIG_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}")
|
||||
set(AVRDUDE_FULL_VERSION ${CMAKE_PROJECT_VERSION})
|
||||
|
||||
# =====================================
|
||||
# Get Git commit info
|
||||
# =====================================
|
||||
|
||||
# GIT_COMMIT_HASH -> hash of latest commit, e.g. b8b859f5
|
||||
# GIT_COMMIT_DATE -> date of latest commit, e.g. 20201231
|
||||
# GIT_COMMIT_YEAR -> year of latest commit, e.g. 2020
|
||||
|
||||
find_package(Git)
|
||||
if(Git_FOUND)
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" log -1 --format=%h
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE GIT_COMMIT_HASH
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" log -1 --format=%ad --date=format:%Y%m%d
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE GIT_COMMIT_DATE
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" log -1 --format=%ad --date=format:%Y
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE GIT_COMMIT_YEAR
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" log -1 --tags --format=%h
|
||||
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE GIT_TAG_HASH
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# If the commit is not tagged, include the date and commit hash in the full version string.
|
||||
if(NOT GIT_COMMIT_HASH STREQUAL GIT_TAG_HASH)
|
||||
set(AVRDUDE_FULL_VERSION "${CMAKE_PROJECT_VERSION}-${GIT_COMMIT_DATE} (${GIT_COMMIT_HASH})")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(FLEX)
|
||||
if(NOT FLEX_FOUND)
|
||||
message(SEND_ERROR "This CMake project requires 'flex', which is not installed on your system." )
|
||||
endif()
|
||||
|
||||
find_package(BISON QUIET)
|
||||
if(BISON_FOUND)
|
||||
find_package_message(BISON "Found BISON: ${BISON_EXECUTABLE} (found version \"${BISON_VERSION}\")" "[${BISON_EXECUTABLE}][${BISON_VERSION}]")
|
||||
else()
|
||||
find_program(YACC_EXECUTABLE NAMES yacc byacc DOC "path to the yacc executable")
|
||||
mark_as_advanced(YACC_EXECUTABLE)
|
||||
if(YACC_EXECUTABLE)
|
||||
find_package_message(YACC "Found YACC: ${YACC_EXECUTABLE}" "[${YACC_EXECUTABLE}]")
|
||||
else()
|
||||
message(SEND_ERROR "This CMake project requires 'bison', 'yacc', or 'byacc', which is not installed on your system." )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# =====================================
|
||||
# Detect installed libraries
|
||||
# =====================================
|
||||
|
||||
# Prefer static libraries over DLLs on Windows
|
||||
if(WIN32)
|
||||
set(PREFERRED_LIBELF libelf.a elf)
|
||||
set(PREFERRED_LIBUSB libusb.a usb)
|
||||
set(PREFERRED_LIBUSB_1_0 libusb-1.0.a usb-1.0)
|
||||
set(PREFERRED_LIBHIDAPI libhidapi.a libhidapi-libusb.a libhidapi-hidraw.a hidapi hidapi-libusb hidapi-hidraw)
|
||||
set(PREFERRED_LIBFTDI libftdi.a ftdi)
|
||||
set(PREFERRED_LIBFTDI1 libftdi1.a ftdi1)
|
||||
else()
|
||||
set(PREFERRED_LIBELF elf)
|
||||
set(PREFERRED_LIBUSB usb)
|
||||
set(PREFERRED_LIBUSB_1_0 usb-1.0)
|
||||
set(PREFERRED_LIBHIDAPI hidapi hidapi-libusb hidapi-hidraw)
|
||||
set(PREFERRED_LIBFTDI ftdi)
|
||||
set(PREFERRED_LIBFTDI1 ftdi1)
|
||||
endif()
|
||||
|
||||
# -------------------------------------
|
||||
# Find libelf
|
||||
|
||||
find_library(HAVE_LIBELF NAMES ${PREFERRED_LIBELF})
|
||||
if(HAVE_LIBELF)
|
||||
set(LIB_LIBELF ${HAVE_LIBELF})
|
||||
check_include_file(libelf.h HAVE_LIBELF_H)
|
||||
check_include_file(libelf/libelf.h HAVE_LIBELF_LIBELF_H)
|
||||
endif()
|
||||
|
||||
# -------------------------------------
|
||||
# Find libusb
|
||||
|
||||
find_library(HAVE_LIBUSB NAMES ${PREFERRED_LIBUSB})
|
||||
if(HAVE_LIBUSB)
|
||||
set(LIB_LIBUSB ${HAVE_LIBUSB})
|
||||
endif()
|
||||
|
||||
find_library(HAVE_LIBUSB_1_0 NAMES ${PREFERRED_LIBUSB_1_0})
|
||||
if(HAVE_LIBUSB_1_0)
|
||||
set(LIB_LIBUSB_1_0 ${HAVE_LIBUSB_1_0})
|
||||
endif()
|
||||
|
||||
# FreeBSD's library 'libusb' supports both the libusb-0.1 and libusb-1.0 API.
|
||||
if (HAVE_LIBUSB AND CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
set(HAVE_LIBUSB_1_0 ${HAVE_LIBUSB})
|
||||
endif()
|
||||
|
||||
find_library(HAVE_LIBUSB_WIN32 NAMES libusb0.a usb0)
|
||||
|
||||
if(HAVE_LIBUSB OR HAVE_LIBUSB_1_0 OR HAVE_LIBUSB_WIN32)
|
||||
check_include_file(usb.h HAVE_USB_H)
|
||||
check_include_file(lusb0_usb.h HAVE_LUSB0_USB_H)
|
||||
check_include_file(libusb.h HAVE_LIBUSB_H)
|
||||
check_include_file(libusb-1.0/libusb.h HAVE_LIBUSB_1_0_LIBUSB_H)
|
||||
|
||||
if((USE_LIBUSBWIN32 OR NOT HAVE_LIBUSB) AND HAVE_LIBUSB_WIN32)
|
||||
set(HAVE_LIBUSB ${HAVE_LIBUSB_WIN32})
|
||||
set(LIB_LIBUSB ${HAVE_LIBUSB_WIN32})
|
||||
unset(HAVE_USB_H CACHE)
|
||||
elseif(NOT HAVE_USB_H)
|
||||
find_path(LIBUSB_COMPAT_DIR libusb-compat/usb.h)
|
||||
if(LIBUSB_COMPAT_DIR)
|
||||
set(LIBUSB_COMPAT_DIR ${LIBUSB_COMPAT_DIR}/libusb-compat)
|
||||
set(HAVE_USB_H 1)
|
||||
else()
|
||||
unset(LIBUSB_COMPAT_DIR CACHE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# -------------------------------------
|
||||
# Find libhidapi
|
||||
|
||||
find_library(HAVE_LIBHID NAMES hid)
|
||||
if(HAVE_LIBHID)
|
||||
set(LIB_LIBHID ${HAVE_LIBHID})
|
||||
endif()
|
||||
|
||||
find_library(HAVE_LIBHIDAPI NAMES ${PREFERRED_LIBHIDAPI})
|
||||
if(HAVE_LIBHIDAPI)
|
||||
set(LIB_LIBHIDAPI ${HAVE_LIBHIDAPI})
|
||||
check_include_file(hidapi/hidapi.h HAVE_HIDAPI_HIDAPI_H)
|
||||
endif()
|
||||
|
||||
# -------------------------------------
|
||||
# Find libftdi
|
||||
|
||||
find_library(HAVE_LIBFTDI NAMES ${PREFERRED_LIBFTDI})
|
||||
if(HAVE_LIBFTDI)
|
||||
set(LIB_LIBFTDI ${HAVE_LIBFTDI})
|
||||
set(HAVE_LIBFTDI_TYPE_232H 1)
|
||||
endif()
|
||||
|
||||
find_library(HAVE_LIBFTDI1 NAMES ${PREFERRED_LIBFTDI1})
|
||||
if(HAVE_LIBFTDI1)
|
||||
set(LIB_LIBFTDI1 ${HAVE_LIBFTDI1})
|
||||
set(HAVE_LIBFTDI_TYPE_232H 1)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${LIB_LIBFTDI1} ${LIB_LIBUSB} ${LIB_LIBUSB_1_0})
|
||||
check_symbol_exists(ftdi_tcioflush "libftdi1/ftdi.h" HAVE_FTDI_TCIOFLUSH)
|
||||
endif()
|
||||
|
||||
# -------------------------------------
|
||||
# Find libreadline
|
||||
|
||||
find_library(HAVE_LIBREADLINE NAMES readline)
|
||||
if(HAVE_LIBREADLINE)
|
||||
set(LIB_LIBREADLINE ${HAVE_LIBREADLINE})
|
||||
endif()
|
||||
|
||||
# =====================================
|
||||
# Use external libraries if requested
|
||||
# =====================================
|
||||
|
||||
if(USE_EXTERNAL)
|
||||
FetchContent_Declare(libelf
|
||||
GIT_REPOSITORY https://github.com/avrdudes/libelf.git
|
||||
GIT_TAG e5a39bf19bd6598c42e09172be5a78ceec2a065c
|
||||
)
|
||||
|
||||
FetchContent_Declare(libusb
|
||||
GIT_REPOSITORY https://github.com/avrdudes/libusb.git
|
||||
GIT_TAG 632bc25d04eff563cc00de29435b9a7ed6f4654c
|
||||
)
|
||||
|
||||
FetchContent_Declare(libhidapi
|
||||
GIT_REPOSITORY https://github.com/avrdudes/libhidapi.git
|
||||
GIT_TAG e3700e951f762ef92871ff4fc94586e4d1c042a6
|
||||
)
|
||||
|
||||
FetchContent_Declare(libftdi
|
||||
GIT_REPOSITORY https://github.com/avrdudes/libftdi.git
|
||||
GIT_TAG f3a54da710002a7d25a32a69e667a69ef84cc120
|
||||
)
|
||||
|
||||
message(STATUS "Fetching external libraries, please wait...")
|
||||
FetchContent_MakeAvailable(
|
||||
libelf
|
||||
libusb
|
||||
libhidapi
|
||||
libftdi
|
||||
)
|
||||
|
||||
message(STATUS "Using external library 'libelf'")
|
||||
set(LIB_LIBELF libelf)
|
||||
set(HAVE_LIBELF 1)
|
||||
set(HAVE_LIBELF_H 1)
|
||||
|
||||
message(STATUS "Using external library 'libusb'")
|
||||
set(LIB_LIBUSB libusb)
|
||||
set(HAVE_LIBUSB 1)
|
||||
set(HAVE_LUSB0_USB_H 1)
|
||||
|
||||
message(STATUS "Using external library 'libhidapi'")
|
||||
set(LIB_LIBHIDAPI libhidapi)
|
||||
set(HAVE_LIBHIDAPI 1)
|
||||
set(HAVE_HIDAPI_HIDAPI_H 1)
|
||||
|
||||
message(STATUS "Using external library 'libftdi'")
|
||||
set(LIB_LIBFTDI libftdi)
|
||||
set(HAVE_LIBFTDI 1)
|
||||
set(HAVE_LIBFTDI_TYPE_232H 1)
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
# =====================================
|
||||
# Setup default port names
|
||||
# =====================================
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(DEFAULT_PAR_PORT "/dev/parport0")
|
||||
set(DEFAULT_SER_PORT "/dev/ttyS0")
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
set(DEFAULT_PAR_PORT "/dev/ppi0")
|
||||
set(DEFAULT_SER_PORT "/dev/cuad0")
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "Solaris")
|
||||
set(DEFAULT_PAR_PORT "/dev/printers/0")
|
||||
set(DEFAULT_SER_PORT "/dev/term/a")
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
set(DEFAULT_PAR_PORT "lpt1")
|
||||
set(DEFAULT_SER_PORT "com1")
|
||||
else()
|
||||
set(DEFAULT_PAR_PORT "unknown")
|
||||
set(DEFAULT_SER_PORT "unknown")
|
||||
endif()
|
||||
|
||||
# =====================================
|
||||
# Configuration
|
||||
# =====================================
|
||||
|
||||
message(STATUS "Configuration summary:")
|
||||
message(STATUS "----------------------")
|
||||
|
||||
if (DEBUG_CMAKE)
|
||||
message(STATUS "CMAKE_HOST_SYSTEM: ${CMAKE_HOST_SYSTEM}")
|
||||
message(STATUS "CMAKE_SYSTEM: ${CMAKE_SYSTEM}")
|
||||
message(STATUS "CMAKE_FIND_ROOT_PATH: ${CMAKE_FIND_ROOT_PATH}")
|
||||
message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
|
||||
message(STATUS "CONFIG_DIR: ${CONFIG_DIR}")
|
||||
message(STATUS "AVRDUDE_FULL_VERSION: ${AVRDUDE_FULL_VERSION}")
|
||||
message(STATUS "USE_EXTERNAL: ${USE_EXTERNAL}")
|
||||
message(STATUS "USE_LIBUSBWIN32: ${USE_LIBUSBWIN32}")
|
||||
message(STATUS "HAVE_LIBELF: ${HAVE_LIBELF}")
|
||||
message(STATUS "HAVE_LIBUSB: ${HAVE_LIBUSB}")
|
||||
message(STATUS "HAVE_LIBUSB_1_0: ${HAVE_LIBUSB_1_0}")
|
||||
message(STATUS "HAVE_LIBUSB_WIN32: ${HAVE_LIBUSB_WIN32}")
|
||||
message(STATUS "HAVE_LIBHID: ${HAVE_LIBHID}")
|
||||
message(STATUS "HAVE_LIBHIDAPI: ${HAVE_LIBHIDAPI}")
|
||||
message(STATUS "HAVE_LIBFTDI: ${HAVE_LIBFTDI}")
|
||||
message(STATUS "HAVE_LIBFTDI1: ${HAVE_LIBFTDI1}")
|
||||
message(STATUS "HAVE_LIBREADLINE: ${HAVE_LIBREADLINE}")
|
||||
message(STATUS "HAVE_LIBELF_H: ${HAVE_LIBELF_H}")
|
||||
message(STATUS "HAVE_LIBELF_LIBELF_H: ${HAVE_LIBELF_LIBELF_H}")
|
||||
message(STATUS "HAVE_USB_H: ${HAVE_USB_H}")
|
||||
message(STATUS "HAVE_LUSB0_USB_H: ${HAVE_LUSB0_USB_H}")
|
||||
message(STATUS "HAVE_LIBUSB_H: ${HAVE_LIBUSB_H}")
|
||||
message(STATUS "HAVE_LIBUSB_1_0_LIBUSB_H: ${HAVE_LIBUSB_1_0_LIBUSB_H}")
|
||||
message(STATUS "HAVE_HIDAPI_HIDAPI_H: ${HAVE_HIDAPI_HIDAPI_H}")
|
||||
message(STATUS "LIBUSB_COMPAT_DIR: ${LIBUSB_COMPAT_DIR}")
|
||||
message(STATUS "----------------------")
|
||||
endif()
|
||||
|
||||
if(HAVE_LIBELF)
|
||||
message(STATUS "DO HAVE libelf")
|
||||
else()
|
||||
message(STATUS "DON'T HAVE libelf")
|
||||
endif()
|
||||
|
||||
if(HAVE_LIBUSB)
|
||||
message(STATUS "DO HAVE libusb")
|
||||
else()
|
||||
message(STATUS "DON'T HAVE libusb")
|
||||
endif()
|
||||
|
||||
if(HAVE_LIBUSB_1_0)
|
||||
message(STATUS "DO HAVE libusb_1_0")
|
||||
else()
|
||||
message(STATUS "DON'T HAVE libusb_1_0")
|
||||
endif()
|
||||
|
||||
if(HAVE_LIBHIDAPI)
|
||||
message(STATUS "DO HAVE libhidapi")
|
||||
else()
|
||||
message(STATUS "DON'T HAVE libhidapi")
|
||||
endif()
|
||||
|
||||
if(HAVE_LIBFTDI)
|
||||
if(HAVE_LIBFTDI1)
|
||||
message(STATUS "DO HAVE libftdi (but prefer to use libftdi1)")
|
||||
else()
|
||||
message(STATUS "DO HAVE libftdi")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "DON'T HAVE libftdi")
|
||||
endif()
|
||||
|
||||
if(HAVE_LIBFTDI1)
|
||||
message(STATUS "DO HAVE libftdi1")
|
||||
else()
|
||||
message(STATUS "DON'T HAVE libftdi1")
|
||||
endif()
|
||||
|
||||
if(BUILD_DOC)
|
||||
message(STATUS "ENABLED doc")
|
||||
else()
|
||||
message(STATUS "DISABLED doc")
|
||||
endif()
|
||||
|
||||
if(HAVE_PARPORT)
|
||||
message(STATUS "ENABLED parport")
|
||||
else()
|
||||
message(STATUS "DISABLED parport")
|
||||
endif()
|
||||
|
||||
if(HAVE_LINUXGPIO)
|
||||
message(STATUS "ENABLED linuxgpio")
|
||||
else()
|
||||
message(STATUS "DISABLED linuxgpio")
|
||||
endif()
|
||||
|
||||
if(HAVE_LINUXSPI)
|
||||
message(STATUS "ENABLED linuxspi")
|
||||
else()
|
||||
message(STATUS "DISABLED linuxspi")
|
||||
endif()
|
||||
|
||||
message(STATUS "----------------------")
|
||||
41
ChangeLog
41
ChangeLog
@@ -1,41 +0,0 @@
|
||||
2016-02-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Released version 6.3.
|
||||
|
||||
2016-02-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
patch #8894: Spelling in 6.2 doc
|
||||
* doc/avrdude.texi: Various spelling fixes.
|
||||
|
||||
2016-02-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
patch #8895: Spelling in 6.2 code
|
||||
* avrftdi.c (avrftdi_open): Spell fix.
|
||||
|
||||
2016-02-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
patch #8896: Silence cppcheck warnings in 6.2 code
|
||||
* linuxgpio.c: Use %ud to print GPIO values.
|
||||
|
||||
2016-02-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
patch #8735: ATtiny28 support in avrdude.conf
|
||||
* avrdude.conf.in (ATtiny28): New device.
|
||||
|
||||
2016-02-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in (ATmega48PB, ATmega88PB, ATmega168PB): New
|
||||
devices.
|
||||
|
||||
2016-02-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
patch #8435: Implementing mEDBG CMSIS-DAP protocol
|
||||
* usb_libusb.c: Add endpoint IDs for Xplained Mini, correctly
|
||||
transfer trailing ZLP when needed
|
||||
* avrdude.conf.in (xplainedmini, xplainedmini_dw): New entries.
|
||||
* jtag3.c (jtag3_edbg_send, jtag3_edbg_recv_frame): Implement
|
||||
fragmentation needed for the 64-byte EP size of the Xplained Mini
|
||||
* avrdude.1: Document the change
|
||||
* doc/avrdude.texi: (Dito.)
|
||||
|
||||
|
||||
598
ChangeLog-2001
598
ChangeLog-2001
@@ -1,598 +0,0 @@
|
||||
2001-12-30 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* main.c: Update version.
|
||||
|
||||
* avrdude.conf.sample: Clarify a comment.
|
||||
|
||||
* avrdude.conf.sample: fix address bits
|
||||
|
||||
* avrdude.1: Bring up to date.
|
||||
|
||||
2001-12-29 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrdude.conf.sample: Add the AVR3 progammer.
|
||||
|
||||
* avr.c, avrdude.conf.sample, config_gram.y, main.c, pindefs.h:
|
||||
Fix VCC assertion.
|
||||
|
||||
Make the BUFF pin a mask like VCC to allow multiple pins to be
|
||||
asserted at the same time (STK200 has two buffer enable lines).
|
||||
|
||||
Add the STK200 programmer.
|
||||
|
||||
Fix EEPROM address line selection for several parts.
|
||||
|
||||
2001-12-15 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrdude.conf.sample: fix spelling error
|
||||
|
||||
2001-11-24 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* Makefile:
|
||||
Change "WARNING" to "NOTE" when overwriting the avrprog.conf file.
|
||||
|
||||
* avrdude.1: Add my e-mail address.
|
||||
|
||||
* avrdude.conf.sample:
|
||||
Add comments about instruction formats. Correct an instruction
|
||||
specification (cut&paste error).
|
||||
|
||||
2001-11-21 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avr.c, config_gram.y, lexer.l, term.c:
|
||||
In interactive mode, reset the address and length if we start dumping
|
||||
a memory type different than the previous one.
|
||||
|
||||
* avr.c, avrdude.conf.sample, config_gram.y:
|
||||
Allow instruction data to be specified more flexibly, which can be
|
||||
used to make the instruction input more readable in the config file.
|
||||
|
||||
* main.c: Bump version number.
|
||||
|
||||
* Makefile, avr.c, avr.h, avrdude.conf.sample, config.c, config.h:
|
||||
* config_gram.y, fileio.c, fileio.h, lexer.l, main.c, term.c:
|
||||
This is a major re-write of the programming algorithms. The Atmel
|
||||
serial programming instructions are not very orthoganal, i.e., the
|
||||
"read fuse bits" instruction on an ATMega103 is an entirely different
|
||||
opcode and data format from the _same_ instruction for an ATMega163!
|
||||
Thus, it becomes impossible to have a single instruction encoding
|
||||
(varying the data) across the chip lines.
|
||||
|
||||
This set of changes allows and requires instruction encodings to be
|
||||
defined on a per-part basis within the configuration file. Hopefully
|
||||
I've defined the encoding scheme in a general enough way so it is
|
||||
useful in describing the instruction formats for yet-to-be invented
|
||||
Atmel chips. I've tried hard to make it match very closely with the
|
||||
specification in Atmel's data sheets for their parts. It's a little
|
||||
more verbose than what I initially hoped for, but I've tried to keep
|
||||
it as concise as I could, while still remaining reasonably flexible.
|
||||
|
||||
2001-11-19 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avr.c, avr.h, avrdude.conf.sample, main.c, ppi.c, term.c:
|
||||
Add support for ATMega163.
|
||||
|
||||
Add support for reading/writing ATMega163 lock and fuse bits.
|
||||
Unfortunately, in looking at the specs for other ATMega parts, they
|
||||
use entirely different instruction formats for these commands. Thus,
|
||||
these routines won't work for the ATMega103, for example.
|
||||
|
||||
Add support for sending raw command bytes via the interactive terminal
|
||||
interface. This allows one to execute any programming instruction on
|
||||
the target device, whether or not avrprog supports it explicitly or
|
||||
not. Thus, one can use this feature to program fuse / lock bits, or
|
||||
access any other feature of a current or future device that avrprog
|
||||
does not know how to do.
|
||||
|
||||
Add in comments, an experimental instruction format in the
|
||||
configuration file. If this works out, it would allow supporting new
|
||||
parts and non-orthoganal instructions across existing parts without
|
||||
making avrprog code changes.
|
||||
|
||||
2001-11-17 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrdude.conf.sample: Add ATMEGA163 part.
|
||||
|
||||
2001-11-11 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* main.c: output formatting
|
||||
|
||||
2001-11-05 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* ppi.c: Get ppi.h from /usr/include, not /sys.
|
||||
|
||||
2001-10-31 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avr.c, avrdude.conf.sample, main.c: Correct version string.
|
||||
Update read/write status more frequently.
|
||||
Prefix ATMega parts with an 'm'.
|
||||
|
||||
2001-10-16 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avr.c: Change ording for memory display.
|
||||
|
||||
* config_gram.y: comment
|
||||
|
||||
* avr.c, avr.h, avrdude.conf.sample, config_gram.y, lexer.l, term.c:
|
||||
Fix (again, hopefully) page addressing for the ATMega parts.
|
||||
|
||||
Rename the poorly chosen name "bank" to "page" for page addressing.
|
||||
Atmel calls it "page" in their documentation.
|
||||
|
||||
* config_gram.y, main.c: Fix an (non)exit.
|
||||
Silence a couple of compiler warnings.
|
||||
|
||||
* avr.c, avr.h, avrdude.conf.sample, config_gram.y, main.c:
|
||||
Fix ATMega flash addressing. Add an ATMEGA16 part. Perform sanity
|
||||
checking on the memory parameters for parts that do bank addressing.
|
||||
|
||||
2001-10-15 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* config.c, config.h, lists.h: Add copyright.
|
||||
|
||||
* config_gram.y, lexer.l, lists.c: Add copyrights.
|
||||
|
||||
* Makefile: Attempt to install avrprog.conf.
|
||||
|
||||
* avrdude.conf.sample: Correct dt006 pinout.
|
||||
|
||||
* Makefile, lexer.l:
|
||||
Try and detect an old-style config file and print an appropriate error
|
||||
message and a suggestion for correcting it.
|
||||
|
||||
* Makefile, avr.c, avrdude.1, avrdude.conf.sample: Update the man page.
|
||||
|
||||
Miscellaneous minor cleanups.
|
||||
|
||||
2001-10-14 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* Makefile, Makefile.inc, avr.c, avr.h, avrdude.conf.sample:
|
||||
* config.c, config.h, config_gram.y, lexer.l, lists.c, lists.h:
|
||||
* main.c, pindefs.h, term.c:
|
||||
Use lex/yacc for parsing the config file. Re-work the config file
|
||||
format using a more human-readable format.
|
||||
|
||||
Read part descriptions from the config file now instead of hard-coding
|
||||
them.
|
||||
|
||||
Update usage().
|
||||
|
||||
Cleanup unused code.
|
||||
|
||||
* Makefile, avr.c, avr.h, fileio.c, term.c:
|
||||
First cut at supporting the ATmega 103 which uses bank addressing and
|
||||
has a 128K flash.
|
||||
|
||||
Due to the bank addressing required, interactive update of the flash
|
||||
is not supported, though the eeprom can be updated interactively.
|
||||
Both memories can be programmed via non-interactive mode.
|
||||
|
||||
Intel Hex Record type '04' is now generated as required for outputing
|
||||
memory contents that go beyond 64K.
|
||||
|
||||
2001-10-13 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avr.c, avr.h, fileio.c, fileio.h, main.c, ppi.c, ppi.h, term.c:
|
||||
* term.h:
|
||||
Style fixes.
|
||||
|
||||
* avr.c, avr.h, fileio.c, fileio.h, main.c, term.c:
|
||||
Commit changes in preparation for support the ATMega line.
|
||||
|
||||
2001-10-01 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* Makefile: Don't override CFLAGS.
|
||||
|
||||
* avrdude.1: Correct default pin assignment.
|
||||
|
||||
* avr.c, fileio.c, main.c, ppi.c, term.c:
|
||||
Remove debugging code - it served its purpose.
|
||||
|
||||
Update copyrights.
|
||||
|
||||
2001-09-21 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* main.c:
|
||||
Be sure to read the exit specs after the pin configuration has been
|
||||
assigned, otherwise, we may apply the exit specs to the wrong pins.
|
||||
|
||||
* main.c: debugging
|
||||
|
||||
2001-09-20 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrdude.1, avrdude.conf.sample, main.c:
|
||||
Prefix pin config entries in the config file with a "c:". Later, I
|
||||
might make part descriptions read in this way and we can use a
|
||||
different letter for those (p). This will make the parsing easier to
|
||||
distinguish between the entry types.
|
||||
|
||||
* main.c: Initialize pin configuration description.
|
||||
|
||||
2001-09-19 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* AVRprog.pdf, Makefile, avr.c, avrdude.1, avrdude.conf.sample:
|
||||
* avrdude.pdf, fileio.c, fileio.h, main.c, pindefs.h, term.c:
|
||||
Make the pin definitions configurable based on entries in a config
|
||||
file. This makes supporting other programmers much easier.
|
||||
|
||||
Rename AVRprog.pdf to avrprog.pdf.
|
||||
|
||||
2001-04-29 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrprog-programmer.jpg: Remove this image file from the repository.
|
||||
|
||||
2001-04-26 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrprog-schematic.jpg:
|
||||
Remove this image, use AVRprog.pdf as the preferred schematic for the
|
||||
programmer.
|
||||
|
||||
2001-04-25 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* AVRprog.pdf, Makefile, avrdude.1:
|
||||
Add a schematic provided by Joerg Wunch and also update the manual
|
||||
page (also updated by Joerg) to reference the schematic.
|
||||
|
||||
2001-02-25 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* Makefile, Makefile.inc: Automate dependency generation.
|
||||
|
||||
2001-02-08 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* main.c: Turn off ready led when finished programming.
|
||||
|
||||
* main.c: update version
|
||||
|
||||
* avr.c, main.c: Correct a few comments.
|
||||
|
||||
* Makefile, avr.c, term.c: Makefile : update dependencies
|
||||
|
||||
avr.c : correct status led updates
|
||||
|
||||
term.c : update status leds on write, make the address and length
|
||||
arguments for dump optional.
|
||||
|
||||
2001-01-26 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* main.c: Version 1.1
|
||||
|
||||
* main.c:
|
||||
Hmmm ... cvs co -D <timestamp> does not work. Change the revision
|
||||
timestamp to a full date/time value.
|
||||
|
||||
* avr.c, fileio.c, main.c, ppi.c, term.c:
|
||||
Add a -V option to display the version information about each
|
||||
component module. This is intended for support purposes, so that I
|
||||
can tell unambiguously what version a binary out in the field is.
|
||||
|
||||
Additionally, display a revision timestamp along with the version
|
||||
number. This also is intended for aiding in support and is the Unix
|
||||
time of the latest component module. Having this, should allow me to
|
||||
do a "cvs co -D timestamp avrprog" and get exactly the source of the
|
||||
version that is being reported.
|
||||
|
||||
* fileio.c:
|
||||
Return the maximum address (+1) written as opposed to the actual
|
||||
number of bytes written. The presence of an Intel Hex address
|
||||
record can cause these two number to be different; but the callers
|
||||
of this routine need the former.
|
||||
|
||||
* main.c:
|
||||
Fix a place where we were exiting without applying the exit-specs.
|
||||
|
||||
Wrap a long line.
|
||||
|
||||
* avr.c, fileio.c: avr.c: Update a comment.
|
||||
|
||||
fileio.c: Properly handle all the Intel Hex record types that I can
|
||||
find information about.
|
||||
|
||||
2001-01-25 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* Usage, avr.h: Get rid of the Usage file.
|
||||
|
||||
2001-01-24 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* Makefile, avr.c, avr.h, main.c, pindefs.h, ppi.c:
|
||||
Move pin definitions to their own file.
|
||||
|
||||
First pass at providing feedback via the optionally connected leds. I
|
||||
don't actually have any of these attached to my programmer, so I can
|
||||
only guess as whether this is toggling them on and off correctly.
|
||||
|
||||
Also, enable and disable the optional 74367 buffer.
|
||||
|
||||
* avr.h, main.c, ppi.c, ppi.h, avr.c:
|
||||
Rearrange the pinout for the programmer to be a little more logical.
|
||||
Provide hooks to support a buffered programmer, pin 6 is now used to
|
||||
enable a buffer that can be used to isolate the target system from the
|
||||
parallel port pins. This is important when programming the target
|
||||
in-system.
|
||||
|
||||
Totally change the way the pin definitions are defined. Actually
|
||||
set/clear pins based on the way more intuitive pin number, instead of
|
||||
PPI data register, bit number combination. A table of pin data is
|
||||
used so that any hardware inversion done by the parallel port is
|
||||
accounted for, what you set is actually what appears at the pin.
|
||||
Retain the old method for handling Vcc, however, because the hold
|
||||
method is much easier to use when setting / retrieving multiple pins
|
||||
simultaneously.
|
||||
|
||||
2001-01-22 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* Makefile: Don't gzip the man page.
|
||||
|
||||
* avrdude.1: .Nm macro fix. Submitted by Joerg.
|
||||
|
||||
* main.c: Cosmetic, don't output a preceding linefeed for usage().
|
||||
|
||||
* Makefile, avr.c, avr.h, fileio.c, term.c:
|
||||
Makefile : use gzip -f for man page installation so that we don't get
|
||||
prompted.
|
||||
|
||||
avr.c avr.h fileio.c term.c :
|
||||
|
||||
Change the avrpart data structure so that the typedef AVRMEM is
|
||||
used as an index into an array for the sizes of the memory types
|
||||
and also for pointers to buffers that represent the chip data for
|
||||
that memory type. This removes a lot of conditional code of the
|
||||
form:
|
||||
|
||||
switch (memtype) {
|
||||
case AVR_FLASH :
|
||||
...
|
||||
}
|
||||
|
||||
Also, re-code avr_read_byte() and avr_write_byte() to properly
|
||||
handle the flash memory type without having to tell them whether
|
||||
they should program the high byte or the low byte - figure that
|
||||
out from the address itself. For flash memory type, these
|
||||
routines now take the actual byte address instead of the word
|
||||
address. This _greatly_ simplifies many otherwise simple
|
||||
operations, such a reading or writing a range of memory, by not
|
||||
having to worry about whether the address starts on an odd byte
|
||||
or an even byte.
|
||||
|
||||
2001-01-20 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avr.c, avr.h, fileio.c, fileio.h, main.c:
|
||||
Return error codes instead of exiting, thus making sure that we exit
|
||||
only via main() so that the exitspecs are properly applied.
|
||||
|
||||
When reading input data from a file, remember how many bytes were read
|
||||
and write and verify only that many bytes.
|
||||
|
||||
Don't complain when an input file size is smaller than the memory size
|
||||
we are programming. This is normal.
|
||||
|
||||
* fileio.c:
|
||||
Correct checksum calculation; failure to account for the value of the
|
||||
record type was causing non-zero record types to be calculated
|
||||
incorrectly.
|
||||
|
||||
* Makefile, main.c: Makefile : install the man page
|
||||
|
||||
main.c : drop the giant usage text now that we have a man page.
|
||||
|
||||
* avrdude.1:
|
||||
Add initial man page graciously contributed by Joerg Wunsch. Thanks
|
||||
Joerg!
|
||||
|
||||
2001-01-19 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* term.c:
|
||||
Accept abbreviations for eeprom and flash for the dump and write
|
||||
commands.
|
||||
|
||||
Fix small bug keeping 1 character command lines from being added to
|
||||
the history.
|
||||
|
||||
* term.c:
|
||||
Implement enough state in cmd_dump so that if it is called with no
|
||||
arguments, it successively dumps the next chunk of data of the same
|
||||
previously specified length.
|
||||
|
||||
* term.c, term.h, fileio.c, fileio.h, main.c, ppi.c, ppi.h:
|
||||
* Makefile, avr.c, avr.h, avrprog.c:
|
||||
The program was getting too large for a single file. Split it up into
|
||||
more modular pieces.
|
||||
|
||||
Also, accept command abbreviations as long as they are not ambiguous.
|
||||
|
||||
* avrprog.c:
|
||||
Add ability to specify the state of the power and reset pins on
|
||||
program exit. Default to leaving the pins in the state they were when
|
||||
we found them.
|
||||
|
||||
Contributed by: Joerg Wunsch
|
||||
|
||||
2001-01-18 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* Makefile, avrprog.c:
|
||||
Switch to using readline() for getting terminal input. I can't seem
|
||||
to get the history capabilities working yet, but even so, it does
|
||||
better handling of the prompt and strips newlines for us, so it's
|
||||
still a win.
|
||||
|
||||
Add a few new commands for terminal mode: help, sig, part, erase.
|
||||
Display rudimentory help using the help command.
|
||||
|
||||
Add some function prototypes.
|
||||
|
||||
* Usage, avrprog.c:
|
||||
Change -c (interactive command mode) to the more intuitive -t
|
||||
(terminal mode).
|
||||
|
||||
Make binary format the default for output.
|
||||
|
||||
Update the parts table with corrections for old values and add some
|
||||
new values.
|
||||
|
||||
2001-01-15 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrprog.c:
|
||||
Automatically verify on-chip data with what we just programmed.
|
||||
|
||||
* avrprog.c, Makefile:
|
||||
Prepare the Makefile for integration into the FreeBSD ports tree.
|
||||
|
||||
Fix a few "may be used uninitialized" bugs found by -Wall.
|
||||
|
||||
2001-01-14 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrprog.c: Free a buffer.
|
||||
|
||||
* avrprog.c:
|
||||
Use a smarter programming algorithm - read the existing data byte
|
||||
first and only write the new one if it is different.
|
||||
|
||||
Add -n option which is a test mode in which the chip is not actually
|
||||
updated. This option does not affect writes in interactive mode.
|
||||
|
||||
* avrprog.c: Add the "dump" and "write" interactive commands.
|
||||
|
||||
* avrprog.c:
|
||||
Correctly produce and handle "end of record" for intel hex files.
|
||||
|
||||
2001-01-13 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrprog.c:
|
||||
Re-enable writing to the chip. I should probably should make this a
|
||||
command-line selectable option so that I don't keep forgetting and
|
||||
committing it with it disabled.
|
||||
|
||||
* avrprog.c:
|
||||
Add a newline before exiting due to command line errors. Perform a
|
||||
bit more option compatibility testing between -c, -i, and -o.
|
||||
|
||||
* avrprog.c: Add input file format auto-detection support.
|
||||
|
||||
* Usage, avrprog.c: Say what the defaults are.
|
||||
|
||||
* avrprog-programmer.jpg, Usage, avrprog-schematic.jpg: New files.
|
||||
|
||||
* avrprog.c: Correct usage text.
|
||||
|
||||
* avrprog.c:
|
||||
Parameterize a few additional items per chip. Print out all per-chip
|
||||
parameters on startup. Use the per-chip parameters in the code
|
||||
instead of hard-coded values for the 2313.
|
||||
|
||||
* avrprog.c: Fix filename assignment error.
|
||||
|
||||
Clean up debugging code a little, utilize fileio() instead of making
|
||||
direct calls to b2ihex().
|
||||
|
||||
* avrprog.c: A lot of general code cleanup.
|
||||
|
||||
Re-work command line options to be more intuitive.
|
||||
|
||||
Support Intel Hex input and output file formats. Provide hooks to
|
||||
support Motorola S-Record as well.
|
||||
|
||||
Add a few more part-specific parameters to the avrpart structure.
|
||||
|
||||
Only write the flash or eeprom if the data to be written is not 0xff.
|
||||
|
||||
2000-12-31 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrprog.c: Update a comment.
|
||||
|
||||
* avrprog.c:
|
||||
Provide the ability to tie additionally tie pins 6-9 of the parallel
|
||||
port to Vcc in order to supply more current.
|
||||
|
||||
Fix a typo on the size of the S1200's Flash.
|
||||
|
||||
Bring RESET low when programming is completed.
|
||||
|
||||
* avrprog.c:
|
||||
Correct pin connection comments. Elaborate a bit on Vcc connection.
|
||||
|
||||
* avrprog.c:
|
||||
Update after receiving some good feedback from Joerg Wunsch. We
|
||||
should now be able to program AT90S1200's.
|
||||
|
||||
2000-12-30 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrprog.c: Don't limit eeprom addresses.
|
||||
|
||||
2000-12-20 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* Makefile, avrprog.c:
|
||||
Add support for the 8515. Make the addition for other devices easier.
|
||||
|
||||
2000-08-27 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrprog.c:
|
||||
Clear all bits except AVR_RESET when finished reading or programming
|
||||
the Atmel device.
|
||||
|
||||
2000-08-07 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrprog.c: update announcement message
|
||||
|
||||
* avrprog.c: Update announcement message.
|
||||
|
||||
* avrprog.c: Return the correct return code from 'main()'.
|
||||
|
||||
* avrprog.c:
|
||||
Add ppi_pulse() function and fix ppi_toggle() to actully toggle
|
||||
instead of pulse.
|
||||
|
||||
Make all abnormal returns after the parallel port has been opened go
|
||||
through a single exit point at the bottom of 'main()'.
|
||||
|
||||
2000-08-06 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* Makefile, avrprog.c: Makefile: add --pedantic compiler option
|
||||
|
||||
avrprog.c:
|
||||
|
||||
Add lots of comments, move getop() variable declarations to
|
||||
the top of the program.
|
||||
|
||||
Add a typedef name to the AVR memory type and use it for
|
||||
function declarations.
|
||||
|
||||
Add a usleep() delay in the sense loop to avoid becoming a cpu
|
||||
hog.
|
||||
|
||||
Print out a version string so that folks know what version of
|
||||
the software they are running.
|
||||
|
||||
Be sure and close the parallel device and the i/o file when
|
||||
terminating abnormally.
|
||||
|
||||
* avrprog.c: Print out version information when invoked.
|
||||
|
||||
* Makefile, avrprog.c: Makefile: Add an install target.
|
||||
|
||||
avrprog.c:
|
||||
|
||||
Add license.
|
||||
|
||||
Document the header a bit better.
|
||||
|
||||
Add capability to read out and display the device signature bytes.
|
||||
|
||||
Add capability to power the device from the parallel port.
|
||||
|
||||
Eliminate debug print facility.
|
||||
|
||||
Provide 'avr_cmd()' function.
|
||||
|
||||
When memory locations don't program, generate a newline so that the
|
||||
information is not overwritten and lost.
|
||||
|
||||
Don't print out the message about needing to specify a file if the
|
||||
user is not requesting an operation that requires the file.
|
||||
|
||||
2000-08-05 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrprog.c: Pring usage when no arguments are supplied.
|
||||
|
||||
* Makefile, avrprog.c: Initial check-in
|
||||
|
||||
* Makefile, avrprog.c: New file.
|
||||
|
||||
237
ChangeLog-2002
237
ChangeLog-2002
@@ -1,237 +0,0 @@
|
||||
2002-12-12 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* main.c: minor cleanup
|
||||
|
||||
2002-12-07 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrdude.1, main.c:
|
||||
If the stk500 is being used, default to using the first serial port.
|
||||
|
||||
2002-12-03 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrdude.1: Mention STK500 support.
|
||||
|
||||
2002-12-01 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* stk500.c: Remove unused code.
|
||||
|
||||
* CHANGELOG, stk500.c:
|
||||
Document changes since the previous version in the CHANGELOG.
|
||||
|
||||
Cleanup stk500.c a bit.
|
||||
|
||||
* stk500.c: Fix cut and paste braino.
|
||||
|
||||
* avr.c, avrdude.conf.sample, main.c, pgm.h, stk500.c:
|
||||
The STK500 can perform paged read/write operations even on standard
|
||||
"non-paged" parts. Take advantage of that and use the faster internal
|
||||
routines of the STK500 for those parts as well.
|
||||
|
||||
* avr.c, avr.h, avrpart.h, main.c, pgm.c, pgm.h, stk500.c:
|
||||
Optimize reading and writing for the STK500 programmer if the part
|
||||
supports paged reads and writes. This greatly decreases the
|
||||
program/verify time from about 4.5 minutes down to about 10 seconds in
|
||||
a 12K program size test case.
|
||||
|
||||
Print out the hardware and firmware version for the STK500 if verbose
|
||||
is enabled.
|
||||
|
||||
* avrdude.conf.sample, avrpart.h, config_gram.y, lexer.l, pgm.h:
|
||||
* ppi.c, ppi.h, stk500.c, stk500.h, stk500_private.h:
|
||||
Add basic support for STK500.
|
||||
|
||||
2002-11-30 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrdude.conf.sample, config.c, config.h, config_gram.y, lexer.l:
|
||||
* main.c, pgm.c, pgm.h, ppi.c, ppi.h, term.c, term.h, Makefile:
|
||||
* avr.c, avr.h:
|
||||
Seperate programmer operations out into a driver-like interface so
|
||||
that programmers other than the direct parallel port connection can be
|
||||
supported.
|
||||
|
||||
2002-11-23 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* CHANGELOG, main.c, term.c:
|
||||
term.c - when in interactive terminal mode and dumping memory using
|
||||
the 'dump <memtype>' command without any address information,
|
||||
and the end of memory is reached, wrap back around to zero on
|
||||
the next invocation.
|
||||
|
||||
CHANGELOG - describe changes
|
||||
|
||||
main.c - update version number
|
||||
|
||||
* main.c:
|
||||
When getting ready to initiate communications with the AVR device,
|
||||
first pull /RESET low for a short period of time before enabling the
|
||||
buffer chip. This sequence allows the AVR to be reset before the
|
||||
buffer is enabled to avoid a short period of time where the AVR may be
|
||||
driving the programming lines at the same time the programmer tries
|
||||
to. Of course, if a buffer is being used, then the /RESET line from
|
||||
the programmer needs to be directly connected to the AVR /RESET line
|
||||
and not via the buffer chip.
|
||||
|
||||
2002-11-06 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* CHANGELOG: Update changelog.
|
||||
|
||||
* avr.c, avr.h, main.c: Fix -Y option. Reported by Joerg Wunsch.
|
||||
|
||||
2002-11-01 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* CHANGELOG, main.c: Version update and CHANGELOG entry.
|
||||
|
||||
* avr.c:
|
||||
Be backward compatible with the 2-byte rewrite cycle counter which
|
||||
appeared in version 2.1.0, but was changed to a 4 byte counter in
|
||||
version 2.1.1. Reminded by Joerg Wunsch.
|
||||
|
||||
2002-10-29 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* CHANGELOG, avrdude.1, main.c:
|
||||
Add '-V' (no verify) flag requested by Joerg Wunsch. Update the man
|
||||
page.
|
||||
|
||||
2002-10-13 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* CHANGELOG, avrdude.1: Update man page and changelog.
|
||||
|
||||
* main.c: Update version number.
|
||||
|
||||
2002-10-12 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* Makefile: Remove --pedantic and -g from the compiler options.
|
||||
|
||||
2002-10-11 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avr.c, term.c:
|
||||
Use a four byte value instead of a two byte value for the programming
|
||||
cycle count stored at the end of EEPROM. It seems as though Atmel was
|
||||
greatly conservative in claiming a 1000 count reliability for the
|
||||
FLASH. I current have a part that has been reprogrammed 173330 times,
|
||||
and counting.
|
||||
|
||||
Fix a compiler warning.
|
||||
|
||||
* avrdude.conf.sample:
|
||||
Fix ATMega128 instruction encoding for reading the low and high fuse
|
||||
bits. Thanks to Joerg Wunsch for tripping over this.
|
||||
|
||||
2002-08-01 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avr.c, avrdude.1, main.c:
|
||||
Move erase-rewrite cycle increment to within the chip erase routine so
|
||||
that it is tracked no matter where the erase was initiated: command
|
||||
line mode or interactive mode, without code duplicaiton.
|
||||
|
||||
* CHANGELOG: Recent updates.
|
||||
|
||||
* avr.c: Eliminate unused variables.
|
||||
|
||||
* avr.c, avr.h, avrdude.1, fileio.c, main.c:
|
||||
Implement a way of tracking how many erase-rewrite cycles a part has
|
||||
undergone. This utilizes the last two bytes of EEPROM to maintain a
|
||||
counter that is incremented each time the part is erased.
|
||||
|
||||
2002-07-27 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avr.c, main.c:
|
||||
Fix a typo in a comment. Display the size of memory being written.
|
||||
Display the correct memory name in an error message (previously
|
||||
hardcoded).
|
||||
|
||||
2002-06-22 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* CHANGELOG, avrdude.conf.sample:
|
||||
Add support for ATtiny15 - contributed by Asher Hoskins
|
||||
<asher@crumbly.freeserve.co.uk>
|
||||
|
||||
2002-04-23 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* CHANGELOG: Say what changed.
|
||||
|
||||
2002-04-07 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* Makefile, avrdude.conf.sample:
|
||||
Backup the config file to a timestamped name to keep from possibly
|
||||
overwriting user-modified configs.
|
||||
|
||||
Add read/write instructions for all memory types for ATMEGA103,
|
||||
ATMEGA128, ATMEGA16, and ATMEGA8.
|
||||
|
||||
2002-04-05 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrdude.conf.sample:
|
||||
Add support for ATMEGA128; untested; requested by Jeff Gardner
|
||||
<gardner@journey.com>.
|
||||
|
||||
2002-02-15 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrdude.conf.sample: Minor ordering.
|
||||
|
||||
* CHANGELOG, main.c: Update version numbers.
|
||||
|
||||
2002-02-14 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* CHANGELOG: Summarize latest updates.
|
||||
|
||||
* avrdude.conf.sample, config_gram.y:
|
||||
Make pwroff_after_write a yes/no field instead of a numeric.
|
||||
|
||||
* avrdude.conf.sample: Document the pwroff_after_write flag.
|
||||
|
||||
* avr.c: Enable the extra part verbosity when verbosity >= 3.
|
||||
|
||||
* avr.c, avr.h, avrdude.conf.sample, config_gram.y, lexer.l:
|
||||
* main.c, term.c:
|
||||
Fix error reporting by avr_write_byte().
|
||||
|
||||
Fix setting of status LEDs under various write-fail conditions.
|
||||
|
||||
Add a flag to indicate that a memory type requires the device to
|
||||
possibly be powered off and back on after a write to it. This is due
|
||||
to a hardware problem on some Atmel devices, see:
|
||||
|
||||
http://www.atmel.com/atmel/acrobat/doc1280.pdf
|
||||
|
||||
Add greater verbosity to the part-display code when verbose>1 to
|
||||
display avrprog's encoding of the defined programming instructions.
|
||||
This is primarily for debugging purposes.
|
||||
|
||||
|
||||
Part updates:
|
||||
|
||||
* add the AT90S4414 part
|
||||
|
||||
* add fuse and lock bit access instructions for the AT90S1200,
|
||||
AT90S4434, and AT90S8515.
|
||||
|
||||
* add the pwroff_after_write flag to the fuse bits for the AT90S2333
|
||||
and AT90S4433 parts
|
||||
|
||||
2002-02-09 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* avrdude.conf.sample:
|
||||
Updates to the 2333 and 4433 parts, contributed by Joerg Wunsh.
|
||||
|
||||
2002-01-18 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* CHANGELOG: Add changelog.
|
||||
|
||||
2002-01-12 Brian S. Dean <bsd@bsdhome.com>
|
||||
|
||||
* main.c: Add (c) to copyright.
|
||||
|
||||
* fileio.c, fileio.h, lexer.l, lists.c, lists.h, main.c:
|
||||
* pindefs.h, ppi.c, ppi.h, term.c, term.h, avr.c, avr.h:
|
||||
* config.c, config.h, config_gram.y:
|
||||
Update version number. Update copyright.
|
||||
|
||||
* avrdude.1: Update copyright and add description of "default".
|
||||
|
||||
Submitted by: Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* avr.c, term.c:
|
||||
Fix programming of write-only memories (such as lock bits on the
|
||||
2313).
|
||||
|
||||
1095
ChangeLog-2003
1095
ChangeLog-2003
File diff suppressed because it is too large
Load Diff
1644
ChangeLog-2004-2006
1644
ChangeLog-2004-2006
File diff suppressed because it is too large
Load Diff
364
ChangeLog-2007
364
ChangeLog-2007
@@ -1,364 +0,0 @@
|
||||
2007-11-08 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* main.c: Partially revert the line buffered output change,
|
||||
and turn stderr into unbuffered output while producing the
|
||||
progress report.
|
||||
|
||||
2007-11-07 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* main.c: Add setup and teardown hooks to the programmer
|
||||
definition. If present, call the setup hook immediately after
|
||||
finding the respective programmer object, and schedule the
|
||||
teardown hook to be called upon exit. This allows the
|
||||
programmer implementation to dynamically allocate private
|
||||
programmer data.
|
||||
* pgm.c: (Ditto.)
|
||||
* pgm.h: (Ditto.)
|
||||
* avr910.c: Convert static programmer data into dynamically
|
||||
allocated data.
|
||||
* butterfly.c: (Ditto.)
|
||||
* jtagmkI.c: (Ditto.)
|
||||
* jtagmkII.c: (Ditto.)
|
||||
* stk500v2.c: (Ditto.)
|
||||
* usbasp.c: (Ditto.)
|
||||
* usbtiny.c: (Ditto.)
|
||||
|
||||
2007-11-06 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* butterfly.c: Remove the no_show_func_info() calls, as Brian
|
||||
promised some 4 years ago.
|
||||
|
||||
2007-11-06 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* main.c: Add the -x option to pass extended parameters to
|
||||
the programmer backend.
|
||||
* pgm.c: (Ditto.)
|
||||
* pgm.h: (Ditto.)
|
||||
* jtagmkII.c: Implement the extended parameter jtagchain=
|
||||
to support JTAG daisy-chains.
|
||||
* avrdude.1: Document all of the above.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2007-10-30 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version for post-release.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version, releasing avrdude-5.5.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by <bikenomad@gmail.com>:
|
||||
patch #5007: Patch for line-buffering of stdout and stderr
|
||||
* main.c: call setvbuf() for stdout and stderr.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by <graceindustries@gmail.com>:
|
||||
patch #5953: Add AT90CAN64 and AT90CAN32 to avrdude.conf
|
||||
* avrdude.conf.in: Add entry for AT90CAN64 and AT90CAN32.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Wolfgang Moser:
|
||||
patch #6121: ISP support for the C2N232I device (serial port
|
||||
bitbanging)
|
||||
* avrdude.conf.in: Add entry for c2n232i.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by <karl.yerkes@gmail.com>:
|
||||
patch #6141: accept binary format immediate values
|
||||
* fileio.c: Detect a 0b prefix, and call strtoul() differently
|
||||
in that case.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
bug #21076: -vvvv serial receive prints are empty in Win32 build
|
||||
* ser_win32.c (ser_recv): Drop the essentially unused variable
|
||||
"len", and use the variable "read" in order to track how many
|
||||
bytes have just been read in.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
bug #21145: atmega329p not recognized
|
||||
* avrdude.conf.in: Add definitions for the ATmega329P/3290P.
|
||||
Same as ATmega329/3290 except of the different signature.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
bug #21152: Unable to program atmega324p with avrdude 5.4 and AVRISP
|
||||
using default configuration file.
|
||||
* avrdude.conf.in: Uncomment the (bogus) stk500_devcode lines for
|
||||
the ATmega164P, ATmega324P, ATmega644, and ATmega644P definitions.
|
||||
This only affects users of STK500v1 firmware.
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Submitted by <ladyada@gmail.com>:
|
||||
Patch #6233: Add support for USBtinyISP programmer
|
||||
* usbtiny.c: New file.
|
||||
* usbtiny.h: (Ditto.)
|
||||
* Makefile.am: Include usbtiny into the build.
|
||||
* avrdude.conf.in: (Ditto.)
|
||||
* config_gram.y: (Ditto.)
|
||||
* lexer.l: (Ditto.)
|
||||
* avrdude.1: Document the usbtiny support.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* doc/avrdude.texi: Sort list of supported programmers into
|
||||
alphabetical order, add all missing programmers.
|
||||
|
||||
2007-07-24 Thomas Fischl <tfischl@gmx.de>
|
||||
|
||||
* usbasp.c: Added long addresses to support devices with more
|
||||
than 64kB flash. Closes bug #20558: Long address problem with
|
||||
USBasp.
|
||||
|
||||
2007-06-27 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* Makefile.am (EXTRA_DIST): Add ChangeLog-2004-2006.
|
||||
|
||||
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version for post-release.
|
||||
|
||||
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version, releasing avrdude-5.4.
|
||||
|
||||
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in: Fix AVR910 devcodes. It seems that the AVR109
|
||||
listing refers to "BOOT"-type code, while the standard codes are
|
||||
different (usually one below).
|
||||
|
||||
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* avr.c (avr_read, avr_write): only use the paged_load and
|
||||
paged_write backend functions iff the memory area in question has
|
||||
a page_size != 0.
|
||||
This is supposed to fix bug #19234: avrdude-5.3.1 segfaults when
|
||||
stk500v1 tries to program an ATtiny15
|
||||
|
||||
2007-05-15 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* avr910.c: Fall back to avr_{read,write}_byte_default(). Fixes
|
||||
bug #18803: Fuse reading regression in avrdude 5.3.1 with avr910
|
||||
programmer
|
||||
|
||||
2007-05-15 Colin O'Flynn <coflynn@newae.com>
|
||||
|
||||
* avrdude.conf.in: Rename the ATmega164 and ATmega324 into
|
||||
ATmega164P and ATmega324P, resp. Add an entry for the ATmega644P.
|
||||
Fixes bug #19769: ATmega164p not recognized
|
||||
|
||||
2007-05-15 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* ser_posix.c (ser_send): Don't select() on the output fd before
|
||||
trying to write something to the serial line. That kind of
|
||||
polling isn't very useful anyway, and it seems it breaks for the
|
||||
Linux CP210x USB<->RS-232 bridge driver which is certainly a bug
|
||||
in the driver, but we can just avoid that bug alltogether.
|
||||
|
||||
2007-05-15 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in: Fix the STK500v2 ISP delay parameter for
|
||||
ATmega640/1280/1281/2560/2561. Atmel has changed the XML
|
||||
files after the initial release.
|
||||
|
||||
2007-05-01 Colin O'Flynn <coflynn@newae.com>
|
||||
|
||||
* safemode.c: -Oops - bug in verbose output. Fixed.
|
||||
-Fixed handling of cases where programmer cannot read fuses (AVR910)
|
||||
* main.c: -Also fixing handling of cases where programmer cannot
|
||||
read fuses
|
||||
This should close one or more bugs (18803, 19570)
|
||||
|
||||
2007-05-01 Colin O'Flynn <coflynn@newae.com>
|
||||
|
||||
* safemode.c: Added verbose output from safemode routines.
|
||||
|
||||
2007-03-25 Colin O'Flynn <coflynn@newae.com>
|
||||
|
||||
* stk500generic.c: Forgot to close the serial port before trying to
|
||||
open it again, caused problems on Windows machines.
|
||||
Closes bug #19411
|
||||
|
||||
2007-02-26 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in: Add the AT90PWM2/3B devices.
|
||||
|
||||
2007-02-02 Thomas Fischl <tfischl@gmx.de>
|
||||
|
||||
* usbasp.c: Changed return value of function usbasp_initialize to stop
|
||||
avrdude on communication errors between programmer and target.
|
||||
Closes bug #18581: safemode destroys fuse bits
|
||||
|
||||
2007-02-01 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* config_gram.y: Remove duplicate definition of token K_WRITEPAGE
|
||||
|
||||
2007-01-30 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* butterfly.c: Implement ATmega256x support for butterfly/avr109.
|
||||
|
||||
2007-01-30 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Fix subdir handling. Now finally, "make
|
||||
distcheck" will include the documentation into the tarball even if
|
||||
the configure had been run without the --enable-doc.
|
||||
|
||||
2007-01-30 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* safemode.c: Obtain progname from avrdude.h rather than trying to
|
||||
roll our own (duplicate) copy of it.
|
||||
* avr910.c: Constify char pointers.
|
||||
* avrpart.c: (Ditto.)
|
||||
* avrpart.h: (Ditto.)
|
||||
* butterfly.c: (Ditto.)
|
||||
* config.c: (Ditto.)
|
||||
* config.h: (Ditto.)
|
||||
* jtagmkI.c: (Ditto.)
|
||||
* jtagmkII.c: (Ditto.)
|
||||
* par.c: (Ditto.)
|
||||
* pgm.c: (Ditto.)
|
||||
* pgm.h: (Ditto.)
|
||||
* serbb_posix.c: (Ditto.)
|
||||
* serbb_win32.c: (Ditto.)
|
||||
* stk500.c: (Ditto.)
|
||||
* stk500v2.c: (Ditto.)
|
||||
* usbasp.c: (Ditto.)
|
||||
|
||||
2007-01-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* avrpart.c: More backend/library abstraction and generalization:
|
||||
turn the list_parts() and list_programmers() functions into
|
||||
general list iteration functions that call a caller-supplied
|
||||
callback for each element. Implement list_parts() and
|
||||
list_programmers() as private functions in main.c based on that
|
||||
approach.
|
||||
* avrpart.h: (Ditto.)
|
||||
* main.c: (Ditto.)
|
||||
* pgm.c: (Ditto.)
|
||||
* pgm.h: (Ditto.)
|
||||
|
||||
2007-01-25 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* Makefile.am: Rearrange everything so it is now built into a
|
||||
libavrdude.a library, and link main.c against that library.
|
||||
* configure.ac: Add AC_PROG_RANLIB as we are building a library
|
||||
now.
|
||||
|
||||
2007-01-24 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Major code cleanup.
|
||||
- Make all internal functions "static".
|
||||
- Make sure each module's header and implementation file match.
|
||||
- Remove all library-like functionality from main.c, so only
|
||||
the actual frontend remains in main.c.
|
||||
- Add C++ brackets to all header files.
|
||||
* avr.c: (Ditto.)
|
||||
* avr.h: (Ditto.)
|
||||
* avr910.c: (Ditto.)
|
||||
* avr910.h: (Ditto.)
|
||||
* avrdude.h: (Ditto.)
|
||||
* avrpart.c: (Ditto.)
|
||||
* avrpart.h: (Ditto.)
|
||||
* bitbang.h: (Ditto.)
|
||||
* butterfly.h: (Ditto.)
|
||||
* config.c: (Ditto.)
|
||||
* config.h: (Ditto.)
|
||||
* confwin.h: (Ditto.)
|
||||
* crc16.c: (Ditto.)
|
||||
* crc16.h: (Ditto.)
|
||||
* fileio.c: (Ditto.)
|
||||
* fileio.h: (Ditto.)
|
||||
* jtagmkI.h: (Ditto.)
|
||||
* jtagmkII.h: (Ditto.)
|
||||
* lexer.l: (Ditto.)
|
||||
* lists.h: (Ditto.)
|
||||
* main.c: (Ditto.)
|
||||
* par.h: (Ditto.)
|
||||
* pgm.c: (Ditto.)
|
||||
* pgm.h: (Ditto.)
|
||||
* ppi.c: (Ditto.)
|
||||
* ppi.h: (Ditto.)
|
||||
* safemode.h: (Ditto.)
|
||||
* serbb.h: (Ditto.)
|
||||
* serial.h: (Ditto.)
|
||||
* stk500.h: (Ditto.)
|
||||
* stk500v2.c: (Ditto.)
|
||||
* stk500v2.h: (Ditto.)
|
||||
* term.c: (Ditto.)
|
||||
* term.h: (Ditto.)
|
||||
* usbasp.h: (Ditto.)
|
||||
* update.c: New file.
|
||||
* update.h: New file.
|
||||
* Makefile.am: Include update.c and update.h.
|
||||
|
||||
2007-01-24 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Move all "extern" declarations into a centreal header file.
|
||||
* Makefile.am: Add new avrdude.h.
|
||||
* avrdude.h: New file.
|
||||
* avr.c: Replace private extern decl's by #include "avrdude.h".
|
||||
* avr910.c: (Ditto.)
|
||||
* avrpart.c: (Ditto.)
|
||||
* bitbang.c: (Ditto.)
|
||||
* butterfly.c: (Ditto.)
|
||||
* config.c: (Ditto.)
|
||||
* config_gram.y: (Ditto.)
|
||||
* fileio.c: (Ditto.)
|
||||
* jtagmkI.c: (Ditto.)
|
||||
* jtagmkII.c: (Ditto.)
|
||||
* lexer.l: (Ditto.)
|
||||
* main.c: (Ditto.)
|
||||
* par.c: (Ditto.)
|
||||
* pgm.c: (Ditto.)
|
||||
* ppi.c: (Ditto.)
|
||||
* ppiwin.c: (Ditto.)
|
||||
* ser_avrdoper.c: (Ditto.)
|
||||
* ser_posix.c: (Ditto.)
|
||||
* ser_win32.c: (Ditto.)
|
||||
* serbb_posix.c: (Ditto.)
|
||||
* serbb_win32.c: (Ditto.)
|
||||
* stk500.c: (Ditto.)
|
||||
* stk500generic.c: (Ditto.)
|
||||
* stk500v2.c: (Ditto.)
|
||||
* term.c: (Ditto.)
|
||||
* usb_libusb.c: (Ditto.)
|
||||
* usbasp.c: (Ditto.)
|
||||
|
||||
2007-01-13 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in (ATmega8): Bump the delay values for flash
|
||||
and EEPROM, based on the current Atmel XML file.
|
||||
|
||||
2007-01-12 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Improve the detection of the Win32 HID library,
|
||||
and the presence of the header ddk/hidsdi.h. It now works
|
||||
correctly under Cygwin and several flavours of MinGW.
|
||||
* Makefile.am: Add new LIBHID pattern.
|
||||
|
||||
2007-01-11 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
* butterfly.c (butterfly_initialize): when sending the 'T'
|
||||
command (which is ignored by current AVR109 bootloaders),
|
||||
send the first reply from the list of supported device
|
||||
codes back rather than using avrdude.conf's idea about
|
||||
an AVR910 device code. Apparently, this solves disagreements
|
||||
between different versions of at least the ATmega8 AVR910
|
||||
device code.
|
||||
Closes bug #18727: Writing flash failed
|
||||
|
||||
2007-01-07 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
|
||||
Reported by Till Harbaum:
|
||||
* avrdude.conf.in (ATtiny25/45/85): Change HVSP reset from
|
||||
500 microseconds to 1 ms, matching the most recent Atmel XML
|
||||
specs.
|
||||
185
ChangeLog-2008
185
ChangeLog-2008
@@ -1,185 +0,0 @@
|
||||
2008-11-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.h: Change the prototype for usleep() to be more Cygwin-
|
||||
friendly.
|
||||
* ppiwin.c: (Ditto.)
|
||||
|
||||
2008-11-06 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by limor <limor@ladyada.net>
|
||||
* usbtiny.c (usbtiny_cmd): Replace sizeof() by a fixed constant
|
||||
4 for the result array, because otherwise it would take the size
|
||||
of a pointer which miserably fails on 64-bit machines.
|
||||
|
||||
2008-11-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
patch #6609: Using PCI parallel port cards on Windows
|
||||
* ppiwin.c (ppi_open): If the port parameter passed from the
|
||||
-p option is neither lpt1/2/3, try interpreting it directly as
|
||||
a base address.
|
||||
* avrdude.1: Document the change.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2008-11-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #22882: Erase Cycle Counter does not work for stk500v2
|
||||
* stk500v2.c (stk500v2_chip_erase,stk500hv_chip_erase): Return
|
||||
the expected 0 for success rather than a protocol-dependant
|
||||
number.
|
||||
|
||||
2008-11-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #22883: Chip Erase performed even with no-write flag (-n)
|
||||
* main.c: Do not erase the chip if both, -e and -n options have
|
||||
been specified.
|
||||
|
||||
2008-11-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #24589: AT90USB64* have wrong signature
|
||||
* avrdude.conf.in: Uncomment the correct, and delete the wrong
|
||||
signature for AT90USB646/647. Alas, the datasheet has never been
|
||||
corrected for years.
|
||||
|
||||
2008-10-31 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtagmkII.c: Fix a serious memory corruption that happened when
|
||||
using the JTAG ICE mkII (or AVR Dragon) in ISP mode. The wrong
|
||||
set of per-programmer private data had been allocated (stk500v2
|
||||
vs. jtagmkII) which was too small to hold the actual data.
|
||||
* jtagmkII.h: (Ditto.)
|
||||
* stk500v2.c: (Ditto.)
|
||||
|
||||
2008-07-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtagmkII.c: Implement Xmega JTAG support.
|
||||
* jtagmkII_private.h: Add EMULATOR_MODE_JTAG_XMEGA.
|
||||
|
||||
2008-07-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* main.c: Remember whether the device initialization worked, and
|
||||
allow to continue with -F if it failed yet do not attempt to
|
||||
perform anything on the device itself. That way, -tF could be
|
||||
specified for programmers like the STK500/STK600 even without a
|
||||
device connected, just in order to allow changing parameters on
|
||||
the programmer itself.
|
||||
* avrdude.1: Document that possible use of the -F option.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2008-07-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2.c (stk600_xprog_paged_write): Fix a fatal miscalculation
|
||||
of the number of bytes to be written which caused a malloc chunk
|
||||
corruption.
|
||||
|
||||
2008-07-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
First implementation of ATxmega support. By now, only the
|
||||
PDI mode of the STK600 is supported. Single-byte EEPROM
|
||||
(and flash) updates do not work yet.
|
||||
* avr.c: "boot" memory is a candidate memory region for paged
|
||||
operations, besides "flash" and "eeprom".
|
||||
* avrdude.conf.in: add ATxmega128A1 and ATxmega128A1revD
|
||||
* avrpart.h: add the AVRPART_HAS_PDI flag (used to distinguish
|
||||
ATxmega parts from classic AVRs), the nvm_base part field, and
|
||||
the offset field for a memory region.
|
||||
* config_gram.y: add "has_pdi", "nvm_base", and "offset"
|
||||
* lexer.l: (Ditto.)
|
||||
* main.c: disable auto_erase for ATxmega parts
|
||||
* stk500v2.c: implement the XPROG functionality, and divert to
|
||||
this for ATxmega parts
|
||||
* avrdude.1: Document the changes.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2008-07-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Fix a bunch of warnings.
|
||||
* avr910.c (avr910_paged_load): possible unitialized use of
|
||||
rd_size
|
||||
* jtagmkI.c (jtagmkI_initialize): pointer signedness mixup
|
||||
* jtagmkII.c (jtagmkII_print_parms1): propagate const'ness
|
||||
of parameter
|
||||
* usbasp.c (usbasp_transmit): pointer signedness mixup
|
||||
* ser_avrdoper.c (usbGetReport): remove useless pointer deref
|
||||
|
||||
2008-07-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Contributed by Ville Voipio:
|
||||
patch #6501: New autotools support for avrdude
|
||||
* Makefile.am: add @WINDOWS_DIRS@ to SUBDIR
|
||||
* bootstrap: allow for autconf-2.61 and automake-1.10, too
|
||||
* configure.ac: fix @WINDOWS_DIRS@ recursion, replace
|
||||
AC_PROG_CC by AM_PROG_CC_C_O, for esoteric reasons
|
||||
|
||||
2008-06-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Contributed by Janos Sallai <janos.sallai@vanderbilt.edu>:
|
||||
patch #6074: added support for crossbow's MIB510 programmer
|
||||
* avrdude.conf.in: Add entry for mib510.
|
||||
* stk500.c: Add special hooks to handle the MIB510 programmer.
|
||||
It mostly talks STK500v1 protocol but has a special hello and
|
||||
goodbye sequence, and uses a fixed block size of 256 bytes.
|
||||
* doc/avrdude.texi: Document support for mib510.
|
||||
|
||||
2008-06-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Contributed by Klaus Leidinger <klaus@mikrocontroller-projekte.de>:
|
||||
* main.c: Realign verbose messages.
|
||||
* avrpart.c: (Ditto.)
|
||||
* avr910.c: Print the device code selected in verbose mode.
|
||||
* butterfly.c: (Ditto.)
|
||||
|
||||
2008-06-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Contributed by Klaus Leidinger <klaus@mikrocontroller-projekte.de>:
|
||||
Add check for buffermode feature, and use it if present. Can be
|
||||
turned off using -x no_blockmode.
|
||||
* avr910.c: Implement buffermode test and usage.
|
||||
* avrdude.1: Document -x no_blockmode.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2008-03-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* usb_libusb.c: #undef interface for Win32
|
||||
|
||||
2008-03-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avr910.c: Add support for the -x devcode option.
|
||||
* avrdude.1: Document -x devcode for avr910.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2008-03-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Add initial support for the Atmel STK600, for
|
||||
"classic" AVRs (AT90, ATtiny, ATmega) in both,
|
||||
ISP and high-voltage programming modes.
|
||||
* Makefile.am: Add -lm.
|
||||
* avrdude.conf.in: Add stk600, stk600pp, and stk600hvsp.
|
||||
* config_gram.y: Add support for the stk600* keywords.
|
||||
* lexer.l: (Ditto.)
|
||||
* pgm.h: Add the "chan" parameter to set_varef().
|
||||
* stk500.c: (Ditto.)
|
||||
* serial.h: Add USB endpoint support to struct filedescriptor.
|
||||
* stk500v2.c: Implement the meat of the STK600 support.
|
||||
* stk500v2.h: Add new prototypes for stk600*() programmers.
|
||||
* stk500v2_private.h: Add new constants used in the STK600.
|
||||
* term.c: Add AREF channel support.
|
||||
* usb_libusb.c: Automatically determine the correct write
|
||||
endpoint ID, the STK600 uses 0x83 while all other tools use
|
||||
0x82. Propagate the EP to use through struct filedescriptor.
|
||||
* usbdevs.h: Add the STK600 USB product ID.
|
||||
* tools/get-stk600-cards.xsl: XSL transformation for
|
||||
targetboards.xml to obtain the list of socket and routing
|
||||
card IDs, to be used in stk500v2.c (for displaying the
|
||||
names).
|
||||
* tools/get-stk600-devices.xsl: XSL transformation for
|
||||
targetboards.xml to obtain the table of socket/routing cards
|
||||
and their respective AVR device support for doc/avrdude.texi.
|
||||
* avrdude.1: Document all the STK600 stuff.
|
||||
* doc/avrdude.texi: Ditto. Added a new chapter for
|
||||
Programmer Specific Information.
|
||||
|
||||
2008-01-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2.c (stk500v2_recv): Make length computation unsigned so
|
||||
it cannot accidentally become negative.
|
||||
|
||||
411
ChangeLog-2009
411
ChangeLog-2009
@@ -1,411 +0,0 @@
|
||||
2009-11-09 David Hoerl <dhoerl@mac.com>
|
||||
|
||||
* fileio.c: ihex2bin did not properly handle files > 64K bytes
|
||||
* usb_libusb.c: re-enabled usb_reset for Macs (no reset causes lots of failures)
|
||||
* avrdude.1: spacing issue for avr32 fixed.
|
||||
|
||||
2009-11-09 Michal Ludvig <mludvig@logix.net.nz>
|
||||
|
||||
* buspirate.c: Implemented reset= and speed= extended parameters.
|
||||
* avrdude.1: Document the change.
|
||||
|
||||
2009-11-04 Michal Ludvig <mludvig@logix.net.nz>
|
||||
|
||||
* configure.ac, Makefile.am: Test if GCC accepts -Wno-pointer-sign
|
||||
|
||||
2009-11-04 Michal Ludvig <mludvig@logix.net.nz>
|
||||
|
||||
* buspirate.c: Implemented 'BinMode' support for
|
||||
firmware 2.7 and higher.
|
||||
* avrdude.1: Added info about BusPirate.
|
||||
|
||||
2009-11-03 Michal Ludvig <mludvig@logix.net.nz>
|
||||
|
||||
* arduino.c: Add on to bug #26703 / patch #6866 - clear DTR/RTS
|
||||
when closing the port.
|
||||
* Makefile.am: Silent warnings about signedness - they're useless
|
||||
and annoying, especially for 'char' vars.
|
||||
|
||||
2009-10-22 David Hoerl <dhoerl@mac.com>
|
||||
|
||||
* usb_libusb.c: disabled usb_reset for Macs (same as FreeBSD)
|
||||
|
||||
2009-10-12 Michal Ludvig <mludvig@logix.net.nz>
|
||||
|
||||
* main.c: Re-added default to serial port for BusPirate.
|
||||
|
||||
2009-10-12 David Hoerl <dhoerl@mac.com>
|
||||
|
||||
* main.c: removed some avr32 code that was pushed into jtagmkII.c
|
||||
* jtagmkII.c: consolodated the avr32 reset code and avr32_chipreset
|
||||
* avrpart.h: modified AVRPART flags for avr32
|
||||
* lexer.l: added is_avr32 flag - only way to get yacc code to set flag
|
||||
* avrdude.conf.in: updated avr32 section to include "is_avr32" flag
|
||||
|
||||
2009-10-12 David Hoerl <dhoerl@mac.com>
|
||||
|
||||
* config_gram.y: Restored inadvertantly removed buspirate entry
|
||||
* lexer.l: Restored inadvertantly removed buspirate entry
|
||||
|
||||
2009-10-12 Michal Ludvig <mludvig@logix.net.nz>
|
||||
|
||||
* buspirate.c: Replace GNU-only %as with %s in sscanf call.
|
||||
* ser_win32.c(ser_set_dtr_rts): Fixed typo in parameter name.
|
||||
* NEWS: Announce BusPirate.
|
||||
|
||||
2009-10-11 David Hoerl <dhoerl@mac.com>
|
||||
|
||||
Support for AVR32
|
||||
|
||||
* AUTHORS: added myself
|
||||
* NEWS: announced AVR32 support
|
||||
* main.c: AVR32 flag tests to avoid several code blocks
|
||||
* fileio.c: mods to ihex read function to handle address offsets and
|
||||
size of avr32
|
||||
* jtagmkI.c: added cast to printf call to remove warning
|
||||
* arduino.c: added header file to bring in prototype for usleep()
|
||||
* config_gram.y: added defines for avr32, new jtag_mkii variant for avr32
|
||||
* jtagmkII_private.h: new jtag_mkii message types defined (used by
|
||||
avr32program)
|
||||
* jtagmkII.h: extern jtagmkII_avr32_initpgm() addition
|
||||
* jtagmkII.c: huge amount of code in support of avr32
|
||||
* avrpart.h: additional flags to AVRPART for avr32
|
||||
* usb_libusb.c: modified verbose test for USB read per-byte messages by
|
||||
by one, so with verbose=3 you get just full messages, 4 gives you bytes
|
||||
too
|
||||
* lexer.l: additions for avr32
|
||||
|
||||
2009-10-10 Michal Ludvig <mludvig@logix.net.nz>
|
||||
|
||||
Support for Arduino auto-reset:
|
||||
* serial.h, ser_avrdoper.c, ser_posix.c, ser_win32.c: Added
|
||||
serial_device.set_dtr_rts implementations.
|
||||
* arduino.c, stk500.c, stk500.h: Call serial_set_dtr_rts()
|
||||
to reset Arduino board before program upload.
|
||||
Inspired by patch #6866, resolves bug #26703
|
||||
|
||||
2009-10-08 Michal Ludvig <mludvig@logix.net.nz>
|
||||
|
||||
* buspirate.c: Optimised buspirate_cmd() - reading 1kB EEPROM now
|
||||
takes only 14 sec instead of almost 2 mins with the original
|
||||
implementation.
|
||||
|
||||
2009-10-08 Michal Ludvig <mludvig@logix.net.nz>
|
||||
|
||||
* buspirate.c, buspirate.h: Support for the BusPirate programmer
|
||||
* config_gram.y, avrdude.conf.in, main.c, lexer.l, Makefile.am:
|
||||
Glue for BusPirate.
|
||||
|
||||
2009-08-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* usb_libusb.c (usbdev_close): Repair the logic around the
|
||||
conditional compilation of usb_reset() introduced in r798.
|
||||
|
||||
2009-07-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: We are post-5.8 now.
|
||||
|
||||
2009-07-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Prepare for releasing version 5.8
|
||||
|
||||
2009-07-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Roger Wolff:
|
||||
bug #26527: bug in unicode conversion
|
||||
* ser_avrdoper.c (convertUniToAscii): when encountering a UTF-16
|
||||
character that cannot be converted to ASCII, increment the UTF-16
|
||||
pointer anyway when proceeding.
|
||||
|
||||
2009-07-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtagmkI.c (jtagmkI_send): Replace %zd format by %u since not all
|
||||
implementations do understand the C99 formatting options (sigh).
|
||||
* jtagmkII.c (jtagmkII_send): (Ditto.)
|
||||
* stk500v2.c (stk500v2_recv): (Ditto.)
|
||||
|
||||
2009-07-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #26002: HVPP of EEPROM with AVR Dragon and ATmega8 Fails
|
||||
* avrdude.conf.in (ATmega8): add page size for EEPROM.
|
||||
|
||||
2009-07-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2.c: Fix a serious memory corruption problem resulting
|
||||
out of the chaining of both, the stk500v2 and the jtagmkII
|
||||
programmers for some programming hardware (JTAG ICE mkII and AVR
|
||||
Dragon running in ISP, HVSP or PP mode), where both programmers
|
||||
have to maintain their private programmer data.
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Post-release (is pre-release...)
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Prepare for releasing version 5.7
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* main.c: Add my name to the copyright output when being verbose.
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Contributed by Shaun Jackman <sjackman@gmail.com>
|
||||
bug #21798: Fix both XSLT scripts
|
||||
* tools/get-dw-params.xsl (format-hex): Add the parameter count.
|
||||
* tools/get-hv-params.xsl (format_cstack): Ditto.
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #21922: ATmega163 still not working in version 5.5
|
||||
* avrdude.conf.in (atmega163): fill in stk500v2 parameters, correct
|
||||
some flash programming parameters as well.
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #22206: avrdude: ser_setspeed(): tcsetattr() failed
|
||||
* ser_posix.c (ser_setspeed): Don't pass TCSAFLUSH to tcsetattr() as
|
||||
it apparently fails to work on Solaris. After reading the
|
||||
documentation again, it seems TCSAFLUSH and TCSANOW are indeed
|
||||
mutually exclusive.
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #22234: WINDOWS version: HOWTO: Specify Serial Ports Larger than COM9
|
||||
* ser_win32.c (ser_open): prepend \\.\ to any COM port name, so it is
|
||||
safe to be used for COM ports above 9.
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #26408: Crash in stk500v2_open()
|
||||
* stk500generic.c: Implement setup and teardown hooks, calling in turn
|
||||
the respective hooks of the stk500v2 implementation.
|
||||
|
||||
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #26130: Avrdude doesn't display it's version.
|
||||
* main.c (usage): add a version number display to the default usage
|
||||
message.
|
||||
|
||||
2009-07-01 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #26412: avrdude segfaults when called with a programmer that does not
|
||||
support it
|
||||
* main.c: do not call pgm->perform_osccal() unless it is != 0.
|
||||
|
||||
2009-06-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Contributed by Zoltan Laday:
|
||||
patch #6825: xmega problems with JTAGICEmkII
|
||||
* jtagmkII.c: Many fixes for Xmega devices.
|
||||
* jtagmkII_private.h: Add various new constants required for
|
||||
Xmega devices.
|
||||
* avrdude.conf.in: New devices: ATXMEGA64A1, ATXMEGA192A1,
|
||||
ATXMEGA256A1, ATXMEGA64A3, ATXMEGA128A3, ATXMEGA192A3,
|
||||
ATXMEGA256A3, ATXMEGA256A3B, ATXMEGA16A4, ATXMEGA32A4,
|
||||
ATXMEGA64A4, ATXMEGA128A4
|
||||
* avr.c (avr_read, avr_write): Add more names for (Xmega)
|
||||
memory areas that require paged operation.
|
||||
|
||||
2009-06-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2.c (stk600_xprog_write_byte): Handle writing fuse bytes.
|
||||
|
||||
2009-04-28 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Carl Hamilton:
|
||||
* update.c (parse_op): correctly \0-terminate buf after filling
|
||||
it, before it is potentially used as the source of a call to
|
||||
strlen or strcpy.
|
||||
|
||||
2009-04-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* doc/avrdude.texi: Merge the -P 0xXXX option description from
|
||||
avrdude.1.
|
||||
|
||||
2009-04-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: declare AM_PROG_CC_C_O to avoid the warning
|
||||
"compiling `config_gram.c' with per-target flags
|
||||
requires `AM_PROG_CC_C_O' in `configure.ac'"
|
||||
|
||||
2009-03-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #25971: "error writing to <stdout>" with multiple -U params.
|
||||
* fileio.c: Do not close the input/output stream when working on an
|
||||
stdio stream.
|
||||
|
||||
2009-02-28 Thomas Fischl <tfischl@gmx.de>
|
||||
|
||||
Based on patch #6484 commited by Jurgis Brigmanis:
|
||||
* usbasp.c: added software control for ISP speed
|
||||
* usbasp.h: (Ditto.)
|
||||
|
||||
2009-02-28 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avr910.c (avr910_read_byte_flash): Eliminate a static variable that
|
||||
hasn't been in use for 5 years.
|
||||
|
||||
2009-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Post-release 5.6.
|
||||
|
||||
2009-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Prepare for releasing version 5.6.
|
||||
|
||||
2009-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Ed Okerson:
|
||||
* jtagmkII.c (jtagmkII_read_byte): Fix signature reading of
|
||||
Xmega.
|
||||
|
||||
2009-02-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Mikael Hermansson:
|
||||
* avrdude.conf.in (ATxmega256A3): new device.
|
||||
* stk500v2 (stk500v2_initialize): Enable the AVRISPmkII as a
|
||||
PDI-capable device for ATxmega parts.
|
||||
|
||||
2009-02-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Lars Immisch:
|
||||
patch #6750: Arduino support - new programmer-id
|
||||
* arduino.c: New file, inherits stk500.c.
|
||||
* arduino.h: New file.
|
||||
* Makefile.am: Add arduino.c and arduino.h.
|
||||
* config_gram.y: Add arduino keyword.
|
||||
* lexer.l: (Ditto.)
|
||||
* avrdude.conf.in: (Ditto.)
|
||||
* avrdude.1: Document the new programmer type.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2009-02-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2.c: Turn all non-const static data into instance data.
|
||||
|
||||
2009-02-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* Makefile.am: Move term.[ch] from the library into the CLI
|
||||
application section, as it is not useful for anything else but
|
||||
the CLI frontend.
|
||||
|
||||
2009-02-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in (ATmega1284P): new device.
|
||||
|
||||
2009-02-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
More fixes for Solaris, including fixes for the Sunpro compiler:
|
||||
* avr.h: Remove stray semicolon.
|
||||
* configure.ac: Add check for predefined types uint_t and ulong_t.
|
||||
* confwin.c: Include "avrdude.h" on top to avoid empty translation
|
||||
unit warning.
|
||||
* ppwin.c: (Ditto.)
|
||||
* ser_win32.c: (Ditto.)
|
||||
* serbb_win32.c: (Ditto.)
|
||||
* jtagmkII.c (jtagmkII_recv): remove unreachable "return".
|
||||
* stk500.c (stk500_initialize): (Ditto.)
|
||||
* par.c: Test for both, __sun__ and __sun to see whether we are
|
||||
being compiled on Solaris.
|
||||
* ppi.c: (Ditto.)
|
||||
* stk500v2.c: Implement the DEBUG and DEBUGRECV macros in a way
|
||||
that is compatible with the ISO C99 standard.
|
||||
* usbtiny.c: Only typedef uint_t and ulong_t if they have not
|
||||
been found already by the autoconf checks.
|
||||
|
||||
2009-02-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #22204: Solaris10/11 Undefiniertes Symbol gethostbyname socket
|
||||
connect
|
||||
* configure.ac: Add checks for gethostent() and socket().
|
||||
While being here, remove some old cruft left from ancient days.
|
||||
|
||||
2009-02-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* lexer.l: Bump the %p size so AT&T lex will continue to work.
|
||||
|
||||
2009-02-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
(Partially) submitted by John Voltz:
|
||||
bug #20004: AVRDUDE update (-U) operations do not close files
|
||||
* fileio.c (fmt_autodetect, fileio): fclose() files.
|
||||
|
||||
2009-02-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* usbtiny.c: Replace all but one (very unlikely to trigger) exit(1)
|
||||
by return -1.
|
||||
|
||||
2009-02-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Dick Streefland:
|
||||
patch #6749: make reading from the USBtinyISP programmer more robust
|
||||
* usbtiny.c: Add code to retry failed communication attempts.
|
||||
|
||||
2009-02-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Nick Hibma:
|
||||
bug #22271: usb_reset in usb_libusb.c not necessary in FreeBSD 6.x
|
||||
* usb_libusb.c (usbdev_close): Do not call usb_reset() on FreeBSD.
|
||||
It is not necessary there.
|
||||
|
||||
2009-02-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Andrew O. Shadoura:
|
||||
bug #25156: add direct SPI transfer mode
|
||||
* bitbang.c: Implement direct SPI transfers.
|
||||
* bitbang.h: (Ditto.)
|
||||
* par.c: (Ditto.)
|
||||
* pgm.c: (Ditto.)
|
||||
* pgm.h: (Ditto.)
|
||||
* term.c: Add the "spi" and "pgm" commands.
|
||||
* avrdude.1: Document the changes.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2009-02-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Limor ("Lady Ada"):
|
||||
bug #24749: add support for '328p
|
||||
* avrdude.conf.in (ATmega328P): new device support.
|
||||
|
||||
2009-02-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by "Womo":
|
||||
bug #25241: AT90USB162, AT90USB82 device support patch for avrdude-5.5
|
||||
(also: bug #21745: AT90USBxx2 support)
|
||||
* avrdude.conf.in (AT90USB162, AT90USB82): new device support.
|
||||
|
||||
2009-02-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Evangelos Arkalis:
|
||||
patch #6069: Atmel AT89ISP Cable
|
||||
* avrdude.conf.in (89isp): new programmer support.
|
||||
|
||||
2009-02-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Bob Paddock:
|
||||
patch #6748: ATTiny88 Config
|
||||
* avrdude.conf.in (ATtiny88): new device support.
|
||||
|
||||
2009-02-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Mark Litwack:
|
||||
patch #6261: avrdude won't use dragon/debugwire to write a file
|
||||
to eeprom
|
||||
* jtagmkII.c (jtagmkII_paged_write): when in debugWire mode,
|
||||
implement a paged write to EEPROM as a series of byte writes.
|
||||
|
||||
2009-02-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Janos Sallai:
|
||||
patch #6542: paged_load fails on the MIB510 programming board
|
||||
* stk500.c: Add a workaround for the different signon sequence on
|
||||
MIB510 programmers.
|
||||
|
||||
2009-02-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in: Add the ATmega128RFA1.
|
||||
* avrdude.1: document the addition of ATmega128RFA1.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
354
ChangeLog-2010
354
ChangeLog-2010
@@ -1,354 +0,0 @@
|
||||
2010-12-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in (ATmega128RFA1): Bump two timing values in order to
|
||||
improve ISP programming stability, in particular with the STK600.
|
||||
|
||||
2010-12-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2.c (stk500v2_command): Detect warning status codes.
|
||||
|
||||
2010-10-22 Nils Springob <nils@nicai-systems.de>
|
||||
|
||||
* serial.h: serial_open() calls will now return -1 on error (no call to exit())
|
||||
* buspirate.c: (Dito.)
|
||||
* jtagmkII.c: (Dito.)
|
||||
* butterfly.c: (Dito.)
|
||||
* jtagmkI.c: (Dito.)
|
||||
* arduino.c: (Dito.)
|
||||
* avr910.c: (Dito.)
|
||||
* stk500.c: (Dito.)
|
||||
* ser_avrdoper.c: (Dito.)
|
||||
* stk500v2.c: (Dito.)
|
||||
* ser_posix.c: (Dito.)
|
||||
* usb_libusb.c: (Dito.)
|
||||
|
||||
2010-07-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #30566: MinGW + Ubuntu 9.04
|
||||
* stk500v2.c (stk500v2_open): use same condition to refer to the AVR
|
||||
Doper support as used in the definition in ser_avrdoper.c.
|
||||
(Thanks to Christian Starkjohann for the analysis of the problem.)
|
||||
|
||||
2010-07-19 Michal Ludvig <mludvig@logix.net.nz>
|
||||
|
||||
* buspirate.c: Added compatibility with BusPirate "NewUI" firmware 5.x
|
||||
(contributed by Kari Knuuttila)
|
||||
|
||||
2010-07-12 Nils Springob <nils@nicai-systems.de>
|
||||
|
||||
* avrdude.conf.in (atmega88p): New device.
|
||||
|
||||
2010-06-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #29913: 246 Byte Bug - AVRdude crashes
|
||||
doc/avrdude.texi (Troubleshooting): Mention the libusb 0.1 API
|
||||
wrapper issue that is present in some Linux versions.
|
||||
|
||||
2010-03-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #29263: Can't build avrdude on windows using latest cygwin 1.7.1
|
||||
* doc/avrdude.texi: Remove the recommendation for building
|
||||
Win32 binaries under Cygwin; mention MinGW as an alternative
|
||||
environment.
|
||||
|
||||
2010-03-08 Michal Ludvig <mludvig@logix.net.nz>
|
||||
|
||||
* ser_posix.c(ser_set_dtr_rts): Fixed DTR on/off to make
|
||||
Arduino auto-reset work. (bug #29108, patch #7100)
|
||||
|
||||
2010-03-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* buspirate.c: Replace printf() by fprintf(stderr)
|
||||
* safemode.c: (Dito.)
|
||||
* usbtiny.c: (Dito.)
|
||||
|
||||
2010-01-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Cleanup Cygwin builds.
|
||||
* windows/Makefile.am (loaddrv_LDFLAGS): remove, the -mno-cygwin
|
||||
flag is supposed to be set in CFLAGS by ./configure
|
||||
* configure.ac: add a check for the presence of usleep(), add a
|
||||
check whether the linker accepts -static
|
||||
* avrdude.h: protect prototype for usleep by !defined(HAVE_USLEEP)
|
||||
* ppwin.c (usleep): protect by !defined(HAVE_USLEEP)
|
||||
* main.c: silence "array subscript of type char" compiler warnings
|
||||
by casting all arguments to tolower()/toupper() and isspace()/
|
||||
isdigit()/ispunct() to "int"
|
||||
* butterfly.c: (Dito.)
|
||||
* avr910.c: (Dito.)
|
||||
|
||||
2010-01-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Bump for post-5.10.
|
||||
|
||||
2010-01-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Released version 5.10.
|
||||
|
||||
2010-01-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #28677: Cygwin's GCC no longer supports -mno-cygwin option
|
||||
* configure.ac: For Win32 environments, add a check whether the
|
||||
compiler understands the -mno-cygwin option. If not, don't use
|
||||
it but suggest using a different compiler.
|
||||
|
||||
2010-01-18 David Hoerl <dhoerl@mac.com>
|
||||
|
||||
bug #28660: Problem with loading intel hex rom files that exceed
|
||||
0x10000 bytes
|
||||
* fileio.c: Fix two byte shifts.
|
||||
|
||||
2010-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Michael biebl:
|
||||
* configure.ac: Fix FreeBSD default serial port name.
|
||||
* doc/avrdude.texi: (Dito.)
|
||||
|
||||
2010-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtagmkII.c: If entering JTAG mode fails with a bad JTAG ID
|
||||
message, retry with external reset applied (in case the target
|
||||
is in sleep mode or has asserted the JTD bit).
|
||||
|
||||
2010-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Aurelien Jarno:
|
||||
* configure.ac: Fix build for GNU/kFreeBSD.
|
||||
* ppi.c: (Dito.)
|
||||
* par.c: (Dito.)
|
||||
|
||||
2010-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Bump version for post-5.8.
|
||||
|
||||
2010-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Bump version for release 5.8.
|
||||
|
||||
2010-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Soren Jorvang:
|
||||
bug #28611: -i delay not being applied to all serial port
|
||||
bit banging state transitions
|
||||
* serbb_win32.c: Apply ispdelay everywhere.
|
||||
* serbb_posix.c: (Dito.)
|
||||
|
||||
2010-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2_private.h: Implement TPI mode for AVRISPmkII/STK600
|
||||
* config_gram.y: (Dito.)
|
||||
* avrpart.h: (Dito.)
|
||||
* stk500v2.c: (Dito.)
|
||||
* main.c: (Dito.)
|
||||
* lexer.l: (Dito.)
|
||||
* avrdude.conf.in: Add ATtiny4/5/9/10
|
||||
* avrdude.1: Document TPI and new device support.
|
||||
* doc/avrdude.texi: (Dito.)
|
||||
|
||||
2010-01-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by clint fisher:
|
||||
patch #7038: Adding Atmega32U4 Device to avrdude.conf.in
|
||||
* avrdude.conf.in (atmega32u4): New device.
|
||||
* avrdude.1: Document the new device support.
|
||||
* doc/avrdude.texi: (Dito.)
|
||||
|
||||
2010-01-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Thomas Pircher:
|
||||
patch #6927: Documentation patches
|
||||
* doc/avrdude.texi: Fix various typos, and remove the last
|
||||
remnants of obsoleted options -i/-o/-m/-f.
|
||||
* avrdude.1: Merge typo fixes from avrdude.texi where
|
||||
applicable.
|
||||
|
||||
2010-01-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.1: Update documentation to match the reality (device
|
||||
support, memory areas).
|
||||
* doc/avrdude.texi: Update documentation to match the
|
||||
reality (device support, programmer support, memory areas).
|
||||
Merge buspirate-specific comments from avrdude.1.
|
||||
* jtagmkII.c: Add some firmware feature checks.
|
||||
|
||||
2010-01-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtagmkII.c: Implement PDI mode support for the JTAG ICE mkII
|
||||
and the AVR Dragon.
|
||||
* jtagmkII.h: (Dito.)
|
||||
* config_gram.y: (Dito.)
|
||||
* jtagmkII_private.h: (Dito.)
|
||||
* avrdude.conf.in: (Dito.)
|
||||
* lexer.l: (Dito.)
|
||||
|
||||
2010-01-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2.c: Update STK600 routing and socket card data from XML
|
||||
file.
|
||||
|
||||
2010-01-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2.c: Cleanup the open/close handling to avoid accessing
|
||||
unallocated memory (in the atexit handler) in case of bailing out.
|
||||
* main.c: (Ditto.)
|
||||
|
||||
2010-01-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtagmkII.c: Stylistic changes: move #defines out into
|
||||
jtagmkII_private.h, drop all #if 0 blocks, fold overly long lines,
|
||||
move the *_initpgm() functions to the end of the file; while being
|
||||
here, remove all trailing whitespace.
|
||||
* jtagmkII_private.h: move AVR32 #defines here.
|
||||
|
||||
2010-01-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* bootstrap: autoconf 2.62 works well.
|
||||
|
||||
2010-01-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Various fixes for Xmega devices.
|
||||
* avrdude.conf.in: Correctly declare EEPROM page sizes for
|
||||
all Xmega devices (0x20 instead of 0x100).
|
||||
* avr.c: If a memory region has a page size declared, try
|
||||
using the paged IO routines regardless of the target memory
|
||||
name. Xmega EEPROM requires to be written in paged mode.
|
||||
Correctly use a long (rather than unsigned long) variable to
|
||||
evaluate the success status of the paged mode write attempt.
|
||||
* stk500v2.c: Don't apply TIF space offsets twice (bug #27995:
|
||||
AVRDUDE 5.8svn fails to program and read XMEGA); use
|
||||
stk500v2_loadaddr() prior to paged mode (EEPROM and flash) writes,
|
||||
otherwise programming of flash areas will fail; while being there,
|
||||
check the return value of stk500v2_loadaddr() everywhere; use the
|
||||
correct write/erase mode bits (same as AVR Studio does).
|
||||
|
||||
2010-01-12 Michal Ludvig <mludvig@logix.net.nz>
|
||||
|
||||
* buspirate.c: Initialise firmware version to v0.0
|
||||
prior to parsing the buspirate banner.
|
||||
|
||||
2010-01-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Clean-up the Xmega erase functions.
|
||||
* jtagmkII_private.h: Add CMND_XMEGA_ERASE as well as
|
||||
the various XMEGA_ERASE_* definitions (from updated
|
||||
appnote AVR067)
|
||||
* jtagmkII.c (jtagmkII_chip_erase): Correctly implement Xmega chip
|
||||
erase based on CMND_XMEGA_ERASE. After erasing an Xmega part, do
|
||||
*not* reinitialize the world, as a subsequent programming
|
||||
operation will fail (for unknown reasons). Actually, this was
|
||||
really only required for ancient AVRs, but doesn't hurt on mega
|
||||
and tiny devices.
|
||||
* jtagmkII.c (jtagmkII_pre_write): Remove, this turned out
|
||||
to be just a chip erase.
|
||||
* jtagmkII.c (jtagmkII_program_disable): Don't try reading
|
||||
"hfuse" for Xmega parts; they don't have it.
|
||||
* main.c (main): Re-enable auto-erase. It's been done
|
||||
before (as "jtagmkII_pre_write") in jtagmkII_paged_write()
|
||||
anyway. Xmega boot and application flash areas should be
|
||||
handled separately in the future, so auto_erase can only
|
||||
affect the area just being programmed.
|
||||
|
||||
2010-01-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* main.c (main): disable safemode for Xmega parts.
|
||||
|
||||
2010-01-12 Michal Ludvig <mludvig@logix.net.nz>
|
||||
|
||||
* buspirate.c: If the BusPirate doesn't respond
|
||||
to a standard a reset command assume it was in binmode
|
||||
and attempt to exit to text mode first.
|
||||
|
||||
2010-01-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* bitbang.c: Fix Win32 build error: move freq up to the file
|
||||
level.
|
||||
* buspirate.c: Fix Win32 build warning: include <malloc.h> to
|
||||
to get a declaration for alloca().
|
||||
|
||||
2010-01-08 Thomas Fischl <tfischl@gmx.de>
|
||||
|
||||
bug #28520: Programming with USBasp with low clock speed fails
|
||||
* usbasp.c: Change blocksize depending on sck frequency to
|
||||
avoid usb transmition timeouts.
|
||||
|
||||
2010-01-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #27505: serbb_posix does not cope with inverted pins
|
||||
* serbb_posix (serbb_highpulsepin): apply PIN_MASK when
|
||||
checking pin numbers.
|
||||
* serbb_win32 (serbb_highpulsepin): (Dito.)
|
||||
|
||||
2010-01-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #28516: Linux/Dragon: Error message on exit
|
||||
* stk500v2.c: Fix the "bad response to GO command:
|
||||
RSP_ILLEGAL_EMULATOR_MODE" message. jtagmkII_close()
|
||||
has been called with the wrong pgm->cookie. Wrap it
|
||||
inside stk500v2_jtagmkII_close(), adjusting the cookie
|
||||
data appropriately.
|
||||
|
||||
2010-01-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Doug:
|
||||
patch #7010: Win32 enhanced bitbang_delay
|
||||
* bitbang.c (bitbang_calibrate_delay, bitbang_delay): On Win32,
|
||||
use the high-resolution performance counter rather than the
|
||||
uneducated delay loop guess if it is available on the target
|
||||
hardware.
|
||||
|
||||
2010-01-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Gerard:
|
||||
patch #6828: Using arbitrary BAUD rates
|
||||
* ser_posix.c (serial_baud_lookup): Allow non-standard baud
|
||||
rates.
|
||||
* ser_win32.c (serial_baud_lookup): (Dito.)
|
||||
|
||||
2010-01-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Eric Trein:
|
||||
bug #27596: AT90s2333 is not correctly supported in avrdude.conf
|
||||
* avrdude.conf.in (at90s2333): add various STK500v2 parameters.
|
||||
|
||||
2010-01-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Gyorgy Szekely:
|
||||
bug #28458: Buffer line is incorrectly released for PP programmers
|
||||
* par.c (par_close): use par_setmany() rather than par_setpin()
|
||||
for PPI_AVR_BUFF.
|
||||
|
||||
2010-01-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Lukasz Goralczyk:
|
||||
bug #27507: SIGSEGV when using avrdragon (avrdude 5.8)
|
||||
* stk500v2.c (stk500v2_dragon_isp_initpgm): Use
|
||||
stk500v2_jtagmkII_setup/stk500v2_jtagmkII_rather than their
|
||||
jtagII counterparts, to get the private data properly
|
||||
initialized.
|
||||
|
||||
2010-01-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* buspirate.c: Cosmetics: remove UTF-8 dashes, adjust for 8-column
|
||||
hard tabs.
|
||||
|
||||
2010-01-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* buspirate.c: add $ Id $ line.
|
||||
* buspirate.h: add $ Id $ line.
|
||||
|
||||
2010-01-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Fix a few warnings that came up recently (some of them only triggered
|
||||
by recent GCC versions).
|
||||
* config_gram.y (parse_cmdbits): "brkt possibly used uninitialized"
|
||||
(GCC errs here)
|
||||
* jtagmkII.c (jtagmkII_reset32): "status possibly used uninitialized"
|
||||
(I think GCC errs, too)
|
||||
* buspirate.c: "pointers differ in signedness" (mismatch between
|
||||
string processing and the use of "unsigned char" throughought the
|
||||
AVRDUDE API)
|
||||
|
||||
2010-01-01 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtagmkII.c (jtagmkII_smc_init32): replace sleep() by usleep() for
|
||||
win32 compatibility.
|
||||
489
ChangeLog-2011
489
ChangeLog-2011
@@ -1,489 +0,0 @@
|
||||
2011-12-30 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* avrdude.conf.in: Added is_at90s1200 option to part description
|
||||
* doc/avrdude.texi: Added missing options to part definition
|
||||
* config_gram.y: Fixed resetting of is_at90s1200 and is_avr32 flags
|
||||
|
||||
2011-12-30 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7693: Fix config file atmel URLs
|
||||
* avrdude.conf.in: Updated URLs
|
||||
* avrpart.h: Updated URLs
|
||||
* doc/avrdude.texi: Updated URLs
|
||||
|
||||
2011-12-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* ser_posix.c (baud_lookup_table): Conditionalize the inclusion of
|
||||
non-standard baud rates (only baud rates up to B38400 are
|
||||
standardized by the Single UNIX Specification).
|
||||
|
||||
2011-12-29 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #34302: Feature request : device configuration with parent classes
|
||||
* config_gram.y: Added part parent rule and allow overwriting existing
|
||||
data at several places
|
||||
* avrdude.conf.in: Added description comment and m328/m328p as example
|
||||
* avrpart.c: avr_dup_mem-functions now copy buf and tags memory block
|
||||
only they are already allocated.
|
||||
* lexer.l: Added parent as valid token
|
||||
|
||||
(not in original patch)
|
||||
* avrpart.c: New function avr_dup_opcode. avr_dup_mem/avr_dup_part-
|
||||
functions now duplicate the opcodes in their op-array to avoid memory leaks.
|
||||
* doc/avrdude.texi: Added description of part parent feature
|
||||
|
||||
2011-12-29 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7687: Autogenerating programmers and parts lists for docs
|
||||
(generating the parts lists, programmers lists follows later)
|
||||
* doc/Makefile.am: Add rule how to create avrdude before generating parts list
|
||||
|
||||
2011-12-29 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7687: Autogenerating programmers and parts lists for docs
|
||||
(generating the parts lists, programmers lists follows later)
|
||||
* doc/avrdude.texi: Add include of generated table of parts
|
||||
* doc/Makefile.am: Add generating of table of parts in parts.texi
|
||||
* doc/parts_comments.txt: Adding file containing part commenz references
|
||||
* avrdude.1: Remove table of parts and mention "-p ?" option
|
||||
* avrpart.c: Use AVR_DESCLEN for strncasecmp at list sorting
|
||||
|
||||
2011-12-22 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* configure.ac: Add writing of definition of confsubst to config.status,
|
||||
so it can run alone, not only called by configure.
|
||||
|
||||
2011-12-17 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7680: Fixing timeout problem in ser_recv in ser_win32.c
|
||||
* ser_win32.c: Return -1 at timeout in ser_recv().
|
||||
|
||||
2011-12-17 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* config_gram.y: Fixed another memory leak, when define an operation
|
||||
more than once
|
||||
* avrdude.conf.in: Fixed double definition at ATmega6490
|
||||
|
||||
2011-12-17 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* config_gram.y: Restructuring and compacting programmer definition
|
||||
part of grammar (in preparation of patch #7688)
|
||||
|
||||
2011-12-17 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* avrdude.conf.in: Update documentation of programmer definition
|
||||
* doc/avrdude.texi: Update documentation of programmer definition
|
||||
and add list of implemented programmer types
|
||||
|
||||
2011-12-17 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7667: Minor memory handling fixes
|
||||
* config_gram.y: Added several free_token() calls.
|
||||
|
||||
2011-12-16 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7671: Sorting programmers and parts lists for console output
|
||||
* avrdude.conf.in: change part desc of several parts to common pattern
|
||||
AT(mega|tiny|xmega)[0-9]+[A-Z]* (Upper case AT, lower case in middle)
|
||||
* list.[ch]: added sorting function lsort()
|
||||
* pgm.[ch]: added function sort_programmers()
|
||||
* avrpart.[ch]: added function sort_avrparts()
|
||||
* main.c: use sort functions in list_programmers() and list_parts()
|
||||
* main.c: list functions show config file info only at verbose mode
|
||||
|
||||
2011-10-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Replace "cvs" in version number by "svn".
|
||||
|
||||
2011-10-10 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #34518: loading intel hex files > 64k using record-type 4
|
||||
(Extended Linear Address Record)
|
||||
fileio.c: Replace the change from r928 (handling of 0x8000000
|
||||
offset in AVR32 files) by a completely different logic that no
|
||||
longer breaks hex files for other devices starting with an
|
||||
offset; also apply a similar change to S-record files, as well
|
||||
as when writing files.
|
||||
fileio.c: (Ditto.)
|
||||
|
||||
2011-09-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrftdi.c: Remove stray printf()s by fprintf(stderr)
|
||||
* usbtiny.c: (Ditto.)
|
||||
|
||||
2011-09-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* main.c: Restrict the cyclecounter readout to those cases where
|
||||
it has been explicitly requested (by -y or -Y), rather than always
|
||||
attempting to read the last EEPROM bytes.
|
||||
|
||||
2011-09-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2.c (stk600_xprog_paged_load, stk600_xprog_paged_write):
|
||||
Fix regression in the AVRISPmkII/STK600 TPI handling introduced
|
||||
by the USBasp's TPI implementation which added a pagesize even for
|
||||
the minor memory regions of TPI devices. Also fix wrong offset
|
||||
introduced by the memory tagging patch.
|
||||
|
||||
2011-09-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avr.c (avr_read, avr_write): Don't bail out on TPI parts if
|
||||
their programmer doesn't provide a (low-level) cmd_tpi method;
|
||||
instead, fall back to the normal programmer methods which are
|
||||
supposed to handle the situation.
|
||||
This fixes a regression where the recent bitbang-TPI implementation
|
||||
broke TPI handling of STK600/AVRISPmkII.
|
||||
|
||||
2011-09-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Mega-commit to bring in memory tagging.
|
||||
Each memory image byte is now tagged as it's being read from a file.
|
||||
Only bytes read from a file will be written or verified (modulo page
|
||||
granularity requirements).
|
||||
* avrpart.h: Add memory tags.
|
||||
* avrpart.c: Allocate and initialize tag area.
|
||||
* update.h: Drop unused parameter "verify" from do_op().
|
||||
* pgm.h: Add parameter base_addr to the paged_load and paged_write
|
||||
methods, respectively.
|
||||
* avr.h: New parameter to avr_read: second AVRPART to verify against.
|
||||
* fileio.c: Track all memory regions that have been read from an
|
||||
input file by tagging them.
|
||||
* update.c: Call avr_read() with the new parameter list.
|
||||
* main.c: Call avr_initmem() to initialize the memory regions, rather
|
||||
than trying to duplicate an unitialized part, and then let the
|
||||
original part rot away.
|
||||
* avr.c: Implement the heart of the new featureset. For paged memory
|
||||
areas, when writing or verifying, call the paged_write and paged_load
|
||||
methods, respectively, once per page instead of on the entire memory.
|
||||
When writing, only write bytes or pages that have content read from a
|
||||
file. Whe verifying, only read memory bytes or pages where the
|
||||
verification data have been read from a file. Only verify those bytes
|
||||
that have been read from a file.
|
||||
* avrftdi.c: Implement the new API for paged_load and paged_write,
|
||||
respectively.
|
||||
* jtagmkII.c: (Ditto.)
|
||||
* butterfly.c: (Ditto.)
|
||||
* jtagmkI.c: (Ditto.)
|
||||
* avr910.c: (Ditto.)
|
||||
* stk500.c: (Ditto.)
|
||||
* usbasp.c: (Ditto.)
|
||||
* stk500v2.c: (Ditto.)
|
||||
* usbtiny.c: (Ditto.)
|
||||
|
||||
2011-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2.c (stk500v2_command): Treat warnings as errors rather than
|
||||
success.
|
||||
|
||||
2011-08-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #34027: avrdude AT90S1200 Problem (part 3 - documentation)
|
||||
* avrdude.1: Document the programmer type restrictions for AT90S1200
|
||||
devices.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2011-08-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #34027: avrdude AT90S1200 Problem (part 2 - stk500v2 and relatives)
|
||||
* stk500v2.c (stk500v2_initialize): For the AT90S1200, release
|
||||
/RESET for a moment before reinitializing, as this is required by
|
||||
its programming protocol.
|
||||
|
||||
2011-08-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: In AC_CHECK_LIB for libftdi, check for
|
||||
ftdi_usb_get_strings() rathern than ftdi_init(), as this is a more
|
||||
specific thing to search for in order to make sure getting a
|
||||
recent enough libftdi.
|
||||
|
||||
2011-08-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #34027: avrdude AT90S1200 Problem (part 1 - bitbang
|
||||
programmers)
|
||||
* config_gram.y: Introduce new keyword "is_at90s1200".
|
||||
* lexer.l: (Ditto.)
|
||||
* avrdude.conf.in: Applew new keyword to the AT90S1200 device.
|
||||
* avrpart.h: Introduce new flag AVRPART_IS_AT90S1200, reflecting
|
||||
the is_at90s1200 configuration keyword.
|
||||
* bitbang.c (bitbang_initialize): Replace existing test for
|
||||
AT90S1200 by AVRPART_IS_AT90S1200
|
||||
* avr.c (avr_write_byte_default): Avoid the pre-write reading for
|
||||
the AT90S1200, as this appears to sometimes corrupt the high byte
|
||||
by pre-programming the low byte just written into it.
|
||||
|
||||
2011-08-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Bump version for post-5.11.
|
||||
|
||||
2011-08-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Bump version for releasing AVRDUDE 5.11.
|
||||
|
||||
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.1: Update the list of supported AVR devices.
|
||||
* doc/avrdude.texi: (Ditto).
|
||||
|
||||
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: add -lusb as "other libraries" when checking
|
||||
for libftdi.
|
||||
|
||||
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Juergen Weigert:
|
||||
patch #7056: adding support for mikrokopter bootloader to butterfly
|
||||
* butterfly.c: Add some specific logic to handle the
|
||||
mikrokopter.de butterfly bootloader.
|
||||
* butterfly.h: Add one related function declaration.
|
||||
* config_gram.y: Add butterfly_mk keyword.
|
||||
* lexer.l: (Ditto.)
|
||||
* avrdude.conf.in: Add entry for butterfly_mk.
|
||||
|
||||
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Stefan Tomanek:
|
||||
patch #7542: add default_bitclock to configuration files
|
||||
* config.c: Add the new keyword and its handling.
|
||||
* config.h: (Ditto.)
|
||||
* config_gram.y: (Ditto.)
|
||||
* avrdude.conf.in: (Ditto.)
|
||||
* main.c: (Ditto.)
|
||||
* lexer.l: (Ditto.)
|
||||
* avrdude.1: Document the change.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Brett Hagman:
|
||||
patch #7603: wiring - programmer type for Wiring boards
|
||||
(based on STK500v2)
|
||||
* wiring.c: New file.
|
||||
* wiring.h: (Ditto.)
|
||||
* Makefile.am: Add new files.
|
||||
* stk500v2_private.h: Reorganize so some functions and struct
|
||||
pdata are globally known.
|
||||
* stk500v2.c: (Ditto.)
|
||||
* stk500v2.h: (Ditto.)
|
||||
* lexer.l: Add new programmer keywords.
|
||||
* config_gram.y: (Ditto.)
|
||||
* avrdude.conf.in: Add "wiring" programmer entry.
|
||||
* avrdude.1: Document the new programmer.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
* AUTHORS: Add Brett Hagman.
|
||||
|
||||
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by an anonymous contributor on the mailinglist:
|
||||
* avrdude.conf (jtagkey): Add a definition for the Amontec
|
||||
JTAGKey
|
||||
|
||||
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Juergen Weigert:
|
||||
bug #22720: avrdude-5.5 ignores buff settings in avrdude.conf
|
||||
(Note that the actual bug the subject is about has been fixed
|
||||
long ago.)
|
||||
* update.c (do_op): fix a diagnostic message
|
||||
* pgm.h: add exit_datahigh field
|
||||
* par.c: set and act upon the exit_datahigh field
|
||||
* avrdude.1: document the new -E options
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #33811: Parallel make fails
|
||||
* Makefile.am (BUILT_SOURCES): Add this macro.
|
||||
|
||||
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #33114: Segfault after setting the DWEN fuse with Dragon
|
||||
* jtagII.c (jtagmkII_getsync): Instead of exit()ing from
|
||||
deep within the tree when detecting the "need debugWIRE"
|
||||
situation, properly pass this up as a return code.
|
||||
* jtagII_private.h (JTAGII_GETSYNC_FAIL_GRACEFUL): New constant.
|
||||
* stk500v2.c (stk500v2_jtagmkII_open): Don't tell anything
|
||||
anymore when receiving a JTAGII_GETSYNC_FAIL_GRACEFUL from
|
||||
jtagmkII_getsync(); silently give up (all necessary has been
|
||||
said already).
|
||||
|
||||
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Reported by Jason Hecker:
|
||||
* usbasp.c (libusb_to_errno): Conditionalize some error codes
|
||||
that apparently are lacking on MinGW.
|
||||
|
||||
2011-08-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Fix warnings.
|
||||
* ser_avrdoper.c: add <stdlib.h> so exit() is declared.
|
||||
* usbtiny.c (usbtiny_open): provide an initializer to a
|
||||
"may be used uninitialized" variable (since GCC could not
|
||||
fully detect the logic behind).
|
||||
|
||||
2011-08-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Add a check for FreeBSD's libusb-1.0
|
||||
compatible library that is found in libusb.a/.so on
|
||||
FreeBSD 8+.
|
||||
|
||||
2011-08-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Doug Springer, based on work by
|
||||
Wolfgang Moser, Ville Voipio, Hannes Weisbach
|
||||
patch #7486: Patch to add FT2232C/D, FT2232H, FT4232H,
|
||||
usbvid, usbpid, usbdev for USB support - Based on #7062
|
||||
* avrftdi.c: New file.
|
||||
* avrftdi.h: (Ditto.)
|
||||
* configure.ac: Add check for libftdi.
|
||||
* config_gram.y: Add AVRFTDI and per-programmer USB string
|
||||
keywords.
|
||||
* lexer.l: (Ditto.)
|
||||
* avrdude.conf.in: Add avrftdi and 2232HIO programmers.
|
||||
* pgm.h: Add USB parameters.
|
||||
* Makefile.am: Add avrftdi.c and avrftdi.h.
|
||||
* AUTHORS: Mention the new authors.
|
||||
* avrdude.1: Document the changes.
|
||||
* doc/avrdude.texi: (Ditto.)
|
||||
|
||||
2011-08-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #29585: Fix license
|
||||
* doc/avrdude.texi: Add FDL as an option to the licensing
|
||||
statement, as the savannah administration would like it
|
||||
that way.
|
||||
|
||||
2011-08-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Darell Tan:
|
||||
patch #7244: TPI bitbang implementation
|
||||
* bitbang.c: Add TPI bitbang stuff.
|
||||
* bitbang.h: (Ditto.)
|
||||
* avr.c: (Ditto.)
|
||||
* avr.h: (Ditto.)
|
||||
* pgm.c: (Ditto.)
|
||||
* pgm.h: (Ditto.)
|
||||
* serbb_posix.c: Wire bitbang_cmd_tpi into the struct pgm.
|
||||
* serbb_win32.c: (Ditto.)
|
||||
* par.c: (Ditto.)
|
||||
* doc/avrdude.texi: Document the TPI bitbang support.
|
||||
|
||||
2011-08-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Grygoriy Fuchedzhy:
|
||||
bug #31779: Add support for addressing usbtinyisp with -P option
|
||||
* usbtiny.c (usbtiny_open): Add logic to distinguish multiple USBtinyISP
|
||||
programmers by their bus:device tuple.
|
||||
* doc/avrdude.texi: Document the new functionality.
|
||||
* avrdude.1: (Ditto.)
|
||||
|
||||
2011-08-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Timon Van Overveldt:
|
||||
bug #30268: Debugwire broken in avrdude-5.10
|
||||
* jtagmkII.c (jtagmkII_initialize): only try setting up a JTAG chain when
|
||||
the programmer is using JTAG.
|
||||
|
||||
2011-08-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #29636: AVRDude issues invalid CMD_CHECK_TARGET_CONNECTION
|
||||
on the AVRISP-MKII
|
||||
* stk500v2.c (stk500v2_program_enable): Rewrite the logic to
|
||||
explain ISP activation failures.
|
||||
* stk500v2_private.h: Fix the various STATUS_* constants;
|
||||
AVR069 and AVR079 disagreed in their values, even though they
|
||||
are apparently implementing the same logic behind.
|
||||
|
||||
2011-08-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #29650: Programming timeouts in ATmega128RFA1 are too slow
|
||||
* avrdude.conf.in (ATmega128RFA1): Bump write delay values for flash and
|
||||
EEPROM to 50 ms.
|
||||
|
||||
2011-08-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in (ATmega8515, ATmega8535, ATmega48, ATmega88, ATmega88P,
|
||||
ATtiny88, ATmega168, ATmega168P, ATmega328P): Bump delay value for STK500v2
|
||||
EEPROM write operation to 5, according to the respective XML files.
|
||||
|
||||
2011-08-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Darcy Houlahan:
|
||||
bug #29694: error in avrdude.conf for attiny84 eeprom
|
||||
* avrdude.conf.in (ATtiny84, ATtiny85): fix A7 bit in EEPROM write
|
||||
command.
|
||||
|
||||
2011-08-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Durant Gilles:
|
||||
* avrdude.conf.in (ATtiny4313): Fix flash addressing bits for manual ISP
|
||||
algorithm.
|
||||
|
||||
2011-08-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Philip:
|
||||
bug #31386: A "BUILD.svn" or similar "how to get started" doc would be helpful
|
||||
* BUILD-FROM-SVN: New file.
|
||||
|
||||
2011-08-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Nic Jones:
|
||||
bug #32539: [Documentation][Patch] Man page is misleading
|
||||
re: Dragon & PDI
|
||||
* doc/avrdude.texi: Update information about PDI connections
|
||||
on AVR Dragon
|
||||
|
||||
2011-08-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* usbasp.c: Add <stdint.h> so this actually compiles
|
||||
again.
|
||||
|
||||
2011-08-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Contributed by tixiv@gmx.net:
|
||||
bug #33345: File auto detection as binary doesn't open
|
||||
file in binary mode on Windows
|
||||
* fileio.c: Move the decision about opening files in
|
||||
binary mode until before the fopen() call.
|
||||
|
||||
2011-06-16 Thomas Fischl <tfischl@gmx.de>
|
||||
|
||||
* avrdude.conf.in: Fix part id of ATtiny9.
|
||||
|
||||
2011-05-28 Thomas Fischl <tfischl@gmx.de>
|
||||
|
||||
Based on patch #7440 commited by Slawomir Fraś:
|
||||
* usbasp.c: added TPI support for USBasp
|
||||
* usbasp.h: (Ditto.)
|
||||
|
||||
2011-05-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in: Add support for ATmega168P.
|
||||
|
||||
2011-05-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in: Fix abbreviated name for ATmega324PA.
|
||||
|
||||
2011-05-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Lech Perczak:
|
||||
bug #30946: Added support for ATmega8/16/32U2
|
||||
* avrdude.conf.in: Add ATmega8/16/32U2 entries.
|
||||
|
||||
2011-05-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by David A Lyons:
|
||||
patch #7393: Adding ATtiny4313 Device to avrdude.conf.in
|
||||
* avrdude.conf.in: Add ATtiny4313 data.
|
||||
|
||||
2011-05-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* usb_libusb.c: Bump timeout values to allow for slow clock
|
||||
speeds.
|
||||
* jtagmkII.c: (Ditto.)
|
||||
|
||||
2011-03-04 Eric B. Weddington <eric.weddington@atmel.com>
|
||||
|
||||
Thanks to Vitaly Chernookiy for the patch.
|
||||
* avrdude.conf.in: Add support for atmega324pa.
|
||||
* ChangeLog-2010: New file, rotate ChangeLog for new year.
|
||||
729
ChangeLog-2012
729
ChangeLog-2012
@@ -1,729 +0,0 @@
|
||||
2012-12-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* usbdefs.h (USBDEV_BULK_EP_WRITE_STK600)
|
||||
(USBDEV_BULK_EP_READ_STK600): new define values
|
||||
* stk500v2.c (stk600_open): use the STK600 EP values,
|
||||
as they are different from AVRISPmkII
|
||||
|
||||
2012-12-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #37942: Latest SVN can't program in dragon_jtag mode
|
||||
* jtagmkII.c (jtagmkII_initialize): For Xmega devices, and
|
||||
firmware >= 7.x, don't trigger a RESET, in order to work around a
|
||||
firmware bug that appears to be present in at least firmware 7.24
|
||||
for the Dragon.
|
||||
|
||||
2012-12-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* config_gram.y: Implement the "ocdrev" keyword
|
||||
* avrpart.c: (Dito)
|
||||
* avrpart.h: (Dito)
|
||||
* lexer.l: (Dito)
|
||||
* avrdude.conf.in: Add "ocdrev" key/value pairs, based
|
||||
on the AS6 XML file information.
|
||||
* jtag3.c: Use the ocdrev in the parameter block.
|
||||
|
||||
2012-12-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtag3.c: Make jtag3_command() public
|
||||
* jtag3.h: (Dito.)
|
||||
* jtag3_private.h: Add two new commands
|
||||
* stk500v2.c: Implement the "MonCon disable" hack that
|
||||
allows temporarily falling back to ISP when trying to
|
||||
talk to a part that has debugWIRE enabled
|
||||
|
||||
2012-12-03 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* pickit2.c: reordered #includes for non-usb configuration
|
||||
|
||||
2012-12-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtag3.c: Enable interactive adjustment of the various
|
||||
clock frequencies (JTAG Xmega, JTAG megaAVR, PDI Xmega)
|
||||
through the set_sck_period() callback.
|
||||
|
||||
2012-12-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtag3.c: Remove unused code that was left over from
|
||||
cloning the jtagmkII.c implementation
|
||||
|
||||
2012-12-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* pgm_type.c: Add "jtagice3_isp" programmer hook
|
||||
* avrdude.conf.in: Add "jtag3isp" programmer
|
||||
* jtag3.c: jtag3_setparm() is now public
|
||||
* jtag3.h: (Dito)
|
||||
* stk500v2_private.h: Command 0x1D is CMD_SPI_MULTI only
|
||||
for STK500v2, AVRISPmkII, and JTAGICEmkII; for JTAGICE3,
|
||||
it's CMD_SET_SCK now; also add CMD_GET_SCK
|
||||
* avrpart.c (avr_get_output_index): New function
|
||||
* avrpart.h: (Dito)
|
||||
* stk500v2.c: Implement the pasthrough programmer glue logic
|
||||
for JTAGICE3 in ISP mode
|
||||
* stk500v2.h: (Dito)
|
||||
* avrdude.1: Document the JTAGICE3 support.
|
||||
|
||||
2012-11-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtag3.c (jtag3_read_byte, jtag3_write_byte): Remove the
|
||||
m->offset from addr, JTAGICE3 doesn't need it anymore (similar
|
||||
to JTAGICEmkII with 7+ firmware)
|
||||
* jtag3.c (jtag3_read_byte): Allow for full-page reads of
|
||||
EEPROM also for Xmega and debugWIRE, allow for signature
|
||||
read in debugWIRE
|
||||
|
||||
2012-11-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtag3_private.h: Add two more error detail codes I stumbled
|
||||
across during development
|
||||
* jtag3.c: (Dito.)
|
||||
* usb_libusb.c: Reduce timeouts from 100 to 10 s, still long
|
||||
enough, but not getting cold feet when something goes wrong.
|
||||
|
||||
2012-11-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtag3.c: Handle events returned by the ICE
|
||||
* usbdevs.h: Add defines that mark an event in return
|
||||
from usb_recv_frame().
|
||||
* usb_libusb.c: (Dito.)
|
||||
|
||||
2012-11-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in: Remove "has_jtag" from Xmega A4 and D4
|
||||
devices, as they only have PDI.
|
||||
* jtag3.c (jtag3_page_erase): Actually implement this.
|
||||
|
||||
2012-11-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #37265: wrong page sizes for XMega64xx in avrdude.conf
|
||||
* avrdude.conf.in: Fix page sizes for all Xmega devices,
|
||||
by cross-checking against Atmel Studio's device XML files
|
||||
|
||||
2012-11-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtag3.c: Fill in the missing pieces for Xmega support (both,
|
||||
PDI and JTAG).
|
||||
* jtagmkII.c (jtagmkII_set_xmega_params): Use "fuse1" rather
|
||||
than "fuse0" memory space to fill in the NVM offset from, as
|
||||
there is no "fuse0" on some Xmega devices.
|
||||
|
||||
2012-11-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in (ATmega256RFR2, ATmega128RFR2, ATmega64RFR2):
|
||||
New devices
|
||||
|
||||
2012-11-28 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
First support for Atmel JTAGICE3. Guessed from USB sniffer
|
||||
traces made by Knut Schwichtenberg, and by similarity to
|
||||
JTAGICEmkII.
|
||||
Still quite incomplete, just megaAVR/JTAG is done by now.
|
||||
* jtag3.c: New file.
|
||||
* jtag3.h: (Dito.)
|
||||
* jtag3_private.h: (Dito.)
|
||||
* pgm_type.c: Add new programmers
|
||||
* avrdude.conf.in: (Dito.)
|
||||
* usbdevs.h: Add new parameters
|
||||
* Makefile.am: Add new files
|
||||
* usb_libusb.c: Handle separate event endpoint, and larger
|
||||
(USB 2.0) packet sizes
|
||||
|
||||
2012-11-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtagmkII.c: Change all the USB details (endpoint numbers,
|
||||
max transfer size etc.) to a per-programmer adjustable value.
|
||||
* serial.h: (Dito.)
|
||||
* stk500v2.c: (Dito.)
|
||||
* usbdevs.h: (Dito.)
|
||||
* usb_libusb.c: (Dito.)
|
||||
|
||||
2012-11-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* buspirate.c: Replace outdated FSF postal address by a reference to
|
||||
the GPL info on their website.
|
||||
* jtagmkII.c: (Dito.)
|
||||
* avrftdi.c: (Dito.)
|
||||
* wiring.c: (Dito.)
|
||||
* linux_ppdev.h: (Dito.)
|
||||
* serbb.h: (Dito.)
|
||||
* usbtiny.h: (Dito.)
|
||||
* confwin.c: (Dito.)
|
||||
* buspirate.h: (Dito.)
|
||||
* avrftdi.h: (Dito.)
|
||||
* wiring.h: (Dito.)
|
||||
* jtagmkII.h: (Dito.)
|
||||
* pickit2.c: (Dito.)
|
||||
* config.c: (Dito.)
|
||||
* term.c: (Dito.)
|
||||
* confwin.h: (Dito.)
|
||||
* avrdude.1: (Dito.)
|
||||
* windows/Makefile.am: (Dito.)
|
||||
* config.h: (Dito.)
|
||||
* pickit2.h: (Dito.)
|
||||
* term.h: (Dito.)
|
||||
* tools/get-hv-params.xsl: (Dito.)
|
||||
* tools/get-stk600-cards.xsl: (Dito.)
|
||||
* tools/get-stk600-devices.xsl: (Dito.)
|
||||
* tools/get-dw-params.xsl: (Dito.)
|
||||
* butterfly.c: (Dito.)
|
||||
* configure.ac: (Dito.)
|
||||
* doc/Makefile.am: (Dito.)
|
||||
* pgm_type.c: (Dito.)
|
||||
* butterfly.h: (Dito.)
|
||||
* jtagmkI.c: (Dito.)
|
||||
* ft245r.c: (Dito.)
|
||||
* COPYING: (Dito.)
|
||||
* pgm_type.h: (Dito.)
|
||||
* jtagmkI.h: (Dito.)
|
||||
* pindefs.h: (Dito.)
|
||||
* config_gram.y: (Dito.)
|
||||
* arduino.c: (Dito.)
|
||||
* arduino.h: (Dito.)
|
||||
* ser_win32.c: (Dito.)
|
||||
* serbb_win32.c: (Dito.)
|
||||
* avr910.c: (Dito.)
|
||||
* stk500.c: (Dito.)
|
||||
* freebsd_ppi.h: (Dito.)
|
||||
* avr910.h: (Dito.)
|
||||
* solaris_ecpp.h: (Dito.)
|
||||
* stk500.h: (Dito.)
|
||||
* jtagmkII_private.h: (Dito.)
|
||||
* avrdude.h: (Dito.)
|
||||
* bitbang.c: (Dito.)
|
||||
* bitbang.h: (Dito.)
|
||||
* avrpart.c: (Dito.)
|
||||
* safemode.c: (Dito.)
|
||||
* stk500generic.c: (Dito.)
|
||||
* serial.h: (Dito.)
|
||||
* avrpart.h: (Dito.)
|
||||
* jtagmkI_private.h: (Dito.)
|
||||
* ppi.c: (Dito.)
|
||||
* avr.c: (Dito.)
|
||||
* safemode.h: (Dito.)
|
||||
* stk500generic.h: (Dito.)
|
||||
* ser_avrdoper.c: (Dito.)
|
||||
* avr.h: (Dito.)
|
||||
* ppi.h: (Dito.)
|
||||
* usbasp.c: (Dito.)
|
||||
* lists.c: (Dito.)
|
||||
* stk500v2.c: (Dito.)
|
||||
* my_ddk_hidsdi.h: (Dito.)
|
||||
* tpi.h: (Dito.)
|
||||
* usbasp.h: (Dito.)
|
||||
* lists.h: (Dito.)
|
||||
* stk500v2.h: (Dito.)
|
||||
* ppiwin.c: (Dito.)
|
||||
* fileio.c: (Dito.)
|
||||
* ser_posix.c: (Dito.)
|
||||
* fileio.h: (Dito.)
|
||||
* serbb_posix.c: (Dito.)
|
||||
* usbdevs.h: (Dito.)
|
||||
* par.c: (Dito.)
|
||||
* update.c: (Dito.)
|
||||
* pgm.c: (Dito.)
|
||||
* main.c: (Dito.)
|
||||
* par.h: (Dito.)
|
||||
* update.h: (Dito.)
|
||||
* lexer.l: (Dito.)
|
||||
* Makefile.am: (Dito.)
|
||||
* pgm.h: (Dito.)
|
||||
* usb_libusb.c: (Dito.)
|
||||
* usbtiny.c: (Dito.)
|
||||
|
||||
2012-11-13 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #35186 inverting pins with "~" doesn't work for pin lists (i.e. vcc)
|
||||
bug #37727 Add support for LM3S811 dev board as a programmer
|
||||
* lexer.l,config_gram.y: accepting inverted pins at pin lists
|
||||
syntax: ~num or ~(num,num,...)
|
||||
* par.c: par_set_many_bits is now usable with inverted pins
|
||||
* avrftdi.c: fixed wrong index in ftdi_pin_name
|
||||
* avrdude.conf.in: added programmer lm3s811
|
||||
|
||||
2012-11-04 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* lexer.l,config_gram.y,config.[hc]: changed reading of numbers to integers
|
||||
except of default_bitclock which is the only real number.
|
||||
No signs are allowed as negative values do not make sense for current
|
||||
config values.
|
||||
* buspirate.c: include own header file buspirate.h
|
||||
* doc/.cvsignore: add programmers.texi to ignore list
|
||||
|
||||
2012-09-06 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* doc/Makefile.am: add EXTRA_DIST, replace $(srcdir) by
|
||||
$(builddir) for generated files, so "make distcheck"
|
||||
works again
|
||||
|
||||
2012-09-05 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* doc/Makefile.am: add $(srcdir) to name of generated files, so BSD make
|
||||
find the files ( GNU make sees no difference if the
|
||||
file is called version.texi or ./version.texi )
|
||||
|
||||
2012-08-15 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7184 Support for PICKit2 programmer
|
||||
* Makefile.am: add pickit2 files
|
||||
* pickit2.[ch]: new programmer implementation
|
||||
* pgm_type.c: add pickit to list
|
||||
* avrdude.1: documentation for pickit2
|
||||
* doc/avrdude.texi: documentation for pickit2
|
||||
* avrdude.conf.in: add pickit2 programmer entry
|
||||
|
||||
2012-08-15 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #30559 Ft232 bit-bang support, see comment #30
|
||||
* ft245r.c: added semaphore workaround for MacOS X,
|
||||
added pthread_testcancel in reader thread
|
||||
|
||||
* configure.ac: added check for TYPE_232H in libftdi (not in libftdi < 0.20)
|
||||
* avrftdi.c: do not use TYPE_232H if not declared
|
||||
|
||||
2012-08-13 Hannes Weisbach <hannes_weisbach@gmx.net>
|
||||
|
||||
* avrftdi.c: fixes pin_limit for different FTDI devices (there was a mixup
|
||||
between 2232C and 2232H)
|
||||
|
||||
2012-07-29 Hannes Weisbach <hannes_weisbach@gmx.net>
|
||||
|
||||
* avrftdi.c: bugfixes (synchronisation) and maintenance (paged programming,
|
||||
nicer output, separation of parameter checking and actual code)
|
||||
|
||||
2012-07-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtagmkII.c (jtagmkII_memtype): return MTYPE_FLASH rather than
|
||||
MTYPE_SPM for non-Xmega flash regions
|
||||
|
||||
2012-07-20 Hannes Weisbach <hannes_weisbach@gmx.net>
|
||||
|
||||
* avrpart.c, avrpart.h: adds avr_pin_name()
|
||||
|
||||
2012-07-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: check for libelf.h also in libelf/
|
||||
* fileio.c: include <libelf/libelf.h> if configure found this
|
||||
to be the case
|
||||
|
||||
2012-06-13 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* configure.ac: Check for presence of <pthread.h>
|
||||
* ft245r.c: Depend on HAVE_PTHREAD_H
|
||||
* Makefile.am: Add -lpthread if needed.
|
||||
|
||||
2012-06-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* usbtiny.c (usbtiny_paged_load, usbtiny_paged_write):
|
||||
fix breakage introduced by the recent page handling reorg;
|
||||
it used to cause an infinite loop
|
||||
|
||||
2012-05-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Xmega page erase implementation for XPROG (AVRISPmkII, STK600)
|
||||
* stk500v2.c (stk600_xprog_page_erase): New function.
|
||||
|
||||
2012-05-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Xmega page erase implementation for JTAGICEmkII
|
||||
* jtagmkII.c: Handle flash pages sizes > 256 bytes, implement
|
||||
page_erase() method
|
||||
* avrdude.conf.in: Change flash pagesize for all Xmega devices
|
||||
to 512 bytes
|
||||
* avr.c: Implement auto_erase, using page_erase if available
|
||||
* avr.h: Remove unused parameters from avr_read(), replace
|
||||
unused parameter in avr_write)() by auto_erase
|
||||
* stk500v2.c: Handle flash page sizes > 256 bytes
|
||||
* update.c (do_op): Handle new updateflags parameter
|
||||
* main.c: Implement auto_erase as page_erase if possible
|
||||
* update.h (enum updateflags): New enum
|
||||
* pgm.h (struct programmer_t): Add page_erase method
|
||||
|
||||
2012-04-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtagmkII.c (jtagmkII_paged_load, jtagmkII_paged_write): fix bug
|
||||
in memory type calculation for Xmega "boot" memory region.
|
||||
|
||||
2012-04-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* update.c (parse_op): do not assume default memtype here
|
||||
* main.c: after locating the part information, determine default
|
||||
memtype for all update options that didn't have a memtype
|
||||
specified; this is "application" for Xmega parts, and "flash" for
|
||||
everything else.
|
||||
|
||||
2012-04-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* fileio.c: Rework the way ELF file sections are considered: while
|
||||
scanning the program header table, the offsets from a program
|
||||
header entry must never be used directly when checking the bounds
|
||||
of the current AVR memory region. Instead, they must always be
|
||||
checked based on the corresponding section's entry. That way,
|
||||
Xmega devices now properly take into account whether the segment
|
||||
fits into any of the application/apptable/boot memory region.
|
||||
|
||||
2012-04-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #30756: When setting SUT to 64ms on XMEGA, avrdude doesn't
|
||||
read device signature
|
||||
* main.c: When reading the signature yields 0x000000 or 0xffffff,
|
||||
retry (up to twice) after some progressive delay.
|
||||
|
||||
2012-04-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in (ATxmega16D4, ATxmega32D4, ATxmega64D4,
|
||||
ATxmega128D4): New devices. As Xmega D doesn't feature a fuse0
|
||||
memory cell, move that one out from the generic .xmega part into
|
||||
the individual Xmega A parts.
|
||||
|
||||
2012-04-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #29019: pagel/bs2 warning when uploading using stk500 to xmega
|
||||
* stk500.c (stk500_initialize): Insert dummy values for PAGEL and
|
||||
BS2 if they are not present in the config file, in order to be able
|
||||
to proceed with the stk500_set_extended_parms() anyway.
|
||||
|
||||
2012-04-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2_private.h (struct pdata): add boot_start
|
||||
* stk500v2.c: For the "flash" pseudo-memory of Xmega devices,
|
||||
distinguish addresses between "application" and "boot" area.
|
||||
|
||||
2012-04-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* fileio.c (elf2b): When checking the bounds of the current
|
||||
program header segment, subtract `low' from ph[n].p_paddr in order
|
||||
to correct the magic section offsets for the AVR's non-flash
|
||||
memory regions.
|
||||
|
||||
2012-04-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* fileio.c (elf_get_scn): Rather than trying to just match whether
|
||||
any given section maps straight to a program header segment, use a
|
||||
more sophisticated decision that matches any section as long as it
|
||||
fits into the segment. This is needed for situations where the
|
||||
program header segment spans a larger area than the section data
|
||||
provided. (This can e.g. happen in an ELF file that contains no
|
||||
data at address 0, like a bootloader only.)
|
||||
|
||||
2012-04-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #28744: Can't load bootloader to xmega128a1 (part 2, fix for
|
||||
firmware >= V7.x)
|
||||
* jtagmkII.c: Add firmware-version dependent handling of Xmega parameters.
|
||||
V7.x firmware expects the NVM offsets being specified through the Xmega
|
||||
parameters command, but left out as part of the memory address itself.
|
||||
* jtagmkII_private.h: Add CMND_SET_XMEGA_PARAMS, and struct xmega_device_desc.
|
||||
* config_gram.y: Add mcu_base keyword.
|
||||
* avrpart.h: (Dito.)
|
||||
* lexer.l: (Dito.)
|
||||
* avrdude.conf.in (.xmega): add mcu_base, and data memory segment.
|
||||
|
||||
2012-03-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #28744: Can't load bootloader to xmega128a1 (part 1, fix for
|
||||
firmware < V7.x)
|
||||
* jtagmkII.c: When going to write to the boot section of flash,
|
||||
use MTYPE_BOOT_FLASH rather than MTYPE_FLASH
|
||||
* jtagmkII_private.h: add MTYPE_BOOT_FLASH constant
|
||||
|
||||
2012-03-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtagmkII_private.h: Sort commands, response codes and events
|
||||
into numerical order.
|
||||
|
||||
2012-03-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #30451: Accessing some Xmega memory sections gives not
|
||||
supported error
|
||||
* stk500v2.c: Handle all Xmega memory sections (except
|
||||
"prodsig" which is not documented in AVR079)
|
||||
* fileio.c: Treat the "boot", "application", and "apptable"
|
||||
regions (which are actually subregions of "flash") all as
|
||||
being flash, i.e. suppress trailing 0xFF bytes when reading
|
||||
them
|
||||
* avr.c: (Dito.)
|
||||
|
||||
2012-03-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtagmkII.c (jtagmkII_close): The GO command before signing off
|
||||
turned out to be not required for normal megaAVR devices, and to
|
||||
cause the exact opposite (i.e. the target stopping) on Xmega
|
||||
devices being programmed to JTAG. However, programming Xmega
|
||||
devcies through PDI *does* need the GO command.
|
||||
|
||||
2012-03-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Print a configuration summary at the end of the
|
||||
configure run
|
||||
|
||||
2012-02-11 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7718: Merge global data of avrftdi in a private data structure
|
||||
* avrftdi.[ch]: moved global data into private data structure, moved
|
||||
private defines from header file into source file
|
||||
|
||||
2012-02-06 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7720 Bug in EEPROM write
|
||||
* avrftdi.c: fixed wrong buffer address initialization in paged_write
|
||||
* fileio.c: added #include <stdint.h>
|
||||
|
||||
2012-02-05 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #30559 Ft232 bit-bang support
|
||||
* ft245r.c: cancel reader thread before exiting program
|
||||
|
||||
2012-02-04 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7717 avrftdi_flash_write is broken
|
||||
* avrftdi.c: fixed wrong buffer address initialization in paged_write
|
||||
bug #35296 Extraneous newlines in output.
|
||||
* main.c: fixed output of newlines at 100% progress
|
||||
|
||||
2012-02-03 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7715 FT4232H support
|
||||
* avrdude.conf.in: added programmer 4232h
|
||||
|
||||
2012-02-03 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7687: Autogenerating programmers and parts lists for docs
|
||||
(generating the programmers lists)
|
||||
* doc/avrdude.texi: Add include of generated table of programmers
|
||||
* doc/Makefile.am: Add generating of table of programmers in programmers.texi
|
||||
|
||||
2012-02-03 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #34768 Proposition: Change the name of the AVR32 devices
|
||||
* avrdude.conf.in: renamed ucr2 to uc3a0512
|
||||
* avrpart.c: added cast to avoid compiler warning
|
||||
|
||||
2012-02-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* fileio.c (fileio_elf): Fix a copy'n-paste-o.
|
||||
|
||||
2012-02-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* par.c (par_desc): Move to end of file, outside the #if
|
||||
HAVE_PARPORT
|
||||
|
||||
2012-02-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Implement ELF file reading (finally). Requires libelf(3) to be
|
||||
present on the host system.
|
||||
* configure.ac (HAVE_LIBELF): Add logic to detect presence of
|
||||
libelf(3)
|
||||
* Makefile.am (avrdude_LDADD): Add @LIBELF@
|
||||
* fileio.h (FILEFMT): add FMT_ELF
|
||||
* fileio.c: Implement ELF file reader.
|
||||
* update.c (parse_op): add 'e' format specifier
|
||||
* avrdude.1: Document the ELF file reading capability
|
||||
* doc/avrdude.texi: (Dito.)
|
||||
|
||||
2012-02-01 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #30559 Ft232 bit-bang support
|
||||
* ft245r.[ch]: new programmer type implementation
|
||||
* configure.ac: add pthread as link library
|
||||
* avrdude.conf.in: added some new programmers
|
||||
* Makefile.am: added new source files to compile
|
||||
* pindefs.h: change PIN_MASK, PIN_INVERSE to highest bit of unsigned int
|
||||
* pgm.[ch]: added generic function to print pin assignments (taken from par.c)
|
||||
* par.c: moved pin assigment print function to pgm.c
|
||||
|
||||
2012-02-01 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* lexer.l: Sort keyword tokens into alphabetic order.
|
||||
|
||||
2012-01-31 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* config_gram.y, lexer.l: removed unused ID/TKN_ID definitions
|
||||
* config.[hc]: removed unused function id(), use value.type to select
|
||||
values
|
||||
|
||||
2012-01-31 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7437 modifications to Bus Pirate module
|
||||
patch #7686 Updating buspirate ascii mode to current firmware, use AUX
|
||||
as clock generator, and setting of serial receive timeout
|
||||
* buspirate.c: added paged_write, changed binary mode setup/detection,
|
||||
added clock output on AUX pin
|
||||
* avrdude.1: updated documentation
|
||||
* doc/avrdude.texi: updated documentation
|
||||
|
||||
2012-01-31 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
Parser does not need to know all programmer types now, new programmers
|
||||
will update only the table in pgm_type.c.
|
||||
* config_gram.y, lexer.l: removed programmer type keywords,
|
||||
use now locate_programmer_type() function
|
||||
* pgm_type.[ch]: added new files for table of programmer types
|
||||
* main.c: allow list of programmer types by -c ?type
|
||||
* avrdude.conf.in: changed all type keywords to quoted strings
|
||||
* doc/avrdude.texi: changed description of type definition, list
|
||||
of valid types is now included from generated file
|
||||
* doc/Makefile.am: generate list of programmer types for doc
|
||||
* all programmers [hc]: add xxx_desc string for description of programmer
|
||||
|
||||
2012-01-30 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* configure.ac: fixed detection of yylex_destroy availability
|
||||
by checking the version number of flex; bump required autoconf
|
||||
version to 2.60 (for AC_PROG_SED)
|
||||
|
||||
2012-01-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* lexer.l: Replace the old, now-defunct #define YY_NO_UNPUT by
|
||||
the new %option nounput. This gets rid of a compiler warning.
|
||||
|
||||
2012-01-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Add a connection_type attribute to each programmer, rather than
|
||||
trying to hard-code the default port name in main.c.
|
||||
* pgm.h: Add conntype to struct pgm.
|
||||
* lexer.l: Extend grammar for connection_type.
|
||||
* config_gram.y: (Dito.)
|
||||
* config.h: Add DEFAULT_USB, for symmetry with default_parallel
|
||||
and default_serial.
|
||||
* main.c: Replace old default portname hack by avrdude.conf-based
|
||||
knowledge.
|
||||
* usbtiny.c: Drop an old hack that's no longer necessary.
|
||||
* avrdude.conf.in: Add connection_type to each programmer
|
||||
definition.
|
||||
|
||||
2012-01-27 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* avrdude.conf.in: used parent parts for some other parts, added
|
||||
abstract .xmega part as parent for xmegas
|
||||
* main.c: hide parts starting with '.' from parts list
|
||||
|
||||
2012-01-22 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7688: Implement parent programmers feature
|
||||
* avrdude.conf.in: updated documentation comment and some programmers
|
||||
have now parents
|
||||
* config_gram.y: initpgm will now called at first use of programmer
|
||||
in main. parser sets only the function pointer in the pgm structure.
|
||||
Pin and pin lists definitions can now be empty to remove the parents
|
||||
setting.
|
||||
* doc/avrdude.texi: updated documentation
|
||||
* main.c: added call to pgm->initpgm after locate_programmer
|
||||
* pgm.[hc]: added field initpgm in structure, added function pgm_dup
|
||||
|
||||
2012-01-21 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #21797: AT90PWM316: New part description
|
||||
* avrdude.conf.in: added pwm316 with parent pwm3b but 16KB flash
|
||||
|
||||
2012-01-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Check for presence of lusb_usb.h as an alternative
|
||||
to usb.h; libusb-win32 switched to this name in version 1.2.5.0.
|
||||
* avrftdi.c: Decide whether to include <usb.h>, or <lusb0_usb.h>.
|
||||
* ser_avrdoper.c: (Dito.)
|
||||
* usbasp.c: (Dito.)
|
||||
* usb_libusb.c: (Dito.)
|
||||
* usbtiny.c: (Dito.)
|
||||
|
||||
2012-01-19 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* avr.c: Unsigned variable was used for return code of paged_write/load
|
||||
functions. So a negative return code led never to a fallback to byte
|
||||
functions.
|
||||
|
||||
2012-01-17 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #34302: Feature request : device configuration with parent classes
|
||||
* config_gram.y: if memory section is overwritten old entry is removed
|
||||
|
||||
(not in original patch)
|
||||
* config_gram.y: if programmer or part is defined twice, a warning is
|
||||
output and the first instance is removed
|
||||
|
||||
General cleanup and free functions, so valgrind does not report any lost
|
||||
blocks at program end.
|
||||
* avrpart.[hc]: added avr_free_(opcode|mem|part) functions
|
||||
* pgm.[hc]: added pgm_free function
|
||||
* update.[hc]: added free_update functions
|
||||
* config.[hc]: added cleanup_config function, use yylex_destroy to reset
|
||||
the lexer after usage. (So it can be reused.)
|
||||
* main.c: add cleanup_main function which is called by atexit() (This
|
||||
frees all lists so that at program exit only really lost memory is
|
||||
reported by valgrind.)
|
||||
* usbasp.c: added libusb_free_device_list() and libusb_exit() calls to
|
||||
avoid lost memory
|
||||
* buspirate.c: moved memory allocation from initpgm to setup and added
|
||||
free in teardown
|
||||
* configure.ac: add definition of HAVE_YYLEX_DESTROY if $LEX is flex.
|
||||
* Makefile.am: added . in front of SUBDIRS to build avrdude before trying
|
||||
to use it for creating the part list for the docs.
|
||||
|
||||
2012-01-17 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* usbasp.c: USB vid/pid/vendor/product from config file are used, for
|
||||
id "usbasp" nibobee and old usbasp are tried as they were currently
|
||||
implemented within usbasp
|
||||
* avrdude.conf.in: added usb params to "usbasp", added new entry "nibobee"
|
||||
with params which were hardcoded in usbasp.c, and added an entry
|
||||
"usbasb-clone" which only checks vid/pid.
|
||||
|
||||
2012-01-10 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #35261 avrftdi uses wrong interface in avrftdi_paged_(write|load)
|
||||
* avrftdi.c: Fixed interface and implementation of avrftdi_paged_(write|load)
|
||||
patch #7672 adding support for O-Link (FTDI based JTAG) as programmer
|
||||
* avrdude.conf.in: added o-link entry
|
||||
|
||||
2012-01-10 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7699 Read additional config files
|
||||
* main.c: Added reading of additional config files
|
||||
* avrdude.1: updated man page
|
||||
* doc/avrdude.texi: updated documentation
|
||||
|
||||
2012-01-10 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Bob Frazier:
|
||||
bug #35208: avrdude 5.11 on freebsd 8.2-STABLE does not reset
|
||||
Arduino Uno properly
|
||||
* arduino.c (arduino_open): Bump the timeout between pulling
|
||||
the DTR and RTS lines low and high.
|
||||
|
||||
2012-01-08 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
Fixed following findings reported by cppcheck
|
||||
* avr910.c:625 (error) Possible null pointer dereference: cmd - otherwise it is redundant to check if cmd is null at line 624
|
||||
* avr910.c:626 (error) Possible null pointer dereference: cmd - otherwise it is redundant to check if cmd is null at line 624
|
||||
* avr910.c:168 (information) The scope of the variable 'devtype_1st' can be reduced
|
||||
* avr910.c:169 (information) The scope of the variable 'dev_supported' can be reduced
|
||||
* avrftdi.c:647 (error) Using sizeof for array given as function argument returns the size of pointer.
|
||||
* stk500v2.c:3347 (error) Memory leak: b
|
||||
* stk500v2.c:3452 (error) Memory leak: b
|
||||
* usbasp.c:554 (error) Using sizeof for array given as function argument returns the size of pointer.
|
||||
* usbasp.c:485 (information) The scope of the variable 'dly' can be reduced
|
||||
|
||||
2012-01-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Reported by Jason Kotzin:
|
||||
* usbasp.c (usbasp_spi_paged_load, usbasp_spi_paged_write):
|
||||
Fix buffer address calculation.
|
||||
|
||||
2012-01-03 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7629 add support for atmega48p
|
||||
* avrdude.conf.in: Added m48p with parent m48 + different signature
|
||||
|
||||
* avrdude.conf.in: made part parents (m88p = m88 + different signature,
|
||||
m168p = m168 + different signature)
|
||||
|
||||
2012-01-02 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #21663 AT90PWM efuse incorrect
|
||||
bug #30438 efuse bits written as 0 on at90pwmxx parts
|
||||
* avrdude.conf.in: (pwm2, pwm2b, pwm3, pwm3b) <efuse.write>: Write
|
||||
eight bits
|
||||
|
||||
* avrdude.conf.in: made part parents (pwm3 = pwm2, pwm3b = pwm2b,
|
||||
pwm2b = pwm2 + different signature)
|
||||
|
||||
* ChangeLog-2011: New file, rotate ChangeLog for new year.
|
||||
618
ChangeLog-2013
618
ChangeLog-2013
@@ -1,618 +0,0 @@
|
||||
2013-12-15 Nils Springob <nils@nicai-systems.de>
|
||||
|
||||
* pgm.c/pgm.h: fixed syntax error in const pointer to const
|
||||
|
||||
2013-12-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: bump version to 6.1-svn-20131205
|
||||
|
||||
2013-12-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #40817: Elf file support (possibly) not working on 6.0.1 windows build
|
||||
* fileio.c (fileio): open file in binary mode also for FMT_ELF
|
||||
|
||||
2013-12-04 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
Rework of bitbanging functions setpin, getpin, highpulsepin to make simplier use
|
||||
of new pindefs data in pgm structure
|
||||
* linuxgpio.c, bitbang.c, buspirate.c, par.c, pgm.h, term.c, serbb_*.c: changed
|
||||
interface of setpin, getpin, highpulsepin to take pin function as parameter
|
||||
(not the real number, which can be found by pgm->pinno[function])
|
||||
|
||||
2013-11-30 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #40748 linuxgpio doesn't work on Raspberry PI rev. 2.
|
||||
* linuxgpio.c: fixed check for unused pins to ignore the inverse flag
|
||||
* pindefs.c: fixed fill_old_pinlist to not create an empty mask with inverse flag set
|
||||
|
||||
2013-10-18 Nils Springob <nils@nicai-systems.de>
|
||||
|
||||
* avrdude.conf.in (atmega1284): ATmega1284 variant added (same as ATmega1284p but with different signature)
|
||||
|
||||
2013-09-25 Hannes Weisbach <hannes_weisbach@gmx.net>
|
||||
|
||||
First part of patch #7720:
|
||||
* avrdude.conf.in: Add UM232H and C232H programmers
|
||||
|
||||
2013-09-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Daniel Rozsnyo:
|
||||
bug #40085: Typo fix in fuses report (for 6.1-svn-20130917)
|
||||
* main.c: Fix a typo.
|
||||
|
||||
2013-09-19 Hannes Weisbach <hannes_weisbach@gmx.net>
|
||||
|
||||
task #12798: Please cleanup #ifdef notyet entries in avrftdi.c
|
||||
* avrftdi.c: ditto.
|
||||
avrftdi.c: Remove DRYRUN-option.
|
||||
|
||||
2013-09-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #40055: AVRDUDE segfaults when writing eeprom
|
||||
* main.c: Always clear the UF_AUTO_ERASE flag if either a
|
||||
non-Xmega device was found, or the programmer does not offer a
|
||||
page_erase method.
|
||||
|
||||
2013-09-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version to post-6.0.
|
||||
|
||||
2013-09-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version to 6.0.
|
||||
|
||||
2013-09-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtag3.c (jtag3_initialize): Fix a buffer overflow by limiting
|
||||
the flash page cache size to at most "readsize". For Xmegas with
|
||||
a page size of 512 bytes, the maximum USB packet size was
|
||||
overflowed, and subsequently, a memmove copied beyond the end of
|
||||
the allocated buffer.
|
||||
* jtag3.c (jtag3_read_byte): Add the correct offset also for the
|
||||
various flash regions, so reading the apptable or boot regions
|
||||
yields the correct data.
|
||||
|
||||
2013-09-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Joakim Lubeck:
|
||||
bug #40040: Support for ATtiny20 and ATtiny40
|
||||
* avrdude.conf.in: Restructure the reduced-core tiny devices
|
||||
to use a common entry .reduced_core_tiny; add ATtiny20 and
|
||||
ATtiny40
|
||||
|
||||
2013-09-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Joakim Lubeck:
|
||||
bug #40033: Support for the XMegaE5 family
|
||||
* avrdude.conf.in (ATxmega8E5, ATxmega16E5, ATxmega32E5): New
|
||||
entries.
|
||||
|
||||
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2.c (stk500v2_set_sck_period): Revamp this to match the
|
||||
description/pseudo-code in appnote AVR068.
|
||||
|
||||
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Stephen Roe:
|
||||
patch #7710: usb_libusb: Check VID/PID before opening device
|
||||
* usb_libusb.c (usbdev_open): Swap the sequence of verifying the
|
||||
VID:PID, and opening the device.
|
||||
|
||||
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
patch #8176: butterfly.c (AVR109 protocol implementation) clean-up and bug-fixing
|
||||
* butterfly.c (butterfly_page_erase): Add dummy function to avoid
|
||||
segfault when writing to EEPROM.
|
||||
|
||||
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #35474 Feature request: print fuse values in safemode output
|
||||
* config_gram.y: New configuration token "default_safemode".
|
||||
* lexer.l: (Dito.)
|
||||
* avrdude.conf.in: (Dito.)
|
||||
* config.h: Add variable default_safemode.
|
||||
* config.c: (Dito.)
|
||||
* main.c: Handle default_safemode, including -u option.
|
||||
* avrdude.1: Document all this.
|
||||
* doc/avrdude.texi: (Dito.)
|
||||
|
||||
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by HubertB:
|
||||
patch #7657 Add ATmega406 support for avrdude using DRAGON + JTAG
|
||||
* avrdude.conf.in (ATmega406): New entry.
|
||||
|
||||
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Marc de Hoop:
|
||||
patch #7606 ATtiny43u support
|
||||
* avrdude.conf.in (ATtiny43U): New entry.
|
||||
|
||||
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
patch #5708 avrdude should make 10 synchronization attempts instead of just one
|
||||
* stk500.c (stk500_getsync): Loop 10 times trying to get in
|
||||
sync with the programmer.
|
||||
|
||||
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Contributed by Ricardo Martins:
|
||||
bug #36384 ATxmega32A4 usersig size
|
||||
* avrdude.conf.in: Revamp all the ATxmega* entries. Add new
|
||||
entries for ATxmega128A1U, ATxmega128A3U, ATxmega128A4U,
|
||||
ATxmega128B1, ATxmega128B3, ATxmega128C3, ATxmega128D3,
|
||||
ATxmega16A4U, ATxmega16C4, ATxmega192A3U, ATxmega192C3,
|
||||
ATxmega192D3, ATxmega256A3BU, ATxmega256A3U, ATxmega256C3,
|
||||
ATxmega256D3, ATxmega32A4U, ATxmega32C4, ATxmega384C3,
|
||||
ATxmega384D3, ATxmega64A1U, ATxmega64A3U, ATxmega64A4U,
|
||||
ATxmega64B1, ATxmega64B3, ATxmega64C3, ATxmega64D3
|
||||
|
||||
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #35456 The progress bar for STK500V2 programmer is "wrong".
|
||||
* avr.c (avr_read, avr_write): Change the progress reporting for
|
||||
paged read/write from per-address to per-considered-page. This
|
||||
ought to give a realistic estimation about the time still to be
|
||||
spent.
|
||||
|
||||
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #34277: avrdude reads wrong byte order if using avr911 (aka butterfly)
|
||||
* butterfly.c (butterfly_read_byte_flash): Swap bytes received.
|
||||
|
||||
2013-09-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #37768 Poll usbtiny 100 times at init time to handle low-clock devices
|
||||
* doc/avrdude.texi: Add a FAQ entry about how to connect to a
|
||||
target where the firmware has reduced the internal clock speed.
|
||||
|
||||
2013-09-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #28344 chip_erase_delay too short for ATmega324P, 644, 644P, and 1284P
|
||||
* avrdude.conf: Bump the chip_erase_delay for all ATmega*4 devices
|
||||
to 55 ms. While the datasheet still claims 9 ms, all the XML files
|
||||
tell either 45 or 55 ms, depending on STK600 or not.
|
||||
|
||||
2013-09-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* fileio.c (fileio): Don't exit(1) if something goes wrong; return
|
||||
-1 instead. Don't refer to obsolete option -f to specify the file
|
||||
format.
|
||||
|
||||
2013-09-10 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Matthias Trute:
|
||||
bug #36901 flashing Atmega32U4 EEPROM produces garbage on chip
|
||||
* avrdude.conf.in (ATmega32U4): Fix EEPROM pagesize to 4, the
|
||||
datasheet is wrong here.
|
||||
|
||||
2013-09-09 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: check for ar and ranlib in the target tool
|
||||
namespace, rather than on the host.
|
||||
|
||||
2013-09-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Fix byte-wise EEPROM and flash writes on Xmega
|
||||
* jtagmkII_private.h (MTYPE_EEPROM_XMEGA): New memory type.
|
||||
* jtagmkII.c (jtagmkII_write_byte): For Xmega EEPROM, use
|
||||
memory type MTYPE_EEPROM_XMEGA; for flash writes, always
|
||||
write 2 bytes starting on an even address.
|
||||
|
||||
2013-09-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* term.c: Implement the "verbose" terminal mode command.
|
||||
* avrdude.1: Document this.
|
||||
* doc/avrdude.texi: (Dito.)
|
||||
|
||||
2013-09-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtag3.c (jtag3_write_byte): Do not attempt to start the paged
|
||||
algorithm for EEPROM when being connected through debugWIRE.
|
||||
|
||||
2013-09-06 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Extend the single-byte algorithm to all devices, both flash and
|
||||
EEPROM. (Flash cells must have been erased before though.)
|
||||
* jtag3.c (jtag3_initialize): OCDEN no longer needs to be
|
||||
considered; a session with "programming" purpose is sufficient
|
||||
* jtag3.c (jtag3_write_byte): Use the paged algorithm for all
|
||||
flash and EEPROM areas, not just Xmega.
|
||||
|
||||
2013-09-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Fix single-byte EEPROM updates on Xmega:
|
||||
* jtag3_private.h (MTYPE_EEPROM_XMEGA): New define.
|
||||
* jtag3.c (jtag3_write_byte): When updating flash or
|
||||
EEPROM on Xmega devices, resort to jtag3_paged_write()
|
||||
after filling and modifying the page cache.
|
||||
* jtag3.c (jtag3_paged_write): use MTYPE_EEPROM_XMEGA
|
||||
where appropriate.
|
||||
* jtag3.c (jtag3_initialize): Open with debugging intent
|
||||
for Xmega devices, so single-byte EEPROM updates will
|
||||
work.
|
||||
|
||||
2013-09-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Matthias Neeracher:
|
||||
bug #38732: Support for ATtiny1634
|
||||
* avrdude.conf.in (ATtiny1634): New entry.
|
||||
|
||||
2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Brane Ždralo:
|
||||
patch #7769: Write flash fails for AVR910 programmers
|
||||
* avr910.c (avr910_paged_write): Fix flash addresses in
|
||||
'A' command.
|
||||
|
||||
2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Fred (magister):
|
||||
bug #38951: AVR109 use byte offset instead of word offset
|
||||
patch #8045: AVR109 butterfly failing
|
||||
* butterfly.c (butterfly_paged_load, butterfly_paged_write):
|
||||
fix calculation of 'A' address when operating on flash memory.
|
||||
It must be given in terms of 16-bit words rather than bytes.
|
||||
|
||||
2013-09-03 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* avrftdi.c, avrftdi_private.h: added tx buffer size, and use
|
||||
smaller block sizes as larger sometimes hang
|
||||
|
||||
2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.h: Remove the erase cycle counter (options -y / -Y).
|
||||
* avr.c: (Dito.)
|
||||
* main.c: (Dito.)
|
||||
* avrdude.1: Undocument -y / -Y.
|
||||
* doc/avrdude.texi: (Dito.)
|
||||
|
||||
2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #39691 Buffer overrun when reading EEPROM byte with JTAGICE3
|
||||
* jtag3.c (jtag3_initialize): initialize the eeprom_pagesize
|
||||
private attribute so the page cache will actually be usable
|
||||
|
||||
2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #38580 Current svn head, xmega and fuses, all fuses tied to fuse0
|
||||
* jtag3.c (jtag3_read_byte, jtag3_write_byte): Correctly apply the
|
||||
relevant part of mem->offset as the address to operate on.
|
||||
|
||||
2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* fileio.c: Fix "unused variable" warnings.
|
||||
* avr.c: (Dito.)
|
||||
* stk500v2.c: (Dito.)
|
||||
* stk500.c: (Dito.)
|
||||
* jtagmkII.c: (Dito.)
|
||||
* term.c: (Dito.)
|
||||
* ser_posix.c: (Dito.)
|
||||
|
||||
2013-09-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Travis Griggs:
|
||||
bug #38307: Can't write usersig of an xmega256a3
|
||||
* stk500v2.c (stk600_xprog_page_erase): allow erasing the usersig space.
|
||||
|
||||
2013-09-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Robert Niemi:
|
||||
bug #35800: Compilation error on certain systems if parport is disabled
|
||||
* linux_ppdev.h: Conditionalize inclusion of <linux/parport.h> and
|
||||
<linux/ppdev.h> on HAVE_PARPORT
|
||||
|
||||
2013-09-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #39794: warnings when building avrdude 6.0rc1 under CentOS 6.4
|
||||
* pickit.c (usb_open_device): Use %p rather than %X to print "handle"
|
||||
which is a pointer
|
||||
* jtag3.c (jtag3_initialize): Initialize "flashsize" to be sure it
|
||||
proceeds with a valid value.
|
||||
|
||||
2013-09-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #39794: warnings when building avrdude 6.0rc1 under CentOS 6.4
|
||||
* buspirate.c: Turn the "cmd" argument of the various methods into
|
||||
a "const unsigned char *"; while doing this, declare all arrays being
|
||||
passed as arguments to be pointers rather than arrays, as the latter
|
||||
obfuscates the way arrays are being passed to a callee in C.
|
||||
* avrftdi.c: (Dito.)
|
||||
* pickit2.c: (Dito.)
|
||||
* ft245r.c: (Dito.)
|
||||
* avr910.c: (Dito.)
|
||||
* stk500.c: (Dito.)
|
||||
* bitbang.c: (Dito.)
|
||||
* bitbang.h: (Dito.)
|
||||
* avrftdi_tpi.c: (Dito.)
|
||||
* avrftdi_tpi.h: (Dito.)
|
||||
* usbasp.c: (Dito.)
|
||||
* stk500v2.c: (Dito.)
|
||||
* pgm.h: (Dito.)
|
||||
* usbtiny.c: (Dito.)
|
||||
|
||||
2013-09-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #38023: avrdude doesn't return an error code when attempting
|
||||
to upload an invalid Intel HEX file
|
||||
* fileio.c (ihex2b): Turn the "No end of file record found" warning
|
||||
into an error if no valid record was found at all.
|
||||
|
||||
2013-09-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Claus-Justus Heine:
|
||||
bug #38713: Compilation of the documentation breaks with texinfo-5
|
||||
* doc/avrdude.texi: Turn @itemx into @item, add @headitem to STK600
|
||||
Routing/Socket card table
|
||||
|
||||
2013-09-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* usbasp.c: Add trace output for -vvv to non-TPI functions, too.
|
||||
|
||||
2013-09-01 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* usbasp.c (usbasp_tpi_paged_load): Calculate correct
|
||||
buffer address.
|
||||
* usbasp.c (usbasp_tpi_paged_write): Calculate correct
|
||||
buffer address; don't issue a SECTION_ERASE command for
|
||||
each page (a CHIP_ERASE has been done before anyway);
|
||||
remove the code that attempted to handle partial page
|
||||
writes, as all writes are now done with a full page.
|
||||
|
||||
2013-09-01 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* usbasp.c: Add more trace output, by now only for the TPI
|
||||
functions.
|
||||
|
||||
2013-08-31 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* usbasp.c (usbasp_transmit): Add -vvvv trace output.
|
||||
|
||||
2013-08-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #39893: Verification failure with AVRISPmkII and Xmega
|
||||
* stk500v2.c (stk600_xprog_page_erase): Fix argument that is
|
||||
passed to stk600_xprog_memtype()
|
||||
|
||||
2013-07-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* fileio.c (elf2b): replace elf_getshstrndx() by
|
||||
elf_getshdrstrndx() as the former one is deprecated
|
||||
|
||||
2013-06-19 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
use bitbanging on ftdi mpsse when wrong pins are used
|
||||
* avrftdi.c, avrftdi_private.h: added additional pin check
|
||||
and bitbanging fallback
|
||||
* pindefs.[ch]: added a flag to enable/disable output
|
||||
* ft245r.c: changes because of added flag above
|
||||
|
||||
2013-05-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by "Malte" and John McCorquodale:
|
||||
patch #7876 JTAGICE mkII fails to connect to attiny if debugwire
|
||||
is enabled AND target has a very slow clock
|
||||
* jtagmkII.c (jtagmkII_getsync): When leaving debugWIRE mode
|
||||
temporarily, immediately retry with ISP, rather than leaving.
|
||||
* stk500v2 (stk500v2_program_enable): Implemented similar logic
|
||||
for the JTAGICE3.
|
||||
|
||||
2013-05-16 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* configure.ac: reactivate check for TYPE_232H, which does not
|
||||
exist in libftdi < 0.20
|
||||
* avrftdi*.*: changed include check for libftdi/libusb, deactivate
|
||||
232H if not available
|
||||
* ft245r.c: changed include check for libftdi/libusb
|
||||
|
||||
2013-05-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* main.c (main): Add option -l logfile.
|
||||
* avrdude.1: Document -l option.
|
||||
* doc/avrdude.texi: (Dito.)
|
||||
|
||||
2013-05-15 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* configure.ac: if both found libftdi and libftdi1 use only libftdi1
|
||||
* avrdude.conf.in: fixed buff pins of avrftdi programmers (low
|
||||
active buffer need now inverted numbers)
|
||||
* avrftdi*.*: accept also old libftdi (0.20 still works with it),
|
||||
added powerup to initialize
|
||||
* ft245r.c: accept libftdi1, code cleanup and make it more similar
|
||||
to avrfdti (os they might be merged someday)
|
||||
|
||||
2013-05-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version to 6.0rc1.
|
||||
|
||||
2013-05-07 Hannes Weisbach <hannes_weisbach@gmx.net>
|
||||
|
||||
* avrftdi_private.h: Change size of pin_checklist to N_PINS (from N_PINS-1)
|
||||
* avrftdi.c: Adapt code to new size of pin_checklist. Remove pins_check()
|
||||
from set_pin().
|
||||
Add pgm->power[up|down] functions as well as fill pgm->enable|disable with
|
||||
proper content as suggested by Rene Liebscher.
|
||||
|
||||
2013-05-05 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* pindefs.h: use unsigned int if stdint.h is not available and UINT_MAX is 0xffffffff
|
||||
otherwise use unsinged long
|
||||
* ft245r.c: added support for more pin functions led, vcc, buff
|
||||
|
||||
2013-05-06 Hannes Weisbach <hannes_weisbach@gmx.net>
|
||||
|
||||
* avrftdi_tpi.c: instead of private set_pin() function pointer use the one
|
||||
declared in struct PROGRAMMER.
|
||||
* avrftdi_private.h: remove set_pin function pointer. Add pin_checklist_t
|
||||
member to check pgm->setpin calls during runtime.
|
||||
* avrftdi.c: remove set_pin function pointer init, add pgm->setpin init.
|
||||
Convert avrftdi to new 0-based pindefs infrastructure.
|
||||
* avrdude.conf.in: Change all avrftdi-based programmers' pin definitions to
|
||||
0-based.
|
||||
|
||||
2013-05-06 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* pindefs.h: Include "ac_cfg.h" before testing for HAVE_* macros.
|
||||
|
||||
2013-05-05 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* main.c: revert to rev 1159 (doing pgm_display after pgm_open)
|
||||
* avrpart.[ch]: moved avr_pin_name to pindefs.[ch]
|
||||
* pgm.c: moved pins_to_str to pindefs.[ch], added initialization of
|
||||
new pin definitions in pgm_new()
|
||||
* pindefs.[ch]: added moved functions from other files, added a lot of
|
||||
documentation, reformatted files using astyle to have consistent spacing,
|
||||
added a new generic check function for pins
|
||||
* ft245r.c: used new generic pin check function
|
||||
|
||||
2013-05-03 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
Create new pin definition data structures to support 0-based pin numbers,
|
||||
and mixed inverse/non-inverse pin lists.
|
||||
* avrftdi.c,buspirate.c,linuxgpio.c,par.c,serbb_*.c: added function call
|
||||
to fill old pinno entries from new pin definitions.
|
||||
* pindefs.[hc]: added data struct and helper functions for new pin definitions
|
||||
* avrdude.conf.in: pins in entries using ftdi_syncbb are now 0-based
|
||||
* config_gram.y: allow combinations of inverted and non-inverted pins in pin lists
|
||||
* ft245r.c: reworked to work directly with the new pin definitions,
|
||||
pins are now 0-based, inverse pins are supported, buff is supported
|
||||
* pgm.[ch]: added new pin definitions field to programmer structure,
|
||||
adapted pin display functions
|
||||
|
||||
2013-05-03 Hannes Weisbach <hannes_weisbach@gmx.net>
|
||||
|
||||
* avrftdi_private.h: Remove update forward declaration from avrftdi_print to
|
||||
avrftdi_log.
|
||||
* avrftdi_tpi.c: Do all I/O in terms of pgm->cmd_tpi()-calls instead of
|
||||
avrftdi_tpi_[read,write]_byte().
|
||||
Remove unnecessary set_pin call to set MOSI high, speeds up I/O.
|
||||
Removes SKEY array, moves it to tpi.h.
|
||||
Integrate new avr_tpi_[program_enable,chip_erase]() and functions into
|
||||
avrftdi_tpi.
|
||||
* avrftdi_tpi.h: Remove avrftdi_tpi_[program_enable,chip_erase] forward
|
||||
declarations.
|
||||
* avr.c: Adds avr_tpi_chip_erase() generic TPI chip erase function.
|
||||
Adds avr_tpi_program_enable() - generic TPI external programming enable
|
||||
function. Sets guard time, reads identification register, sends SKEY command
|
||||
and key, checks NVMEN bit. The required guard time has to be passed as
|
||||
parameter.
|
||||
* tpi.h: Adds SKEY array including CMD_SKEY in "correct" order.
|
||||
|
||||
2013-05-02 Hannes Weisbach <hannes_weisbach@gmx.net>
|
||||
|
||||
* avrftdi_private.h: Add libusb-1.0 include to fix include order in windows.
|
||||
* NEWS: Add notice avrftdi supporting TPI
|
||||
* avr.c: Fix avr_tpi_poll_nvmbsy() - poll read data instead of return code
|
||||
* avrftdi_private.h, avrftdi.c: move logging #defines to from avrftdi.c to
|
||||
avrftdi_private.h, so that they are available for avrftdi_tpi, too.
|
||||
|
||||
2013-04-30 Hannes Weisbach <hannes_weisbach@gmx.net>
|
||||
|
||||
* tpi.h: Add definition for TPI Identification Code
|
||||
* avrftdi_tpi.c: Add TPI-support for FTDI-based programmers
|
||||
* avrftdi_private.h: Add common include file for FTDI-based programmers
|
||||
|
||||
2013-04-28 Hannes Weisbach <hannes_weisbach@gmx.net>
|
||||
|
||||
* avrftdic: Rework of textual output. Messages are divided by severity and
|
||||
printed accordingly to the verbosity, as specified by the user. The provided
|
||||
severity level are (ERROR, WARN, INFO, DEBUG, TRACE). Where "ERROR" messages
|
||||
are always printed. Shortcut-macros including function, from which the
|
||||
output was generated, and line number were also added.
|
||||
Some log messages were updated and other code warnings removed.
|
||||
|
||||
2013-04-27 Hannes Weisbach <hannes_weisbach@gmx.net>
|
||||
|
||||
* configure.ac: Add libftdi1 library check, remove TYPE_232H DECL check
|
||||
* Makefile.am: Add @LIBFTDI1@ to avrdude_LDADD
|
||||
* avrftdi.c: Update from libftdi0 to libftdi1. Use libftdi1's function to
|
||||
find a device by vid/pid/serial instead of doing it ourself and add/update
|
||||
error messages. avrftdi_print is changed so that a message is printed when
|
||||
the verbosity level is greater or equal the message level, to have always-on
|
||||
messages.
|
||||
Fix a bug where the RX fifo of the FTDI chip is full, resulting in STALL/NAK
|
||||
of the ongoing OUT request and subsequently timeout, because an IN request
|
||||
cannot be issued due to the synchronous part of libftdi. This should fix
|
||||
#38831 and #38659.
|
||||
|
||||
2013-04-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac(AC_CONFIG_HEADERS): Replace the old AM_CONFIG_HEADER
|
||||
by this; automake 1.13+ barfs.
|
||||
|
||||
2013-03-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in (ATmega2564RFR2, ATmega1284RFR2, ATmega644RFR2):
|
||||
New devices
|
||||
|
||||
2013-01-30 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7724 Add TPI support for Bus Pirate using bitbang mode
|
||||
* buspirate.[ch]: added support for BusPirate Bitbanging
|
||||
* pgm_type.c: added entry for buspirate_bb
|
||||
* avrdude.conf.in: added entry for buspirate_bb
|
||||
|
||||
2013-01-30 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7936 Patch to support BusPirate AVR Extended Commands mode
|
||||
* buspirate.c: added support for BusPirate AVR Extended Commands mode
|
||||
* avrdude.1: added doc for nopagedread parameter
|
||||
* doc/avrdude.texi: added doc for nopagedread parameter
|
||||
|
||||
2013-01-30 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7723 Bus Pirate “raw-wire” mode which can run down to 5 kHz
|
||||
* buspirate.c: added raw wire mode
|
||||
* avrdude.1: added doc for rawfreq parameter
|
||||
* doc/avrdude.texi: added doc for rawfreq parameter
|
||||
|
||||
2013-01-30 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #37977 Support for Openmoko Debug Board
|
||||
* avrdude.conf.in: added openmoko entry
|
||||
|
||||
2013-01-29 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7932 Read USBtiny VID and PID from avrdude.conf if provided.
|
||||
* avrdude.conf.in: added usbpid, usbvid to usbtiny
|
||||
* usbtiny.[ch]: use usbpid, usbpid if provided in config file
|
||||
|
||||
2013-01-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #38172: avrftdi: Incorrect information in avrdude.conf
|
||||
* avrdude.conf.in (avrftdi): fix comments about ACBUS vs. ADBUS;
|
||||
add a comment that the MPSSE signals are fixed by the FTDI
|
||||
hardware and cannot be changed
|
||||
|
||||
2013-01-09 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7165 Add support for bitbanging GPIO lines using the Linux sysf GPIO interface
|
||||
* doc/avrdude.texi,avrdude.1: added doc for linuxgpio
|
||||
* avrdude.conf.in: added template for linuxgpio programmer
|
||||
* config_gram.y: pin numbers restricted to [PIN_MIN, PIN_MAX]
|
||||
* pindefs.h: added PIN_MIN, PIN_MAX, removed unused LED_ON/OFF
|
||||
* configure.ac: configure option enable-linuxgpio, print of enabled options
|
||||
* linuxgpio.[ch]: new source for linuxgpio programmer
|
||||
* Makefile.am: added linuxgpio to sources list
|
||||
* pgm_type.c: added linuxgpio to programmer types list
|
||||
|
||||
2013-01-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtagmkI.c (jtagmkI_prmsg): replace a putchar() by putc(...stderr)
|
||||
* jtagmkII.c (jtagmkII_prmsg): (Dito.)
|
||||
* jtag3.c (jtag3_prevent, jtag3_prmsg): (Dito.)
|
||||
|
||||
2013-01-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* usb_libusb.c (usbdev_open): Downgrade the max transfer size for
|
||||
the main data endpoints when being forced so by the USB; this can
|
||||
happen when attaching the JTAGICE3 to a USB 1.1 connection
|
||||
* jtag3.c (jtag3_initialize): When detecting a downgraded max
|
||||
transfer size on the JTAGICE3 (presumably, due to being connected
|
||||
to USB 1.1 only), bail out as its firmware cannot properly handle
|
||||
this (by now)
|
||||
|
||||
2013-01-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* ChangeLog: annual ChangeLog rotation time
|
||||
697
ChangeLog-2014
697
ChangeLog-2014
@@ -1,697 +0,0 @@
|
||||
2014-11-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* ser_win32.c (net_send): Properly declare argument 2 as being a
|
||||
pointer to const data.
|
||||
|
||||
2014-11-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
patch #8380: adds 500k 1M 2M baud to ser_posix.c
|
||||
* ser_posix.c: Add a hack to allow for arbitrary baud rates on
|
||||
Linux
|
||||
|
||||
2014-11-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
patch #8437: [PATCH] Serial-over-ethernet for Win32
|
||||
* configure.ac: Check for ws2_32 library
|
||||
* ser_win32.c: Add hooks for forwarding serial data over
|
||||
TCP connections
|
||||
* avrdude.1: Drop previous restriction of -P net:
|
||||
* doc/avrdude.conf: (Dito.)
|
||||
|
||||
2014-11-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #42908: no external reset at JTAGICE3
|
||||
* jtag3.c (jtag3_initialize): Retry with external reset applied if
|
||||
the first sign-on attempt fails.
|
||||
|
||||
2014-11-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* main.c: Allow the -B option argument to be suffixed with Hz,
|
||||
kHz, or MHz, in order to specify a bitclock frequency rather than
|
||||
period.
|
||||
* avrdude.1: Document the -B option changes.
|
||||
* doc/avrdude.texi: (Dito.)
|
||||
|
||||
2014-11-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #40870: config nitpick: ATtiny25/45/85 have 1 calibration byte not 2
|
||||
* avrdude.conf.in (ATtiny25, ATtiny45, ATtiny85): Fix size of
|
||||
"calibration" memory area
|
||||
|
||||
2014-11-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #43137: Writing and reading incorrect pages when using jtagicemkI
|
||||
* jtagmkI.c (jtagmkI_paged_write, jtagmkI_paged_load): correctly
|
||||
calculate the size of a partial (non-pagesize) buffer
|
||||
|
||||
2014-11-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #43078: AVRDUDE crashes after sucessfully reading/writing eeprom
|
||||
* jtag3.c (jtag3_edbg_recv_frame): Return correct length as
|
||||
reported in the response packet, rather than full 512 byte which
|
||||
are always reported by the CMSIS-DAP layer. Miscalculations
|
||||
based on the wrongly reported length caused heap corruption
|
||||
elsewhere, so this is presumably also a fix for bug #43078.
|
||||
|
||||
2014-11-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #41561: AVRDUDE 6.0.1/USBasp doesn't write first bytes of
|
||||
flash page
|
||||
* usbasp.c (usbasp_spi_paged_write): Remove USBASP_BLOCKFLAG_LAST.
|
||||
It is no longer needed, as we always write full pages now in paged
|
||||
write mode.
|
||||
|
||||
2014-11-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #43626: Inconsistent timeouts in stk500v2
|
||||
* stk500v2.c (stk500v2_recv): Add a reference to the bug report
|
||||
but don't change anything, lest to break it somehow
|
||||
|
||||
2014-11-14 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #8529 2 more ftdi_syncbb devices
|
||||
* avrdude.conf.in: added 2 new programmers
|
||||
|
||||
2014-11-14 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #40142 Floating point exception on Ubuntu 10.04
|
||||
* avr.c: avoid division by zero in report_progress(), eg. when
|
||||
writing an empty eeprom file were total becomes 0
|
||||
|
||||
2014-11-13 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #8504 buspirate: Also support "cpufreq" extended parameter
|
||||
in binary mode
|
||||
* buspirate.c: applied patch + switch off at disable (even when
|
||||
a reset follows) + some general whitespace/tab cleanup
|
||||
|
||||
2014-10-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #37441: lockbits in ATxmega + avrdude = problem
|
||||
* fileio.c: replace strmcp(..., "lock") by strncmp(..., "lock", 4)
|
||||
where applicable
|
||||
* jtag3.c: (Dito.)
|
||||
* jtagmkII.c: (Dito.)
|
||||
|
||||
2014-10-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #42267: jtag3isp fails to read lock and fuse bytes directly
|
||||
after changing lock byte
|
||||
* stk500v2.c (stk500isp_write_byte): As a workaround for broken
|
||||
tool firmware, add 10 ms of delay before returning from any
|
||||
single-byte write operation.
|
||||
|
||||
2014-10-06 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500v2.c: Use stk500isp_read_byte/stk500isp_write_byte for
|
||||
every byte-wide access (rather than JTAGICE3 only). This finally
|
||||
obsoletes the use of the prehistoric SPI_MULTI command where
|
||||
AVRDUDE used to assemble all the low-level ISP stuff by itself.
|
||||
|
||||
2014-10-06 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #22248: Read efuse error
|
||||
* avrdude.conf.in (m168, m328, m48, m88, t1634, t26, t261, t461,
|
||||
t861, t88): In efuse (or hfuse for t26) read operation, turn all
|
||||
bits in byte 3 from "x" to "o" (output); this is a first step
|
||||
towards fixing the symptoms mentioned in the bug, by unifying the
|
||||
behaviour between different AVRs. Not touched are the historic
|
||||
devices where the fuses are not documented to form a full byte
|
||||
each (2333, 4433, 4434, 8535, m103, m161, m163).
|
||||
|
||||
2014-09-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #43268: usb_drain() call causes LUFA AVR-ISP MKII Code to Fail
|
||||
* usb_libusb.c (usbdev_drain): Make this a dummy function only.
|
||||
|
||||
2014-08-19 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #7694 Add support for the atmega32m1
|
||||
* avrdude.conf.in: added ATmega32M1
|
||||
|
||||
2014-08-18 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #8440 Print part id after signature
|
||||
When printing the part signature also print the part id.
|
||||
* avrpart.c (locate_part_by_signature): New function.
|
||||
* libavrdude.h (locate_part_by_signature): New function.
|
||||
* main.c (main): Use the new function to find the part and print its id.
|
||||
|
||||
2014-08-18 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #8511 Fix reset on FT245R
|
||||
* ft245r.c: applied patch
|
||||
|
||||
2014-08-18 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #43002 usbasp debug output typo
|
||||
* usbasp.c: fixed typos
|
||||
|
||||
2014-07-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #42662 clang warnings under FreeBSD 10.x
|
||||
* avrftdi.h: Fix header guard macro name.
|
||||
* pgm_type.c (programmers_types): Remove duplicate "const".
|
||||
|
||||
2014-07-16 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #42662 clang warnings under FreeBSD 10.x
|
||||
* avrftdi.c: remove warnings
|
||||
* buspirate.c: (Dito.)
|
||||
* dfu.c: (Dito.)
|
||||
* fileio.c: (Dito.)
|
||||
* libavrdude.h: (Dito.)
|
||||
* pickit2.c: (Dito.)
|
||||
* safemode.c: (Dito.)
|
||||
* ser_avrdoper.c: (Dito.)
|
||||
* ser_posix.c: (Dito.)
|
||||
* ser_win32.c: (Dito.)
|
||||
* stk500v2.c: (Dito.)
|
||||
* usb_libusb.c: (Dito.)
|
||||
* usbasp.c: (Dito.)
|
||||
|
||||
* config_gram.y: fix problem when using parent part with usbpid lists
|
||||
(existing list was extended not overwritten)
|
||||
|
||||
2014-07-11 Axel Wachtler <axel@uracoli.de>
|
||||
|
||||
* avrftdi.c: rollback to vfprintf, fixed error from -r1305, (patch #8463)
|
||||
|
||||
2014-06-23 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* linux_ppdev.h: added missing msg level for avrdude_message
|
||||
in ppi_claim/ppi_release macros
|
||||
* avrftdi.c: added break at end of default
|
||||
|
||||
2014-06-21 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
patch #8419 fix ftdi_syncbb hang with libftdi 1
|
||||
* ft245r.c: set pthread cancel type to asynchronous, reorder ftdi_usb_close/deinit
|
||||
|
||||
2014-06-17 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
* avrftdi_private.h: added missing msg level for avrdude_message
|
||||
in E/E_VOID macros
|
||||
|
||||
2014-06-17 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
Removing exit calls from config parser
|
||||
* config.h: cleanup, left only internally needed definitions
|
||||
* config.c: removed exit calls, use yyerror and yywarning
|
||||
* config_gram.y: (Dito.)
|
||||
* lexer.l: (Dito.)
|
||||
* libavrdude.h: removed internal definitions of config parser
|
||||
* main.c: removed yyerror, it is now in config.c
|
||||
* jtagmkII.c: added missing free in error case
|
||||
* pgm.c: replaced exits by returns
|
||||
* pickit2.c: add missing return
|
||||
|
||||
2014-06-13 Axel Wachtler <axel@uracoli.de>
|
||||
|
||||
start removing global "verbose" variable, for avrdude library.
|
||||
* arduino.c: added verbose level in avrdude_message()
|
||||
* avr910.c: (Dito.)
|
||||
* avr.c: (Dito.)
|
||||
* avrdude.h: (Dito.)
|
||||
* avrftdi.c: (Dito.)
|
||||
* avrpart.c: (Dito.)
|
||||
* bitbang.c: (Dito.)
|
||||
* buspirate.c: (Dito.)
|
||||
* butterfly.c: (Dito.)
|
||||
* config.c: (Dito.)
|
||||
* config_gram.y: (Dito.)
|
||||
* dfu.c: (Dito.)
|
||||
* fileio.c: (Dito.)
|
||||
* flip1.c: (Dito.)
|
||||
* flip2.c: (Dito.)
|
||||
* ft245r.c: (Dito.)
|
||||
* jtag3.c: (Dito.)
|
||||
* jtagmkI.c: (Dito.)
|
||||
* jtagmkII.c: (Dito.)
|
||||
* lexer.l: (Dito.)
|
||||
* libavrdude.h: (Dito.)
|
||||
* linuxgpio.c: (Dito.)
|
||||
* main.c: (Dito.)
|
||||
* par.c: (Dito.)
|
||||
* pgm.c: (Dito.)
|
||||
* pickit2.c: (Dito.)
|
||||
* pindefs.c: (Dito.)
|
||||
* ppi.c: (Dito.)
|
||||
* ppiwin.c: (Dito.)
|
||||
* safemode.c: (Dito.)
|
||||
* ser_avrdoper.c: (Dito.)
|
||||
* serbb_posix.c: (Dito.)
|
||||
* serbb_win32.c: (Dito.)
|
||||
* ser_posix.c: (Dito.)
|
||||
* ser_win32.c: (Dito.)
|
||||
* stk500.c: (Dito.)
|
||||
* stk500generic.c: (Dito.)
|
||||
* stk500v2.c: (Dito.)
|
||||
* term.c: (Dito.)
|
||||
* update.c: (Dito.)
|
||||
* usbasp.c: (Dito.)
|
||||
* usb_libusb.c: (Dito.)
|
||||
* usbtiny.c: (Dito.)
|
||||
* wiring.c: (Dito.)
|
||||
|
||||
2014-06-11 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #42516 spelling-error-in-binary
|
||||
* stk500v2.c, avrftdi.c, usbasp.c: fixed spelling errors
|
||||
|
||||
2014-06-01 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #42337 avrdude.conf updates for UM232H/CM232H
|
||||
* avrdude.conf.in: fixed entries as proposed
|
||||
|
||||
2014-05-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #41854: avrdude 6.1 does not compile on systems without libUSB
|
||||
Submitted by Didrik Madheden:
|
||||
* flip1.c: Provide dummy functions for the #ifndef HAVE_LIBUSB case
|
||||
* flip2.c: (Dito.)
|
||||
|
||||
2014-05-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* libavrdude.h: Join the former "public" header files (avr.h avrpart.h pindefs.h
|
||||
serial.h fileio.h safemode.h update.h pgm_type.h config.h confwin.h lists.h) into
|
||||
a single header that can be included by anyone wanting to link against the
|
||||
library
|
||||
* avr.h: Remove file.
|
||||
* avrpart.h: (Dito.)
|
||||
* pindefs.h: (Dito.)
|
||||
* serial.h: (Dito.)
|
||||
* fileio.h: (Dito.)
|
||||
* safemode.h: (Dito.)
|
||||
* update.h: (Dito.)
|
||||
* pgm.h: (Dito.)
|
||||
* pgm_type.h: (Dito.)
|
||||
* config.h: (Dito.)
|
||||
* confwin.h: (Dito.)
|
||||
* lists.h: (Dito.)
|
||||
* Makefile.am: Adapt for new include file constellation; install shared lib
|
||||
* configure.ac: Bump version date
|
||||
* arduino.c: #include <libavrdude.h> rather than a bunch of different headers
|
||||
* avr910.c: (Dito.)
|
||||
* avr910.h: (Dito.)
|
||||
* avr.c: (Dito.)
|
||||
* avrftdi.c: (Dito.)
|
||||
* avrftdi_private.h: (Dito.)
|
||||
* avrftdi_tpi.c: (Dito.)
|
||||
* avrftdi_tpi.h: (Dito.)
|
||||
* avr.h: (Dito.)
|
||||
* avrpart.c: (Dito.)
|
||||
* avrpart.h: (Dito.)
|
||||
* bitbang.c: (Dito.)
|
||||
* buspirate.c: (Dito.)
|
||||
* butterfly.c: (Dito.)
|
||||
* config.c: (Dito.)
|
||||
* config_gram.y: (Dito.)
|
||||
* config.h: (Dito.)
|
||||
* confwin.c: (Dito.)
|
||||
* confwin.h: (Dito.)
|
||||
* dfu.c: (Dito.)
|
||||
* fileio.c: (Dito.)
|
||||
* fileio.h: (Dito.)
|
||||
* flip1.c: (Dito.)
|
||||
* flip1.h: (Dito.)
|
||||
* flip2.c: (Dito.)
|
||||
* flip2.h: (Dito.)
|
||||
* ft245r.c: (Dito.)
|
||||
* ft245r.h: (Dito.)
|
||||
* jtag3.c: (Dito.)
|
||||
* jtagmkI.c: (Dito.)
|
||||
* jtagmkII.c: (Dito.)
|
||||
* lexer.l: (Dito.)
|
||||
* libavrdude.h: (Dito.)
|
||||
* linuxgpio.c: (Dito.)
|
||||
* lists.c: (Dito.)
|
||||
* lists.h: (Dito.)
|
||||
* main.c: (Dito.)
|
||||
* par.c: (Dito.)
|
||||
* pgm.c: (Dito.)
|
||||
* pgm_type.c: (Dito.)
|
||||
* pgm_type.h: (Dito.)
|
||||
* pickit2.c: (Dito.)
|
||||
* pickit2.h: (Dito.)
|
||||
* pindefs.c: (Dito.)
|
||||
* pindefs.h: (Dito.)
|
||||
* ppi.c: (Dito.)
|
||||
* ppiwin.c: (Dito.)
|
||||
* safemode.c: (Dito.)
|
||||
* safemode.h: (Dito.)
|
||||
* ser_avrdoper.c: (Dito.)
|
||||
* serbb_posix.c: (Dito.)
|
||||
* serbb_win32.c: (Dito.)
|
||||
* serial.h: (Dito.)
|
||||
* ser_posix.c: (Dito.)
|
||||
* ser_win32.c: (Dito.)
|
||||
* stk500.c: (Dito.)
|
||||
* stk500generic.c: (Dito.)
|
||||
* stk500v2.c: (Dito.)
|
||||
* stk500v2_private.h: (Dito.)
|
||||
* term.c: (Dito.)
|
||||
* term.h: (Dito.)
|
||||
* update.c: (Dito.)
|
||||
* update.h: (Dito.)
|
||||
* usbasp.c: (Dito.)
|
||||
* usbasp.h: (Dito.)
|
||||
* usb_libusb.c: (Dito.)
|
||||
* usbtiny.c: (Dito.)
|
||||
* usbtiny.h: (Dito.)
|
||||
* wiring.c: (Dito.)
|
||||
|
||||
2014-05-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* main.c: Cleanup unused include files.
|
||||
|
||||
2014-05-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* linux_ppdev.h: Caught two more instances of exit()
|
||||
* configure.ac: Add AC_CONFIG_MACRO_DIR as suggested by libtoolize
|
||||
* Makefile.am: add -I m4 to ACLOCAL_AMFLAGS as suggested by libtoolize
|
||||
|
||||
2014-05-16 Axel Wachtler <axel@uracoli.de>
|
||||
|
||||
* arduino.c: Replacing all occurences of fprintf(stderr,...) with avrdude_message(...)
|
||||
in potential library functions.
|
||||
* avr910.c: (Dito.)
|
||||
* avr.c: (Dito.)
|
||||
* avrdude.h: (Dito.)
|
||||
* avrftdi.c: (Dito.)
|
||||
* avrftdi_private.h: (Dito.)
|
||||
* avrpart.c: (Dito.)
|
||||
* bitbang.c: (Dito.)
|
||||
* buspirate.c: (Dito.)
|
||||
* butterfly.c: (Dito.)
|
||||
* config.c: (Dito.)
|
||||
* config_gram.y: (Dito.)
|
||||
* dfu.c: (Dito.)
|
||||
* fileio.c: (Dito.)
|
||||
* flip1.c: (Dito.)
|
||||
* flip2.c: (Dito.)
|
||||
* ft245r.c: (Dito.)
|
||||
* jtag3.c: (Dito.)
|
||||
* jtagmkI.c: (Dito.)
|
||||
* jtagmkII.c: (Dito.)
|
||||
* lexer.l: (Dito.)
|
||||
* linuxgpio.c: (Dito.)
|
||||
* linux_ppdev.h: (Dito.)
|
||||
* main.c: (Dito.)
|
||||
* par.c: (Dito.)
|
||||
* pgm.c: (Dito.)
|
||||
* pickit2.c: (Dito.)
|
||||
* pindefs.c: (Dito.)
|
||||
* ppi.c: (Dito.)
|
||||
* ppiwin.c: (Dito.)
|
||||
* safemode.c: (Dito.)
|
||||
* ser_avrdoper.c: (Dito.)
|
||||
* serbb_posix.c: (Dito.)
|
||||
* serbb_win32.c: (Dito.)
|
||||
* ser_posix.c: (Dito.)
|
||||
* ser_win32.c: (Dito.)
|
||||
* stk500.c: (Dito.)
|
||||
* stk500generic.c: (Dito.)
|
||||
* stk500v2.c: (Dito.)
|
||||
* term.c: (Dito.)
|
||||
* update.c: (Dito.)
|
||||
* usbasp.c: (Dito.)
|
||||
* usb_libusb.c: (Dito.)
|
||||
* usbtiny.c: (Dito.)
|
||||
* wiring.c: (Dito.)
|
||||
|
||||
2014-05-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Bump version, add libtool hooks
|
||||
* Makefile.am: First attempt to define building a shared library
|
||||
(not to be installed by now)
|
||||
|
||||
2014-05-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* dfu.c (dfu_open, dfu_init): Fix signature of the dummy functions
|
||||
(in the !HAVE_LIBUSB case) to match prototypes.
|
||||
|
||||
2014-05-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avr910.c: Replace all occurences of exit() in potential library
|
||||
functions by appropriate return values
|
||||
* avrftdi.c: (Dito.)
|
||||
* bitbang.c: (Dito.)
|
||||
* bitbang.h: (Dito.)
|
||||
* buspirate.c: (Dito.)
|
||||
* butterfly.c: (Dito.)
|
||||
* config.c: (Dito.)
|
||||
* flip2.c: (Dito.)
|
||||
* ft245r.c: (Dito.)
|
||||
* jtagmkI.c: (Dito.)
|
||||
* jtagmkII.c: (Dito.)
|
||||
* linuxgpio.c: (Dito.)
|
||||
* main.c: (Dito.)
|
||||
* par.c: (Dito.)
|
||||
* pgm.c: (Dito.)
|
||||
* pickit2.c: (Dito.)
|
||||
* pindefs.c: (Dito.)
|
||||
* pindefs.h: (Dito.)
|
||||
* ser_avrdoper.c: (Dito.)
|
||||
* ser_posix.c: (Dito.)
|
||||
* ser_win32.c: (Dito.)
|
||||
* serbb_posix.c: (Dito.)
|
||||
* serbb_win32.c: (Dito.)
|
||||
* stk500.c: (Dito.)
|
||||
* stk500v2.c: (Dito.)
|
||||
|
||||
2014-05-07 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #42310: New part description for AT90PWM216
|
||||
* avrdude.conf.in: added pwm216 entry
|
||||
|
||||
2014-05-07 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #42158: Linux GPIO - Source Typo
|
||||
* pindefs.h: fixed typo
|
||||
|
||||
2014-04-14 Rene Liebscher <R.Liebscher@gmx.de>
|
||||
|
||||
bug #42056: double free or corruption triggered at exit
|
||||
* pgm.c: copy usbpid list in pgm_dup
|
||||
|
||||
2014-04-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.1: Remove the note that users might edit the system-wide
|
||||
config file. This file will be overwritten by the next
|
||||
installation, so it's not a good idea to manually modify it.
|
||||
Using the -C +file option is a much better way for user
|
||||
modifications.
|
||||
* doc/avrdude.texi: (Dito.)
|
||||
* avrdude.conf.in: Add a warning to not modify the file manually.
|
||||
|
||||
2014-03-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version for post-6.1.
|
||||
|
||||
2014-03-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version to 6.1.
|
||||
|
||||
2014-03-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* pgm.c (pgm_free): Cleanup police: destroy the p->usbpid
|
||||
list when freeing the programmer struct.
|
||||
|
||||
2014-03-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #40782: Verify errors for object size > 16 k on x32e5 due
|
||||
to typo in avrdude.conf
|
||||
* avrdude.conf.in (ATmega8E5, ATmega32E5): fix boot location
|
||||
|
||||
2014-02-28 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in (atmelice, atmelice_pdi, atmelice_dw, atmelice_isp):
|
||||
New entries.
|
||||
* avrdude.1: Document the Atmel-ICE addition.
|
||||
* doc/avrdude.texi: (Dito.)
|
||||
* usbdevs.c (USB_DEVICE_ATMEL_ICE): New entry.
|
||||
|
||||
2014-02-28 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* main.c: Bump copyright year.
|
||||
|
||||
2014-02-28 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtag3.c (jtag3_recv): avoid memmov'ing more data than available
|
||||
|
||||
2014-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.1: Documentation update for EDBG.
|
||||
* doc/avrdude.texi: (Dito.)
|
||||
|
||||
2014-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtag3.c: For EDBG protocol, always use 512-byte block I/O. The
|
||||
lower layers will split this according to the EP's maxsize. This
|
||||
makes it work over USB 1.1 connections (albeit very slowly, due to
|
||||
the interrupt transfers used).
|
||||
|
||||
2014-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* config_gram.y: Turn the usbpid parameter of the programmer into
|
||||
a list of PIDs. Make the JTAGICE3 programmer handle a list of
|
||||
PIDs, by trying each of them in sequence. Use a single, central
|
||||
jtag3_open_common() function to handle the common code of all
|
||||
jtag3_open_* functions. Centralize all USB VID/PID definitions in
|
||||
usbdevs.h.
|
||||
* flip1.c: (Dito.)
|
||||
* ft245r.c: (Dito.)
|
||||
* stk500v2.c: (Dito.)
|
||||
* jtag3.c: (Dito.)
|
||||
* jtag3.h: (Dito.)
|
||||
* flip2.c: (Dito.)
|
||||
* usbdevs.h: (Dito.)
|
||||
* pgm.c: (Dito.)
|
||||
* serial.h: (Dito.)
|
||||
* pgm.h: (Dito.)
|
||||
* usbtiny.c: (Dito.)
|
||||
* usbasp.c: (Dito.)
|
||||
* avrftdi.c: (Dito.)
|
||||
* usbtiny.h: (Dito.)
|
||||
* avrdude.conf.in: (Dito.)
|
||||
* usbasp.h: (Dito.)
|
||||
* usb_libusb.c: (Dito.)
|
||||
|
||||
2014-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* usb_libusb.c (usbdev_open): Replace all calls to exit(1) by
|
||||
return -1
|
||||
|
||||
2014-02-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* jtag3_private.h: Add EDBG/CMSIS-DAP specific constants.
|
||||
* jtag3.c: Add EDBG/CMSIS-DAP protocol implementation.
|
||||
* serial.h: (Dito.)
|
||||
* usbdevs.h: (Dito.)
|
||||
* usb_libusb.c: (Dito.)
|
||||
* configure.ac: (Dito.)
|
||||
* avrdude.conf.in: Add JTAGICE3 and XplainedPro entries using
|
||||
EDBG.
|
||||
* configure.ac: Bump version date.
|
||||
|
||||
2014-02-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* usb_libusb.c (usbdev_recv_frame): Fix a bug where a new recv
|
||||
request was issued even though all desired data had aldready
|
||||
been received.
|
||||
|
||||
2014-02-21 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* serial.h: Change the second parameter of the ser_open method
|
||||
from "baud" into a "union pinfo", so the USB parameters can be
|
||||
passed without hacks.
|
||||
* arduino.c: (Dito.)
|
||||
* avr910.c: (Dito.)
|
||||
* buspirate.c: (Dito.)
|
||||
* butterfly.c: (Dito.)
|
||||
* jtag3.c: (Dito.)
|
||||
* jtagmkI.c: (Dito.)
|
||||
* jtagmkII.c: (Dito.)
|
||||
* ser_avrdoper.c: (Dito.)
|
||||
* ser_posix.c: (Dito.)
|
||||
* ser_win32.c: (Dito.)
|
||||
* stk500.c: (Dito.)
|
||||
* stk500v2.c: (Dito.)
|
||||
* usb_libusb.c: (Dito.)
|
||||
* wiring.c: (Dito.)
|
||||
|
||||
2014-01-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
[bug #41402] dfu.c missing include <stdint.h>
|
||||
* dfu.c: include <stdint.h> where uint16_t is defined
|
||||
|
||||
2014-01-28 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in (ATmega256RFR2 et al.): Fix EEPROM size.
|
||||
|
||||
2014-01-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
[bug #41357] OS X: Avrdude messes with the usb stack?
|
||||
* usb_libusb.c (usbdev_close): Only issue the usb_reset() for
|
||||
Linux systems, as these are the only ones that seem to require
|
||||
it under some circumstances.
|
||||
|
||||
2014-01-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (libelf): check against elf_getshdrstrndx() rather
|
||||
than just elf_begin() only, so it is clear we found a sufficiently
|
||||
recent libelf to work with.
|
||||
|
||||
2014-01-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Contributed by Alan Horstmann:
|
||||
bug #40897: AT Mega2560 not correctly programmed with stk500(v1) ISP (solution patch)
|
||||
* stk500.c: Implement extended address byte handling.
|
||||
* avrdude.conf.in (ATmega2560): enable stk500_devcode so
|
||||
STK500v1 protocol actually starts at all.
|
||||
|
||||
2014-01-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* flip1.c: Implement the meat of FLIP version 1 protocol.
|
||||
* avrdude.1: Document the new protocol.
|
||||
* doc/avrdude.texi: (Dito.)
|
||||
|
||||
2014-01-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* flip2.c (flip2_page_erase): Remove unimplemented function.
|
||||
* dfu.h: Correctly conditionalize <usb.h> vs. <lusb0_usb.h>;
|
||||
add adjustable timeout (struct dfu_dev); add dfu_abort()
|
||||
* dfu.c (dfu_abort): New function; implement adjustable timeout.
|
||||
|
||||
2014-01-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (libhid): Turn from AC_TRY_RUN into
|
||||
AC_TRY_COMPILE, so it also works for cross-compilation
|
||||
setups.
|
||||
|
||||
2014-01-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* dfu.c (dfu_init): Move the descriptor checks up into the
|
||||
FLIP protocol implementation.
|
||||
* flip2.c (flip2_initialize): (Dito.)
|
||||
* flip1.c (flip1_initialize): (Dito.)
|
||||
|
||||
2014-01-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* flip2.c: Rename from flip.c
|
||||
* flip2.h: Rename from flip.h
|
||||
* Makefile.am: Reflect the renaming.
|
||||
* dfu.c: Update information how to get GPL.
|
||||
* dfu.h: (Dito.)
|
||||
|
||||
2014-01-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* flip.c (flip2_initialize): Check user is running on an Xmega
|
||||
device.
|
||||
|
||||
2014-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* flip.c: Added some verbose-level messages (-vv)
|
||||
* dfu.c: Added some verbose-level messages (-vvvv)
|
||||
|
||||
2014-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Kirill Levchenko:
|
||||
patch #7896: DFU FLIPv2 programming support
|
||||
* pgm_type.c: Add the flip2 programmer type.
|
||||
* config_gram.y: Allow for the usbid keyword in a device definition.
|
||||
* avrdude.conf.in: Add usbpid values to those Xmega devices where
|
||||
applicable.
|
||||
* avrpart.h: Add usbpid device field.
|
||||
* dfu.c: (New file.)
|
||||
* dfu.h: (New file.)
|
||||
* flip.c: (New file.)
|
||||
* flip.h: (New file.)
|
||||
* Makefile.am: Add new files.
|
||||
* doc/avrdude.texi: Document the changes.
|
||||
* avrdude.1: (Dito.)
|
||||
|
||||
2014-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* ChangeLog-2013: Annual changelog rotation.
|
||||
@@ -1,54 +0,0 @@
|
||||
2015-12-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.1 (-C): Do not suggest users might change the
|
||||
default config file. It will be overwritten by updates.
|
||||
|
||||
2015-12-09 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #46610: Floating point exception (core dumped) arch linux rpi2
|
||||
bug #46483: version 6.2. ser_open(): can't set attributes for device
|
||||
* ser_posix.c: Back out change from patch #8380
|
||||
|
||||
2015-11-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Bump for post-release 6.2.
|
||||
|
||||
2015-11-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac: Released version 6.2.
|
||||
|
||||
2015-10-31 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Martino Facchin:
|
||||
bug #45727: Wrong atmega8u2 flash parameters
|
||||
* avrdude.conf.in (ATmega8U2): correct page and block size
|
||||
|
||||
2015-10-31 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Pasquale Cocchini:
|
||||
bug #46020: Add TIAO TUMPA to the conf file.
|
||||
* avrdude.conf.in (tumpa): New entry.
|
||||
|
||||
2015-10-31 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Submitted by Pasquale Cocchini:
|
||||
bug #46021: Please add read in the memory lock section of ATtiny85
|
||||
* avrdude.conf.in (ATtiny25/45/85): add read pattern for lock bits
|
||||
|
||||
2015-10-31 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* Makefile.am (libavrdude_a_SOURCES): reflect recent changes
|
||||
(pgm.h is gone, config.h is new).
|
||||
|
||||
2015-04-09 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
bug #44717: avrdude creates empty flash dump
|
||||
* update.c (do_op): When about to write an empty flash dump file,
|
||||
warn about this to avoid surprises.
|
||||
* avrdude.1: Document the truncation of trailing 0xFF bytes for
|
||||
flash memory areas.
|
||||
* doc/avrdude.texi: (Dito.)
|
||||
|
||||
2015-04-09 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
Annual ChangeLog rotation.
|
||||
4
INSTALL
Normal file
4
INSTALL
Normal file
@@ -0,0 +1,4 @@
|
||||
Installation Instructions
|
||||
*************************
|
||||
|
||||
See README.md.
|
||||
331
NEWS
331
NEWS
@@ -2,9 +2,336 @@ $Id$
|
||||
|
||||
Approximate change log for AVRDUDE by version.
|
||||
|
||||
(For more detailed changes, see the ChangeLog file.)
|
||||
(For detailed changes, see the version control system logs.)
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Changes in version 7.0:
|
||||
|
||||
* Major changes compared to the previous version:
|
||||
|
||||
- Completely revamped Windows support, including MSVC
|
||||
- Started to add CMake (by now, parallel with autoconf/automake)
|
||||
- New-architecture devices (AVR8X mega and tiny) can access all
|
||||
fuses, and memory display shows meaningful alias names
|
||||
- The "safemode" feature has been removed. The major class of
|
||||
programmers it has been designed for (lowlevel bitbang
|
||||
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:
|
||||
|
||||
- ATtiny828, ATtiny87, ATtiny167, ATtiny48, ATtiny102, ATtiny104
|
||||
- LGT8F88P, LGT8F168P, LGT8F328P (fixed names of these parts)
|
||||
- ATmeg164A, ATmega169A, ATmega169P, ATmega169PA, ATmega329A,
|
||||
ATmega329PA, ATmega3290, ATmega3290A, ATmega3290PA, ATmega649A,
|
||||
ATmega649P, ATmega6490A, ATmega6490P, ATmega165, ATmega165A,
|
||||
ATmega165P, ATmega165PA, ATmega325A, ATmega325P, ATmega325PA,
|
||||
ATmega645A, ATmega645P, ATmega3250A, ATmega3250P, ATmega3250PA,
|
||||
ATmega6450A, ATmega6450P
|
||||
- ATmega48A/48PA/88A/88PA/168A/168PA, ATmega164A/644A/644PA,
|
||||
ATmega16A/32A/64A/128A, ATtiny13A, ATtiny24A/44A/84A,
|
||||
ATtiny261A/461A/861A, ATtiny828R, ATtiny2313A, ATtiny1634R
|
||||
- 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:
|
||||
|
||||
- SerialUPDI (UPDI devices connected to serial port with few
|
||||
passive parts)
|
||||
- PicKit4 / SNAP (now also in ISP and PDI mode)
|
||||
- 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:
|
||||
|
||||
- Curiosity Nano and terminal mode #790 (only the actual bugs
|
||||
reported)
|
||||
- CMake doesn't correctly handle conditionals in avrdude.conf.in
|
||||
#776
|
||||
- CMake doesn't detect FreeBSD's libusb-1.0 (compatibility) #775
|
||||
- CMake doesn't correctly handle conditionals in avrdude.conf.in
|
||||
#776
|
||||
- CMake: Recognize more than just bison #785
|
||||
- [bug #26007] ATTiny167 not supported #150
|
||||
- [bug #47375] ATtiny102/104 descriptions missing in configuration
|
||||
file #409
|
||||
- No error message when connecting to a not-connected AVRISP mkII
|
||||
programmer #813
|
||||
- [bug #53180] missing programmer or bad -P option argument
|
||||
doesn't result in error message #471
|
||||
- ATmega328P reported as lgt8fx328p #812
|
||||
- [bug #48004] Dead link for linuxgpio in avrdude description #419
|
||||
- Segmentation fault when writing ATtiny104 fuse #823
|
||||
- USBasp returns ERANGE for unknown error #848
|
||||
- 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:
|
||||
|
||||
- GitHub Migration #765
|
||||
- Update toplevel files. #767
|
||||
- GitHub Migration part 2 #768
|
||||
- Remove 'windows' folder with giveio.sys driver #769
|
||||
- SerialUPDI implementation - release candidate 1 #772
|
||||
- Fix typos #777
|
||||
- Fix memory leaks #779
|
||||
- As promised, documentation for SerialUPDI programmer #782
|
||||
- Improve CMake project #783
|
||||
- Fix avr_read() for page reads #784
|
||||
- Serialupdi manpage #787
|
||||
- Add PicKit4 and SNAP programmers #791
|
||||
- Use yacc/byacc as an alternative to bison, closes #785 #793
|
||||
- Derive program version string from last commit #794
|
||||
- Find 'avrdude.conf' based on absolute path to executable #780
|
||||
- buspirate: fix -Wtautological-constant-out-of-range-compare #796
|
||||
- avrftdi: don't use the deprecated ftdi_usb_purge_buffers routine #792
|
||||
- Ignore ctags index file #804
|
||||
- term: fix memleakOnRealloc #806
|
||||
- Add missing ATtiny targets to avrdude.conf #803
|
||||
- Add support for Teensy bootloader #802
|
||||
- Conffile clean up #801
|
||||
- Fix typos all over the code #807
|
||||
- Add MSVC builds and better WinUSB/FTDI support #798
|
||||
- buspirate: fix invalidScanfArgType_int warning #808
|
||||
- Ignore ac_cfg.h.in~ #810
|
||||
- Notify open failure #814
|
||||
- Print expected part #817
|
||||
- pindefs: conform to the function declaration #818
|
||||
- Add support for Micronucleus bootloader #786
|
||||
- Remove ac_cfg.h from libavrdude.h #820
|
||||
- CMake: enable dynamic-link library for libavrdude #826
|
||||
- Fix for TPI fuse write (issue #823) #828
|
||||
- Add missing ATmega__5 and ATmega__9 targets to avrdude.conf #809
|
||||
- Add missing ATmega and ATtiny targets #832
|
||||
- Added missing RTS/DTR management feature to serialupdi
|
||||
programmer #811
|
||||
- Add missing tinyAVR-2, AVR DD and AVR EA targets #836
|
||||
- Add a new programmer ft232h #842
|
||||
- Reduce verbosity when setting fuses and uploading programs #845
|
||||
- jtagmkii: Reduce the number of sync attempts to 10 + print
|
||||
number of attempts #844
|
||||
- CMake: add initial support for installing lib and include files #829
|
||||
- Add SPI support to USBtiny #816
|
||||
- Add more memory sections to read from #815
|
||||
- Add a build script for Unix-like systems #849
|
||||
- Fix receive buffer implementation in ftdi_syncbb programmer #843
|
||||
- CMake: split configuration in two files #852
|
||||
- Set number of connection retry attempts for Arduino/STK500
|
||||
programmer #854
|
||||
- Fix libusb-1.0 error strings #850
|
||||
- Assign proper type to msg[] in errstr() #857
|
||||
- Fix Arduino retry attempts #855
|
||||
- CMake: use CMAKE_CURRENT_BINARY_DIR to locate avrdude.conf #858
|
||||
- Remove the "safemode" feature. #859
|
||||
- Add support for reading from more memory sections #863
|
||||
- Alias keyword #868
|
||||
- Add fuse name aliases to avrdude.conf + tweak update.c #869
|
||||
- Print JTAG3 clocks after configuration + string formatting #853
|
||||
- Tweak programmer info formatting strings #872
|
||||
- Remove libhid support in ser_avrdoper.c in favor of libhidapi #882
|
||||
- Reduce jtag3 output verbosity #877
|
||||
- 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:
|
||||
|
||||
- Development moved to Github
|
||||
- Addition of "alias" keyword to avrdude.conf.in syntax; used
|
||||
for fuse name aliases right now
|
||||
|
||||
|
||||
Version 6.4:
|
||||
|
||||
* Major changes compared to the previous version:
|
||||
|
||||
- libhidapi support (part of patch #8717)
|
||||
- use libhidapi as (optional) transport for CMSIS-DAP compliant
|
||||
debuggers (JTAGICE3 with firmware 3+, AtmelICE, EDBG, mEDBG)
|
||||
- UPDI support added (AVR8X family)
|
||||
- TPI support for USBtinyISP
|
||||
- TPI support for ft245r
|
||||
- TPI support for linuxgpio
|
||||
- AVR Doper uses libhidapi rather than raw libusb (patch #9033)
|
||||
- -P net:host:port can use IPv6 now (Posix systems only)
|
||||
- New configure option: -disable-libusb_1_0
|
||||
- extended UPDI device context (> 64 Ki flash)
|
||||
- major overhaul of ft245r driver (patch #9327/#9328)
|
||||
- some improvements in linuxspi driver
|
||||
- Use -B <bitclock> rather than -b <baudrate> for linuxspi driver
|
||||
- unused lock byte bits are not masked on read anymore
|
||||
- parport support disabled by default; configure with
|
||||
--enable-parport to explicitly enable it
|
||||
|
||||
* New devices supported:
|
||||
|
||||
- ATmega328PB
|
||||
- AVR8X family, ATtiny1617, ATtiny817, ATtiny202, ATtiny204,
|
||||
ATtiny402, ATtiny404, ATtiny406, ATtiny804, ATtiny806,
|
||||
ATtiny807, ATtiny1604, ATtiny1606, ATtiny1607, ATtiny212,
|
||||
ATtiny214, ATtiny412, ATTiny414, ATtiny416, ATtiny417,
|
||||
ATtiny814, ATtiny816, ATtiny1614, ATtiny1616, ATtiny3214,
|
||||
ATtiny3216, ATtiny3217, ATmega3208, ATmega3209, ATmega4808,
|
||||
ATmega4809
|
||||
- ATtiny841, ATtiny441
|
||||
- ATmega64M1
|
||||
- ATmega324A
|
||||
- ATmega808, ATmega809, ATmega1608, ATmega1609, AVR DA, AVR DB
|
||||
- LGT8FX88P, LGT8FX168P, LGT8FX328P
|
||||
- ATmega324PB
|
||||
- ATmega8A
|
||||
|
||||
* New programmers supported:
|
||||
|
||||
- ehajo-isp (commercial version of USBtiny)
|
||||
- XplainedPro in UPDI mode
|
||||
- XplainedMini in UPDI mode
|
||||
- JTAGICE3 in UPDI mode
|
||||
- Atmel Powerdebugger in all modes (JTAG, PDI, UPDI, debugWIRE, ISP)
|
||||
- linuxspi (direct SPI bus e.g. on Raspberry Pi devices)
|
||||
- PICkit4, Snap, PKoB
|
||||
- iseavrprog
|
||||
- XBeeBoot
|
||||
|
||||
* Bugfixes:
|
||||
bug #47550: Linux GPIO broken
|
||||
bug #47718: "lfuse reads as" not displayed in verbose mode - SOLUTION
|
||||
bug #48084: Avoid compiled-in timestamp for reproducible release builds
|
||||
bug #47376: ATtiny841 description missing in configuration file
|
||||
bug #49455: support for tiny441
|
||||
bug #57428: document when 'arduino' or 'wiring' should be used, and -D requirement of latter
|
||||
bug #58095: error setting efuse on atmega328pb variant
|
||||
bug #51409: Can't program EFUSE on ATmega32M1
|
||||
bug #60753: Patch #1436 breaks multiple programmer/device combinations on MacOS BigSur
|
||||
bug #59525: Bogus error message because Copy/Paste typo in stk500.c
|
||||
bug #58078: [PATCH] buspirate: remove compound literals (fixes GCC>=9)
|
||||
bug #57453: [PATCH] fix reference to nonexistant -m option by changing to -U
|
||||
bug #59227: Add new part. How does one get a part added to the CONF file?
|
||||
bug #55009: no efuses for m164a/pa
|
||||
bug #55734: USBtiny programming of ATmega328p broken by Patch #9278
|
||||
bug #58495: Add atmega324pb support to avrdude.conf.in
|
||||
bug #60863: avrftdi programming error probably caused by multiple, consecutive empty pages
|
||||
bug #50517: Reading fails if "immediate mode" for output file format is selected - fileio: invalid operation=1
|
||||
bug #50630: Erase Cycle Counter options ( -y -Y n ) should be removed from usage Message
|
||||
bug #48767: ser_drain() for TCP on Windows doesn't work
|
||||
bug #46759: avrdude 6.1 -> 6.2 regression: lock byte verification error
|
||||
bug #58440: linuxgpio PIN limit too low
|
||||
bug #55462: wrong programmer id check in jtag3_getsync() and jtag3_close()
|
||||
bug #58994: VPP PWM still enabled at the end of programming process
|
||||
bug #57338: if safemode has to change fuses avrdude should exit with non-zero exit code
|
||||
bug #60575: Permission denied on macOS Big Sur
|
||||
|
||||
* Patches:
|
||||
patch #9482: Add support for UPDI and AVR8X
|
||||
patch #9508: Add PowerDebugger and XPlained Mini in UPDI mode
|
||||
patch #9507: Fix UPDI chip erase
|
||||
patch #9506: Script to create device configuration stub from Atmel
|
||||
ATDF files
|
||||
patch #9423: Support ATtiny841 and ATtiny441
|
||||
patch #9530: Update URL to Ladyada's USBtinyISP page.
|
||||
patch #9317: Support atmega64m1 as part
|
||||
patch #9222: Enable silent build
|
||||
patch #8924: Enable TPI for usbtiny
|
||||
patch #9033: avrdoper backend uses libhidapi instead of libusb
|
||||
patch #8580: FT245r support to select device by serial number
|
||||
patch #8910: ATxmega32c4 and ATxmega16c4 have wrong signatures
|
||||
patch #8219: Fix boot_start for xmega devices on jtagmkII
|
||||
patch #9185: Add extended_param to usbasp.c - erasing
|
||||
patch #8311: Add IPv6 support to the -Pnet:host:port option
|
||||
patch #9542: Correct "usersig" on avr8x devices
|
||||
patch #8128: Added new option to configure.ac script
|
||||
patch #8444: Proposal for modifications in -B and -U command options managment (partially)
|
||||
patch #9735: spelling error fix: psuedo -> pseudo
|
||||
patch #9893: [PATCH] Reader reads ftdi handle after main thread close it
|
||||
patch #9819: Address several leaks in SVN rev 1429
|
||||
patch #9820: Fix some out-of-bounds/uninitialized issues
|
||||
patch #9818: correct typos in SVN rev 1429
|
||||
patch #9732: usbtiny_paged_load overflows buffer e.g. when reading EEPROM
|
||||
patch #9966: Add JTAGICE3 in UPDI mode
|
||||
patch #9963: UsbAsp 3 MHz patch for UsbAsp-flash firmware
|
||||
patch #9816: Implement new programmer type: linuxspi
|
||||
patch #9811: ATmega328pb has efuse bit 3
|
||||
patch #9744: Patch for ATMega324A support
|
||||
patch #10000: Add support for extended UPDI device context
|
||||
patch #9697: Add iseavrprog support
|
||||
patch #10017: uspasp / tpi: Automatically clear configuration byte (fuse) before writing it
|
||||
patch #8957: Allow reading prodsig memory from stk500v2 on xmega devices
|
||||
patch #9110: Let reserved fuse bits to be read as *don't care*
|
||||
patch #9253: Fix for giving terminal_mode commands more than 20 arguments
|
||||
patch #9320: fix TPI RESET in bitbang.c
|
||||
patch #9079: Fix ftdi_syncbb teardown (supersedes #9893, superseded by #9328)
|
||||
patch #9122: Fixed MISO sampling in ftdi_syncbb
|
||||
patch #9123: ftdi_syncbb: use FT245R_CYCLES in ft245r_set_bitclock()
|
||||
patch #8719: Support Over-the-Air bootloading with XBeeBoot
|
||||
patch #9757: Fix ATtiny817 Xplained Mini programmer
|
||||
patch #9327: ft245r.c: add TPI support (patches 1-4)
|
||||
patch #9328: ft245r.c: add TPI support (patches 5-7)
|
||||
patch #10027: linuxspi: Add reset pulse, according to AVR programming algorithm
|
||||
patch #10028: linuxspi: close() only when necessary
|
||||
patch #10029: linuxspi: Report GPIO_GET_LINEHANDLE_IOCTL errors
|
||||
patch #10030: linuxspi: Support inverted GPIO pin
|
||||
patch #10031: linuxspi: Support GPIO uAPI v2
|
||||
(no-id): Improve documentation of linuxspi driver, provide portname default
|
||||
(no-id): Use -B <bitclock> rather than -b <baudrate> for linuxspi driver
|
||||
patch #9304: [Bug #48767] Implemented WinSock variation of "ser_drain(...)" functionality
|
||||
patch #8996: Remove lock byte read mask (bug#21954, bug#46759)
|
||||
patch #8923: Enable TPI for linuxgpio
|
||||
patch #10153: linuxspi: Support "-E reset" and "-E noreset"
|
||||
|
||||
* Internals:
|
||||
- New avrdude.conf keyword "family_id", used to verify SIB attributes
|
||||
on AVR8X architecture if device is locked.
|
||||
|
||||
|
||||
Version 6.3:
|
||||
|
||||
* Major changes compared to the previous version:
|
||||
@@ -601,7 +928,7 @@ Version 4.3.0:
|
||||
* Added "Troubleshooting"-Appendix to the manual.
|
||||
|
||||
* Add ATmega8515 support.
|
||||
Contributed by: Matthias Wei<EFBFBD>er <matthias@matwei.de>
|
||||
Contributed by: Matthias Weißer <matthias@matwei.de>
|
||||
|
||||
* Add ATmega64 support.
|
||||
Contributed by: Erik Christiansen <erik@dd.nec.com.au>
|
||||
|
||||
46
README
46
README
@@ -1,46 +0,0 @@
|
||||
See the documentation file for the details.
|
||||
|
||||
The latest version of AVRDUDE is always available here:
|
||||
|
||||
http://savannah.nongnu.org/projects/avrdude
|
||||
|
||||
|
||||
Important environment variables for ./configure:
|
||||
================================================
|
||||
|
||||
CPPFLAGS: C preprocessor flags (*not* "C++")
|
||||
|
||||
This is the place to put additional (non-standard) -I options into.
|
||||
For example, if your Windows system has LibUSB-Win32 installed into
|
||||
\\WINDOWS\ProgramFiles\LibUSB-Win32, use
|
||||
|
||||
CPPFLAGS=-I/WINDOWS/ProgramFiles/LibUSB-Win32/include
|
||||
|
||||
to tell configure where to search for the header files. (The use of
|
||||
forward slashes rather than backslashes can often simplify things.
|
||||
Note that the Windows system services internally treat both the same.
|
||||
It's only cmd.exe which requires backslashes as the directory
|
||||
separator.)
|
||||
|
||||
LDFLAGS: Linker options
|
||||
|
||||
This is the place to make additional library locations known to the
|
||||
linker. To continue the above example, use
|
||||
|
||||
LDFLAGS=-L/WINDOWS/ProgramFiles/LibUSB-Win32/lib/gcc
|
||||
|
||||
to make the linker search for "libusb.a" in that directory.
|
||||
|
||||
|
||||
Linux users: make sure the header files are installed
|
||||
=====================================================
|
||||
|
||||
While many Linux distributions install the libraries needed by AVRDUDE
|
||||
(libusb, libelf) by default, they leave out the corresponding header
|
||||
files. Consequently, the configure script won't find them, so these
|
||||
libraries could not be used.
|
||||
|
||||
Usually, the packages with the header files (and static libraries) are
|
||||
derived from the regular package name by appending "-devel". Thus,
|
||||
make sure you have "libusb-devel" and "libelf-devel" installed before
|
||||
running the configure script. (Same goes for libftdi.)
|
||||
64
README.md
Normal file
64
README.md
Normal file
@@ -0,0 +1,64 @@
|
||||
# AVRDUDE
|
||||
|
||||
[](https://github.com/avrdudes/avrdude/actions/workflows/build.yml)
|
||||
|
||||
AVRDUDE - AVR Downloader Uploader - is a program for downloading and uploading
|
||||
the on-chip memories of Microchip’s [AVR microcontrollers](https://en.wikipedia.org/wiki/AVR_microcontrollers).
|
||||
It can program the Flash and EEPROM, and where supported by the programming
|
||||
protocol, it can program fuse and lock bits.
|
||||
AVRDUDE also supplies a direct instruction mode allowing one to issue any
|
||||
programming instruction to the AVR chip regardless of whether AVRDUDE
|
||||
implements that specific feature of a particular chip.
|
||||
|
||||
AVRDUDE was originally written in 2003 by Brian S. Dean. Since 2006, AVRDUDE has been maintained by Jörg Wunsch,
|
||||
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.
|
||||
|
||||
Alternatively, you may [build AVRDUDE](https://github.com/avrdudes/avrdude/wiki) yourself from source.
|
||||
|
||||
## Getting AVRDUDE for Linux
|
||||
|
||||
To install AVRDUDE for Linux, install the package `avrdude` by running the following commands:
|
||||
|
||||
```console
|
||||
sudo apt-get install avrdude
|
||||
```
|
||||
|
||||
Alternatively, you may [build AVRDUDE](https://github.com/avrdudes/avrdude/wiki) yourself from source.
|
||||
|
||||
## Getting AVRDUDE for MacOS
|
||||
|
||||
On MacOS, AVRDUDE can be installed through Mac Ports.
|
||||
|
||||
Alternatively, you may [build AVRDUDE](https://github.com/avrdudes/avrdude/wiki) yourself from source.
|
||||
|
||||
## Using AVRDUDE
|
||||
|
||||
AVRDUDE is a command-line application. Run the command `avrdude` without any arguments for a list of options.
|
||||
|
||||
A typical command to program your HEX file into your AVR microcontroller looks like this:
|
||||
|
||||
```console
|
||||
avrdude -c <programmer> -p <part> -U flash:w:<file>:i
|
||||
```
|
||||
|
||||
For instance, to program an **Arduino Uno** connected to the serial port **COM1** with a HEX file called `blink.hex`,
|
||||
you would run the following command:
|
||||
|
||||
```console
|
||||
avrdude -c arduino -P COM1 -b 115200 -p atmega328p -D -U flash:w:objs/blink.hex:i
|
||||
```
|
||||
|
||||
There are many different programmers and options that may be required for the programming to succeed.
|
||||
|
||||
For more information, refer to the [AVRDUDE documentation](https://avrdudes.github.io/avrdude/).
|
||||
77
build.sh
Executable file
77
build.sh
Executable file
@@ -0,0 +1,77 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Build script for Unix-like systems, using the CMake subsystem
|
||||
#
|
||||
# This script covers some common cases. It does *not* install any
|
||||
# prerequisites though.
|
||||
#
|
||||
# For documentation of AVRDUDE's build system, please refer to the
|
||||
# Wiki:
|
||||
#
|
||||
# https://github.com/avrdudes/avrdude/wiki
|
||||
|
||||
# Determine OS type
|
||||
#
|
||||
# So far, this script tries to handle three different Unix-like
|
||||
# systems:
|
||||
#
|
||||
# Linux
|
||||
# FreeBSD
|
||||
# Darwin (aka. MacOS)
|
||||
#
|
||||
# On Linux, if the machine is ARM-based, LINUXSPI and LINUXGPIO are
|
||||
# enabled.
|
||||
# On MacOS, an attempt is made to find out whether Mac ports or brew
|
||||
# are in place, and are assumed to have install the prerequisites.
|
||||
|
||||
ostype=$(uname | tr '[A-Z]' '[a-z]')
|
||||
|
||||
build_type=RelWithDebInfo
|
||||
# build_type=Release # no debug info
|
||||
|
||||
extra_enable=""
|
||||
build_flags=""
|
||||
|
||||
case "${ostype}" in
|
||||
linux)
|
||||
# try to find out whether this is an Embedded Linux
|
||||
# platform (e.g. Raspberry Pi)
|
||||
machine=$(uname -m)
|
||||
if expr "${machine}" : 'arm' >/dev/null
|
||||
then
|
||||
extra_enable="${extra_enable} -D HAVE_LINUXGPIO=ON -D HAVE_LINUXSPI=ON"
|
||||
fi
|
||||
;;
|
||||
|
||||
darwin)
|
||||
# determine whether we are running using Mac Ports
|
||||
# if not, assume Mac Brew
|
||||
if [ -f /opt/local/bin/port ]
|
||||
then
|
||||
build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/opt/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/opt/local/lib"
|
||||
else
|
||||
build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/Cellar"
|
||||
fi
|
||||
;;
|
||||
|
||||
freebsd)
|
||||
build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/lib"
|
||||
;;
|
||||
esac
|
||||
|
||||
cmake ${build_flags} ${extra_enable} -D CMAKE_BUILD_TYPE=${build_type} -B build_${ostype} ||\
|
||||
{ echo "CMake failed."; exit 1; }
|
||||
cmake --build build_${ostype} ||\
|
||||
{ echo "Build failed."; exit 1; }
|
||||
|
||||
cat <<EOF
|
||||
|
||||
Build succeeded.
|
||||
|
||||
Run
|
||||
|
||||
sudo cmake --build build_${ostype} --target install
|
||||
|
||||
to install.
|
||||
|
||||
EOF
|
||||
26
doc/TODO
26
doc/TODO
@@ -1,26 +0,0 @@
|
||||
|
||||
- Man page needs updated for avr910 info.
|
||||
|
||||
- Website needs to link to docs:
|
||||
http://savannah.nongnu.org/download/avrdude/doc/avrdude-html/
|
||||
|
||||
- Add "skip empty pages" optimization on avr910 paged write. The stk500 has
|
||||
this optimization already.
|
||||
|
||||
- Fix "overfull \hbox" issues in building documentation.
|
||||
|
||||
- FIXME: term.c: terminal_get_input(): strip newlines in non-readline input
|
||||
code.
|
||||
|
||||
- FIXME: avr910.c: avr910_cmd(): Insert version check here.
|
||||
|
||||
- FIXME: ser_posix.c: serial_close(): Should really restore the terminal to
|
||||
original state here.
|
||||
|
||||
- FIXME: main.c, par.c: exitspecs don't work if RESET-pin is controlled over
|
||||
PPICTRL.
|
||||
|
||||
- transfer ppi-speedtuning to the windows version (CAVEAT: This will make
|
||||
programming too fast for chips with 500kHz clock)
|
||||
|
||||
- make SCK-period configurable for PPI-programmers
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2006 Christian Starkjohann
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
The following is a replacement for hidsdi.h from the Windows DDK. It defines some
|
||||
of the types and function prototypes of this header for our project. If you
|
||||
have the Windows DDK version of this file or a version shipped with MinGW, use
|
||||
that instead.
|
||||
*/
|
||||
#ifndef MY_DDK_HIDSDI_H
|
||||
#define MY_DDK_HIDSDI_H
|
||||
#include <pshpack4.h>
|
||||
#include <ddk/hidusage.h>
|
||||
#include <ddk/hidpi.h>
|
||||
typedef struct{
|
||||
ULONG Size;
|
||||
USHORT VendorID;
|
||||
USHORT ProductID;
|
||||
USHORT VersionNumber;
|
||||
}HIDD_ATTRIBUTES;
|
||||
void __stdcall HidD_GetHidGuid(OUT LPGUID hidGuid);
|
||||
BOOLEAN __stdcall HidD_GetAttributes(IN HANDLE device, OUT HIDD_ATTRIBUTES *attributes);
|
||||
BOOLEAN __stdcall HidD_GetManufacturerString(IN HANDLE device, OUT void *buffer, IN ULONG bufferLen);
|
||||
BOOLEAN __stdcall HidD_GetProductString(IN HANDLE device, OUT void *buffer, IN ULONG bufferLen);
|
||||
BOOLEAN __stdcall HidD_GetSerialNumberString(IN HANDLE device, OUT void *buffer, IN ULONG bufferLen);
|
||||
BOOLEAN __stdcall HidD_GetFeature(IN HANDLE device, OUT void *reportBuffer, IN ULONG bufferLen);
|
||||
BOOLEAN __stdcall HidD_SetFeature(IN HANDLE device, IN void *reportBuffer, IN ULONG bufferLen);
|
||||
BOOLEAN __stdcall HidD_GetNumInputBuffers(IN HANDLE device, OUT ULONG *numBuffers);
|
||||
BOOLEAN __stdcall HidD_SetNumInputBuffers(IN HANDLE device, OUT ULONG numBuffers);
|
||||
#include <poppack.h>
|
||||
#endif /* MY_DDK_HIDSDI_H */
|
||||
318
safemode.c
318
safemode.c
@@ -1,318 +0,0 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* avrdude is Copyright (C) 2000-2004 Brian S. Dean <bsd@bsdhome.com>
|
||||
*
|
||||
* This file: Copyright (C) 2005-2007 Colin O'Flynn <coflynn@newae.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ac_cfg.h"
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "libavrdude.h"
|
||||
|
||||
/* This value from ac_cfg.h */
|
||||
/*
|
||||
* Writes the specified fuse in fusename (can be "lfuse", "hfuse", or
|
||||
* "efuse") and verifies it. Will try up to tries amount of times
|
||||
* before giving up
|
||||
*/
|
||||
int safemode_writefuse (unsigned char fuse, char * fusename, PROGRAMMER * pgm,
|
||||
AVRPART * p, int tries)
|
||||
{
|
||||
AVRMEM * m;
|
||||
unsigned char fuseread;
|
||||
int returnvalue = -1;
|
||||
|
||||
m = avr_locate_mem(p, fusename);
|
||||
if (m == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Keep trying to write then read back the fuse values */
|
||||
while (tries > 0) {
|
||||
if (avr_write_byte(pgm, p, m, 0, fuse) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (pgm->read_byte(pgm, p, m, 0, &fuseread) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Report information to user if needed */
|
||||
avrdude_message(MSG_NOTICE, "%s: safemode: Wrote %s to %x, read as %x. %d attempts left\n",
|
||||
progname, fusename, fuse, fuseread, tries-1);
|
||||
|
||||
/* If fuse wrote OK, no need to keep going */
|
||||
if (fuse == fuseread) {
|
||||
tries = 0;
|
||||
returnvalue = 0;
|
||||
}
|
||||
tries--;
|
||||
}
|
||||
|
||||
return returnvalue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reads the fuses three times, checking that all readings are the
|
||||
* same. This will ensure that the before values aren't in error!
|
||||
*/
|
||||
int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse,
|
||||
unsigned char * efuse, unsigned char * fuse,
|
||||
PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
|
||||
unsigned char value;
|
||||
unsigned char fusegood = 0;
|
||||
unsigned char allowfuseread = 1;
|
||||
unsigned char safemode_lfuse;
|
||||
unsigned char safemode_hfuse;
|
||||
unsigned char safemode_efuse;
|
||||
unsigned char safemode_fuse;
|
||||
AVRMEM * m;
|
||||
|
||||
safemode_lfuse = *lfuse;
|
||||
safemode_hfuse = *hfuse;
|
||||
safemode_efuse = *efuse;
|
||||
safemode_fuse = *fuse;
|
||||
|
||||
|
||||
/* Read fuse three times */
|
||||
fusegood = 2; /* If AVR device doesn't support this fuse, don't want
|
||||
to generate a verify error */
|
||||
m = avr_locate_mem(p, "fuse");
|
||||
if (m != NULL) {
|
||||
fusegood = 0; /* By default fuse is a failure */
|
||||
if(pgm->read_byte(pgm, p, m, 0, &safemode_fuse) != 0)
|
||||
{
|
||||
allowfuseread = 0;
|
||||
}
|
||||
avrdude_message(MSG_DEBUG, "%s: safemode read 1, fuse value: %x\n",progname, safemode_fuse);
|
||||
if(pgm->read_byte(pgm, p, m, 0, &value) != 0)
|
||||
{
|
||||
allowfuseread = 0;
|
||||
}
|
||||
avrdude_message(MSG_DEBUG, "%s: safemode read 2, fuse value: %x\n",progname, value);
|
||||
if (value == safemode_fuse) {
|
||||
if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
|
||||
{
|
||||
allowfuseread = 0;
|
||||
}
|
||||
avrdude_message(MSG_DEBUG, "%s: safemode read 3, fuse value: %x\n",progname, value);
|
||||
if (value == safemode_fuse)
|
||||
{
|
||||
fusegood = 1; /* Fuse read OK three times */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Programmer does not allow fuse reading.... no point trying anymore
|
||||
if (allowfuseread == 0)
|
||||
{
|
||||
return -5;
|
||||
}
|
||||
|
||||
if (fusegood == 0) {
|
||||
avrdude_message(MSG_INFO, "%s: safemode: Verify error - unable to read fuse properly. "
|
||||
"Programmer may not be reliable.\n", progname);
|
||||
return -1;
|
||||
}
|
||||
else if (fusegood == 1) {
|
||||
avrdude_message(MSG_NOTICE, "%s: safemode: fuse reads as %X\n", progname, safemode_fuse);
|
||||
}
|
||||
|
||||
|
||||
/* Read lfuse three times */
|
||||
fusegood = 2; /* If AVR device doesn't support this fuse, don't want
|
||||
to generate a verify error */
|
||||
m = avr_locate_mem(p, "lfuse");
|
||||
if (m != NULL) {
|
||||
fusegood = 0; /* By default fuse is a failure */
|
||||
if (pgm->read_byte(pgm, p, m, 0, &safemode_lfuse) != 0)
|
||||
{
|
||||
allowfuseread = 0;
|
||||
}
|
||||
avrdude_message(MSG_DEBUG, "%s: safemode read 1, lfuse value: %x\n",progname, safemode_lfuse);
|
||||
if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
|
||||
{
|
||||
allowfuseread = 0;
|
||||
}
|
||||
avrdude_message(MSG_DEBUG, "%s: safemode read 2, lfuse value: %x\n",progname, value);
|
||||
if (value == safemode_lfuse) {
|
||||
if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
|
||||
{
|
||||
allowfuseread = 0;
|
||||
}
|
||||
avrdude_message(MSG_DEBUG, "%s: safemode read 3, lfuse value: %x\n",progname, value);
|
||||
if (value == safemode_lfuse){
|
||||
fusegood = 1; /* Fuse read OK three times */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Programmer does not allow fuse reading.... no point trying anymore
|
||||
if (allowfuseread == 0)
|
||||
{
|
||||
return -5;
|
||||
}
|
||||
|
||||
|
||||
if (fusegood == 0) {
|
||||
avrdude_message(MSG_INFO, "%s: safemode: Verify error - unable to read lfuse properly. "
|
||||
"Programmer may not be reliable.\n", progname);
|
||||
return -1;
|
||||
}
|
||||
else if (fusegood == 1) {
|
||||
avrdude_message(MSG_DEBUG, "%s: safemode: lfuse reads as %X\n", progname, safemode_lfuse);
|
||||
}
|
||||
|
||||
/* Read hfuse three times */
|
||||
fusegood = 2; /* If AVR device doesn't support this fuse, don't want
|
||||
to generate a verify error */
|
||||
m = avr_locate_mem(p, "hfuse");
|
||||
if (m != NULL) {
|
||||
fusegood = 0; /* By default fuse is a failure */
|
||||
if (pgm->read_byte(pgm, p, m, 0, &safemode_hfuse) != 0)
|
||||
{
|
||||
allowfuseread = 0;
|
||||
}
|
||||
avrdude_message(MSG_DEBUG, "%s: safemode read 1, hfuse value: %x\n",progname, safemode_hfuse);
|
||||
if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
|
||||
{
|
||||
allowfuseread = 0;
|
||||
}
|
||||
avrdude_message(MSG_DEBUG, "%s: safemode read 2, hfuse value: %x\n",progname, value);
|
||||
if (value == safemode_hfuse) {
|
||||
if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
|
||||
{
|
||||
allowfuseread = 0;
|
||||
}
|
||||
avrdude_message(MSG_DEBUG, "%s: safemode read 3, hfuse value: %x\n",progname, value);
|
||||
if (value == safemode_hfuse){
|
||||
fusegood = 1; /* Fuse read OK three times */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Programmer does not allow fuse reading.... no point trying anymore
|
||||
if (allowfuseread == 0)
|
||||
{
|
||||
return -5;
|
||||
}
|
||||
|
||||
if (fusegood == 0) {
|
||||
avrdude_message(MSG_INFO, "%s: safemode: Verify error - unable to read hfuse properly. "
|
||||
"Programmer may not be reliable.\n", progname);
|
||||
return -2;
|
||||
}
|
||||
else if (fusegood == 1){
|
||||
avrdude_message(MSG_NOTICE, "%s: safemode: hfuse reads as %X\n", progname, safemode_hfuse);
|
||||
}
|
||||
|
||||
/* Read efuse three times */
|
||||
fusegood = 2; /* If AVR device doesn't support this fuse, don't want
|
||||
to generate a verify error */
|
||||
m = avr_locate_mem(p, "efuse");
|
||||
if (m != NULL) {
|
||||
fusegood = 0; /* By default fuse is a failure */
|
||||
if (pgm->read_byte(pgm, p, m, 0, &safemode_efuse) != 0)
|
||||
{
|
||||
allowfuseread = 0;
|
||||
}
|
||||
avrdude_message(MSG_DEBUG, "%s: safemode read 1, efuse value: %x\n",progname, safemode_efuse);
|
||||
if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
|
||||
{
|
||||
allowfuseread = 0;
|
||||
}
|
||||
avrdude_message(MSG_DEBUG, "%s: safemode read 2, efuse value: %x\n",progname, value);
|
||||
if (value == safemode_efuse) {
|
||||
if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
|
||||
{
|
||||
allowfuseread = 0;
|
||||
}
|
||||
avrdude_message(MSG_DEBUG, "%s: safemode read 3, efuse value: %x\n",progname, value);
|
||||
if (value == safemode_efuse){
|
||||
fusegood = 1; /* Fuse read OK three times */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Programmer does not allow fuse reading.... no point trying anymore
|
||||
if (allowfuseread == 0)
|
||||
{
|
||||
return -5;
|
||||
}
|
||||
|
||||
if (fusegood == 0) {
|
||||
avrdude_message(MSG_INFO, "%s: safemode: Verify error - unable to read efuse properly. "
|
||||
"Programmer may not be reliable.\n", progname);
|
||||
return -3;
|
||||
}
|
||||
else if (fusegood == 1) {
|
||||
avrdude_message(MSG_NOTICE, "%s: safemode: efuse reads as %X\n", progname, safemode_efuse);
|
||||
}
|
||||
|
||||
*lfuse = safemode_lfuse;
|
||||
*hfuse = safemode_hfuse;
|
||||
*efuse = safemode_efuse;
|
||||
*fuse = safemode_fuse;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This routine will store the current values pointed to by lfuse,
|
||||
* hfuse, and efuse into an internal buffer in this routine when save
|
||||
* is set to 1. When save is 0 (or not 1 really) it will copy the
|
||||
* values from the internal buffer into the locations pointed to be
|
||||
* lfuse, hfuse, and efuse. This allows you to change the fuse bits if
|
||||
* needed from another routine (ie: have it so if user requests fuse
|
||||
* bits are changed, the requested value is now verified
|
||||
*/
|
||||
int safemode_memfuses (int save, unsigned char * lfuse, unsigned char * hfuse,
|
||||
unsigned char * efuse, unsigned char * fuse)
|
||||
{
|
||||
static unsigned char safemode_lfuse = 0xff;
|
||||
static unsigned char safemode_hfuse = 0xff;
|
||||
static unsigned char safemode_efuse = 0xff;
|
||||
static unsigned char safemode_fuse = 0xff;
|
||||
|
||||
switch (save) {
|
||||
|
||||
/* Save the fuses as safemode setting */
|
||||
case 1:
|
||||
safemode_lfuse = *lfuse;
|
||||
safemode_hfuse = *hfuse;
|
||||
safemode_efuse = *efuse;
|
||||
safemode_fuse = *fuse;
|
||||
|
||||
break;
|
||||
/* Read back the fuses */
|
||||
default:
|
||||
*lfuse = safemode_lfuse;
|
||||
*hfuse = safemode_hfuse;
|
||||
*efuse = safemode_efuse;
|
||||
*fuse = safemode_fuse;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
661
ser_avrdoper.c
661
ser_avrdoper.c
@@ -1,661 +0,0 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2003-2004 Theodore A. Roth <troth@openavr.org>
|
||||
* Copyright (C) 2006 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
* Copyright (C) 2006 Christian Starkjohann
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* Serial Interface emulation for USB programmer "AVR-Doper" in HID mode.
|
||||
*/
|
||||
|
||||
#include "ac_cfg.h"
|
||||
|
||||
#if defined(HAVE_LIBUSB) || (defined(WIN32NATIVE) && defined(HAVE_LIBHID))
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "libavrdude.h"
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* Numeric constants for 'reportType' parameters */
|
||||
#define USB_HID_REPORT_TYPE_INPUT 1
|
||||
#define USB_HID_REPORT_TYPE_OUTPUT 2
|
||||
#define USB_HID_REPORT_TYPE_FEATURE 3
|
||||
|
||||
/* These are the error codes which can be returned by functions of this
|
||||
* module.
|
||||
*/
|
||||
#define USB_ERROR_NONE 0
|
||||
#define USB_ERROR_ACCESS 1
|
||||
#define USB_ERROR_NOTFOUND 2
|
||||
#define USB_ERROR_BUSY 16
|
||||
#define USB_ERROR_IO 5
|
||||
|
||||
#define USB_VENDOR_ID 0x16c0
|
||||
#define USB_PRODUCT_ID 0x05df
|
||||
|
||||
static int reportDataSizes[4] = {13, 29, 61, 125};
|
||||
|
||||
static unsigned char avrdoperRxBuffer[280]; /* buffer for receive data */
|
||||
static int avrdoperRxLength = 0; /* amount of valid bytes in rx buffer */
|
||||
static int avrdoperRxPosition = 0; /* amount of bytes already consumed in rx buffer */
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#if defined(WIN32NATIVE) && defined(HAVE_LIBHID)
|
||||
|
||||
#include <windows.h>
|
||||
#include <setupapi.h>
|
||||
|
||||
#if defined(HAVE_DDK_HIDSDI_H)
|
||||
# include <ddk/hidsdi.h>
|
||||
#else
|
||||
# include "my_ddk_hidsdi.h"
|
||||
#endif
|
||||
#include <ddk/hidpi.h>
|
||||
|
||||
#ifdef USB_DEBUG
|
||||
#define DEBUG_PRINT(arg) printf arg
|
||||
#else
|
||||
#define DEBUG_PRINT(arg)
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
static void convertUniToAscii(char *buffer)
|
||||
{
|
||||
unsigned short *uni = (void *)buffer;
|
||||
char *ascii = buffer;
|
||||
|
||||
while(*uni != 0){
|
||||
if(*uni >= 256){
|
||||
*ascii++ = '?';
|
||||
uni++;
|
||||
}else{
|
||||
*ascii++ = *uni++;
|
||||
}
|
||||
}
|
||||
*ascii++ = 0;
|
||||
}
|
||||
|
||||
static int usbOpenDevice(union filedescriptor *fdp, int vendor, char *vendorName,
|
||||
int product, char *productName, int usesReportIDs)
|
||||
{
|
||||
GUID hidGuid; /* GUID for HID driver */
|
||||
HDEVINFO deviceInfoList;
|
||||
SP_DEVICE_INTERFACE_DATA deviceInfo;
|
||||
SP_DEVICE_INTERFACE_DETAIL_DATA *deviceDetails = NULL;
|
||||
DWORD size;
|
||||
int i, openFlag = 0; /* may be FILE_FLAG_OVERLAPPED */
|
||||
int errorCode = USB_ERROR_NOTFOUND;
|
||||
HANDLE handle = INVALID_HANDLE_VALUE;
|
||||
HIDD_ATTRIBUTES deviceAttributes;
|
||||
|
||||
HidD_GetHidGuid(&hidGuid);
|
||||
deviceInfoList = SetupDiGetClassDevs(&hidGuid, NULL, NULL,
|
||||
DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
|
||||
deviceInfo.cbSize = sizeof(deviceInfo);
|
||||
for(i=0;;i++){
|
||||
if(handle != INVALID_HANDLE_VALUE){
|
||||
CloseHandle(handle);
|
||||
handle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
if(!SetupDiEnumDeviceInterfaces(deviceInfoList, 0, &hidGuid, i, &deviceInfo))
|
||||
break; /* no more entries */
|
||||
/* first do a dummy call just to determine the actual size required */
|
||||
SetupDiGetDeviceInterfaceDetail(deviceInfoList, &deviceInfo, NULL, 0, &size, NULL);
|
||||
if(deviceDetails != NULL)
|
||||
free(deviceDetails);
|
||||
deviceDetails = malloc(size);
|
||||
deviceDetails->cbSize = sizeof(*deviceDetails);
|
||||
/* this call is for real: */
|
||||
SetupDiGetDeviceInterfaceDetail(deviceInfoList, &deviceInfo, deviceDetails,
|
||||
size, &size, NULL);
|
||||
DEBUG_PRINT(("checking HID path \"%s\"\n", deviceDetails->DevicePath));
|
||||
/* attempt opening for R/W -- we don't care about devices which can't be accessed */
|
||||
handle = CreateFile(deviceDetails->DevicePath, GENERIC_READ|GENERIC_WRITE,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
|
||||
openFlag, NULL);
|
||||
if(handle == INVALID_HANDLE_VALUE){
|
||||
DEBUG_PRINT(("opening failed: %d\n", (int)GetLastError()));
|
||||
/* errorCode = USB_ERROR_ACCESS; opening will always fail for mouse -- ignore */
|
||||
continue;
|
||||
}
|
||||
deviceAttributes.Size = sizeof(deviceAttributes);
|
||||
HidD_GetAttributes(handle, &deviceAttributes);
|
||||
DEBUG_PRINT(("device attributes: vid=%d pid=%d\n",
|
||||
deviceAttributes.VendorID, deviceAttributes.ProductID));
|
||||
if(deviceAttributes.VendorID != vendor || deviceAttributes.ProductID != product)
|
||||
continue; /* ignore this device */
|
||||
errorCode = USB_ERROR_NOTFOUND;
|
||||
if(vendorName != NULL && productName != NULL){
|
||||
char buffer[512];
|
||||
if(!HidD_GetManufacturerString(handle, buffer, sizeof(buffer))){
|
||||
DEBUG_PRINT(("error obtaining vendor name\n"));
|
||||
errorCode = USB_ERROR_IO;
|
||||
continue;
|
||||
}
|
||||
convertUniToAscii(buffer);
|
||||
DEBUG_PRINT(("vendorName = \"%s\"\n", buffer));
|
||||
if(strcmp(vendorName, buffer) != 0)
|
||||
continue;
|
||||
if(!HidD_GetProductString(handle, buffer, sizeof(buffer))){
|
||||
DEBUG_PRINT(("error obtaining product name\n"));
|
||||
errorCode = USB_ERROR_IO;
|
||||
continue;
|
||||
}
|
||||
convertUniToAscii(buffer);
|
||||
DEBUG_PRINT(("productName = \"%s\"\n", buffer));
|
||||
if(strcmp(productName, buffer) != 0)
|
||||
continue;
|
||||
}
|
||||
break; /* we have found the device we are looking for! */
|
||||
}
|
||||
SetupDiDestroyDeviceInfoList(deviceInfoList);
|
||||
if(deviceDetails != NULL)
|
||||
free(deviceDetails);
|
||||
if(handle != INVALID_HANDLE_VALUE){
|
||||
fdp->pfd = (void *)handle;
|
||||
errorCode = 0;
|
||||
}
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
static void usbCloseDevice(union filedescriptor *fdp)
|
||||
{
|
||||
CloseHandle((HANDLE)fdp->pfd);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
static int usbSetReport(union filedescriptor *fdp, int reportType, char *buffer, int len)
|
||||
{
|
||||
HANDLE handle = (HANDLE)fdp->pfd;
|
||||
BOOLEAN rval = 0;
|
||||
DWORD bytesWritten;
|
||||
|
||||
switch(reportType){
|
||||
case USB_HID_REPORT_TYPE_INPUT:
|
||||
break;
|
||||
case USB_HID_REPORT_TYPE_OUTPUT:
|
||||
rval = WriteFile(handle, buffer, len, &bytesWritten, NULL);
|
||||
break;
|
||||
case USB_HID_REPORT_TYPE_FEATURE:
|
||||
rval = HidD_SetFeature(handle, buffer, len);
|
||||
break;
|
||||
}
|
||||
return rval == 0 ? USB_ERROR_IO : 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
static int usbGetReport(union filedescriptor *fdp, int reportType, int reportNumber,
|
||||
char *buffer, int *len)
|
||||
{
|
||||
HANDLE handle = (HANDLE)fdp->pfd;
|
||||
BOOLEAN rval = 0;
|
||||
DWORD bytesRead;
|
||||
|
||||
switch(reportType){
|
||||
case USB_HID_REPORT_TYPE_INPUT:
|
||||
buffer[0] = reportNumber;
|
||||
rval = ReadFile(handle, buffer, *len, &bytesRead, NULL);
|
||||
if(rval)
|
||||
*len = bytesRead;
|
||||
break;
|
||||
case USB_HID_REPORT_TYPE_OUTPUT:
|
||||
break;
|
||||
case USB_HID_REPORT_TYPE_FEATURE:
|
||||
buffer[0] = reportNumber;
|
||||
rval = HidD_GetFeature(handle, buffer, *len);
|
||||
break;
|
||||
}
|
||||
return rval == 0 ? USB_ERROR_IO : 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#else /* !(WIN32NATIVE && HAVE_LIBHID) */
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#if defined(HAVE_USB_H)
|
||||
# include <usb.h>
|
||||
#elif defined(HAVE_LUSB0_USB_H)
|
||||
# include <lusb0_usb.h>
|
||||
#else
|
||||
# error "libusb needs either <usb.h> or <lusb0_usb.h>"
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#define USBRQ_HID_GET_REPORT 0x01
|
||||
#define USBRQ_HID_SET_REPORT 0x09
|
||||
|
||||
static int usesReportIDs;
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static int usbGetStringAscii(usb_dev_handle *dev, int index, int langid, char *buf, int buflen)
|
||||
{
|
||||
char buffer[256];
|
||||
int rval, i;
|
||||
|
||||
if((rval = usb_control_msg(dev, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR,
|
||||
(USB_DT_STRING << 8) + index, langid, buffer,
|
||||
sizeof(buffer), 1000)) < 0)
|
||||
return rval;
|
||||
if(buffer[1] != USB_DT_STRING)
|
||||
return 0;
|
||||
if((unsigned char)buffer[0] < rval)
|
||||
rval = (unsigned char)buffer[0];
|
||||
rval /= 2;
|
||||
/* lossy conversion to ISO Latin1 */
|
||||
for(i=1;i<rval;i++){
|
||||
if(i > buflen) /* destination buffer overflow */
|
||||
break;
|
||||
buf[i-1] = buffer[2 * i];
|
||||
if(buffer[2 * i + 1] != 0) /* outside of ISO Latin1 range */
|
||||
buf[i-1] = '?';
|
||||
}
|
||||
buf[i-1] = 0;
|
||||
return i-1;
|
||||
}
|
||||
|
||||
static int usbOpenDevice(union filedescriptor *fdp, int vendor, char *vendorName,
|
||||
int product, char *productName, int doReportIDs)
|
||||
{
|
||||
struct usb_bus *bus;
|
||||
struct usb_device *dev;
|
||||
usb_dev_handle *handle = NULL;
|
||||
int errorCode = USB_ERROR_NOTFOUND;
|
||||
static int didUsbInit = 0;
|
||||
|
||||
if(!didUsbInit){
|
||||
usb_init();
|
||||
didUsbInit = 1;
|
||||
}
|
||||
usb_find_busses();
|
||||
usb_find_devices();
|
||||
for(bus=usb_get_busses(); bus; bus=bus->next){
|
||||
for(dev=bus->devices; dev; dev=dev->next){
|
||||
if(dev->descriptor.idVendor == vendor && dev->descriptor.idProduct == product){
|
||||
char string[256];
|
||||
int len;
|
||||
handle = usb_open(dev); /* we need to open the device in order to query strings */
|
||||
if(!handle){
|
||||
errorCode = USB_ERROR_ACCESS;
|
||||
avrdude_message(MSG_INFO, "Warning: cannot open USB device: %s\n",
|
||||
usb_strerror());
|
||||
continue;
|
||||
}
|
||||
if(vendorName == NULL && productName == NULL){ /* name does not matter */
|
||||
break;
|
||||
}
|
||||
/* now check whether the names match: */
|
||||
len = usbGetStringAscii(handle, dev->descriptor.iManufacturer,
|
||||
0x0409, string, sizeof(string));
|
||||
if(len < 0){
|
||||
errorCode = USB_ERROR_IO;
|
||||
avrdude_message(MSG_INFO, "Warning: cannot query manufacturer for device: %s\n",
|
||||
usb_strerror());
|
||||
}else{
|
||||
errorCode = USB_ERROR_NOTFOUND;
|
||||
/* avrdude_message(MSG_INFO, "seen device from vendor ->%s<-\n", string); */
|
||||
if(strcmp(string, vendorName) == 0){
|
||||
len = usbGetStringAscii(handle, dev->descriptor.iProduct,
|
||||
0x0409, string, sizeof(string));
|
||||
if(len < 0){
|
||||
errorCode = USB_ERROR_IO;
|
||||
avrdude_message(MSG_INFO, "Warning: cannot query product for device: %s\n",
|
||||
usb_strerror());
|
||||
}else{
|
||||
errorCode = USB_ERROR_NOTFOUND;
|
||||
/* avrdude_message(MSG_INFO, "seen product ->%s<-\n", string); */
|
||||
if(strcmp(string, productName) == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
usb_close(handle);
|
||||
handle = NULL;
|
||||
}
|
||||
}
|
||||
if(handle)
|
||||
break;
|
||||
}
|
||||
if(handle != NULL){
|
||||
int rval, retries = 3;
|
||||
if(usb_set_configuration(handle, 1)){
|
||||
avrdude_message(MSG_INFO, "Warning: could not set configuration: %s\n",
|
||||
usb_strerror());
|
||||
}
|
||||
/* now try to claim the interface and detach the kernel HID driver on
|
||||
* linux and other operating systems which support the call.
|
||||
*/
|
||||
while((rval = usb_claim_interface(handle, 0)) != 0 && retries-- > 0){
|
||||
#ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
|
||||
if(usb_detach_kernel_driver_np(handle, 0) < 0){
|
||||
avrdude_message(MSG_INFO, "Warning: could not detach kernel HID driver: %s\n",
|
||||
usb_strerror());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if(rval != 0)
|
||||
avrdude_message(MSG_INFO, "Warning: could not claim interface\n");
|
||||
/* Continue anyway, even if we could not claim the interface. Control transfers
|
||||
* should still work.
|
||||
*/
|
||||
errorCode = 0;
|
||||
fdp->pfd = (void *)handle;
|
||||
usesReportIDs = doReportIDs;
|
||||
}
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static void usbCloseDevice(union filedescriptor *fdp)
|
||||
{
|
||||
usb_close((usb_dev_handle *)fdp->pfd);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static int usbSetReport(union filedescriptor *fdp, int reportType, char *buffer, int len)
|
||||
{
|
||||
int bytesSent;
|
||||
|
||||
if(!usesReportIDs){
|
||||
buffer++; /* skip dummy report ID */
|
||||
len--;
|
||||
}
|
||||
bytesSent = usb_control_msg((usb_dev_handle *)fdp->pfd, USB_TYPE_CLASS |
|
||||
USB_RECIP_INTERFACE | USB_ENDPOINT_OUT, USBRQ_HID_SET_REPORT,
|
||||
reportType << 8 | buffer[0], 0, buffer, len, 5000);
|
||||
if(bytesSent != len){
|
||||
if(bytesSent < 0)
|
||||
avrdude_message(MSG_INFO, "Error sending message: %s\n", usb_strerror());
|
||||
return USB_ERROR_IO;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static int usbGetReport(union filedescriptor *fdp, int reportType, int reportNumber,
|
||||
char *buffer, int *len)
|
||||
{
|
||||
int bytesReceived, maxLen = *len;
|
||||
|
||||
if(!usesReportIDs){
|
||||
buffer++; /* make room for dummy report ID */
|
||||
maxLen--;
|
||||
}
|
||||
bytesReceived = usb_control_msg((usb_dev_handle *)fdp->pfd, USB_TYPE_CLASS |
|
||||
USB_RECIP_INTERFACE | USB_ENDPOINT_IN, USBRQ_HID_GET_REPORT,
|
||||
reportType << 8 | reportNumber, 0, buffer, maxLen, 5000);
|
||||
if(bytesReceived < 0){
|
||||
avrdude_message(MSG_INFO, "Error sending message: %s\n", usb_strerror());
|
||||
return USB_ERROR_IO;
|
||||
}
|
||||
*len = bytesReceived;
|
||||
if(!usesReportIDs){
|
||||
buffer[-1] = reportNumber; /* add dummy report ID */
|
||||
len++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* WIN32NATIVE */
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static void dumpBlock(const char *prefix, const unsigned char *buf, int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(len <= 8){ /* more compact format for short blocks */
|
||||
avrdude_message(MSG_INFO, "%s: %d bytes: ", prefix, len);
|
||||
for(i = 0; i < len; i++){
|
||||
avrdude_message(MSG_INFO, "%02x ", buf[i]);
|
||||
}
|
||||
avrdude_message(MSG_INFO, " \"");
|
||||
for(i = 0; i < len; i++){
|
||||
if(buf[i] >= 0x20 && buf[i] < 0x7f){
|
||||
fputc(buf[i], stderr);
|
||||
}else{
|
||||
fputc('.', stderr);
|
||||
}
|
||||
}
|
||||
avrdude_message(MSG_INFO, "\"\n");
|
||||
}else{
|
||||
avrdude_message(MSG_INFO, "%s: %d bytes:\n", prefix, len);
|
||||
while(len > 0){
|
||||
for(i = 0; i < 16; i++){
|
||||
if(i < len){
|
||||
avrdude_message(MSG_INFO, "%02x ", buf[i]);
|
||||
}else{
|
||||
avrdude_message(MSG_INFO, " ");
|
||||
}
|
||||
if(i == 7)
|
||||
fputc(' ', stderr);
|
||||
}
|
||||
avrdude_message(MSG_INFO, " \"");
|
||||
for(i = 0; i < 16; i++){
|
||||
if(i < len){
|
||||
if(buf[i] >= 0x20 && buf[i] < 0x7f){
|
||||
fputc(buf[i], stderr);
|
||||
}else{
|
||||
fputc('.', stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
avrdude_message(MSG_INFO, "\"\n");
|
||||
buf += 16;
|
||||
len -= 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static char *usbErrorText(int usbErrno)
|
||||
{
|
||||
static char buffer[32];
|
||||
|
||||
switch(usbErrno){
|
||||
case USB_ERROR_NONE: return "Success.";
|
||||
case USB_ERROR_ACCESS: return "Access denied.";
|
||||
case USB_ERROR_NOTFOUND:return "Device not found.";
|
||||
case USB_ERROR_BUSY: return "Device is busy.";
|
||||
case USB_ERROR_IO: return "I/O Error.";
|
||||
default:
|
||||
sprintf(buffer, "Unknown error %d.", usbErrno);
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static int avrdoper_open(char *port, union pinfo pinfo, union filedescriptor *fdp)
|
||||
{
|
||||
int rval;
|
||||
char *vname = "obdev.at";
|
||||
char *devname = "AVR-Doper";
|
||||
|
||||
rval = usbOpenDevice(fdp, USB_VENDOR_ID, vname, USB_PRODUCT_ID, devname, 1);
|
||||
if(rval != 0){
|
||||
avrdude_message(MSG_INFO, "%s: avrdoper_open(): %s\n", progname, usbErrorText(rval));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static void avrdoper_close(union filedescriptor *fdp)
|
||||
{
|
||||
usbCloseDevice(fdp);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static int chooseDataSize(int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < sizeof(reportDataSizes)/sizeof(reportDataSizes[0]); i++){
|
||||
if(reportDataSizes[i] >= len)
|
||||
return i;
|
||||
}
|
||||
return i - 1;
|
||||
}
|
||||
|
||||
static int avrdoper_send(union filedescriptor *fdp, const unsigned char *buf, size_t buflen)
|
||||
{
|
||||
if(verbose > 3)
|
||||
dumpBlock("Send", buf, buflen);
|
||||
while(buflen > 0){
|
||||
unsigned char buffer[256];
|
||||
int rval, lenIndex = chooseDataSize(buflen);
|
||||
int thisLen = buflen > reportDataSizes[lenIndex] ?
|
||||
reportDataSizes[lenIndex] : buflen;
|
||||
buffer[0] = lenIndex + 1; /* report ID */
|
||||
buffer[1] = thisLen;
|
||||
memcpy(buffer + 2, buf, thisLen);
|
||||
avrdude_message(MSG_TRACE, "Sending %d bytes data chunk\n", thisLen);
|
||||
rval = usbSetReport(fdp, USB_HID_REPORT_TYPE_FEATURE, (char *)buffer,
|
||||
reportDataSizes[lenIndex] + 2);
|
||||
if(rval != 0){
|
||||
avrdude_message(MSG_INFO, "%s: avrdoper_send(): %s\n", progname, usbErrorText(rval));
|
||||
return -1;
|
||||
}
|
||||
buflen -= thisLen;
|
||||
buf += thisLen;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static int avrdoperFillBuffer(union filedescriptor *fdp)
|
||||
{
|
||||
int bytesPending = reportDataSizes[1]; /* guess how much data is buffered in device */
|
||||
|
||||
avrdoperRxPosition = avrdoperRxLength = 0;
|
||||
while(bytesPending > 0){
|
||||
int len, usbErr, lenIndex = chooseDataSize(bytesPending);
|
||||
unsigned char buffer[128];
|
||||
len = sizeof(avrdoperRxBuffer) - avrdoperRxLength; /* bytes remaining */
|
||||
if(reportDataSizes[lenIndex] + 2 > len) /* requested data would not fit into buffer */
|
||||
break;
|
||||
len = reportDataSizes[lenIndex] + 2;
|
||||
usbErr = usbGetReport(fdp, USB_HID_REPORT_TYPE_FEATURE, lenIndex + 1,
|
||||
(char *)buffer, &len);
|
||||
if(usbErr != 0){
|
||||
avrdude_message(MSG_INFO, "%s: avrdoperFillBuffer(): %s\n", progname, usbErrorText(usbErr));
|
||||
return -1;
|
||||
}
|
||||
avrdude_message(MSG_TRACE, "Received %d bytes data chunk of total %d\n", len - 2, buffer[1]);
|
||||
len -= 2; /* compensate for report ID and length byte */
|
||||
bytesPending = buffer[1] - len; /* amount still buffered */
|
||||
if(len > buffer[1]) /* cut away padding */
|
||||
len = buffer[1];
|
||||
if(avrdoperRxLength + len > sizeof(avrdoperRxBuffer)){
|
||||
avrdude_message(MSG_INFO, "%s: avrdoperFillBuffer(): internal error: buffer overflow\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
memcpy(avrdoperRxBuffer + avrdoperRxLength, buffer + 2, len);
|
||||
avrdoperRxLength += len;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int avrdoper_recv(union filedescriptor *fdp, unsigned char *buf, size_t buflen)
|
||||
{
|
||||
unsigned char *p = buf;
|
||||
int remaining = buflen;
|
||||
|
||||
while(remaining > 0){
|
||||
int len, available = avrdoperRxLength - avrdoperRxPosition;
|
||||
if(available <= 0){ /* buffer is empty */
|
||||
if (avrdoperFillBuffer(fdp) < 0)
|
||||
return -1;
|
||||
continue;
|
||||
}
|
||||
len = remaining < available ? remaining : available;
|
||||
memcpy(p, avrdoperRxBuffer + avrdoperRxPosition, len);
|
||||
p += len;
|
||||
remaining -= len;
|
||||
avrdoperRxPosition += len;
|
||||
}
|
||||
if(verbose > 3)
|
||||
dumpBlock("Receive", buf, buflen);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static int avrdoper_drain(union filedescriptor *fdp, int display)
|
||||
{
|
||||
do{
|
||||
if (avrdoperFillBuffer(fdp) < 0)
|
||||
return -1;
|
||||
}while(avrdoperRxLength > 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static int avrdoper_set_dtr_rts(union filedescriptor *fdp, int is_on)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: AVR-Doper doesn't support DTR/RTS setting\n", progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
struct serial_device avrdoper_serdev =
|
||||
{
|
||||
.open = avrdoper_open,
|
||||
.close = avrdoper_close,
|
||||
.send = avrdoper_send,
|
||||
.recv = avrdoper_recv,
|
||||
.drain = avrdoper_drain,
|
||||
.set_dtr_rts = avrdoper_set_dtr_rts,
|
||||
.flags = SERDEV_FL_NONE,
|
||||
};
|
||||
|
||||
#endif /* defined(HAVE_LIBUSB) || (defined(WIN32NATIVE) && defined(HAVE_LIBHID)) */
|
||||
272
src/CMakeLists.txt
Normal file
272
src/CMakeLists.txt
Normal file
@@ -0,0 +1,272 @@
|
||||
#
|
||||
# CMakeLists.txt - CMake project for AVRDUDE
|
||||
# Copyright (C) 2021 Marius Greuel
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# =====================================
|
||||
# Set up flex target
|
||||
# =====================================
|
||||
|
||||
FLEX_TARGET(Parser "lexer.l" "${PROJECT_BINARY_DIR}/lexer.c")
|
||||
|
||||
if (FLEX_VERSION VERSION_GREATER_EQUAL 2.5.9)
|
||||
set(HAVE_YYLEX_DESTROY 1)
|
||||
endif()
|
||||
|
||||
# =====================================
|
||||
# Set up yacc/bison target
|
||||
# =====================================
|
||||
|
||||
if(BISON_FOUND)
|
||||
BISON_TARGET(Parser config_gram.y "${PROJECT_BINARY_DIR}/config_gram.c" DEFINES_FILE "${PROJECT_BINARY_DIR}/config_gram.h")
|
||||
else()
|
||||
set(YACC_TARGET_outputs "${PROJECT_BINARY_DIR}/config_gram.c")
|
||||
add_custom_command(OUTPUT ${YACC_TARGET_outputs}
|
||||
COMMAND ${YACC_EXECUTABLE} -d -o ${YACC_TARGET_outputs} config_gram.y
|
||||
VERBATIM
|
||||
COMMENT "[YACC][Parser] Building parser with yacc"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
set(BISON_Parser_OUTPUTS ${YACC_TARGET_outputs})
|
||||
endif()
|
||||
|
||||
# =====================================
|
||||
# Setup target specific options
|
||||
# =====================================
|
||||
|
||||
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
add_compile_definitions(CONFIG_DIR=\"${CONFIG_DIR}\")
|
||||
|
||||
if(WIN32)
|
||||
set(EXTRA_WINDOWS_SOURCES "${PROJECT_BINARY_DIR}/src/windows.rc")
|
||||
set(EXTRA_WINDOWS_LIBRARIES setupapi ws2_32)
|
||||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
set(LIB_MATH m)
|
||||
add_compile_options(-Wall) # -Wextra
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS=1)
|
||||
add_compile_definitions(_CRT_NONSTDC_NO_WARNINGS=1)
|
||||
add_compile_definitions(_WINSOCK_DEPRECATED_NO_WARNINGS=1)
|
||||
add_compile_options(/W3)
|
||||
add_compile_options(/wd4018) # warning C4018: signed/unsigned mismatch
|
||||
add_compile_options(/wd4244) # warning C4244: conversion from '...' to '...', possible loss of data
|
||||
add_compile_options(/wd4267) # warning C4267: conversion from '...' to '...', possible loss of data
|
||||
add_compile_options(/wd5105) # warning C5105: macro expansion producing 'xxx' has undefined behavior
|
||||
add_compile_options(/wd6255) # warning C6255: _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead
|
||||
|
||||
set(EXTRA_WINDOWS_SOURCES ${EXTRA_WINDOWS_SOURCES}
|
||||
"msvc/getopt.c"
|
||||
"msvc/gettimeofday.c"
|
||||
"msvc/usleep.cpp"
|
||||
)
|
||||
set(EXTRA_WINDOWS_INCLUDES ${EXTRA_WINDOWS_INCLUDES}
|
||||
"msvc"
|
||||
)
|
||||
endif()
|
||||
|
||||
# =====================================
|
||||
# Configure files
|
||||
# =====================================
|
||||
|
||||
macro(configure_option option)
|
||||
if(${${option}})
|
||||
string(REGEX REPLACE "(.*)@${option}_BEGIN@(.*)@${option}_END@(.*)" "\\1\\2\\3" conf_file "${conf_file}")
|
||||
else()
|
||||
string(REGEX REPLACE "(.*)@${option}_BEGIN@(.*)@${option}_END@(.*)" "\\1\\3" conf_file "${conf_file}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
file(READ avrdude.conf.in conf_file)
|
||||
configure_option(HAVE_PARPORT)
|
||||
configure_option(HAVE_LINUXGPIO)
|
||||
configure_option(HAVE_LINUXSPI)
|
||||
file(WRITE "${PROJECT_BINARY_DIR}/avrdude.conf.in" "${conf_file}")
|
||||
|
||||
configure_file(cmake_config.h.in ac_cfg.h)
|
||||
configure_file("${PROJECT_BINARY_DIR}/avrdude.conf.in" avrdude.conf)
|
||||
configure_file(avrdude.spec.in avrdude.spec)
|
||||
if(WIN32)
|
||||
configure_file(windows.rc.in windows.rc)
|
||||
endif()
|
||||
|
||||
# =====================================
|
||||
# Project
|
||||
# =====================================
|
||||
|
||||
add_library(libavrdude
|
||||
ac_cfg.h
|
||||
arduino.h
|
||||
arduino.c
|
||||
avr.c
|
||||
avr910.c
|
||||
avr910.h
|
||||
avrdude.h
|
||||
avrftdi.c
|
||||
avrftdi.h
|
||||
avrftdi_private.h
|
||||
avrftdi_tpi.c
|
||||
avrftdi_tpi.h
|
||||
avrpart.c
|
||||
bitbang.c
|
||||
bitbang.h
|
||||
buspirate.c
|
||||
buspirate.h
|
||||
butterfly.c
|
||||
butterfly.h
|
||||
config.c
|
||||
config.h
|
||||
confwin.c
|
||||
crc16.c
|
||||
crc16.h
|
||||
dfu.c
|
||||
dfu.h
|
||||
fileio.c
|
||||
flip1.c
|
||||
flip1.h
|
||||
flip2.c
|
||||
flip2.h
|
||||
freebsd_ppi.h
|
||||
ft245r.c
|
||||
ft245r.h
|
||||
jtagmkI.c
|
||||
jtagmkI.h
|
||||
jtagmkI_private.h
|
||||
jtagmkII.c
|
||||
jtagmkII.h
|
||||
jtagmkII_private.h
|
||||
jtag3.c
|
||||
jtag3.h
|
||||
jtag3_private.h
|
||||
libavrdude.h
|
||||
linuxgpio.c
|
||||
linuxgpio.h
|
||||
linuxspi.c
|
||||
linuxspi.h
|
||||
linux_ppdev.h
|
||||
lists.c
|
||||
micronucleus.c
|
||||
micronucleus.h
|
||||
par.c
|
||||
par.h
|
||||
pgm.c
|
||||
pgm_type.c
|
||||
pickit2.c
|
||||
pickit2.h
|
||||
pindefs.c
|
||||
ppi.c
|
||||
ppi.h
|
||||
ppiwin.c
|
||||
serbb.h
|
||||
serbb_posix.c
|
||||
serbb_win32.c
|
||||
ser_avrdoper.c
|
||||
ser_posix.c
|
||||
ser_win32.c
|
||||
serialupdi.c
|
||||
serialupdi.h
|
||||
solaris_ecpp.h
|
||||
stk500.c
|
||||
stk500.h
|
||||
stk500_private.h
|
||||
stk500v2.c
|
||||
stk500v2.h
|
||||
stk500v2_private.h
|
||||
stk500generic.c
|
||||
stk500generic.h
|
||||
teensy.c
|
||||
teensy.h
|
||||
tpi.h
|
||||
updi_constants.h
|
||||
updi_link.c
|
||||
updi_link.h
|
||||
updi_nvm.c
|
||||
updi_nvm.h
|
||||
updi_readwrite.c
|
||||
updi_readwrite.h
|
||||
updi_state.c
|
||||
updi_state.h
|
||||
usbasp.c
|
||||
usbasp.h
|
||||
usbdevs.h
|
||||
usb_hidapi.c
|
||||
usb_libusb.c
|
||||
usbtiny.h
|
||||
usbtiny.c
|
||||
update.c
|
||||
wiring.h
|
||||
wiring.c
|
||||
xbee.h
|
||||
xbee.c
|
||||
${FLEX_Parser_OUTPUTS}
|
||||
${BISON_Parser_OUTPUTS}
|
||||
)
|
||||
|
||||
set_target_properties(libavrdude PROPERTIES
|
||||
PREFIX ""
|
||||
PUBLIC_HEADER "libavrdude.h"
|
||||
VERSION 1.0.0
|
||||
SOVERSION 1
|
||||
)
|
||||
|
||||
target_include_directories(libavrdude
|
||||
PUBLIC
|
||||
"${PROJECT_SOURCE_DIR}"
|
||||
"${PROJECT_BINARY_DIR}"
|
||||
"${LIBUSB_COMPAT_DIR}"
|
||||
"${EXTRA_WINDOWS_INCLUDES}"
|
||||
)
|
||||
|
||||
target_link_libraries(libavrdude
|
||||
PUBLIC
|
||||
${LIB_MATH}
|
||||
${LIB_LIBELF}
|
||||
${LIB_LIBUSB}
|
||||
${LIB_LIBUSB_1_0}
|
||||
${LIB_LIBHID}
|
||||
${LIB_LIBHIDAPI}
|
||||
${LIB_LIBFTDI}
|
||||
${LIB_LIBFTDI1}
|
||||
${LIB_LIBREADLINE}
|
||||
${EXTRA_WINDOWS_LIBRARIES}
|
||||
)
|
||||
|
||||
add_executable(avrdude
|
||||
main.c
|
||||
term.c
|
||||
term.h
|
||||
whereami.c
|
||||
whereami.h
|
||||
"${EXTRA_WINDOWS_SOURCES}"
|
||||
)
|
||||
|
||||
target_link_libraries(avrdude PUBLIC libavrdude)
|
||||
|
||||
# =====================================
|
||||
# Install
|
||||
# =====================================
|
||||
|
||||
install(TARGETS avrdude DESTINATION bin)
|
||||
install(TARGETS libavrdude
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
PUBLIC_HEADER DESTINATION include COMPONENT dev
|
||||
)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/avrdude.conf" TYPE SYSCONF)
|
||||
install(FILES avrdude.1 TYPE MAN)
|
||||
@@ -16,23 +16,20 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# In order to get verbose build messages rather than a summary line
|
||||
# only, either use
|
||||
#
|
||||
# ./configure --disable-silent-rules
|
||||
#
|
||||
# or run make like
|
||||
#
|
||||
# make V=1
|
||||
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
EXTRA_DIST = \
|
||||
ChangeLog \
|
||||
ChangeLog-2001 \
|
||||
ChangeLog-2002 \
|
||||
ChangeLog-2003 \
|
||||
ChangeLog-2004-2006 \
|
||||
ChangeLog-2007 \
|
||||
ChangeLog-2008 \
|
||||
ChangeLog-2009 \
|
||||
ChangeLog-2010 \
|
||||
ChangeLog-2011 \
|
||||
ChangeLog-2012 \
|
||||
ChangeLog-2013 \
|
||||
avrdude.1 \
|
||||
avrdude.spec \
|
||||
bootstrap
|
||||
@@ -44,14 +41,13 @@ CLEANFILES = \
|
||||
|
||||
BUILT_SOURCES = $(CLEANFILES)
|
||||
|
||||
#SUBDIRS = doc @WINDOWS_DIRS@
|
||||
#DIST_SUBDIRS = doc windows
|
||||
#SUBDIRS = doc
|
||||
#DIST_SUBDIRS = doc
|
||||
|
||||
# . lets build this directory before the following in SUBDIRS
|
||||
SUBDIRS = .
|
||||
# doc comes here, and we want to use the built avrdude to generate the parts list
|
||||
SUBDIRS += @SUBDIRS_AC@
|
||||
SUBDIRS += @WINDOWS_DIRS@
|
||||
DIST_SUBDIRS = @DIST_SUBDIRS_AC@
|
||||
|
||||
AM_YFLAGS = -d
|
||||
@@ -66,7 +62,7 @@ avrdude_CFLAGS = @ENABLE_WARNINGS@
|
||||
libavrdude_a_CFLAGS = @ENABLE_WARNINGS@
|
||||
libavrdude_la_CFLAGS = $(libavrdude_a_CFLAGS)
|
||||
|
||||
avrdude_LDADD = $(top_builddir)/$(noinst_LIBRARIES) @LIBUSB_1_0@ @LIBUSB@ @LIBFTDI1@ @LIBFTDI@ @LIBHID@ @LIBELF@ @LIBPTHREAD@ -lm
|
||||
avrdude_LDADD = $(top_builddir)/$(noinst_LIBRARIES) @LIBUSB_1_0@ @LIBHIDAPI@ @LIBUSB@ @LIBFTDI1@ @LIBFTDI@ @LIBHID@ @LIBELF@ @LIBPTHREAD@ -lm
|
||||
|
||||
bin_PROGRAMS = avrdude
|
||||
|
||||
@@ -136,9 +132,12 @@ libavrdude_a_SOURCES = \
|
||||
libavrdude.h \
|
||||
linuxgpio.c \
|
||||
linuxgpio.h \
|
||||
linuxspi.c \
|
||||
linuxspi.h \
|
||||
linux_ppdev.h \
|
||||
lists.c \
|
||||
my_ddk_hidsdi.h \
|
||||
micronucleus.c \
|
||||
micronucleus.h \
|
||||
par.c \
|
||||
par.h \
|
||||
pgm.c \
|
||||
@@ -149,7 +148,6 @@ libavrdude_a_SOURCES = \
|
||||
ppi.c \
|
||||
ppi.h \
|
||||
ppiwin.c \
|
||||
safemode.c \
|
||||
serbb.h \
|
||||
serbb_posix.c \
|
||||
serbb_win32.c \
|
||||
@@ -165,16 +163,32 @@ libavrdude_a_SOURCES = \
|
||||
stk500v2_private.h \
|
||||
stk500generic.c \
|
||||
stk500generic.h \
|
||||
teensy.c \
|
||||
teensy.h \
|
||||
tpi.h \
|
||||
usbasp.c \
|
||||
usbasp.h \
|
||||
serialupdi.c \
|
||||
serialupdi.h \
|
||||
updi_constants.h \
|
||||
updi_link.c \
|
||||
updi_link.h \
|
||||
updi_state.c \
|
||||
updi_state.h \
|
||||
updi_readwrite.c \
|
||||
updi_readwrite.h \
|
||||
updi_nvm.c \
|
||||
updi_nvm.h \
|
||||
usbdevs.h \
|
||||
usb_hidapi.c \
|
||||
usb_libusb.c \
|
||||
usbtiny.h \
|
||||
usbtiny.c \
|
||||
update.c \
|
||||
wiring.h \
|
||||
wiring.c
|
||||
wiring.c \
|
||||
xbee.h \
|
||||
xbee.c
|
||||
libavrdude_la_SOURCES = $(libavrdude_a_SOURCES)
|
||||
libavrdude_la_LDFLAGS = -version-info 1:0
|
||||
|
||||
@@ -182,6 +196,8 @@ include_HEADERS = libavrdude.h
|
||||
|
||||
avrdude_SOURCES = \
|
||||
main.c \
|
||||
whereami.c \
|
||||
whereami.h \
|
||||
term.c \
|
||||
term.h
|
||||
|
||||
@@ -84,7 +84,8 @@ static int arduino_open(PROGRAMMER * pgm, char * port)
|
||||
{
|
||||
union pinfo pinfo;
|
||||
strcpy(pgm->port, port);
|
||||
pinfo.baud = pgm->baudrate? pgm->baudrate: 115200;
|
||||
pinfo.serialinfo.baud = pgm->baudrate? pgm->baudrate: 115200;
|
||||
pinfo.serialinfo.cflags = SERIAL_8N1;
|
||||
if (serial_open(port, pinfo, &pgm->fd)==-1) {
|
||||
return -1;
|
||||
}
|
||||
@@ -80,11 +80,12 @@ int avr_tpi_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
||||
0xFF
|
||||
};
|
||||
|
||||
while (avr_tpi_poll_nvmbsy(pgm));
|
||||
while (avr_tpi_poll_nvmbsy(pgm))
|
||||
;
|
||||
|
||||
err = pgm->cmd_tpi(pgm, cmd, sizeof(cmd), NULL, 0);
|
||||
if(err)
|
||||
return err;
|
||||
err = pgm->cmd_tpi(pgm, cmd, sizeof(cmd), NULL, 0);
|
||||
if(err)
|
||||
return err;
|
||||
|
||||
while (avr_tpi_poll_nvmbsy(pgm));
|
||||
|
||||
@@ -329,8 +330,8 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype,
|
||||
memset(mem->buf, 0xff, mem->size);
|
||||
|
||||
/* supports "paged load" thru post-increment */
|
||||
if ((p->flags & AVRPART_HAS_TPI) && mem->page_size != 0 &&
|
||||
pgm->cmd_tpi != NULL) {
|
||||
if ((p->flags & AVRPART_HAS_TPI) && mem->page_size > 1 &&
|
||||
mem->size % mem->page_size == 0 && pgm->cmd_tpi != NULL) {
|
||||
|
||||
while (avr_tpi_poll_nvmbsy(pgm));
|
||||
|
||||
@@ -360,7 +361,8 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype,
|
||||
return avr_mem_hiaddr(mem);
|
||||
}
|
||||
|
||||
if (pgm->paged_load != NULL && mem->page_size != 0) {
|
||||
if (pgm->paged_load != NULL && mem->page_size > 1 &&
|
||||
mem->size % mem->page_size == 0) {
|
||||
/*
|
||||
* the programmer supports a paged mode read
|
||||
*/
|
||||
@@ -438,11 +440,15 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype,
|
||||
{
|
||||
rc = pgm->read_byte(pgm, p, mem, i, mem->buf + i);
|
||||
if (rc != 0) {
|
||||
avrdude_message(MSG_INFO, "avr_read(): error reading address 0x%04lx\n", i);
|
||||
if (rc == -1)
|
||||
avrdude_message(MSG_INFO, " read operation not supported for memory \"%s\"\n",
|
||||
avrdude_message(MSG_INFO, "avr_read(): error reading address 0x%04lx\n", i);
|
||||
if (rc == -1) {
|
||||
avrdude_message(MSG_INFO, " read operation not supported for memory \"%s\"\n",
|
||||
memtype);
|
||||
return -2;
|
||||
return -2;
|
||||
}
|
||||
avrdude_message(MSG_INFO, " read operation failed for memory \"%s\"\n",
|
||||
memtype);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
report_progress(i, mem->size, NULL);
|
||||
@@ -785,30 +791,6 @@ int avr_write_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
int avr_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
unsigned long addr, unsigned char data)
|
||||
{
|
||||
|
||||
unsigned char safemode_lfuse;
|
||||
unsigned char safemode_hfuse;
|
||||
unsigned char safemode_efuse;
|
||||
unsigned char safemode_fuse;
|
||||
|
||||
/* If we write the fuses, then we need to tell safemode that they *should* change */
|
||||
safemode_memfuses(0, &safemode_lfuse, &safemode_hfuse, &safemode_efuse, &safemode_fuse);
|
||||
|
||||
if (strcmp(mem->desc, "fuse")==0) {
|
||||
safemode_fuse = data;
|
||||
}
|
||||
if (strcmp(mem->desc, "lfuse")==0) {
|
||||
safemode_lfuse = data;
|
||||
}
|
||||
if (strcmp(mem->desc, "hfuse")==0) {
|
||||
safemode_hfuse = data;
|
||||
}
|
||||
if (strcmp(mem->desc, "efuse")==0) {
|
||||
safemode_efuse = data;
|
||||
}
|
||||
|
||||
safemode_memfuses(1, &safemode_lfuse, &safemode_hfuse, &safemode_efuse, &safemode_fuse);
|
||||
|
||||
return pgm->write_byte(pgm, p, mem, addr, data);
|
||||
}
|
||||
|
||||
@@ -858,9 +840,14 @@ int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
|
||||
}
|
||||
|
||||
|
||||
if ((p->flags & AVRPART_HAS_TPI) && m->page_size != 0 &&
|
||||
if ((p->flags & AVRPART_HAS_TPI) && m->page_size > 1 &&
|
||||
pgm->cmd_tpi != NULL) {
|
||||
|
||||
if (wsize == 1) {
|
||||
/* fuse (configuration) memory: only single byte to write */
|
||||
return avr_write_byte(pgm, p, m, 0, m->buf[0]) == 0? 1: -1;
|
||||
}
|
||||
|
||||
while (avr_tpi_poll_nvmbsy(pgm));
|
||||
|
||||
/* setup for WORD_WRITE */
|
||||
@@ -898,7 +885,7 @@ int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
|
||||
return i;
|
||||
}
|
||||
|
||||
if (pgm->paged_write != NULL && m->page_size != 0) {
|
||||
if (pgm->paged_write != NULL && m->page_size > 1) {
|
||||
/*
|
||||
* the programmer supports a paged mode write
|
||||
*/
|
||||
@@ -1051,13 +1038,42 @@ int avr_signature(PROGRAMMER * pgm, AVRPART * p)
|
||||
if (rc < 0) {
|
||||
avrdude_message(MSG_INFO, "%s: error reading signature data for part \"%s\", rc=%d\n",
|
||||
progname, p->desc, rc);
|
||||
return -1;
|
||||
return rc;
|
||||
}
|
||||
report_progress (1,1,NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint8_t get_fuse_bitmask(AVRMEM * m) {
|
||||
uint8_t bitmask_r = 0;
|
||||
uint8_t bitmask_w = 0;
|
||||
int i;
|
||||
|
||||
if (!m || m->size > 1) {
|
||||
// not a fuse, compare bytes directly
|
||||
return 0xFF;
|
||||
}
|
||||
|
||||
if (m->op[AVR_OP_WRITE] == NULL ||
|
||||
m->op[AVR_OP_READ] == NULL)
|
||||
// no memory operations provided by configuration, compare directly
|
||||
return 0xFF;
|
||||
|
||||
// For fuses, only compare bytes that are actually written *and* read.
|
||||
for (i = 0; i < 32; i++) {
|
||||
if (m->op[AVR_OP_WRITE]->bit[i].type == AVR_CMDBIT_INPUT)
|
||||
bitmask_w |= (1 << m->op[AVR_OP_WRITE]->bit[i].bitno);
|
||||
if (m->op[AVR_OP_READ]->bit[i].type == AVR_CMDBIT_OUTPUT)
|
||||
bitmask_r |= (1 << m->op[AVR_OP_READ]->bit[i].bitno);
|
||||
}
|
||||
return bitmask_r & bitmask_w;
|
||||
}
|
||||
|
||||
int compare_memory_masked(AVRMEM * m, uint8_t b1, uint8_t b2) {
|
||||
uint8_t bitmask = get_fuse_bitmask(m);
|
||||
return (b1 & bitmask) != (b2 & bitmask);
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify the memory buffer of p with that of v. The byte range of v,
|
||||
@@ -1104,11 +1120,30 @@ int avr_verify(AVRPART * p, AVRPART * v, char * memtype, int size)
|
||||
for (i=0; i<size; i++) {
|
||||
if ((b->tags[i] & TAG_ALLOCATED) != 0 &&
|
||||
buf1[i] != buf2[i]) {
|
||||
avrdude_message(MSG_INFO, "%s: verification error, first mismatch at byte 0x%04x\n"
|
||||
"%s0x%02x != 0x%02x\n",
|
||||
progname, i,
|
||||
progbuf, buf1[i], buf2[i]);
|
||||
return -1;
|
||||
uint8_t bitmask = get_fuse_bitmask(a);
|
||||
if((buf1[i] & bitmask) != (buf2[i] & bitmask)) {
|
||||
// Mismatch is not just in unused bits
|
||||
avrdude_message(MSG_INFO, "%s: verification error, first mismatch at byte 0x%04x\n"
|
||||
"%s0x%02x != 0x%02x\n",
|
||||
progname, i,
|
||||
progbuf, buf1[i], buf2[i]);
|
||||
return -1;
|
||||
} else {
|
||||
// Mismatch is only in unused bits
|
||||
if ((buf1[i] | bitmask) != 0xff) {
|
||||
// Programmer returned unused bits as 0, must be the part/programmer
|
||||
avrdude_message(MSG_INFO, "%s: WARNING: ignoring mismatch in unused bits of \"%s\"\n"
|
||||
"%s(0x%02x != 0x%02x). To prevent this warning fix the part\n"
|
||||
"%sor programmer definition in the config file.\n",
|
||||
progname, memtype, progbuf, buf1[i], buf2[i], progbuf);
|
||||
} else {
|
||||
// Programmer returned unused bits as 1, must be the user
|
||||
avrdude_message(MSG_INFO, "%s: WARNING: ignoring mismatch in unused bits of \"%s\"\n"
|
||||
"%s(0x%02x != 0x%02x). To prevent this warning set unused bits\n"
|
||||
"%sto 1 when writing (double check with your datasheet first).\n",
|
||||
progname, memtype, progbuf, buf1[i], buf2[i], progbuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1191,6 +1226,16 @@ int avr_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
||||
return rc;
|
||||
}
|
||||
|
||||
int avr_unlock(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
int rc = -1;
|
||||
|
||||
if (pgm->unlock)
|
||||
rc = pgm->unlock(pgm, p);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* Report the progress of a read or write operation from/to the
|
||||
* device.
|
||||
@@ -370,7 +370,8 @@ static int avr910_open(PROGRAMMER * pgm, char * port)
|
||||
}
|
||||
|
||||
strcpy(pgm->port, port);
|
||||
pinfo.baud = pgm->baudrate;
|
||||
pinfo.serialinfo.baud = pgm->baudrate;
|
||||
pinfo.serialinfo.cflags = SERIAL_8N1;
|
||||
if (serial_open(port, pinfo, &pgm->fd)==-1) {
|
||||
return -1;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
.\"
|
||||
.\" avrdude - A Downloader/Uploader for AVR device programmers
|
||||
.\" Copyright (C) 2001, 2002, 2003, 2005 - 2016 Joerg Wunsch
|
||||
.\" Copyright (C) 2001, 2002, 2003, 2005 - 2020 Joerg Wunsch
|
||||
.\"
|
||||
.\" This program is free software; you can redistribute it and/or modify
|
||||
.\" it under the terms of the GNU General Public License as published by
|
||||
@@ -18,7 +18,7 @@
|
||||
.\"
|
||||
.\" $Id$
|
||||
.\"
|
||||
.Dd DATE February 15, 2016
|
||||
.Dd DATE November 22, 2021
|
||||
.Os
|
||||
.Dt AVRDUDE 1
|
||||
.Sh NAME
|
||||
@@ -106,9 +106,34 @@ be taken about voltage level compatibility. Also, although not strictrly
|
||||
required, it is strongly advisable to protect the GPIO pins from
|
||||
overcurrent situations in some way. The simplest would be to just put
|
||||
some resistors in series or better yet use a 3-state buffer driver like
|
||||
the 74HC244. Have a look at http://kolev.info/avrdude-linuxgpio for a more
|
||||
the 74HC244. Have a look at http://kolev.info/blog/2013/01/06/avrdude-linuxgpio/ for a more
|
||||
detailed tutorial about using this programmer type.
|
||||
.Pp
|
||||
Under a Linux installation with direct access to the SPI bus and GPIO
|
||||
pins, such as would be found on a Raspberry Pi, the ``linuxspi''
|
||||
programmer type can be used to directly connect to and program a chip
|
||||
using the built in interfaces on the computer. The requirements to use
|
||||
this type are that an SPI interface is exposed along with one GPIO
|
||||
pin. The GPIO serves as the reset output since the Linux SPI drivers
|
||||
do not hold slave select down when a transfer is not occurring and thus
|
||||
it cannot be used as the reset pin. A readily available level
|
||||
translator should be used between the SPI bus/reset GPIO and the chip
|
||||
to avoid potentially damaging the computer's SPI controller in the
|
||||
event that the chip is running at 5V and the SPI runs at 3.3V. The
|
||||
GPIO chosen for reset can be configured in the avrdude configuration
|
||||
file using the
|
||||
.Li reset
|
||||
entry under the linuxspi programmer, or
|
||||
directly in the port specification. An external pull-up resistor
|
||||
should be connected between the AVR's reset pin and Vcc. If Vcc is not
|
||||
the same as the SPI voltage, this should be done on the AVR side of
|
||||
the level translator to protect the hardware from damage.
|
||||
.Pp
|
||||
The
|
||||
.Fl P Ar portname
|
||||
option for this programmer defaults to
|
||||
.Li /dev/spidev0.0:/dev/gpiochip0 .
|
||||
.Pp
|
||||
Atmel's STK500 programmer is also supported and connects to a serial
|
||||
port.
|
||||
Both, firmware versions 1.x and 2.x can be handled, but require a
|
||||
@@ -117,12 +142,15 @@ Using firmware version 2, high-voltage programming is also supported,
|
||||
both parallel and serial
|
||||
(programmer types stk500pp and stk500hvsp).
|
||||
.Pp
|
||||
Wiring boards are supported, utilizing STK500 V2.x protocol, but
|
||||
a simple DTR/RTS toggle is used to set the boards into programming mode.
|
||||
The programmer type is ``wiring''.
|
||||
Wiring boards (e.g. Arduino Mega 2560 Rev3) are supported, utilizing STK500
|
||||
V2.x protocol, but a simple DTR/RTS toggle is used to set the boards into
|
||||
programming mode. The programmer type is ``wiring''. Note that the -D option
|
||||
will likely be required in this case, because the bootloader will rewrite the
|
||||
program memory, but no true chip erase can be performed.
|
||||
.Pp
|
||||
The Arduino (which is very similar to the STK500 1.x) is supported via
|
||||
its own programmer type specification ``arduino''.
|
||||
its own programmer type specification ``arduino''. This programmer works for
|
||||
the Arduino Uno Rev3 or any AVR that runs the Optiboot bootloader.
|
||||
.Pp
|
||||
The BusPirate is a versatile tool that can also be used as an AVR programmer.
|
||||
A single BusPirate can be connected to up to 3 independent AVRs. See
|
||||
@@ -188,6 +216,48 @@ The Atmel DFU bootloader is supported in both, FLIP protocol version 1
|
||||
(AT90USB* and ATmega*U* devices), as well as version 2 (Xmega devices).
|
||||
See below for some hints about FLIP version 1 protocol behaviour.
|
||||
.Pp
|
||||
The MPLAB(R) PICkit 4 and MPLAB(R) SNAP, are supported in ISP, PDI and UPDI mode.
|
||||
The Curiosity Nano board is supported in UPDI mode. It is dubbed
|
||||
.Dq PICkit on Board ,
|
||||
thus the name
|
||||
.Pa pkobn_updi .
|
||||
.Pp
|
||||
SerialUPDI programmer implementation is based on Microchip's
|
||||
.Em pymcuprog Li https://github.com/microchip-pic-avr-tools/pymcuprog
|
||||
utility, but it also contains some performance improvements included in
|
||||
Spence Kohde's
|
||||
.Em DxCore
|
||||
Arduino core
|
||||
.Li https://github.com/SpenceKonde/DxCore .
|
||||
In a nutshell, this programmer consists of simple USB->UART adapter, diode
|
||||
and couple of resistors. It uses serial connection to provide UPDI interface.
|
||||
See the texinfo documentation for more details and known issues.
|
||||
.Pp
|
||||
The jtag2updi programmer is supported,
|
||||
and can program AVRs with a UPDI interface.
|
||||
Jtag2updi is just a firmware that can be uploaded to an AVR,
|
||||
which enables it to interface with avrdude using the jtagice mkii protocol
|
||||
via a serial link.
|
||||
.Li https://github.com/ElTangas/jtag2updi
|
||||
.Pp
|
||||
The Micronucleus bootloader is supported for both protocol version V1
|
||||
and V2. As the bootloader does not support reading from flash memory,
|
||||
use the
|
||||
.Fl V
|
||||
option to prevent AVRDUDE from verifying the flash memory.
|
||||
See the section on
|
||||
.Em extended parameters
|
||||
for Micronucleus specific options.
|
||||
.Pp
|
||||
The Teensy bootloader is supported for all AVR boards.
|
||||
As the bootloader does not support reading from flash memory,
|
||||
use the
|
||||
.Fl V
|
||||
option to prevent AVRDUDE from verifing the flash memory.
|
||||
See the section on
|
||||
.Em extended parameters
|
||||
for Teensy specific options.
|
||||
.Pp
|
||||
Input files can be provided, and output files can be written in
|
||||
different file formats, such as raw binary files containing the data
|
||||
to download to the chip, Intel hex format, or Motorola S-record
|
||||
@@ -213,7 +283,7 @@ lock bits can be programmed as well. These are implemented within
|
||||
.Nm
|
||||
as separate memory types and can be programmed using data from a file
|
||||
(see the
|
||||
.Fl m
|
||||
.Fl U
|
||||
option) or from terminal mode (see the
|
||||
.Ar dump
|
||||
and
|
||||
@@ -485,15 +555,31 @@ same method of specifying the port is required there.
|
||||
For the USB programmer "AVR-Doper" running in HID mode, the port must
|
||||
be specified as
|
||||
.Ar avrdoper.
|
||||
Libusb support is required on Unix but not on Windows. For more
|
||||
Libhidapi support is required on Unix and Mac OS but not on Windows. For more
|
||||
information about AVR-Doper see http://www.obdev.at/avrusb/avrdoper.html.
|
||||
.Pp
|
||||
For the USBtinyISP, which is a simplicistic device not implementing
|
||||
For the USBtinyISP, which is a simplistic device not implementing
|
||||
serial numbers, multiple devices can be distinguished by their
|
||||
location in the USB hierarchy. See the the respective
|
||||
location in the USB hierarchy. See the respective
|
||||
.Em Troubleshooting
|
||||
entry in the detailed documentation for examples.
|
||||
.Pp
|
||||
For the XBee programmer the target MCU is to be programmed wirelessly over a
|
||||
ZigBee mesh using the XBeeBoot bootloader. The ZigBee 64-bit address for the
|
||||
target MCU's own XBee device must be supplied as a 16-character hexadecimal
|
||||
value as a
|
||||
.Ar port
|
||||
prefix, followed by the
|
||||
.Ql @
|
||||
character, and the serial device to connect to a second directly contactable
|
||||
XBee device associated with the same mesh (with a default baud rate of 9600).
|
||||
This may look similar to:
|
||||
.Pa 0013a20000000001@/dev/tty.serial .
|
||||
.Pp
|
||||
For diagnostic purposes, if the target MCU with an XBeeBoot bootloader is
|
||||
connected directly to the serial port, the 64-bit address field can be
|
||||
omitted. In this mode the default baud rate will be 19200.
|
||||
.Pp
|
||||
For programmers that attach to a serial port using some kind of
|
||||
higher level protocol (as opposed to bit-bang style programmers),
|
||||
.Ar port
|
||||
@@ -505,49 +591,27 @@ network connection to (TCP)
|
||||
on
|
||||
.Ar host
|
||||
is established.
|
||||
Square brackets may be placed around
|
||||
.Ar host
|
||||
to improve readability, for numeric IPv6 addresses (e.g.
|
||||
.Li net:[2001:db8::42]:1337 ) .
|
||||
The remote endpoint is assumed to be a terminal or console server
|
||||
that connects the network stream to a local serial port where the
|
||||
actual programmer has been attached to.
|
||||
The port is assumed to be properly configured, for example using a
|
||||
transparent 8-bit data connection without parity at 115200 Baud
|
||||
for a STK500.
|
||||
.Pp
|
||||
Note: The ability to handle IPv6 hostnames and addresses is limited to
|
||||
Posix systems (by now).
|
||||
.It Fl q
|
||||
Disable (or quell) output of the progress bar while reading or writing
|
||||
to the device. Specify it a second time for even quieter operation.
|
||||
.It Fl s
|
||||
Disable safemode prompting. When safemode discovers that one or more
|
||||
fuse bits have unintentionally changed, it will prompt for
|
||||
confirmation regarding whether or not it should attempt to recover the
|
||||
fuse bit(s). Specifying this flag disables the prompt and assumes
|
||||
that the fuse bit(s) should be recovered without asking for
|
||||
confirmation first.
|
||||
.It Fl t
|
||||
Tells
|
||||
.Nm
|
||||
to enter the interactive ``terminal'' mode instead of up- or downloading
|
||||
files. See below for a detailed description of the terminal mode.
|
||||
.It Fl u
|
||||
Disable the safemode fuse bit checks. Safemode is enabled by default
|
||||
and is intended to prevent unintentional fuse bit changes. When
|
||||
enabled, safemode will issue a warning if the any fuse bits are found
|
||||
to be different at program exit than they were when
|
||||
.Nm
|
||||
was invoked. Safemode won't alter fuse bits itself, but rather will
|
||||
prompt for instructions, unless the terminal is non-interactive, in
|
||||
which case safemode is disabled. See the
|
||||
.Fl s
|
||||
option to disable safemode prompting.
|
||||
.Pp
|
||||
If one of the configuration files has a line
|
||||
.Dl "default_safemode = no;"
|
||||
safemode is disabled by default.
|
||||
The
|
||||
.Fl u
|
||||
option's effect is negated in that case, i. e. it
|
||||
.Em enables
|
||||
safemode.
|
||||
.Pp
|
||||
Safemode is always disabled for AVR32, Xmega and TPI devices.
|
||||
.It Xo Fl U Ar memtype Ns
|
||||
.Ar \&: Ns Ar op Ns
|
||||
.Ar \&: Ns Ar filename Ns
|
||||
@@ -745,7 +809,7 @@ Display the device signature bytes.
|
||||
Enter direct SPI mode. The
|
||||
.Em pgmled
|
||||
pin acts as slave select.
|
||||
.Em Only supported on parallel bitbang programmers.
|
||||
.Em Only supported on parallel bitbang programmers, and partially by USBtiny.
|
||||
.It Ar part
|
||||
Display the current part settings and parameters. Includes chip
|
||||
specific information including all memory types supported by the
|
||||
@@ -937,6 +1001,12 @@ only if your
|
||||
.Ar AVR910
|
||||
programmer creates errors during initial sequence.
|
||||
.El
|
||||
.It Ar Arduino
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar attemps[=<1..99>]
|
||||
Specify how many connection retry attemps to perform before exiting.
|
||||
Defaults to 10 if not specified.
|
||||
.El
|
||||
.It Ar buspirate
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar reset={cs,aux,aux2}
|
||||
@@ -1016,6 +1086,26 @@ Especially in ascii mode this happens very often, so setting a smaller value
|
||||
can speed up programming a lot.
|
||||
The default value is 100ms. Using 10ms might work in most cases.
|
||||
.El
|
||||
.It Ar Micronucleus bootloader
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar wait[=<timeout>]
|
||||
If the device is not connected, wait for the device to be plugged in.
|
||||
The optional
|
||||
.Ar timeout
|
||||
specifies the connection time-out in seconds.
|
||||
If no time-out is specified, AVRDUDE will wait indefinitely until the
|
||||
device is plugged in.
|
||||
.El
|
||||
.It Ar Teensy bootloader
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar wait[=<timeout>]
|
||||
If the device is not connected, wait for the device to be plugged in.
|
||||
The optional
|
||||
.Ar timeout
|
||||
specifies the connection time-out in seconds.
|
||||
If no time-out is specified, AVRDUDE will wait indefinitely until the
|
||||
device is plugged in.
|
||||
.El
|
||||
.It Ar Wiring
|
||||
When using the Wiring programmer type, the
|
||||
following optional extended parameter is accepted:
|
||||
@@ -1047,14 +1137,65 @@ Sets the SPI clocking rate in Hz (default is 100kHz). Alternately the -B or -i o
|
||||
.It Ar timeout=<usb-transaction-timeout>
|
||||
Sets the timeout for USB reads and writes in milliseconds (default is 1500 ms).
|
||||
.El
|
||||
.It Ar USBasp
|
||||
Extended parameters:
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar section_config
|
||||
Programmer will erase configuration section with option
|
||||
.Fl e
|
||||
(chip erase), rather than entire chip.
|
||||
Only applicable to TPI devices (ATtiny 4/5/9/10/20/40).
|
||||
.El
|
||||
.It Ar xbee
|
||||
Extended parameters:
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar xbeeresetpin=<1..7>
|
||||
Select the XBee pin DIO<1..7> that is connected to the MCU's
|
||||
.Ql /RESET
|
||||
line. The programmer needs to know which DIO pin to use to reset into the
|
||||
bootloader. The default (3) is the DIO3 pin (XBee pin 17), but some
|
||||
commercial products use a different XBee pin.
|
||||
.Pp
|
||||
The remaining two necessary XBee-to-MCU connections are not selectable - the
|
||||
XBee DOUT pin (pin 2) must be connected to the MCU's
|
||||
.Ql RXD
|
||||
line, and the XBee DIN pin (pin 3) must be connected to the MCU's
|
||||
.Ql TXD
|
||||
line.
|
||||
.El
|
||||
.It Ar STK500
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar attemps[=<1..99>]
|
||||
Specify how many connection retry attemps to perform before exiting.
|
||||
Defaults to 10 if not specified.
|
||||
.El
|
||||
.It Ar serialupdi
|
||||
Extended parameters:
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar rtsdtr=low|high
|
||||
Forces RTS/DTR lines to assume low or high state during the whole
|
||||
programming session. Some programmers might use this signal to
|
||||
indicate UPDI programming state, but this is strictly hardware
|
||||
specific.
|
||||
.Pp
|
||||
When not provided, driver/OS default value will be used.
|
||||
.El
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -offset indent -width /dev/ppi0XXX
|
||||
.It Pa /dev/ppi0
|
||||
default device to be used for communication with the programming
|
||||
hardware
|
||||
.It Pa ${PREFIX}/etc/avrdude.conf
|
||||
.It Pa avrdude.conf
|
||||
programmer and parts configuration file
|
||||
.Pp
|
||||
On Windows systems, this file is looked up in the same directory as the
|
||||
executable file.
|
||||
On all other systems, the file is first looked up in
|
||||
.Pa ../etc/ ,
|
||||
relative to the path of the executable, then in the same directory as
|
||||
the executable itself, and finally in the system default location
|
||||
.Pa ${PREFIX}/etc/avrdude.conf .
|
||||
.It Pa ${HOME}/.avrduderc
|
||||
programmer and parts configuration file (per-user overrides)
|
||||
.It Pa ~/.inputrc
|
||||
@@ -1109,7 +1250,7 @@ This man page by
|
||||
.el Joerg Wunsch.
|
||||
.Sh BUGS
|
||||
Please report bugs via
|
||||
.Dl "http://savannah.nongnu.org/bugs/?group=avrdude" .
|
||||
.Dl "https://github.com/avrdudes/avrdude/issues"
|
||||
.Pp
|
||||
The JTAG ICE programmers currently cannot write to the flash ROM
|
||||
one byte at a time.
|
||||
@@ -1126,6 +1267,9 @@ The USBasp and USBtinyISP drivers do not offer any option to distinguish multipl
|
||||
devices connected simultaneously, so effectively only a single device
|
||||
is supported.
|
||||
.Pp
|
||||
Slave Select must be externally held low for direct SPI when
|
||||
using USBtinyISP, and send must be a multiple of four bytes.
|
||||
.Pp
|
||||
The avrftdi driver allows one to select specific devices using any combination of vid,pid
|
||||
serial number (usbsn) vendor description (usbvendoror part description (usbproduct)
|
||||
as seen with lsusb or whatever tool used to view USB device information. Multiple
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,48 +16,32 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef avrdude_h
|
||||
#define avrdude_h
|
||||
|
||||
#define SYSTEM_CONF_FILE "avrdude.conf"
|
||||
#if defined(WIN32)
|
||||
#define USER_CONF_FILE "avrdude.rc"
|
||||
#else
|
||||
#define USER_CONF_FILE ".avrduderc"
|
||||
#endif
|
||||
|
||||
extern char * progname; /* name of program, for messages */
|
||||
extern char progbuf[]; /* spaces same length as progname */
|
||||
|
||||
extern int ovsigck; /* override signature check (-F) */
|
||||
extern int verbose; /* verbosity level (-v, -vv, ...) */
|
||||
extern int quell_progress; /* quiteness level (-q, -qq) */
|
||||
extern int quell_progress; /* quietness level (-q, -qq) */
|
||||
|
||||
int avrdude_message(const int msglvl, const char *format, ...);
|
||||
|
||||
#define MSG_INFO (0) /* no -v option, can be supressed with -qq */
|
||||
#define MSG_INFO (0) /* no -v option, can be suppressed with -qq */
|
||||
#define MSG_NOTICE (1) /* displayed with -v */
|
||||
#define MSG_NOTICE2 (2) /* displayed with -vv, used rarely */
|
||||
#define MSG_DEBUG (3) /* displayed with -vvv */
|
||||
#define MSG_TRACE (4) /* displayed with -vvvv, show trace commuication */
|
||||
#define MSG_TRACE (4) /* displayed with -vvvv, show trace communication */
|
||||
#define MSG_TRACE2 (5) /* displayed with -vvvvv */
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
|
||||
#include "ac_cfg.h"
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_USLEEP)
|
||||
int usleep(unsigned int us);
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_GETTIMEOFDAY)
|
||||
struct timezone;
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||
#endif /* HAVE_GETTIMEOFDAY */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* defined(WIN32NATIVE) */
|
||||
|
||||
#endif
|
||||
@@ -71,7 +71,7 @@ enum { FTDI_SCK = 0, FTDI_MOSI, FTDI_MISO, FTDI_RESET };
|
||||
static int write_flush(avrftdi_t *);
|
||||
|
||||
/*
|
||||
* returns a human-readable name for a pin number. the name should match with
|
||||
* returns a human-readable name for a pin number. The name should match with
|
||||
* the pin names used in FTDI datasheets.
|
||||
*/
|
||||
static char*
|
||||
@@ -125,7 +125,7 @@ ftdi_pin_name(avrftdi_t* pdata, struct pindef_t pin)
|
||||
}
|
||||
|
||||
/*
|
||||
* output function, to save if(vebose>level)-constructs. also prefixes output
|
||||
* output function, to save if(vebose>level)-constructs. Also prefixes output
|
||||
* with "avrftdi function-name(line-number):" to identify were messages came
|
||||
* from.
|
||||
* This function is the backend of the log_*-macros, but it can be used
|
||||
@@ -163,9 +163,9 @@ void avrftdi_log(int level, const char * func, int line,
|
||||
}
|
||||
|
||||
/*
|
||||
* helper function to print a binary buffer *buf of size len. begin and end of
|
||||
* the dump are enclosed in the string contained in *desc. offset denotes the
|
||||
* number of bytes which are printed on the first line (may be 0). after that
|
||||
* helper function to print a binary buffer *buf of size len. Begin and end of
|
||||
* the dump are enclosed in the string contained in *desc. Offset denotes the
|
||||
* number of bytes which are printed on the first line (may be 0). After that
|
||||
* width bytes are printed on each line
|
||||
*/
|
||||
static void buf_dump(const unsigned char *buf, int len, char *desc,
|
||||
@@ -356,6 +356,9 @@ static int avrftdi_transmit_bb(PROGRAMMER * pgm, unsigned char mode, const unsig
|
||||
blocksize = MAX(1,(max_size-7)/((8*2*6)+(8*1*2)));
|
||||
//avrdude_message(MSG_INFO, "blocksize %d \n",blocksize);
|
||||
|
||||
unsigned char* send_buffer = alloca((8 * 2 * 6) * blocksize + (8 * 1 * 2) * blocksize + 7);
|
||||
unsigned char* recv_buffer = alloca(2 * 16 * blocksize);
|
||||
|
||||
while(remaining)
|
||||
{
|
||||
|
||||
@@ -364,7 +367,6 @@ static int avrftdi_transmit_bb(PROGRAMMER * pgm, unsigned char mode, const unsig
|
||||
// (8*2) outputs per data byte, 6 transmit bytes per output (SET_BITS_LOW/HIGH),
|
||||
// (8*1) inputs per data byte, 2 transmit bytes per input (GET_BITS_LOW/HIGH),
|
||||
// 1x SEND_IMMEDIATE
|
||||
unsigned char send_buffer[(8*2*6)*transfer_size+(8*1*2)*transfer_size+7];
|
||||
int len = 0;
|
||||
int i;
|
||||
|
||||
@@ -384,7 +386,6 @@ static int avrftdi_transmit_bb(PROGRAMMER * pgm, unsigned char mode, const unsig
|
||||
|
||||
E(ftdi_write_data(pdata->ftdic, send_buffer, len) != len, pdata->ftdic);
|
||||
if (mode & MPSSE_DO_READ) {
|
||||
unsigned char recv_buffer[2*16*transfer_size];
|
||||
int n;
|
||||
int k = 0;
|
||||
do {
|
||||
@@ -531,7 +532,7 @@ static int avrftdi_check_pins_bb(PROGRAMMER * pgm, bool output)
|
||||
/* value for 8/12/16 bit wide interface */
|
||||
int valid_mask = ((1 << pdata->pin_limit) - 1);
|
||||
|
||||
log_debug("Using valid mask bibanging: 0x%08x\n", valid_mask);
|
||||
log_debug("Using valid mask bitbanging: 0x%08x\n", valid_mask);
|
||||
static struct pindef_t valid_pins;
|
||||
valid_pins.mask[0] = valid_mask;
|
||||
valid_pins.inverse[0] = valid_mask ;
|
||||
@@ -556,7 +557,7 @@ static int avrftdi_check_pins_mpsse(PROGRAMMER * pgm, bool output)
|
||||
|
||||
avrftdi_t* pdata = to_pdata(pgm);
|
||||
|
||||
/* SCK/MOSI/MISO are fixed and not invertable?*/
|
||||
/* SCK/MOSI/MISO are fixed and not invertible?*/
|
||||
/* TODO: inverted SCK/MISO/MOSI */
|
||||
static const struct pindef_t valid_pins_SCK = {{0x01},{0x00}} ;
|
||||
static const struct pindef_t valid_pins_MOSI = {{0x02},{0x00}} ;
|
||||
@@ -705,7 +706,7 @@ static int avrftdi_open(PROGRAMMER * pgm, char *port)
|
||||
if(err) {
|
||||
log_err("Error %d occurred: %s\n", err, ftdi_get_error_string(pdata->ftdic));
|
||||
//stupid hack, because avrdude calls pgm->close() even when pgm->open() fails
|
||||
//and usb_dev is intialized to the last usb device from probing
|
||||
//and usb_dev is initialized to the last usb device from probing
|
||||
pdata->ftdic->usb_dev = NULL;
|
||||
return err;
|
||||
} else {
|
||||
@@ -720,7 +721,11 @@ static int avrftdi_open(PROGRAMMER * pgm, char *port)
|
||||
/* set SPI mode */
|
||||
E(ftdi_set_bitmode(pdata->ftdic, 0, BITMODE_RESET) < 0, pdata->ftdic);
|
||||
E(ftdi_set_bitmode(pdata->ftdic, pdata->pin_direction & 0xff, BITMODE_MPSSE) < 0, pdata->ftdic);
|
||||
#ifdef HAVE_FTDI_TCIOFLUSH
|
||||
E(ftdi_tcioflush(pdata->ftdic), pdata->ftdic);
|
||||
#else
|
||||
E(ftdi_usb_purge_buffers(pdata->ftdic), pdata->ftdic);
|
||||
#endif
|
||||
|
||||
write_flush(pdata);
|
||||
|
||||
@@ -757,7 +762,11 @@ static int avrftdi_open(PROGRAMMER * pgm, char *port)
|
||||
pdata->tx_buffer_size = 1024;
|
||||
break;
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#pragma message("No support for 232H, use a newer libftdi, version >= 0.20")
|
||||
#else
|
||||
#warning No support for 232H, use a newer libftdi, version >= 0.20
|
||||
#endif
|
||||
#endif
|
||||
case TYPE_4232H:
|
||||
pdata->pin_limit = 8;
|
||||
@@ -831,7 +840,7 @@ static int avrftdi_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
|
||||
/*setting rst back to 0 */
|
||||
set_pin(pgm, PIN_AVR_RESET, OFF);
|
||||
/*wait at least 20ms bevor issuing spi commands to avr */
|
||||
/*wait at least 20ms before issuing spi commands to avr */
|
||||
usleep(20 * 1000);
|
||||
}
|
||||
|
||||
@@ -840,7 +849,7 @@ static int avrftdi_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
|
||||
static void avrftdi_display(PROGRAMMER * pgm, const char *p)
|
||||
{
|
||||
// print the full pin definitiions as in ft245r ?
|
||||
// print the full pin definitions as in ft245r ?
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -949,10 +958,12 @@ static int avrftdi_eeprom_read(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m,
|
||||
unsigned int page_size, unsigned int addr, unsigned int len)
|
||||
{
|
||||
unsigned char cmd[4];
|
||||
unsigned char buffer[len], *bufptr = buffer;
|
||||
unsigned int add;
|
||||
unsigned char* buffer = alloca(len);
|
||||
unsigned char* bufptr = buffer;
|
||||
|
||||
memset(buffer, 0, len);
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
for (add = addr; add < addr + len; add++)
|
||||
{
|
||||
memset(cmd, 0, sizeof(cmd));
|
||||
@@ -976,13 +987,14 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
|
||||
unsigned int word;
|
||||
unsigned int poll_index;
|
||||
unsigned int buf_size;
|
||||
|
||||
unsigned char poll_byte;
|
||||
unsigned char *buffer = &m->buf[addr];
|
||||
unsigned char buf[4*len+4], *bufptr = buf;
|
||||
unsigned int buf_size = 4 * len + 4;
|
||||
unsigned char* buf = alloca(buf_size);
|
||||
unsigned char* bufptr = buf;
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
memset(buf, 0, buf_size);
|
||||
|
||||
/* pre-check opcodes */
|
||||
if (m->op[AVR_OP_LOADPAGE_LO] == NULL) {
|
||||
@@ -1045,17 +1057,7 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
bufptr += 4;
|
||||
}
|
||||
|
||||
buf_size = bufptr - buf;
|
||||
|
||||
if(verbose > TRACE)
|
||||
buf_dump(buf, buf_size, "command buffer", 0, 16*2);
|
||||
|
||||
log_info("Transmitting buffer of size: %d\n", buf_size);
|
||||
if (0 > avrftdi_transmit(pgm, MPSSE_DO_WRITE, buf, buf, buf_size))
|
||||
return -1;
|
||||
|
||||
bufptr = buf;
|
||||
/* find a poll byte. we cannot poll a value of 0xff, so look
|
||||
/* find a poll byte. We cannot poll a value of 0xff, so look
|
||||
* for a value != 0xff
|
||||
*/
|
||||
for(poll_index = addr+len-1; poll_index > addr-1; poll_index--)
|
||||
@@ -1064,6 +1066,17 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
|
||||
if((poll_index < addr + len) && m->buf[poll_index] != 0xff)
|
||||
{
|
||||
buf_size = bufptr - buf;
|
||||
|
||||
if(verbose > TRACE)
|
||||
buf_dump(buf, buf_size, "command buffer", 0, 16*2);
|
||||
|
||||
log_info("Transmitting buffer of size: %d\n", buf_size);
|
||||
if (0 > avrftdi_transmit(pgm, MPSSE_DO_WRITE, buf, buf, buf_size))
|
||||
return -1;
|
||||
|
||||
bufptr = buf;
|
||||
|
||||
log_info("Using m->buf[%d] = 0x%02x as polling value ", poll_index,
|
||||
m->buf[poll_index]);
|
||||
/* poll page write ready */
|
||||
@@ -1077,9 +1090,7 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
}
|
||||
else
|
||||
{
|
||||
log_warn("No suitable byte (!=0xff) for polling found.\n");
|
||||
log_warn("Trying to sleep instead, but programming errors may occur.\n");
|
||||
log_warn("Be sure to verify programmed memory (no -V option)\n");
|
||||
log_warn("Skipping empty page (containing only 0xff bytes)\n");
|
||||
/* TODO sync write */
|
||||
/* sleep */
|
||||
usleep((m->max_write_delay));
|
||||
@@ -1099,13 +1110,13 @@ static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int use_lext_address = m->op[AVR_OP_LOAD_EXT_ADDR] != NULL;
|
||||
unsigned int address = addr/2;
|
||||
|
||||
unsigned char o_buf[4*len+4];
|
||||
unsigned char i_buf[4*len+4];
|
||||
unsigned int buf_size = 4 * len + 4;
|
||||
unsigned char* o_buf = alloca(buf_size);
|
||||
unsigned char* i_buf = alloca(buf_size);
|
||||
unsigned int index;
|
||||
|
||||
|
||||
memset(o_buf, 0, sizeof(o_buf));
|
||||
memset(i_buf, 0, sizeof(i_buf));
|
||||
memset(o_buf, 0, buf_size);
|
||||
memset(i_buf, 0, buf_size);
|
||||
|
||||
/* pre-check opcodes */
|
||||
if (m->op[AVR_OP_READ_LO] == NULL) {
|
||||
@@ -12,11 +12,14 @@
|
||||
# include <libftdi1/ftdi.h>
|
||||
# undef HAVE_LIBFTDI_TYPE_232H
|
||||
# define HAVE_LIBFTDI_TYPE_232H 1
|
||||
#elif defined(HAVE_LIBFTDI) && defined(HAVE_USB_H)
|
||||
/* ftdi.h includes usb.h */
|
||||
#elif defined(HAVE_LIBFTDI)
|
||||
#include <ftdi.h>
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#pragma message("No libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.")
|
||||
#else
|
||||
#warning No libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.
|
||||
#endif
|
||||
#define DO_NOT_BUILD_AVRFTDI
|
||||
#endif
|
||||
|
||||
@@ -103,11 +103,28 @@ avrftdi_tpi_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
|
||||
#define TPI_PARITY_MASK 0x2000
|
||||
|
||||
static inline int count1s(unsigned int x)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
return __builtin_popcount(x);
|
||||
#else
|
||||
int count = 0;
|
||||
|
||||
while (x)
|
||||
{
|
||||
count += x & 1;
|
||||
x >>= 1;
|
||||
}
|
||||
|
||||
return count;
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
tpi_byte2frame(uint8_t byte)
|
||||
{
|
||||
uint16_t frame = 0xc00f;
|
||||
int parity = __builtin_popcount(byte) & 1;
|
||||
int parity = count1s(byte) & 1;
|
||||
|
||||
frame |= ((byte << 5) & 0x1fe0);
|
||||
|
||||
@@ -123,7 +140,7 @@ tpi_frame2byte(uint16_t frame, uint8_t * byte)
|
||||
/* drop idle and start bit(s) */
|
||||
*byte = (frame >> 5) & 0xff;
|
||||
|
||||
int parity = __builtin_popcount(*byte) & 1;
|
||||
int parity = count1s(*byte) & 1;
|
||||
int parity_rcvd = (frame & TPI_PARITY_MASK) ? 1 : 0;
|
||||
|
||||
return parity != parity_rcvd;
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ac_cfg.h"
|
||||
#include "avrdude.h"
|
||||
#include "libavrdude.h"
|
||||
|
||||
@@ -253,6 +254,22 @@ AVRMEM * avr_new_memtype(void)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
memset(m, 0, sizeof(*m));
|
||||
m->page_size = 1; // ensure not 0
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
AVRMEM_ALIAS * avr_new_memalias(void)
|
||||
{
|
||||
AVRMEM_ALIAS * m;
|
||||
|
||||
m = (AVRMEM_ALIAS *)malloc(sizeof(*m));
|
||||
if (m == NULL) {
|
||||
avrdude_message(MSG_INFO, "avr_new_memalias(): out of memory\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
memset(m, 0, sizeof(*m));
|
||||
|
||||
return m;
|
||||
@@ -324,6 +341,17 @@ AVRMEM * avr_dup_mem(AVRMEM * m)
|
||||
return n;
|
||||
}
|
||||
|
||||
AVRMEM_ALIAS * avr_dup_memalias(AVRMEM_ALIAS * m)
|
||||
{
|
||||
AVRMEM_ALIAS * n;
|
||||
|
||||
n = avr_new_memalias();
|
||||
|
||||
*n = *m;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
void avr_free_mem(AVRMEM * m)
|
||||
{
|
||||
int i;
|
||||
@@ -346,7 +374,36 @@ void avr_free_mem(AVRMEM * m)
|
||||
free(m);
|
||||
}
|
||||
|
||||
AVRMEM * avr_locate_mem(AVRPART * p, char * desc)
|
||||
void avr_free_memalias(AVRMEM_ALIAS * m)
|
||||
{
|
||||
free(m);
|
||||
}
|
||||
|
||||
AVRMEM_ALIAS * avr_locate_memalias(AVRPART * p, char * desc)
|
||||
{
|
||||
AVRMEM_ALIAS * m, * match;
|
||||
LNODEID ln;
|
||||
int matches;
|
||||
int l;
|
||||
|
||||
l = strlen(desc);
|
||||
matches = 0;
|
||||
match = NULL;
|
||||
for (ln=lfirst(p->mem_alias); ln; ln=lnext(ln)) {
|
||||
m = ldata(ln);
|
||||
if (strncmp(desc, m->desc, l) == 0) {
|
||||
match = m;
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
|
||||
if (matches == 1)
|
||||
return match;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AVRMEM * avr_locate_mem_noalias(AVRPART * p, char * desc)
|
||||
{
|
||||
AVRMEM * m, * match;
|
||||
LNODEID ln;
|
||||
@@ -371,38 +428,97 @@ AVRMEM * avr_locate_mem(AVRPART * p, char * desc)
|
||||
}
|
||||
|
||||
|
||||
void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, int type,
|
||||
int verbose)
|
||||
AVRMEM * avr_locate_mem(AVRPART * p, char * desc)
|
||||
{
|
||||
AVRMEM * m, * match;
|
||||
AVRMEM_ALIAS * alias;
|
||||
LNODEID ln;
|
||||
int matches;
|
||||
int l;
|
||||
|
||||
l = strlen(desc);
|
||||
matches = 0;
|
||||
match = NULL;
|
||||
for (ln=lfirst(p->mem); ln; ln=lnext(ln)) {
|
||||
m = ldata(ln);
|
||||
if (strncmp(desc, m->desc, l) == 0) {
|
||||
match = m;
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
|
||||
if (matches == 1)
|
||||
return match;
|
||||
|
||||
/* not yet found: look for matching alias name */
|
||||
alias = avr_locate_memalias(p, desc);
|
||||
if (alias != NULL)
|
||||
return alias->aliased_mem;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AVRMEM_ALIAS * avr_find_memalias(AVRPART * p, AVRMEM * m_orig)
|
||||
{
|
||||
AVRMEM_ALIAS * m;
|
||||
LNODEID ln;
|
||||
|
||||
for (ln=lfirst(p->mem_alias); ln; ln=lnext(ln)) {
|
||||
m = ldata(ln);
|
||||
if (m->aliased_mem == m_orig)
|
||||
return m;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p,
|
||||
int type, int verbose)
|
||||
{
|
||||
static unsigned int prev_mem_offset, prev_mem_size;
|
||||
int i, j;
|
||||
char * optr;
|
||||
|
||||
if (m == NULL) {
|
||||
fprintf(f,
|
||||
"%s Block Poll Page Polled\n"
|
||||
"%sMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack\n"
|
||||
"%s----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------\n",
|
||||
"%s Block Poll Page Polled\n"
|
||||
"%sMemory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack\n"
|
||||
"%s----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------\n",
|
||||
prefix, prefix, prefix);
|
||||
}
|
||||
else {
|
||||
if (verbose > 2) {
|
||||
fprintf(f,
|
||||
"%s Block Poll Page Polled\n"
|
||||
"%sMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack\n"
|
||||
"%s----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------\n",
|
||||
"%s Block Poll Page Polled\n"
|
||||
"%sMemory Type Alias Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack\n"
|
||||
"%s----------- -------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------\n",
|
||||
prefix, prefix, prefix);
|
||||
}
|
||||
fprintf(f,
|
||||
"%s%-11s %4d %5d %5d %4d %-6s %6d %4d %6d %5d %5d 0x%02x 0x%02x\n",
|
||||
prefix, m->desc, m->mode, m->delay, m->blocksize, m->pollindex,
|
||||
m->paged ? "yes" : "no",
|
||||
m->size,
|
||||
m->page_size,
|
||||
m->num_pages,
|
||||
m->min_write_delay,
|
||||
m->max_write_delay,
|
||||
m->readback[0],
|
||||
m->readback[1]);
|
||||
|
||||
// Only print memory section if the previous section printed isn't identical
|
||||
if(prev_mem_offset != m->offset || prev_mem_size != m->size || (strcmp(p->family_id, "") == 0)) {
|
||||
prev_mem_offset = m->offset;
|
||||
prev_mem_size = m->size;
|
||||
AVRMEM_ALIAS *ap = avr_find_memalias(p, m);
|
||||
/* Show alias if the current and the next memory section has the same offset
|
||||
and size, we're not out of band and a family_id is present */
|
||||
char * mem_desc_alias = ap? ap->desc: "";
|
||||
fprintf(f,
|
||||
"%s%-11s %-8s %4d %5d %5d %4d %-6s %6d %4d %6d %5d %5d 0x%02x 0x%02x\n",
|
||||
prefix,
|
||||
m->desc,
|
||||
mem_desc_alias,
|
||||
m->mode, m->delay, m->blocksize, m->pollindex,
|
||||
m->paged ? "yes" : "no",
|
||||
m->size,
|
||||
m->page_size,
|
||||
m->num_pages,
|
||||
m->min_write_delay,
|
||||
m->max_write_delay,
|
||||
m->readback[0],
|
||||
m->readback[1]);
|
||||
}
|
||||
if (verbose > 4) {
|
||||
avrdude_message(MSG_TRACE2, "%s Memory Ops:\n"
|
||||
"%s Oeration Inst Bit Bit Type Bitno Value\n"
|
||||
@@ -459,6 +575,7 @@ AVRPART * avr_new_part(void)
|
||||
p->ocdrev = -1;
|
||||
|
||||
p->mem = lcreat(NULL, 0);
|
||||
p->mem_alias = lcreat(NULL, 0);
|
||||
|
||||
return p;
|
||||
}
|
||||
@@ -467,19 +584,35 @@ AVRPART * avr_new_part(void)
|
||||
AVRPART * avr_dup_part(AVRPART * d)
|
||||
{
|
||||
AVRPART * p;
|
||||
LISTID save;
|
||||
LNODEID ln;
|
||||
LISTID save, save2;
|
||||
LNODEID ln, ln2;
|
||||
int i;
|
||||
|
||||
p = avr_new_part();
|
||||
save = p->mem;
|
||||
save2 = p->mem_alias;
|
||||
|
||||
*p = *d;
|
||||
|
||||
p->mem = save;
|
||||
p->mem_alias = save2;
|
||||
|
||||
for (ln=lfirst(d->mem); ln; ln=lnext(ln)) {
|
||||
ladd(p->mem, avr_dup_mem(ldata(ln)));
|
||||
AVRMEM *m = ldata(ln);
|
||||
AVRMEM *m2 = avr_dup_mem(m);
|
||||
ladd(p->mem, m2);
|
||||
// see if there is any alias for it
|
||||
for (ln2=lfirst(d->mem_alias); ln2; ln2=lnext(ln2)) {
|
||||
AVRMEM_ALIAS *a = ldata(ln2);
|
||||
if (a->aliased_mem == m) {
|
||||
// yes, duplicate it
|
||||
AVRMEM_ALIAS *a2 = avr_dup_memalias(a);
|
||||
// ... adjust the pointer ...
|
||||
a2->aliased_mem = m2;
|
||||
// ... and add to new list
|
||||
ladd(p->mem_alias, a2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < AVR_OP_MAX; i++) {
|
||||
@@ -494,6 +627,8 @@ void avr_free_part(AVRPART * d)
|
||||
int i;
|
||||
ldestroy_cb(d->mem, (void(*)(void *))avr_free_mem);
|
||||
d->mem = NULL;
|
||||
ldestroy_cb(d->mem_alias, (void(*)(void *))avr_free_memalias);
|
||||
d->mem_alias = NULL;
|
||||
for(i=0;i<sizeof(d->op)/sizeof(d->op[0]);i++)
|
||||
{
|
||||
if (d->op[i] != NULL)
|
||||
@@ -620,40 +755,33 @@ void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose)
|
||||
LNODEID ln;
|
||||
AVRMEM * m;
|
||||
|
||||
fprintf(f,
|
||||
"%sAVR Part : %s\n"
|
||||
"%sChip Erase delay : %d us\n"
|
||||
"%sPAGEL : P%02X\n"
|
||||
"%sBS2 : P%02X\n"
|
||||
"%sRESET disposition : %s\n"
|
||||
"%sRETRY pulse : %s\n"
|
||||
"%sserial program mode : %s\n"
|
||||
"%sparallel program mode : %s\n"
|
||||
"%sTimeout : %d\n"
|
||||
"%sStabDelay : %d\n"
|
||||
"%sCmdexeDelay : %d\n"
|
||||
"%sSyncLoops : %d\n"
|
||||
"%sByteDelay : %d\n"
|
||||
"%sPollIndex : %d\n"
|
||||
"%sPollValue : 0x%02x\n"
|
||||
"%sMemory Detail :\n\n",
|
||||
prefix, p->desc,
|
||||
prefix, p->chip_erase_delay,
|
||||
prefix, p->pagel,
|
||||
prefix, p->bs2,
|
||||
prefix, reset_disp_str(p->reset_disposition),
|
||||
prefix, avr_pin_name(p->retry_pulse),
|
||||
prefix, (p->flags & AVRPART_SERIALOK) ? "yes" : "no",
|
||||
prefix, (p->flags & AVRPART_PARALLELOK) ?
|
||||
((p->flags & AVRPART_PSEUDOPARALLEL) ? "psuedo" : "yes") : "no",
|
||||
prefix, p->timeout,
|
||||
prefix, p->stabdelay,
|
||||
prefix, p->cmdexedelay,
|
||||
prefix, p->synchloops,
|
||||
prefix, p->bytedelay,
|
||||
prefix, p->pollindex,
|
||||
prefix, p->pollvalue,
|
||||
prefix);
|
||||
fprintf( f, "%sAVR Part : %s\n", prefix, p->desc);
|
||||
if (p->chip_erase_delay)
|
||||
fprintf(f, "%sChip Erase delay : %d us\n", prefix, p->chip_erase_delay);
|
||||
if (p->pagel)
|
||||
fprintf(f, "%sPAGEL : P%02X\n", prefix, p->pagel);
|
||||
if (p->bs2)
|
||||
fprintf(f, "%sBS2 : P%02X\n", prefix, p->bs2);
|
||||
fprintf( f, "%sRESET disposition : %s\n", prefix, reset_disp_str(p->reset_disposition));
|
||||
fprintf( f, "%sRETRY pulse : %s\n", prefix, avr_pin_name(p->retry_pulse));
|
||||
fprintf( f, "%sSerial program mode : %s\n", prefix, (p->flags & AVRPART_SERIALOK) ? "yes" : "no");
|
||||
fprintf( f, "%sParallel program mode : %s\n", prefix, (p->flags & AVRPART_PARALLELOK) ?
|
||||
((p->flags & AVRPART_PSEUDOPARALLEL) ? "pseudo" : "yes") : "no");
|
||||
if(p->timeout)
|
||||
fprintf(f, "%sTimeout : %d\n", prefix, p->timeout);
|
||||
if(p->stabdelay)
|
||||
fprintf(f, "%sStabDelay : %d\n", prefix, p->stabdelay);
|
||||
if(p->cmdexedelay)
|
||||
fprintf(f, "%sCmdexeDelay : %d\n", prefix, p->cmdexedelay);
|
||||
if(p->synchloops)
|
||||
fprintf(f, "%sSyncLoops : %d\n", prefix, p->synchloops);
|
||||
if(p->bytedelay)
|
||||
fprintf(f, "%sByteDelay : %d\n", prefix, p->bytedelay);
|
||||
if(p->pollindex)
|
||||
fprintf(f, "%sPollIndex : %d\n", prefix, p->pollindex);
|
||||
if(p->pollvalue)
|
||||
fprintf(f, "%sPollValue : 0x%02x\n", prefix, p->pollvalue);
|
||||
fprintf( f, "%sMemory Detail :\n\n", prefix);
|
||||
|
||||
px = prefix;
|
||||
i = strlen(prefix) + 5;
|
||||
@@ -668,11 +796,11 @@ void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose)
|
||||
}
|
||||
|
||||
if (verbose <= 2) {
|
||||
avr_mem_display(px, f, NULL, 0, verbose);
|
||||
avr_mem_display(px, f, NULL, p, 0, verbose);
|
||||
}
|
||||
for (ln=lfirst(p->mem); ln; ln=lnext(ln)) {
|
||||
m = ldata(ln);
|
||||
avr_mem_display(px, f, m, i, verbose);
|
||||
avr_mem_display(px, f, m, p, i, verbose);
|
||||
}
|
||||
|
||||
if (buf)
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2000, 2001, 2002, 2003 Brian S. Dean <bsd@bsdhome.com>
|
||||
* Copyright (C) 2005 Michael Holzt <kju-avr@fqdn.org>
|
||||
* Copyright (C) 2005 Juliane Holzt <avrdude@juliane.holzt.de>
|
||||
* Copyright (C) 2011 Darell Tan <darell.tan@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -17,7 +17,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* $Id$ */
|
||||
/* $Id$ */
|
||||
|
||||
#include "ac_cfg.h"
|
||||
|
||||
@@ -28,9 +28,12 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if !defined(WIN32NATIVE)
|
||||
# include <signal.h>
|
||||
# include <sys/time.h>
|
||||
#if defined(WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <signal.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include "avrdude.h"
|
||||
@@ -43,7 +46,7 @@
|
||||
|
||||
static int delay_decrement;
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
#if defined(WIN32)
|
||||
static int has_perfcount;
|
||||
static LARGE_INTEGER freq;
|
||||
#else
|
||||
@@ -57,14 +60,14 @@ static void alarmhandler(int signo)
|
||||
done = 1;
|
||||
signal(SIGALRM, saved_alarmhandler);
|
||||
}
|
||||
#endif /* WIN32NATIVE */
|
||||
#endif /* WIN32 */
|
||||
|
||||
/*
|
||||
* Calibrate the microsecond delay loop below.
|
||||
*/
|
||||
static void bitbang_calibrate_delay(void)
|
||||
{
|
||||
#if defined(WIN32NATIVE)
|
||||
#if defined(WIN32)
|
||||
/*
|
||||
* If the hardware supports a high-resolution performance counter,
|
||||
* we ultimately prefer that one, as it gives quite accurate delays
|
||||
@@ -91,7 +94,7 @@ static void bitbang_calibrate_delay(void)
|
||||
progname);
|
||||
delay_decrement = 100;
|
||||
}
|
||||
#else /* !WIN32NATIVE */
|
||||
#else /* !WIN32 */
|
||||
struct itimerval itv;
|
||||
volatile int i;
|
||||
|
||||
@@ -124,7 +127,7 @@ static void bitbang_calibrate_delay(void)
|
||||
delay_decrement = -i / 100000;
|
||||
avrdude_message(MSG_NOTICE2, " calibrated to %d cycles per us\n",
|
||||
delay_decrement);
|
||||
#endif /* WIN32NATIVE */
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -134,7 +137,7 @@ static void bitbang_calibrate_delay(void)
|
||||
*/
|
||||
void bitbang_delay(unsigned int us)
|
||||
{
|
||||
#if defined(WIN32NATIVE)
|
||||
#if defined(WIN32)
|
||||
LARGE_INTEGER countNow, countEnd;
|
||||
|
||||
if (has_perfcount)
|
||||
@@ -147,14 +150,14 @@ void bitbang_delay(unsigned int us)
|
||||
}
|
||||
else /* no performance counters -- run normal uncalibrated delay */
|
||||
{
|
||||
#endif /* WIN32NATIVE */
|
||||
#endif /* WIN32 */
|
||||
volatile unsigned int del = us * delay_decrement;
|
||||
|
||||
while (del > 0)
|
||||
del--;
|
||||
#if defined(WIN32NATIVE)
|
||||
#if defined(WIN32)
|
||||
}
|
||||
#endif /* WIN32NATIVE */
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -542,7 +545,10 @@ int bitbang_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
|
||||
/* bring RESET high first */
|
||||
pgm->setpin(pgm, PIN_AVR_RESET, 1);
|
||||
usleep(1000);
|
||||
usleep(128000); /* wait t_TOUT (32-128ms) */
|
||||
|
||||
/* RESET must be LOW in case the existing code is driving the TPI pins: */
|
||||
pgm->setpin(pgm, PIN_AVR_RESET, 0);
|
||||
|
||||
avrdude_message(MSG_NOTICE2, "doing MOSI-MISO link check\n");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2000, 2001, 2002, 2003 Brian S. Dean <bsd@bsdhome.com>
|
||||
* Copyright (C) 2005 Michael Holzt <kju-avr@fqdn.org>
|
||||
* Copyright (C) 2005 Juliane Holzt <avrdude@juliane.holzt.de>
|
||||
* Copyright (C) 2011 Darell Tan <darell.tan@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -13,7 +13,11 @@ set -x
|
||||
|
||||
rm -rf autom4te.cache
|
||||
|
||||
libtoolize
|
||||
# MacOS calls it "glibtoolize", everyone else "libtoolize"
|
||||
# probe for that
|
||||
LIBTOOLIZE=libtoolize
|
||||
glibtoolize --version > /dev/null 2>&1 && LIBTOOLIZE=glibtoolize
|
||||
${LIBTOOLIZE}
|
||||
|
||||
${ACLOCAL}
|
||||
${AUTOHEADER}
|
||||
@@ -41,9 +41,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#if defined(WIN32NATIVE)
|
||||
# include <malloc.h> /* for alloca() */
|
||||
#endif
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "libavrdude.h"
|
||||
@@ -178,6 +175,7 @@ static int buspirate_getc(struct programmer_t *pgm)
|
||||
static char *buspirate_readline_noexit(struct programmer_t *pgm, char *buf, size_t len)
|
||||
{
|
||||
char *buf_p;
|
||||
int c;
|
||||
long orig_serial_recv_timeout = serial_recv_timeout;
|
||||
|
||||
/* Static local buffer - this may come handy at times */
|
||||
@@ -190,12 +188,12 @@ static char *buspirate_readline_noexit(struct programmer_t *pgm, char *buf, size
|
||||
buf_p = buf;
|
||||
memset(buf, 0, len);
|
||||
while (buf_p < (buf + len - 1)) { /* keep the very last byte == 0 */
|
||||
*buf_p = buspirate_getc(pgm);
|
||||
if (*buf_p == '\r')
|
||||
*buf_p = c = buspirate_getc(pgm);
|
||||
if (c == '\r')
|
||||
continue;
|
||||
if (*buf_p == '\n')
|
||||
if (c == '\n')
|
||||
break;
|
||||
if (*buf_p == EOF) {
|
||||
if (c == EOF) {
|
||||
*buf_p = '\0';
|
||||
break;
|
||||
}
|
||||
@@ -427,7 +425,8 @@ static int buspirate_open(struct programmer_t *pgm, char * port)
|
||||
if(pgm->baudrate == 0)
|
||||
pgm->baudrate = 115200;
|
||||
|
||||
pinfo.baud = pgm->baudrate;
|
||||
pinfo.serialinfo.baud = pgm->baudrate;
|
||||
pinfo.serialinfo.cflags = SERIAL_8N1;
|
||||
strcpy(pgm->port, port);
|
||||
if (serial_open(port, pinfo, &pgm->fd)==-1) {
|
||||
return -1;
|
||||
@@ -493,35 +492,31 @@ static void buspirate_reset_from_binmode(struct programmer_t *pgm)
|
||||
|
||||
static int buspirate_start_mode_bin(struct programmer_t *pgm)
|
||||
{
|
||||
const struct submode {
|
||||
struct submode {
|
||||
const char *name; /* Name of mode for user messages */
|
||||
char enter; /* Command to enter from base binary mode */
|
||||
const char *entered_format; /* Response, for "scanf" */
|
||||
char config; /* Command to setup submode parameters */
|
||||
} *submode;
|
||||
} submode;
|
||||
|
||||
if (pgm->flag & BP_FLAG_XPARM_RAWFREQ) {
|
||||
submode = &(const struct submode){
|
||||
.name = "Raw-wire",
|
||||
.enter = 0x05,
|
||||
.entered_format = "RAW%1d",
|
||||
.config = 0x8C,
|
||||
};
|
||||
submode.name = "Raw-wire";
|
||||
submode.enter = 0x05;
|
||||
submode.entered_format = "RAW%1d";
|
||||
submode.config = 0x8C;
|
||||
pgm->flag |= BP_FLAG_NOPAGEDWRITE;
|
||||
pgm->flag |= BP_FLAG_NOPAGEDREAD;
|
||||
} else {
|
||||
submode = &(const struct submode){
|
||||
.name = "SPI",
|
||||
.enter = 0x01,
|
||||
.entered_format = "SPI%1d",
|
||||
|
||||
/* 1000wxyz - SPI config, w=HiZ(0)/3.3v(1), x=CLK idle, y=CLK edge, z=SMP sample
|
||||
* we want: 3.3V(1), idle low(0), data change on
|
||||
* trailing edge (1), sample in the middle
|
||||
* of the pulse (0)
|
||||
* => 0b10001010 = 0x8a */
|
||||
.config = 0x8A,
|
||||
};
|
||||
submode.name = "SPI";
|
||||
submode.enter = 0x01;
|
||||
submode.entered_format = "SPI%1d";
|
||||
|
||||
/* 1000wxyz - SPI config, w=HiZ(0)/3.3v(1), x=CLK idle, y=CLK edge, z=SMP sample
|
||||
* we want: 3.3V(1), idle low(0), data change on
|
||||
* trailing edge (1), sample in the middle
|
||||
* of the pulse (0)
|
||||
* => 0b10001010 = 0x8a */
|
||||
submode.config = 0x8A;
|
||||
}
|
||||
|
||||
unsigned char buf[20] = { '\0' };
|
||||
@@ -566,18 +561,18 @@ static int buspirate_start_mode_bin(struct programmer_t *pgm)
|
||||
}
|
||||
|
||||
/* == Set protocol sub-mode of binary mode == */
|
||||
buf[0] = submode->enter;
|
||||
buf[0] = submode.enter;
|
||||
buspirate_send_bin(pgm, buf, 1);
|
||||
memset(buf, 0, sizeof(buf));
|
||||
buspirate_recv_bin(pgm, buf, 4);
|
||||
if (sscanf((const char*)buf, submode->entered_format, &PDATA(pgm)->submode_version) != 1) {
|
||||
if (sscanf((const char*)buf, submode.entered_format, &PDATA(pgm)->submode_version) != 1) {
|
||||
avrdude_message(MSG_INFO, "%s mode not confirmed: '%s'\n",
|
||||
submode->name, buf);
|
||||
submode.name, buf);
|
||||
buspirate_reset_from_binmode(pgm);
|
||||
return -1;
|
||||
}
|
||||
avrdude_message(MSG_NOTICE, "BusPirate %s version: %d\n",
|
||||
submode->name, PDATA(pgm)->submode_version);
|
||||
submode.name, PDATA(pgm)->submode_version);
|
||||
|
||||
if (pgm->flag & BP_FLAG_NOPAGEDWRITE) {
|
||||
avrdude_message(MSG_NOTICE, "%s: Paged flash write disabled.\n", progname);
|
||||
@@ -618,7 +613,7 @@ static int buspirate_start_mode_bin(struct programmer_t *pgm)
|
||||
return -1;
|
||||
|
||||
/* Submode config */
|
||||
if (buspirate_expect_bin_byte(pgm, submode->config, 0x01) < 0)
|
||||
if (buspirate_expect_bin_byte(pgm, submode.config, 0x01) < 0)
|
||||
return -1;
|
||||
|
||||
/* AVR Extended Commands - test for existence */
|
||||
@@ -801,7 +796,7 @@ static void buspirate_powerup(struct programmer_t *pgm)
|
||||
char buf[25];
|
||||
int ok = 0;
|
||||
snprintf(buf, sizeof(buf), "%d\n", PDATA(pgm)->cpufreq);
|
||||
if (buspirate_expect(pgm, "g\n", "Frequency in KHz", 1)) {
|
||||
if (buspirate_expect(pgm, "g\n", "Frequency in kHz", 1)) {
|
||||
if (buspirate_expect(pgm, buf, "Duty cycle in %", 1)) {
|
||||
if (buspirate_expect(pgm, "50\n", "PWM active", 1)) {
|
||||
ok = 1;
|
||||
@@ -862,7 +857,8 @@ static int buspirate_cmd_ascii(struct programmer_t *pgm,
|
||||
{
|
||||
char buf[25];
|
||||
char *rcvd;
|
||||
int spi_write, spi_read, i = 0;
|
||||
int i = 0;
|
||||
unsigned int spi_write, spi_read;
|
||||
|
||||
snprintf(buf, sizeof(buf), "0x%02x 0x%02x 0x%02x 0x%02x\n",
|
||||
cmd[0], cmd[1], cmd[2], cmd[3]);
|
||||
@@ -391,7 +391,8 @@ static int butterfly_open(PROGRAMMER * pgm, char * port)
|
||||
if(pgm->baudrate == 0) {
|
||||
pgm->baudrate = 19200;
|
||||
}
|
||||
pinfo.baud = pgm->baudrate;
|
||||
pinfo.serialinfo.baud = pgm->baudrate;
|
||||
pinfo.serialinfo.cflags = SERIAL_8N1;
|
||||
if (serial_open(port, pinfo, &pgm->fd)==-1) {
|
||||
return -1;
|
||||
}
|
||||
101
src/cmake_config.h.in
Normal file
101
src/cmake_config.h.in
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2021 Marius Greuel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include "msvc/msvc_compat.h"
|
||||
#endif
|
||||
|
||||
#define VERSION "@AVRDUDE_FULL_VERSION@"
|
||||
|
||||
/* Options */
|
||||
|
||||
/* Linux sysfs GPIO support enabled */
|
||||
#cmakedefine HAVE_LINUXGPIO 1
|
||||
|
||||
/* Linux SPI support enabled */
|
||||
#cmakedefine HAVE_LINUXSPI 1
|
||||
|
||||
/* Parallel port access enabled */
|
||||
#cmakedefine HAVE_PARPORT 1
|
||||
|
||||
/* ----- Functions ----- */
|
||||
|
||||
/* Define if lex/flex has yylex_destroy */
|
||||
#cmakedefine HAVE_YYLEX_DESTROY 1
|
||||
|
||||
/* Define if ftdi1 has 'ftdi_tcioflush' function. */
|
||||
#cmakedefine HAVE_FTDI_TCIOFLUSH 1
|
||||
|
||||
/* ----- Libraries and Headers ----- */
|
||||
|
||||
/* Define to 1 if the system has the type `uint_t'. */
|
||||
#cmakedefine HAVE_UINT_T 1
|
||||
|
||||
/* Define to 1 if the system has the type `ulong_t'. */
|
||||
#cmakedefine HAVE_ULONG_T 1
|
||||
|
||||
/* Define if ELF support is enabled via libelf */
|
||||
#cmakedefine HAVE_LIBELF 1
|
||||
|
||||
/* Define to 1 if you have the <libelf.h> header file. */
|
||||
#cmakedefine HAVE_LIBELF_H 1
|
||||
|
||||
/* Define to 1 if you have the <libelf/libelf.h> header file. */
|
||||
#cmakedefine HAVE_LIBELF_LIBELF_H 1
|
||||
|
||||
/* Define if USB support is enabled via libusb */
|
||||
#cmakedefine HAVE_LIBUSB 1
|
||||
|
||||
/* Define if USB support is enabled via a libusb-1.0 compatible libusb */
|
||||
#cmakedefine HAVE_LIBUSB_1_0 1
|
||||
|
||||
/* Define if USB support is enabled via a libusb-win32 compatible libusb */
|
||||
#cmakedefine HAVE_LIBUSB_WIN32 1
|
||||
|
||||
/* Define to 1 if you have the <usb.h> header file. */
|
||||
#cmakedefine HAVE_USB_H 1
|
||||
|
||||
/* Define to 1 if you have the <lusb0_usb.h> header file. */
|
||||
#cmakedefine HAVE_LUSB0_USB_H 1
|
||||
|
||||
/* Define to 1 if you have the <libusb.h> header file. */
|
||||
#cmakedefine HAVE_LIBUSB_H 1
|
||||
|
||||
/* Define to 1 if you have the <libusb-1.0/libusb.h> header file. */
|
||||
#cmakedefine HAVE_LIBUSB_1_0_LIBUSB_H 1
|
||||
|
||||
/* Define if HID support is enabled via the Win32 DDK */
|
||||
#cmakedefine HAVE_LIBHID 1
|
||||
|
||||
/* Define if HID support is enabled via libhidapi */
|
||||
#cmakedefine HAVE_LIBHIDAPI 1
|
||||
|
||||
/* Define to 1 if you have the <hidapi/hidapi.h> header file. */
|
||||
#cmakedefine HAVE_HIDAPI_HIDAPI_H 1
|
||||
|
||||
/* Define if FTDI support is enabled via libftdi */
|
||||
#cmakedefine HAVE_LIBFTDI 1
|
||||
|
||||
/* Define if FTDI support is enabled via libftdi1 */
|
||||
#cmakedefine HAVE_LIBFTDI1 1
|
||||
|
||||
/* Define if libftdi supports FT232H, libftdi version >= 0.20 */
|
||||
#cmakedefine HAVE_LIBFTDI_TYPE_232H 1
|
||||
|
||||
/* Define to 1 if you have the `readline' library (-lreadline). */
|
||||
#cmakedefine HAVE_LIBREADLINE 1
|
||||
@@ -36,7 +36,6 @@ char default_programmer[MAX_STR_CONST];
|
||||
char default_parallel[PATH_MAX];
|
||||
char default_serial[PATH_MAX];
|
||||
double default_bitclock;
|
||||
int default_safemode;
|
||||
|
||||
char string_buf[MAX_STR_CONST];
|
||||
char *string_buf_ptr;
|
||||
@@ -48,6 +47,7 @@ AVRPART * current_part;
|
||||
AVRMEM * current_mem;
|
||||
LISTID part_list;
|
||||
LISTID programmers;
|
||||
bool is_alias;
|
||||
|
||||
int lineno;
|
||||
const char * infile;
|
||||
@@ -73,6 +73,7 @@ int init_config(void)
|
||||
current_mem = NULL;
|
||||
part_list = lcreat(NULL, 0);
|
||||
programmers = lcreat(NULL, 0);
|
||||
is_alias = false;
|
||||
|
||||
lineno = 1;
|
||||
infile = NULL;
|
||||
@@ -217,6 +218,7 @@ TOKEN * hexnumber(char * text)
|
||||
tkn->value.number = strtoul(text, &e, 16);
|
||||
if ((e == text) || (*e != 0)) {
|
||||
yyerror("can't scan hex number \"%s\"", text);
|
||||
free_token(tkn);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -244,6 +246,7 @@ TOKEN * string(char * text)
|
||||
tkn->value.string = (char *) malloc(len+1);
|
||||
if (tkn->value.string == NULL) {
|
||||
yyerror("string(): out of memory");
|
||||
free_token(tkn);
|
||||
return NULL;
|
||||
}
|
||||
strcpy(tkn->value.string, text);
|
||||
@@ -54,6 +54,7 @@ extern int lineno;
|
||||
extern const char * infile;
|
||||
extern LISTID string_list;
|
||||
extern LISTID number_list;
|
||||
extern bool is_alias; // current entry is alias
|
||||
|
||||
|
||||
#if !defined(HAS_YYSTYPE)
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "libavrdude.h"
|
||||
#include "config.h"
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
#if defined(WIN32)
|
||||
#define strtok_r( _s, _sep, _lasts ) \
|
||||
( *(_lasts) = strtok( (_s), (_sep) ) )
|
||||
#endif
|
||||
@@ -68,6 +68,7 @@ static int pin_name;
|
||||
%token K_PAGE_SIZE
|
||||
%token K_PAGED
|
||||
|
||||
%token K_ALIAS
|
||||
%token K_BAUDRATE
|
||||
%token K_BS2
|
||||
%token K_BUFF
|
||||
@@ -77,9 +78,9 @@ static int pin_name;
|
||||
%token K_DEFAULT_BITCLOCK
|
||||
%token K_DEFAULT_PARALLEL
|
||||
%token K_DEFAULT_PROGRAMMER
|
||||
%token K_DEFAULT_SAFEMODE
|
||||
%token K_DEFAULT_SERIAL
|
||||
%token K_DESC
|
||||
%token K_FAMILY_ID
|
||||
%token K_DEVICECODE
|
||||
%token K_STK500_DEVCODE
|
||||
%token K_AVR910_DEVCODE
|
||||
@@ -96,6 +97,7 @@ static int pin_name;
|
||||
%token K_MOSI
|
||||
%token K_NUM_PAGES
|
||||
%token K_NVM_BASE
|
||||
%token K_OCD_BASE
|
||||
%token K_OCDREV
|
||||
%token K_OFFSET
|
||||
%token K_PAGEL
|
||||
@@ -183,6 +185,7 @@ static int pin_name;
|
||||
%token K_HAS_JTAG /* MCU has JTAG i/f. */
|
||||
%token K_HAS_DW /* MCU has debugWire i/f. */
|
||||
%token K_HAS_PDI /* MCU has PDI i/f rather than ISP (ATxmega). */
|
||||
%token K_HAS_UPDI /* MCU has UPDI i/f (AVR8X). */
|
||||
%token K_HAS_TPI /* MCU has TPI i/f rather than ISP (ATtiny4/5/9/10). */
|
||||
%token K_IDR /* address of OCD register in IO space */
|
||||
%token K_IS_AT90S1200 /* chip is an AT90S1200 (needs special treatment) */
|
||||
@@ -254,14 +257,6 @@ def :
|
||||
K_DEFAULT_BITCLOCK TKN_EQUAL number_real TKN_SEMI {
|
||||
default_bitclock = $3->value.number_real;
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_DEFAULT_SAFEMODE TKN_EQUAL yesno TKN_SEMI {
|
||||
if ($3->primary == K_YES)
|
||||
default_safemode = 1;
|
||||
else if ($3->primary == K_NO)
|
||||
default_safemode = 0;
|
||||
free_token($3);
|
||||
}
|
||||
;
|
||||
|
||||
@@ -282,7 +277,7 @@ prog_def :
|
||||
id = ldata(lfirst(current_prog->id));
|
||||
existing_prog = locate_programmer(programmers, id);
|
||||
if (existing_prog) {
|
||||
{ /* temporarly set lineno to lineno of programmer start */
|
||||
{ /* temporarily set lineno to lineno of programmer start */
|
||||
int temp = lineno; lineno = current_prog->lineno;
|
||||
yywarning("programmer %s overwrites previous definition %s:%d.",
|
||||
id, existing_prog->config_file, existing_prog->lineno);
|
||||
@@ -291,7 +286,7 @@ prog_def :
|
||||
lrmv_d(programmers, existing_prog);
|
||||
pgm_free(existing_prog);
|
||||
}
|
||||
PUSH(programmers, current_prog);
|
||||
LISTADD(programmers, current_prog);
|
||||
// pgm_fill_old_pins(current_prog); // TODO to be removed if old pin data no longer needed
|
||||
// pgm_display_generic(current_prog, id);
|
||||
current_prog = NULL;
|
||||
@@ -374,7 +369,7 @@ part_def :
|
||||
|
||||
existing_part = locate_part(part_list, current_part->id);
|
||||
if (existing_part) {
|
||||
{ /* temporarly set lineno to lineno of part start */
|
||||
{ /* temporarily set lineno to lineno of part start */
|
||||
int temp = lineno; lineno = current_part->lineno;
|
||||
yywarning("part %s overwrites previous definition %s:%d.",
|
||||
current_part->id,
|
||||
@@ -384,7 +379,7 @@ part_def :
|
||||
lrmv_d(part_list, existing_part);
|
||||
avr_free_part(existing_part);
|
||||
}
|
||||
PUSH(part_list, current_part);
|
||||
LISTADD(part_list, current_part);
|
||||
current_part = NULL;
|
||||
}
|
||||
;
|
||||
@@ -669,11 +664,18 @@ part_parm :
|
||||
|
||||
K_DESC TKN_EQUAL TKN_STRING
|
||||
{
|
||||
strncpy(current_part->desc, $3->value.string, AVR_DESCLEN);
|
||||
strncpy(current_part->desc, $3->value.string, AVR_DESCLEN - 1);
|
||||
current_part->desc[AVR_DESCLEN-1] = 0;
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_FAMILY_ID TKN_EQUAL TKN_STRING
|
||||
{
|
||||
strncpy(current_part->family_id, $3->value.string, AVR_FAMILYIDLEN);
|
||||
current_part->family_id[AVR_FAMILYIDLEN] = 0;
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_DEVICECODE TKN_EQUAL TKN_NUMBER {
|
||||
{
|
||||
yyerror("devicecode is deprecated, use "
|
||||
@@ -1062,6 +1064,16 @@ part_parm :
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_HAS_UPDI TKN_EQUAL yesno
|
||||
{
|
||||
if ($3->primary == K_YES)
|
||||
current_part->flags |= AVRPART_HAS_UPDI;
|
||||
else if ($3->primary == K_NO)
|
||||
current_part->flags &= ~AVRPART_HAS_UPDI;
|
||||
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_HAS_TPI TKN_EQUAL yesno
|
||||
{
|
||||
if ($3->primary == K_YES)
|
||||
@@ -1148,6 +1160,12 @@ part_parm :
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_OCD_BASE TKN_EQUAL TKN_NUMBER
|
||||
{
|
||||
current_part->ocd_base = $3->value.number;
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_OCDREV TKN_EQUAL TKN_NUMBER
|
||||
{
|
||||
current_part->ocdrev = $3->value.number;
|
||||
@@ -1214,7 +1232,7 @@ part_parm :
|
||||
free_token($2);
|
||||
YYABORT;
|
||||
}
|
||||
strncpy(current_mem->desc, $2->value.string, AVR_MEMDESCLEN);
|
||||
strncpy(current_mem->desc, $2->value.string, AVR_MEMDESCLEN - 1);
|
||||
current_mem->desc[AVR_MEMDESCLEN-1] = 0;
|
||||
free_token($2);
|
||||
}
|
||||
@@ -1222,12 +1240,17 @@ part_parm :
|
||||
{
|
||||
AVRMEM * existing_mem;
|
||||
|
||||
existing_mem = avr_locate_mem(current_part, current_mem->desc);
|
||||
existing_mem = avr_locate_mem_noalias(current_part, current_mem->desc);
|
||||
if (existing_mem != NULL) {
|
||||
lrmv_d(current_part->mem, existing_mem);
|
||||
avr_free_mem(existing_mem);
|
||||
}
|
||||
ladd(current_part->mem, current_mem);
|
||||
if (is_alias) {
|
||||
avr_free_mem(current_mem); // alias mem has been already entered below
|
||||
is_alias = false;
|
||||
} else {
|
||||
ladd(current_part->mem, current_mem);
|
||||
}
|
||||
current_mem = NULL;
|
||||
} |
|
||||
|
||||
@@ -1264,6 +1287,7 @@ yesno :
|
||||
|
||||
mem_specs :
|
||||
mem_spec TKN_SEMI |
|
||||
mem_alias TKN_SEMI |
|
||||
mem_specs mem_spec TKN_SEMI
|
||||
;
|
||||
|
||||
@@ -1284,7 +1308,13 @@ mem_spec :
|
||||
|
||||
K_PAGE_SIZE TKN_EQUAL TKN_NUMBER
|
||||
{
|
||||
current_mem->page_size = $3->value.number;
|
||||
int ps = $3->value.number;
|
||||
if (ps <= 0)
|
||||
avrdude_message(MSG_INFO,
|
||||
"%s, line %d: invalid page size %d, ignored\n",
|
||||
infile, lineno, ps);
|
||||
else
|
||||
current_mem->page_size = ps;
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
@@ -1387,6 +1417,38 @@ mem_spec :
|
||||
}
|
||||
;
|
||||
|
||||
mem_alias :
|
||||
K_ALIAS TKN_STRING
|
||||
{
|
||||
AVRMEM * existing_mem;
|
||||
|
||||
existing_mem = avr_locate_mem(current_part, $2->value.string);
|
||||
if (existing_mem == NULL) {
|
||||
yyerror("%s alias to non-existent memory %s",
|
||||
current_mem->desc, $2->value.string);
|
||||
free_token($2);
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
// if this alias does already exist, drop the old one
|
||||
AVRMEM_ALIAS * alias = avr_locate_memalias(current_part, current_mem->desc);
|
||||
if (alias) {
|
||||
lrmv_d(current_part->mem_alias, alias);
|
||||
avr_free_memalias(alias);
|
||||
}
|
||||
|
||||
is_alias = true;
|
||||
alias = avr_new_memalias();
|
||||
|
||||
// alias->desc and current_mem->desc have the same length
|
||||
// definition, thus no need to check for length here
|
||||
strcpy(alias->desc, current_mem->desc);
|
||||
alias->aliased_mem = existing_mem;
|
||||
ladd(current_part->mem_alias, alias);
|
||||
|
||||
free_token($2);
|
||||
}
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
@@ -23,19 +23,21 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.60)
|
||||
AC_INIT(avrdude, 6.3, avrdude-dev@nongnu.org)
|
||||
AC_INIT(avrdude, 7.0, avrdude-dev@nongnu.org)
|
||||
|
||||
AC_CANONICAL_BUILD
|
||||
AC_CANONICAL_HOST
|
||||
AC_CANONICAL_TARGET
|
||||
|
||||
AC_CONFIG_SRCDIR([main.c])
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_INIT_AUTOMAKE([foreign])
|
||||
AC_CONFIG_HEADERS(ac_cfg.h)
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
LT_INIT()
|
||||
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
@@ -113,10 +115,22 @@ if test x$have_libusb = xyes; then
|
||||
fi
|
||||
AC_SUBST(LIBUSB, $LIBUSB)
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
[libusb_1_0],
|
||||
AC_HELP_STRING(
|
||||
[--disable-libusb_1_0],
|
||||
[Allow to build with libusb instead of libusb_1_0 if both are present]),
|
||||
[case "${enableval}" in
|
||||
yes) enabled_libusb_1_0=yes ;;
|
||||
no) enabled_libusb_1_0=no ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for enable-libusb_1_0 option) ;;
|
||||
esac],
|
||||
[enabled_libusb_1_0=yes])
|
||||
|
||||
AH_TEMPLATE([HAVE_LIBUSB_1_0],
|
||||
[Define if USB support is enabled via libusb 1.0])
|
||||
AC_CHECK_LIB([usb-1.0], [libusb_init], [have_libusb_1_0=yes])
|
||||
if test x$have_libusb_1_0 = xyes; then
|
||||
if test x$have_libusb_1_0 = xyes && test x$enabled_libusb_1_0 = xyes; then
|
||||
case $target in
|
||||
*-*-darwin*)
|
||||
LIBUSB_1_0="-lusb-1.0 -framework CoreFoundation -framework IOKit"
|
||||
@@ -132,7 +146,7 @@ fi
|
||||
AH_TEMPLATE([HAVE_LIBUSB_1_0],
|
||||
[Define if USB support is enabled via a libusb-1.0 compatible libusb])
|
||||
AC_CHECK_LIB([usb], [libusb_init], [have_libusb_1_0=yes])
|
||||
if test x$have_libusb_1_0 = xyes; then
|
||||
if test x$have_libusb_1_0 = xyes && test x$enabled_libusb_1_0 = xyes; then
|
||||
case $target in
|
||||
*-*-freebsd*)
|
||||
# FreeBSD 8+ has a native libusb-1.0 API compatible
|
||||
@@ -150,18 +164,39 @@ if test x$have_libusb_1_0 = xyes; then
|
||||
AC_CHECK_HEADERS([libusb.h])
|
||||
fi
|
||||
AC_SUBST(LIBUSB_1_0, $LIBUSB_1_0)
|
||||
|
||||
AH_TEMPLATE([HAVE_LIBHIDAPI],
|
||||
[Define if HID support is enabled via libhidapi])
|
||||
AC_SEARCH_LIBS([hid_init], [hidapi hidapi-libusb hidapi-hidraw], [have_libhidapi=yes])
|
||||
if test x$have_libhidapi = xyes; then
|
||||
case $target in
|
||||
*-*-darwin*)
|
||||
LIBHIDAPI="-lhidapi -iframework CoreFoundation -framework IOKit"
|
||||
;;
|
||||
*)
|
||||
LIBHIDAPI="$ac_cv_lib_hid_init"
|
||||
;;
|
||||
esac
|
||||
AC_DEFINE([HAVE_LIBHIDAPI])
|
||||
AC_CHECK_HEADERS([hidapi/hidapi.h])
|
||||
fi
|
||||
AC_SUBST(LIBHIDAPI, $LIBHIDAPI)
|
||||
|
||||
|
||||
AH_TEMPLATE([HAVE_LIBFTDI1],
|
||||
[Define if FTDI support is enabled via libftdi1])
|
||||
AH_TEMPLATE([HAVE_LIBFTDI],
|
||||
[Define if FTDI support is enabled via libftdi])
|
||||
AH_TEMPLATE([HAVE_LIBFTDI_TYPE_232H],
|
||||
[Define if libftdi supports FT232H, libftdi version >= 0.20])
|
||||
AC_CHECK_LIB([ftdi1], [ftdi_new], [have_libftdi1=yes], [], [-lusb-1.0])
|
||||
AC_CHECK_LIB([ftdi1], [ftdi_new], [have_libftdi1=yes], [], [$LIBUSB_1_0])
|
||||
AC_CHECK_LIB([ftdi], [ftdi_usb_get_strings], [have_libftdi=yes], [], [-lusb])
|
||||
if test x$have_libftdi1 = xyes; then
|
||||
LIBFTDI1="-lftdi1"
|
||||
AC_DEFINE([HAVE_LIBFTDI1])
|
||||
AC_SUBST(LIBFTDI1, $LIBFTDI1)
|
||||
LIBS="${LIBS} ${LIBFTDI1}"
|
||||
AC_CHECK_FUNCS(ftdi_tcioflush)
|
||||
else
|
||||
if test x$have_libftdi = xyes; then
|
||||
LIBFTDI="-lftdi -lusb"
|
||||
@@ -191,23 +226,17 @@ AC_CHECK_HEADERS([ddk/hidsdi.h],,,[#include <windows.h>
|
||||
AC_C_CONST
|
||||
AC_HEADER_TIME
|
||||
|
||||
# WinSock2
|
||||
AC_CHECK_LIB([ws2_32], [puts])
|
||||
AC_CHECK_HEADERS([netinet/in.h])
|
||||
|
||||
# Checks for library functions.
|
||||
AC_CHECK_FUNCS([memset select strcasecmp strdup strerror strncasecmp strtol strtoul gettimeofday usleep])
|
||||
AC_CHECK_FUNCS([memset select strcasecmp strdup strerror strncasecmp strtol strtoul gettimeofday usleep getaddrinfo])
|
||||
|
||||
AC_MSG_CHECKING([for a Win32 HID libray])
|
||||
AC_MSG_CHECKING([for a Win32 HID library])
|
||||
SAVED_LIBS="${LIBS}"
|
||||
case $target in
|
||||
*-*-mingw32* | *-*-cygwin* | *-*-windows*)
|
||||
LIBHID="-lhid -lsetupapi"
|
||||
if test $ac_cv_header_ddk_hidsdi_h = yes
|
||||
then
|
||||
HIDINCLUDE="#include <ddk/hidsdi.h>"
|
||||
else
|
||||
HIDINCLUDE="#include \"my_ddk_hidsdi.h\""
|
||||
fi
|
||||
HIDINCLUDE="#include <hidsdi.h>"
|
||||
;;
|
||||
*)
|
||||
LIBHID=""
|
||||
@@ -287,7 +316,7 @@ AC_ARG_ENABLE(
|
||||
no) enabled_parport=no ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for enable-parport option) ;;
|
||||
esac],
|
||||
[enabled_parport=yes])
|
||||
[enabled_parport=no])
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
[linuxgpio],
|
||||
@@ -301,7 +330,19 @@ AC_ARG_ENABLE(
|
||||
esac],
|
||||
[enabled_linuxgpio=no])
|
||||
|
||||
DIST_SUBDIRS_AC='doc windows'
|
||||
AC_ARG_ENABLE(
|
||||
[linuxspi],
|
||||
AC_HELP_STRING(
|
||||
[--enable-linuxspi],
|
||||
[Enable the Linux SPIDEV interface programmer type]),
|
||||
[case "${enableval}" in
|
||||
yes) enabled_linuxspi=yes ;;
|
||||
no) enabled_linuxspi=no ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for enable-linuxspi option) ;;
|
||||
esac],
|
||||
[enabled_linuxspi=no])
|
||||
|
||||
DIST_SUBDIRS_AC='doc'
|
||||
|
||||
if test "$enabled_doc" = "yes"; then
|
||||
SUBDIRS_AC='doc'
|
||||
@@ -378,7 +419,15 @@ else
|
||||
fi
|
||||
|
||||
|
||||
# If we are compiling with gcc, enable all warning and make warnings errors.
|
||||
if test "$enabled_linuxspi" = "yes"; then
|
||||
AC_DEFINE(HAVE_LINUXSPI, 1, [Linux SPI support enabled])
|
||||
confsubst="$confsubst -e /^@HAVE_LINUXSPI_/d"
|
||||
else
|
||||
confsubst="$confsubst -e /^@HAVE_LINUXSPI_BEGIN@/,/^@HAVE_LINUXSPI_END@/d"
|
||||
fi
|
||||
|
||||
|
||||
# If we are compiling with gcc, enable all warnings and make warnings errors.
|
||||
if test "$GCC" = yes; then
|
||||
ENABLE_WARNINGS="-Wall"
|
||||
|
||||
@@ -450,22 +499,19 @@ case $target in
|
||||
LDFLAGS="${LDFLAGS} -static"
|
||||
fi
|
||||
|
||||
WINDOWS_DIRS="windows"
|
||||
CFLAGS="${CFLAGS} -DWIN32NATIVE"
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(WINDOWS_DIRS,$WINDOWS_DIRS)
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
doc/Makefile
|
||||
windows/Makefile
|
||||
avrdude.spec
|
||||
Makefile
|
||||
])
|
||||
|
||||
# The procedure to create avrdude.conf involves two steps. First,
|
||||
# normal autoconf substitution will be applied, resulting in
|
||||
# avrdude.conf.tmp. Finally, a sed command will be applied to filter
|
||||
# avrdude.conf.tmp. Finally, a sed command will be applied to filter
|
||||
# out unwanted parts (currently the parallel port programmer types)
|
||||
# based on previous configuration results, thereby producing the final
|
||||
# avrdude.conf file.
|
||||
@@ -494,7 +540,11 @@ else
|
||||
fi
|
||||
|
||||
if test x$have_libusb_1_0 = xyes; then
|
||||
echo "DO HAVE libusb_1_0"
|
||||
if test x$enabled_libusb_1_0 = xyes; then
|
||||
echo "DO HAVE libusb_1_0"
|
||||
else
|
||||
echo "DISABLED libusb_1_0"
|
||||
fi
|
||||
else
|
||||
echo "DON'T HAVE libusb_1_0"
|
||||
fi
|
||||
@@ -521,6 +571,12 @@ else
|
||||
echo "DON'T HAVE libhid"
|
||||
fi
|
||||
|
||||
if test x$have_libhidapi = xyes; then
|
||||
echo "DO HAVE libhidapi"
|
||||
else
|
||||
echo "DON'T HAVE libhidapi"
|
||||
fi
|
||||
|
||||
if test x$have_pthread = xyes; then
|
||||
echo "DO HAVE pthread"
|
||||
else
|
||||
@@ -545,3 +601,9 @@ else
|
||||
echo "DISABLED linuxgpio"
|
||||
fi
|
||||
|
||||
if test x$enabled_linuxspi = xyes; then
|
||||
echo "ENABLED linuxspi"
|
||||
else
|
||||
echo "DISABLED linuxspi"
|
||||
fi
|
||||
|
||||
@@ -17,38 +17,33 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "ac_cfg.h"
|
||||
#include "avrdude.h"
|
||||
#include "libavrdude.h"
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
#if defined(WIN32)
|
||||
|
||||
#include <limits.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
static char *filename;
|
||||
|
||||
|
||||
void win_sys_config_set(char sys_config[PATH_MAX])
|
||||
{
|
||||
sys_config[0] = 0;
|
||||
|
||||
|
||||
/* Use Windows API call to search for the Windows default system config file.*/
|
||||
SearchPath(NULL, "avrdude.conf", NULL, PATH_MAX, sys_config, &filename);
|
||||
SearchPath(NULL, SYSTEM_CONF_FILE, NULL, PATH_MAX, sys_config, &filename);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void win_usr_config_set(char usr_config[PATH_MAX])
|
||||
{
|
||||
usr_config[0] = 0;
|
||||
|
||||
|
||||
/* Use Windows API call to search for the Windows default user config file. */
|
||||
SearchPath(NULL, "avrdude.rc", NULL, PATH_MAX, usr_config, &filename);
|
||||
SearchPath(NULL, USER_CONF_FILE, NULL, PATH_MAX, usr_config, &filename);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ struct dfu_dev
|
||||
#else
|
||||
|
||||
struct dfu_dev {
|
||||
// empty
|
||||
int dummy;
|
||||
};
|
||||
|
||||
#endif
|
||||
3
doc/.cvsignore → src/doc/.gitignore
vendored
3
doc/.cvsignore → src/doc/.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
.cvsignore
|
||||
avrdude.t2d/
|
||||
avrdude.t2p/
|
||||
Makefile
|
||||
Makefile.in
|
||||
avrdude-html
|
||||
@@ -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 ; \
|
||||
20
src/doc/avrdude.css
Normal file
20
src/doc/avrdude.css
Normal file
@@ -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 - 2011 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,
|
||||
@@ -177,9 +171,52 @@ be taken about voltage level compatibility. Also, although not strictly
|
||||
required, it is strongly advisable to protect the GPIO pins from
|
||||
overcurrent situations in some way. The simplest would be to just put
|
||||
some resistors in series or better yet use a 3-state buffer driver like
|
||||
the 74HC244. Have a look at http://kolev.info/avrdude-linuxgpio for a more
|
||||
the 74HC244. Have a look at http://kolev.info/blog/2013/01/06/avrdude-linuxgpio/ for a more
|
||||
detailed tutorial about using this programmer type.
|
||||
|
||||
Under a Linux installation with direct access to the SPI bus and GPIO
|
||||
pins, such as would be found on a Raspberry Pi, the ``linuxspi''
|
||||
programmer type can be used to directly connect to and program a chip
|
||||
using the built in interfaces on the computer. The requirements to use
|
||||
this type are that an SPI interface is exposed along with one GPIO
|
||||
pin. The GPIO serves as the reset output since the Linux SPI drivers
|
||||
do not hold slave select down when a transfer is not occuring and thus
|
||||
it cannot be used as the reset pin. A readily available level
|
||||
translator should be used between the SPI bus/reset GPIO and the chip
|
||||
to avoid potentially damaging the computer's SPI controller in the
|
||||
event that the chip is running at 5V and the SPI runs at 3.3V. The
|
||||
GPIO chosen for reset can be configured in the avrdude configuration
|
||||
file using the @code{reset} entry under the linuxspi programmer, or
|
||||
directly in the port specification. An external pull-up resistor
|
||||
should be connected between the AVR's reset pin and Vcc. If Vcc is not
|
||||
the same as the SPI voltage, this should be done on the AVR side of
|
||||
the level translator to protect the hardware from damage.
|
||||
|
||||
On a Raspberry Pi, header J8 provides access to the SPI and GPIO
|
||||
lines.
|
||||
|
||||
Typically, pins 19, 21, and 23 are SPI MOSI, MISO, and SCK, while
|
||||
pins 24 and 26 would serve as CE outputs. So, close to these pins
|
||||
is pin 22 as GPIO25 which can be used as /RESET, and pin 25 can
|
||||
be used as GND.
|
||||
|
||||
A typical programming cable would then look like:
|
||||
|
||||
@multitable @columnfractions .15 .15 .3
|
||||
@item @code{J8 pin} @tab @code{ISP pin} @tab @code{Name}
|
||||
@item @code{21} @tab @code{1} @tab @code{MISO}
|
||||
@item @code{-} @tab @code{2} @tab @code{Vcc - leave open}
|
||||
@item @code{23} @tab @code{3} @tab @code{SCK}
|
||||
@item @code{19} @tab @code{4} @tab @code{MOSI}
|
||||
@item @code{22} @tab @code{5} @tab @code{/RESET}
|
||||
@item @code{25} @tab @code{6} @tab @code{GND}
|
||||
@end multitable
|
||||
|
||||
(Mind the 3.3 V voltage level of the Raspberry Pi!)
|
||||
|
||||
The @code{-P @var{portname}} option defaults to
|
||||
@code{/dev/spidev0.0:/dev/gpiochip0} for this programmer.
|
||||
|
||||
The STK500, JTAG ICE, avr910, and avr109/butterfly use the serial port to communicate with the PC.
|
||||
The STK600, JTAG ICE mkII/3, AVRISP mkII, USBasp, avrftdi (and derivatives), and USBtinyISP
|
||||
programmers communicate through the USB, using @code{libusb} as a
|
||||
@@ -234,12 +271,20 @@ option might be required to achieve a stable ISP communication.
|
||||
For ATxmega devices, the AVR Dragon is supported in PDI mode, provided it
|
||||
has a firmware version of at least 6.11 (decimal).
|
||||
|
||||
Wiring boards are supported, utilizing STK500 V2.x protocol, but
|
||||
a simple DTR/RTS toggle to set the boards into programming mode.
|
||||
The programmer type is ``wiring''.
|
||||
Wiring boards (e.g. Arduino Mega 2560 Rev3) are supported, utilizing
|
||||
STK500 V2.x protocol, but a simple DTR/RTS toggle to set the boards
|
||||
into programming mode. The programmer type is ``wiring''. Note that
|
||||
the -D option will likely be required in this case, because the
|
||||
bootloader will rewrite the program memory, but no true chip erase can
|
||||
be performed.
|
||||
|
||||
The Arduino (which is very similar to the STK500 1.x) is supported via
|
||||
its own programmer type specification ``arduino''.
|
||||
its own programmer type specification ``arduino''. This programmer works for
|
||||
the Arduino Uno Rev3 or any AVR that runs the Optiboot bootloader.
|
||||
The number of connection retry attempts can be specified as an
|
||||
extended parameter. See the section on
|
||||
@emph{extended parameters}
|
||||
below for details.
|
||||
|
||||
The BusPirate is a versatile tool that can also be used as an AVR programmer.
|
||||
A single BusPirate can be connected to up to 3 independent AVRs. See
|
||||
@@ -256,6 +301,35 @@ The Atmel DFU bootloader is supported in both, FLIP protocol version 1
|
||||
(AT90USB* and ATmega*U* devices), as well as version 2 (Xmega devices).
|
||||
See below for some hints about FLIP version 1 protocol behaviour.
|
||||
|
||||
The MPLAB(R) PICkit 4 and MPLAB(R) SNAP are supported in ISP, PDI and UPDI mode.
|
||||
The Curiosity Nano board is supported in UPDI mode. It is dubbed ``PICkit on
|
||||
Board'', thus the name @code{pkobn_updi}.
|
||||
|
||||
SerialUPDI programmer implementation is based on Microchip's
|
||||
@emph{pymcuprog} (@url{https://github.com/microchip-pic-avr-tools/pymcuprog})
|
||||
utility, but it also contains some performance improvements included in
|
||||
Spence Konde's @emph{DxCore} Arduino core (@url{https://github.com/SpenceKonde/DxCore}).
|
||||
In a nutshell, this programmer consists of simple USB->UART adapter, diode
|
||||
and couple of resistors. It uses serial connection to provide UPDI interface.
|
||||
@xref{SerialUPDI programmer} for more details and known issues.
|
||||
|
||||
The jtag2updi programmer is supported,
|
||||
and can program AVRs with a UPDI interface.
|
||||
Jtag2updi is just a firmware that can be uploaded to an AVR,
|
||||
which enables it to interface with avrdude using the jtagice mkii protocol
|
||||
via a serial link (@url{https://github.com/ElTangas/jtag2updi}).
|
||||
|
||||
The Micronucleus bootloader is supported for both protocol version V1
|
||||
and V2. As the bootloader does not support reading from flash memory,
|
||||
use the @code{-V} option to prevent AVRDUDE from verifing the flash memory.
|
||||
See the section on @emph{extended parameters}
|
||||
below for Micronucleus specific options.
|
||||
|
||||
The Teensy bootloader is supported for all AVR boards.
|
||||
As the bootloader does not support reading from flash memory,
|
||||
use the @code{-V} option to prevent AVRDUDE from verifing the flash memory.
|
||||
See the section on @emph{extended parameters}
|
||||
below for Teensy specific options.
|
||||
|
||||
@menu
|
||||
* History::
|
||||
@@ -265,6 +339,7 @@ See below for some hints about FLIP version 1 protocol behaviour.
|
||||
@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
|
||||
@@ -273,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
|
||||
@@ -294,7 +371,6 @@ Roth.
|
||||
@c
|
||||
@node Command Line Options, Terminal Mode Operation, Introduction, Top
|
||||
@chapter Command Line Options
|
||||
@cindex options
|
||||
|
||||
@menu
|
||||
* Option Descriptions::
|
||||
@@ -306,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
|
||||
@@ -330,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
|
||||
@@ -381,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
|
||||
@@ -390,10 +471,22 @@ Currently, the following programmer ids are understood and supported:
|
||||
@item -C @var{config-file}
|
||||
Use the specified config file for configuration data. This file
|
||||
contains all programmer and part definitions that AVRDUDE knows about.
|
||||
If not
|
||||
specified, AVRDUDE reads the configuration file from
|
||||
/usr/local/etc/avrdude.conf (FreeBSD and Linux). See Appendix A for
|
||||
the method of searching for the configuration file for Windows.
|
||||
If not specified, AVRDUDE looks for the configuration file in the following
|
||||
two locations:
|
||||
|
||||
@enumerate
|
||||
|
||||
@item
|
||||
@code{<directory from which application loaded>/../etc/avrdude.conf}
|
||||
|
||||
@item
|
||||
@code{<directory from which application loaded>/avrdude.conf}
|
||||
|
||||
@end enumerate
|
||||
|
||||
If not found there, the lookup procedure becomes platform dependent. On FreeBSD
|
||||
and Linux, AVRDUDE looks at @code{/usr/local/etc/avrdude.conf}. See Appendix A
|
||||
for the method of searching on Windows.
|
||||
|
||||
If @var{config-file} is written as @var{+filename}
|
||||
then this file is read after the system wide and user configuration
|
||||
@@ -542,14 +635,29 @@ As the AVRISP mkII device can only be talked to over USB, the very
|
||||
same method of specifying the port is required there.
|
||||
|
||||
For the USB programmer "AVR-Doper" running in HID mode, the port must
|
||||
be specified as @var{avrdoper}. Libusb support is required on Unix
|
||||
but not on Windows. For more information about AVR-Doper see
|
||||
be specified as @var{avrdoper}. Libhidapi support is required on Unix
|
||||
and Mac OS but not on Windows. For more information about AVR-Doper see
|
||||
@url{http://www.obdev.at/avrusb/avrdoper.html}.
|
||||
|
||||
For the USBtinyISP, which is a simplistic device not implementing
|
||||
serial numbers, multiple devices can be distinguished by their
|
||||
location in the USB hierarchy.
|
||||
@xref{Troubleshooting}, for examples.
|
||||
See the respective
|
||||
@xref{Troubleshooting} entry for examples.
|
||||
|
||||
For the XBee programmer the target MCU is to be programmed wirelessly
|
||||
over a ZigBee mesh using the XBeeBoot bootloader. The ZigBee 64-bit
|
||||
address for the target MCU's own XBee device must be supplied as a
|
||||
16-character hexadecimal value as a port prefix, followed by the
|
||||
@code{@@} character, and the serial device to connect to a second
|
||||
directly contactable XBee device associated with the same mesh (with
|
||||
a default baud rate of 9600). This may look similar to:
|
||||
@code{0013a20000000001@/dev/tty.serial}.
|
||||
|
||||
For diagnostic purposes, if the target MCU with an XBeeBoot
|
||||
bootloader is connected directly to the serial port, the
|
||||
64-bit address field can be omitted. In this mode the
|
||||
default baud rate will be 19200.
|
||||
|
||||
For programmers that attach to a serial port using some kind of
|
||||
higher level protocol (as opposed to bit-bang style programmers),
|
||||
@@ -557,6 +665,9 @@ higher level protocol (as opposed to bit-bang style programmers),
|
||||
In this case, instead of trying to open a local device, a TCP
|
||||
network connection to (TCP) @var{port} on @var{host}
|
||||
is established.
|
||||
Square brackets may be placed around @var{host} to improve
|
||||
readability for numeric IPv6 addresses (e.g.
|
||||
@code{net:[2001:db8::42]:1337}).
|
||||
The remote endpoint is assumed to be a terminal or console server
|
||||
that connects the network stream to a local serial port where the
|
||||
actual programmer has been attached to.
|
||||
@@ -564,37 +675,13 @@ The port is assumed to be properly configured, for example using a
|
||||
transparent 8-bit data connection without parity at 115200 Baud
|
||||
for a STK500.
|
||||
|
||||
Note: The ability to handle IPv6 hostnames and addresses is limited to
|
||||
Posix systems (by now).
|
||||
|
||||
@item -q
|
||||
Disable (or quell) output of the progress bar while reading or writing
|
||||
to the device. Specify it a second time for even quieter operation.
|
||||
|
||||
@item -u
|
||||
Disables the default behaviour of reading out the fuses three times before
|
||||
programming, then verifying at the end of programming that the fuses have not
|
||||
changed. If you want to change fuses you will need to specify this option,
|
||||
as avrdude will see the fuses have changed (even though you wanted to) and
|
||||
will change them back for your "safety". This option was designed to
|
||||
prevent cases of fuse bits magically changing (usually called @emph{safemode}).
|
||||
|
||||
If one of the configuration files contains a line
|
||||
|
||||
@code{default_safemode = no;}
|
||||
|
||||
safemode is disabled by default.
|
||||
The @option{-u} option's effect is negated in that case, i. e. it
|
||||
@emph{enables} safemode.
|
||||
|
||||
Safemode is always disabled for AVR32, Xmega and TPI devices.
|
||||
|
||||
@item -s
|
||||
Disable safemode prompting. When safemode discovers that one or more
|
||||
fuse bits have unintentionally changed, it will prompt for
|
||||
confirmation regarding whether or not it should attempt to recover the
|
||||
fuse bit(s). Specifying this flag disables the prompt and assumes
|
||||
that the fuse bit(s) should be recovered without asking for
|
||||
confirmation first.
|
||||
|
||||
@item -t
|
||||
Tells AVRDUDE to enter the interactive ``terminal'' mode instead of up-
|
||||
or downloading files. See below for a detailed description of the
|
||||
@@ -752,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
|
||||
@@ -769,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:
|
||||
@@ -789,6 +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:
|
||||
@@ -878,6 +976,33 @@ 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
|
||||
following optional extended parameter is accepted:
|
||||
@table @code
|
||||
@item @samp{wait=@var{timeout}}
|
||||
If the device is not connected, wait for the device to be plugged in.
|
||||
The optional @var{timeout} specifies the connection time-out in seconds.
|
||||
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
|
||||
following optional extended parameter is accepted:
|
||||
@table @code
|
||||
@item @samp{wait=@var{timeout}}
|
||||
If the device is not connected, wait for the device to be plugged in.
|
||||
The optional @var{timeout} specifies the connection time-out in seconds.
|
||||
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
|
||||
@@ -889,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
|
||||
@@ -909,6 +1035,47 @@ 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
|
||||
@item @samp{section_config}
|
||||
Programmer will erase
|
||||
configuration section with option '-e' (chip erase),
|
||||
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
|
||||
@item @samp{xbeeresetpin=@var{1..7}}
|
||||
Select the XBee pin @code{DIO<1..7>} that is connected to the MCU's
|
||||
‘/RESET’ line. The programmer needs to know which DIO pin to use to
|
||||
reset into the bootloader. The default (3) is the @code{DIO3} pin
|
||||
(XBee pin 17), but some commercial products use a different XBee
|
||||
pin.
|
||||
|
||||
The remaining two necessary XBee-to-MCU connections are not selectable
|
||||
- the XBee @code{DOUT} pin (pin 2) must be connected to the MCU's
|
||||
‘RXD’ line, and the XBee @code{DIN} pin (pin 3) must be connected to
|
||||
the MCU's ‘TXD’ line.
|
||||
@end table
|
||||
|
||||
@cindex @code{-x} serialupdi
|
||||
@item serialupdi
|
||||
Extended parameters:
|
||||
@table @code
|
||||
@item @samp{rtsdtr=low|high}
|
||||
Forces RTS/DTR lines to assume low or high state during the whole
|
||||
programming session. Some programmers might use this signal to
|
||||
indicate UPDI programming state, but this is strictly hardware
|
||||
specific.
|
||||
|
||||
When not provided, driver/OS default value will be used.
|
||||
@end table
|
||||
|
||||
@end table
|
||||
|
||||
@page
|
||||
@@ -952,8 +1119,6 @@ Reading | ################################################## | 100% 6.83s
|
||||
avrdude: verifying ...
|
||||
avrdude: 19278 bytes of flash verified
|
||||
|
||||
avrdude: safemode: Fuses OK
|
||||
|
||||
avrdude done. Thank you.
|
||||
|
||||
%
|
||||
@@ -981,8 +1146,6 @@ Reading | ################################################## | 100% 46.10s
|
||||
|
||||
avrdude: writing output file "c:/diag flash.bin"
|
||||
|
||||
avrdude: safemode: Fuses OK
|
||||
|
||||
avrdude done. Thank you.
|
||||
|
||||
%
|
||||
@@ -1103,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
|
||||
@@ -1110,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.
|
||||
|
||||
@@ -1139,7 +1366,9 @@ Display the device signature bytes.
|
||||
|
||||
@item spi
|
||||
Enter direct SPI mode. The @emph{pgmled} pin acts as slave select.
|
||||
@emph{Only supported on parallel bitbang programmers.}
|
||||
@emph{Only supported on parallel bitbang programmers, and partially by USBtiny.}
|
||||
Slave Select must be externally held low for direct SPI when
|
||||
using USBtinyISP, and send must be a multiple of four bytes.
|
||||
|
||||
@item part
|
||||
Display the current part settings and parameters. Includes chip
|
||||
@@ -1214,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
|
||||
@@ -1225,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
|
||||
|
||||
@@ -1287,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 |. |
|
||||
@@ -1313,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
|
||||
@@ -1437,9 +1710,11 @@ Following programmer types are currently implemented:
|
||||
part
|
||||
id = <id> ; # quoted string
|
||||
desc = <description> ; # quoted string
|
||||
family_id = <description> ; # quoted string
|
||||
has_jtag = <yes/no> ; # part has JTAG i/f
|
||||
has_debugwire = <yes/no> ; # part has debugWire i/f
|
||||
has_pdi = <yes/no> ; # part has PDI i/f
|
||||
has_updi = <yes/no> ; # part has UPDI i/f
|
||||
has_tpi = <yes/no> ; # part has TPI i/f
|
||||
devicecode = <num> ; # numeric
|
||||
stk500_devcode = <num> ; # numeric
|
||||
@@ -1660,9 +1935,6 @@ flash pages of the application section.
|
||||
|
||||
Reading fuse and lock bits is fully supported.
|
||||
|
||||
Note that due to the inability to write the fuse bits, the safemode
|
||||
functionality does not make sense for these boot loaders.
|
||||
|
||||
@end itemize
|
||||
|
||||
@c
|
||||
@@ -1674,12 +1946,14 @@ functionality does not make sense for these boot loaders.
|
||||
@menu
|
||||
* Atmel STK600::
|
||||
* Atmel DFU bootloader using FLIP version 1::
|
||||
* SerialUPDI programmer::
|
||||
@end menu
|
||||
|
||||
@c
|
||||
@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
|
||||
@@ -1775,7 +2049,8 @@ least 4.5 V in order to work. This can be done using
|
||||
@c
|
||||
@c Node
|
||||
@c
|
||||
@node Atmel DFU bootloader using FLIP version 1, , Atmel STK600, Programmer Specific Information
|
||||
@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
|
||||
@@ -1800,6 +2075,107 @@ signature check to be overridden with the @option{-F} option.
|
||||
A @emph{chip erase} might leave the EEPROM unerased, at least on some
|
||||
versions of the bootloader.
|
||||
|
||||
@c
|
||||
@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
|
||||
using very simple serial connection.
|
||||
You can read more about the details here
|
||||
@url{https://github.com/SpenceKonde/AVR-Guidance/blob/master/UPDI/jtag2updi.md}
|
||||
|
||||
SerialUPDI programmer has been tested using FT232RL USB->UART interface
|
||||
with the following connection layout (copied from Spence Kohde's page linked
|
||||
above):
|
||||
|
||||
@example
|
||||
-------------------- To Target device
|
||||
DTR| __________________
|
||||
Rx |--------------,------------------| UPDI---\/\/---------->
|
||||
Tx---/\/\/\---Tx |-------|<|---' .--------| Gnd 470 ohm
|
||||
resistor Vcc|---------------------------------| Vcc
|
||||
1k CTS| .` |__________________
|
||||
Gnd|--------------------'
|
||||
--------------------
|
||||
@end example
|
||||
|
||||
There are several limitations in current SerialUPDI/AVRDUDE integration,
|
||||
listed below.
|
||||
|
||||
At the end of each run there are fuse values being presented to the user.
|
||||
For most of the UPDI-enabled devices these definitions (low fuse, high
|
||||
fuse, extended fuse) have no meaning whatsoever, as they have been
|
||||
simply replaced by array of fuses: fuse0..9. Therefore you can simply
|
||||
ignore this particular line of AVRDUDE output.
|
||||
|
||||
Currently available devices support only UPDI NVM programming model 0
|
||||
and 2, but there is also experimental implementation of model 3 - not
|
||||
yet tested.
|
||||
|
||||
One of the core AVRDUDE features is verification of the connection by
|
||||
reading device signature prior to any operation, but this operation
|
||||
is not possible on UPDI locked devices. Therefore, to be able to
|
||||
connect to such a device, you have to provide @option{-F} to override
|
||||
this check.
|
||||
|
||||
Please note: using @option{-F} during write operation to locked device
|
||||
will force chip erase. Use carefully.
|
||||
|
||||
Another issue you might notice is slow performance of EEPROM writing
|
||||
using SerialUPDI for AVR Dx devices. This can be addressed by changing
|
||||
@emph{avrdude.conf} section for this device - changing EEPROM page
|
||||
size to 0x20 (instead of default 1), like so:
|
||||
|
||||
@example
|
||||
#------------------------------------------------------------
|
||||
# AVR128DB28
|
||||
#------------------------------------------------------------
|
||||
|
||||
part parent ".avrdx"
|
||||
id = "avr128db28";
|
||||
desc = "AVR128DB28";
|
||||
signature = 0x1E 0x97 0x0E;
|
||||
|
||||
memory "flash"
|
||||
size = 0x20000;
|
||||
offset = 0x800000;
|
||||
page_size = 0x200;
|
||||
readsize = 0x100;
|
||||
;
|
||||
|
||||
memory "eeprom"
|
||||
size = 0x200;
|
||||
offset = 0x1400;
|
||||
page_size = 0x1;
|
||||
readsize = 0x100;
|
||||
;
|
||||
;
|
||||
@end example
|
||||
|
||||
USERROW memory has not been defined for new devices except for
|
||||
experimental addition for AVR128DB28. The point of USERROW is to
|
||||
provide ability to write configuration details to already locked
|
||||
device and currently SerialUPDI interface supports this feature,
|
||||
but it hasn't been tested on wide variety of chips. Treat this as
|
||||
something experimental at this point. Please note: on locked devices
|
||||
it's not possible to read back USERROW contents when written, so
|
||||
the automatic verification will most likely fail and to prevent
|
||||
error messages, use @option{-V}.
|
||||
|
||||
Please note that SerialUPDI interface is pretty new and some
|
||||
issues are to be expected. In case you run into them, please
|
||||
make sure to run the intended command with debug output enabled
|
||||
(@option{-v -v -v}) and provide this verbose output with your
|
||||
bug report. You can also try to perform the same action using
|
||||
@emph{pymcuprog} (@url{https://github.com/microchip-pic-avr-tools/pymcuprog})
|
||||
utility with @option{-v debug} and provide its output too.
|
||||
You will notice that both outputs are pretty similar, and this
|
||||
was implemented like that on purpose - it was supposed to make
|
||||
analysis of UPDI protocol quirks easier.
|
||||
|
||||
@c
|
||||
@c Node
|
||||
@c
|
||||
@@ -1954,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
|
||||
@@ -2009,9 +2387,7 @@ such as @option{--prefix}.
|
||||
* Windows Installation::
|
||||
* Windows Configuration Files::
|
||||
* Windows Port Names::
|
||||
* Using the parallel port::
|
||||
* Documentation::
|
||||
* Credits.::
|
||||
@end menu
|
||||
|
||||
@c
|
||||
@@ -2088,6 +2464,10 @@ configuration files:
|
||||
|
||||
@enumerate
|
||||
|
||||
@item
|
||||
Only for the system configuration file:
|
||||
@code{<directory from which application loaded>/../etc/avrdude.conf}
|
||||
|
||||
@item
|
||||
The directory from which the application loaded.
|
||||
|
||||
@@ -2114,7 +2494,7 @@ The directories that are listed in the PATH environment variable.
|
||||
@c
|
||||
@c Node
|
||||
@c
|
||||
@node Windows Port Names, Using the parallel port, Windows Configuration Files, Windows
|
||||
@node Windows Port Names, Windows Configuration Files, Windows
|
||||
@subsection Port Names
|
||||
|
||||
@menu
|
||||
@@ -2166,71 +2546,8 @@ language notation (i. e., hexadecimal values are prefixed by @code{0x}).
|
||||
|
||||
@c
|
||||
@c Node
|
||||
@c
|
||||
@node Using the parallel port, Documentation, Windows Port Names, Windows
|
||||
@subsection Using the parallel port
|
||||
|
||||
@menu
|
||||
* Windows NT/2K/XP::
|
||||
* Windows 95/98::
|
||||
@end menu
|
||||
|
||||
@c
|
||||
@c Node
|
||||
@c
|
||||
@node Windows NT/2K/XP, Windows 95/98, Using the parallel port, Using the parallel port
|
||||
@subsubsection Windows NT/2K/XP
|
||||
|
||||
@noindent
|
||||
On Windows NT, 2000, and XP user applications cannot directly access the
|
||||
parallel port. However, kernel mode drivers can access the parallel port.
|
||||
giveio.sys is a driver that can allow user applications to set the state
|
||||
of the parallel port pins.
|
||||
|
||||
Before using AVRDUDE, the giveio.sys driver must be loaded. The
|
||||
accompanying command-line program, loaddrv.exe, can do just that.
|
||||
|
||||
To make things even easier there are 3 batch files that are also
|
||||
included:
|
||||
|
||||
@enumerate
|
||||
@item install_giveio.bat
|
||||
Install and start the giveio driver.
|
||||
|
||||
@item status_giveio.bat
|
||||
Check on the status of the giveio driver.
|
||||
|
||||
@item remove_giveio.bat
|
||||
Stop and remove the giveio driver from memory.
|
||||
@end enumerate
|
||||
|
||||
These 3 batch files calls the loaddrv program with various options to
|
||||
install, start, stop, and remove the driver.
|
||||
|
||||
When you first execute install_giveio.bat, loaddrv.exe and giveio.sys
|
||||
must be in the current directory. When install_giveio.bat is executed it
|
||||
will copy giveio.sys from your current directory to your Windows
|
||||
directory. It will then load the driver from the Windows directory. This
|
||||
means that after the first time install_giveio is executed, you should
|
||||
be able to subsequently execute the batch file from any directory and have
|
||||
it successfully start the driver.
|
||||
|
||||
Note that you must have administrator privilege to load the giveio driver.
|
||||
|
||||
@c
|
||||
@c Node
|
||||
@c
|
||||
@node Windows 95/98, , Windows NT/2K/XP, Using the parallel port
|
||||
@subsubsection Windows 95/98
|
||||
|
||||
@noindent
|
||||
On Windows 95 and 98 the giveio.sys driver is not needed.
|
||||
|
||||
|
||||
@c
|
||||
@c Node
|
||||
@c
|
||||
@node Documentation, Credits., Using the parallel port, Windows
|
||||
@node Documentation, Windows
|
||||
@subsection Documentation
|
||||
|
||||
@noindent
|
||||
@@ -2247,35 +2564,13 @@ such as @option{--prefix} and @option{--datadir}.
|
||||
@c
|
||||
@c Node
|
||||
@c
|
||||
@node Credits., , Documentation, Windows
|
||||
@subsection Credits.
|
||||
|
||||
@noindent
|
||||
Thanks to:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Dale Roberts for the giveio driver.
|
||||
|
||||
@item
|
||||
Paula Tomlinson for the loaddrv sources.
|
||||
|
||||
@item
|
||||
Chris Liechti <cliechti@@gmx.net> for modifying loaddrv to be command
|
||||
line driven and for writing the batch files.
|
||||
|
||||
@end itemize
|
||||
|
||||
@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
|
||||
@@ -2580,7 +2875,11 @@ erase cycle.
|
||||
|
||||
@end itemize
|
||||
|
||||
@node Index, , Troubleshooting, Top
|
||||
|
||||
@unnumbered Concept Index
|
||||
|
||||
@printindex cp
|
||||
|
||||
@bye
|
||||
|
||||
@@ -34,7 +34,9 @@
|
||||
#elif defined(HAVE_LIBELF_LIBELF_H)
|
||||
#include <libelf/libelf.h>
|
||||
#endif
|
||||
#define EM_AVR32 0x18ad /* inofficial */
|
||||
#ifndef EM_AVR32
|
||||
# define EM_AVR32 0x18ad /* unofficial */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "avrdude.h"
|
||||
@@ -271,9 +273,9 @@ static int ihex_readrec(struct ihexrec * ihex, char * rec)
|
||||
/*
|
||||
* Intel Hex to binary buffer
|
||||
*
|
||||
* Given an open file 'inf' which contains Intel Hex formated data,
|
||||
* Given an open file 'inf' which contains Intel Hex formatted data,
|
||||
* parse the file and lay it out within the memory buffer pointed to
|
||||
* by outbuf. The size of outbuf, 'bufsize' is honored; if data would
|
||||
* by outbuf. The size of outbuf, 'bufsize' is honored; if data would
|
||||
* fall outsize of the memory buffer outbuf, an error is generated.
|
||||
*
|
||||
* Return the maximum memory address within 'outbuf' that was written.
|
||||
@@ -1118,7 +1120,7 @@ static int fileio_imm(struct fioparms * fio,
|
||||
p = strtok(filename, " ,");
|
||||
while (p != NULL && loc < size) {
|
||||
b = strtoul(p, &e, 0);
|
||||
/* check for binary formated (0b10101001) strings */
|
||||
/* check for binary formatted (0b10101001) strings */
|
||||
b = (strncmp (p, "0b", 2))?
|
||||
strtoul (p, &e, 0):
|
||||
strtoul (p + 2, &e, 2);
|
||||
@@ -1170,7 +1172,7 @@ static int fileio_ihex(struct fioparms * fio,
|
||||
break;
|
||||
|
||||
default:
|
||||
avrdude_message(MSG_INFO, "%s: invalid Intex Hex file I/O operation=%d\n",
|
||||
avrdude_message(MSG_INFO, "%s: invalid Intel Hex file I/O operation=%d\n",
|
||||
progname, fio->op);
|
||||
return -1;
|
||||
break;
|
||||
@@ -1367,7 +1369,7 @@ static int fmt_autodetect(char * fname)
|
||||
int found;
|
||||
int first = 1;
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
#if defined(WIN32)
|
||||
f = fopen(fname, "r");
|
||||
#else
|
||||
f = fopen(fname, "rb");
|
||||
@@ -1516,7 +1518,7 @@ int fileio(int op, char * filename, FILEFMT format,
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
#if defined(WIN32)
|
||||
/* Open Raw Binary and ELF format in binary mode on Windows.*/
|
||||
if(format == FMT_RBIN || format == FMT_ELF)
|
||||
{
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "ac_cfg.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -30,13 +31,6 @@
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#elif HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "libavrdude.h"
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "ac_cfg.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -27,12 +28,6 @@
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#elif HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "libavrdude.h"
|
||||
|
||||
@@ -215,7 +210,7 @@ int flip2_initialize(PROGRAMMER* pgm, AVRPART *part)
|
||||
/* A note about return values. Negative return values from this function are
|
||||
* interpreted as failure by main(), from where this function is called.
|
||||
* However such failures are interpreted as a device signature check failure
|
||||
* and the user is adviced to use the -F option to override this check. In
|
||||
* and the user is advised to use the -F option to override this check. In
|
||||
* our case, this is misleading, so we defer reporting an error until another
|
||||
* function is called. Thus, we always return 0 (success) from initialize().
|
||||
* I don't like this, but I don't want to mess with main().
|
||||
@@ -617,7 +612,7 @@ int flip2_read_memory(struct dfu_dev *dfu,
|
||||
return -1;
|
||||
}
|
||||
|
||||
ptr += read_size;
|
||||
ptr = (char*)ptr + read_size;
|
||||
addr += read_size;
|
||||
size -= read_size;
|
||||
}
|
||||
@@ -680,7 +675,7 @@ int flip2_write_memory(struct dfu_dev *dfu,
|
||||
return -1;
|
||||
}
|
||||
|
||||
ptr += write_size;
|
||||
ptr = (const char*)ptr + write_size;
|
||||
addr += write_size;
|
||||
size -= write_size;
|
||||
}
|
||||
@@ -59,6 +59,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "libavrdude.h"
|
||||
@@ -67,9 +68,10 @@
|
||||
#include "ft245r.h"
|
||||
#include "usbdevs.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "tpi.h"
|
||||
|
||||
#define TPIPCR_GT_0b 0x07
|
||||
#define TPI_STOP_BITS 0x03
|
||||
|
||||
#if defined(HAVE_LIBFTDI1) && defined(HAVE_LIBUSB_1_0)
|
||||
# if defined(HAVE_LIBUSB_1_0_LIBUSB_H)
|
||||
@@ -78,33 +80,18 @@
|
||||
# include <libusb.h>
|
||||
# endif
|
||||
# include <libftdi1/ftdi.h>
|
||||
#elif defined(HAVE_LIBFTDI) && defined(HAVE_USB_H)
|
||||
/* ftdi.h includes usb.h */
|
||||
#elif defined(HAVE_LIBFTDI)
|
||||
#include <ftdi.h>
|
||||
#else
|
||||
#ifdef _MSC_VER
|
||||
#pragma message("No libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.")
|
||||
#else
|
||||
#warning No libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.
|
||||
#endif
|
||||
#define DO_NOT_BUILD_FT245R
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PTHREAD_H
|
||||
|
||||
static int ft245r_nopthread_open (struct programmer_t *pgm, char * name) {
|
||||
avrdude_message(MSG_INFO, "%s: error: no pthread support. Please compile again with pthread installed."
|
||||
#if defined(_WIN32)
|
||||
" See http://sourceware.org/pthreads-win32/."
|
||||
#endif
|
||||
"\n",
|
||||
progname);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ft245r_initpgm(PROGRAMMER * pgm) {
|
||||
strcpy(pgm->type, "ftdi_syncbb");
|
||||
pgm->open = ft245r_nopthread_open;
|
||||
}
|
||||
|
||||
#elif defined(DO_NOT_BUILD_FT245R)
|
||||
#if defined(DO_NOT_BUILD_FT245R)
|
||||
|
||||
static int ft245r_noftdi_open (struct programmer_t *pgm, char * name) {
|
||||
avrdude_message(MSG_INFO, "%s: error: no libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.\n",
|
||||
@@ -120,102 +107,219 @@ void ft245r_initpgm(PROGRAMMER * pgm) {
|
||||
|
||||
#else
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
/* Mac OS X defines sem_init but actually does not implement them */
|
||||
#include <dispatch/dispatch.h>
|
||||
|
||||
typedef dispatch_semaphore_t sem_t;
|
||||
|
||||
#define sem_init(psem,x,val) *psem = dispatch_semaphore_create(val)
|
||||
#define sem_post(psem) dispatch_semaphore_signal(*psem)
|
||||
#define sem_wait(psem) dispatch_semaphore_wait(*psem, DISPATCH_TIME_FOREVER)
|
||||
#else
|
||||
#include <semaphore.h>
|
||||
#endif
|
||||
|
||||
#define FT245R_CYCLES 2
|
||||
#define FT245R_FRAGMENT_SIZE 512
|
||||
#define REQ_OUTSTANDINGS 10
|
||||
//#define USE_INLINE_WRITE_PAGE
|
||||
|
||||
#define FT245R_DEBUG 0
|
||||
/*
|
||||
Some revisions of the FTDI chips mess up the timing in bitbang mode
|
||||
unless the bitclock is set to the max (3MHz). For example, see:
|
||||
|
||||
http://www.ftdichip.com/Support/Documents/TechnicalNotes/TN_120_FT232R%20Errata%20Technical%20Note.pdf
|
||||
|
||||
To work around this problem, set the macro below to 1 to always set
|
||||
the bitclock to 3MHz and then issue the same byte repeatedly to get
|
||||
the desired timing.
|
||||
|
||||
*/
|
||||
#define FT245R_BITBANG_VARIABLE_PULSE_WIDTH_WORKAROUND 0
|
||||
|
||||
static struct ftdi_context *handle;
|
||||
|
||||
#if FT245R_BITBANG_VARIABLE_PULSE_WIDTH_WORKAROUND
|
||||
static unsigned int baud_multiplier;
|
||||
#else
|
||||
# define baud_multiplier 1 // this let's C compiler optimize
|
||||
#endif
|
||||
static unsigned char ft245r_ddr;
|
||||
static unsigned char ft245r_out;
|
||||
static unsigned char ft245r_in;
|
||||
|
||||
#define BUFSIZE 0x2000
|
||||
#define FT245R_BUFSIZE 0x2000 // receive buffer size
|
||||
#define FT245R_MIN_FIFO_SIZE 128 // min of FTDI RX/TX FIFO size
|
||||
|
||||
// libftdi / libftd2xx compatibility functions.
|
||||
static struct {
|
||||
int len; // # of bytes in transmit buffer
|
||||
uint8_t buf[FT245R_MIN_FIFO_SIZE]; // transmit buffer
|
||||
} tx;
|
||||
|
||||
static pthread_t readerthread;
|
||||
static sem_t buf_data, buf_space;
|
||||
static unsigned char buffer[BUFSIZE];
|
||||
static int head, tail;
|
||||
static struct {
|
||||
int discard; // # of bytes to discard during read
|
||||
int pending; // # of bytes that have been written since last read
|
||||
int len; // # of bytes in receive buffer
|
||||
int wr; // write pointer
|
||||
int rd; // read pointer
|
||||
uint8_t buf[FT245R_BUFSIZE]; // receive ring buffer
|
||||
} rx;
|
||||
|
||||
static void add_to_buf (unsigned char c) {
|
||||
int nh;
|
||||
static int ft245r_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res);
|
||||
static int ft245r_tpi_tx(PROGRAMMER * pgm, uint8_t byte);
|
||||
static int ft245r_tpi_rx(PROGRAMMER * pgm, uint8_t *bytep);
|
||||
|
||||
sem_wait (&buf_space);
|
||||
if (head == (BUFSIZE -1)) nh = 0;
|
||||
else nh = head + 1;
|
||||
|
||||
if (nh == tail) {
|
||||
avrdude_message(MSG_INFO, "buffer overflow. Cannot happen!\n");
|
||||
}
|
||||
buffer[head] = c;
|
||||
head = nh;
|
||||
sem_post (&buf_data);
|
||||
// Discard all data from the receive buffer.
|
||||
static void ft245r_rx_buf_purge(PROGRAMMER * pgm) {
|
||||
rx.len = 0;
|
||||
rx.rd = rx.wr = 0;
|
||||
}
|
||||
|
||||
static void *reader (void *arg) {
|
||||
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL);
|
||||
struct ftdi_context *handle = (struct ftdi_context *)(arg);
|
||||
unsigned char buf[0x1000];
|
||||
int br, i;
|
||||
|
||||
while (1) {
|
||||
pthread_testcancel();
|
||||
br = ftdi_read_data (handle, buf, sizeof(buf));
|
||||
for (i=0; i<br; i++)
|
||||
add_to_buf (buf[i]);
|
||||
}
|
||||
return NULL;
|
||||
static void ft245r_rx_buf_put(PROGRAMMER * pgm, uint8_t byte) {
|
||||
rx.len++;
|
||||
rx.buf[rx.wr++] = byte;
|
||||
if (rx.wr >= sizeof(rx.buf))
|
||||
rx.wr = 0;
|
||||
}
|
||||
|
||||
static int ft245r_send(PROGRAMMER * pgm, unsigned char * buf, size_t len) {
|
||||
int rv;
|
||||
static uint8_t ft245r_rx_buf_get(PROGRAMMER * pgm) {
|
||||
rx.len--;
|
||||
uint8_t byte = rx.buf[rx.rd++];
|
||||
if (rx.rd >= sizeof(rx.buf))
|
||||
rx.rd = 0;
|
||||
return byte;
|
||||
}
|
||||
|
||||
rv = ftdi_write_data(handle, buf, len);
|
||||
if (len != rv) return -1;
|
||||
/* Fill receive buffer with data from the FTDI receive FIFO. */
|
||||
static int ft245r_fill(PROGRAMMER * pgm) {
|
||||
uint8_t raw[FT245R_MIN_FIFO_SIZE];
|
||||
int i, nread;
|
||||
|
||||
nread = ftdi_read_data(handle, raw, rx.pending);
|
||||
if (nread < 0)
|
||||
return -1;
|
||||
rx.pending -= nread;
|
||||
#if FT245R_DEBUG
|
||||
avrdude_message(MSG_INFO, "%s: read %d bytes (pending=%d)\n",
|
||||
__func__, nread, rx.pending);
|
||||
#endif
|
||||
for (i = 0; i < nread; ++i)
|
||||
ft245r_rx_buf_put(pgm, raw[i]);
|
||||
return nread;
|
||||
}
|
||||
|
||||
static int ft245r_rx_buf_fill_and_get(PROGRAMMER* pgm)
|
||||
{
|
||||
while (rx.len == 0)
|
||||
{
|
||||
int result = ft245r_fill(pgm);
|
||||
if (result < 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return ft245r_rx_buf_get(pgm);
|
||||
}
|
||||
|
||||
/* Flush pending TX data to the FTDI send FIFO. */
|
||||
static int ft245r_flush(PROGRAMMER * pgm) {
|
||||
int rv, len = tx.len, avail;
|
||||
uint8_t *src = tx.buf;
|
||||
|
||||
if (!len)
|
||||
return 0;
|
||||
|
||||
while (len > 0) {
|
||||
avail = FT245R_MIN_FIFO_SIZE - rx.pending;
|
||||
if (avail <= 0) {
|
||||
avail = ft245r_fill(pgm);
|
||||
if (avail < 0) {
|
||||
avrdude_message(MSG_INFO,
|
||||
"%s: fill returned %d: %s\n",
|
||||
__func__, avail, ftdi_get_error_string(handle));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (avail > len)
|
||||
avail = len;
|
||||
|
||||
#if FT245R_DEBUG
|
||||
avrdude_message(MSG_INFO, "%s: writing %d bytes\n", __func__, avail);
|
||||
#endif
|
||||
rv = ftdi_write_data(handle, src, avail);
|
||||
if (rv != avail) {
|
||||
avrdude_message(MSG_INFO,
|
||||
"%s: write returned %d (expected %d): %s\n",
|
||||
__func__, rv, avail, ftdi_get_error_string(handle));
|
||||
return -1;
|
||||
}
|
||||
src += avail;
|
||||
len -= avail;
|
||||
rx.pending += avail;
|
||||
}
|
||||
tx.len = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ft245r_recv(PROGRAMMER * pgm, unsigned char * buf, size_t len) {
|
||||
int i;
|
||||
static int ft245r_send2(PROGRAMMER * pgm, unsigned char * buf, size_t len,
|
||||
bool discard_rx_data) {
|
||||
int i, j;
|
||||
|
||||
// Copy over data from the circular buffer..
|
||||
// XXX This should timeout, and return error if there isn't enough
|
||||
// data.
|
||||
for (i=0; i<len; i++) {
|
||||
sem_wait (&buf_data);
|
||||
buf[i] = buffer[tail];
|
||||
if (tail == (BUFSIZE -1)) tail = 0;
|
||||
else tail++;
|
||||
sem_post (&buf_space);
|
||||
for (i = 0; i < len; ++i) {
|
||||
for (j = 0; j < baud_multiplier; ++j) {
|
||||
if (discard_rx_data)
|
||||
++rx.discard;
|
||||
tx.buf[tx.len++] = buf[i];
|
||||
if (tx.len >= FT245R_MIN_FIFO_SIZE)
|
||||
ft245r_flush(pgm);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ft245r_send(PROGRAMMER * pgm, unsigned char * buf, size_t len) {
|
||||
return ft245r_send2(pgm, buf, len, false);
|
||||
}
|
||||
|
||||
static int ft245r_send_and_discard(PROGRAMMER * pgm, unsigned char * buf,
|
||||
size_t len) {
|
||||
return ft245r_send2(pgm, buf, len, true);
|
||||
}
|
||||
|
||||
static int ft245r_recv(PROGRAMMER * pgm, unsigned char * buf, size_t len) {
|
||||
int i, j;
|
||||
|
||||
ft245r_flush(pgm);
|
||||
ft245r_fill(pgm);
|
||||
|
||||
#if FT245R_DEBUG
|
||||
avrdude_message(MSG_INFO, "%s: discarding %d, consuming %zu bytes\n",
|
||||
__func__, rx.discard, len);
|
||||
#endif
|
||||
while (rx.discard > 0) {
|
||||
int result = ft245r_rx_buf_fill_and_get(pgm);
|
||||
if (result < 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
--rx.discard;
|
||||
}
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
{
|
||||
int result = ft245r_rx_buf_fill_and_get(pgm);
|
||||
if (result < 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
buf[i] = (uint8_t)result;
|
||||
for (j = 1; j < baud_multiplier; ++j)
|
||||
{
|
||||
result = ft245r_rx_buf_fill_and_get(pgm);
|
||||
if (result < 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int ft245r_drain(PROGRAMMER * pgm, int display) {
|
||||
int r;
|
||||
unsigned char t;
|
||||
|
||||
// flush the buffer in the chip by changing the mode.....
|
||||
r = ftdi_set_bitmode(handle, 0, BITMODE_RESET); // reset
|
||||
@@ -224,17 +328,25 @@ static int ft245r_drain(PROGRAMMER * pgm, int display) {
|
||||
if (r) return -1;
|
||||
|
||||
// drain our buffer.
|
||||
while (head != tail) {
|
||||
ft245r_recv (pgm, &t, 1);
|
||||
}
|
||||
ft245r_rx_buf_purge(pgm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Ensure any pending writes are sent to the FTDI chip before sleeping. */
|
||||
static void ft245r_usleep(PROGRAMMER * pgm, useconds_t usec) {
|
||||
ft245r_flush(pgm);
|
||||
usleep(usec);
|
||||
}
|
||||
|
||||
|
||||
static int ft245r_chip_erase(PROGRAMMER * pgm, AVRPART * p) {
|
||||
unsigned char cmd[4] = {0,0,0,0};
|
||||
unsigned char res[4];
|
||||
|
||||
if (p->flags & AVRPART_HAS_TPI)
|
||||
return avr_tpi_chip_erase(pgm, p);
|
||||
|
||||
if (p->op[AVR_OP_CHIP_ERASE] == NULL) {
|
||||
avrdude_message(MSG_INFO, "chip erase instruction not defined for part \"%s\"\n",
|
||||
p->desc);
|
||||
@@ -243,29 +355,38 @@ static int ft245r_chip_erase(PROGRAMMER * pgm, AVRPART * p) {
|
||||
|
||||
avr_set_bits(p->op[AVR_OP_CHIP_ERASE], cmd);
|
||||
pgm->cmd(pgm, cmd, res);
|
||||
usleep(p->chip_erase_delay);
|
||||
ft245r_usleep(pgm, p->chip_erase_delay);
|
||||
return pgm->initialize(pgm, p);
|
||||
}
|
||||
|
||||
|
||||
static int ft245r_set_bitclock(PROGRAMMER * pgm) {
|
||||
int r;
|
||||
int rate = 0;
|
||||
// libftdi1 multiplies bitbang baudrate by 4:
|
||||
int r, rate = 0, ftdi_rate = 3000000 / 4;
|
||||
|
||||
/* bitclock is second. 1us = 0.000001. Max rate for ft232r 750000 */
|
||||
if(pgm->bitclock) {
|
||||
rate = (uint32_t)(1.0/pgm->bitclock) * 2;
|
||||
rate = (uint32_t)(1.0/pgm->bitclock);
|
||||
} else if (pgm->baudrate) {
|
||||
rate = pgm->baudrate * 2;
|
||||
rate = pgm->baudrate;
|
||||
} else {
|
||||
rate = 150000; /* should work for all ftdi chips and the avr default internal clock of 1MHz */
|
||||
}
|
||||
|
||||
if (FT245R_DEBUG) {
|
||||
avrdude_message(MSG_NOTICE2, " ft245r: spi bitclk %d -> ft baudrate %d\n",
|
||||
rate / 2, rate);
|
||||
}
|
||||
r = ftdi_set_baudrate(handle, rate);
|
||||
#if FT245R_BITBANG_VARIABLE_PULSE_WIDTH_WORKAROUND
|
||||
if (rate > 0 && rate < ftdi_rate)
|
||||
baud_multiplier = round((ftdi_rate + rate - 1) / rate);
|
||||
else
|
||||
baud_multiplier = 1;
|
||||
#else
|
||||
ftdi_rate = rate;
|
||||
#endif
|
||||
|
||||
avrdude_message(MSG_NOTICE2,
|
||||
"%s: bitclk %d -> FTDI rate %d, baud multiplier %d\n",
|
||||
__func__, rate, ftdi_rate, baud_multiplier);
|
||||
|
||||
r = ftdi_set_baudrate(handle, ftdi_rate);
|
||||
if (r) {
|
||||
avrdude_message(MSG_INFO, "Set baudrate (%d) failed with error '%s'.\n",
|
||||
rate, ftdi_get_error_string (handle));
|
||||
@@ -274,6 +395,18 @@ static int ft245r_set_bitclock(PROGRAMMER * pgm) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_pin(PROGRAMMER *pgm, int pinname) {
|
||||
uint8_t byte;
|
||||
|
||||
ft245r_flush(pgm);
|
||||
|
||||
if (ftdi_read_pins(handle, &byte) != 0)
|
||||
return -1;
|
||||
if (FT245R_DEBUG)
|
||||
avrdude_message(MSG_INFO, "%s: in 0x%02x\n", __func__, byte);
|
||||
return GET_BITS_0(byte, pgm, pinname) != 0;
|
||||
}
|
||||
|
||||
static int set_pin(PROGRAMMER * pgm, int pinname, int val) {
|
||||
unsigned char buf[1];
|
||||
|
||||
@@ -285,10 +418,7 @@ static int set_pin(PROGRAMMER * pgm, int pinname, int val) {
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,pinname,val);
|
||||
buf[0] = ft245r_out;
|
||||
|
||||
ft245r_send (pgm, buf, 1);
|
||||
ft245r_recv (pgm, buf, 1);
|
||||
|
||||
ft245r_in = buf[0];
|
||||
ft245r_send_and_discard(pgm, buf, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -333,7 +463,7 @@ static int set_led_vfy(struct programmer_t * pgm, int value) {
|
||||
static void ft245r_powerup(PROGRAMMER * pgm)
|
||||
{
|
||||
set_vcc(pgm, ON); /* power up */
|
||||
usleep(100);
|
||||
ft245r_usleep(pgm, 100);
|
||||
}
|
||||
|
||||
|
||||
@@ -363,12 +493,10 @@ static void ft245r_enable(PROGRAMMER * pgm) {
|
||||
* and not via the buffer chip.
|
||||
*/
|
||||
set_reset(pgm, OFF);
|
||||
usleep(1);
|
||||
ft245r_usleep(pgm, 1);
|
||||
set_buff(pgm, ON);
|
||||
}
|
||||
|
||||
static int ft245r_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res);
|
||||
/*
|
||||
* issue the 'program enable' command to the AVR device
|
||||
*/
|
||||
@@ -377,6 +505,9 @@ static int ft245r_program_enable(PROGRAMMER * pgm, AVRPART * p) {
|
||||
unsigned char res[4];
|
||||
int i;
|
||||
|
||||
if (p->flags & AVRPART_HAS_TPI)
|
||||
return avr_tpi_program_enable(pgm, p, TPIPCR_GT_0b);
|
||||
|
||||
if (p->op[AVR_OP_PGM_ENABLE] == NULL) {
|
||||
avrdude_message(MSG_INFO, "%s: AVR_OP_PGM_ENABLE command not defined for %s\n",
|
||||
progname, p->desc);
|
||||
@@ -397,12 +528,12 @@ static int ft245r_program_enable(PROGRAMMER * pgm, AVRPART * p) {
|
||||
fflush(stderr);
|
||||
}
|
||||
set_pin(pgm, PIN_AVR_RESET, ON);
|
||||
usleep(20);
|
||||
ft245r_usleep(pgm, 20);
|
||||
set_pin(pgm, PIN_AVR_RESET, OFF);
|
||||
|
||||
if (i == 3) {
|
||||
ft245r_drain(pgm, 0);
|
||||
tail = head;
|
||||
ft245r_rx_buf_purge(pgm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,35 +558,83 @@ static int ft245r_initialize(PROGRAMMER * pgm, AVRPART * p) {
|
||||
ft245r_powerup(pgm);
|
||||
|
||||
set_reset(pgm, OFF);
|
||||
usleep(5000); // 5ms
|
||||
ft245r_usleep(pgm, 5000); // 5ms
|
||||
set_reset(pgm, ON);
|
||||
usleep(5000); // 5ms
|
||||
ft245r_usleep(pgm, 5000); // 5ms
|
||||
set_reset(pgm, OFF);
|
||||
|
||||
/* Wait for at least 20 ms and enable serial programming by sending the Programming
|
||||
* Enable serial instruction to pin MOSI.
|
||||
*/
|
||||
usleep(20000); // 20ms
|
||||
ft245r_usleep(pgm, 20000); // 20ms
|
||||
|
||||
if (p->flags & AVRPART_HAS_TPI) {
|
||||
bool io_link_ok = true;
|
||||
uint8_t byte;
|
||||
int i;
|
||||
|
||||
/* Since there is a single TPIDATA line, MOSI and MISO must be
|
||||
linked together through a 1kOhm resistor. Verify that
|
||||
everything we send on MOSI gets mirrored back on MISO. */
|
||||
set_pin(pgm, PIN_AVR_MOSI, 0);
|
||||
if (get_pin(pgm, PIN_AVR_MISO) != 0) {
|
||||
io_link_ok = false;
|
||||
avrdude_message(MSG_INFO, "MOSI->MISO 0 failed\n");
|
||||
if (!ovsigck)
|
||||
return -1;
|
||||
}
|
||||
set_pin(pgm, PIN_AVR_MOSI, 1);
|
||||
if (get_pin(pgm, PIN_AVR_MISO) != 1) {
|
||||
io_link_ok = false;
|
||||
avrdude_message(MSG_INFO, "MOSI->MISO 1 failed\n");
|
||||
if (!ovsigck)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (io_link_ok)
|
||||
avrdude_message(MSG_NOTICE2, "MOSI-MISO link present\n");
|
||||
|
||||
/* keep TPIDATA high for 16 clock cycles */
|
||||
set_pin(pgm, PIN_AVR_MOSI, 1);
|
||||
for (i = 0; i < 16; i++) {
|
||||
set_sck(pgm, 1);
|
||||
set_sck(pgm, 0);
|
||||
}
|
||||
|
||||
/* remove extra guard timing bits */
|
||||
ft245r_tpi_tx(pgm, TPI_CMD_SSTCS | TPI_REG_TPIPCR);
|
||||
ft245r_tpi_tx(pgm, 0x7);
|
||||
|
||||
/* read TPI ident reg */
|
||||
ft245r_tpi_tx(pgm, TPI_CMD_SLDCS | TPI_REG_TPIIR);
|
||||
ft245r_tpi_rx(pgm, &byte);
|
||||
if (byte != 0x80) {
|
||||
avrdude_message(MSG_INFO, "TPIIR 0x%02x not correct\n", byte);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return ft245r_program_enable(pgm, p);
|
||||
}
|
||||
|
||||
static inline void add_bit(PROGRAMMER * pgm, unsigned char *buf, int *buf_pos,
|
||||
uint8_t bit) {
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_MOSI, bit);
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0);
|
||||
buf[*buf_pos] = ft245r_out;
|
||||
(*buf_pos)++;
|
||||
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,1);
|
||||
buf[*buf_pos] = ft245r_out;
|
||||
(*buf_pos)++;
|
||||
}
|
||||
|
||||
static inline int set_data(PROGRAMMER * pgm, unsigned char *buf, unsigned char data) {
|
||||
int j;
|
||||
int buf_pos = 0;
|
||||
unsigned char bit = 0x80;
|
||||
|
||||
for (j=0; j<8; j++) {
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_MOSI,data & bit);
|
||||
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0);
|
||||
buf[buf_pos] = ft245r_out;
|
||||
buf_pos++;
|
||||
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,1);
|
||||
buf[buf_pos] = ft245r_out;
|
||||
buf_pos++;
|
||||
|
||||
add_bit(pgm, buf, &buf_pos, (data & bit) != 0);
|
||||
bit >>= 1;
|
||||
}
|
||||
return buf_pos;
|
||||
@@ -463,7 +642,8 @@ static inline int set_data(PROGRAMMER * pgm, unsigned char *buf, unsigned char d
|
||||
|
||||
static inline unsigned char extract_data(PROGRAMMER * pgm, unsigned char *buf, int offset) {
|
||||
int j;
|
||||
int buf_pos = 1;
|
||||
int buf_pos = FT245R_CYCLES; /* MISO data is valid AFTER rising SCK edge,
|
||||
i.e. in next clock cycle */
|
||||
unsigned char bit = 0x80;
|
||||
unsigned char r = 0;
|
||||
|
||||
@@ -479,6 +659,7 @@ static inline unsigned char extract_data(PROGRAMMER * pgm, unsigned char *buf, i
|
||||
}
|
||||
|
||||
/* to check data */
|
||||
#if 0
|
||||
static inline unsigned char extract_data_out(PROGRAMMER * pgm, unsigned char *buf, int offset) {
|
||||
int j;
|
||||
int buf_pos = 1;
|
||||
@@ -495,6 +676,7 @@ static inline unsigned char extract_data_out(PROGRAMMER * pgm, unsigned char *bu
|
||||
}
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
@@ -523,6 +705,122 @@ static int ft245r_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline uint8_t extract_tpi_data(PROGRAMMER * pgm, unsigned char *buf,
|
||||
int *buf_pos) {
|
||||
uint8_t bit = 0x1, byte = 0;
|
||||
int j;
|
||||
|
||||
for (j = 0; j < 8; j++) {
|
||||
(*buf_pos)++; // skip over falling clock edge
|
||||
if (GET_BITS_0(buf[(*buf_pos)++], pgm, PIN_AVR_MISO))
|
||||
byte |= bit;
|
||||
bit <<= 1;
|
||||
}
|
||||
return byte;
|
||||
}
|
||||
|
||||
static inline int set_tpi_data(PROGRAMMER * pgm, unsigned char *buf,
|
||||
uint8_t byte) {
|
||||
uint8_t bit = 0x1, parity = 0;
|
||||
int j, buf_pos = 0;
|
||||
|
||||
// start bit:
|
||||
add_bit(pgm, buf, &buf_pos, 0);
|
||||
|
||||
// 8 data bits:
|
||||
for (j = 0; j < 8; j++) {
|
||||
add_bit(pgm, buf, &buf_pos, (byte & bit) != 0);
|
||||
parity ^= (byte & bit) != 0;
|
||||
bit <<= 1;
|
||||
}
|
||||
|
||||
// parity bit:
|
||||
add_bit(pgm, buf, &buf_pos, parity);
|
||||
// stop bits:
|
||||
add_bit(pgm, buf, &buf_pos, 1);
|
||||
add_bit(pgm, buf, &buf_pos, 1);
|
||||
return buf_pos;
|
||||
}
|
||||
|
||||
static int ft245r_tpi_tx(PROGRAMMER * pgm, uint8_t byte) {
|
||||
uint8_t buf[128];
|
||||
int len;
|
||||
|
||||
len = set_tpi_data(pgm, buf, byte);
|
||||
ft245r_send_and_discard(pgm, buf, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ft245r_tpi_rx(PROGRAMMER * pgm, uint8_t *bytep) {
|
||||
uint8_t buf[128], bit, parity;
|
||||
int i, buf_pos = 0, len = 0;
|
||||
uint32_t res, m, byte;
|
||||
|
||||
/* Allow for up to 4 bits before we must see start bit; during
|
||||
that time, we must keep the MOSI line high. */
|
||||
for (i = 0; i < 2; ++i)
|
||||
len += set_data(pgm, &buf[len], 0xff);
|
||||
|
||||
ft245r_send(pgm, buf, len);
|
||||
ft245r_recv(pgm, buf, len);
|
||||
|
||||
res = (extract_tpi_data(pgm, buf, &buf_pos)
|
||||
| ((uint32_t) extract_tpi_data(pgm, buf, &buf_pos) << 8));
|
||||
|
||||
/* Look for start bit: */
|
||||
m = 0x1;
|
||||
while (m & res)
|
||||
m <<= 1;
|
||||
if (m >= 0x10) {
|
||||
avrdude_message(MSG_INFO, "%s: start bit missing (res=0x%04x)\n",
|
||||
__func__, res);
|
||||
return -1;
|
||||
}
|
||||
byte = parity = 0;
|
||||
for (i = 0; i < 8; ++i) {
|
||||
m <<= 1;
|
||||
bit = (res & m) != 0;
|
||||
parity ^= bit;
|
||||
byte |= bit << i;
|
||||
}
|
||||
m <<= 1;
|
||||
if (((res & m) != 0) != parity) {
|
||||
avrdude_message(MSG_INFO, "%s: parity bit wrong\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
if (((res & (m << 1)) == 0) || ((res & (m << 2))) == 0) {
|
||||
avrdude_message(MSG_INFO, "%s: stop bits wrong\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
*bytep = (uint8_t) byte;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ft245r_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
int cmd_len, unsigned char *res, int res_len) {
|
||||
int i, ret = 0;
|
||||
|
||||
pgm->pgm_led(pgm, ON);
|
||||
|
||||
for (i = 0; i < cmd_len; ++i)
|
||||
ft245r_tpi_tx(pgm, cmd[i]);
|
||||
for (i = 0; i < res_len; ++i)
|
||||
if ((ret = ft245r_tpi_rx(pgm, &res[i])) < 0)
|
||||
break;
|
||||
if (verbose >= 2) {
|
||||
avrdude_message(MSG_NOTICE2, "%s: [ ", __func__);
|
||||
for (i = 0; i < cmd_len; i++)
|
||||
avrdude_message(MSG_NOTICE2, "%02X ", cmd[i]);
|
||||
avrdude_message(MSG_NOTICE2, "] [ ");
|
||||
for(i = 0; i < res_len; i++)
|
||||
avrdude_message(MSG_NOTICE2, "%02X ", res[i]);
|
||||
avrdude_message(MSG_NOTICE2, "]\n");
|
||||
}
|
||||
|
||||
pgm->pgm_led(pgm, OFF);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* lower 8 pins are accepted, they might be also inverted */
|
||||
static const struct pindef_t valid_pins = {{0xff},{0xff}} ;
|
||||
|
||||
@@ -537,8 +835,10 @@ static const struct pin_checklist_t pin_checklist[] = {
|
||||
static int ft245r_open(PROGRAMMER * pgm, char * port) {
|
||||
int rv;
|
||||
int devnum = -1;
|
||||
char device[9] = "";
|
||||
|
||||
rv = pins_check(pgm,pin_checklist,sizeof(pin_checklist)/sizeof(pin_checklist[0]), true);
|
||||
|
||||
if(rv) {
|
||||
pgm->display(pgm, progbuf);
|
||||
return rv;
|
||||
@@ -546,22 +846,47 @@ static int ft245r_open(PROGRAMMER * pgm, char * port) {
|
||||
|
||||
strcpy(pgm->port, port);
|
||||
|
||||
if (strcmp(port,DEFAULT_USB) != 0) {
|
||||
if (strncasecmp("ft", port, 2) == 0) {
|
||||
char *startptr = port + 2;
|
||||
char *endptr = NULL;
|
||||
devnum = strtol(startptr,&endptr,10);
|
||||
if ((startptr==endptr) || (*endptr != '\0')) {
|
||||
devnum = -1;
|
||||
}
|
||||
}
|
||||
if (devnum < 0) {
|
||||
avrdude_message(MSG_INFO, "%s: invalid portname '%s': use 'ft[0-9]+'\n",
|
||||
progname,port);
|
||||
return -1;
|
||||
}
|
||||
// read device string cut after 8 chars (max. length of serial number)
|
||||
if ((sscanf(port, "usb:%8s", device) != 1)) {
|
||||
avrdude_message(MSG_NOTICE,
|
||||
"%s: ft245r_open(): no device identifier in portname, using default\n",
|
||||
progname);
|
||||
pgm->usbsn[0] = 0;
|
||||
devnum = 0;
|
||||
} else {
|
||||
if (strlen(device) == 8 ){ // serial number
|
||||
if (verbose >= 2) {
|
||||
avrdude_message(MSG_INFO,
|
||||
"%s: ft245r_open(): serial number parsed as: "
|
||||
"%s\n",
|
||||
progname,
|
||||
device);
|
||||
}
|
||||
// copy serial number to pgm struct
|
||||
strcpy(pgm->usbsn, device);
|
||||
// and use first device with matching serial (should be unique)
|
||||
devnum = 0;
|
||||
}
|
||||
else if (strncmp("ft", device, 2) || strlen(device) <= 8) { // classic device number
|
||||
char *startptr = device + 2;
|
||||
char *endptr = NULL;
|
||||
devnum = strtol(startptr,&endptr,10);
|
||||
if ((startptr==endptr) || (*endptr != '\0')) {
|
||||
devnum = -1;
|
||||
}
|
||||
avrdude_message(MSG_INFO,
|
||||
"%s: ft245r_open(): device number parsed as: "
|
||||
"%d\n",
|
||||
progname,
|
||||
devnum);
|
||||
}
|
||||
}
|
||||
|
||||
// if something went wrong before abort with helpful message
|
||||
if (devnum < 0) {
|
||||
avrdude_message(MSG_INFO, "%s: ft245r_open(): invalid portname '%s': use^ 'ft[0-9]+' or serial number\n",
|
||||
progname,port);
|
||||
return -1;
|
||||
}
|
||||
|
||||
handle = malloc (sizeof (struct ftdi_context));
|
||||
@@ -583,7 +908,8 @@ static int ft245r_open(PROGRAMMER * pgm, char * port) {
|
||||
pgm->usbsn[0]?pgm->usbsn:NULL,
|
||||
devnum);
|
||||
if (rv) {
|
||||
avrdude_message(MSG_INFO, "can't open ftdi device %d. (%s)\n", devnum, ftdi_get_error_string(handle));
|
||||
avrdude_message(MSG_INFO, "%s: can't open ftdi device: %s\n",
|
||||
progname, ftdi_get_error_string(handle));
|
||||
goto cleanup_no_usb;
|
||||
}
|
||||
|
||||
@@ -611,6 +937,13 @@ static int ft245r_open(PROGRAMMER * pgm, char * port) {
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_LED_VFY,0);
|
||||
|
||||
|
||||
rv = ftdi_set_latency_timer(handle, 1);
|
||||
if (rv) {
|
||||
avrdude_message(MSG_INFO, "%s: unable to set latency timer to 1 (%s)\n",
|
||||
progname, ftdi_get_error_string(handle));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rv = ftdi_set_bitmode(handle, ft245r_ddr, BITMODE_SYNCBB); // set Synchronous BitBang
|
||||
if (rv) {
|
||||
avrdude_message(MSG_INFO, "%s: Synchronous BitBangMode is not supported (%s)\n",
|
||||
@@ -623,22 +956,12 @@ static int ft245r_open(PROGRAMMER * pgm, char * port) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* We start a new thread to read the output from the FTDI. This is
|
||||
* necessary because otherwise we'll deadlock. We cannot finish
|
||||
* writing because the ftdi cannot send the results because we
|
||||
* haven't provided a read buffer yet. */
|
||||
|
||||
sem_init (&buf_data, 0, 0);
|
||||
sem_init (&buf_space, 0, BUFSIZE);
|
||||
pthread_create (&readerthread, NULL, reader, handle);
|
||||
|
||||
/*
|
||||
* drain any extraneous input
|
||||
*/
|
||||
ft245r_drain (pgm, 0);
|
||||
|
||||
ft245r_send (pgm, &ft245r_out, 1);
|
||||
ft245r_recv (pgm, &ft245r_in, 1);
|
||||
ft245r_send_and_discard(pgm, &ft245r_out, 1);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -659,8 +982,6 @@ static void ft245r_close(PROGRAMMER * pgm) {
|
||||
ftdi_set_bitmode(handle, 0, BITMODE_RESET); // disable Synchronous BitBang
|
||||
ftdi_usb_close(handle);
|
||||
ftdi_deinit (handle);
|
||||
pthread_cancel(readerthread);
|
||||
pthread_join(readerthread, NULL);
|
||||
free(handle);
|
||||
handle = NULL;
|
||||
}
|
||||
@@ -810,6 +1131,11 @@ static int ft245r_paged_write_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0); // sck down
|
||||
buf[buf_pos++] = ft245r_out;
|
||||
}
|
||||
else {
|
||||
/* stretch sequence to allow correct readout, see extract_data() */
|
||||
buf[buf_pos] = buf[buf_pos - 1];
|
||||
buf_pos++;
|
||||
}
|
||||
ft245r_send(pgm, buf, buf_pos);
|
||||
put_request(addr_save, buf_pos, 0);
|
||||
//ft245r_sync(pgm);
|
||||
@@ -827,7 +1153,7 @@ static int ft245r_paged_write_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
#if defined(USE_INLINE_WRITE_PAGE)
|
||||
while (do_request(pgm, m))
|
||||
;
|
||||
usleep(m->max_write_delay);
|
||||
ft245r_usleep(pgm, m->max_write_delay);
|
||||
#else
|
||||
int addr_wk = addr_save - (addr_save % m->page_size);
|
||||
int rc;
|
||||
@@ -899,6 +1225,11 @@ static int ft245r_paged_load_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0); // sck down
|
||||
buf[buf_pos++] = ft245r_out;
|
||||
}
|
||||
else {
|
||||
/* stretch sequence to allow correct readout, see extract_data() */
|
||||
buf[buf_pos] = buf[buf_pos - 1];
|
||||
buf_pos++;
|
||||
}
|
||||
n = j;
|
||||
ft245r_send(pgm, buf, buf_pos);
|
||||
put_request(addr_save, buf_pos, n);
|
||||
@@ -937,6 +1268,7 @@ void ft245r_initpgm(PROGRAMMER * pgm) {
|
||||
pgm->program_enable = ft245r_program_enable;
|
||||
pgm->chip_erase = ft245r_chip_erase;
|
||||
pgm->cmd = ft245r_cmd;
|
||||
pgm->cmd_tpi = ft245r_cmd_tpi;
|
||||
pgm->open = ft245r_open;
|
||||
pgm->close = ft245r_close;
|
||||
pgm->read_byte = avr_read_byte_default;
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
@@ -84,6 +85,7 @@ struct pdata
|
||||
#define PGM_FL_IS_PDI (0x0002)
|
||||
#define PGM_FL_IS_JTAG (0x0004)
|
||||
#define PGM_FL_IS_EDBG (0x0008)
|
||||
#define PGM_FL_IS_UPDI (0x0010)
|
||||
|
||||
static int jtag3_open(PROGRAMMER * pgm, char * port);
|
||||
static int jtag3_edbg_prepare(PROGRAMMER * pgm);
|
||||
@@ -160,6 +162,11 @@ u16_to_b2(unsigned char *b, unsigned short l)
|
||||
b[1] = (l >> 8) & 0xff;
|
||||
}
|
||||
|
||||
static bool matches(const char *s, const char *pat)
|
||||
{
|
||||
return strncmp(s, pat, strlen(pat)) == 0;
|
||||
}
|
||||
|
||||
static void jtag3_print_data(unsigned char *b, size_t s)
|
||||
{
|
||||
int i;
|
||||
@@ -423,6 +430,7 @@ int jtag3_send(PROGRAMMER * pgm, unsigned char * data, size_t len)
|
||||
if (serial_send(&pgm->fd, buf, len + 4) != 0) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_send(): failed to send command to serial port\n",
|
||||
progname);
|
||||
free(buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -485,7 +493,7 @@ static int jtag3_edbg_send(PROGRAMMER * pgm, unsigned char * data, size_t len)
|
||||
}
|
||||
|
||||
if (serial_send(&pgm->fd, buf, max_xfer) != 0) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_edbg_send(): failed to send command to serial port\n",
|
||||
avrdude_message(MSG_NOTICE, "%s: jtag3_edbg_send(): failed to send command to serial port\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
@@ -501,7 +509,7 @@ static int jtag3_edbg_send(PROGRAMMER * pgm, unsigned char * data, size_t len)
|
||||
(frag == nfragments - 1 && status[1] != 0x01))
|
||||
{
|
||||
/* what to do in this case? */
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_edbg_send(): Unexpected response 0x%02x, 0x%02x\n",
|
||||
avrdude_message(MSG_NOTICE, "%s: jtag3_edbg_send(): Unexpected response 0x%02x, 0x%02x\n",
|
||||
progname, status[0], status[1]);
|
||||
}
|
||||
data += this_len;
|
||||
@@ -588,36 +596,36 @@ static int jtag3_edbg_signoff(PROGRAMMER * pgm)
|
||||
buf[1] = CMSISDAP_LED_CONNECT;
|
||||
buf[2] = 0;
|
||||
if (serial_send(&pgm->fd, buf, pgm->fd.usb.max_xfer) != 0) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_edbg_signoff(): failed to send command to serial port\n",
|
||||
avrdude_message(MSG_NOTICE, "%s: jtag3_edbg_signoff(): failed to send command to serial port\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
rv = serial_recv(&pgm->fd, status, pgm->fd.usb.max_xfer);
|
||||
if (rv != pgm->fd.usb.max_xfer) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_edbg_signoff(): failed to read from serial port (%d)\n",
|
||||
avrdude_message(MSG_NOTICE, "%s: jtag3_edbg_signoff(): failed to read from serial port (%d)\n",
|
||||
progname, rv);
|
||||
return -1;
|
||||
}
|
||||
if (status[0] != CMSISDAP_CMD_LED ||
|
||||
status[1] != 0)
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_edbg_signoff(): unexpected response 0x%02x, 0x%02x\n",
|
||||
avrdude_message(MSG_NOTICE, "%s: jtag3_edbg_signoff(): unexpected response 0x%02x, 0x%02x\n",
|
||||
progname, status[0], status[1]);
|
||||
|
||||
buf[0] = CMSISDAP_CMD_DISCONNECT;
|
||||
if (serial_send(&pgm->fd, buf, pgm->fd.usb.max_xfer) != 0) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_edbg_signoff(): failed to send command to serial port\n",
|
||||
avrdude_message(MSG_NOTICE, "%s: jtag3_edbg_signoff(): failed to send command to serial port\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
rv = serial_recv(&pgm->fd, status, pgm->fd.usb.max_xfer);
|
||||
if (rv != pgm->fd.usb.max_xfer) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_edbg_signoff(): failed to read from serial port (%d)\n",
|
||||
avrdude_message(MSG_NOTICE, "%s: jtag3_edbg_signoff(): failed to read from serial port (%d)\n",
|
||||
progname, rv);
|
||||
return -1;
|
||||
}
|
||||
if (status[0] != CMSISDAP_CMD_DISCONNECT ||
|
||||
status[1] != 0)
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_edbg_signoff(): unexpected response 0x%02x, 0x%02x\n",
|
||||
avrdude_message(MSG_NOTICE, "%s: jtag3_edbg_signoff(): unexpected response 0x%02x, 0x%02x\n",
|
||||
progname, status[0], status[1]);
|
||||
|
||||
return 0;
|
||||
@@ -678,12 +686,12 @@ static int jtag3_edbg_recv_frame(PROGRAMMER * pgm, unsigned char **msg) {
|
||||
avrdude_message(MSG_TRACE, "%s: jtag3_edbg_recv():\n", progname);
|
||||
|
||||
if ((buf = malloc(USBDEV_MAX_XFER_3)) == NULL) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_edbg_recv(): out of memory\n",
|
||||
avrdude_message(MSG_NOTICE, "%s: jtag3_edbg_recv(): out of memory\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
if ((request = malloc(pgm->fd.usb.max_xfer)) == NULL) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_edbg_recv(): out of memory\n",
|
||||
avrdude_message(MSG_NOTICE, "%s: jtag3_edbg_recv(): out of memory\n",
|
||||
progname);
|
||||
free(buf);
|
||||
return -1;
|
||||
@@ -698,7 +706,7 @@ static int jtag3_edbg_recv_frame(PROGRAMMER * pgm, unsigned char **msg) {
|
||||
request[0] = EDBG_VENDOR_AVR_RSP;
|
||||
|
||||
if (serial_send(&pgm->fd, request, pgm->fd.usb.max_xfer) != 0) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_edbg_recv(): error sending CMSIS-DAP vendor command\n",
|
||||
avrdude_message(MSG_NOTICE, "%s: jtag3_edbg_recv(): error sending CMSIS-DAP vendor command\n",
|
||||
progname);
|
||||
free(request);
|
||||
free(*msg);
|
||||
@@ -717,13 +725,26 @@ static int jtag3_edbg_recv_frame(PROGRAMMER * pgm, unsigned char **msg) {
|
||||
}
|
||||
|
||||
if (buf[0] != EDBG_VENDOR_AVR_RSP) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_edbg_recv(): Unexpected response 0x%02x\n",
|
||||
avrdude_message(MSG_NOTICE, "%s: jtag3_edbg_recv(): Unexpected response 0x%02x\n",
|
||||
progname, buf[0]);
|
||||
free(*msg);
|
||||
free(request);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf[1] == 0) {
|
||||
// Documentation says:
|
||||
// "FragmentInfo 0x00 indicates that no response data is
|
||||
// available, and the rest of the packet is ignored."
|
||||
avrdude_message(MSG_NOTICE,
|
||||
"%s: jtag3_edbg_recv(): "
|
||||
"No response available\n",
|
||||
progname);
|
||||
free(*msg);
|
||||
free(request);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* calculate fragment information */
|
||||
if (thisfrag == 0) {
|
||||
/* first fragment */
|
||||
@@ -731,7 +752,7 @@ static int jtag3_edbg_recv_frame(PROGRAMMER * pgm, unsigned char **msg) {
|
||||
thisfrag = 1;
|
||||
} else {
|
||||
if (nfrags != (buf[1] & 0x0F)) {
|
||||
avrdude_message(MSG_INFO,
|
||||
avrdude_message(MSG_NOTICE,
|
||||
"%s: jtag3_edbg_recv(): "
|
||||
"Inconsistent # of fragments; had %d, now %d\n",
|
||||
progname, nfrags, (buf[1] & 0x0F));
|
||||
@@ -741,7 +762,7 @@ static int jtag3_edbg_recv_frame(PROGRAMMER * pgm, unsigned char **msg) {
|
||||
}
|
||||
}
|
||||
if (thisfrag != ((buf[1] >> 4) & 0x0F)) {
|
||||
avrdude_message(MSG_INFO,
|
||||
avrdude_message(MSG_NOTICE,
|
||||
"%s: jtag3_edbg_recv(): "
|
||||
"Inconsistent fragment number; expect %d, got %d\n",
|
||||
progname, thisfrag, ((buf[1] >> 4) & 0x0F));
|
||||
@@ -752,12 +773,12 @@ static int jtag3_edbg_recv_frame(PROGRAMMER * pgm, unsigned char **msg) {
|
||||
|
||||
int thislen = (buf[2] << 8) | buf[3];
|
||||
if (thislen > rv + 4) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_edbg_recv(): Unexpected length value (%d > %d)\n",
|
||||
avrdude_message(MSG_NOTICE, "%s: jtag3_edbg_recv(): Unexpected length value (%d > %d)\n",
|
||||
progname, thislen, rv + 4);
|
||||
thislen = rv + 4;
|
||||
}
|
||||
if (len + thislen > USBDEV_MAX_XFER_3) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_edbg_recv(): Length exceeds max size (%d > %d)\n",
|
||||
avrdude_message(MSG_NOTICE, "%s: jtag3_edbg_recv(): Length exceeds max size (%d > %d)\n",
|
||||
progname, len + thislen, USBDEV_MAX_XFER_3);
|
||||
thislen = USBDEV_MAX_XFER_3 - len;
|
||||
}
|
||||
@@ -839,11 +860,18 @@ int jtag3_recv(PROGRAMMER * pgm, unsigned char **msg) {
|
||||
|
||||
c = (*resp)[1];
|
||||
if ((c & RSP3_STATUS_MASK) != RSP3_OK) {
|
||||
avrdude_message(MSG_INFO, "%s: bad response to %s command: 0x%02x\n",
|
||||
progname, descr, c);
|
||||
if ((c == RSP3_FAILED) && ((*resp)[3] == RSP3_FAIL_OCD_LOCKED)) {
|
||||
avrdude_message(MSG_INFO,
|
||||
"%s: Device is locked! Chip erase required to unlock.\n",
|
||||
progname);
|
||||
} else {
|
||||
avrdude_message(MSG_NOTICE, "%s: bad response to %s command: 0x%02x\n",
|
||||
progname, descr, c);
|
||||
}
|
||||
status = (*resp)[3];
|
||||
free(*resp);
|
||||
resp = 0;
|
||||
return -1;
|
||||
return -status;
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -856,9 +884,13 @@ int jtag3_getsync(PROGRAMMER * pgm, int mode) {
|
||||
|
||||
avrdude_message(MSG_DEBUG, "%s: jtag3_getsync()\n", progname);
|
||||
|
||||
if (pgm->flag & PGM_FL_IS_EDBG) {
|
||||
if (jtag3_edbg_prepare(pgm) < 0)
|
||||
return -1;
|
||||
/* XplainedMini boards do not need this, and early revisions had a
|
||||
* firmware bug where they complained about it. */
|
||||
if ((pgm->flag & PGM_FL_IS_EDBG) &&
|
||||
!matches(ldata(lfirst(pgm->id)), "xplainedmini")) {
|
||||
if (jtag3_edbg_prepare(pgm) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the sign-on information. */
|
||||
@@ -894,6 +926,34 @@ static int jtag3_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* UPDI 'unlock' -> 'enter progmode' with chip erase key
|
||||
*/
|
||||
static int jtag3_unlock_erase_key(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
unsigned char buf[8], *resp;
|
||||
|
||||
buf[0] = 1; /* Enable */
|
||||
if (jtag3_setparm(pgm, SCOPE_AVR, SET_GET_CTXT_OPTIONS, PARM3_OPT_CHIP_ERASE_TO_ENTER, buf, 1) < 0)
|
||||
return -1;
|
||||
|
||||
buf[0] = SCOPE_AVR;
|
||||
buf[1] = CMD3_ENTER_PROGMODE;
|
||||
buf[2] = 0;
|
||||
|
||||
if (jtag3_command(pgm, buf, 3, &resp, "enter progmode") < 0)
|
||||
return -1;
|
||||
PDATA(pgm)->prog_enabled = 1;
|
||||
|
||||
buf[0] = 0; /* Disable */
|
||||
if (jtag3_setparm(pgm, SCOPE_AVR, SET_GET_CTXT_OPTIONS, PARM3_OPT_CHIP_ERASE_TO_ENTER, buf, 1) < 0)
|
||||
return -1;
|
||||
|
||||
free(resp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* There is no chip erase functionality in debugWire mode.
|
||||
*/
|
||||
@@ -914,6 +974,7 @@ static int jtag3_program_enable_dummy(PROGRAMMER * pgm, AVRPART * p)
|
||||
static int jtag3_program_enable(PROGRAMMER * pgm)
|
||||
{
|
||||
unsigned char buf[3], *resp;
|
||||
int status;
|
||||
|
||||
if (PDATA(pgm)->prog_enabled)
|
||||
return 0;
|
||||
@@ -922,14 +983,14 @@ static int jtag3_program_enable(PROGRAMMER * pgm)
|
||||
buf[1] = CMD3_ENTER_PROGMODE;
|
||||
buf[2] = 0;
|
||||
|
||||
if (jtag3_command(pgm, buf, 3, &resp, "enter progmode") >= 0) {
|
||||
if ((status = jtag3_command(pgm, buf, 3, &resp, "enter progmode")) >= 0) {
|
||||
free(resp);
|
||||
PDATA(pgm)->prog_enabled = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return status;
|
||||
}
|
||||
|
||||
static int jtag3_program_disable(PROGRAMMER * pgm)
|
||||
@@ -1014,6 +1075,10 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
ifname = "PDI";
|
||||
if (p->flags & AVRPART_HAS_PDI)
|
||||
conn = PARM3_CONN_PDI;
|
||||
} else if (pgm->flag & PGM_FL_IS_UPDI) {
|
||||
ifname = "UPDI";
|
||||
if (p->flags & AVRPART_HAS_UPDI)
|
||||
conn = PARM3_CONN_UPDI;
|
||||
} else {
|
||||
ifname = "JTAG";
|
||||
if (p->flags & AVRPART_HAS_JTAG)
|
||||
@@ -1028,6 +1093,8 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
|
||||
if (p->flags & AVRPART_HAS_PDI)
|
||||
parm[0] = PARM3_ARCH_XMEGA;
|
||||
else if (p->flags & AVRPART_HAS_UPDI)
|
||||
parm[0] = PARM3_ARCH_UPDI;
|
||||
else if (p->flags & AVRPART_HAS_DW)
|
||||
parm[0] = PARM3_ARCH_TINY;
|
||||
else
|
||||
@@ -1043,7 +1110,7 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
if (jtag3_setparm(pgm, SCOPE_AVR, 1, PARM3_CONNECTION, parm, 1) < 0)
|
||||
return -1;
|
||||
|
||||
if (conn == PARM3_CONN_PDI)
|
||||
if (conn == PARM3_CONN_PDI || conn == PARM3_CONN_UPDI)
|
||||
PDATA(pgm)->set_sck = jtag3_set_sck_xmega_pdi;
|
||||
else if (conn == PARM3_CONN_JTAG) {
|
||||
if (p->flags & AVRPART_HAS_PDI)
|
||||
@@ -1062,7 +1129,7 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
if (PDATA(pgm)->set_sck(pgm, parm) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
jtag3_print_parms1(pgm, progbuf);
|
||||
if (conn == PARM3_CONN_JTAG)
|
||||
{
|
||||
avrdude_message(MSG_NOTICE2, "%s: jtag3_initialize(): "
|
||||
@@ -1105,9 +1172,10 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
u32_to_b4(xd.nvm_boot_offset, m->offset);
|
||||
} else if (strcmp(m->desc, "fuse1") == 0) {
|
||||
u32_to_b4(xd.nvm_fuse_offset, m->offset & ~7);
|
||||
} else if (strncmp(m->desc, "lock", 4) == 0) {
|
||||
} 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);
|
||||
@@ -1119,6 +1187,100 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
if (jtag3_setparm(pgm, SCOPE_AVR, 2, PARM3_DEVICEDESC, (unsigned char *)&xd, sizeof xd) < 0)
|
||||
return -1;
|
||||
}
|
||||
else if ((p->flags & AVRPART_HAS_UPDI))
|
||||
{
|
||||
struct updi_device_desc xd;
|
||||
LNODEID ln;
|
||||
AVRMEM *m;
|
||||
|
||||
u16_to_b2(xd.nvm_base_addr, p->nvm_base);
|
||||
u16_to_b2(xd.ocd_base_addr, p->ocd_base);
|
||||
|
||||
for (ln = lfirst(p->mem); ln; ln = lnext(ln))
|
||||
{
|
||||
m = ldata(ln);
|
||||
if (strcmp(m->desc, "flash") == 0)
|
||||
{
|
||||
u16_to_b2(xd.prog_base, m->offset&0xFFFF);
|
||||
xd.prog_base_msb = m->offset>>16;
|
||||
|
||||
if (m->readsize != 0 && m->readsize < m->page_size)
|
||||
PDATA(pgm)->flash_pagesize = m->readsize;
|
||||
else
|
||||
PDATA(pgm)->flash_pagesize = m->page_size;
|
||||
xd.flash_page_size = m->page_size & 0xFF;
|
||||
xd.flash_page_size_msb = (m->page_size)>>8;
|
||||
|
||||
u32_to_b4(xd.flash_bytes, m->size);
|
||||
|
||||
if (m->offset > 0xFFFF)
|
||||
xd.address_mode = UPDI_ADDRESS_MODE_24BIT;
|
||||
else
|
||||
xd.address_mode = UPDI_ADDRESS_MODE_16BIT;
|
||||
}
|
||||
else if (strcmp(m->desc, "eeprom") == 0)
|
||||
{
|
||||
PDATA(pgm)->eeprom_pagesize = m->page_size;
|
||||
xd.eeprom_page_size = m->page_size;
|
||||
|
||||
u16_to_b2(xd.eeprom_bytes, m->size);
|
||||
u16_to_b2(xd.eeprom_base, m->offset);
|
||||
}
|
||||
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);
|
||||
}
|
||||
else if (strcmp(m->desc, "signature") == 0)
|
||||
{
|
||||
u16_to_b2(xd.signature_base, m->offset);
|
||||
xd.device_id[0] = p->signature[1];
|
||||
xd.device_id[1] = p->signature[2];
|
||||
}
|
||||
else if (strcmp(m->desc, "fuses") == 0)
|
||||
{
|
||||
xd.fuses_bytes = m->size;
|
||||
u16_to_b2(xd.fuses_base, m->offset);
|
||||
}
|
||||
else if (strcmp(m->desc, "lock") == 0)
|
||||
{
|
||||
u16_to_b2(xd.lockbits_base, m->offset);
|
||||
}
|
||||
}
|
||||
|
||||
u16_to_b2(xd.default_min_div1_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV1_VOLTAGE_MV);
|
||||
u16_to_b2(xd.default_min_div2_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV2_VOLTAGE_MV);
|
||||
u16_to_b2(xd.default_min_div4_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV4_VOLTAGE_MV);
|
||||
u16_to_b2(xd.default_min_div8_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV8_VOLTAGE_MV);
|
||||
u16_to_b2(xd.pdi_pad_fmax, MAX_FREQUENCY_SHARED_UPDI_PIN);
|
||||
xd.syscfg_offset = FUSES_SYSCFG0_OFFSET;
|
||||
xd.syscfg_write_mask_and = 0xFF;
|
||||
xd.syscfg_write_mask_or = 0x00;
|
||||
xd.syscfg_erase_mask_and = 0xFF;
|
||||
xd.syscfg_erase_mask_or = 0x00;
|
||||
|
||||
avrdude_message(MSG_NOTICE2, "UPDI SET: \n\t"
|
||||
"xd->prog_base_msb=%x\n\t"
|
||||
"xd->prog_base=%x %x\n\t"
|
||||
"xd->flash_page_size_msb=%x\n\t"
|
||||
"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->address_mode=%x\n",
|
||||
xd.prog_base_msb,
|
||||
xd.prog_base[0], xd.prog_base[1],
|
||||
xd.flash_page_size_msb,
|
||||
xd.flash_page_size,
|
||||
xd.eeprom_page_size,
|
||||
xd.nvm_base_addr[0], xd.nvm_base_addr[1],
|
||||
xd.ocd_base_addr[0], xd.ocd_base_addr[1],
|
||||
xd.address_mode);
|
||||
|
||||
if (jtag3_setparm(pgm, SCOPE_AVR, 2, PARM3_DEVICEDESC, (unsigned char *)&xd, sizeof xd) < 0)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct mega_device_desc md;
|
||||
@@ -1191,27 +1353,39 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
if ((status = jtag3_command(pgm, cmd, 4, &resp, "AVR sign-on")) >= 0)
|
||||
break;
|
||||
|
||||
avrdude_message(MSG_INFO, "%s: retrying with external reset applied\n",
|
||||
avrdude_message(MSG_NOTICE, "%s: retrying with external reset applied\n",
|
||||
progname);
|
||||
}
|
||||
|
||||
if (use_ext_reset > 1) {
|
||||
avrdude_message(MSG_INFO, "%s: JTAGEN fuse disabled?\n", progname);
|
||||
return -1;
|
||||
if(strcmp(pgm->type, "JTAGICE3") == 0 && p->flags & AVRPART_HAS_JTAG)
|
||||
avrdude_message(MSG_INFO, "%s: JTAGEN fuse disabled?\n", progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Depending on the target connection, there are two different
|
||||
* Depending on the target connection, there are three different
|
||||
* possible replies of the ICE. For a JTAG connection, the reply
|
||||
* format is RSP3_DATA, followed by 4 bytes of the JTAG ID read from
|
||||
* the device (followed by a trailing 0). For all other connections
|
||||
* the device (followed by a trailing 0).
|
||||
* For a UPDI connection the reply format is RSP3_DATA, followed by
|
||||
* 4 bytes of the SIB Family_ID read from the device (followed by a
|
||||
* trailing 0).
|
||||
* For all other connections
|
||||
* (except ISP which is handled completely differently, but that
|
||||
* doesn't apply here anyway), the response is just RSP_OK.
|
||||
*/
|
||||
if (resp[1] == RSP3_DATA && status >= 7)
|
||||
/* JTAG ID has been returned */
|
||||
avrdude_message(MSG_NOTICE, "%s: JTAG ID returned: 0x%02x 0x%02x 0x%02x 0x%02x\n",
|
||||
progname, resp[3], resp[4], resp[5], resp[6]);
|
||||
if (resp[1] == RSP3_DATA && status >= 7) {
|
||||
if (p->flags & AVRPART_HAS_UPDI) {
|
||||
/* Partial Family_ID has been returned */
|
||||
avrdude_message(MSG_NOTICE, "%s: Partial Family_ID returned: \"%c%c%c%c\"\n",
|
||||
progname, resp[3], resp[4], resp[5], resp[6]);
|
||||
}
|
||||
else
|
||||
/* JTAG ID has been returned */
|
||||
avrdude_message(MSG_NOTICE, "%s: JTAG ID returned: 0x%02x 0x%02x 0x%02x 0x%02x\n",
|
||||
progname, resp[3], resp[4], resp[5], resp[6]);
|
||||
}
|
||||
|
||||
free(resp);
|
||||
|
||||
@@ -1279,7 +1453,7 @@ static int jtag3_parseextparms(PROGRAMMER * pgm, LISTID extparms)
|
||||
for (ln = lfirst(extparms); ln; ln = lnext(ln)) {
|
||||
extended_param = ldata(ln);
|
||||
|
||||
if (strncmp(extended_param, "jtagchain=", strlen("jtagchain=")) == 0) {
|
||||
if (matches(extended_param, "jtagchain=")) {
|
||||
unsigned int ub, ua, bb, ba;
|
||||
if (sscanf(extended_param, "jtagchain=%u,%u,%u,%u", &ub, &ua, &bb, &ba)
|
||||
!= 4) {
|
||||
@@ -1314,18 +1488,17 @@ int jtag3_open_common(PROGRAMMER * pgm, char * port)
|
||||
LNODEID usbpid;
|
||||
int rv = -1;
|
||||
|
||||
#if !defined(HAVE_LIBUSB)
|
||||
avrdude_message(MSG_INFO, "avrdude was compiled without usb support.\n");
|
||||
#if !defined(HAVE_LIBUSB) && !defined(HAVE_LIBHIDAPI)
|
||||
avrdude_message(MSG_INFO, "avrdude was compiled without USB or HIDAPI support.\n");
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
if (strncmp(port, "usb", 3) != 0) {
|
||||
if (!matches(port, "usb")) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_open_common(): JTAGICE3/EDBG port names must start with \"usb\"\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
serdev = &usb_serdev_frame;
|
||||
if (pgm->usbvid)
|
||||
pinfo.usbinfo.vid = pgm->usbvid;
|
||||
else
|
||||
@@ -1335,17 +1508,42 @@ int jtag3_open_common(PROGRAMMER * pgm, char * port)
|
||||
if (lfirst(pgm->usbpid) == NULL)
|
||||
ladd(pgm->usbpid, (void *)USB_DEVICE_JTAGICE3);
|
||||
|
||||
#if defined(HAVE_LIBHIDAPI)
|
||||
/*
|
||||
* Try HIDAPI first. LibUSB is more generic, but might then cause
|
||||
* troubles for HID-class devices in some OSes (like Windows).
|
||||
*/
|
||||
serdev = &usbhid_serdev;
|
||||
for (usbpid = lfirst(pgm->usbpid); rv < 0 && usbpid != NULL; usbpid = lnext(usbpid)) {
|
||||
pinfo.usbinfo.flags = PINFO_FL_SILENT;
|
||||
pinfo.usbinfo.pid = *(int *)(ldata(usbpid));
|
||||
pgm->fd.usb.max_xfer = USBDEV_MAX_XFER_3;
|
||||
pgm->fd.usb.rep = USBDEV_BULK_EP_READ_3;
|
||||
pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_3;
|
||||
pgm->fd.usb.eep = USBDEV_EVT_EP_READ_3;
|
||||
pgm->fd.usb.eep = 0;
|
||||
|
||||
strcpy(pgm->port, port);
|
||||
rv = serial_open(port, pinfo, &pgm->fd);
|
||||
}
|
||||
if (rv < 0) {
|
||||
#endif /* HAVE_LIBHIDAPI */
|
||||
#if defined(HAVE_LIBUSB)
|
||||
serdev = &usb_serdev_frame;
|
||||
for (usbpid = lfirst(pgm->usbpid); rv < 0 && usbpid != NULL; usbpid = lnext(usbpid)) {
|
||||
pinfo.usbinfo.flags = PINFO_FL_SILENT;
|
||||
pinfo.usbinfo.pid = *(int *)(ldata(usbpid));
|
||||
pgm->fd.usb.max_xfer = USBDEV_MAX_XFER_3;
|
||||
pgm->fd.usb.rep = USBDEV_BULK_EP_READ_3;
|
||||
pgm->fd.usb.wep = USBDEV_BULK_EP_WRITE_3;
|
||||
pgm->fd.usb.eep = USBDEV_EVT_EP_READ_3;
|
||||
|
||||
strcpy(pgm->port, port);
|
||||
rv = serial_open(port, pinfo, &pgm->fd);
|
||||
}
|
||||
#endif /* HAVE_LIBUSB */
|
||||
#if defined(HAVE_LIBHIDAPI)
|
||||
}
|
||||
#endif
|
||||
if (rv < 0) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_open_common(): Did not find any device matching VID 0x%04x and PID list: ",
|
||||
progname, (unsigned)pinfo.usbinfo.vid);
|
||||
@@ -1419,6 +1617,18 @@ static int jtag3_open_pdi(PROGRAMMER * pgm, char * port)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int jtag3_open_updi(PROGRAMMER * pgm, char * port)
|
||||
{
|
||||
avrdude_message(MSG_NOTICE2, "%s: jtag3_open_updi()\n", progname);
|
||||
|
||||
if (jtag3_open_common(pgm, port) < 0)
|
||||
return -1;
|
||||
|
||||
if (jtag3_getsync(pgm, PARM3_CONN_UPDI) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void jtag3_close(PROGRAMMER * pgm)
|
||||
{
|
||||
@@ -1439,8 +1649,12 @@ void jtag3_close(PROGRAMMER * pgm)
|
||||
if (jtag3_command(pgm, buf, 4, &resp, "sign-off") >= 0)
|
||||
free(resp);
|
||||
|
||||
if (pgm->flag & PGM_FL_IS_EDBG)
|
||||
jtag3_edbg_signoff(pgm);
|
||||
/* XplainedMini boards do not need this, and early revisions had a
|
||||
* firmware bug where they complained about it. */
|
||||
if ((pgm->flag & PGM_FL_IS_EDBG) &&
|
||||
!matches(ldata(lfirst(pgm->id)), "xplainedmini")) {
|
||||
jtag3_edbg_signoff(pgm);
|
||||
}
|
||||
|
||||
serial_close(&pgm->fd);
|
||||
pgm->fd.ifd = -1;
|
||||
@@ -1474,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;
|
||||
@@ -1502,8 +1717,13 @@ static int jtag3_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int status, dynamic_memtype = 0;
|
||||
long otimeout = serial_recv_timeout;
|
||||
|
||||
avrdude_message(MSG_NOTICE2, "%s: jtag3_paged_write(.., %s, %d, %d)\n",
|
||||
progname, m->desc, page_size, n_bytes);
|
||||
avrdude_message(MSG_NOTICE2, "%s: jtag3_paged_write(.., %s, %d, 0x%lx, %d)\n",
|
||||
progname, m->desc, page_size, addr, n_bytes);
|
||||
|
||||
block_size = jtag3_memaddr(pgm, p, m, addr);
|
||||
if(block_size != addr)
|
||||
avrdude_message(MSG_NOTICE2, " mapped to address: 0x%lx\n", block_size);
|
||||
block_size = 0;
|
||||
|
||||
if (!(pgm->flag & PGM_FL_IS_DW) && jtag3_program_enable(pgm) < 0)
|
||||
return -1;
|
||||
@@ -1543,11 +1763,12 @@ 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 ) {
|
||||
} else if ( p->flags & AVRPART_HAS_PDI || p->flags & AVRPART_HAS_UPDI ) {
|
||||
cmd[3] = MTYPE_FLASH;
|
||||
} else {
|
||||
cmd[3] = MTYPE_SPM;
|
||||
@@ -1606,8 +1827,13 @@ static int jtag3_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int status, dynamic_memtype = 0;
|
||||
long otimeout = serial_recv_timeout;
|
||||
|
||||
avrdude_message(MSG_NOTICE2, "%s: jtag3_paged_load(.., %s, %d, %d)\n",
|
||||
progname, m->desc, page_size, n_bytes);
|
||||
avrdude_message(MSG_NOTICE2, "%s: jtag3_paged_load(.., %s, %d, 0x%lx, %d)\n",
|
||||
progname, m->desc, page_size, addr, n_bytes);
|
||||
|
||||
block_size = jtag3_memaddr(pgm, p, m, addr);
|
||||
if(block_size != addr)
|
||||
avrdude_message(MSG_NOTICE2, " mapped to address: 0x%lx\n", block_size);
|
||||
block_size = 0;
|
||||
|
||||
if (!(pgm->flag & PGM_FL_IS_DW) && jtag3_program_enable(pgm) < 0)
|
||||
return -1;
|
||||
@@ -1624,17 +1850,20 @@ static int jtag3_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[3] = ( p->flags & AVRPART_HAS_PDI ) ? MTYPE_EEPROM : MTYPE_EEPROM_PAGE;
|
||||
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;
|
||||
} else if ( p->flags & AVRPART_HAS_UPDI ) {
|
||||
cmd[3] = MTYPE_SRAM;
|
||||
} else {
|
||||
cmd[3] = MTYPE_SPM;
|
||||
}
|
||||
@@ -1685,14 +1914,20 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
avrdude_message(MSG_NOTICE2, "%s: jtag3_read_byte(.., %s, 0x%lx, ...)\n",
|
||||
progname, mem->desc, addr);
|
||||
|
||||
if (!(pgm->flag & PGM_FL_IS_DW) && jtag3_program_enable(pgm) < 0)
|
||||
return -1;
|
||||
paddr = jtag3_memaddr(pgm, p, mem, addr);
|
||||
if(paddr != addr)
|
||||
avrdude_message(MSG_NOTICE2, " mapped to address: 0x%lx\n", paddr);
|
||||
paddr = 0;
|
||||
|
||||
if (!(pgm->flag & PGM_FL_IS_DW))
|
||||
if ((status = jtag3_program_enable(pgm)) < 0)
|
||||
return status;
|
||||
|
||||
cmd[0] = SCOPE_AVR;
|
||||
cmd[1] = CMD3_READ_MEMORY;
|
||||
cmd[2] = 0;
|
||||
|
||||
cmd[3] = ( p->flags & AVRPART_HAS_PDI ) ? MTYPE_FLASH : MTYPE_FLASH_PAGE;
|
||||
cmd[3] = ( p->flags & AVRPART_HAS_PDI || p->flags & AVRPART_HAS_UPDI ) ? MTYPE_FLASH : MTYPE_FLASH_PAGE;
|
||||
if (strcmp(mem->desc, "flash") == 0 ||
|
||||
strcmp(mem->desc, "application") == 0 ||
|
||||
strcmp(mem->desc, "apptable") == 0 ||
|
||||
@@ -1703,7 +1938,7 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
paddr_ptr = &PDATA(pgm)->flash_pageaddr;
|
||||
cache_ptr = PDATA(pgm)->flash_pagecache;
|
||||
} else if (strcmp(mem->desc, "eeprom") == 0) {
|
||||
if ( (pgm->flag & PGM_FL_IS_DW) || ( p->flags & AVRPART_HAS_PDI ) ) {
|
||||
if ( (pgm->flag & PGM_FL_IS_DW) || ( p->flags & AVRPART_HAS_PDI ) || ( p->flags & AVRPART_HAS_UPDI ) ) {
|
||||
cmd[3] = MTYPE_EEPROM;
|
||||
} else {
|
||||
cmd[3] = MTYPE_EEPROM_PAGE;
|
||||
@@ -1727,17 +1962,31 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
addr = 2;
|
||||
if (pgm->flag & PGM_FL_IS_DW)
|
||||
unsupp = 1;
|
||||
} else if (strncmp(mem->desc, "lock", 4) == 0) {
|
||||
} else if (matches(mem->desc, "lock")) {
|
||||
cmd[3] = MTYPE_LOCK_BITS;
|
||||
if (pgm->flag & PGM_FL_IS_DW)
|
||||
unsupp = 1;
|
||||
} else if (strncmp(mem->desc, "fuse", strlen("fuse")) == 0) {
|
||||
} else if (matches(mem->desc, "fuse")) {
|
||||
cmd[3] = MTYPE_FUSE_BITS;
|
||||
addr = mem->offset & 7;
|
||||
} else if (strcmp(mem->desc, "usersig") == 0) {
|
||||
if (!(p->flags & AVRPART_HAS_UPDI))
|
||||
addr = mem->offset & 7;
|
||||
} 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;
|
||||
} else if (strcmp(mem->desc, "sernum") == 0) {
|
||||
cmd[3] = MTYPE_SIGN_JTAG;
|
||||
} else if (strcmp(mem->desc, "osccal16") == 0) {
|
||||
cmd[3] = MTYPE_SIGN_JTAG;
|
||||
} else if (strcmp(mem->desc, "osccal20") == 0) {
|
||||
cmd[3] = MTYPE_SIGN_JTAG;
|
||||
} else if (strcmp(mem->desc, "tempsense") == 0) {
|
||||
cmd[3] = MTYPE_SIGN_JTAG;
|
||||
} else if (strcmp(mem->desc, "osc16err") == 0) {
|
||||
cmd[3] = MTYPE_SIGN_JTAG;
|
||||
} else if (strcmp(mem->desc, "osc20err") == 0) {
|
||||
cmd[3] = MTYPE_SIGN_JTAG;
|
||||
} else if (strcmp(mem->desc, "calibration") == 0) {
|
||||
cmd[3] = MTYPE_OSCCAL_BYTE;
|
||||
if (pgm->flag & PGM_FL_IS_DW)
|
||||
@@ -1754,11 +2003,11 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
* harm for other connection types either.
|
||||
*/
|
||||
u32_to_b4(cmd + 8, 3);
|
||||
u32_to_b4(cmd + 4, 0);
|
||||
u32_to_b4(cmd + 4, jtag3_memaddr(pgm, p, mem, addr));
|
||||
|
||||
if (addr == 0) {
|
||||
if ((status = jtag3_command(pgm, cmd, 12, &resp, "read memory")) < 0)
|
||||
return -1;
|
||||
return status;
|
||||
|
||||
signature_cache[0] = resp[4];
|
||||
signature_cache[1] = resp[5];
|
||||
@@ -1800,14 +2049,15 @@ static int jtag3_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
|
||||
if (pagesize) {
|
||||
u32_to_b4(cmd + 8, pagesize);
|
||||
u32_to_b4(cmd + 4, paddr);
|
||||
u32_to_b4(cmd + 4, jtag3_memaddr(pgm, p, mem, paddr));
|
||||
|
||||
} else {
|
||||
u32_to_b4(cmd + 8, 1);
|
||||
u32_to_b4(cmd + 4, addr);
|
||||
u32_to_b4(cmd + 4, jtag3_memaddr(pgm, p, mem, addr));
|
||||
}
|
||||
|
||||
if ((status = jtag3_command(pgm, cmd, 12, &resp, "read memory")) < 0)
|
||||
return -1;
|
||||
return status;
|
||||
|
||||
if (resp[1] != RSP3_DATA ||
|
||||
status < (pagesize? pagesize: 1) + 4) {
|
||||
@@ -1836,14 +2086,19 @@ static int jtag3_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
unsigned char *cache_ptr = 0;
|
||||
int status, unsupp = 0;
|
||||
unsigned int pagesize = 0;
|
||||
unsigned long mapped_addr;
|
||||
|
||||
avrdude_message(MSG_NOTICE2, "%s: jtag3_write_byte(.., %s, 0x%lx, ...)\n",
|
||||
progname, mem->desc, addr);
|
||||
|
||||
mapped_addr = jtag3_memaddr(pgm, p, mem, addr);
|
||||
if(mapped_addr != addr)
|
||||
avrdude_message(MSG_NOTICE2, " mapped to address: 0x%lx\n", mapped_addr);
|
||||
|
||||
cmd[0] = SCOPE_AVR;
|
||||
cmd[1] = CMD3_WRITE_MEMORY;
|
||||
cmd[2] = 0;
|
||||
cmd[3] = ( p->flags & AVRPART_HAS_PDI ) ? MTYPE_FLASH : MTYPE_SPM;
|
||||
cmd[3] = ( p->flags & AVRPART_HAS_PDI || p->flags & AVRPART_HAS_UPDI ) ? MTYPE_FLASH : MTYPE_SPM;
|
||||
if (strcmp(mem->desc, "flash") == 0) {
|
||||
cache_ptr = PDATA(pgm)->flash_pagecache;
|
||||
pagesize = PDATA(pgm)->flash_pagesize;
|
||||
@@ -1873,14 +2128,16 @@ static int jtag3_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
addr = 2;
|
||||
if (pgm->flag & PGM_FL_IS_DW)
|
||||
unsupp = 1;
|
||||
} else if (strncmp(mem->desc, "fuse", strlen("fuse")) == 0) {
|
||||
} else if (matches(mem->desc, "fuse")) {
|
||||
cmd[3] = MTYPE_FUSE_BITS;
|
||||
addr = mem->offset & 7;
|
||||
} else if (strcmp(mem->desc, "usersig") == 0) {
|
||||
if (!(p->flags & AVRPART_HAS_UPDI))
|
||||
addr = mem->offset & 7;
|
||||
} 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;
|
||||
} else if (strncmp(mem->desc, "lock", 4) == 0) {
|
||||
} else if (matches(mem->desc, "lock")) {
|
||||
cmd[3] = MTYPE_LOCK_BITS;
|
||||
if (pgm->flag & PGM_FL_IS_DW)
|
||||
unsupp = 1;
|
||||
@@ -1923,12 +2180,12 @@ static int jtag3_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
return -1;
|
||||
|
||||
u32_to_b4(cmd + 8, 1);
|
||||
u32_to_b4(cmd + 4, addr);
|
||||
u32_to_b4(cmd + 4, jtag3_memaddr(pgm, p, mem, addr));
|
||||
cmd[12] = 0;
|
||||
cmd[13] = data;
|
||||
|
||||
if ((status = jtag3_command(pgm, cmd, 14, &resp, "write memory")) < 0)
|
||||
return -1;
|
||||
return status;
|
||||
|
||||
free(resp);
|
||||
|
||||
@@ -1991,7 +2248,7 @@ int jtag3_getparm(PROGRAMMER * pgm, unsigned char scope,
|
||||
|
||||
c = resp[1];
|
||||
if (c != RSP3_DATA || status < 3) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_getparm(): "
|
||||
avrdude_message(MSG_NOTICE, "%s: jtag3_getparm(): "
|
||||
"bad response to %s\n",
|
||||
progname, descr);
|
||||
free(resp);
|
||||
@@ -2045,6 +2302,55 @@ int jtag3_setparm(PROGRAMMER * pgm, unsigned char scope,
|
||||
return status;
|
||||
}
|
||||
|
||||
int jtag3_read_sib(PROGRAMMER * pgm, AVRPART * p, char * sib)
|
||||
{
|
||||
int status;
|
||||
unsigned char cmd[12];
|
||||
unsigned char *resp = NULL;
|
||||
|
||||
cmd[0] = SCOPE_AVR;
|
||||
cmd[1] = CMD3_READ_MEMORY;
|
||||
cmd[2] = 0;
|
||||
cmd[3] = MTYPE_SIB;
|
||||
u32_to_b4(cmd + 4, 0);
|
||||
u32_to_b4(cmd + 8, AVR_SIBLEN);
|
||||
|
||||
if ((status = jtag3_command(pgm, cmd, 12, &resp, "read SIB")) < 0)
|
||||
return status;
|
||||
|
||||
memcpy(sib, resp+3, AVR_SIBLEN);
|
||||
sib[AVR_SIBLEN] = 0; // Zero terminate string
|
||||
avrdude_message(MSG_DEBUG, "%s: jtag3_read_sib(): Received SIB: \"%s\"\n", progname, sib);
|
||||
free(resp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int jtag3_set_vtarget(PROGRAMMER * pgm, double v)
|
||||
{
|
||||
unsigned uaref, utarg;
|
||||
unsigned char buf[2];
|
||||
|
||||
utarg = (unsigned)(v * 1000);
|
||||
|
||||
if (jtag3_getparm(pgm, SCOPE_GENERAL, 1, PARM3_VTARGET, buf, 2) < 0) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_set_vtarget(): cannot obtain V[target]\n",
|
||||
progname);
|
||||
}
|
||||
|
||||
uaref = b2_to_u16(buf);
|
||||
u16_to_b2(buf, utarg);
|
||||
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_set_vtarget(): changing V[target] from %.1f to %.1f\n",
|
||||
progname, uaref / 1000.0, v);
|
||||
|
||||
if (jtag3_setparm(pgm, SCOPE_GENERAL, 1, PARM3_VADJUST, buf, sizeof(buf)) < 0) {
|
||||
avrdude_message(MSG_INFO, "%s: jtag3_set_vtarget(): cannot confirm new V[target] value\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void jtag3_display(PROGRAMMER * pgm, const char * p)
|
||||
{
|
||||
@@ -2080,14 +2386,12 @@ static void jtag3_display(PROGRAMMER * pgm, const char * p)
|
||||
memmove(resp, resp + 3, status - 3);
|
||||
resp[status - 3] = 0;
|
||||
|
||||
avrdude_message(MSG_INFO, "%sICE hardware version: %d\n", p, parms[0]);
|
||||
avrdude_message(MSG_INFO, "%sICE firmware version: %d.%02d (rel. %d)\n", p,
|
||||
avrdude_message(MSG_INFO, "%sICE HW version : %d\n", p, parms[0]);
|
||||
avrdude_message(MSG_INFO, "%sICE FW version : %d.%02d (rel. %d)\n", p,
|
||||
parms[1], parms[2],
|
||||
(parms[3] | (parms[4] << 8)));
|
||||
avrdude_message(MSG_INFO, "%sSerial number : %s\n", p, resp);
|
||||
avrdude_message(MSG_INFO, "%sSerial number : %s", p, resp);
|
||||
free(resp);
|
||||
|
||||
jtag3_print_parms1(pgm, p);
|
||||
}
|
||||
|
||||
|
||||
@@ -2098,28 +2402,40 @@ static void jtag3_print_parms1(PROGRAMMER * pgm, const char * p)
|
||||
if (jtag3_getparm(pgm, SCOPE_GENERAL, 1, PARM3_VTARGET, buf, 2) < 0)
|
||||
return;
|
||||
|
||||
avrdude_message(MSG_INFO, "%sVtarget : %.2f V\n", p,
|
||||
b2_to_u16(buf) / 1000.0);
|
||||
avrdude_message(MSG_INFO, "%sVtarget %s: %.2f V\n", p,
|
||||
verbose ? "" : " ", b2_to_u16(buf) / 1000.0);
|
||||
|
||||
if (jtag3_getparm(pgm, SCOPE_AVR, 1, PARM3_CLK_MEGA_PROG, buf, 2) < 0)
|
||||
return;
|
||||
avrdude_message(MSG_INFO, "%sJTAG clock megaAVR/program: %u kHz\n", p,
|
||||
b2_to_u16(buf));
|
||||
|
||||
if (b2_to_u16(buf) > 0) {
|
||||
avrdude_message(MSG_INFO, "%sJTAG clock megaAVR/program : %u kHz\n", p,
|
||||
b2_to_u16(buf));
|
||||
}
|
||||
|
||||
if (jtag3_getparm(pgm, SCOPE_AVR, 1, PARM3_CLK_MEGA_DEBUG, buf, 2) < 0)
|
||||
return;
|
||||
avrdude_message(MSG_INFO, "%sJTAG clock megaAVR/debug: %u kHz\n", p,
|
||||
b2_to_u16(buf));
|
||||
|
||||
if (b2_to_u16(buf) > 0) {
|
||||
avrdude_message(MSG_INFO, "%sJTAG clock megaAVR/debug : %u kHz\n", p,
|
||||
b2_to_u16(buf));
|
||||
}
|
||||
|
||||
if (jtag3_getparm(pgm, SCOPE_AVR, 1, PARM3_CLK_XMEGA_JTAG, buf, 2) < 0)
|
||||
return;
|
||||
avrdude_message(MSG_INFO, "%sJTAG clock Xmega: %u kHz\n", p,
|
||||
b2_to_u16(buf));
|
||||
|
||||
if (b2_to_u16(buf) > 0) {
|
||||
avrdude_message(MSG_INFO, "%sJTAG clock Xmega : %u kHz\n", p,
|
||||
b2_to_u16(buf));
|
||||
}
|
||||
|
||||
if (jtag3_getparm(pgm, SCOPE_AVR, 1, PARM3_CLK_XMEGA_PDI, buf, 2) < 0)
|
||||
return;
|
||||
avrdude_message(MSG_INFO, "%sPDI clock Xmega : %u kHz\n", p,
|
||||
b2_to_u16(buf));
|
||||
|
||||
if (b2_to_u16(buf) > 0) {
|
||||
avrdude_message(MSG_INFO, "%sPDI/UPDI clock Xmega/megaAVR : %u kHz\n\n", p,
|
||||
b2_to_u16(buf));
|
||||
}
|
||||
}
|
||||
|
||||
static void jtag3_print_parms(PROGRAMMER * pgm)
|
||||
@@ -2155,6 +2471,17 @@ static unsigned int jtag3_memaddr(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, uns
|
||||
/*
|
||||
* Non-Xmega device.
|
||||
*/
|
||||
if (p->flags & AVRPART_HAS_UPDI) {
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
return addr;
|
||||
}
|
||||
else if (m->size == 1) {
|
||||
addr = m->offset;
|
||||
}
|
||||
else if (m->size > 1) {
|
||||
addr += m->offset;
|
||||
}
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
|
||||
@@ -2260,3 +2587,46 @@ void jtag3_pdi_initpgm(PROGRAMMER * pgm)
|
||||
pgm->flag = PGM_FL_IS_PDI;
|
||||
}
|
||||
|
||||
const char jtag3_updi_desc[] = "Atmel JTAGICE3 in UPDI mode";
|
||||
|
||||
void jtag3_updi_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
strcpy(pgm->type, "JTAGICE3_UPDI");
|
||||
|
||||
/*
|
||||
* mandatory functions
|
||||
*/
|
||||
pgm->initialize = jtag3_initialize;
|
||||
pgm->display = jtag3_display;
|
||||
pgm->enable = jtag3_enable;
|
||||
pgm->disable = jtag3_disable;
|
||||
pgm->program_enable = jtag3_program_enable_dummy;
|
||||
pgm->chip_erase = jtag3_chip_erase;
|
||||
pgm->open = jtag3_open_updi;
|
||||
pgm->close = jtag3_close;
|
||||
pgm->read_byte = jtag3_read_byte;
|
||||
pgm->write_byte = jtag3_write_byte;
|
||||
|
||||
/*
|
||||
* optional functions
|
||||
*/
|
||||
pgm->paged_write = jtag3_paged_write;
|
||||
pgm->paged_load = jtag3_paged_load;
|
||||
pgm->page_erase = jtag3_page_erase;
|
||||
pgm->print_parms = jtag3_print_parms;
|
||||
pgm->set_sck_period = jtag3_set_sck_period;
|
||||
pgm->setup = jtag3_setup;
|
||||
pgm->teardown = jtag3_teardown;
|
||||
pgm->page_size = 256;
|
||||
pgm->flag = PGM_FL_IS_UPDI;
|
||||
pgm->unlock = jtag3_unlock_erase_key;
|
||||
pgm->read_sib = jtag3_read_sib;
|
||||
|
||||
/*
|
||||
* enable target voltage adjustment for PKOB/nEDBG boards
|
||||
*/
|
||||
if (matches(ldata(lfirst(pgm->id)), "pkobn_updi")) {
|
||||
pgm->set_vtarget = jtag3_set_vtarget;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,9 +41,11 @@ int jtag3_command(PROGRAMMER *pgm, unsigned char *cmd, unsigned int cmdlen,
|
||||
extern const char jtag3_desc[];
|
||||
extern const char jtag3_dw_desc[];
|
||||
extern const char jtag3_pdi_desc[];
|
||||
extern const char jtag3_updi_desc[];
|
||||
void jtag3_initpgm (PROGRAMMER * pgm);
|
||||
void jtag3_dw_initpgm (PROGRAMMER * pgm);
|
||||
void jtag3_pdi_initpgm (PROGRAMMER * pgm);
|
||||
void jtag3_updi_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
/*
|
||||
* These functions are referenced from stk500v2.c for JTAGICE3 in
|
||||
@@ -109,6 +109,7 @@
|
||||
#define CMD3_GET_PARAMETER 0x02
|
||||
#define CMD3_SIGN_ON 0x10
|
||||
#define CMD3_SIGN_OFF 0x11 /* takes one parameter? */
|
||||
#define CMD3_GET_ID 0x12
|
||||
#define CMD3_START_DW_DEBUG 0x13
|
||||
#define CMD3_MONCON_DISABLE 0x17
|
||||
|
||||
@@ -143,6 +144,7 @@
|
||||
# define RSP3_FAIL_WRONG_MODE 0x32 /* progmode vs. non-prog */
|
||||
# define RSP3_FAIL_UNSUPP_MEMORY 0x34 /* unsupported memory type */
|
||||
# define RSP3_FAIL_WRONG_LENGTH 0x35 /* wrong lenth for mem access */
|
||||
# define RSP3_FAIL_OCD_LOCKED 0x44 /* device is locked */
|
||||
# define RSP3_FAIL_NOT_UNDERSTOOD 0x91
|
||||
|
||||
/* ICE events */
|
||||
@@ -165,6 +167,16 @@
|
||||
#define MTYPE_EEPROM_XMEGA 0xc4 /* xmega EEPROM in debug mode - undocumented in AVR067 */
|
||||
#define MTYPE_USERSIG 0xc5 /* xmega user signature - undocumented in AVR067 */
|
||||
#define MTYPE_PRODSIG 0xc6 /* xmega production signature - undocumented in AVR067 */
|
||||
#define MTYPE_SIB 0xD3 /* AVR8X System Information Block */
|
||||
|
||||
/*
|
||||
* SET and GET context definitions
|
||||
*/
|
||||
#define SET_GET_CTXT_CONFIG 0x00 /* Configuration */
|
||||
#define SET_GET_CTXT_PHYSICAL 0x01 /* Physical interface related */
|
||||
#define SET_GET_CTXT_DEVICE 0x02 /* Device specific settings */
|
||||
#define SET_GET_CTXT_OPTIONS 0x03 /* Option-related settings */
|
||||
#define SET_GET_CTXT_SESSION 0x04 /* Session-related settings */
|
||||
|
||||
/*
|
||||
* Parameters are divided into sections, where the section number
|
||||
@@ -177,8 +189,11 @@
|
||||
#define PARM3_FW_RELEASE 0x03 /* section 0, generic scope, 1 byte;
|
||||
* always asked for by Atmel Studio,
|
||||
* but never displayed there */
|
||||
#define PARM3_VTARGET 0x00 /* section 1, generic scope, 2 bytes,
|
||||
* in millivolts */
|
||||
#define PARM3_VTARGET 0x00 /* section 1, generic scope, 2 bytes, in millivolts */
|
||||
#define PARM3_VBUF 0x01 /* section 1, generic scope, 2 bytes, bufferred target voltage reference */
|
||||
#define PARM3_VUSB 0x02 /* section 1, generic scope, 2 bytes, USB voltage */
|
||||
#define PARM3_VADJUST 0x20 /* section 1, generic scope, 2 bytes, set voltage */
|
||||
|
||||
#define PARM3_DEVICEDESC 0x00 /* section 2, memory etc. configuration,
|
||||
* 31 bytes for tiny/mega AVR, 47 bytes
|
||||
* for Xmega; is also used in command
|
||||
@@ -189,6 +204,7 @@
|
||||
# define PARM3_ARCH_TINY 1 /* also small megaAVR with ISP/DW only */
|
||||
# define PARM3_ARCH_MEGA 2
|
||||
# define PARM3_ARCH_XMEGA 3
|
||||
# define PARM3_ARCH_UPDI 5 /* AVR devices with UPDI i/f */
|
||||
|
||||
#define PARM3_SESS_PURPOSE 0x01 /* section 0, AVR scope, 1 byte */
|
||||
# define PARM3_SESS_PROGRAMMING 1
|
||||
@@ -199,18 +215,26 @@
|
||||
# define PARM3_CONN_JTAG 4
|
||||
# define PARM3_CONN_DW 5
|
||||
# define PARM3_CONN_PDI 6
|
||||
# define PARM3_CONN_UPDI 8
|
||||
|
||||
|
||||
#define PARM3_JTAGCHAIN 0x01 /* JTAG chain info, AVR scope (units
|
||||
* before/after, bits before/after), 4
|
||||
* bytes */
|
||||
|
||||
/*
|
||||
* Physical context parameters
|
||||
*/
|
||||
#define PARM3_CLK_MEGA_PROG 0x20 /* section 1, AVR scope, 2 bytes (kHz) */
|
||||
#define PARM3_CLK_MEGA_DEBUG 0x21 /* section 1, AVR scope, 2 bytes (kHz) */
|
||||
#define PARM3_CLK_XMEGA_JTAG 0x30 /* section 1, AVR scope, 2 bytes (kHz) */
|
||||
#define PARM3_CLK_XMEGA_PDI 0x31 /* section 1, AVR scope, 2 bytes (kHz) */
|
||||
|
||||
|
||||
/*
|
||||
* Options context parameters
|
||||
*/
|
||||
#define PARM3_OPT_12V_UPDI_ENABLE 0x06
|
||||
#define PARM3_OPT_CHIP_ERASE_TO_ENTER 0x07
|
||||
|
||||
/* Xmega erase memory types, for CMND_XMEGA_ERASE */
|
||||
#define XMEGA_ERASE_CHIP 0x00
|
||||
@@ -263,6 +287,16 @@
|
||||
|
||||
#define CMSISDAP_CMD_SWD_CONFIGURE 0x13 /* configure SWD protocol; (byte) */
|
||||
|
||||
#define DEFAULT_MINIMUM_CHARACTERISED_DIV1_VOLTAGE_MV 4500 // Default minimum voltage for 32M => 4.5V
|
||||
#define DEFAULT_MINIMUM_CHARACTERISED_DIV2_VOLTAGE_MV 2700 // Default minimum voltage for 16M => 2.7V
|
||||
#define DEFAULT_MINIMUM_CHARACTERISED_DIV4_VOLTAGE_MV 2200 // Default minimum voltage for 8M => 2.2V
|
||||
#define DEFAULT_MINIMUM_CHARACTERISED_DIV8_VOLTAGE_MV 1500 // Default minimum voltage for 4M => 1.5V
|
||||
#define MAX_FREQUENCY_DEDICATED_UPDI_PIN 1500
|
||||
#define MAX_FREQUENCY_SHARED_UPDI_PIN 750
|
||||
#define UPDI_ADDRESS_MODE_16BIT 0
|
||||
#define UPDI_ADDRESS_MODE_24BIT 1
|
||||
#define FUSES_SYSCFG0_OFFSET 5
|
||||
|
||||
#if !defined(JTAG3_PRIVATE_EXPORTED)
|
||||
|
||||
struct mega_device_desc {
|
||||
@@ -316,4 +350,47 @@ struct xmega_device_desc {
|
||||
unsigned char nvm_base_addr[2]; // IO space base address of NVM controller
|
||||
unsigned char mcu_base_addr[2]; // IO space base address of MCU control
|
||||
};
|
||||
|
||||
/* UPDI device descriptor */
|
||||
struct updi_device_desc {
|
||||
unsigned char prog_base[2];
|
||||
unsigned char flash_page_size;
|
||||
unsigned char eeprom_page_size;
|
||||
unsigned char nvm_base_addr[2];
|
||||
unsigned char ocd_base_addr[2];
|
||||
|
||||
// Configuration below, except for "Extended memory support", is only used by kits with
|
||||
// embedded debuggers (XPlained, Curiosity, ...).
|
||||
unsigned char default_min_div1_voltage[2]; // Default minimum voltage for 32M => 4.5V -> 4500
|
||||
unsigned char default_min_div2_voltage[2]; // Default minimum voltage for 16M => 2.7V -> 2700
|
||||
unsigned char default_min_div4_voltage[2]; // Default minimum voltage for 8M => 2.2V -> 2200
|
||||
unsigned char default_min_div8_voltage[2]; // Default minimum voltage for 4M => 1.5V -> 1500
|
||||
|
||||
unsigned char pdi_pad_fmax[2]; // 750
|
||||
|
||||
unsigned char flash_bytes[4]; // Flash size in bytes
|
||||
unsigned char eeprom_bytes[2]; // EEPROM size in bytes
|
||||
unsigned char user_sig_bytes[2]; // UserSignture size in bytes
|
||||
unsigned char fuses_bytes; // Fuses size in bytes
|
||||
|
||||
unsigned char syscfg_offset; // Offset of SYSCFG0 within FUSE space
|
||||
unsigned char syscfg_write_mask_and; // AND mask to apply to SYSCFG0 when writing
|
||||
unsigned char syscfg_write_mask_or; // OR mask to apply to SYSCFG0 when writing
|
||||
unsigned char syscfg_erase_mask_and; // AND mask to apply to SYSCFG0 after erase
|
||||
unsigned char syscfg_erase_mask_or; // OR mask to apply to SYSCFG0 after erase
|
||||
|
||||
unsigned char eeprom_base[2]; // Base address for EEPROM memory
|
||||
unsigned char user_sig_base[2]; // Base address for UserSignature memory
|
||||
unsigned char signature_base[2]; // Base address for Signature memory
|
||||
unsigned char fuses_base[2]; // Base address for Fuses memory
|
||||
unsigned char lockbits_base[2]; // Base address for Lockbits memory
|
||||
|
||||
unsigned char device_id[2]; // Two last bytes of the device ID
|
||||
|
||||
// Extended memory support. Needed for flash >= 64kb
|
||||
unsigned char prog_base_msb; // Extends prog_base, used in 24-bit mode
|
||||
unsigned char flash_page_size_msb; // Extends flash_page_size, used in 24-bit mode
|
||||
|
||||
unsigned char address_mode; // 0x00 = 16-bit mode, 0x01 = 24-bit mode
|
||||
};
|
||||
#endif /* JTAG3_PRIVATE_EXPORTED */
|
||||
@@ -214,6 +214,7 @@ static int jtagmkI_send(PROGRAMMER * pgm, unsigned char * data, size_t len)
|
||||
if (serial_send(&pgm->fd, buf, len + 2) != 0) {
|
||||
avrdude_message(MSG_INFO, "%s: jtagmkI_send(): failed to send command to serial port\n",
|
||||
progname);
|
||||
free(buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -553,7 +554,7 @@ static int jtagmkI_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
progname, pgm->baudrate);
|
||||
if (jtagmkI_setparm(pgm, PARM_BITRATE, b) == 0) {
|
||||
PDATA(pgm)->initial_baudrate = pgm->baudrate; /* don't adjust again later */
|
||||
serial_setspeed(&pgm->fd, pgm->baudrate);
|
||||
serial_setparams(&pgm->fd, pgm->baudrate, SERIAL_8N1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -648,9 +649,10 @@ static int jtagmkI_open(PROGRAMMER * pgm, char * port)
|
||||
|
||||
for (i = 0; i < sizeof(baudtab) / sizeof(baudtab[0]); i++) {
|
||||
union pinfo pinfo;
|
||||
pinfo.baud = baudtab[i].baud;
|
||||
pinfo.serialinfo.baud = baudtab[i].baud;
|
||||
pinfo.serialinfo.cflags = SERIAL_8N1;
|
||||
avrdude_message(MSG_NOTICE2, "%s: jtagmkI_open(): trying to sync at baud rate %ld:\n",
|
||||
progname, pinfo.baud);
|
||||
progname, pinfo.serialinfo.baud);
|
||||
if (serial_open(port, pinfo, &pgm->fd)==-1) {
|
||||
return -1;
|
||||
}
|
||||
@@ -697,7 +699,7 @@ static void jtagmkI_close(PROGRAMMER * pgm)
|
||||
"trying to set baudrate to %d\n",
|
||||
progname, PDATA(pgm)->initial_baudrate);
|
||||
if (jtagmkI_setparm(pgm, PARM_BITRATE, b) == 0) {
|
||||
serial_setspeed(&pgm->fd, pgm->baudrate);
|
||||
serial_setparams(&pgm->fd, pgm->baudrate, SERIAL_8N1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1273,8 +1275,8 @@ static void jtagmkI_display(PROGRAMMER * pgm, const char * p)
|
||||
jtagmkI_getparm(pgm, PARM_SW_VERSION, &fw) < 0)
|
||||
return;
|
||||
|
||||
avrdude_message(MSG_INFO, "%sICE hardware version: 0x%02x\n", p, hw);
|
||||
avrdude_message(MSG_INFO, "%sICE firmware version: 0x%02x\n", p, fw);
|
||||
avrdude_message(MSG_INFO, "%sICE HW version: 0x%02x\n", p, hw);
|
||||
avrdude_message(MSG_INFO, "%sICE FW version: 0x%02x\n", p, fw);
|
||||
|
||||
jtagmkI_print_parms1(pgm, p);
|
||||
|
||||
@@ -1318,9 +1320,9 @@ static void jtagmkI_print_parms1(PROGRAMMER * pgm, const char * p)
|
||||
clk = 1e6;
|
||||
}
|
||||
|
||||
avrdude_message(MSG_INFO, "%sVtarget : %.1f V\n", p,
|
||||
avrdude_message(MSG_INFO, "%sVtarget : %.1f V\n", p,
|
||||
6.25 * (unsigned)vtarget / 255.0);
|
||||
avrdude_message(MSG_INFO, "%sJTAG clock : %s (%.1f us)\n", p, clkstr,
|
||||
avrdude_message(MSG_INFO, "%sJTAG clock : %s (%.1f us)\n", p, clkstr,
|
||||
1.0e6 / clk);
|
||||
|
||||
return;
|
||||
@@ -604,6 +604,7 @@ static int jtagmkII_recv_frame(PROGRAMMER * pgm, unsigned char **msg,
|
||||
if (tnow - tstart > timeoutval) {
|
||||
avrdude_message(MSG_INFO, "%s: jtagmkII_recv_frame(): timeout\n",
|
||||
progname);
|
||||
free(buf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -674,7 +675,7 @@ int jtagmkII_recv(PROGRAMMER * pgm, unsigned char **msg) {
|
||||
|
||||
int jtagmkII_getsync(PROGRAMMER * pgm, int mode) {
|
||||
int tries;
|
||||
#define MAXTRIES 33
|
||||
#define MAXTRIES 10
|
||||
unsigned char buf[3], *resp, c = 0xff;
|
||||
int status;
|
||||
unsigned int fwver, hwver;
|
||||
@@ -695,15 +696,14 @@ int jtagmkII_getsync(PROGRAMMER * pgm, int mode) {
|
||||
|
||||
/* Get the sign-on information. */
|
||||
buf[0] = CMND_GET_SIGN_ON;
|
||||
avrdude_message(MSG_NOTICE2, "%s: jtagmkII_getsync(): Sending sign-on command: ",
|
||||
progname);
|
||||
avrdude_message(MSG_NOTICE2, "%s: jtagmkII_getsync() attempt %d of %d: Sending sign-on command: ",
|
||||
progname, tries + 1, MAXTRIES);
|
||||
jtagmkII_send(pgm, buf, 1);
|
||||
|
||||
status = jtagmkII_recv(pgm, &resp);
|
||||
if (status <= 0) {
|
||||
avrdude_message(MSG_INFO, "%s: jtagmkII_getsync(): sign-on command: "
|
||||
"status %d\n",
|
||||
progname, status);
|
||||
avrdude_message(MSG_INFO, "%s: jtagmkII_getsync() attempt %d of %d: sign-on command: status %d\n",
|
||||
progname, tries + 1, MAXTRIES, status);
|
||||
} else if (verbose >= 3) {
|
||||
putc('\n', stderr);
|
||||
jtagmkII_prmsg(pgm, resp, status);
|
||||
@@ -741,6 +741,7 @@ int jtagmkII_getsync(PROGRAMMER * pgm, int mode) {
|
||||
avrdude_message(MSG_NOTICE, "Device ID: %s\n",
|
||||
resp + 16);
|
||||
}
|
||||
free(resp);
|
||||
break;
|
||||
}
|
||||
free(resp);
|
||||
@@ -889,7 +890,7 @@ static int jtagmkII_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
||||
int status, len;
|
||||
unsigned char buf[6], *resp, c;
|
||||
|
||||
if (p->flags & AVRPART_HAS_PDI) {
|
||||
if (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) {
|
||||
buf[0] = CMND_XMEGA_ERASE;
|
||||
buf[1] = XMEGA_ERASE_CHIP;
|
||||
memset(buf + 2, 0, 4); /* address of area to be erased */
|
||||
@@ -900,7 +901,7 @@ static int jtagmkII_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
||||
}
|
||||
avrdude_message(MSG_NOTICE2, "%s: jtagmkII_chip_erase(): Sending %schip erase command: ",
|
||||
progname,
|
||||
(p->flags & AVRPART_HAS_PDI)? "Xmega ": "");
|
||||
(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))? "Xmega ": "");
|
||||
jtagmkII_send(pgm, buf, len);
|
||||
|
||||
status = jtagmkII_recv(pgm, &resp);
|
||||
@@ -926,7 +927,7 @@ static int jtagmkII_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(p->flags & AVRPART_HAS_PDI))
|
||||
if (!(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)))
|
||||
pgm->initialize(pgm, p);
|
||||
|
||||
return 0;
|
||||
@@ -984,7 +985,7 @@ static void jtagmkII_set_devdescr(PROGRAMMER * pgm, AVRPART * p)
|
||||
}
|
||||
}
|
||||
sendbuf.dd.ucCacheType =
|
||||
(p->flags & AVRPART_HAS_PDI)? 0x02 /* ATxmega */: 0x00;
|
||||
(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))? 0x02 /* ATxmega */: 0x00;
|
||||
|
||||
avrdude_message(MSG_NOTICE2, "%s: jtagmkII_set_devdescr(): "
|
||||
"Sending set device descriptor command: ",
|
||||
@@ -1055,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);
|
||||
@@ -1252,15 +1254,38 @@ static unsigned char jtagmkII_get_baud(long baud)
|
||||
long baud;
|
||||
unsigned char val;
|
||||
} baudtab[] = {
|
||||
{ 2400L, PAR_BAUD_2400 },
|
||||
{ 4800L, PAR_BAUD_4800 },
|
||||
{ 9600L, PAR_BAUD_9600 },
|
||||
{ 19200L, PAR_BAUD_19200 },
|
||||
{ 38400L, PAR_BAUD_38400 },
|
||||
{ 57600L, PAR_BAUD_57600 },
|
||||
{ 115200L, PAR_BAUD_115200 },
|
||||
{ 14400L, PAR_BAUD_14400 },
|
||||
};
|
||||
{ 2400L, PAR_BAUD_2400 },
|
||||
{ 4800L, PAR_BAUD_4800 },
|
||||
{ 9600L, PAR_BAUD_9600 },
|
||||
{ 19200L, PAR_BAUD_19200 },
|
||||
{ 38400L, PAR_BAUD_38400 },
|
||||
{ 57600L, PAR_BAUD_57600 },
|
||||
{ 115200L, PAR_BAUD_115200 },
|
||||
{ 14400L, PAR_BAUD_14400 },
|
||||
/* Extension to jtagmkII protocol: extra baud rates, standard series. */
|
||||
{ 153600L, PAR_BAUD_153600 },
|
||||
{ 230400L, PAR_BAUD_230400 },
|
||||
{ 460800L, PAR_BAUD_460800 },
|
||||
{ 921600L, PAR_BAUD_921600 },
|
||||
/* Extension to jtagmkII protocol: extra baud rates, binary series. */
|
||||
{ 128000L, PAR_BAUD_128000 },
|
||||
{ 256000L, PAR_BAUD_256000 },
|
||||
{ 512000L, PAR_BAUD_512000 },
|
||||
{ 1024000L, PAR_BAUD_1024000 },
|
||||
/* Extension to jtagmkII protocol: extra baud rates, decimal series. */
|
||||
{ 150000L, PAR_BAUD_150000 },
|
||||
{ 200000L, PAR_BAUD_200000 },
|
||||
{ 250000L, PAR_BAUD_250000 },
|
||||
{ 300000L, PAR_BAUD_300000 },
|
||||
{ 400000L, PAR_BAUD_400000 },
|
||||
{ 500000L, PAR_BAUD_500000 },
|
||||
{ 600000L, PAR_BAUD_600000 },
|
||||
{ 666666L, PAR_BAUD_666666 },
|
||||
{ 1000000L, PAR_BAUD_1000000 },
|
||||
{ 1500000L, PAR_BAUD_1500000 },
|
||||
{ 2000000L, PAR_BAUD_2000000 },
|
||||
{ 3000000L, PAR_BAUD_3000000 },
|
||||
};
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof baudtab / sizeof baudtab[0]; i++)
|
||||
@@ -1280,6 +1305,14 @@ static int jtagmkII_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
int ok;
|
||||
const char *ifname;
|
||||
|
||||
/* Abort and print error if programmer does not support the target microcontroller */
|
||||
if ((strncmp(ldata(lfirst(pgm->id)), "jtag2updi", strlen("jtag2updi")) == 0 && p->flags & AVRPART_HAS_PDI) ||
|
||||
(strncmp(ldata(lfirst(pgm->id)), "jtagmkII", strlen("jtagmkII")) == 0 && p->flags & AVRPART_HAS_UPDI)) {
|
||||
avrdude_message(MSG_INFO, "Error: programmer %s does not support target %s\n\n",
|
||||
ldata(lfirst(pgm->id)), p->desc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ok = 0;
|
||||
if (pgm->flag & PGM_FL_IS_DW) {
|
||||
ifname = "debugWire";
|
||||
@@ -1287,7 +1320,7 @@ static int jtagmkII_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
ok = 1;
|
||||
} else if (pgm->flag & PGM_FL_IS_PDI) {
|
||||
ifname = "PDI";
|
||||
if (p->flags & AVRPART_HAS_PDI)
|
||||
if (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))
|
||||
ok = 1;
|
||||
} else {
|
||||
ifname = "JTAG";
|
||||
@@ -1310,7 +1343,7 @@ static int jtagmkII_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
"trying to set baudrate to %d\n",
|
||||
progname, pgm->baudrate);
|
||||
if (jtagmkII_setparm(pgm, PAR_BAUD_RATE, &b) == 0)
|
||||
serial_setspeed(&pgm->fd, pgm->baudrate);
|
||||
serial_setparams(&pgm->fd, pgm->baudrate, SERIAL_8N1);
|
||||
}
|
||||
}
|
||||
if ((pgm->flag & PGM_FL_IS_JTAG) && pgm->bitclock != 0.0) {
|
||||
@@ -1333,25 +1366,20 @@ static int jtagmkII_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
* mode from JTAG to JTAG_XMEGA.
|
||||
*/
|
||||
if ((pgm->flag & PGM_FL_IS_JTAG) &&
|
||||
(p->flags & AVRPART_HAS_PDI)) {
|
||||
(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))) {
|
||||
if (jtagmkII_getsync(pgm, EMULATOR_MODE_JTAG_XMEGA) < 0)
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
* Must set the device descriptor before entering programming mode.
|
||||
*/
|
||||
if (PDATA(pgm)->fwver >= 0x700 && (p->flags & AVRPART_HAS_PDI) != 0)
|
||||
if (PDATA(pgm)->fwver >= 0x700 && (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) != 0)
|
||||
jtagmkII_set_xmega_params(pgm, p);
|
||||
else
|
||||
jtagmkII_set_devdescr(pgm, p);
|
||||
|
||||
PDATA(pgm)->boot_start = ULONG_MAX;
|
||||
/*
|
||||
* If this is an ATxmega device in JTAG mode, change the emulator
|
||||
* mode from JTAG to JTAG_XMEGA.
|
||||
*/
|
||||
if ((pgm->flag & PGM_FL_IS_JTAG) &&
|
||||
(p->flags & AVRPART_HAS_PDI)) {
|
||||
if ((p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))) {
|
||||
/*
|
||||
* Find out where the border between application and boot area
|
||||
* is.
|
||||
@@ -1359,8 +1387,10 @@ static int jtagmkII_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
AVRMEM *bootmem = avr_locate_mem(p, "boot");
|
||||
AVRMEM *flashmem = avr_locate_mem(p, "flash");
|
||||
if (bootmem == NULL || flashmem == NULL) {
|
||||
avrdude_message(MSG_INFO, "%s: jtagmkII_initialize(): Cannot locate \"flash\" and \"boot\" memories in description\n",
|
||||
progname);
|
||||
if (strncmp(ldata(lfirst(pgm->id)), "jtagmkII", strlen("jtagmkII")) == 0) {
|
||||
avrdude_message(MSG_INFO, "%s: jtagmkII_initialize(): Cannot locate \"flash\" and \"boot\" memories in description\n",
|
||||
progname);
|
||||
}
|
||||
} else {
|
||||
if (PDATA(pgm)->fwver < 0x700) {
|
||||
/* V7+ firmware does not need this anymore */
|
||||
@@ -1391,7 +1421,7 @@ static int jtagmkII_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
}
|
||||
PDATA(pgm)->flash_pageaddr = PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
|
||||
|
||||
if (PDATA(pgm)->fwver >= 0x700 && (p->flags & AVRPART_HAS_PDI)) {
|
||||
if (PDATA(pgm)->fwver >= 0x700 && (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))) {
|
||||
/*
|
||||
* Work around for
|
||||
* https://savannah.nongnu.org/bugs/index.php?37942
|
||||
@@ -1408,7 +1438,7 @@ static int jtagmkII_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((pgm->flag & PGM_FL_IS_JTAG) && !(p->flags & AVRPART_HAS_PDI)) {
|
||||
if ((pgm->flag & PGM_FL_IS_JTAG) && !(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))) {
|
||||
strcpy(hfuse.desc, "hfuse");
|
||||
if (jtagmkII_read_byte(pgm, p, &hfuse, 1, &b) < 0)
|
||||
return -1;
|
||||
@@ -1493,7 +1523,8 @@ static int jtagmkII_open(PROGRAMMER * pgm, char * port)
|
||||
* a higher baud rate, we switch to it later on, after establishing
|
||||
* the connection with the ICE.
|
||||
*/
|
||||
pinfo.baud = 19200;
|
||||
pinfo.serialinfo.baud = 19200;
|
||||
pinfo.serialinfo.cflags = SERIAL_8N1;
|
||||
|
||||
/*
|
||||
* If the port name starts with "usb", divert the serial routines
|
||||
@@ -1545,7 +1576,8 @@ static int jtagmkII_open_dw(PROGRAMMER * pgm, char * port)
|
||||
* a higher baud rate, we switch to it later on, after establishing
|
||||
* the connection with the ICE.
|
||||
*/
|
||||
pinfo.baud = 19200;
|
||||
pinfo.serialinfo.baud = 19200;
|
||||
pinfo.serialinfo.cflags = SERIAL_8N1;
|
||||
|
||||
/*
|
||||
* If the port name starts with "usb", divert the serial routines
|
||||
@@ -1597,7 +1629,8 @@ static int jtagmkII_open_pdi(PROGRAMMER * pgm, char * port)
|
||||
* a higher baud rate, we switch to it later on, after establishing
|
||||
* the connection with the ICE.
|
||||
*/
|
||||
pinfo.baud = 19200;
|
||||
pinfo.serialinfo.baud = 19200;
|
||||
pinfo.serialinfo.cflags = SERIAL_8N1;
|
||||
|
||||
/*
|
||||
* If the port name starts with "usb", divert the serial routines
|
||||
@@ -1650,7 +1683,8 @@ static int jtagmkII_dragon_open(PROGRAMMER * pgm, char * port)
|
||||
* a higher baud rate, we switch to it later on, after establishing
|
||||
* the connection with the ICE.
|
||||
*/
|
||||
pinfo.baud = 19200;
|
||||
pinfo.serialinfo.baud = 19200;
|
||||
pinfo.serialinfo.cflags = SERIAL_8N1;
|
||||
|
||||
/*
|
||||
* If the port name starts with "usb", divert the serial routines
|
||||
@@ -1703,7 +1737,8 @@ static int jtagmkII_dragon_open_dw(PROGRAMMER * pgm, char * port)
|
||||
* a higher baud rate, we switch to it later on, after establishing
|
||||
* the connection with the ICE.
|
||||
*/
|
||||
pinfo.baud = 19200;
|
||||
pinfo.serialinfo.baud = 19200;
|
||||
pinfo.serialinfo.cflags = SERIAL_8N1;
|
||||
|
||||
/*
|
||||
* If the port name starts with "usb", divert the serial routines
|
||||
@@ -1756,7 +1791,8 @@ static int jtagmkII_dragon_open_pdi(PROGRAMMER * pgm, char * port)
|
||||
* a higher baud rate, we switch to it later on, after establishing
|
||||
* the connection with the ICE.
|
||||
*/
|
||||
pinfo.baud = 19200;
|
||||
pinfo.serialinfo.baud = 19200;
|
||||
pinfo.serialinfo.cflags = SERIAL_8N1;
|
||||
|
||||
/*
|
||||
* If the port name starts with "usb", divert the serial routines
|
||||
@@ -1876,7 +1912,7 @@ static int jtagmkII_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
avrdude_message(MSG_NOTICE2, "%s: jtagmkII_page_erase(.., %s, 0x%x)\n",
|
||||
progname, m->desc, addr);
|
||||
|
||||
if (!(p->flags & AVRPART_HAS_PDI)) {
|
||||
if (!(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))) {
|
||||
avrdude_message(MSG_INFO, "%s: jtagmkII_page_erase: not an Xmega device\n",
|
||||
progname);
|
||||
return -1;
|
||||
@@ -1898,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;
|
||||
@@ -1919,7 +1956,7 @@ static int jtagmkII_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
|
||||
retry:
|
||||
avrdude_message(MSG_NOTICE2, "%s: jtagmkII_page_erase(): "
|
||||
"Sending xmega erase command: ",
|
||||
"Sending Xmega erase command: ",
|
||||
progname);
|
||||
jtagmkII_send(pgm, cmd, sizeof cmd);
|
||||
|
||||
@@ -1990,7 +2027,7 @@ static int jtagmkII_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
PDATA(pgm)->flash_pageaddr = (unsigned long)-1L;
|
||||
cmd[1] = jtagmkII_memtype(pgm, p, addr);
|
||||
if (p->flags & AVRPART_HAS_PDI)
|
||||
if (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))
|
||||
/* dynamically decide between flash/boot memtype */
|
||||
dynamic_memtype = 1;
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
@@ -2009,18 +2046,19 @@ static int jtagmkII_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
free(cmd);
|
||||
return n_bytes;
|
||||
}
|
||||
cmd[1] = ( p->flags & AVRPART_HAS_PDI ) ? 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 ) {
|
||||
} else if (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) {
|
||||
cmd[1] = MTYPE_FLASH;
|
||||
} else {
|
||||
cmd[1] = MTYPE_SPM;
|
||||
}
|
||||
serial_recv_timeout = 100;
|
||||
serial_recv_timeout = 200;
|
||||
for (; addr < maxaddr; addr += page_size) {
|
||||
if ((maxaddr - addr) < page_size)
|
||||
block_size = maxaddr - addr;
|
||||
@@ -2117,20 +2155,21 @@ static int jtagmkII_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
cmd[0] = CMND_READ_MEMORY;
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
cmd[1] = jtagmkII_memtype(pgm, p, addr);
|
||||
if (p->flags & AVRPART_HAS_PDI)
|
||||
if (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI))
|
||||
/* dynamically decide between flash/boot memtype */
|
||||
dynamic_memtype = 1;
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
cmd[1] = ( p->flags & AVRPART_HAS_PDI ) ? 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 ) {
|
||||
} else if (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) {
|
||||
cmd[1] = MTYPE_FLASH;
|
||||
} else {
|
||||
cmd[1] = MTYPE_SPM;
|
||||
@@ -2215,7 +2254,7 @@ static int jtagmkII_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
unsupp = 0;
|
||||
|
||||
addr += mem->offset;
|
||||
cmd[1] = ( p->flags & AVRPART_HAS_PDI ) ? MTYPE_FLASH : MTYPE_FLASH_PAGE;
|
||||
cmd[1] = ( p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI) ) ? MTYPE_FLASH : MTYPE_FLASH_PAGE;
|
||||
if (strcmp(mem->desc, "flash") == 0 ||
|
||||
strcmp(mem->desc, "application") == 0 ||
|
||||
strcmp(mem->desc, "apptable") == 0 ||
|
||||
@@ -2225,7 +2264,7 @@ static int jtagmkII_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
paddr_ptr = &PDATA(pgm)->flash_pageaddr;
|
||||
cache_ptr = PDATA(pgm)->flash_pagecache;
|
||||
} else if (strcmp(mem->desc, "eeprom") == 0) {
|
||||
if ( (pgm->flag & PGM_FL_IS_DW) || ( p->flags & AVRPART_HAS_PDI ) ) {
|
||||
if ( (pgm->flag & PGM_FL_IS_DW) || ( p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI) ) ) {
|
||||
/* debugWire cannot use page access for EEPROM */
|
||||
cmd[1] = MTYPE_EEPROM;
|
||||
} else {
|
||||
@@ -2256,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;
|
||||
@@ -2391,7 +2431,7 @@ static int jtagmkII_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
|
||||
writedata = data;
|
||||
cmd[0] = CMND_WRITE_MEMORY;
|
||||
cmd[1] = ( p->flags & AVRPART_HAS_PDI ) ? MTYPE_FLASH : MTYPE_SPM;
|
||||
cmd[1] = ( p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI) ) ? MTYPE_FLASH : MTYPE_SPM;
|
||||
if (strcmp(mem->desc, "flash") == 0) {
|
||||
if ((addr & 1) == 1) {
|
||||
/* odd address = high byte */
|
||||
@@ -2405,7 +2445,7 @@ static int jtagmkII_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
if (pgm->flag & PGM_FL_IS_DW)
|
||||
unsupp = 1;
|
||||
} else if (strcmp(mem->desc, "eeprom") == 0) {
|
||||
cmd[1] = ( p->flags & AVRPART_HAS_PDI ) ? MTYPE_EEPROM_XMEGA: MTYPE_EEPROM;
|
||||
cmd[1] = ( p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI) ) ? MTYPE_EEPROM_XMEGA: MTYPE_EEPROM;
|
||||
need_progmode = 0;
|
||||
PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
|
||||
} else if (strcmp(mem->desc, "lfuse") == 0) {
|
||||
@@ -2425,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;
|
||||
@@ -2653,11 +2694,11 @@ static void jtagmkII_display(PROGRAMMER * pgm, const char * p)
|
||||
jtagmkII_getparm(pgm, PAR_FW_VERSION, fw) < 0)
|
||||
return;
|
||||
|
||||
avrdude_message(MSG_INFO, "%sM_MCU hardware version: %d\n", p, hw[0]);
|
||||
avrdude_message(MSG_INFO, "%sM_MCU firmware version: %d.%02d\n", p, fw[1], fw[0]);
|
||||
avrdude_message(MSG_INFO, "%sS_MCU hardware version: %d\n", p, hw[1]);
|
||||
avrdude_message(MSG_INFO, "%sS_MCU firmware version: %d.%02d\n", p, fw[3], fw[2]);
|
||||
avrdude_message(MSG_INFO, "%sSerial number: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
avrdude_message(MSG_INFO, "%sM_MCU HW version: %d\n", p, hw[0]);
|
||||
avrdude_message(MSG_INFO, "%sM_MCU FW version: %d.%02d\n", p, fw[1], fw[0]);
|
||||
avrdude_message(MSG_INFO, "%sS_MCU HW version: %d\n", p, hw[1]);
|
||||
avrdude_message(MSG_INFO, "%sS_MCU FW version: %d.%02d\n", p, fw[3], fw[2]);
|
||||
avrdude_message(MSG_INFO, "%sSerial number : %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
p, PDATA(pgm)->serno[0], PDATA(pgm)->serno[1], PDATA(pgm)->serno[2], PDATA(pgm)->serno[3], PDATA(pgm)->serno[4], PDATA(pgm)->serno[5]);
|
||||
|
||||
jtagmkII_print_parms1(pgm, p);
|
||||
@@ -2710,7 +2751,7 @@ static void jtagmkII_print_parms(PROGRAMMER * pgm)
|
||||
|
||||
static unsigned char jtagmkII_memtype(PROGRAMMER * pgm, AVRPART * p, unsigned long addr)
|
||||
{
|
||||
if ( p->flags & AVRPART_HAS_PDI ) {
|
||||
if ( p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI) ) {
|
||||
if (addr >= PDATA(pgm)->boot_start)
|
||||
return MTYPE_BOOT_FLASH;
|
||||
else
|
||||
@@ -2726,7 +2767,7 @@ static unsigned int jtagmkII_memaddr(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
* Xmega devices handled by V7+ firmware don't want to be told their
|
||||
* m->offset within the write memory command.
|
||||
*/
|
||||
if (PDATA(pgm)->fwver >= 0x700 && (p->flags & AVRPART_HAS_PDI) != 0) {
|
||||
if (PDATA(pgm)->fwver >= 0x700 && (p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_UPDI)) != 0) {
|
||||
if (addr >= PDATA(pgm)->boot_start)
|
||||
/*
|
||||
* all memories but "flash" are smaller than boot_start anyway, so
|
||||
@@ -3333,7 +3374,8 @@ static int jtagmkII_open32(PROGRAMMER * pgm, char * port)
|
||||
* a higher baud rate, we switch to it later on, after establishing
|
||||
* the connection with the ICE.
|
||||
*/
|
||||
pinfo.baud = 19200;
|
||||
pinfo.serialinfo.baud = 19200;
|
||||
pinfo.serialinfo.cflags = SERIAL_8N1;
|
||||
|
||||
/*
|
||||
* If the port name starts with "usb", divert the serial routines
|
||||
@@ -3639,12 +3681,12 @@ static int jtagmkII_paged_write32(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
status = jtagmkII_flash_write_page32(pgm, pageNum);
|
||||
if(status < 0) {lineno = __LINE__; goto eRR;}
|
||||
}
|
||||
free(cmd);
|
||||
serial_recv_timeout = otimeout;
|
||||
|
||||
status = jtagmkII_reset32(pgm, AVR32_SET4RUNNING); // AVR32_SET4RUNNING | AVR32_RELEASE_JTAG
|
||||
if(status < 0) {lineno = __LINE__; goto eRR;}
|
||||
|
||||
free(cmd);
|
||||
return addr;
|
||||
|
||||
eRR:
|
||||
@@ -4020,4 +4062,3 @@ void jtagmkII_dragon_pdi_initpgm(PROGRAMMER * pgm)
|
||||
pgm->page_size = 256;
|
||||
pgm->flag = PGM_FL_IS_PDI;
|
||||
}
|
||||
|
||||
@@ -206,6 +206,29 @@
|
||||
# define PAR_BAUD_57600 0x06
|
||||
# define PAR_BAUD_115200 0x07
|
||||
# define PAR_BAUD_14400 0x08
|
||||
/* Extension to jtagmkII protocol: extra baud rates, standard series. */
|
||||
# define PAR_BAUD_153600 0x09
|
||||
# define PAR_BAUD_230400 0x0A
|
||||
# define PAR_BAUD_460800 0x0B
|
||||
# define PAR_BAUD_921600 0x0C
|
||||
/* Extension to jtagmkII protocol: extra baud rates, binary series. */
|
||||
# define PAR_BAUD_128000 0x0D
|
||||
# define PAR_BAUD_256000 0x0E
|
||||
# define PAR_BAUD_512000 0x0F
|
||||
# define PAR_BAUD_1024000 0x10
|
||||
/* Extension to jtagmkII protocol: extra baud rates, decimal series. */
|
||||
# define PAR_BAUD_150000 0x11
|
||||
# define PAR_BAUD_200000 0x12
|
||||
# define PAR_BAUD_250000 0x13
|
||||
# define PAR_BAUD_300000 0x14
|
||||
# define PAR_BAUD_400000 0x15
|
||||
# define PAR_BAUD_500000 0x16
|
||||
# define PAR_BAUD_600000 0x17
|
||||
# define PAR_BAUD_666666 0x18
|
||||
# define PAR_BAUD_1000000 0x19
|
||||
# define PAR_BAUD_1500000 0x1A
|
||||
# define PAR_BAUD_2000000 0x1B
|
||||
# define PAR_BAUD_3000000 0x1C
|
||||
#define PAR_OCD_VTARGET 0x06
|
||||
#define PAR_OCD_JTAG_CLK 0x07
|
||||
#define PAR_OCD_BREAK_CAUSE 0x08
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "ac_cfg.h"
|
||||
#include "avrdude.h"
|
||||
#include "libavrdude.h"
|
||||
#include "config.h"
|
||||
@@ -116,6 +117,7 @@ SIGN [+-]
|
||||
<strng>\n { yyerror("unterminated character constant");
|
||||
return YYERRCODE; }
|
||||
|
||||
alias { yylval=NULL; return K_ALIAS; }
|
||||
allowfullpagebitstream { yylval=NULL; return K_ALLOWFULLPAGEBITSTREAM; }
|
||||
avr910_devcode { yylval=NULL; return K_AVR910_DEVCODE; }
|
||||
bank_size { yylval=NULL; return K_PAGE_SIZE; }
|
||||
@@ -136,10 +138,10 @@ dedicated { yylval=new_token(K_DEDICATED); return K_DEDICATED; }
|
||||
default_bitclock { yylval=NULL; return K_DEFAULT_BITCLOCK; }
|
||||
default_parallel { yylval=NULL; return K_DEFAULT_PARALLEL; }
|
||||
default_programmer { yylval=NULL; return K_DEFAULT_PROGRAMMER; }
|
||||
default_safemode { yylval=NULL; return K_DEFAULT_SAFEMODE; }
|
||||
default_serial { yylval=NULL; return K_DEFAULT_SERIAL; }
|
||||
delay { yylval=NULL; return K_DELAY; }
|
||||
desc { yylval=NULL; return K_DESC; }
|
||||
family_id { yylval=NULL; return K_FAMILY_ID; }
|
||||
devicecode { yylval=NULL; return K_DEVICECODE; }
|
||||
eecr { yylval=NULL; return K_EECR; }
|
||||
eeprom { yylval=NULL; return K_EEPROM; }
|
||||
@@ -152,6 +154,7 @@ has_debugwire { yylval=NULL; return K_HAS_DW; }
|
||||
has_jtag { yylval=NULL; return K_HAS_JTAG; }
|
||||
has_pdi { yylval=NULL; return K_HAS_PDI; }
|
||||
has_tpi { yylval=NULL; return K_HAS_TPI; }
|
||||
has_updi { yylval=NULL; return K_HAS_UPDI; }
|
||||
hventerstabdelay { yylval=NULL; return K_HVENTERSTABDELAY; }
|
||||
hvleavestabdelay { yylval=NULL; return K_HVLEAVESTABDELAY; }
|
||||
hvsp_controlstack { yylval=NULL; return K_HVSP_CONTROLSTACK; }
|
||||
@@ -176,6 +179,7 @@ no { yylval=new_token(K_NO); return K_NO; }
|
||||
num_banks { yylval=NULL; return K_NUM_PAGES; }
|
||||
num_pages { yylval=NULL; return K_NUM_PAGES; }
|
||||
nvm_base { yylval=NULL; return K_NVM_BASE; }
|
||||
ocd_base { yylval=NULL; return K_OCD_BASE; }
|
||||
ocdrev { yylval=NULL; return K_OCDREV; }
|
||||
offset { yylval=NULL; return K_OFFSET; }
|
||||
page_size { yylval=NULL; return K_PAGE_SIZE; }
|
||||
@@ -21,25 +21,12 @@
|
||||
#ifndef libavrdude_h
|
||||
#define libavrdude_h
|
||||
|
||||
/* XXX should go away */
|
||||
#include "ac_cfg.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/* lets try to select at least 32 bits */
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
typedef uint32_t pinmask_t;
|
||||
#else
|
||||
#if UINT_MAX >= 0xFFFFFFFF
|
||||
typedef unsigned int pinmask_t;
|
||||
#else
|
||||
typedef unsigned long pinmask_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef uint32_t pinmask_t;
|
||||
|
||||
/* formerly lists.h */
|
||||
|
||||
@@ -199,9 +186,12 @@ typedef struct opcode {
|
||||
#define AVRPART_WRITE 0x0400 /* at least one write operation specified */
|
||||
#define AVRPART_HAS_TPI 0x0800 /* part has TPI i/f rather than ISP (ATtiny4/5/9/10) */
|
||||
#define AVRPART_IS_AT90S1200 0x1000 /* part is an AT90S1200 (needs special treatment) */
|
||||
#define AVRPART_HAS_UPDI 0x2000 /* part has UPDI i/f (AVR8X) */
|
||||
|
||||
#define AVR_DESCLEN 64
|
||||
#define AVR_IDLEN 32
|
||||
#define AVR_FAMILYIDLEN 7
|
||||
#define AVR_SIBLEN 16
|
||||
#define CTL_STACK_SIZE 32
|
||||
#define FLASH_INSTR_SIZE 3
|
||||
#define EEPROM_INSTR_SIZE 20
|
||||
@@ -211,6 +201,7 @@ typedef struct opcode {
|
||||
typedef struct avrpart {
|
||||
char desc[AVR_DESCLEN]; /* long part name */
|
||||
char id[AVR_IDLEN]; /* short part name */
|
||||
char family_id[AVR_FAMILYIDLEN+1]; /* family id in the SIB (avr8x) */
|
||||
int stk500_devcode; /* stk500 device code */
|
||||
int avr910_devcode; /* avr910 device code */
|
||||
int chip_erase_delay; /* microseconds */
|
||||
@@ -264,11 +255,13 @@ typedef struct avrpart {
|
||||
unsigned short eecr; /* JTAC ICE mkII XML file parameter */
|
||||
unsigned int mcu_base; /* Base address of MCU control block in ATxmega devices */
|
||||
unsigned int nvm_base; /* Base address of NVM controller in ATxmega devices */
|
||||
unsigned int ocd_base; /* Base address of OCD module in AVR8X/UPDI devices */
|
||||
int ocdrev; /* OCD revision (JTAGICE3 parameter, from AS6 XML files) */
|
||||
|
||||
OPCODE * op[AVR_OP_MAX]; /* opcodes */
|
||||
|
||||
LISTID mem; /* avr memory definitions */
|
||||
LISTID mem_alias; /* memory alias definitions */
|
||||
char config_file[PATH_MAX]; /* config file where defined */
|
||||
int lineno; /* config file line number */
|
||||
} AVRPART;
|
||||
@@ -300,6 +293,11 @@ typedef struct avrmem {
|
||||
OPCODE * op[AVR_OP_MAX]; /* opcodes */
|
||||
} AVRMEM;
|
||||
|
||||
typedef struct avrmem_alias {
|
||||
char desc[AVR_MEMDESCLEN]; /* alias name ("syscfg0" etc.) */
|
||||
AVRMEM *aliased_mem;
|
||||
} AVRMEM_ALIAS;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -315,12 +313,17 @@ int avr_get_output_index(OPCODE * op);
|
||||
|
||||
/* Functions for AVRMEM structures */
|
||||
AVRMEM * avr_new_memtype(void);
|
||||
AVRMEM_ALIAS * avr_new_memalias(void);
|
||||
int avr_initmem(AVRPART * p);
|
||||
AVRMEM * avr_dup_mem(AVRMEM * m);
|
||||
void avr_free_mem(AVRMEM * m);
|
||||
void avr_free_memalias(AVRMEM_ALIAS * m);
|
||||
AVRMEM * avr_locate_mem(AVRPART * p, char * desc);
|
||||
void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, int type,
|
||||
int verbose);
|
||||
AVRMEM * avr_locate_mem_noalias(AVRPART * p, char * desc);
|
||||
AVRMEM_ALIAS * avr_locate_memalias(AVRPART * p, char * desc);
|
||||
AVRMEM_ALIAS * avr_find_memalias(AVRPART * p, AVRMEM * m_orig);
|
||||
void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, AVRPART * p,
|
||||
int type, int verbose);
|
||||
|
||||
/* Functions for AVRPART structures */
|
||||
AVRPART * avr_new_part(void);
|
||||
@@ -337,6 +340,9 @@ typedef void (*walk_avrparts_cb)(const char *name, const char *desc,
|
||||
void *cookie);
|
||||
void walk_avrparts(LISTID avrparts, walk_avrparts_cb cb, void *cookie);
|
||||
void sort_avrparts(LISTID avrparts);
|
||||
|
||||
int compare_memory_masked(AVRMEM * m, uint8_t buf1, uint8_t buf2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -365,7 +371,7 @@ enum {
|
||||
#ifdef HAVE_LINUXGPIO
|
||||
/* Embedded systems might have a lot more gpio than only 0-31 */
|
||||
#undef PIN_MAX
|
||||
#define PIN_MAX 255 /* largest allowed pin number */
|
||||
#define PIN_MAX 400 /* largest allowed pin number */
|
||||
#endif
|
||||
|
||||
/** Number of pins in each element of the bitfield */
|
||||
@@ -526,9 +532,34 @@ union filedescriptor
|
||||
} usb;
|
||||
};
|
||||
|
||||
#define SERIAL_CS5 0x0000
|
||||
#define SERIAL_CS6 0x0001
|
||||
#define SERIAL_CS7 0x0002
|
||||
#define SERIAL_CS8 0x0004
|
||||
|
||||
#define SERIAL_NO_CSTOPB 0x0000
|
||||
#define SERIAL_CSTOPB 0x0008
|
||||
|
||||
#define SERIAL_NO_CREAD 0x0000
|
||||
#define SERIAL_CREAD 0x0010
|
||||
|
||||
#define SERIAL_NO_PARITY 0x0000
|
||||
#define SERIAL_PARENB 0x0020
|
||||
#define SERIAL_PARODD 0x0040
|
||||
|
||||
#define SERIAL_NO_CLOCAL 0x0000
|
||||
#define SERIAL_CLOCAL 0x0080
|
||||
|
||||
#define SERIAL_8N1 (SERIAL_CS8 | SERIAL_NO_CSTOPB | SERIAL_CREAD | SERIAL_NO_PARITY | SERIAL_CLOCAL)
|
||||
#define SERIAL_8E1 (SERIAL_CS8 | SERIAL_NO_CSTOPB | SERIAL_CREAD | SERIAL_PARENB | SERIAL_CLOCAL)
|
||||
#define SERIAL_8E2 (SERIAL_CS8 | SERIAL_CSTOPB | SERIAL_CREAD | SERIAL_PARENB | SERIAL_CLOCAL)
|
||||
|
||||
union pinfo
|
||||
{
|
||||
long baud;
|
||||
struct {
|
||||
long baud;
|
||||
unsigned long cflags;
|
||||
} serialinfo;
|
||||
struct
|
||||
{
|
||||
unsigned short vid;
|
||||
@@ -544,7 +575,7 @@ struct serial_device
|
||||
{
|
||||
// open should return -1 on error, other values on success
|
||||
int (*open)(char * port, union pinfo pinfo, union filedescriptor *fd);
|
||||
int (*setspeed)(union filedescriptor *fd, long baud);
|
||||
int (*setparams)(union filedescriptor *fd, long baud, unsigned long cflags);
|
||||
void (*close)(union filedescriptor *fd);
|
||||
|
||||
int (*send)(union filedescriptor *fd, const unsigned char * buf, size_t buflen);
|
||||
@@ -563,9 +594,10 @@ extern struct serial_device serial_serdev;
|
||||
extern struct serial_device usb_serdev;
|
||||
extern struct serial_device usb_serdev_frame;
|
||||
extern struct serial_device avrdoper_serdev;
|
||||
extern struct serial_device usbhid_serdev;
|
||||
|
||||
#define serial_open (serdev->open)
|
||||
#define serial_setspeed (serdev->setspeed)
|
||||
#define serial_setparams (serdev->setparams)
|
||||
#define serial_close (serdev->close)
|
||||
#define serial_send (serdev->send)
|
||||
#define serial_recv (serdev->recv)
|
||||
@@ -641,6 +673,7 @@ typedef struct programmer_t {
|
||||
void (*powerdown) (struct programmer_t * pgm);
|
||||
int (*program_enable) (struct programmer_t * pgm, AVRPART * p);
|
||||
int (*chip_erase) (struct programmer_t * pgm, AVRPART * p);
|
||||
int (*unlock) (struct programmer_t * pgm, AVRPART * p);
|
||||
int (*cmd) (struct programmer_t * pgm, const unsigned char *cmd,
|
||||
unsigned char *res);
|
||||
int (*cmd_tpi) (struct programmer_t * pgm, const unsigned char *cmd,
|
||||
@@ -663,6 +696,7 @@ typedef struct programmer_t {
|
||||
int (*read_byte) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m,
|
||||
unsigned long addr, unsigned char * value);
|
||||
int (*read_sig_bytes) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m);
|
||||
int (*read_sib) (struct programmer_t * pgm, AVRPART * p, char *sib);
|
||||
void (*print_parms) (struct programmer_t * pgm);
|
||||
int (*set_vtarget) (struct programmer_t * pgm, double v);
|
||||
int (*set_varef) (struct programmer_t * pgm, unsigned int chan, double v);
|
||||
@@ -757,6 +791,8 @@ int avr_mem_hiaddr(AVRMEM * mem);
|
||||
|
||||
int avr_chip_erase(PROGRAMMER * pgm, AVRPART * p);
|
||||
|
||||
int avr_unlock(PROGRAMMER * pgm, AVRPART * p);
|
||||
|
||||
void report_progress (int completed, int total, char *hdr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -806,30 +842,6 @@ int fileio(int op, char * filename, FILEFMT format,
|
||||
#endif
|
||||
|
||||
|
||||
/* formerly safemode.h */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Writes the specified fuse in fusename (can be "lfuse", "hfuse", or "efuse") and verifies it. Will try up to tries
|
||||
amount of times before giving up */
|
||||
int safemode_writefuse (unsigned char fuse, char * fusename, PROGRAMMER * pgm, AVRPART * p, int tries);
|
||||
|
||||
/* Reads the fuses three times, checking that all readings are the same. This will ensure that the before values aren't in error! */
|
||||
int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse, unsigned char * efuse, unsigned char * fuse, PROGRAMMER * pgm, AVRPART * p);
|
||||
|
||||
/* This routine will store the current values pointed to by lfuse, hfuse, and efuse into an internal buffer in this routine
|
||||
when save is set to 1. When save is 0 (or not 1 really) it will copy the values from the internal buffer into the locations
|
||||
pointed to be lfuse, hfuse, and efuse. This allows you to change the fuse bits if needed from another routine (ie: have it so
|
||||
if user requests fuse bits are changed, the requested value is now verified */
|
||||
int safemode_memfuses (int save, unsigned char * lfuse, unsigned char * hfuse, unsigned char * efuse, unsigned char * fuse);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* formerly update.h */
|
||||
|
||||
enum {
|
||||
@@ -901,7 +913,6 @@ extern char default_programmer[];
|
||||
extern char default_parallel[];
|
||||
extern char default_serial[];
|
||||
extern double default_bitclock;
|
||||
extern int default_safemode;
|
||||
|
||||
/* This name is fixed, it's only here for symmetry with
|
||||
* default_parallel and default_serial. */
|
||||
@@ -924,7 +935,7 @@ int read_config(const char * file);
|
||||
|
||||
/* formerly confwin.h */
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
#if defined(WIN32)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -937,7 +948,7 @@ void win_usr_config_set(char usr_config[PATH_MAX]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* WIN32NATIVE */
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
#endif /* libavrdude_h */
|
||||
@@ -66,7 +66,7 @@ static int linuxgpio_export(unsigned int gpio)
|
||||
return fd;
|
||||
}
|
||||
|
||||
len = snprintf(buf, sizeof(buf), "%ud", gpio);
|
||||
len = snprintf(buf, sizeof(buf), "%u", gpio);
|
||||
r = write(fd, buf, len);
|
||||
close(fd);
|
||||
|
||||
@@ -84,7 +84,7 @@ static int linuxgpio_unexport(unsigned int gpio)
|
||||
return fd;
|
||||
}
|
||||
|
||||
len = snprintf(buf, sizeof(buf), "%ud", gpio);
|
||||
len = snprintf(buf, sizeof(buf), "%u", gpio);
|
||||
r = write(fd, buf, len);
|
||||
close(fd);
|
||||
|
||||
@@ -95,7 +95,7 @@ static int linuxgpio_openfd(unsigned int gpio)
|
||||
{
|
||||
char filepath[60];
|
||||
|
||||
snprintf(filepath, sizeof(filepath), "/sys/class/gpio/gpio%ud/value", gpio);
|
||||
snprintf(filepath, sizeof(filepath), "/sys/class/gpio/gpio%u/value", gpio);
|
||||
return (open(filepath, O_RDWR));
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ static int linuxgpio_dir(unsigned int gpio, unsigned int dir)
|
||||
int fd, r;
|
||||
char buf[60];
|
||||
|
||||
snprintf(buf, sizeof(buf), "/sys/class/gpio/gpio%ud/direction", gpio);
|
||||
snprintf(buf, sizeof(buf), "/sys/class/gpio/gpio%u/direction", gpio);
|
||||
|
||||
fd = open(buf, O_WRONLY);
|
||||
if (fd < 0) {
|
||||
@@ -330,6 +330,7 @@ void linuxgpio_initpgm(PROGRAMMER *pgm)
|
||||
pgm->program_enable = bitbang_program_enable;
|
||||
pgm->chip_erase = bitbang_chip_erase;
|
||||
pgm->cmd = bitbang_cmd;
|
||||
pgm->cmd_tpi = bitbang_cmd_tpi;
|
||||
pgm->open = linuxgpio_open;
|
||||
pgm->close = linuxgpio_close;
|
||||
pgm->setpin = linuxgpio_setpin;
|
||||
427
src/linuxspi.c
Normal file
427
src/linuxspi.c
Normal file
@@ -0,0 +1,427 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Support for using spidev userspace drivers to communicate directly over SPI
|
||||
*
|
||||
* Copyright (C) 2013 Kevin Cuzner <kevin@kevincuzner.com>
|
||||
* Copyright (C) 2018 Ralf Ramsauer <ralf@vmexit.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Support for inversion of reset pin, Tim Chilton 02/05/2014
|
||||
* Review code, rebase to latest trunk, add linux/gpio.h support, Ralf Ramsauer 2018-09-07
|
||||
*/
|
||||
|
||||
|
||||
#include "ac_cfg.h"
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "libavrdude.h"
|
||||
|
||||
#include "linuxspi.h"
|
||||
|
||||
#if HAVE_LINUXSPI
|
||||
|
||||
/**
|
||||
* Linux Kernel SPI Drivers
|
||||
*
|
||||
* Copyright (C) 2006 SWAPP
|
||||
* Andrea Paterniani <a.paterniani@swapp-eng.it>
|
||||
* Copyright (C) 2007 David Brownell (simplification, cleanup)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/spi/spidev.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#define LINUXSPI "linuxspi"
|
||||
|
||||
static int fd_spidev, fd_gpiochip, fd_linehandle;
|
||||
|
||||
/**
|
||||
* @brief Sends/receives a message in full duplex mode
|
||||
* @return -1 on failure, otherwise number of bytes sent/received
|
||||
*/
|
||||
static int linuxspi_spi_duplex(PROGRAMMER *pgm, const unsigned char *tx, unsigned char *rx, int len)
|
||||
{
|
||||
struct spi_ioc_transfer tr;
|
||||
int ret;
|
||||
|
||||
tr = (struct spi_ioc_transfer) {
|
||||
.tx_buf = (unsigned long)tx,
|
||||
.rx_buf = (unsigned long)rx,
|
||||
.len = len,
|
||||
.delay_usecs = 1,
|
||||
.speed_hz = 1.0 / pgm->bitclock, // seconds to Hz
|
||||
.bits_per_word = 8,
|
||||
};
|
||||
|
||||
ret = ioctl(fd_spidev, SPI_IOC_MESSAGE(1), &tr);
|
||||
if (ret != len)
|
||||
avrdude_message(MSG_INFO, "\n%s: error: Unable to send SPI message\n", progname);
|
||||
|
||||
return (ret == -1) ? -1 : 0;
|
||||
}
|
||||
|
||||
static void linuxspi_setup(PROGRAMMER *pgm)
|
||||
{
|
||||
}
|
||||
|
||||
static void linuxspi_teardown(PROGRAMMER* pgm)
|
||||
{
|
||||
}
|
||||
|
||||
static int linuxspi_reset_mcu(PROGRAMMER *pgm, bool active)
|
||||
{
|
||||
struct gpiohandle_data data;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Set the reset state and keep it. The pin will be released and set back to
|
||||
* its initial value, once the fd_gpiochip is closed.
|
||||
*/
|
||||
data.values[0] = active ^ !(pgm->pinno[PIN_AVR_RESET] & PIN_INVERSE);
|
||||
ret = ioctl(fd_linehandle, GPIOHANDLE_SET_LINE_VALUES_IOCTL, &data);
|
||||
#ifdef GPIO_V2_LINE_SET_VALUES_IOCTL
|
||||
if (ret == -1) {
|
||||
struct gpio_v2_line_values val;
|
||||
|
||||
val.mask = 1;
|
||||
val.bits = active ^ !(pgm->pinno[PIN_AVR_RESET] & PIN_INVERSE);
|
||||
|
||||
ret = ioctl(fd_linehandle, GPIO_V2_LINE_SET_VALUES_IOCTL, &val);
|
||||
}
|
||||
#endif
|
||||
if (ret == -1) {
|
||||
ret = -errno;
|
||||
avrdude_message(MSG_INFO, "%s error: Unable to set GPIO line %d value\n",
|
||||
progname, pgm->pinno[PIN_AVR_RESET] & ~PIN_INVERSE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int linuxspi_open(PROGRAMMER *pgm, char *port)
|
||||
{
|
||||
const char *port_error =
|
||||
"%s: error: Unknown port specification. "
|
||||
"Please use the format /dev/spidev:/dev/gpiochip[:resetno]\n";
|
||||
char port_default[] = "/dev/spidev0.0:/dev/gpiochip0";
|
||||
char *spidev, *gpiochip, *reset_pin;
|
||||
struct gpiohandle_request req;
|
||||
int ret;
|
||||
|
||||
if (!strcmp(port, "unknown")) {
|
||||
port = port_default;
|
||||
}
|
||||
|
||||
spidev = strtok(port, ":");
|
||||
if (!spidev) {
|
||||
avrdude_message(MSG_INFO, port_error, progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
gpiochip = strtok(NULL, ":");
|
||||
if (!gpiochip) {
|
||||
avrdude_message(MSG_INFO, port_error, progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* optional: override reset pin in configuration */
|
||||
reset_pin = strtok(NULL, ":");
|
||||
if (reset_pin)
|
||||
pgm->pinno[PIN_AVR_RESET] = strtoul(reset_pin, NULL, 0);
|
||||
|
||||
strcpy(pgm->port, port);
|
||||
fd_spidev = open(pgm->port, O_RDWR);
|
||||
if (fd_spidev < 0) {
|
||||
avrdude_message(MSG_INFO, "\n%s: error: Unable to open the spidev device %s", progname, pgm->port);
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t mode = SPI_MODE_0 | SPI_NO_CS;
|
||||
ret = ioctl(fd_spidev, SPI_IOC_WR_MODE32, &mode);
|
||||
if (ret == -1) {
|
||||
avrdude_message(MSG_INFO, "%s: error: Unable to set SPI mode %0X on %s\n",
|
||||
progname, mode, spidev);
|
||||
goto close_spidev;
|
||||
}
|
||||
fd_gpiochip = open(gpiochip, 0);
|
||||
if (fd_gpiochip < 0) {
|
||||
avrdude_message(MSG_INFO, "\n%s error: Unable to open the gpiochip %s", progname, gpiochip);
|
||||
ret = -1;
|
||||
goto close_spidev;
|
||||
}
|
||||
|
||||
strcpy(req.consumer_label, progname);
|
||||
req.lines = 1;
|
||||
req.lineoffsets[0] = pgm->pinno[PIN_AVR_RESET] & ~PIN_INVERSE;
|
||||
req.default_values[0] = !!(pgm->pinno[PIN_AVR_RESET] & PIN_INVERSE);
|
||||
req.flags = GPIOHANDLE_REQUEST_OUTPUT;
|
||||
|
||||
ret = ioctl(fd_gpiochip, GPIO_GET_LINEHANDLE_IOCTL, &req);
|
||||
if (ret != -1)
|
||||
fd_linehandle = req.fd;
|
||||
#ifdef GPIO_V2_GET_LINE_IOCTL
|
||||
if (ret == -1) {
|
||||
struct gpio_v2_line_request reqv2;
|
||||
|
||||
memset(&reqv2, 0, sizeof(reqv2));
|
||||
reqv2.offsets[0] = pgm->pinno[PIN_AVR_RESET] & ~PIN_INVERSE;
|
||||
strncpy(reqv2.consumer, progname, sizeof(reqv2.consumer) - 1);
|
||||
reqv2.config.flags = GPIO_V2_LINE_FLAG_OUTPUT;
|
||||
reqv2.config.num_attrs = 1;
|
||||
reqv2.config.attrs[0].attr.id = GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES;
|
||||
reqv2.config.attrs[0].attr.values = !!(pgm->pinno[PIN_AVR_RESET] & PIN_INVERSE);
|
||||
reqv2.config.attrs[0].mask = 1;
|
||||
reqv2.num_lines = 1;
|
||||
|
||||
ret = ioctl(fd_gpiochip, GPIO_V2_GET_LINE_IOCTL, &reqv2);
|
||||
if (ret != -1)
|
||||
fd_linehandle = reqv2.fd;
|
||||
}
|
||||
#endif
|
||||
if (ret == -1) {
|
||||
ret = -errno;
|
||||
avrdude_message(MSG_INFO, "%s error: Unable to get GPIO line %d\n",
|
||||
progname, pgm->pinno[PIN_AVR_RESET] & ~PIN_INVERSE);
|
||||
goto close_gpiochip;
|
||||
}
|
||||
|
||||
ret = linuxspi_reset_mcu(pgm, true);
|
||||
if (ret)
|
||||
goto close_out;
|
||||
|
||||
if (pgm->baudrate != 0) {
|
||||
avrdude_message(MSG_INFO,
|
||||
"%s: obsolete use of -b <clock> option for bit clock; use -B <clock>\n",
|
||||
progname);
|
||||
pgm->bitclock = 1.0 / pgm->baudrate;
|
||||
}
|
||||
if (pgm->bitclock == 0) {
|
||||
avrdude_message(MSG_NOTICE,
|
||||
"%s: defaulting bit clock to 200 kHz\n",
|
||||
progname);
|
||||
pgm->bitclock = 5E-6; // 200 kHz - 5 µs
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
close_out:
|
||||
close(fd_linehandle);
|
||||
close_gpiochip:
|
||||
close(fd_gpiochip);
|
||||
close_spidev:
|
||||
close(fd_spidev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void linuxspi_close(PROGRAMMER *pgm)
|
||||
{
|
||||
switch (pgm->exit_reset) {
|
||||
case EXIT_RESET_ENABLED:
|
||||
linuxspi_reset_mcu(pgm, true);
|
||||
break;
|
||||
|
||||
case EXIT_RESET_DISABLED:
|
||||
linuxspi_reset_mcu(pgm, false);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
close(fd_linehandle);
|
||||
close(fd_spidev);
|
||||
close(fd_gpiochip);
|
||||
}
|
||||
|
||||
static void linuxspi_disable(PROGRAMMER* pgm)
|
||||
{
|
||||
}
|
||||
|
||||
static void linuxspi_enable(PROGRAMMER* pgm)
|
||||
{
|
||||
}
|
||||
|
||||
static void linuxspi_display(PROGRAMMER* pgm, const char* p)
|
||||
{
|
||||
}
|
||||
|
||||
static int linuxspi_initialize(PROGRAMMER *pgm, AVRPART *p)
|
||||
{
|
||||
int tries, ret;
|
||||
|
||||
if (p->flags & AVRPART_HAS_TPI) {
|
||||
/* We do not support tpi. This is a dedicated SPI thing */
|
||||
avrdude_message(MSG_INFO, "%s: error: Programmer " LINUXSPI " does not support TPI\n", progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
//enable programming on the part
|
||||
tries = 0;
|
||||
do
|
||||
{
|
||||
ret = pgm->program_enable(pgm, p);
|
||||
if (ret == 0 || ret == -1)
|
||||
break;
|
||||
} while(tries++ < 65);
|
||||
|
||||
if (ret)
|
||||
avrdude_message(MSG_INFO, "%s: error: AVR device not responding\n", progname);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int linuxspi_cmd(PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res)
|
||||
{
|
||||
return linuxspi_spi_duplex(pgm, cmd, res, 4);
|
||||
}
|
||||
|
||||
static int linuxspi_program_enable(PROGRAMMER *pgm, AVRPART *p)
|
||||
{
|
||||
unsigned char cmd[4], res[4];
|
||||
|
||||
if (!p->op[AVR_OP_PGM_ENABLE]) {
|
||||
avrdude_message(MSG_INFO, "%s: error: program enable instruction not defined for part \"%s\"\n", progname, p->desc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(cmd, 0, sizeof(cmd));
|
||||
avr_set_bits(p->op[AVR_OP_PGM_ENABLE], cmd); //set the cmd
|
||||
pgm->cmd(pgm, cmd, res);
|
||||
|
||||
if (res[2] != cmd[1]) {
|
||||
/*
|
||||
* From ATtiny441 datasheet:
|
||||
*
|
||||
* In some systems, the programmer can not guarantee that SCK is held low
|
||||
* during power-up. In this case, RESET must be given a positive pulse after
|
||||
* SCK has been set to '0'. The duration of the pulse must be at least t RST
|
||||
* plus two CPU clock cycles. See Table 25-5 on page 240 for definition of
|
||||
* minimum pulse width on RESET pin, t RST
|
||||
* 2. Wait for at least 20 ms and then enable serial programming by sending
|
||||
* the Programming Enable serial instruction to the MOSI pin
|
||||
* 3. The serial programming instructions will not work if the communication
|
||||
* is out of synchronization. When in sync, the second byte (0x53) will echo
|
||||
* back when issuing the third byte of the Programming Enable instruction
|
||||
* ...
|
||||
* If the 0x53 did not echo back, give RESET a positive pulse and issue a
|
||||
* new Programming Enable command
|
||||
*/
|
||||
if (linuxspi_reset_mcu(pgm, false))
|
||||
return -1;
|
||||
usleep(5);
|
||||
if (linuxspi_reset_mcu(pgm, true))
|
||||
return -1;
|
||||
usleep(20000);
|
||||
|
||||
return -2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int linuxspi_chip_erase(PROGRAMMER *pgm, AVRPART *p)
|
||||
{
|
||||
unsigned char cmd[4], res[4];
|
||||
|
||||
if (!p->op[AVR_OP_CHIP_ERASE]) {
|
||||
avrdude_message(MSG_INFO, "%s: error: chip erase instruction not defined for part \"%s\"\n", progname, p->desc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(cmd, 0, sizeof(cmd));
|
||||
avr_set_bits(p->op[AVR_OP_CHIP_ERASE], cmd);
|
||||
pgm->cmd(pgm, cmd, res);
|
||||
usleep(p->chip_erase_delay);
|
||||
pgm->initialize(pgm, p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int linuxspi_parseexitspecs(PROGRAMMER *pgm, char *s)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
while ((cp = strtok(s, ","))) {
|
||||
s = 0;
|
||||
if (!strcmp(cp, "reset")) {
|
||||
pgm->exit_reset = EXIT_RESET_ENABLED;
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(cp, "noreset")) {
|
||||
pgm->exit_reset = EXIT_RESET_DISABLED;
|
||||
continue;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void linuxspi_initpgm(PROGRAMMER *pgm)
|
||||
{
|
||||
strcpy(pgm->type, LINUXSPI);
|
||||
|
||||
pgm_fill_old_pins(pgm); // TODO to be removed if old pin data no longer needed
|
||||
|
||||
/* mandatory functions */
|
||||
pgm->initialize = linuxspi_initialize;
|
||||
pgm->display = linuxspi_display;
|
||||
pgm->enable = linuxspi_enable;
|
||||
pgm->disable = linuxspi_disable;
|
||||
pgm->program_enable = linuxspi_program_enable;
|
||||
pgm->chip_erase = linuxspi_chip_erase;
|
||||
pgm->cmd = linuxspi_cmd;
|
||||
pgm->open = linuxspi_open;
|
||||
pgm->close = linuxspi_close;
|
||||
pgm->read_byte = avr_read_byte_default;
|
||||
pgm->write_byte = avr_write_byte_default;
|
||||
|
||||
/* optional functions */
|
||||
pgm->setup = linuxspi_setup;
|
||||
pgm->teardown = linuxspi_teardown;
|
||||
pgm->parseexitspecs = linuxspi_parseexitspecs;
|
||||
}
|
||||
|
||||
const char linuxspi_desc[] = "SPI using Linux spidev driver";
|
||||
|
||||
#else /* !HAVE_LINUXSPI */
|
||||
|
||||
void linuxspi_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: Linux SPI driver not available in this configuration\n",
|
||||
progname);
|
||||
}
|
||||
|
||||
const char linuxspi_desc[] = "SPI using Linux spidev driver (not available)";
|
||||
|
||||
#endif /* HAVE_LINUXSPI */
|
||||
35
src/linuxspi.h
Normal file
35
src/linuxspi.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2013 Kevin Cuzner <kevin@kevincuner.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef linuxspi_h
|
||||
#define linuxspi_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const char linuxspi_desc[];
|
||||
void linuxspi_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //linuxspi_h
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2000-2005 Brian S. Dean <bsd@bsdhome.com>
|
||||
* Copyright 2007-2014 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
* Copyright Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <whereami.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@@ -121,19 +122,14 @@ static void usage(void)
|
||||
" is performed in the order specified.\n"
|
||||
" -n Do not write anything to the device.\n"
|
||||
" -V Do not verify.\n"
|
||||
" -u Disable safemode, default when running from a script.\n"
|
||||
" -s Silent safemode operation, will not ask you if\n"
|
||||
" fuses should be changed back.\n"
|
||||
" -t Enter terminal mode.\n"
|
||||
" -E <exitspec>[,<exitspec>] List programmer exit specifications.\n"
|
||||
" -x <extended_param> Pass <extended_param> to programmer.\n"
|
||||
" -y Count # erase cycles in EEPROM.\n"
|
||||
" -Y <number> Initialize erase cycle # in EEPROM.\n"
|
||||
" -v Verbose output. -v -v for more.\n"
|
||||
" -q Quell progress output. -q -q for less.\n"
|
||||
" -l logfile Use logfile rather than stderr for diagnostics.\n"
|
||||
" -? Display this usage.\n"
|
||||
"\navrdude version %s, URL: <http://savannah.nongnu.org/projects/avrdude/>\n"
|
||||
"\navrdude version %s, URL: <https://github.com/avrdudes/avrdude>\n"
|
||||
,progname, version);
|
||||
}
|
||||
|
||||
@@ -303,6 +299,17 @@ static void cleanup_main(void)
|
||||
cleanup_config();
|
||||
}
|
||||
|
||||
static void replace_backslashes(char *s)
|
||||
{
|
||||
// Replace all backslashes with forward slashes
|
||||
for (int i = 0; i < strlen(s); i++) {
|
||||
if (s[i] == '\\') {
|
||||
s[i] = '/';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* main routine
|
||||
*/
|
||||
@@ -331,28 +338,27 @@ int main(int argc, char * argv [])
|
||||
char * partdesc; /* part id */
|
||||
char sys_config[PATH_MAX]; /* system wide config file */
|
||||
char usr_config[PATH_MAX]; /* per-user config file */
|
||||
char executable_abspath[PATH_MAX]; /* absolute path to avrdude executable */
|
||||
char executable_dirpath[PATH_MAX]; /* absolute path to folder with executable */
|
||||
bool executable_abspath_found = false; /* absolute path to executable found */
|
||||
bool sys_config_found = false; /* 'avrdude.conf' file found */
|
||||
char * e; /* for strtol() error checking */
|
||||
int baudrate; /* override default programmer baud rate */
|
||||
double bitclock; /* Specify programmer bit clock (JTAG ICE) */
|
||||
int ispdelay; /* Specify the delay for ISP clock */
|
||||
int safemode; /* Enable safemode, 1=safemode on, 0=normal */
|
||||
int silentsafe; /* Don't ask about fuses, 1=silent, 0=normal */
|
||||
int init_ok; /* Device initialization worked well */
|
||||
int is_open; /* Device open succeeded */
|
||||
char * logfile; /* Use logfile rather than stderr for diagnostics */
|
||||
enum updateflags uflags = UF_AUTO_ERASE; /* Flags for do_op() */
|
||||
unsigned char safemode_lfuse = 0xff;
|
||||
unsigned char safemode_hfuse = 0xff;
|
||||
unsigned char safemode_efuse = 0xff;
|
||||
unsigned char safemode_fuse = 0xff;
|
||||
|
||||
char * safemode_response;
|
||||
int fuses_specified = 0;
|
||||
int fuses_updated = 0;
|
||||
#if !defined(WIN32NATIVE)
|
||||
#if !defined(WIN32)
|
||||
char * homedir;
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
_set_printf_count_output(1);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set line buffering for file descriptors so we see stdout and stderr
|
||||
* properly interleaved.
|
||||
@@ -360,12 +366,14 @@ int main(int argc, char * argv [])
|
||||
setvbuf(stdout, (char*)NULL, _IOLBF, 0);
|
||||
setvbuf(stderr, (char*)NULL, _IOLBF, 0);
|
||||
|
||||
sys_config[0] = '\0';
|
||||
|
||||
progname = strrchr(argv[0],'/');
|
||||
|
||||
#if defined (WIN32NATIVE)
|
||||
#if defined (WIN32)
|
||||
/* take care of backslash as dir sep in W32 */
|
||||
if (!progname) progname = strrchr(argv[0],'\\');
|
||||
#endif /* WIN32NATIVE */
|
||||
#endif /* WIN32 */
|
||||
|
||||
if (progname)
|
||||
progname++;
|
||||
@@ -375,7 +383,6 @@ int main(int argc, char * argv [])
|
||||
default_parallel[0] = 0;
|
||||
default_serial[0] = 0;
|
||||
default_bitclock = 0.0;
|
||||
default_safemode = -1;
|
||||
|
||||
init_config();
|
||||
|
||||
@@ -415,36 +422,9 @@ int main(int argc, char * argv [])
|
||||
baudrate = 0;
|
||||
bitclock = 0.0;
|
||||
ispdelay = 0;
|
||||
safemode = 1; /* Safemode on by default */
|
||||
silentsafe = 0; /* Ask by default */
|
||||
is_open = 0;
|
||||
logfile = NULL;
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
|
||||
win_sys_config_set(sys_config);
|
||||
win_usr_config_set(usr_config);
|
||||
|
||||
#else
|
||||
|
||||
strcpy(sys_config, CONFIG_DIR);
|
||||
i = strlen(sys_config);
|
||||
if (i && (sys_config[i-1] != '/'))
|
||||
strcat(sys_config, "/");
|
||||
strcat(sys_config, "avrdude.conf");
|
||||
|
||||
usr_config[0] = 0;
|
||||
homedir = getenv("HOME");
|
||||
if (homedir != NULL) {
|
||||
strcpy(usr_config, homedir);
|
||||
i = strlen(usr_config);
|
||||
if (i && (usr_config[i-1] != '/'))
|
||||
strcat(usr_config, "/");
|
||||
strcat(usr_config, ".avrduderc");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
len = strlen(progname) + 2;
|
||||
for (i=0; i<len; i++)
|
||||
progbuf[i] = ' ';
|
||||
@@ -587,17 +567,13 @@ int main(int argc, char * argv [])
|
||||
quell_progress++ ;
|
||||
break;
|
||||
|
||||
case 's' : /* Silent safemode */
|
||||
silentsafe = 1;
|
||||
safemode = 1;
|
||||
break;
|
||||
|
||||
case 't': /* enter terminal mode */
|
||||
terminal = 1;
|
||||
break;
|
||||
|
||||
case 'u' : /* Disable safemode */
|
||||
safemode = 0;
|
||||
case 'u':
|
||||
avrdude_message(MSG_INFO, "%s: \"safemode\" feature no longer supported\n",
|
||||
progname);
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
@@ -662,6 +638,122 @@ int main(int argc, char * argv [])
|
||||
}
|
||||
}
|
||||
|
||||
/* search for system configuration file unless -C conffile was given */
|
||||
if (strlen(sys_config) == 0) {
|
||||
/*
|
||||
* EXECUTABLE ABSPATH
|
||||
* ------------------
|
||||
* Determine the absolute path to avrdude executable. This will be used to
|
||||
* locate the 'avrdude.conf' file later.
|
||||
*/
|
||||
int executable_dirpath_len;
|
||||
int executable_abspath_len = wai_getExecutablePath(
|
||||
executable_abspath,
|
||||
PATH_MAX,
|
||||
&executable_dirpath_len
|
||||
);
|
||||
if (
|
||||
(executable_abspath_len != -1) &&
|
||||
(executable_abspath_len != 0) &&
|
||||
(executable_dirpath_len != -1) &&
|
||||
(executable_dirpath_len != 0)
|
||||
) {
|
||||
// All requirements satisfied, executable path was found
|
||||
executable_abspath_found = true;
|
||||
|
||||
// Make sure the string is null terminated
|
||||
executable_abspath[executable_abspath_len] = '\0';
|
||||
|
||||
replace_backslashes(executable_abspath);
|
||||
|
||||
// Define 'executable_dirpath' to be the path to the parent folder of the
|
||||
// executable.
|
||||
strcpy(executable_dirpath, executable_abspath);
|
||||
executable_dirpath[executable_dirpath_len] = '\0';
|
||||
|
||||
// Debug output
|
||||
avrdude_message(MSG_DEBUG, "executable_abspath = %s\n", executable_abspath);
|
||||
avrdude_message(MSG_DEBUG, "executable_abspath_len = %i\n", executable_abspath_len);
|
||||
avrdude_message(MSG_DEBUG, "executable_dirpath = %s\n", executable_dirpath);
|
||||
avrdude_message(MSG_DEBUG, "executable_dirpath_len = %i\n", executable_dirpath_len);
|
||||
}
|
||||
|
||||
/*
|
||||
* SYSTEM CONFIG
|
||||
* -------------
|
||||
* Determine the location of 'avrdude.conf'. Check in this order:
|
||||
* 1. <dirpath of executable>/../etc/avrdude.conf
|
||||
* 2. <dirpath of executable>/avrdude.conf
|
||||
* 3. CONFIG_DIR/avrdude.conf
|
||||
*
|
||||
* When found, write the result into the 'sys_config' variable.
|
||||
*/
|
||||
if (executable_abspath_found) {
|
||||
// 1. Check <dirpath of executable>/../etc/avrdude.conf
|
||||
strcpy(sys_config, executable_dirpath);
|
||||
sys_config[PATH_MAX - 1] = '\0';
|
||||
i = strlen(sys_config);
|
||||
if (i && (sys_config[i - 1] != '/'))
|
||||
strcat(sys_config, "/");
|
||||
strcat(sys_config, "../etc/" SYSTEM_CONF_FILE);
|
||||
sys_config[PATH_MAX - 1] = '\0';
|
||||
if (access(sys_config, F_OK) == 0) {
|
||||
sys_config_found = true;
|
||||
}
|
||||
else {
|
||||
// 2. Check <dirpath of executable>/avrdude.conf
|
||||
strcpy(sys_config, executable_dirpath);
|
||||
sys_config[PATH_MAX - 1] = '\0';
|
||||
i = strlen(sys_config);
|
||||
if (i && (sys_config[i - 1] != '/'))
|
||||
strcat(sys_config, "/");
|
||||
strcat(sys_config, SYSTEM_CONF_FILE);
|
||||
sys_config[PATH_MAX - 1] = '\0';
|
||||
if (access(sys_config, F_OK) == 0) {
|
||||
sys_config_found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!sys_config_found) {
|
||||
// 3. Check CONFIG_DIR/avrdude.conf
|
||||
#if defined(WIN32)
|
||||
win_sys_config_set(sys_config);
|
||||
#else
|
||||
strcpy(sys_config, CONFIG_DIR);
|
||||
i = strlen(sys_config);
|
||||
if (i && (sys_config[i - 1] != '/'))
|
||||
strcat(sys_config, "/");
|
||||
strcat(sys_config, SYSTEM_CONF_FILE);
|
||||
#endif
|
||||
if (access(sys_config, F_OK) == 0) {
|
||||
sys_config_found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Debug output
|
||||
avrdude_message(MSG_DEBUG, "sys_config = %s\n", sys_config);
|
||||
avrdude_message(MSG_DEBUG, "sys_config_found = %s\n", sys_config_found ? "true" : "false");
|
||||
avrdude_message(MSG_DEBUG, "\n");
|
||||
|
||||
/*
|
||||
* USER CONFIG
|
||||
* -----------
|
||||
* Determine the location of '.avrduderc'.
|
||||
*/
|
||||
#if defined(WIN32)
|
||||
win_usr_config_set(usr_config);
|
||||
#else
|
||||
usr_config[0] = 0;
|
||||
homedir = getenv("HOME");
|
||||
if (homedir != NULL) {
|
||||
strcpy(usr_config, homedir);
|
||||
i = strlen(usr_config);
|
||||
if (i && (usr_config[i - 1] != '/'))
|
||||
strcat(usr_config, "/");
|
||||
strcat(usr_config, USER_CONF_FILE);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (quell_progress == 0) {
|
||||
if (isatty (STDERR_FILENO))
|
||||
update_progress = update_progress_tty;
|
||||
@@ -679,10 +771,10 @@ int main(int argc, char * argv [])
|
||||
* Print out an identifying string so folks can tell what version
|
||||
* they are running
|
||||
*/
|
||||
avrdude_message(MSG_NOTICE, "\n%s: Version %s, compiled on %s at %s\n"
|
||||
"%sCopyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/\n"
|
||||
"%sCopyright (c) 2007-2014 Joerg Wunsch\n\n",
|
||||
progname, version, __DATE__, __TIME__, progbuf, progbuf);
|
||||
avrdude_message(MSG_NOTICE, "\n%s: Version %s\n"
|
||||
"%sCopyright (c) Brian Dean, http://www.bdmicro.com/\n"
|
||||
"%sCopyright (c) Joerg Wunsch\n\n",
|
||||
progname, version, progbuf, progbuf);
|
||||
avrdude_message(MSG_NOTICE, "%sSystem wide configuration file is \"%s\"\n",
|
||||
progbuf, sys_config);
|
||||
|
||||
@@ -865,29 +957,6 @@ int main(int argc, char * argv [])
|
||||
}
|
||||
}
|
||||
|
||||
if (default_safemode == 0) {
|
||||
/* configuration disables safemode: revert meaning of -u */
|
||||
if (safemode == 0)
|
||||
/* -u was given: enable safemode */
|
||||
safemode = 1;
|
||||
else
|
||||
/* -u not given: turn off */
|
||||
safemode = 0;
|
||||
}
|
||||
|
||||
if (isatty(STDIN_FILENO) == 0 && silentsafe == 0)
|
||||
safemode = 0; /* Turn off safemode if this isn't a terminal */
|
||||
|
||||
|
||||
if(p->flags & AVRPART_AVR32) {
|
||||
safemode = 0;
|
||||
}
|
||||
|
||||
if(p->flags & (AVRPART_HAS_PDI | AVRPART_HAS_TPI)) {
|
||||
safemode = 0;
|
||||
}
|
||||
|
||||
|
||||
if (avr_initmem(p) != 0)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "\n%s: failed to initialize memories\n",
|
||||
@@ -921,7 +990,7 @@ int main(int argc, char * argv [])
|
||||
*/
|
||||
if (port[0] == 0) {
|
||||
avrdude_message(MSG_INFO, "\n%s: no port has been specified on the command line "
|
||||
"or the config file\n",
|
||||
"or in the config file\n",
|
||||
progname);
|
||||
avrdude_message(MSG_INFO, "%sSpecify a port using the -P option and try again\n\n",
|
||||
progbuf);
|
||||
@@ -955,6 +1024,9 @@ int main(int argc, char * argv [])
|
||||
|
||||
rc = pgm->open(pgm, port);
|
||||
if (rc < 0) {
|
||||
avrdude_message(MSG_INFO,
|
||||
"%s: opening programmer \"%s\" on port \"%s\" failed\n",
|
||||
progname, programmer, port);
|
||||
exitrc = 1;
|
||||
pgm->ppidata = 0; /* clear all bits at exit */
|
||||
goto main_exit;
|
||||
@@ -1007,7 +1079,7 @@ int main(int argc, char * argv [])
|
||||
pgm->vfy_led(pgm, OFF);
|
||||
|
||||
/*
|
||||
* initialize the chip in preperation for accepting commands
|
||||
* initialize the chip in preparation for accepting commands
|
||||
*/
|
||||
init_ok = (rc = pgm->initialize(pgm, p)) >= 0;
|
||||
if (!init_ok) {
|
||||
@@ -1045,6 +1117,44 @@ int main(int argc, char * argv [])
|
||||
if (init_ok) {
|
||||
rc = avr_signature(pgm, p);
|
||||
if (rc != 0) {
|
||||
// -68 == -(0x44) == -(RSP3_FAIL_OCD_LOCKED)
|
||||
if ((rc == -68) && (p->flags & AVRPART_HAS_UPDI) && (attempt < 1)) {
|
||||
attempt++;
|
||||
if (pgm->read_sib) {
|
||||
// Read SIB and compare FamilyID
|
||||
char sib[AVR_SIBLEN + 1];
|
||||
pgm->read_sib(pgm, p, sib);
|
||||
avrdude_message(MSG_NOTICE, "%s: System Information Block: \"%s\"\n",
|
||||
progname, sib);
|
||||
if (quell_progress < 2) {
|
||||
avrdude_message(MSG_INFO, "%s: Received FamilyID: \"%.*s\"\n", progname, AVR_FAMILYIDLEN, sib);
|
||||
}
|
||||
if (strncmp(p->family_id, sib, AVR_FAMILYIDLEN)) {
|
||||
avrdude_message(MSG_INFO, "%s: Expected FamilyID: \"%s\"\n", progname, p->family_id);
|
||||
if (!ovsigck) {
|
||||
avrdude_message(MSG_INFO, "%sDouble check chip, "
|
||||
"or use -F to override this check.\n",
|
||||
progbuf);
|
||||
exitrc = 1;
|
||||
goto main_exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(erase) {
|
||||
erase = 0;
|
||||
if (uflags & UF_NOWRITE) {
|
||||
avrdude_message(MSG_INFO, "%s: conflicting -e and -n options specified, NOT erasing chip\n",
|
||||
progname);
|
||||
} else {
|
||||
if (quell_progress < 2) {
|
||||
avrdude_message(MSG_INFO, "%s: erasing chip\n", progname);
|
||||
}
|
||||
exitrc = avr_unlock(pgm, p);
|
||||
if(exitrc) goto main_exit;
|
||||
goto sig_again;
|
||||
}
|
||||
}
|
||||
}
|
||||
avrdude_message(MSG_INFO, "%s: error reading signature data, rc=%d\n",
|
||||
progname, rc);
|
||||
exitrc = 1;
|
||||
@@ -1074,12 +1184,19 @@ int main(int argc, char * argv [])
|
||||
if (sig->buf[i] != 0x00)
|
||||
zz = 0;
|
||||
}
|
||||
|
||||
bool signature_matches =
|
||||
sig->size == 3 &&
|
||||
sig->buf[0] == p->signature[0] &&
|
||||
sig->buf[1] == p->signature[1] &&
|
||||
sig->buf[2] == p->signature[2];
|
||||
|
||||
if (quell_progress < 2) {
|
||||
AVRPART * part;
|
||||
|
||||
part = locate_part_by_signature(part_list, sig->buf, sig->size);
|
||||
if (part) {
|
||||
avrdude_message(MSG_INFO, " (probably %s)", part->id);
|
||||
avrdude_message(MSG_INFO, " (probably %s)", signature_matches ? p->id : part->id);
|
||||
}
|
||||
}
|
||||
if (ff || zz) {
|
||||
@@ -1108,10 +1225,7 @@ int main(int argc, char * argv [])
|
||||
}
|
||||
}
|
||||
|
||||
if (sig->size != 3 ||
|
||||
sig->buf[0] != p->signature[0] ||
|
||||
sig->buf[1] != p->signature[1] ||
|
||||
sig->buf[2] != p->signature[2]) {
|
||||
if (!signature_matches) {
|
||||
avrdude_message(MSG_INFO, "%s: Expected signature for %s is %02X %02X %02X\n",
|
||||
progname, p->desc,
|
||||
p->signature[0], p->signature[1], p->signature[2]);
|
||||
@@ -1126,36 +1240,6 @@ int main(int argc, char * argv [])
|
||||
}
|
||||
}
|
||||
|
||||
if (init_ok && safemode == 1) {
|
||||
/* If safemode is enabled, go ahead and read the current low, high,
|
||||
and extended fuse bytes as needed */
|
||||
|
||||
rc = safemode_readfuses(&safemode_lfuse, &safemode_hfuse,
|
||||
&safemode_efuse, &safemode_fuse, pgm, p);
|
||||
|
||||
if (rc != 0) {
|
||||
|
||||
//Check if the programmer just doesn't support reading
|
||||
if (rc == -5)
|
||||
{
|
||||
avrdude_message(MSG_NOTICE, "%s: safemode: Fuse reading not support by programmer.\n"
|
||||
" Safemode disabled.\n", progname);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
avrdude_message(MSG_INFO, "%s: safemode: To protect your AVR the programming "
|
||||
"will be aborted\n",
|
||||
progname);
|
||||
exitrc = 1;
|
||||
goto main_exit;
|
||||
}
|
||||
} else {
|
||||
//Save the fuses as default
|
||||
safemode_memfuses(1, &safemode_lfuse, &safemode_hfuse, &safemode_efuse, &safemode_fuse);
|
||||
}
|
||||
}
|
||||
|
||||
if (uflags & UF_AUTO_ERASE) {
|
||||
if ((p->flags & AVRPART_HAS_PDI) && pgm->page_erase != NULL &&
|
||||
lsize(updates) > 0) {
|
||||
@@ -1231,163 +1315,6 @@ int main(int argc, char * argv [])
|
||||
}
|
||||
}
|
||||
|
||||
/* Right before we exit programming mode, which will make the fuse
|
||||
bits active, check to make sure they are still correct */
|
||||
if (safemode == 1) {
|
||||
/* If safemode is enabled, go ahead and read the current low,
|
||||
* high, and extended fuse bytes as needed */
|
||||
unsigned char safemodeafter_lfuse = 0xff;
|
||||
unsigned char safemodeafter_hfuse = 0xff;
|
||||
unsigned char safemodeafter_efuse = 0xff;
|
||||
unsigned char safemodeafter_fuse = 0xff;
|
||||
unsigned char failures = 0;
|
||||
char yes[1] = {'y'};
|
||||
|
||||
if (quell_progress < 2) {
|
||||
avrdude_message(MSG_INFO, "\n");
|
||||
}
|
||||
|
||||
//Restore the default fuse values
|
||||
safemode_memfuses(0, &safemode_lfuse, &safemode_hfuse, &safemode_efuse, &safemode_fuse);
|
||||
|
||||
/* Try reading back fuses, make sure they are reliable to read back */
|
||||
if (safemode_readfuses(&safemodeafter_lfuse, &safemodeafter_hfuse,
|
||||
&safemodeafter_efuse, &safemodeafter_fuse, pgm, p) != 0) {
|
||||
/* Uh-oh.. try once more to read back fuses */
|
||||
if (safemode_readfuses(&safemodeafter_lfuse, &safemodeafter_hfuse,
|
||||
&safemodeafter_efuse, &safemodeafter_fuse, pgm, p) != 0) {
|
||||
avrdude_message(MSG_INFO, "%s: safemode: Sorry, reading back fuses was unreliable. "
|
||||
"I have given up and exited programming mode\n",
|
||||
progname);
|
||||
exitrc = 1;
|
||||
goto main_exit;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now check what fuses are against what they should be */
|
||||
if (safemodeafter_fuse != safemode_fuse) {
|
||||
fuses_updated = 1;
|
||||
avrdude_message(MSG_INFO, "%s: safemode: fuse changed! Was %x, and is now %x\n",
|
||||
progname, safemode_fuse, safemodeafter_fuse);
|
||||
|
||||
|
||||
/* Ask user - should we change them */
|
||||
|
||||
if (silentsafe == 0)
|
||||
safemode_response = terminal_get_input("Would you like this fuse to be changed back? [y/n] ");
|
||||
else
|
||||
safemode_response = yes;
|
||||
|
||||
if (tolower((int)(safemode_response[0])) == 'y') {
|
||||
|
||||
/* Enough chit-chat, time to program some fuses and check them */
|
||||
if (safemode_writefuse (safemode_fuse, "fuse", pgm, p,
|
||||
10) == 0) {
|
||||
avrdude_message(MSG_INFO, "%s: safemode: and is now rescued\n", progname);
|
||||
}
|
||||
else {
|
||||
avrdude_message(MSG_INFO, "%s: and COULD NOT be changed\n", progname);
|
||||
failures++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Now check what fuses are against what they should be */
|
||||
if (safemodeafter_lfuse != safemode_lfuse) {
|
||||
fuses_updated = 1;
|
||||
avrdude_message(MSG_INFO, "%s: safemode: lfuse changed! Was %x, and is now %x\n",
|
||||
progname, safemode_lfuse, safemodeafter_lfuse);
|
||||
|
||||
|
||||
/* Ask user - should we change them */
|
||||
|
||||
if (silentsafe == 0)
|
||||
safemode_response = terminal_get_input("Would you like this fuse to be changed back? [y/n] ");
|
||||
else
|
||||
safemode_response = yes;
|
||||
|
||||
if (tolower((int)(safemode_response[0])) == 'y') {
|
||||
|
||||
/* Enough chit-chat, time to program some fuses and check them */
|
||||
if (safemode_writefuse (safemode_lfuse, "lfuse", pgm, p,
|
||||
10) == 0) {
|
||||
avrdude_message(MSG_INFO, "%s: safemode: and is now rescued\n", progname);
|
||||
}
|
||||
else {
|
||||
avrdude_message(MSG_INFO, "%s: and COULD NOT be changed\n", progname);
|
||||
failures++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Now check what fuses are against what they should be */
|
||||
if (safemodeafter_hfuse != safemode_hfuse) {
|
||||
fuses_updated = 1;
|
||||
avrdude_message(MSG_INFO, "%s: safemode: hfuse changed! Was %x, and is now %x\n",
|
||||
progname, safemode_hfuse, safemodeafter_hfuse);
|
||||
|
||||
/* Ask user - should we change them */
|
||||
if (silentsafe == 0)
|
||||
safemode_response = terminal_get_input("Would you like this fuse to be changed back? [y/n] ");
|
||||
else
|
||||
safemode_response = yes;
|
||||
if (tolower((int)(safemode_response[0])) == 'y') {
|
||||
|
||||
/* Enough chit-chat, time to program some fuses and check them */
|
||||
if (safemode_writefuse(safemode_hfuse, "hfuse", pgm, p,
|
||||
10) == 0) {
|
||||
avrdude_message(MSG_INFO, "%s: safemode: and is now rescued\n", progname);
|
||||
}
|
||||
else {
|
||||
avrdude_message(MSG_INFO, "%s: and COULD NOT be changed\n", progname);
|
||||
failures++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Now check what fuses are against what they should be */
|
||||
if (safemodeafter_efuse != safemode_efuse) {
|
||||
fuses_updated = 1;
|
||||
avrdude_message(MSG_INFO, "%s: safemode: efuse changed! Was %x, and is now %x\n",
|
||||
progname, safemode_efuse, safemodeafter_efuse);
|
||||
|
||||
/* Ask user - should we change them */
|
||||
if (silentsafe == 0)
|
||||
safemode_response = terminal_get_input("Would you like this fuse to be changed back? [y/n] ");
|
||||
else
|
||||
safemode_response = yes;
|
||||
if (tolower((int)(safemode_response[0])) == 'y') {
|
||||
|
||||
/* Enough chit-chat, time to program some fuses and check them */
|
||||
if (safemode_writefuse (safemode_efuse, "efuse", pgm, p,
|
||||
10) == 0) {
|
||||
avrdude_message(MSG_INFO, "%s: safemode: and is now rescued\n", progname);
|
||||
}
|
||||
else {
|
||||
avrdude_message(MSG_INFO, "%s: and COULD NOT be changed\n", progname);
|
||||
failures++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (quell_progress < 2) {
|
||||
avrdude_message(MSG_INFO, "%s: safemode: ", progname);
|
||||
if (failures == 0) {
|
||||
avrdude_message(MSG_INFO, "Fuses OK (E:%02X, H:%02X, L:%02X)\n",
|
||||
safemode_efuse, safemode_hfuse, safemode_lfuse);
|
||||
}
|
||||
else {
|
||||
avrdude_message(MSG_INFO, "Fuses not recovered, sorry\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (fuses_updated && fuses_specified) {
|
||||
exitrc = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
main_exit:
|
||||
|
||||
/*
|
||||
970
src/micronucleus.c
Normal file
970
src/micronucleus.c
Normal file
@@ -0,0 +1,970 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2019 Marius Greuel
|
||||
* Portions Copyright (C) 2014 T. Bo"scke
|
||||
* Portions Copyright (C) 2012 ihsan Kehribar
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Notes:
|
||||
// This file adds support for the Micronucleus bootloader V1 and V2,
|
||||
// so you do no longer need the Micronucleus command-line utility.
|
||||
//
|
||||
// This bootloader is typically used on small ATtiny boards,
|
||||
// such as Digispark (ATtiny85), Digispark Pro (ATtiny167),
|
||||
// and the respective clones.
|
||||
// By default, it bootloader uses the VID/PID 16d0:0753 (MCS Digistump).
|
||||
//
|
||||
// As the micronucleus bootloader is optimized for size, it implements
|
||||
// writing to flash memory only. Since it does not support reading,
|
||||
// use the -V option to prevent avrdude from verifing the flash memory.
|
||||
// To have avrdude wait for the device to be connected, use the
|
||||
// extended option '-x wait'.
|
||||
//
|
||||
// Example:
|
||||
// avrdude -c micronucleus -p t85 -x wait -V -U flash:w:main.hex
|
||||
|
||||
#include "ac_cfg.h"
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include "avrdude.h"
|
||||
#include "micronucleus.h"
|
||||
#include "usbdevs.h"
|
||||
|
||||
#if defined(HAVE_LIBUSB)
|
||||
|
||||
#if defined(HAVE_USB_H)
|
||||
#include <usb.h>
|
||||
#elif defined(HAVE_LUSB0_USB_H)
|
||||
#include <lusb0_usb.h>
|
||||
#else
|
||||
#error "libusb needs either <usb.h> or <lusb0_usb.h>"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#define MICRONUCLEUS_VID 0x16D0
|
||||
#define MICRONUCLEUS_PID 0x0753
|
||||
|
||||
#define MICRONUCLEUS_CONNECT_WAIT 100
|
||||
|
||||
#define MICRONUCLEUS_CMD_INFO 0
|
||||
#define MICRONUCLEUS_CMD_TRANSFER 1
|
||||
#define MICRONUCLEUS_CMD_ERASE 2
|
||||
#define MICRONUCLEUS_CMD_PROGRAM 3
|
||||
#define MICRONUCLEUS_CMD_START 4
|
||||
|
||||
#define MICRONUCLEUS_DEFAULT_TIMEOUT 500
|
||||
#define MICRONUCLEUS_MAX_MAJOR_VERSION 2
|
||||
|
||||
#define PDATA(pgm) ((pdata_t*)(pgm->cookie))
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
typedef struct pdata
|
||||
{
|
||||
usb_dev_handle* usb_handle;
|
||||
// Extended parameters
|
||||
bool wait_until_device_present;
|
||||
int wait_timout; // in seconds
|
||||
// Bootloader version
|
||||
uint8_t major_version;
|
||||
uint8_t minor_version;
|
||||
// Bootloader info (via USB request)
|
||||
uint16_t flash_size; // programmable size (in bytes) of flash
|
||||
uint8_t page_size; // size (in bytes) of page
|
||||
uint8_t write_sleep; // milliseconds
|
||||
uint8_t signature1; // only used in protocol v2
|
||||
uint8_t signature2; // only used in protocol v2
|
||||
// Calculated bootloader info
|
||||
uint16_t pages; // total number of pages to program
|
||||
uint16_t bootloader_start; // start of the bootloader (at page boundary)
|
||||
uint16_t erase_sleep; // milliseconds
|
||||
// State
|
||||
uint16_t user_reset_vector; // reset vector of user program
|
||||
bool write_last_page; // last page already programmed
|
||||
bool start_program; // require start after flash
|
||||
} pdata_t;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void delay_ms(uint32_t duration)
|
||||
{
|
||||
usleep(duration * 1000);
|
||||
}
|
||||
|
||||
static int micronucleus_check_connection(pdata_t* pdata)
|
||||
{
|
||||
if (pdata->major_version >= 2)
|
||||
{
|
||||
uint8_t buffer[6] = { 0 };
|
||||
int result = usb_control_msg(
|
||||
pdata->usb_handle,
|
||||
USB_ENDPOINT_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
MICRONUCLEUS_CMD_INFO,
|
||||
0, 0,
|
||||
(char*)buffer, sizeof(buffer),
|
||||
MICRONUCLEUS_DEFAULT_TIMEOUT);
|
||||
return result == sizeof(buffer) ? 0 : -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t buffer[4] = { 0 };
|
||||
int result = usb_control_msg(
|
||||
pdata->usb_handle,
|
||||
USB_ENDPOINT_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
MICRONUCLEUS_CMD_INFO,
|
||||
0, 0,
|
||||
(char*)buffer, sizeof(buffer),
|
||||
MICRONUCLEUS_DEFAULT_TIMEOUT);
|
||||
return result == sizeof(buffer) ? 0 : -1;
|
||||
}
|
||||
}
|
||||
|
||||
static int micronucleus_reconnect(pdata_t* pdata)
|
||||
{
|
||||
struct usb_device* device = usb_device(pdata->usb_handle);
|
||||
|
||||
usb_close(pdata->usb_handle);
|
||||
pdata->usb_handle = NULL;
|
||||
|
||||
for (int i = 0; i < 25; i++)
|
||||
{
|
||||
avrdude_message(MSG_NOTICE, "%s: Trying to reconnect...\n", progname);
|
||||
|
||||
pdata->usb_handle = usb_open(device);
|
||||
if (pdata->usb_handle != NULL)
|
||||
return 0;
|
||||
|
||||
delay_ms(MICRONUCLEUS_CONNECT_WAIT);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int micronucleus_get_bootloader_info_v1(pdata_t* pdata)
|
||||
{
|
||||
uint8_t buffer[4] = { 0 };
|
||||
int result = usb_control_msg(
|
||||
pdata->usb_handle,
|
||||
USB_ENDPOINT_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
MICRONUCLEUS_CMD_INFO,
|
||||
0, 0,
|
||||
(char*)buffer, sizeof(buffer),
|
||||
MICRONUCLEUS_DEFAULT_TIMEOUT);
|
||||
if (result < 0)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: WARNING: Failed to get bootloader info block: %s\n",
|
||||
progname, usb_strerror());
|
||||
return result;
|
||||
}
|
||||
else if (result < sizeof(buffer))
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: WARNING: Received invalid bootloader info block size: %d\n",
|
||||
progname, result);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pdata->flash_size = (buffer[0] << 8) | buffer[1];
|
||||
pdata->page_size = buffer[2];
|
||||
pdata->write_sleep = buffer[3] & 127;
|
||||
|
||||
// Take a wild guess on the part ID, so that we can supply it for device verification
|
||||
if (pdata->page_size == 128)
|
||||
{
|
||||
// ATtiny167
|
||||
pdata->signature1 = 0x94;
|
||||
pdata->signature2 = 0x87;
|
||||
}
|
||||
else if (pdata->page_size == 64)
|
||||
{
|
||||
if (pdata->flash_size > 4096)
|
||||
{
|
||||
// ATtiny85
|
||||
pdata->signature1 = 0x93;
|
||||
pdata->signature2 = 0x0B;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ATtiny45
|
||||
pdata->signature1 = 0x92;
|
||||
pdata->signature2 = 0x06;
|
||||
}
|
||||
}
|
||||
else if (pdata->page_size == 16)
|
||||
{
|
||||
// ATtiny841
|
||||
pdata->signature1 = 0x93;
|
||||
pdata->signature2 = 0x15;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Unknown device
|
||||
pdata->signature1 = 0;
|
||||
pdata->signature2 = 0;
|
||||
}
|
||||
|
||||
pdata->pages = (pdata->flash_size + pdata->page_size - 1) / pdata->page_size;
|
||||
pdata->bootloader_start = pdata->pages * pdata->page_size;
|
||||
pdata->erase_sleep = pdata->write_sleep * pdata->pages;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int micronucleus_get_bootloader_info_v2(pdata_t* pdata)
|
||||
{
|
||||
uint8_t buffer[6] = { 0 };
|
||||
int result = usb_control_msg(
|
||||
pdata->usb_handle,
|
||||
USB_ENDPOINT_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
MICRONUCLEUS_CMD_INFO,
|
||||
0, 0,
|
||||
(char*)buffer, sizeof(buffer),
|
||||
MICRONUCLEUS_DEFAULT_TIMEOUT);
|
||||
if (result < 0)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: WARNING: Failed to get bootloader info block: %s\n",
|
||||
progname, usb_strerror());
|
||||
return result;
|
||||
}
|
||||
else if (result < sizeof(buffer))
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: WARNING: Received invalid bootloader info block size: %d\n",
|
||||
progname, result);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pdata->flash_size = (buffer[0] << 8) + buffer[1];
|
||||
pdata->page_size = buffer[2];
|
||||
pdata->write_sleep = (buffer[3] & 127) + 2;
|
||||
pdata->signature1 = buffer[4];
|
||||
pdata->signature2 = buffer[5];
|
||||
|
||||
pdata->pages = (pdata->flash_size + pdata->page_size - 1) / pdata->page_size;
|
||||
pdata->bootloader_start = pdata->pages * pdata->page_size;
|
||||
pdata->erase_sleep = pdata->write_sleep * pdata->pages;
|
||||
|
||||
// if bit 7 of write sleep time is set, divide the erase time by four to
|
||||
// accomodate to the 4*page erase of the ATtiny841/441
|
||||
if ((buffer[3] & 128) != 0)
|
||||
{
|
||||
pdata->erase_sleep /= 4;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int micronucleus_get_bootloader_info(pdata_t* pdata)
|
||||
{
|
||||
if (pdata->major_version >= 2)
|
||||
{
|
||||
return micronucleus_get_bootloader_info_v2(pdata);
|
||||
}
|
||||
else
|
||||
{
|
||||
return micronucleus_get_bootloader_info_v1(pdata);
|
||||
}
|
||||
}
|
||||
|
||||
static void micronucleus_dump_device_info(pdata_t* pdata)
|
||||
{
|
||||
avrdude_message(MSG_NOTICE, "%s: Bootloader version: %d.%d\n", progname, pdata->major_version, pdata->minor_version);
|
||||
avrdude_message(MSG_NOTICE, "%s: Available flash size: %u\n", progname, pdata->flash_size);
|
||||
avrdude_message(MSG_NOTICE, "%s: Page size: %u\n", progname, pdata->page_size);
|
||||
avrdude_message(MSG_NOTICE, "%s: Bootloader start: 0x%04X\n", progname, pdata->bootloader_start);
|
||||
avrdude_message(MSG_NOTICE, "%s: Write sleep: %ums\n", progname, pdata->write_sleep);
|
||||
avrdude_message(MSG_NOTICE, "%s: Erase sleep: %ums\n", progname, pdata->erase_sleep);
|
||||
avrdude_message(MSG_NOTICE, "%s: Signature1: 0x%02X\n", progname, pdata->signature1);
|
||||
avrdude_message(MSG_NOTICE, "%s: Signature2: 0x%02X\n", progname, pdata->signature2);
|
||||
}
|
||||
|
||||
static int micronucleus_erase_device(pdata_t* pdata)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_erase_device()\n", progname);
|
||||
|
||||
int result = usb_control_msg(
|
||||
pdata->usb_handle,
|
||||
USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
MICRONUCLEUS_CMD_ERASE,
|
||||
0, 0,
|
||||
NULL, 0,
|
||||
MICRONUCLEUS_DEFAULT_TIMEOUT);
|
||||
if (result < 0)
|
||||
{
|
||||
switch (result)
|
||||
{
|
||||
case -EIO:
|
||||
case -EPIPE:
|
||||
avrdude_message(MSG_NOTICE, "%s: Ignoring last error of erase command: %s\n", progname, usb_strerror());
|
||||
break;
|
||||
default:
|
||||
avrdude_message(MSG_INFO, "%s: WARNING: Failed is issue erase command, code %d: %s\n", progname, result, usb_strerror());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
delay_ms(pdata->erase_sleep);
|
||||
|
||||
result = micronucleus_check_connection(pdata);
|
||||
if (result < 0)
|
||||
{
|
||||
avrdude_message(MSG_NOTICE, "%s: Connection dropped, trying to reconnect...\n", progname);
|
||||
|
||||
result = micronucleus_reconnect(pdata);
|
||||
if (result < 0)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: WARNING: Failed to reconnect USB device: %s\n", progname, usb_strerror());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int micronucleus_patch_reset_vector(pdata_t* pdata, uint8_t* buffer)
|
||||
{
|
||||
// Save user reset vector.
|
||||
uint16_t word0 = (buffer[1] << 8) | buffer[0];
|
||||
uint16_t word1 = (buffer[3] << 8) | buffer[2];
|
||||
|
||||
if (word0 == 0x940C)
|
||||
{
|
||||
// long jump
|
||||
pdata->user_reset_vector = word1;
|
||||
}
|
||||
else if ((word0 & 0xF000) == 0xC000)
|
||||
{
|
||||
// rjmp
|
||||
pdata->user_reset_vector = (word0 & 0x0FFF) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: The reset vector of the user program does not contain a branch instruction.\n", progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Patch in jmp to bootloader.
|
||||
if (pdata->bootloader_start > 0x2000)
|
||||
{
|
||||
// jmp
|
||||
uint16_t data = 0x940C;
|
||||
buffer[0] = (uint8_t)(data >> 0);
|
||||
buffer[1] = (uint8_t)(data >> 8);
|
||||
buffer[2] = (uint8_t)(pdata->bootloader_start >> 0);
|
||||
buffer[3] = (uint8_t)(pdata->bootloader_start >> 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// rjmp
|
||||
uint16_t data = 0xC000 | ((pdata->bootloader_start / 2 - 1) & 0x0FFF);
|
||||
buffer[0] = (uint8_t)(data >> 0);
|
||||
buffer[1] = (uint8_t)(data >> 8);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void micronucleus_patch_user_vector(pdata_t* pdata, uint8_t* buffer)
|
||||
{
|
||||
uint16_t user_reset_addr = pdata->bootloader_start - 4;
|
||||
uint16_t address = pdata->bootloader_start - pdata->page_size;
|
||||
if (user_reset_addr > 0x2000)
|
||||
{
|
||||
// jmp
|
||||
uint16_t data = 0x940C;
|
||||
buffer[user_reset_addr - address + 0] = (uint8_t)(data >> 0);
|
||||
buffer[user_reset_addr - address + 1] = (uint8_t)(data >> 8);
|
||||
buffer[user_reset_addr - address + 2] = (uint8_t)(pdata->user_reset_vector >> 0);
|
||||
buffer[user_reset_addr - address + 3] = (uint8_t)(pdata->user_reset_vector >> 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
// rjmp
|
||||
uint16_t data = 0xC000 | ((pdata->user_reset_vector - user_reset_addr / 2 - 1) & 0x0FFF);
|
||||
buffer[user_reset_addr - address + 0] = (uint8_t)(data >> 0);
|
||||
buffer[user_reset_addr - address + 1] = (uint8_t)(data >> 8);
|
||||
}
|
||||
}
|
||||
|
||||
static int micronucleus_write_page_v1(pdata_t* pdata, uint32_t address, uint8_t* buffer, uint32_t size)
|
||||
{
|
||||
int result = usb_control_msg(
|
||||
pdata->usb_handle,
|
||||
USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
MICRONUCLEUS_CMD_TRANSFER,
|
||||
size, address,
|
||||
(char*)buffer, size,
|
||||
MICRONUCLEUS_DEFAULT_TIMEOUT);
|
||||
if (result < 0)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: Failed to transfer page: %s\n", progname, usb_strerror());
|
||||
return result;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int micronucleus_write_page_v2(pdata_t* pdata, uint32_t address, uint8_t* buffer, uint32_t size)
|
||||
{
|
||||
int result = usb_control_msg(
|
||||
pdata->usb_handle,
|
||||
USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
MICRONUCLEUS_CMD_TRANSFER,
|
||||
size, address,
|
||||
NULL, 0,
|
||||
MICRONUCLEUS_DEFAULT_TIMEOUT);
|
||||
if (result < 0)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: Failed to transfer page: %s\n", progname, usb_strerror());
|
||||
return result;
|
||||
}
|
||||
|
||||
for (int i = 0; i < size; i += 4)
|
||||
{
|
||||
int w1 = (buffer[i + 1] << 8) | (buffer[i + 0] << 0);
|
||||
int w2 = (buffer[i + 3] << 8) | (buffer[i + 2] << 0);
|
||||
result = usb_control_msg(
|
||||
pdata->usb_handle,
|
||||
USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
MICRONUCLEUS_CMD_PROGRAM,
|
||||
w1, w2,
|
||||
NULL, 0,
|
||||
MICRONUCLEUS_DEFAULT_TIMEOUT);
|
||||
if (result < 0)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: Failed to transfer page: %s\n", progname, usb_strerror());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int micronucleus_write_page(pdata_t* pdata, uint32_t address, uint8_t* buffer, uint32_t size)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_write_page(address=0x%04X, size=%d)\n", progname, address, size);
|
||||
|
||||
if (address == 0)
|
||||
{
|
||||
if (pdata->major_version >= 2)
|
||||
{
|
||||
int result = micronucleus_patch_reset_vector(pdata, buffer);
|
||||
if (result < 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// Require last page (with application reset vector) to be written.
|
||||
pdata->write_last_page = true;
|
||||
|
||||
// Require software start.
|
||||
pdata->start_program = true;
|
||||
}
|
||||
else if (address >= pdata->bootloader_start - pdata->page_size)
|
||||
{
|
||||
if (pdata->major_version >= 2)
|
||||
{
|
||||
micronucleus_patch_user_vector(pdata, buffer);
|
||||
}
|
||||
|
||||
// Mark last page as written.
|
||||
pdata->write_last_page = false;
|
||||
}
|
||||
|
||||
int result;
|
||||
if (pdata->major_version >= 2)
|
||||
{
|
||||
result = micronucleus_write_page_v2(pdata, address, buffer, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = micronucleus_write_page_v1(pdata, address, buffer, size);
|
||||
}
|
||||
|
||||
if (result < 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
delay_ms(pdata->write_sleep);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int micronucleus_start(pdata_t* pdata)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_start()\n", progname);
|
||||
|
||||
int result = usb_control_msg(
|
||||
pdata->usb_handle,
|
||||
USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
MICRONUCLEUS_CMD_START,
|
||||
0, 0,
|
||||
NULL, 0,
|
||||
MICRONUCLEUS_DEFAULT_TIMEOUT);
|
||||
if (result < 0)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: WARNING: Failed is issue start command: %s\n", progname, usb_strerror());
|
||||
return result;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void micronucleus_setup(PROGRAMMER* pgm)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_setup()\n", progname);
|
||||
|
||||
if ((pgm->cookie = malloc(sizeof(pdata_t))) == 0)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: micronucleus_setup(): Out of memory allocating private data\n", progname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
memset(pgm->cookie, 0, sizeof(pdata_t));
|
||||
}
|
||||
|
||||
static void micronucleus_teardown(PROGRAMMER* pgm)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_teardown()\n", progname);
|
||||
free(pgm->cookie);
|
||||
}
|
||||
|
||||
static int micronucleus_initialize(PROGRAMMER* pgm, AVRPART* p)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_initialize()\n", progname);
|
||||
|
||||
pdata_t* pdata = PDATA(pgm);
|
||||
|
||||
int result = micronucleus_get_bootloader_info(pdata);
|
||||
if (result < 0)
|
||||
return result;
|
||||
|
||||
micronucleus_dump_device_info(pdata);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void micronucleus_display(PROGRAMMER* pgm, const char* prefix)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_display()\n", progname);
|
||||
}
|
||||
|
||||
static void micronucleus_powerup(PROGRAMMER* pgm)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_powerup()\n", progname);
|
||||
}
|
||||
|
||||
static void micronucleus_powerdown(PROGRAMMER* pgm)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_powerdown()\n", progname);
|
||||
|
||||
pdata_t* pdata = PDATA(pgm);
|
||||
if (pdata->write_last_page)
|
||||
{
|
||||
pdata->write_last_page = false;
|
||||
|
||||
uint8_t* buffer = (unsigned char*)malloc(pdata->page_size);
|
||||
if (buffer != NULL)
|
||||
{
|
||||
memset(buffer, 0xFF, pdata->page_size);
|
||||
micronucleus_write_page(pdata, pdata->bootloader_start - pdata->page_size, buffer, pdata->page_size);
|
||||
free(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
if (pdata->start_program)
|
||||
{
|
||||
pdata->start_program = false;
|
||||
|
||||
micronucleus_start(pdata);
|
||||
}
|
||||
}
|
||||
|
||||
static void micronucleus_enable(PROGRAMMER* pgm)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_enable()\n", progname);
|
||||
}
|
||||
|
||||
static void micronucleus_disable(PROGRAMMER* pgm)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_disable()\n", progname);
|
||||
}
|
||||
|
||||
static int micronucleus_program_enable(PROGRAMMER* pgm, AVRPART* p)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_program_enable()\n", progname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int micronucleus_read_sig_bytes(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_read_sig_bytes()\n", progname);
|
||||
|
||||
if (mem->size < 3)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: memory size too small for read_sig_bytes", progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pdata_t* pdata = PDATA(pgm);
|
||||
mem->buf[0] = 0x1E;
|
||||
mem->buf[1] = pdata->signature1;
|
||||
mem->buf[2] = pdata->signature2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int micronucleus_chip_erase(PROGRAMMER* pgm, AVRPART* p)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_chip_erase()\n", progname);
|
||||
|
||||
pdata_t* pdata = PDATA(pgm);
|
||||
return micronucleus_erase_device(pdata);
|
||||
}
|
||||
|
||||
static int micronucleus_open(PROGRAMMER* pgm, char* port)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_open(\"%s\")\n", progname, port);
|
||||
|
||||
pdata_t* pdata = PDATA(pgm);
|
||||
char* bus_name = NULL;
|
||||
char* dev_name = NULL;
|
||||
|
||||
// if no -P was given or '-P usb' was given
|
||||
if (strcmp(port, "usb") == 0)
|
||||
{
|
||||
port = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// calculate bus and device names from -P option
|
||||
if (strncmp(port, "usb", 3) == 0 && ':' == port[3])
|
||||
{
|
||||
bus_name = port + 4;
|
||||
dev_name = strchr(bus_name, ':');
|
||||
if (dev_name != NULL)
|
||||
{
|
||||
*dev_name = '\0';
|
||||
dev_name++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (port != NULL && dev_name == NULL)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: ERROR: Invalid -P value: '%s'\n", progname, port);
|
||||
avrdude_message(MSG_INFO, "%sUse -P usb:bus:device\n", progbuf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Determine VID/PID
|
||||
int vid = pgm->usbvid ? pgm->usbvid : MICRONUCLEUS_VID;
|
||||
int pid = MICRONUCLEUS_PID;
|
||||
|
||||
LNODEID usbpid = lfirst(pgm->usbpid);
|
||||
if (usbpid != NULL)
|
||||
{
|
||||
pid = *(int*)(ldata(usbpid));
|
||||
if (lnext(usbpid))
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: WARNING: using PID 0x%04x, ignoring remaining PIDs in list\n",
|
||||
progname, pid);
|
||||
}
|
||||
}
|
||||
|
||||
usb_init();
|
||||
|
||||
bool show_retry_message = true;
|
||||
|
||||
time_t start_time = time(NULL);
|
||||
for (;;)
|
||||
{
|
||||
usb_find_busses();
|
||||
usb_find_devices();
|
||||
|
||||
pdata->usb_handle = NULL;
|
||||
|
||||
// Search for device
|
||||
struct usb_bus* bus = NULL;
|
||||
for (bus = usb_busses; bus != NULL && pdata->usb_handle == NULL; bus = bus->next)
|
||||
{
|
||||
struct usb_device* device = NULL;
|
||||
for (device = bus->devices; device != NULL && pdata->usb_handle == NULL; device = device->next)
|
||||
{
|
||||
if (device->descriptor.idVendor == vid && device->descriptor.idProduct == pid)
|
||||
{
|
||||
pdata->major_version = (uint8_t)(device->descriptor.bcdDevice >> 8);
|
||||
pdata->minor_version = (uint8_t)(device->descriptor.bcdDevice >> 0);
|
||||
|
||||
avrdude_message(MSG_NOTICE, "%s: Found device with Micronucleus V%d.%d, bus:device: %s:%s\n",
|
||||
progname,
|
||||
pdata->major_version, pdata->minor_version,
|
||||
bus->dirname, device->filename);
|
||||
|
||||
// if -P was given, match device by device name and bus name
|
||||
if (port != NULL)
|
||||
{
|
||||
if (dev_name == NULL || strcmp(bus->dirname, bus_name) || strcmp(device->filename, dev_name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (pdata->major_version > MICRONUCLEUS_MAX_MAJOR_VERSION)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: WARNING: device with unsupported version (V%d.%d) of Micronucleus detected.\n",
|
||||
progname,
|
||||
pdata->major_version, pdata->minor_version);
|
||||
continue;
|
||||
}
|
||||
|
||||
pdata->usb_handle = usb_open(device);
|
||||
if (pdata->usb_handle == NULL)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: ERROR: Failed to open USB device: %s\n", progname, usb_strerror());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pdata->usb_handle == NULL && pdata->wait_until_device_present)
|
||||
{
|
||||
if (show_retry_message)
|
||||
{
|
||||
if (pdata->wait_timout < 0)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: No device found, waiting for device to be plugged in...\n", progname);
|
||||
}
|
||||
else
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: No device found, waiting %d seconds for device to be plugged in...\n",
|
||||
progname,
|
||||
pdata->wait_timout);
|
||||
}
|
||||
|
||||
avrdude_message(MSG_INFO, "%s: Press CTRL-C to terminate.\n", progname);
|
||||
show_retry_message = false;
|
||||
}
|
||||
|
||||
if (pdata->wait_timout < 0 || (time(NULL) - start_time) < pdata->wait_timout)
|
||||
{
|
||||
delay_ms(MICRONUCLEUS_CONNECT_WAIT);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (!pdata->usb_handle)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: ERROR: Could not find device with Micronucleus bootloader (%04X:%04X)\n",
|
||||
progname, vid, pid);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void micronucleus_close(PROGRAMMER* pgm)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_close()\n", progname);
|
||||
|
||||
pdata_t* pdata = PDATA(pgm);
|
||||
if (pdata->usb_handle != NULL)
|
||||
{
|
||||
usb_close(pdata->usb_handle);
|
||||
pdata->usb_handle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static int micronucleus_read_byte(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem,
|
||||
unsigned long addr, unsigned char* value)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_read_byte(desc=%s, addr=0x%0X)\n",
|
||||
progname, mem->desc, addr);
|
||||
|
||||
if (strcmp(mem->desc, "lfuse") == 0 ||
|
||||
strcmp(mem->desc, "hfuse") == 0 ||
|
||||
strcmp(mem->desc, "efuse") == 0 ||
|
||||
strcmp(mem->desc, "lock") == 0)
|
||||
{
|
||||
*value = 0xFF;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: Unsupported memory type: %s\n", progname, mem->desc);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static int micronucleus_write_byte(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem,
|
||||
unsigned long addr, unsigned char value)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_write_byte(desc=%s, addr=0x%0X)\n",
|
||||
progname, mem->desc, addr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int micronucleus_paged_load(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem,
|
||||
unsigned int page_size,
|
||||
unsigned int addr, unsigned int n_bytes)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_paged_load(page_size=0x%X, addr=0x%X, n_bytes=0x%X)\n",
|
||||
progname, page_size, addr, n_bytes);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int micronucleus_paged_write(PROGRAMMER* pgm, AVRPART* p, AVRMEM* mem,
|
||||
unsigned int page_size,
|
||||
unsigned int addr, unsigned int n_bytes)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_paged_write(page_size=0x%X, addr=0x%X, n_bytes=0x%X)\n",
|
||||
progname, page_size, addr, n_bytes);
|
||||
|
||||
if (strcmp(mem->desc, "flash") == 0)
|
||||
{
|
||||
pdata_t* pdata = PDATA(pgm);
|
||||
|
||||
if (n_bytes > page_size)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: Buffer size (%u) exceeds page size (%u)\n", progname, n_bytes, page_size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (addr + n_bytes > pdata->flash_size)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: Program size (%u) exceeds flash size (%u)\n", progname, addr + n_bytes, pdata->flash_size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint8_t* page_buffer = (uint8_t*)malloc(pdata->page_size);
|
||||
if (page_buffer == NULL)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: Failed to allocate memory\n", progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Note: Page size reported by the bootloader may be smaller than device page size as configured in avrdude.conf.
|
||||
int result = 0;
|
||||
while (n_bytes > 0)
|
||||
{
|
||||
size_t chunk_size = n_bytes < pdata->page_size ? n_bytes : pdata->page_size;
|
||||
|
||||
memcpy(page_buffer, mem->buf + addr, chunk_size);
|
||||
memset(page_buffer + chunk_size, 0xFF, pdata->page_size - chunk_size);
|
||||
|
||||
result = micronucleus_write_page(pdata, addr, page_buffer, pdata->page_size);
|
||||
if (result < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
addr += chunk_size;
|
||||
n_bytes -= chunk_size;
|
||||
}
|
||||
|
||||
free(page_buffer);
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: Unsupported memory type: %s\n", progname, mem->desc);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static int micronucleus_parseextparams(PROGRAMMER* pgm, LISTID xparams)
|
||||
{
|
||||
avrdude_message(MSG_DEBUG, "%s: micronucleus_parseextparams()\n", progname);
|
||||
|
||||
pdata_t* pdata = PDATA(pgm);
|
||||
for (LNODEID node = lfirst(xparams); node != NULL; node = lnext(node))
|
||||
{
|
||||
const char* param = ldata(node);
|
||||
|
||||
if (strcmp(param, "wait") == 0)
|
||||
{
|
||||
pdata->wait_until_device_present = true;
|
||||
pdata->wait_timout = -1;
|
||||
}
|
||||
else if (strncmp(param, "wait=", 5) == 0)
|
||||
{
|
||||
pdata->wait_until_device_present = true;
|
||||
pdata->wait_timout = atoi(param + 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: Invalid extended parameter '%s'\n", progname, param);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void micronucleus_initpgm(PROGRAMMER* pgm)
|
||||
{
|
||||
strcpy(pgm->type, "Micronucleus V2.0");
|
||||
|
||||
pgm->setup = micronucleus_setup;
|
||||
pgm->teardown = micronucleus_teardown;
|
||||
pgm->initialize = micronucleus_initialize;
|
||||
pgm->display = micronucleus_display;
|
||||
pgm->powerup = micronucleus_powerup;
|
||||
pgm->powerdown = micronucleus_powerdown;
|
||||
pgm->enable = micronucleus_enable;
|
||||
pgm->disable = micronucleus_disable;
|
||||
pgm->program_enable = micronucleus_program_enable;
|
||||
pgm->read_sig_bytes = micronucleus_read_sig_bytes;
|
||||
pgm->chip_erase = micronucleus_chip_erase;
|
||||
pgm->cmd = NULL;
|
||||
pgm->open = micronucleus_open;
|
||||
pgm->close = micronucleus_close;
|
||||
pgm->read_byte = micronucleus_read_byte;
|
||||
pgm->write_byte = micronucleus_write_byte;
|
||||
pgm->paged_load = micronucleus_paged_load;
|
||||
pgm->paged_write = micronucleus_paged_write;
|
||||
pgm->parseextparams = micronucleus_parseextparams;
|
||||
}
|
||||
|
||||
#else /* !HAVE_LIBUSB */
|
||||
|
||||
// Give a proper error if we were not compiled with libusb
|
||||
static int micronucleus_nousb_open(struct programmer_t* pgm, char* name)
|
||||
{
|
||||
avrdude_message(MSG_INFO, "%s: error: No usb support. Please compile again with libusb installed.\n", progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void micronucleus_initpgm(PROGRAMMER* pgm)
|
||||
{
|
||||
strcpy(pgm->type, "micronucleus");
|
||||
pgm->open = micronucleus_nousb_open;
|
||||
}
|
||||
|
||||
#endif /* HAVE_LIBUSB */
|
||||
|
||||
const char micronucleus_desc[] = "Micronucleus Bootloader";
|
||||
35
src/micronucleus.h
Normal file
35
src/micronucleus.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2019 Marius Greuel
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef micronucleus_h
|
||||
#define micronucleus_h
|
||||
|
||||
#include "libavrdude.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const char micronucleus_desc[];
|
||||
void micronucleus_initpgm(PROGRAMMER* pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* micronucleus_h */
|
||||
563
src/msvc/getopt.c
Normal file
563
src/msvc/getopt.c
Normal file
@@ -0,0 +1,563 @@
|
||||
/* $OpenBSD: getopt_long.c,v 1.23 2007/10/31 12:34:57 chl Exp $ */
|
||||
/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Sponsored in part by the Defense Advanced Research Projects
|
||||
* Agency (DARPA) and Air Force Research Laboratory, Air Force
|
||||
* Materiel Command, USAF, under agreement number F39502-99-1-0512.
|
||||
*/
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Dieter Baron and Thomas Klausner.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define REPLACE_GETOPT /* use this getopt as the system getopt(3) */
|
||||
|
||||
#ifdef REPLACE_GETOPT
|
||||
int opterr = 1; /* if error message should be printed */
|
||||
int optind = 1; /* index into parent argv vector */
|
||||
int optopt = '?'; /* character checked for validity */
|
||||
#undef optreset /* see getopt.h */
|
||||
#define optreset __mingw_optreset
|
||||
int optreset; /* reset getopt */
|
||||
char *optarg; /* argument associated with option */
|
||||
#endif
|
||||
|
||||
#define PRINT_ERROR ((opterr) && (*options != ':'))
|
||||
|
||||
#define FLAG_PERMUTE 0x01 /* permute non-options to the end of argv */
|
||||
#define FLAG_ALLARGS 0x02 /* treat non-options as args to option "-1" */
|
||||
#define FLAG_LONGONLY 0x04 /* operate as getopt_long_only */
|
||||
|
||||
/* return values */
|
||||
#define BADCH (int)'?'
|
||||
#define BADARG ((*options == ':') ? (int)':' : (int)'?')
|
||||
#define INORDER (int)1
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
#define __progname __argv[0]
|
||||
#else
|
||||
extern char __declspec(dllimport) *__progname;
|
||||
#endif
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
static char EMSG[] = "";
|
||||
#else
|
||||
#define EMSG ""
|
||||
#endif
|
||||
|
||||
static int getopt_internal(int, char * const *, const char *,
|
||||
const struct option *, int *, int);
|
||||
static int parse_long_options(char * const *, const char *,
|
||||
const struct option *, int *, int);
|
||||
static int gcd(int, int);
|
||||
static void permute_args(int, int, int, char * const *);
|
||||
|
||||
static char *place = EMSG; /* option letter processing */
|
||||
|
||||
/* XXX: set optreset to 1 rather than these two */
|
||||
static int nonopt_start = -1; /* first non option argument (for permute) */
|
||||
static int nonopt_end = -1; /* first option after non options (for permute) */
|
||||
|
||||
/* Error messages */
|
||||
static const char recargchar[] = "option requires an argument -- %c";
|
||||
static const char recargstring[] = "option requires an argument -- %s";
|
||||
static const char ambig[] = "ambiguous option -- %.*s";
|
||||
static const char noarg[] = "option doesn't take an argument -- %.*s";
|
||||
static const char illoptchar[] = "unknown option -- %c";
|
||||
static const char illoptstring[] = "unknown option -- %s";
|
||||
|
||||
static void
|
||||
_vwarnx(const char *fmt,va_list ap)
|
||||
{
|
||||
(void)fprintf(stderr,"%s: ",__progname);
|
||||
if (fmt != NULL)
|
||||
(void)vfprintf(stderr,fmt,ap);
|
||||
(void)fprintf(stderr,"\n");
|
||||
}
|
||||
|
||||
static void
|
||||
warnx(const char *fmt,...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap,fmt);
|
||||
_vwarnx(fmt,ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the greatest common divisor of a and b.
|
||||
*/
|
||||
static int
|
||||
gcd(int a, int b)
|
||||
{
|
||||
int c;
|
||||
|
||||
c = a % b;
|
||||
while (c != 0) {
|
||||
a = b;
|
||||
b = c;
|
||||
c = a % b;
|
||||
}
|
||||
|
||||
return (b);
|
||||
}
|
||||
|
||||
/*
|
||||
* Exchange the block from nonopt_start to nonopt_end with the block
|
||||
* from nonopt_end to opt_end (keeping the same order of arguments
|
||||
* in each block).
|
||||
*/
|
||||
static void
|
||||
permute_args(int panonopt_start, int panonopt_end, int opt_end,
|
||||
char * const *nargv)
|
||||
{
|
||||
int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos;
|
||||
char *swap;
|
||||
|
||||
/*
|
||||
* compute lengths of blocks and number and size of cycles
|
||||
*/
|
||||
nnonopts = panonopt_end - panonopt_start;
|
||||
nopts = opt_end - panonopt_end;
|
||||
ncycle = gcd(nnonopts, nopts);
|
||||
cyclelen = (opt_end - panonopt_start) / ncycle;
|
||||
|
||||
for (i = 0; i < ncycle; i++) {
|
||||
cstart = panonopt_end+i;
|
||||
pos = cstart;
|
||||
for (j = 0; j < cyclelen; j++) {
|
||||
if (pos >= panonopt_end)
|
||||
pos -= nnonopts;
|
||||
else
|
||||
pos += nopts;
|
||||
swap = nargv[pos];
|
||||
/* LINTED const cast */
|
||||
((char **) nargv)[pos] = nargv[cstart];
|
||||
/* LINTED const cast */
|
||||
((char **)nargv)[cstart] = swap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* parse_long_options --
|
||||
* Parse long options in argc/argv argument vector.
|
||||
* Returns -1 if short_too is set and the option does not match long_options.
|
||||
*/
|
||||
static int
|
||||
parse_long_options(char * const *nargv, const char *options,
|
||||
const struct option *long_options, int *idx, int short_too)
|
||||
{
|
||||
char *current_argv, *has_equal;
|
||||
size_t current_argv_len;
|
||||
int i, ambiguous, match;
|
||||
|
||||
#define IDENTICAL_INTERPRETATION(_x, _y) \
|
||||
(long_options[(_x)].has_arg == long_options[(_y)].has_arg && \
|
||||
long_options[(_x)].flag == long_options[(_y)].flag && \
|
||||
long_options[(_x)].val == long_options[(_y)].val)
|
||||
|
||||
current_argv = place;
|
||||
match = -1;
|
||||
ambiguous = 0;
|
||||
|
||||
optind++;
|
||||
|
||||
if ((has_equal = strchr(current_argv, '=')) != NULL) {
|
||||
/* argument found (--option=arg) */
|
||||
current_argv_len = has_equal - current_argv;
|
||||
has_equal++;
|
||||
} else
|
||||
current_argv_len = strlen(current_argv);
|
||||
|
||||
for (i = 0; long_options[i].name; i++) {
|
||||
/* find matching long option */
|
||||
if (strncmp(current_argv, long_options[i].name,
|
||||
current_argv_len))
|
||||
continue;
|
||||
|
||||
if (strlen(long_options[i].name) == current_argv_len) {
|
||||
/* exact match */
|
||||
match = i;
|
||||
ambiguous = 0;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* If this is a known short option, don't allow
|
||||
* a partial match of a single character.
|
||||
*/
|
||||
if (short_too && current_argv_len == 1)
|
||||
continue;
|
||||
|
||||
if (match == -1) /* partial match */
|
||||
match = i;
|
||||
else if (!IDENTICAL_INTERPRETATION(i, match))
|
||||
ambiguous = 1;
|
||||
}
|
||||
if (ambiguous) {
|
||||
/* ambiguous abbreviation */
|
||||
if (PRINT_ERROR)
|
||||
warnx(ambig, (int)current_argv_len,
|
||||
current_argv);
|
||||
optopt = 0;
|
||||
return (BADCH);
|
||||
}
|
||||
if (match != -1) { /* option found */
|
||||
if (long_options[match].has_arg == no_argument
|
||||
&& has_equal) {
|
||||
if (PRINT_ERROR)
|
||||
warnx(noarg, (int)current_argv_len,
|
||||
current_argv);
|
||||
/*
|
||||
* XXX: GNU sets optopt to val regardless of flag
|
||||
*/
|
||||
if (long_options[match].flag == NULL)
|
||||
optopt = long_options[match].val;
|
||||
else
|
||||
optopt = 0;
|
||||
return (BADARG);
|
||||
}
|
||||
if (long_options[match].has_arg == required_argument ||
|
||||
long_options[match].has_arg == optional_argument) {
|
||||
if (has_equal)
|
||||
optarg = has_equal;
|
||||
else if (long_options[match].has_arg ==
|
||||
required_argument) {
|
||||
/*
|
||||
* optional argument doesn't use next nargv
|
||||
*/
|
||||
optarg = nargv[optind++];
|
||||
}
|
||||
}
|
||||
if ((long_options[match].has_arg == required_argument)
|
||||
&& (optarg == NULL)) {
|
||||
/*
|
||||
* Missing argument; leading ':' indicates no error
|
||||
* should be generated.
|
||||
*/
|
||||
if (PRINT_ERROR)
|
||||
warnx(recargstring,
|
||||
current_argv);
|
||||
/*
|
||||
* XXX: GNU sets optopt to val regardless of flag
|
||||
*/
|
||||
if (long_options[match].flag == NULL)
|
||||
optopt = long_options[match].val;
|
||||
else
|
||||
optopt = 0;
|
||||
--optind;
|
||||
return (BADARG);
|
||||
}
|
||||
} else { /* unknown option */
|
||||
if (short_too) {
|
||||
--optind;
|
||||
return (-1);
|
||||
}
|
||||
if (PRINT_ERROR)
|
||||
warnx(illoptstring, current_argv);
|
||||
optopt = 0;
|
||||
return (BADCH);
|
||||
}
|
||||
if (idx)
|
||||
*idx = match;
|
||||
if (long_options[match].flag) {
|
||||
*long_options[match].flag = long_options[match].val;
|
||||
return (0);
|
||||
} else
|
||||
return (long_options[match].val);
|
||||
#undef IDENTICAL_INTERPRETATION
|
||||
}
|
||||
|
||||
/*
|
||||
* getopt_internal --
|
||||
* Parse argc/argv argument vector. Called by user level routines.
|
||||
*/
|
||||
static int
|
||||
getopt_internal(int nargc, char * const *nargv, const char *options,
|
||||
const struct option *long_options, int *idx, int flags)
|
||||
{
|
||||
char *oli; /* option letter list index */
|
||||
int optchar, short_too;
|
||||
static int posixly_correct = -1;
|
||||
|
||||
if (options == NULL)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* XXX Some GNU programs (like cvs) set optind to 0 instead of
|
||||
* XXX using optreset. Work around this braindamage.
|
||||
*/
|
||||
if (optind == 0)
|
||||
optind = optreset = 1;
|
||||
|
||||
/*
|
||||
* Disable GNU extensions if POSIXLY_CORRECT is set or options
|
||||
* string begins with a '+'.
|
||||
*
|
||||
* CV, 2009-12-14: Check POSIXLY_CORRECT anew if optind == 0 or
|
||||
* optreset != 0 for GNU compatibility.
|
||||
*/
|
||||
if (posixly_correct == -1 || optreset != 0)
|
||||
posixly_correct = (getenv("POSIXLY_CORRECT") != NULL);
|
||||
if (*options == '-')
|
||||
flags |= FLAG_ALLARGS;
|
||||
else if (posixly_correct || *options == '+')
|
||||
flags &= ~FLAG_PERMUTE;
|
||||
if (*options == '+' || *options == '-')
|
||||
options++;
|
||||
|
||||
optarg = NULL;
|
||||
if (optreset)
|
||||
nonopt_start = nonopt_end = -1;
|
||||
start:
|
||||
if (optreset || !*place) { /* update scanning pointer */
|
||||
optreset = 0;
|
||||
if (optind >= nargc) { /* end of argument vector */
|
||||
place = EMSG;
|
||||
if (nonopt_end != -1) {
|
||||
/* do permutation, if we have to */
|
||||
permute_args(nonopt_start, nonopt_end,
|
||||
optind, nargv);
|
||||
optind -= nonopt_end - nonopt_start;
|
||||
}
|
||||
else if (nonopt_start != -1) {
|
||||
/*
|
||||
* If we skipped non-options, set optind
|
||||
* to the first of them.
|
||||
*/
|
||||
optind = nonopt_start;
|
||||
}
|
||||
nonopt_start = nonopt_end = -1;
|
||||
return (-1);
|
||||
}
|
||||
if (*(place = nargv[optind]) != '-' ||
|
||||
(place[1] == '\0' && strchr(options, '-') == NULL)) {
|
||||
place = EMSG; /* found non-option */
|
||||
if (flags & FLAG_ALLARGS) {
|
||||
/*
|
||||
* GNU extension:
|
||||
* return non-option as argument to option 1
|
||||
*/
|
||||
optarg = nargv[optind++];
|
||||
return (INORDER);
|
||||
}
|
||||
if (!(flags & FLAG_PERMUTE)) {
|
||||
/*
|
||||
* If no permutation wanted, stop parsing
|
||||
* at first non-option.
|
||||
*/
|
||||
return (-1);
|
||||
}
|
||||
/* do permutation */
|
||||
if (nonopt_start == -1)
|
||||
nonopt_start = optind;
|
||||
else if (nonopt_end != -1) {
|
||||
permute_args(nonopt_start, nonopt_end,
|
||||
optind, nargv);
|
||||
nonopt_start = optind -
|
||||
(nonopt_end - nonopt_start);
|
||||
nonopt_end = -1;
|
||||
}
|
||||
optind++;
|
||||
/* process next argument */
|
||||
goto start;
|
||||
}
|
||||
if (nonopt_start != -1 && nonopt_end == -1)
|
||||
nonopt_end = optind;
|
||||
|
||||
/*
|
||||
* If we have "-" do nothing, if "--" we are done.
|
||||
*/
|
||||
if (place[1] != '\0' && *++place == '-' && place[1] == '\0') {
|
||||
optind++;
|
||||
place = EMSG;
|
||||
/*
|
||||
* We found an option (--), so if we skipped
|
||||
* non-options, we have to permute.
|
||||
*/
|
||||
if (nonopt_end != -1) {
|
||||
permute_args(nonopt_start, nonopt_end,
|
||||
optind, nargv);
|
||||
optind -= nonopt_end - nonopt_start;
|
||||
}
|
||||
nonopt_start = nonopt_end = -1;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check long options if:
|
||||
* 1) we were passed some
|
||||
* 2) the arg is not just "-"
|
||||
* 3) either the arg starts with -- we are getopt_long_only()
|
||||
*/
|
||||
if (long_options != NULL && place != nargv[optind] &&
|
||||
(*place == '-' || (flags & FLAG_LONGONLY))) {
|
||||
short_too = 0;
|
||||
if (*place == '-')
|
||||
place++; /* --foo long option */
|
||||
else if (*place != ':' && strchr(options, *place) != NULL)
|
||||
short_too = 1; /* could be short option too */
|
||||
|
||||
optchar = parse_long_options(nargv, options, long_options,
|
||||
idx, short_too);
|
||||
if (optchar != -1) {
|
||||
place = EMSG;
|
||||
return (optchar);
|
||||
}
|
||||
}
|
||||
|
||||
if ((optchar = (int)*place++) == (int)':' ||
|
||||
(optchar == (int)'-' && *place != '\0') ||
|
||||
(oli = strchr(options, optchar)) == NULL) {
|
||||
/*
|
||||
* If the user specified "-" and '-' isn't listed in
|
||||
* options, return -1 (non-option) as per POSIX.
|
||||
* Otherwise, it is an unknown option character (or ':').
|
||||
*/
|
||||
if (optchar == (int)'-' && *place == '\0')
|
||||
return (-1);
|
||||
if (!*place)
|
||||
++optind;
|
||||
if (PRINT_ERROR)
|
||||
warnx(illoptchar, optchar);
|
||||
optopt = optchar;
|
||||
return (BADCH);
|
||||
}
|
||||
if (long_options != NULL && optchar == 'W' && oli[1] == ';') {
|
||||
/* -W long-option */
|
||||
if (*place) /* no space */
|
||||
/* NOTHING */;
|
||||
else if (++optind >= nargc) { /* no arg */
|
||||
place = EMSG;
|
||||
if (PRINT_ERROR)
|
||||
warnx(recargchar, optchar);
|
||||
optopt = optchar;
|
||||
return (BADARG);
|
||||
} else /* white space */
|
||||
place = nargv[optind];
|
||||
optchar = parse_long_options(nargv, options, long_options,
|
||||
idx, 0);
|
||||
place = EMSG;
|
||||
return (optchar);
|
||||
}
|
||||
if (*++oli != ':') { /* doesn't take argument */
|
||||
if (!*place)
|
||||
++optind;
|
||||
} else { /* takes (optional) argument */
|
||||
optarg = NULL;
|
||||
if (*place) /* no white space */
|
||||
optarg = place;
|
||||
else if (oli[1] != ':') { /* arg not optional */
|
||||
if (++optind >= nargc) { /* no arg */
|
||||
place = EMSG;
|
||||
if (PRINT_ERROR)
|
||||
warnx(recargchar, optchar);
|
||||
optopt = optchar;
|
||||
return (BADARG);
|
||||
} else
|
||||
optarg = nargv[optind];
|
||||
}
|
||||
place = EMSG;
|
||||
++optind;
|
||||
}
|
||||
/* dump back option letter */
|
||||
return (optchar);
|
||||
}
|
||||
|
||||
#ifdef REPLACE_GETOPT
|
||||
/*
|
||||
* getopt --
|
||||
* Parse argc/argv argument vector.
|
||||
*
|
||||
* [eventually this will replace the BSD getopt]
|
||||
*/
|
||||
int
|
||||
getopt(int nargc, char * const *nargv, const char *options)
|
||||
{
|
||||
|
||||
/*
|
||||
* We don't pass FLAG_PERMUTE to getopt_internal() since
|
||||
* the BSD getopt(3) (unlike GNU) has never done this.
|
||||
*
|
||||
* Furthermore, since many privileged programs call getopt()
|
||||
* before dropping privileges it makes sense to keep things
|
||||
* as simple (and bug-free) as possible.
|
||||
*/
|
||||
return (getopt_internal(nargc, nargv, options, NULL, NULL, 0));
|
||||
}
|
||||
#endif /* REPLACE_GETOPT */
|
||||
|
||||
/*
|
||||
* getopt_long --
|
||||
* Parse argc/argv argument vector.
|
||||
*/
|
||||
int
|
||||
getopt_long(int nargc, char * const *nargv, const char *options,
|
||||
const struct option *long_options, int *idx)
|
||||
{
|
||||
|
||||
return (getopt_internal(nargc, nargv, options, long_options, idx,
|
||||
FLAG_PERMUTE));
|
||||
}
|
||||
|
||||
/*
|
||||
* getopt_long_only --
|
||||
* Parse argc/argv argument vector.
|
||||
*/
|
||||
int
|
||||
getopt_long_only(int nargc, char * const *nargv, const char *options,
|
||||
const struct option *long_options, int *idx)
|
||||
{
|
||||
|
||||
return (getopt_internal(nargc, nargv, options, long_options, idx,
|
||||
FLAG_PERMUTE|FLAG_LONGONLY));
|
||||
}
|
||||
95
src/msvc/getopt.h
Normal file
95
src/msvc/getopt.h
Normal file
@@ -0,0 +1,95 @@
|
||||
#ifndef __GETOPT_H__
|
||||
/**
|
||||
* DISCLAIMER
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the mingw-w64 runtime package.
|
||||
*
|
||||
* The mingw-w64 runtime package and its code is distributed in the hope that it
|
||||
* will be useful but WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESSED OR
|
||||
* IMPLIED ARE HEREBY DISCLAIMED. This includes but is not limited to
|
||||
* warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
#define __GETOPT_H__
|
||||
|
||||
/* All the headers include this file. */
|
||||
#include <crtdefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int optind; /* index of first non-option in argv */
|
||||
extern int optopt; /* single option character, as parsed */
|
||||
extern int opterr; /* flag to enable built-in diagnostics... */
|
||||
/* (user may set to zero, to suppress) */
|
||||
|
||||
extern char *optarg; /* pointer to argument of current option */
|
||||
|
||||
extern int getopt(int nargc, char * const *nargv, const char *options);
|
||||
|
||||
#ifdef _BSD_SOURCE
|
||||
/*
|
||||
* BSD adds the non-standard `optreset' feature, for reinitialisation
|
||||
* of `getopt' parsing. We support this feature, for applications which
|
||||
* proclaim their BSD heritage, before including this header; however,
|
||||
* to maintain portability, developers are advised to avoid it.
|
||||
*/
|
||||
# define optreset __mingw_optreset
|
||||
extern int optreset;
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* POSIX requires the `getopt' API to be specified in `unistd.h';
|
||||
* thus, `unistd.h' includes this header. However, we do not want
|
||||
* to expose the `getopt_long' or `getopt_long_only' APIs, when
|
||||
* included in this manner. Thus, close the standard __GETOPT_H__
|
||||
* declarations block, and open an additional __GETOPT_LONG_H__
|
||||
* specific block, only when *not* __UNISTD_H_SOURCED__, in which
|
||||
* to declare the extended API.
|
||||
*/
|
||||
#endif /* !defined(__GETOPT_H__) */
|
||||
|
||||
#if !defined(__UNISTD_H_SOURCED__) && !defined(__GETOPT_LONG_H__)
|
||||
#define __GETOPT_LONG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct option /* specification for a long form option... */
|
||||
{
|
||||
const char *name; /* option name, without leading hyphens */
|
||||
int has_arg; /* does it take an argument? */
|
||||
int *flag; /* where to save its status, or NULL */
|
||||
int val; /* its associated status value */
|
||||
};
|
||||
|
||||
enum /* permitted values for its `has_arg' field... */
|
||||
{
|
||||
no_argument = 0, /* option never takes an argument */
|
||||
required_argument, /* option always requires an argument */
|
||||
optional_argument /* option may take an argument */
|
||||
};
|
||||
|
||||
extern int getopt_long(int nargc, char * const *nargv, const char *options,
|
||||
const struct option *long_options, int *idx);
|
||||
extern int getopt_long_only(int nargc, char * const *nargv, const char *options,
|
||||
const struct option *long_options, int *idx);
|
||||
/*
|
||||
* Previous MinGW implementation had...
|
||||
*/
|
||||
#ifndef HAVE_DECL_GETOPT
|
||||
/*
|
||||
* ...for the long form API only; keep this for compatibility.
|
||||
*/
|
||||
# define HAVE_DECL_GETOPT 1
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !defined(__UNISTD_H_SOURCED__) && !defined(__GETOPT_LONG_H__) */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user