mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-15 02:01:07 +00:00
Compare commits
479 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b828d3cb7 | ||
|
|
722f33f68e | ||
|
|
b4707cebde | ||
|
|
5c82307586 | ||
|
|
47911f8cc7 | ||
|
|
8f6c6fc28f | ||
|
|
eb3660e618 | ||
|
|
2f1a8a45cd | ||
|
|
0094ab73d1 | ||
|
|
2b08f873f8 | ||
|
|
0ce272c9ae | ||
|
|
73cff9708a | ||
|
|
307258a0e6 | ||
|
|
33c5f3798a | ||
|
|
4b5ecec817 | ||
|
|
4d6574dc51 | ||
|
|
96b5dc8ca8 | ||
|
|
a851c91afe | ||
|
|
d2a9e1da31 | ||
|
|
bf7e5f7a63 | ||
|
|
9985e91387 | ||
|
|
9de394d847 | ||
|
|
99bfbc353e | ||
|
|
a7019a277c | ||
|
|
80cec375d5 | ||
|
|
11512d89be | ||
|
|
5675681c4d | ||
|
|
e1165d38d6 | ||
|
|
0396362f6e | ||
|
|
6cb80eb3e9 | ||
|
|
4628444db3 | ||
|
|
3869f4a0b2 | ||
|
|
dd2f68190a | ||
|
|
f52f5e97ec | ||
|
|
b6c29bb9f2 | ||
|
|
9132f02a72 | ||
|
|
98fa26cc1b | ||
|
|
e80cc3c767 | ||
|
|
ded0d45ee5 | ||
|
|
46399cbecf | ||
|
|
f2a859946a | ||
|
|
2b73747187 | ||
|
|
e1337cde63 | ||
|
|
e242f4acc1 | ||
|
|
951ee532fd | ||
|
|
ae18160bc1 | ||
|
|
1e42dde472 | ||
|
|
80dcdfc9ea | ||
|
|
95cace0939 | ||
|
|
d6c362d31c | ||
|
|
33ac0622fa | ||
|
|
f747521b39 | ||
|
|
3ec648749d | ||
|
|
c5f714342b | ||
|
|
b47607549e | ||
|
|
858a800f5d | ||
|
|
a8117f20d5 | ||
|
|
10caeca025 | ||
|
|
da9c2fe1c8 | ||
|
|
021240ac3c | ||
|
|
efbf84950e | ||
|
|
1569cd8b8d | ||
|
|
f2bcdc87b8 | ||
|
|
58dd75556f | ||
|
|
b9a400a34c | ||
|
|
f11db218a7 | ||
|
|
d201c4d11a | ||
|
|
9ae148ffbe | ||
|
|
065d688a8f | ||
|
|
19880def06 | ||
|
|
724f44c234 | ||
|
|
9e81c10f08 | ||
|
|
62ee4ec3c5 | ||
|
|
5e06d73fc2 | ||
|
|
272e78ac00 | ||
|
|
2f6ad9c3ed | ||
|
|
716fbbfe17 | ||
|
|
2ef3c19545 | ||
|
|
ca81aeb139 | ||
|
|
548e8bef49 | ||
|
|
5729bdf698 | ||
|
|
21a122a8f6 | ||
|
|
bb0092eb4e | ||
|
|
e72e92f027 | ||
|
|
1d29bd71df | ||
|
|
171be6ed47 | ||
|
|
1885f8ba84 | ||
|
|
068c6ca9cc | ||
|
|
ce473c01d9 | ||
|
|
6742e48d32 | ||
|
|
cc12312b2c | ||
|
|
1341a16432 | ||
|
|
f31f050de2 | ||
|
|
91c6cdfdea | ||
|
|
848cf9b55d | ||
|
|
a211b17abb | ||
|
|
da998cb635 | ||
|
|
33e9b840bf | ||
|
|
b1a5eaf2a0 | ||
|
|
6cb94ba5a2 | ||
|
|
d4439e4d43 | ||
|
|
fe9e329013 | ||
|
|
ff31f7f44f | ||
|
|
ed8e97475e | ||
|
|
1b9eed0f8e | ||
|
|
51cf44ff12 | ||
|
|
f177b994be | ||
|
|
9dbdbf5129 | ||
|
|
852428d8d6 | ||
|
|
d4102781ae | ||
|
|
4479ea8858 | ||
|
|
a34237dce3 | ||
|
|
b8ba817c68 | ||
|
|
6f84a29bd7 | ||
|
|
b5ed550b9d | ||
|
|
7d60f59b1e | ||
|
|
baa8f5a000 | ||
|
|
7ba3e6a3d7 | ||
|
|
0764958d0f | ||
|
|
179fc32c03 | ||
|
|
01800f7394 | ||
|
|
bf6fb8c947 | ||
|
|
f383f714e6 | ||
|
|
d7930063cc | ||
|
|
2b407ef73d | ||
|
|
6b815d76c3 | ||
|
|
b3ff415b9e | ||
|
|
63989b1d3c | ||
|
|
89b44856be | ||
|
|
30ef6e5c95 | ||
|
|
ed9ae0b503 | ||
|
|
5d2fc235cc | ||
|
|
3bb345359a | ||
|
|
6c95ae96b7 | ||
|
|
9924b5c06e | ||
|
|
39ac451895 | ||
|
|
4b6b934c91 | ||
|
|
fe204c55b8 | ||
|
|
498981c109 | ||
|
|
e2c61ee7b0 | ||
|
|
4f362e6424 | ||
|
|
14ba5b7666 | ||
|
|
0cb3966136 | ||
|
|
f3e5e5b8d5 | ||
|
|
5aaecc6ae7 | ||
|
|
23326f0ebe | ||
|
|
a206c7c2df | ||
|
|
f9a24c3427 | ||
|
|
0440263ceb | ||
|
|
6d200b83e1 | ||
|
|
5a4c46b6a8 | ||
|
|
688b628018 | ||
|
|
b93c0c0c13 | ||
|
|
1a427f265c | ||
|
|
61c41f321d | ||
|
|
1e9003943e | ||
|
|
2616b4663d | ||
|
|
1ee3bad56f | ||
|
|
258caa132f | ||
|
|
bc4a31e7c3 | ||
|
|
229c4d9237 | ||
|
|
c215c7c574 | ||
|
|
3d7d68054f | ||
|
|
39cdc50871 | ||
|
|
841f1bdac6 | ||
|
|
f9c8307273 | ||
|
|
7bf57779e0 | ||
|
|
566adf1e2d | ||
|
|
9b5a44e190 | ||
|
|
a5af43ae76 | ||
|
|
55ce7983fa | ||
|
|
6f5273657a | ||
|
|
b30793d6fa | ||
|
|
71e9429f1a | ||
|
|
2caa743379 | ||
|
|
3ff232b966 | ||
|
|
4c71539cf1 | ||
|
|
f639ccc9a6 | ||
|
|
37e0f0e0b1 | ||
|
|
3cfb8bf6e6 | ||
|
|
576c41605c | ||
|
|
6e88b88505 | ||
|
|
1a97b41cb8 | ||
|
|
6dc51ef1be | ||
|
|
2e0129c1f1 | ||
|
|
8304b149a3 | ||
|
|
ab116c9ef7 | ||
|
|
9f8d07859b | ||
|
|
01c8dddad6 | ||
|
|
78caacd7cc | ||
|
|
c535035a57 | ||
|
|
08365693b8 | ||
|
|
25433c4f08 | ||
|
|
6ebc317942 | ||
|
|
90fae5f375 | ||
|
|
793591c158 | ||
|
|
a3ac01c572 | ||
|
|
86c30c0cf0 | ||
|
|
381ea18b08 | ||
|
|
b403105824 | ||
|
|
af991085ca | ||
|
|
459aa147e7 | ||
|
|
fe7be6301e | ||
|
|
710b9350d0 | ||
|
|
33a0f421cf | ||
|
|
c6518e2a1c | ||
|
|
13184383f9 | ||
|
|
3991a4a0fc | ||
|
|
df96c25878 | ||
|
|
e816040c22 | ||
|
|
f6b14731cd | ||
|
|
041c91a43f | ||
|
|
144b52a851 | ||
|
|
f7c2ed3eba | ||
|
|
eb5e7aa5d7 | ||
|
|
574cd4a831 | ||
|
|
3a1754ce5b | ||
|
|
53e4a02350 | ||
|
|
182dc7ada7 | ||
|
|
f83447928d | ||
|
|
a84a97cadf | ||
|
|
bbdee28f6c | ||
|
|
3b5ff04973 | ||
|
|
74f8658ea2 | ||
|
|
67bae11bad | ||
|
|
011d62b582 | ||
|
|
5b274cb151 | ||
|
|
c66c0fa7ac | ||
|
|
a5dd4a5423 | ||
|
|
22d69998a0 | ||
|
|
f92773d5ab | ||
|
|
b5c719e95d | ||
|
|
444e0826b6 | ||
|
|
1ba16f6ee3 | ||
|
|
e6e87970f2 | ||
|
|
dc59e1711b | ||
|
|
dc8ea09d9b | ||
|
|
613e3804fe | ||
|
|
093f999f4d | ||
|
|
11f50aeb06 | ||
|
|
c1b55a9512 | ||
|
|
1461178b63 | ||
|
|
e9ff975620 | ||
|
|
9afb392045 | ||
|
|
61e52e318d | ||
|
|
d8d8f858e9 | ||
|
|
36a2d84468 | ||
|
|
42351c5df2 | ||
|
|
776417c112 | ||
|
|
b46da172b8 | ||
|
|
50c0adfd52 | ||
|
|
aa551534e3 | ||
|
|
dd21a09ea8 | ||
|
|
8e9f50a9d0 | ||
|
|
4b59038b1e | ||
|
|
a3fc883cde | ||
|
|
a636dd2212 | ||
|
|
5493db89d2 | ||
|
|
73a8d9bffc | ||
|
|
e5ad8f6208 | ||
|
|
fbef8e0d29 | ||
|
|
0ae7a61335 | ||
|
|
c02e25c2cc | ||
|
|
8595de951e | ||
|
|
7ec4b042ef | ||
|
|
13dc823b74 | ||
|
|
e6cd7c3deb | ||
|
|
b5509dc7ce | ||
|
|
54ef965da4 | ||
|
|
50ac9887e9 | ||
|
|
23228c6c52 | ||
|
|
933398d603 | ||
|
|
b097878aaa | ||
|
|
7782b9cd10 | ||
|
|
954c493d79 | ||
|
|
d6d4b561d3 | ||
|
|
2398bc214b | ||
|
|
ede2a09a19 | ||
|
|
caf56a11b1 | ||
|
|
b397a32005 | ||
|
|
232831e0c2 | ||
|
|
6ba5db3959 | ||
|
|
cf0d169f92 | ||
|
|
c00ff220d8 | ||
|
|
809d69ac1f | ||
|
|
be92fd4c06 | ||
|
|
397215523c | ||
|
|
a673818068 | ||
|
|
06f4076fcf | ||
|
|
5f1421e8d6 | ||
|
|
0090f71c3e | ||
|
|
123e343cf8 | ||
|
|
a9238e9730 | ||
|
|
3796c529f4 | ||
|
|
7af6da70fb | ||
|
|
74982042c5 | ||
|
|
026be0b3de | ||
|
|
647aa95c9e | ||
|
|
e7741311a8 | ||
|
|
bd9e65dd73 | ||
|
|
dab2db1b6f | ||
|
|
74592918c9 | ||
|
|
9fa1a454be | ||
|
|
c3a798ea24 | ||
|
|
5ae90cdd25 | ||
|
|
ec7b0c03a1 | ||
|
|
f2c00658a7 | ||
|
|
dac678cdcc | ||
|
|
c18c796ecf | ||
|
|
bcd482810d | ||
|
|
485ac8ed6e | ||
|
|
03aaf5cfa9 | ||
|
|
53fcfef7ef | ||
|
|
3df5f307d7 | ||
|
|
2763e194d7 | ||
|
|
230f3af622 | ||
|
|
27cac22b84 | ||
|
|
b9a5e05f9c | ||
|
|
130e71072e | ||
|
|
617d99c13e | ||
|
|
06fe35484e | ||
|
|
53fe2be4a3 | ||
|
|
d23e035b3b | ||
|
|
a7e45fd3d3 | ||
|
|
b9041f1adc | ||
|
|
02a229b5f7 | ||
|
|
a195465d97 | ||
|
|
d4fd2a74aa | ||
|
|
b8562e7eed | ||
|
|
ce87897cb3 | ||
|
|
10bf04f706 | ||
|
|
872dd6199a | ||
|
|
828253ff93 | ||
|
|
fd0d2665d4 | ||
|
|
0494fa205f | ||
|
|
f9762375e4 | ||
|
|
2107a74340 | ||
|
|
8902e9d1a4 | ||
|
|
c5058da936 | ||
|
|
ff60d53522 | ||
|
|
f514ad8fbc | ||
|
|
edfd29d7b6 | ||
|
|
485250220c | ||
|
|
373c213418 | ||
|
|
038d28ac29 | ||
|
|
5ccdb8b905 | ||
|
|
10db97bb35 | ||
|
|
1e6c7b0a5e | ||
|
|
498d92d028 | ||
|
|
e7543c2250 | ||
|
|
d148f4c43e | ||
|
|
3476594946 | ||
|
|
1da61f080e | ||
|
|
89bf8e2652 | ||
|
|
ce27505c0d | ||
|
|
9bf4f335cf | ||
|
|
390c092c34 | ||
|
|
6ef18c4e99 | ||
|
|
3aaa04fc59 | ||
|
|
43f3df912a | ||
|
|
0f5f52462a | ||
|
|
33f8d0416f | ||
|
|
c2d47a3578 | ||
|
|
8078b48cdc | ||
|
|
c2744d7778 | ||
|
|
d2d5e188fa | ||
|
|
1be0b7c2b8 | ||
|
|
eb5dccdbca | ||
|
|
b6149364f0 | ||
|
|
ebeadb58de | ||
|
|
fc96149548 | ||
|
|
66be0a7f95 | ||
|
|
4fedef1192 | ||
|
|
d61d603d6a | ||
|
|
0b2e9ebdd8 | ||
|
|
7c4dc335ca | ||
|
|
e6928c77cf | ||
|
|
99a626821f | ||
|
|
226a267011 | ||
|
|
4246ec4455 | ||
|
|
d52d262ec1 | ||
|
|
daee7db4ca | ||
|
|
17db533dfc | ||
|
|
d5a1a058d0 | ||
|
|
a5cd46d616 | ||
|
|
edd01c0fda | ||
|
|
d2eff2b99d | ||
|
|
a1a6149f64 | ||
|
|
490ae0bb19 | ||
|
|
7b6b425b75 | ||
|
|
40e33e39b2 | ||
|
|
1348900d7c | ||
|
|
606aa2d4fd | ||
|
|
493113907c | ||
|
|
7021e5022b | ||
|
|
be7642861a | ||
|
|
d8013732ed | ||
|
|
9330d9000e | ||
|
|
85ab99b2ea | ||
|
|
6fdd7e2ad0 | ||
|
|
f663500996 | ||
|
|
a17e93fc2d | ||
|
|
141a19049a | ||
|
|
9161daeaa1 | ||
|
|
91f6cc9ac2 | ||
|
|
1c55f53261 | ||
|
|
5290713bb9 | ||
|
|
09df6aa664 | ||
|
|
4f075ae3b3 | ||
|
|
90943bf2bb | ||
|
|
e293f2b5a2 | ||
|
|
acf6f3060b | ||
|
|
795b5ded83 | ||
|
|
a21d1f3ceb | ||
|
|
c5ec274a19 | ||
|
|
a824d108c6 | ||
|
|
a76d845880 | ||
|
|
27072552fa | ||
|
|
d32338b5ba | ||
|
|
efc97346a2 | ||
|
|
71262c2d44 | ||
|
|
1d41442054 | ||
|
|
822d9bc3f2 | ||
|
|
9c9c479e37 | ||
|
|
d1c90c4ce2 | ||
|
|
f7e7ac43be | ||
|
|
98aa7dbb5a | ||
|
|
39ac828213 | ||
|
|
f913088cdb | ||
|
|
9fdeb5444d | ||
|
|
47660adc4b | ||
|
|
03d6bcda04 | ||
|
|
f1411fca7e | ||
|
|
abb56b44fb | ||
|
|
27ad2caa5b | ||
|
|
6bfb5f1f94 | ||
|
|
d70f6c343c | ||
|
|
e031a67542 | ||
|
|
cafa88eb9e | ||
|
|
889b1f3e48 | ||
|
|
f8f1e6486a | ||
|
|
d888b1bbb5 | ||
|
|
d230a46035 | ||
|
|
fae57bc0fa | ||
|
|
499b0bec72 | ||
|
|
40e63d4d1a | ||
|
|
8ae6321da2 | ||
|
|
130eda2439 | ||
|
|
0ee630eeca | ||
|
|
fb55e7e383 | ||
|
|
39902a7b7b | ||
|
|
5252991341 | ||
|
|
85cb696790 | ||
|
|
cc4caf1d92 | ||
|
|
d9ce7185a4 | ||
|
|
712282c81d | ||
|
|
853080dfeb | ||
|
|
e92c22e2a3 | ||
|
|
948534b2b6 | ||
|
|
89e53f2e3d | ||
|
|
fa07082d30 | ||
|
|
d3bb347e4f | ||
|
|
c8c9c6b087 | ||
|
|
30a3143cc3 | ||
|
|
2afd3d882e | ||
|
|
a566b4a888 | ||
|
|
9693e039cb | ||
|
|
7f188d48db | ||
|
|
477f1f1049 | ||
|
|
15d320cbfe | ||
|
|
83334a1794 | ||
|
|
122f2e8ec6 | ||
|
|
9858495500 | ||
|
|
007f4b378d | ||
|
|
f721cc0d53 | ||
|
|
ff700a8f1a | ||
|
|
4f47c560ac | ||
|
|
4f4497f94e | ||
|
|
e79a210517 |
@@ -12,6 +12,17 @@ Contributors:
|
||||
Theodore A. Roth <troth@openavr.org>
|
||||
Michael Holzt <kju-avr@fqdn.org>
|
||||
Colin O'Flynn <coflynn@newae.com>
|
||||
Thomas Fischl <tfischl@gmx.de>
|
||||
David Hoerl <dhoerl@mac.com>
|
||||
Michal Ludvig <mludvig@logix.net.nz>
|
||||
Darell Tan <darell.tan@gmail.com>
|
||||
Wolfgang Moser
|
||||
Ville Voipio
|
||||
Hannes Weisbach
|
||||
Doug Springer
|
||||
Brett Hagman <bhagman@roguerobotics.com>
|
||||
Rene Liebscher <r.liebscher@gmx.de>
|
||||
Jim Paris <jim@jtan.com>
|
||||
|
||||
For minor contributions, please see the ChangeLog files.
|
||||
|
||||
|
||||
13
avrdude/BUILD-FROM-SVN
Normal file
13
avrdude/BUILD-FROM-SVN
Normal file
@@ -0,0 +1,13 @@
|
||||
$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
|
||||
@@ -304,8 +304,7 @@ the "copyright" line and a pointer to where the full notice is found.
|
||||
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
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
@@ -1,236 +1,570 @@
|
||||
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* configure.ac (AC_INIT): Bump version, releasing avrdude-5.4.
|
||||
* configure.ac (AC_INIT): Bump version to 6.0.1.
|
||||
|
||||
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-17 Joerg Wunsch <j.gnu@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).
|
||||
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.
|
||||
|
||||
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-17 Joerg Wunsch <j.gnu@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
|
||||
* configure.ac (AC_INIT): Bump version to 6.0.
|
||||
|
||||
2007-05-15 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-17 Joerg Wunsch <j.gnu@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
|
||||
* 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.
|
||||
|
||||
2007-05-15 Colin O'Flynn <coflynn@newae.com>
|
||||
2013-09-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* 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
|
||||
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
|
||||
|
||||
2007-05-15 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-15 Joerg Wunsch <j.gnu@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.
|
||||
Submitted by Joakim Lubeck:
|
||||
bug #40033: Support for the XMegaE5 family
|
||||
* avrdude.conf.in (ATxmega8E5, ATxmega16E5, ATxmega32E5): New
|
||||
entries.
|
||||
|
||||
2007-05-15 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-13 Joerg Wunsch <j.gnu@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.
|
||||
* stk500v2.c (stk500v2_set_sck_period): Revamp this to match the
|
||||
description/pseudo-code in appnote AVR068.
|
||||
|
||||
2007-05-01 Colin O'Flynn <coflynn@newae.com>
|
||||
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* 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)
|
||||
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.
|
||||
|
||||
2007-05-01 Colin O'Flynn <coflynn@newae.com>
|
||||
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* safemode.c: Added verbose output from safemode routines.
|
||||
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.
|
||||
|
||||
2007-03-25 Colin O'Flynn <coflynn@newae.com>
|
||||
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* stk500generic.c: Forgot to close the serial port before trying to
|
||||
open it again, caused problems on Windows machines.
|
||||
Closes bug #19411
|
||||
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.)
|
||||
|
||||
2007-02-26 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in: Add the AT90PWM2/3B devices.
|
||||
Submitted by HubertB:
|
||||
patch #7657 Add ATmega406 support for avrdude using DRAGON + JTAG
|
||||
* avrdude.conf.in (ATmega406): New entry.
|
||||
|
||||
2007-02-02 Thomas Fischl <tfischl@gmx.de>
|
||||
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.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
|
||||
Submitted by Marc de Hoop:
|
||||
patch #7606 ATtiny43u support
|
||||
* avrdude.conf.in (ATtiny43U): New entry.
|
||||
|
||||
2007-02-01 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* config_gram.y: Remove duplicate definition of token K_WRITEPAGE
|
||||
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.
|
||||
|
||||
2007-01-30 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* butterfly.c: Implement ATmega256x support for butterfly/avr109.
|
||||
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
|
||||
|
||||
2007-01-30 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-13 Joerg Wunsch <j.gnu@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.
|
||||
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.
|
||||
|
||||
2007-01-30 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-13 Joerg Wunsch <j.gnu@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.)
|
||||
bug #34277: avrdude reads wrong byte order if using avr911 (aka butterfly)
|
||||
* butterfly.c (butterfly_read_byte_flash): Swap bytes received.
|
||||
|
||||
2007-01-29 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-12 Joerg Wunsch <j.gnu@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.)
|
||||
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.
|
||||
|
||||
2007-01-25 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-11 Joerg Wunsch <j.gnu@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.
|
||||
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.
|
||||
|
||||
2007-01-24 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-11 Joerg Wunsch <j.gnu@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.
|
||||
* 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.
|
||||
|
||||
2007-01-24 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-10 Joerg Wunsch <j.gnu@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.)
|
||||
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.
|
||||
|
||||
2007-01-13 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-09 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||
|
||||
* avrdude.conf.in (ATmega8): Bump the delay values for flash
|
||||
and EEPROM, based on the current Atmel XML file.
|
||||
* configure.ac: check for ar and ranlib in the target tool
|
||||
namespace, rather than on the host.
|
||||
|
||||
2007-01-12 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-08 Joerg Wunsch <j.gnu@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.
|
||||
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.
|
||||
|
||||
2007-01-11 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-08 Joerg Wunsch <j.gnu@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
|
||||
* term.c: Implement the "verbose" terminal mode command.
|
||||
* avrdude.1: Document this.
|
||||
* doc/avrdude.texi: (Dito.)
|
||||
|
||||
2007-01-07 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
2013-09-07 Joerg Wunsch <j.gnu@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.
|
||||
* 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
|
||||
|
||||
364
avrdude/ChangeLog-2007
Normal file
364
avrdude/ChangeLog-2007
Normal file
@@ -0,0 +1,364 @@
|
||||
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
avrdude/ChangeLog-2008
Normal file
185
avrdude/ChangeLog-2008
Normal file
@@ -0,0 +1,185 @@
|
||||
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
avrdude/ChangeLog-2009
Normal file
411
avrdude/ChangeLog-2009
Normal file
@@ -0,0 +1,411 @@
|
||||
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
avrdude/ChangeLog-2010
Normal file
354
avrdude/ChangeLog-2010
Normal file
@@ -0,0 +1,354 @@
|
||||
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
avrdude/ChangeLog-2011
Normal file
489
avrdude/ChangeLog-2011
Normal file
@@ -0,0 +1,489 @@
|
||||
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
avrdude/ChangeLog-2012
Normal file
729
avrdude/ChangeLog-2012
Normal file
@@ -0,0 +1,729 @@
|
||||
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.
|
||||
@@ -13,8 +13,7 @@
|
||||
# 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
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
#
|
||||
@@ -26,6 +25,13 @@ EXTRA_DIST = \
|
||||
ChangeLog-2001 \
|
||||
ChangeLog-2002 \
|
||||
ChangeLog-2003 \
|
||||
ChangeLog-2004-2006 \
|
||||
ChangeLog-2007 \
|
||||
ChangeLog-2008 \
|
||||
ChangeLog-2009 \
|
||||
ChangeLog-2010 \
|
||||
ChangeLog-2011 \
|
||||
ChangeLog-2012 \
|
||||
avrdude.1 \
|
||||
avrdude.spec \
|
||||
bootstrap
|
||||
@@ -35,10 +41,16 @@ CLEANFILES = \
|
||||
config_gram.h \
|
||||
lexer.c
|
||||
|
||||
BUILT_SOURCES = $(CLEANFILES)
|
||||
|
||||
#SUBDIRS = doc @WINDOWS_DIRS@
|
||||
#DIST_SUBDIRS = doc windows
|
||||
|
||||
SUBDIRS = @SUBDIRS_AC@
|
||||
# . 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
|
||||
@@ -51,7 +63,7 @@ avrdude_CFLAGS = @ENABLE_WARNINGS@
|
||||
|
||||
libavrdude_a_CFLAGS = @ENABLE_WARNINGS@
|
||||
|
||||
avrdude_LDADD = $(top_builddir)/$(noinst_LIBRARIES) @LIBUSB@ @LIBHID@
|
||||
avrdude_LDADD = $(top_builddir)/$(noinst_LIBRARIES) @LIBUSB_1_0@ @LIBUSB@ @LIBFTDI1@ @LIBFTDI@ @LIBHID@ @LIBELF@ @LIBPTHREAD@ -lm
|
||||
|
||||
bin_PROGRAMS = avrdude
|
||||
|
||||
@@ -75,15 +87,24 @@ dist-hook:
|
||||
libavrdude_a_SOURCES = \
|
||||
config_gram.y \
|
||||
lexer.l \
|
||||
arduino.h \
|
||||
arduino.c \
|
||||
avr.c \
|
||||
avr.h \
|
||||
avr910.c \
|
||||
avr910.h \
|
||||
avrdude.h \
|
||||
avrftdi.c \
|
||||
avrftdi.h \
|
||||
avrftdi_private.h \
|
||||
avrftdi_tpi.c \
|
||||
avrftdi_tpi.h \
|
||||
avrpart.c \
|
||||
avrpart.h \
|
||||
bitbang.c \
|
||||
bitbang.h \
|
||||
buspirate.c \
|
||||
buspirate.h \
|
||||
butterfly.c \
|
||||
butterfly.h \
|
||||
config.c \
|
||||
@@ -95,12 +116,19 @@ libavrdude_a_SOURCES = \
|
||||
fileio.c \
|
||||
fileio.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 \
|
||||
linuxgpio.c \
|
||||
linuxgpio.h \
|
||||
linux_ppdev.h \
|
||||
lists.c \
|
||||
lists.h \
|
||||
@@ -109,6 +137,11 @@ libavrdude_a_SOURCES = \
|
||||
par.h \
|
||||
pgm.c \
|
||||
pgm.h \
|
||||
pgm_type.c \
|
||||
pgm_type.h \
|
||||
pickit2.c \
|
||||
pickit2.h \
|
||||
pindefs.c \
|
||||
pindefs.h \
|
||||
ppi.c \
|
||||
ppi.h \
|
||||
@@ -131,17 +164,22 @@ libavrdude_a_SOURCES = \
|
||||
stk500v2_private.h \
|
||||
stk500generic.c \
|
||||
stk500generic.h \
|
||||
term.c \
|
||||
term.h \
|
||||
tpi.h \
|
||||
usbasp.c \
|
||||
usbasp.h \
|
||||
usbdevs.h \
|
||||
usb_libusb.c \
|
||||
usbtiny.h \
|
||||
usbtiny.c \
|
||||
update.h \
|
||||
update.c
|
||||
update.c \
|
||||
wiring.h \
|
||||
wiring.c
|
||||
|
||||
avrdude_SOURCES = \
|
||||
main.c
|
||||
main.c \
|
||||
term.c \
|
||||
term.h
|
||||
|
||||
man_MANS = avrdude.1
|
||||
|
||||
|
||||
338
avrdude/NEWS
338
avrdude/NEWS
@@ -5,6 +5,344 @@ Approximate change log for AVRDUDE by version.
|
||||
(For more detailed changes, see the ChangeLog file.)
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Version 6.0.1:
|
||||
|
||||
* Major changes compared to the previous version:
|
||||
|
||||
- Programmer types in configuration file are no longer keywords but
|
||||
specified as string.
|
||||
|
||||
So you need to change 'type = XYZ;' to 'type = "XYZ";' in own
|
||||
config files. (internal: The parser does not need to know all
|
||||
programmer types now, new programmers will update only the table
|
||||
in pgm_type.c.)
|
||||
|
||||
- The erase cycle counter (formerly options -y / -Y) has been
|
||||
removed.
|
||||
|
||||
- Specifying a -U option without a memory type (short form of
|
||||
option argument list) now defaults to "application" memory for
|
||||
Xmega devices, and "flash" for everything else. This ensures
|
||||
the Xmega bootloader is not accidentally touched.
|
||||
|
||||
- For programmers that support it, the default erase method is a
|
||||
page erase now, rather than a chip erase (Xmega only).
|
||||
|
||||
- Keep track of input file contents
|
||||
|
||||
Memory segments are being tracked to remember whether they've
|
||||
been actually read from a file. Only segments that came from a
|
||||
file are being programmed into the device, or considered for
|
||||
verification. This drastically improves handling speed for
|
||||
sparse files (e.g. files that have a second bootloader segment),
|
||||
and it ensures the device contents is actually compared for
|
||||
everything mentioned in the file (even in case the file has
|
||||
large 0xFF blocks).
|
||||
|
||||
- The -U option now accepts ELF files as input files, and extracts
|
||||
the appropriate section contents that matches the requested memory
|
||||
region. To enable this feature, the host system used for the
|
||||
compilation must have a libelf around, including the respective
|
||||
header files (i.e., package "libelf-devel" on many Linux systems).
|
||||
|
||||
- Programmers and parts lists
|
||||
|
||||
They are now sorted at output with '-c ?'/'-p ?'. (patch #7671:
|
||||
Sorting programmers and parts lists for console output)
|
||||
|
||||
Programmers and parts lists in documentation generated from lists
|
||||
mentioned above. (patch #7687: Autogenerating programmers and
|
||||
parts lists for docs)
|
||||
|
||||
Output list of programmer types with '-c ?type', add list to
|
||||
documentation
|
||||
|
||||
- Configuration files now accepts parent parts/programmers, parts
|
||||
starting with '.' (eg. .xmega) are not included in output parts
|
||||
list and can be used as abstract parents
|
||||
|
||||
(bug #34302: Feature request : device configuration with parent classes)
|
||||
(patch #7688: Implement parent programmers feature)
|
||||
|
||||
- Additional config files which are read after default can be
|
||||
specified on command line using '-C +filename'
|
||||
|
||||
(patch #7699 Read additional config files)
|
||||
|
||||
- "Safemode" can now be turned off by default from within a
|
||||
configuration file (like ~/.avrduderc).
|
||||
|
||||
- The new option -l logfile allows to redirect diagnostic messages
|
||||
to a logfile rather than stderr. Useful to record debugging
|
||||
traces, in particular in environments which do not offer
|
||||
shell-style redirection functionality for standard streams.
|
||||
|
||||
- When leaving debugWIRE mode, immediately retry with ISP rather
|
||||
than bailing out completely.
|
||||
|
||||
- The USBasp programmer implementation now supports detailed traces
|
||||
with -vvv, and device communication traces with -vvvv.
|
||||
|
||||
- The "verbose" terminal mode command allows to query or modify the
|
||||
verbosity level.
|
||||
|
||||
* New devices supported:
|
||||
- ATmega48P (patch #7629 add support for atmega48p)
|
||||
- AT90PWM316 (bug #21797: AT90PWM316: New part description)
|
||||
- ATxmega16D4, ATxmega32D4, ATxmega64D4, ATxmega128D4
|
||||
- ATmega256RFR2, ATmega128RFR2, ATmega64RFR2, ATmega2564RFR2,
|
||||
ATmega1284RFR2, ATmega644RFR2
|
||||
- ATtiny1634
|
||||
- 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
|
||||
- ATtiny43U
|
||||
- ATmega406
|
||||
- ATxmega8E5, ATxmega16E5, ATxmega32E5
|
||||
- ATtiny20, ATtiny40
|
||||
|
||||
|
||||
* New programmers supported:
|
||||
- linuxgpio
|
||||
+ any (embedded) Linux system with 4 GPIOs available can be used
|
||||
as a programmer with little or no additional hardware.
|
||||
|
||||
- avrftdi
|
||||
+ o-link (patch #7672 adding support for O-Link (FTDI based
|
||||
JTAG) as programmer)
|
||||
+ 4232h (patch #7715 FT4232H support)
|
||||
- TPI support
|
||||
+ openmoko (bug #37977 Support for Openmoko Debug Board)
|
||||
|
||||
- usbasp
|
||||
+ nibobee (previously specified as '-c usbasp -P nibobee)
|
||||
+ usbasp-clone (same as usbasp but ignores vendor and product
|
||||
string, checks only vid/pid)
|
||||
|
||||
- ftdi_syncbb (new type for synchronous bitbanging with ft232r/ft245r)
|
||||
+ ft245r (FT245R Synchronous BitBang, miso = D1, sck = D0, mosi
|
||||
= D2, reset = D4)
|
||||
+ ft232r (FT232R Synchronous BitBang, miso = RxD, sck = RTS,
|
||||
mosi = TxD, reset = DTR)
|
||||
+ bwmega (BitWizard ftdi_atmega builtin programmer, miso = DSR,
|
||||
sck = DCD, mosi = CTS, reset = RI)
|
||||
+ arduino-ft232r (Arduino: FT232R connected to ISP, miso = CTS
|
||||
X3(1), sck = DSR X3(2), mosi = DCD X3(3), reset = RI X3(4))
|
||||
+ diecimila (alias for arduino-ft232r)
|
||||
|
||||
- pickit2
|
||||
|
||||
- Atmel JTAGICE3
|
||||
|
||||
- buspirate_bb (TPI programming using the BusPirate in bitbang mode)
|
||||
|
||||
* Bugfixes
|
||||
- bug #34027: avrdude AT90S1200 Problem
|
||||
- bug #34518: loading intel hex files > 64k using record-type 4
|
||||
- patch #7667: Minor memory handling fixes
|
||||
- patch #7680: Fixing timeout problem in ser_recv in ser_win32.c
|
||||
- patch #7693: Fix config file atmel URLs (+ URLs in
|
||||
avrdude.texi and avrpart.h)
|
||||
- bug #21663: AT90PWM efuse incorrect, bug #30438: efuse bits
|
||||
written as 0 on at90pwmxx parts
|
||||
- bug #35261: avrftdi uses wrong interface in avrftdi_paged_(write|load)
|
||||
- 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
|
||||
- bug #34768 Proposition: Change the name of the AVR32 devices
|
||||
- patch #7718: Merge global data of avrftdi in a private data
|
||||
structure
|
||||
- bug #35208: avrdude 5.11 on freebsd 8.2-STABLE does not reset
|
||||
Arduino Uno properly
|
||||
- bug #34518: loading intel hex files > 64k using record-type 4
|
||||
(Extended Linear Address Record)
|
||||
- bug #34027: avrdude AT90S1200 Problem
|
||||
- bug #30451: Accessing some Xmega memory sections gives not
|
||||
supported error
|
||||
- bug #28744: Can't load bootloader to xmega128a1
|
||||
- bug #29019: pagel/bs2 warning when uploading using stk500 to xmega
|
||||
- bug #30756: When setting SUT to 64ms on XMEGA, avrdude doesn't
|
||||
read device signature
|
||||
- bug #37265: wrong page sizes for XMega64xx in avrdude.conf
|
||||
- bug #37942: Latest SVN can't program in dragon_jtag mode
|
||||
- patch #7876 JTAGICE mkII fails to connect to attiny if debugwire
|
||||
is enabled AND target has a very slow clock
|
||||
- bug #39893: Verification failure with AVRISPmkII and Xmega
|
||||
- bug #38713: Compilation of the documentation breaks with texinfo-5
|
||||
- bug #38023: avrdude doesn't return an error code when attempting
|
||||
to upload an invalid Intel HEX file
|
||||
- bug #39794: warnings when building avrdude 6.0rc1 under CentOS 6.4
|
||||
- bug #35800: Compilation error on certain systems if parport is disabled
|
||||
- bug #38307: Can't write usersig of an xmega256a3
|
||||
- bug #38580: Current svn head, xmega and fuses, all fuses tied to fuse0
|
||||
- bug #39691: Buffer overrun when reading EEPROM byte with JTAGICE3
|
||||
- bug #38951: AVR109 use byte offset instead of word offset
|
||||
- patch #7769: Write flash fails for AVR910 programmers
|
||||
- bug #38732: Support for ATtiny1634
|
||||
- bug #36901: flashing Atmega32U4 EEPROM produces garbage on chip
|
||||
- bug #28344: chip_erase_delay too short for ATmega324P, 644, 644P, and 1284P
|
||||
- bug #34277: avrdude reads wrong byte order if using avr911 (aka butterfly)
|
||||
- bug #35456: The progress bar for STK500V2 programmer is "wrong".
|
||||
- patch #5708: avrdude should make 10 synchronization attempts instead of just one
|
||||
- patch #7606: ATtiny43u support
|
||||
- patch #7657: Add ATmega406 support for avrdude using DRAGON + JTAG
|
||||
- bug #35474: Feature request: print fuse values in safemode output.
|
||||
- patch #7710: usb_libusb: Check VID/PID before opening device
|
||||
- [no-id]: Fix SCK period adjustment for STK500v2
|
||||
- bug #40040: Support for ATtiny20 and ATtiny40
|
||||
- bug #40055: AVRDUDE segfaults when writing eeprom
|
||||
|
||||
* Internals:
|
||||
|
||||
- Restructuring and compacting programmer definition part of
|
||||
grammar for config file.
|
||||
- Cleanup of parser code, removing unused definitions/
|
||||
functions. Using yylex_destroy if available.
|
||||
- Fixed some more memory leaks, added cleanup code at program exit
|
||||
(to minimize the number of non-freed memory blocks reported by
|
||||
valgrind)
|
||||
- Fixed some findings reported by cppcheck.
|
||||
|
||||
Version 5.11:
|
||||
|
||||
* New devices supported:
|
||||
- ATmega88P/168P
|
||||
- ATmega8U2/16U2/32U2
|
||||
- ATtiny4313
|
||||
|
||||
* New programmers supported:
|
||||
- TPI programming through bitbang programmers (both, serial
|
||||
and parallel ones)
|
||||
- FT2232 (and relatives) based programmers (MPSSE bitbang mode)
|
||||
- Wiring environment (http://wiring.org.co/)
|
||||
- butterfly-style bootloader of the Mikrokopter.de device
|
||||
|
||||
* Bugfixes
|
||||
|
||||
|
||||
Version 5.10:
|
||||
|
||||
* Bugfixes
|
||||
- bug #28660: Problem with loading intel hex rom files that exceed
|
||||
0x10000 bytes
|
||||
- see ChangeLog for further details
|
||||
|
||||
* New Features
|
||||
- (JTAG ICE / AVR Dragon) apply external reset if JTAG ID could
|
||||
not be read
|
||||
|
||||
Version 5.9:
|
||||
|
||||
* New devices supported:
|
||||
|
||||
- AVR32A0512 (JTAGMKII only)
|
||||
- ATmega32U4
|
||||
- ATtiny4
|
||||
- ATtiny5
|
||||
- ATtiny9
|
||||
- ATtiny10
|
||||
|
||||
* New programmers supported:
|
||||
|
||||
- BusPirate
|
||||
- Arduino
|
||||
- JTAGICEmkII and AVR Dragon in PDI mode (ATxmega devices)
|
||||
- STK600 and AVRISP mkII in TPI mode (ATtiny4/5/9/10)
|
||||
|
||||
* Bugfixes
|
||||
|
||||
- see ChangeLog and ChangeLog-2009 for details
|
||||
|
||||
Version 5.8:
|
||||
|
||||
* Bugfixes; most importantly, fix a serious memory corruption for
|
||||
that JTAG ICE mkII and AVR Dragon in ISP/HVSP/PP mode.
|
||||
|
||||
Version 5.7:
|
||||
|
||||
* New devices supported:
|
||||
|
||||
- ATXMEGA64A1
|
||||
- ATXMEGA192A1
|
||||
- ATXMEGA256A1
|
||||
- ATXMEGA64A3
|
||||
- ATXMEGA128A3
|
||||
- ATXMEGA192A3
|
||||
- ATXMEGA256A3
|
||||
- ATXMEGA256A3B
|
||||
- ATXMEGA16A4
|
||||
- ATXMEGA32A4
|
||||
- ATXMEGA64A4
|
||||
- ATXMEGA128A4
|
||||
|
||||
* Major Xmega fixes for the JTAG ICE mkII (patch #6825)
|
||||
|
||||
* Bugfixes.
|
||||
|
||||
Version 5.6:
|
||||
|
||||
* New devices supported:
|
||||
|
||||
- AT90USB82
|
||||
- AT90USB162
|
||||
- ATtiny88
|
||||
- ATmega328P
|
||||
- ATmega1284P
|
||||
- ATmega128RFA1
|
||||
- ATxmega128A1 rev D
|
||||
- ATxmega128A1
|
||||
- ATxmega256A3
|
||||
|
||||
* New programmers supported:
|
||||
|
||||
- AT89ISP cable (patch #6069)
|
||||
- Arduino
|
||||
|
||||
* Add support for the -x option to pass extended parameters to the
|
||||
programmer backend.
|
||||
|
||||
* Add support for JTAG daisy-chains, using the -x daisychain=
|
||||
option.
|
||||
|
||||
* Add support for the Atmel STK600 for "classic" AVRs (AT90, ATtiny,
|
||||
ATmega), using either ISP or high-voltage programming modes.
|
||||
|
||||
* Add support for the -x devcode extended parameter to the avr910
|
||||
programmer, to allow overriding the device code sent to the
|
||||
programmer.
|
||||
|
||||
* Add support for the Crossbow MIB510 programmer (patch #6074, #6542).
|
||||
|
||||
* Add support to bootstrap with GNU autoconf 2.61, and automake 1.10,
|
||||
respectively.
|
||||
|
||||
* Add support for ATxmega128A1 (including the revision D engineering
|
||||
samples) for STK600 and AVRISPmkII tools using PDI
|
||||
|
||||
* The option combination -tF now enters terminal mode even if the
|
||||
device initialization failed, so the user can modify programmer
|
||||
parameters (like Vtarget).
|
||||
|
||||
* Add preliminary support for ATxmega128A1 for the JTAG ICE mkII using
|
||||
JTAG.
|
||||
|
||||
* Add support for direct SPI transfers (bug #25156).
|
||||
|
||||
* Bugfixes.
|
||||
|
||||
Version 5.5:
|
||||
|
||||
* Add support for the USBtinyISP programmer (patch #6233)
|
||||
|
||||
* Add support for the C2N232I serial bitbang programmer (patch #6121)
|
||||
|
||||
* Bugfixes.
|
||||
|
||||
Version 5.4:
|
||||
|
||||
* New devices supported:
|
||||
|
||||
@@ -4,3 +4,43 @@ 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.)
|
||||
|
||||
133
avrdude/arduino.c
Normal file
133
avrdude/arduino.c
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2009 Lars Immisch
|
||||
*
|
||||
* 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$ */
|
||||
|
||||
/*
|
||||
* avrdude interface for Arduino programmer
|
||||
*
|
||||
* The Arduino programmer is mostly a STK500v1, just the signature bytes
|
||||
* are read differently.
|
||||
*/
|
||||
|
||||
#include "ac_cfg.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "pgm.h"
|
||||
#include "stk500_private.h"
|
||||
#include "stk500.h"
|
||||
#include "serial.h"
|
||||
#include "arduino.h"
|
||||
|
||||
/* read signature bytes - arduino version */
|
||||
static int arduino_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
|
||||
{
|
||||
unsigned char buf[32];
|
||||
|
||||
/* Signature byte reads are always 3 bytes. */
|
||||
|
||||
if (m->size < 3) {
|
||||
fprintf(stderr, "%s: memsize too small for sig byte read", progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
buf[0] = Cmnd_STK_READ_SIGN;
|
||||
buf[1] = Sync_CRC_EOP;
|
||||
|
||||
serial_send(&pgm->fd, buf, 2);
|
||||
|
||||
if (serial_recv(&pgm->fd, buf, 5) < 0)
|
||||
return -1;
|
||||
if (buf[0] == Resp_STK_NOSYNC) {
|
||||
fprintf(stderr, "%s: stk500_cmd(): programmer is out of sync\n",
|
||||
progname);
|
||||
return -1;
|
||||
} else if (buf[0] != Resp_STK_INSYNC) {
|
||||
fprintf(stderr,
|
||||
"\n%s: arduino_read_sig_bytes(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return -2;
|
||||
}
|
||||
if (buf[4] != Resp_STK_OK) {
|
||||
fprintf(stderr,
|
||||
"\n%s: arduino_read_sig_bytes(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_OK, buf[4]);
|
||||
return -3;
|
||||
}
|
||||
|
||||
m->buf[0] = buf[1];
|
||||
m->buf[1] = buf[2];
|
||||
m->buf[2] = buf[3];
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
static int arduino_open(PROGRAMMER * pgm, char * port)
|
||||
{
|
||||
strcpy(pgm->port, port);
|
||||
if (serial_open(port, pgm->baudrate? pgm->baudrate: 115200, &pgm->fd)==-1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Clear DTR and RTS to unload the RESET capacitor
|
||||
* (for example in Arduino) */
|
||||
serial_set_dtr_rts(&pgm->fd, 0);
|
||||
usleep(250*1000);
|
||||
/* Set DTR and RTS back to high */
|
||||
serial_set_dtr_rts(&pgm->fd, 1);
|
||||
usleep(50*1000);
|
||||
|
||||
/*
|
||||
* drain any extraneous input
|
||||
*/
|
||||
stk500_drain(pgm, 0);
|
||||
|
||||
if (stk500_getsync(pgm) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void arduino_close(PROGRAMMER * pgm)
|
||||
{
|
||||
serial_set_dtr_rts(&pgm->fd, 0);
|
||||
serial_close(&pgm->fd);
|
||||
pgm->fd.ifd = -1;
|
||||
}
|
||||
|
||||
const char arduino_desc[] = "Arduino programmer";
|
||||
|
||||
void arduino_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
/* This is mostly a STK500; just the signature is read
|
||||
differently than on real STK500v1
|
||||
and the DTR signal is set when opening the serial port
|
||||
for the Auto-Reset feature */
|
||||
stk500_initpgm(pgm);
|
||||
|
||||
strcpy(pgm->type, "Arduino");
|
||||
pgm->read_sig_bytes = arduino_read_sig_bytes;
|
||||
pgm->open = arduino_open;
|
||||
pgm->close = arduino_close;
|
||||
}
|
||||
29
avrdude/arduino.h
Normal file
29
avrdude/arduino.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2009 Lars Immisch
|
||||
*
|
||||
* 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$ */
|
||||
|
||||
#ifndef arduino_h__
|
||||
#define arduino_h__
|
||||
|
||||
extern const char arduino_desc[];
|
||||
void arduino_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
611
avrdude/avr.c
611
avrdude/avr.c
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2000-2004 Brian S. Dean <bsd@bsdhome.com>
|
||||
* Copyright (C) 2011 Darell Tan <darell.tan@gmail.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
|
||||
@@ -13,8 +14,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -36,17 +36,159 @@
|
||||
#include "ppi.h"
|
||||
#include "safemode.h"
|
||||
#include "update.h"
|
||||
#include "tpi.h"
|
||||
|
||||
FP_UpdateProgress update_progress;
|
||||
|
||||
#define DEBUG 0
|
||||
|
||||
/* TPI: returns 1 if NVM controller busy, 0 if free */
|
||||
int avr_tpi_poll_nvmbsy(PROGRAMMER *pgm)
|
||||
{
|
||||
unsigned char cmd;
|
||||
unsigned char res;
|
||||
|
||||
cmd = TPI_CMD_SIN | TPI_SIO_ADDR(TPI_IOREG_NVMCSR);
|
||||
(void)pgm->cmd_tpi(pgm, &cmd, 1, &res, 1);
|
||||
return (res & TPI_IOREG_NVMCSR_NVMBSY);
|
||||
}
|
||||
|
||||
/* TPI chip erase sequence */
|
||||
int avr_tpi_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
int err;
|
||||
AVRMEM *mem;
|
||||
|
||||
if (p->flags & AVRPART_HAS_TPI) {
|
||||
pgm->pgm_led(pgm, ON);
|
||||
|
||||
/* Set Pointer Register */
|
||||
mem = avr_locate_mem(p, "flash");
|
||||
if (mem == NULL) {
|
||||
fprintf(stderr, "No flash memory to erase for part %s\n",
|
||||
p->desc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
unsigned char cmd[] = {
|
||||
/* write pointer register high byte */
|
||||
(TPI_CMD_SSTPR | 0),
|
||||
((mem->offset & 0xFF) | 1),
|
||||
/* and low byte */
|
||||
(TPI_CMD_SSTPR | 1),
|
||||
((mem->offset >> 8) & 0xFF),
|
||||
/* write CHIP_ERASE command to NVMCMD register */
|
||||
(TPI_CMD_SOUT | TPI_SIO_ADDR(TPI_IOREG_NVMCMD)),
|
||||
TPI_NVMCMD_CHIP_ERASE,
|
||||
/* write dummy value to start erase */
|
||||
TPI_CMD_SST,
|
||||
0xFF
|
||||
};
|
||||
|
||||
while (avr_tpi_poll_nvmbsy(pgm));
|
||||
|
||||
err = pgm->cmd_tpi(pgm, cmd, sizeof(cmd), NULL, 0);
|
||||
if(err)
|
||||
return err;
|
||||
|
||||
while (avr_tpi_poll_nvmbsy(pgm));
|
||||
|
||||
pgm->pgm_led(pgm, OFF);
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
fprintf(stderr, "%s called for a part that has no TPI\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* TPI program enable sequence */
|
||||
int avr_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p, unsigned char guard_time)
|
||||
{
|
||||
int err, retry;
|
||||
unsigned char cmd[2];
|
||||
unsigned char response;
|
||||
|
||||
if(p->flags & AVRPART_HAS_TPI) {
|
||||
/* set guard time */
|
||||
cmd[0] = (TPI_CMD_SSTCS | TPI_REG_TPIPCR);
|
||||
cmd[1] = guard_time;
|
||||
|
||||
err = pgm->cmd_tpi(pgm, cmd, sizeof(cmd), NULL, 0);
|
||||
if(err)
|
||||
return err;
|
||||
|
||||
/* read TPI ident reg */
|
||||
cmd[0] = (TPI_CMD_SLDCS | TPI_REG_TPIIR);
|
||||
err = pgm->cmd_tpi(pgm, cmd, 1, &response, sizeof(response));
|
||||
if (err || response != TPI_IDENT_CODE) {
|
||||
fprintf(stderr, "TPIIR not correct\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* send SKEY command + SKEY */
|
||||
err = pgm->cmd_tpi(pgm, tpi_skey_cmd, sizeof(tpi_skey_cmd), NULL, 0);
|
||||
if(err)
|
||||
return err;
|
||||
|
||||
/* check if device is ready */
|
||||
for(retry = 0; retry < 10; retry++)
|
||||
{
|
||||
cmd[0] = (TPI_CMD_SLDCS | TPI_REG_TPISR);
|
||||
err = pgm->cmd_tpi(pgm, cmd, 1, &response, sizeof(response));
|
||||
if(err || !(response & TPI_REG_TPISR_NVMEN))
|
||||
continue;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Error enabling TPI external programming mode:");
|
||||
fprintf(stderr, "Target does not reply\n");
|
||||
return -1;
|
||||
|
||||
} else {
|
||||
fprintf(stderr, "%s called for a part that has no TPI\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* TPI: setup NVMCMD register and pointer register (PR) for read/write/erase */
|
||||
static int avr_tpi_setup_rw(PROGRAMMER * pgm, AVRMEM * mem,
|
||||
unsigned long addr, unsigned char nvmcmd)
|
||||
{
|
||||
unsigned char cmd[4];
|
||||
int rc;
|
||||
|
||||
/* set NVMCMD register */
|
||||
cmd[0] = TPI_CMD_SOUT | TPI_SIO_ADDR(TPI_IOREG_NVMCMD);
|
||||
cmd[1] = nvmcmd;
|
||||
rc = pgm->cmd_tpi(pgm, cmd, 2, NULL, 0);
|
||||
if (rc == -1)
|
||||
return -1;
|
||||
|
||||
/* set Pointer Register (PR) */
|
||||
cmd[0] = TPI_CMD_SSTPR | 0;
|
||||
cmd[1] = (mem->offset + addr) & 0xFF;
|
||||
rc = pgm->cmd_tpi(pgm, cmd, 2, NULL, 0);
|
||||
if (rc == -1)
|
||||
return -1;
|
||||
|
||||
cmd[0] = TPI_CMD_SSTPR | 1;
|
||||
cmd[1] = ((mem->offset + addr) >> 8) & 0xFF;
|
||||
rc = pgm->cmd_tpi(pgm, cmd, 2, NULL, 0);
|
||||
if (rc == -1)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
unsigned long addr, unsigned char * value)
|
||||
{
|
||||
unsigned char cmd[4];
|
||||
unsigned char res[4];
|
||||
unsigned char data;
|
||||
int r;
|
||||
OPCODE * readop, * lext;
|
||||
|
||||
if (pgm->cmd == NULL) {
|
||||
@@ -60,6 +202,27 @@ int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
pgm->pgm_led(pgm, ON);
|
||||
pgm->err_led(pgm, OFF);
|
||||
|
||||
if (p->flags & AVRPART_HAS_TPI) {
|
||||
if (pgm->cmd_tpi == NULL) {
|
||||
fprintf(stderr, "%s: Error: %s programmer does not support TPI\n",
|
||||
progname, pgm->type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (avr_tpi_poll_nvmbsy(pgm));
|
||||
|
||||
/* setup for read */
|
||||
avr_tpi_setup_rw(pgm, mem, addr, TPI_NVMCMD_NO_OPERATION);
|
||||
|
||||
/* load byte */
|
||||
cmd[0] = TPI_CMD_SLD;
|
||||
r = pgm->cmd_tpi(pgm, cmd, 1, value, 1);
|
||||
if (r == -1)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* figure out what opcode to use
|
||||
*/
|
||||
@@ -78,7 +241,7 @@ int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
#if DEBUG
|
||||
fprintf(stderr,
|
||||
"avr_read_byte(): operation not supported on memory type \"%s\"\n",
|
||||
p->desc);
|
||||
mem->desc);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
@@ -92,14 +255,18 @@ int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
|
||||
avr_set_bits(lext, cmd);
|
||||
avr_set_addr(lext, cmd, addr);
|
||||
pgm->cmd(pgm, cmd, res);
|
||||
r = pgm->cmd(pgm, cmd, res);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
memset(cmd, 0, sizeof(cmd));
|
||||
|
||||
avr_set_bits(readop, cmd);
|
||||
avr_set_addr(readop, cmd, addr);
|
||||
pgm->cmd(pgm, cmd, res);
|
||||
r = pgm->cmd(pgm, cmd, res);
|
||||
if (r < 0)
|
||||
return r;
|
||||
data = 0;
|
||||
avr_get_output(readop, res, &data);
|
||||
|
||||
@@ -140,52 +307,131 @@ int avr_mem_hiaddr(AVRMEM * mem)
|
||||
|
||||
/*
|
||||
* Read the entirety of the specified memory type into the
|
||||
* corresponding buffer of the avrpart pointed to by 'p'. If size =
|
||||
* 0, read the entire contents, otherwise, read 'size' bytes.
|
||||
* corresponding buffer of the avrpart pointed to by 'p'.
|
||||
* If v is non-NULL, verify against v's memory area, only
|
||||
* those cells that are tagged TAG_ALLOCATED are verified.
|
||||
*
|
||||
* Return the number of bytes read, or < 0 if an error occurs.
|
||||
*/
|
||||
int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
|
||||
int verbose)
|
||||
int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype,
|
||||
AVRPART * v)
|
||||
{
|
||||
unsigned char rbyte;
|
||||
unsigned long i;
|
||||
unsigned char * buf;
|
||||
AVRMEM * mem;
|
||||
unsigned long i, lastaddr;
|
||||
unsigned char cmd[4];
|
||||
AVRMEM * mem, * vmem = NULL;
|
||||
int rc;
|
||||
|
||||
mem = avr_locate_mem(p, memtype);
|
||||
if (v != NULL)
|
||||
vmem = avr_locate_mem(v, memtype);
|
||||
if (mem == NULL) {
|
||||
fprintf(stderr, "No \"%s\" memory for part %s\n",
|
||||
memtype, p->desc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
buf = mem->buf;
|
||||
if (size == 0) {
|
||||
size = mem->size;
|
||||
}
|
||||
|
||||
/*
|
||||
* start with all 0xff
|
||||
*/
|
||||
memset(buf, 0xff, size);
|
||||
memset(mem->buf, 0xff, mem->size);
|
||||
|
||||
if ((strcmp(mem->desc, "flash")==0) || (strcmp(mem->desc, "eeprom")==0)) {
|
||||
if (pgm->paged_load != NULL && mem->page_size != 0) {
|
||||
/*
|
||||
* the programmer supports a paged mode read, perhaps more
|
||||
* efficiently than we can read it directly, so use its routine
|
||||
* instead
|
||||
*/
|
||||
rc = pgm->paged_load(pgm, p, mem, mem->page_size, size);
|
||||
if (rc >= 0) {
|
||||
if (strcasecmp(mem->desc, "flash") == 0)
|
||||
return avr_mem_hiaddr(mem);
|
||||
else
|
||||
return rc;
|
||||
/* supports "paged load" thru post-increment */
|
||||
if ((p->flags & AVRPART_HAS_TPI) && mem->page_size != 0 &&
|
||||
pgm->cmd_tpi != NULL) {
|
||||
|
||||
while (avr_tpi_poll_nvmbsy(pgm));
|
||||
|
||||
/* setup for read (NOOP) */
|
||||
avr_tpi_setup_rw(pgm, mem, 0, TPI_NVMCMD_NO_OPERATION);
|
||||
|
||||
/* load bytes */
|
||||
for (lastaddr = i = 0; i < mem->size; i++) {
|
||||
if (vmem == NULL ||
|
||||
(vmem->tags[i] & TAG_ALLOCATED) != 0)
|
||||
{
|
||||
if (lastaddr != i) {
|
||||
/* need to setup new address */
|
||||
avr_tpi_setup_rw(pgm, mem, i, TPI_NVMCMD_NO_OPERATION);
|
||||
lastaddr = i;
|
||||
}
|
||||
cmd[0] = TPI_CMD_SLD_PI;
|
||||
rc = pgm->cmd_tpi(pgm, cmd, 1, mem->buf + i, 1);
|
||||
lastaddr++;
|
||||
if (rc == -1) {
|
||||
fprintf(stderr, "avr_read(): error reading address 0x%04lx\n", i);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
report_progress(i, mem->size, NULL);
|
||||
}
|
||||
return avr_mem_hiaddr(mem);
|
||||
}
|
||||
|
||||
if (pgm->paged_load != NULL && mem->page_size != 0) {
|
||||
/*
|
||||
* the programmer supports a paged mode read
|
||||
*/
|
||||
int need_read, failure;
|
||||
unsigned int pageaddr;
|
||||
unsigned int npages, nread;
|
||||
|
||||
/* quickly scan number of pages to be written to first */
|
||||
for (pageaddr = 0, npages = 0;
|
||||
pageaddr < mem->size;
|
||||
pageaddr += mem->page_size) {
|
||||
/* check whether this page must be read */
|
||||
for (i = pageaddr;
|
||||
i < pageaddr + mem->page_size;
|
||||
i++)
|
||||
if (vmem == NULL /* no verify, read everything */ ||
|
||||
(mem->tags[i] & TAG_ALLOCATED) != 0 /* verify, do only
|
||||
read pages that
|
||||
are needed in
|
||||
input file */) {
|
||||
npages++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (pageaddr = 0, failure = 0, nread = 0;
|
||||
!failure && pageaddr < mem->size;
|
||||
pageaddr += mem->page_size) {
|
||||
/* check whether this page must be read */
|
||||
for (i = pageaddr, need_read = 0;
|
||||
i < pageaddr + mem->page_size;
|
||||
i++)
|
||||
if (vmem == NULL /* no verify, read everything */ ||
|
||||
(vmem->tags[i] & TAG_ALLOCATED) != 0 /* verify, do only
|
||||
read pages that
|
||||
are needed in
|
||||
input file */) {
|
||||
need_read = 1;
|
||||
break;
|
||||
}
|
||||
if (need_read) {
|
||||
rc = pgm->paged_load(pgm, p, mem, mem->page_size,
|
||||
pageaddr, mem->page_size);
|
||||
if (rc < 0)
|
||||
/* paged load failed, fall back to byte-at-a-time read below */
|
||||
failure = 1;
|
||||
} else if (verbose >= 3) {
|
||||
fprintf(stderr,
|
||||
"%s: avr_read(): skipping page %u: no interesting data\n",
|
||||
progname, pageaddr / mem->page_size);
|
||||
}
|
||||
nread++;
|
||||
report_progress(nread, npages, NULL);
|
||||
}
|
||||
if (!failure) {
|
||||
if (strcasecmp(mem->desc, "flash") == 0 ||
|
||||
strcasecmp(mem->desc, "application") == 0 ||
|
||||
strcasecmp(mem->desc, "apptable") == 0 ||
|
||||
strcasecmp(mem->desc, "boot") == 0)
|
||||
return avr_mem_hiaddr(mem);
|
||||
else
|
||||
return mem->size;
|
||||
}
|
||||
/* else: fall back to byte-at-a-time write, for historical reasons */
|
||||
}
|
||||
|
||||
if (strcmp(mem->desc, "signature") == 0) {
|
||||
@@ -194,21 +440,27 @@ int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<size; i++) {
|
||||
rc = pgm->read_byte(pgm, p, mem, i, &rbyte);
|
||||
if (rc != 0) {
|
||||
fprintf(stderr, "avr_read(): error reading address 0x%04lx\n", i);
|
||||
if (rc == -1)
|
||||
fprintf(stderr,
|
||||
" read operation not supported for memory \"%s\"\n",
|
||||
memtype);
|
||||
return -2;
|
||||
for (i=0; i < mem->size; i++) {
|
||||
if (vmem == NULL ||
|
||||
(vmem->tags[i] & TAG_ALLOCATED) != 0)
|
||||
{
|
||||
rc = pgm->read_byte(pgm, p, mem, i, mem->buf + i);
|
||||
if (rc != 0) {
|
||||
fprintf(stderr, "avr_read(): error reading address 0x%04lx\n", i);
|
||||
if (rc == -1)
|
||||
fprintf(stderr,
|
||||
" read operation not supported for memory \"%s\"\n",
|
||||
memtype);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
buf[i] = rbyte;
|
||||
report_progress(i, size, NULL);
|
||||
report_progress(i, mem->size, NULL);
|
||||
}
|
||||
|
||||
if (strcasecmp(mem->desc, "flash") == 0)
|
||||
if (strcasecmp(mem->desc, "flash") == 0 ||
|
||||
strcasecmp(mem->desc, "application") == 0 ||
|
||||
strcasecmp(mem->desc, "apptable") == 0 ||
|
||||
strcasecmp(mem->desc, "boot") == 0)
|
||||
return avr_mem_hiaddr(mem);
|
||||
else
|
||||
return i;
|
||||
@@ -305,11 +557,63 @@ int avr_write_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!mem->paged) {
|
||||
if (p->flags & AVRPART_HAS_TPI) {
|
||||
if (pgm->cmd_tpi == NULL) {
|
||||
fprintf(stderr, "%s: Error: %s programmer does not support TPI\n",
|
||||
progname, pgm->type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strcmp(mem->desc, "flash") == 0) {
|
||||
fprintf(stderr, "Writing a byte to flash is not supported for %s\n", p->desc);
|
||||
return -1;
|
||||
} else if ((mem->offset + addr) & 1) {
|
||||
fprintf(stderr, "Writing a byte to an odd location is not supported for %s\n", p->desc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (avr_tpi_poll_nvmbsy(pgm));
|
||||
|
||||
/* must erase fuse first */
|
||||
if (strcmp(mem->desc, "fuse") == 0) {
|
||||
/* setup for SECTION_ERASE (high byte) */
|
||||
avr_tpi_setup_rw(pgm, mem, addr | 1, TPI_NVMCMD_SECTION_ERASE);
|
||||
|
||||
/* write dummy byte */
|
||||
cmd[0] = TPI_CMD_SST;
|
||||
cmd[1] = 0xFF;
|
||||
rc = pgm->cmd_tpi(pgm, cmd, 2, NULL, 0);
|
||||
|
||||
while (avr_tpi_poll_nvmbsy(pgm));
|
||||
}
|
||||
|
||||
/* setup for WORD_WRITE */
|
||||
avr_tpi_setup_rw(pgm, mem, addr, TPI_NVMCMD_WORD_WRITE);
|
||||
|
||||
cmd[0] = TPI_CMD_SST_PI;
|
||||
cmd[1] = data;
|
||||
rc = pgm->cmd_tpi(pgm, cmd, 2, NULL, 0);
|
||||
/* dummy high byte to start WORD_WRITE */
|
||||
cmd[0] = TPI_CMD_SST_PI;
|
||||
cmd[1] = data;
|
||||
rc = pgm->cmd_tpi(pgm, cmd, 2, NULL, 0);
|
||||
|
||||
while (avr_tpi_poll_nvmbsy(pgm));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!mem->paged &&
|
||||
(p->flags & AVRPART_IS_AT90S1200) == 0) {
|
||||
/*
|
||||
* check to see if the write is necessary by reading the existing
|
||||
* value and only write if we are changing the value; we can't
|
||||
* use this optimization for paged addressing.
|
||||
*
|
||||
* For mysterious reasons, on the AT90S1200, this read operation
|
||||
* sometimes causes the high byte of the same word to be
|
||||
* programmed to the value of the low byte that has just been
|
||||
* programmed before. Avoid that optimization on this device.
|
||||
*/
|
||||
rc = pgm->read_byte(pgm, p, mem, addr, &b);
|
||||
if (rc != 0) {
|
||||
@@ -535,13 +839,15 @@ int avr_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
* Return the number of bytes written, or -1 if an error occurs.
|
||||
*/
|
||||
int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
|
||||
int verbose)
|
||||
int auto_erase)
|
||||
{
|
||||
int rc;
|
||||
int newpage, page_tainted, flush_page, do_write;
|
||||
int wsize;
|
||||
unsigned long i;
|
||||
unsigned int i, lastaddr;
|
||||
unsigned char data;
|
||||
int werror;
|
||||
unsigned char cmd[4];
|
||||
AVRMEM * m;
|
||||
|
||||
m = avr_locate_mem(p, memtype);
|
||||
@@ -568,52 +874,173 @@ int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
|
||||
progbuf, wsize);
|
||||
}
|
||||
|
||||
if ((strcmp(m->desc, "flash")==0) || (strcmp(m->desc, "eeprom")==0)) {
|
||||
if (pgm->paged_write != NULL && m->page_size != 0) {
|
||||
/*
|
||||
* the programmer supports a paged mode write, perhaps more
|
||||
* efficiently than we can read it directly, so use its routine
|
||||
* instead
|
||||
*/
|
||||
if ((i = pgm->paged_write(pgm, p, m, m->page_size, size)) >= 0)
|
||||
return i;
|
||||
|
||||
if ((p->flags & AVRPART_HAS_TPI) && m->page_size != 0 &&
|
||||
pgm->cmd_tpi != NULL) {
|
||||
|
||||
while (avr_tpi_poll_nvmbsy(pgm));
|
||||
|
||||
/* setup for WORD_WRITE */
|
||||
avr_tpi_setup_rw(pgm, m, 0, TPI_NVMCMD_WORD_WRITE);
|
||||
|
||||
/* make sure it's aligned to a word boundary */
|
||||
if (wsize & 0x1) {
|
||||
wsize++;
|
||||
}
|
||||
|
||||
/* write words, low byte first */
|
||||
for (lastaddr = i = 0; i < wsize; i += 2) {
|
||||
if ((m->tags[i] & TAG_ALLOCATED) != 0 ||
|
||||
(m->tags[i + 1] & TAG_ALLOCATED) != 0) {
|
||||
|
||||
if (lastaddr != i) {
|
||||
/* need to setup new address */
|
||||
avr_tpi_setup_rw(pgm, m, i, TPI_NVMCMD_WORD_WRITE);
|
||||
lastaddr = i;
|
||||
}
|
||||
|
||||
cmd[0] = TPI_CMD_SST_PI;
|
||||
cmd[1] = m->buf[i];
|
||||
rc = pgm->cmd_tpi(pgm, cmd, 2, NULL, 0);
|
||||
|
||||
cmd[1] = m->buf[i + 1];
|
||||
rc = pgm->cmd_tpi(pgm, cmd, 2, NULL, 0);
|
||||
|
||||
lastaddr += 2;
|
||||
|
||||
while (avr_tpi_poll_nvmbsy(pgm));
|
||||
}
|
||||
report_progress(i, wsize, NULL);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
if (pgm->paged_write != NULL && m->page_size != 0) {
|
||||
/*
|
||||
* the programmer supports a paged mode write
|
||||
*/
|
||||
int need_write, failure;
|
||||
unsigned int pageaddr;
|
||||
unsigned int npages, nwritten;
|
||||
|
||||
/* quickly scan number of pages to be written to first */
|
||||
for (pageaddr = 0, npages = 0;
|
||||
pageaddr < wsize;
|
||||
pageaddr += m->page_size) {
|
||||
/* check whether this page must be written to */
|
||||
for (i = pageaddr;
|
||||
i < pageaddr + m->page_size;
|
||||
i++)
|
||||
if ((m->tags[i] & TAG_ALLOCATED) != 0) {
|
||||
npages++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (pageaddr = 0, failure = 0, nwritten = 0;
|
||||
!failure && pageaddr < wsize;
|
||||
pageaddr += m->page_size) {
|
||||
/* check whether this page must be written to */
|
||||
for (i = pageaddr, need_write = 0;
|
||||
i < pageaddr + m->page_size;
|
||||
i++)
|
||||
if ((m->tags[i] & TAG_ALLOCATED) != 0) {
|
||||
need_write = 1;
|
||||
break;
|
||||
}
|
||||
if (need_write) {
|
||||
rc = 0;
|
||||
if (auto_erase)
|
||||
rc = pgm->page_erase(pgm, p, m, pageaddr);
|
||||
if (rc >= 0)
|
||||
rc = pgm->paged_write(pgm, p, m, m->page_size, pageaddr, m->page_size);
|
||||
if (rc < 0)
|
||||
/* paged write failed, fall back to byte-at-a-time write below */
|
||||
failure = 1;
|
||||
} else if (verbose >= 3) {
|
||||
fprintf(stderr,
|
||||
"%s: avr_write(): skipping page %u: no interesting data\n",
|
||||
progname, pageaddr / m->page_size);
|
||||
}
|
||||
nwritten++;
|
||||
report_progress(nwritten, npages, NULL);
|
||||
}
|
||||
if (!failure)
|
||||
return wsize;
|
||||
/* else: fall back to byte-at-a-time write, for historical reasons */
|
||||
}
|
||||
|
||||
if (pgm->write_setup) {
|
||||
pgm->write_setup(pgm, p, m);
|
||||
}
|
||||
|
||||
newpage = 1;
|
||||
page_tainted = 0;
|
||||
flush_page = 0;
|
||||
|
||||
for (i=0; i<wsize; i++) {
|
||||
data = m->buf[i];
|
||||
report_progress(i, wsize, NULL);
|
||||
|
||||
rc = avr_write_byte(pgm, p, m, i, data);
|
||||
if (rc) {
|
||||
fprintf(stderr, " ***failed; ");
|
||||
fprintf(stderr, "\n");
|
||||
pgm->err_led(pgm, ON);
|
||||
werror = 1;
|
||||
/*
|
||||
* Find out whether the write action must be invoked for this
|
||||
* byte.
|
||||
*
|
||||
* For non-paged memory, this only happens if TAG_ALLOCATED is
|
||||
* set for the byte.
|
||||
*
|
||||
* For paged memory, TAG_ALLOCATED also invokes the write
|
||||
* operation, which is actually a page buffer fill only. This
|
||||
* "taints" the page, and upon encountering the last byte of each
|
||||
* tainted page, the write operation must also be invoked in order
|
||||
* to actually write the page buffer to memory.
|
||||
*/
|
||||
do_write = (m->tags[i] & TAG_ALLOCATED) != 0;
|
||||
if (m->paged) {
|
||||
if (newpage) {
|
||||
page_tainted = do_write;
|
||||
} else {
|
||||
page_tainted |= do_write;
|
||||
}
|
||||
if (i % m->page_size == m->page_size - 1 ||
|
||||
i == wsize - 1) {
|
||||
/* last byte this page */
|
||||
flush_page = page_tainted;
|
||||
newpage = 1;
|
||||
} else {
|
||||
flush_page = newpage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (m->paged) {
|
||||
/*
|
||||
* check to see if it is time to flush the page with a page
|
||||
* write
|
||||
*/
|
||||
if (((i % m->page_size) == m->page_size-1) ||
|
||||
(i == wsize-1)) {
|
||||
rc = avr_write_page(pgm, p, m, i);
|
||||
if (rc) {
|
||||
fprintf(stderr,
|
||||
" *** page %ld (addresses 0x%04lx - 0x%04lx) failed "
|
||||
"to write\n",
|
||||
i % m->page_size,
|
||||
i - m->page_size + 1, i);
|
||||
fprintf(stderr, "\n");
|
||||
pgm->err_led(pgm, ON);
|
||||
if (!do_write && !flush_page) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (do_write) {
|
||||
rc = avr_write_byte(pgm, p, m, i, data);
|
||||
if (rc) {
|
||||
fprintf(stderr, " ***failed; ");
|
||||
fprintf(stderr, "\n");
|
||||
pgm->err_led(pgm, ON);
|
||||
werror = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* check to see if it is time to flush the page with a page
|
||||
* write
|
||||
*/
|
||||
if (flush_page) {
|
||||
rc = avr_write_page(pgm, p, m, i);
|
||||
if (rc) {
|
||||
fprintf(stderr,
|
||||
" *** page %d (addresses 0x%04x - 0x%04x) failed "
|
||||
"to write\n",
|
||||
i % m->page_size,
|
||||
i - m->page_size + 1, i);
|
||||
fprintf(stderr, "\n");
|
||||
pgm->err_led(pgm, ON);
|
||||
werror = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -639,7 +1066,7 @@ int avr_signature(PROGRAMMER * pgm, AVRPART * p)
|
||||
int rc;
|
||||
|
||||
report_progress (0,1,"Reading");
|
||||
rc = avr_read(pgm, p, "signature", 0, 0);
|
||||
rc = avr_read(pgm, p, "signature", 0);
|
||||
if (rc < 0) {
|
||||
fprintf(stderr,
|
||||
"%s: error reading signature data for part \"%s\", rc=%d\n",
|
||||
@@ -698,7 +1125,8 @@ int avr_verify(AVRPART * p, AVRPART * v, char * memtype, int size)
|
||||
}
|
||||
|
||||
for (i=0; i<size; i++) {
|
||||
if (buf1[i] != buf2[i]) {
|
||||
if ((b->tags[i] & TAG_ALLOCATED) != 0 &&
|
||||
buf1[i] != buf2[i]) {
|
||||
fprintf(stderr,
|
||||
"%s: verification error, first mismatch at byte 0x%04x\n"
|
||||
"%s0x%02x != 0x%02x\n",
|
||||
@@ -780,31 +1208,10 @@ int avr_put_cycle_count(PROGRAMMER * pgm, AVRPART * p, int cycles)
|
||||
|
||||
int avr_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
int cycles;
|
||||
int rc;
|
||||
|
||||
if (do_cycles) {
|
||||
rc = avr_get_cycle_count(pgm, p, &cycles);
|
||||
/*
|
||||
* Don't update the cycle counter, if read failed
|
||||
*/
|
||||
if(rc != 0) {
|
||||
do_cycles = 0;
|
||||
}
|
||||
}
|
||||
|
||||
rc = pgm->chip_erase(pgm, p);
|
||||
|
||||
/*
|
||||
* Don't update the cycle counter, if erase failed
|
||||
*/
|
||||
if (do_cycles && (rc == 0)) {
|
||||
cycles++;
|
||||
fprintf(stderr, "%s: erase-rewrite cycle count is now %d\n",
|
||||
progname, cycles);
|
||||
avr_put_cycle_count(pgm, p, cycles);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -37,11 +36,13 @@ extern FP_UpdateProgress update_progress;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int avr_tpi_poll_nvmbsy(PROGRAMMER *pgm);
|
||||
int avr_tpi_chip_erase(PROGRAMMER * pgm, AVRPART * p);
|
||||
int avr_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p, unsigned char guard_time);
|
||||
int avr_read_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
unsigned long addr, unsigned char * value);
|
||||
|
||||
int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
|
||||
int verbose);
|
||||
int avr_read(PROGRAMMER * pgm, AVRPART * p, char * memtype, AVRPART * v);
|
||||
|
||||
int avr_write_page(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
unsigned long addr);
|
||||
@@ -53,7 +54,7 @@ int avr_write_byte_default(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
unsigned long addr, unsigned char data);
|
||||
|
||||
int avr_write(PROGRAMMER * pgm, AVRPART * p, char * memtype, int size,
|
||||
int verbose);
|
||||
int auto_erase);
|
||||
|
||||
int avr_signature(PROGRAMMER * pgm, AVRPART * p);
|
||||
|
||||
@@ -61,7 +62,7 @@ int avr_verify(AVRPART * p, AVRPART * v, char * memtype, int size);
|
||||
|
||||
int avr_get_cycle_count(PROGRAMMER * pgm, AVRPART * p, int * cycles);
|
||||
|
||||
int avr_put_cycle_count(PROGRAMMER * pgm, AVRPART * p, int cycles);;
|
||||
int avr_put_cycle_count(PROGRAMMER * pgm, AVRPART * p, int cycles);
|
||||
|
||||
int avr_mem_hiaddr(AVRMEM * mem);
|
||||
|
||||
|
||||
399
avrdude/avr910.c
399
avrdude/avr910.c
@@ -1,6 +1,8 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2003-2004 Theodore A. Roth <troth@openavr.org>
|
||||
* Copyright 2007 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
* Copyright 2008 Klaus Leidinger <klaus@mikrocontroller-projekte.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
|
||||
@@ -13,8 +15,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -30,6 +31,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -40,7 +42,36 @@
|
||||
#include "avr910.h"
|
||||
#include "serial.h"
|
||||
|
||||
static char has_auto_incr_addr;
|
||||
/*
|
||||
* Private data for this programmer.
|
||||
*/
|
||||
struct pdata
|
||||
{
|
||||
char has_auto_incr_addr;
|
||||
unsigned char devcode;
|
||||
unsigned int buffersize;
|
||||
unsigned char test_blockmode;
|
||||
unsigned char use_blockmode;
|
||||
};
|
||||
|
||||
#define PDATA(pgm) ((struct pdata *)(pgm->cookie))
|
||||
|
||||
static void avr910_setup(PROGRAMMER * pgm)
|
||||
{
|
||||
if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: avr910_setup(): Out of memory allocating private data\n",
|
||||
progname);
|
||||
exit(1);
|
||||
}
|
||||
memset(pgm->cookie, 0, sizeof(struct pdata));
|
||||
PDATA(pgm)->test_blockmode = 1;
|
||||
}
|
||||
|
||||
static void avr910_teardown(PROGRAMMER * pgm)
|
||||
{
|
||||
free(pgm->cookie);
|
||||
}
|
||||
|
||||
|
||||
static int avr910_send(PROGRAMMER * pgm, char * buf, size_t len)
|
||||
@@ -133,8 +164,7 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
char hw[2];
|
||||
char buf[10];
|
||||
char type;
|
||||
char c, devtype_1st;
|
||||
int dev_supported = 0;
|
||||
char c;
|
||||
AVRPART * part;
|
||||
|
||||
/* Get the programmer identifier. Programmer returns exactly 7 chars
|
||||
@@ -164,50 +194,85 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
/* See if programmer supports autoincrement of address. */
|
||||
|
||||
avr910_send(pgm, "a", 1);
|
||||
avr910_recv(pgm, &has_auto_incr_addr, 1);
|
||||
if (has_auto_incr_addr == 'Y')
|
||||
avr910_recv(pgm, &PDATA(pgm)->has_auto_incr_addr, 1);
|
||||
if (PDATA(pgm)->has_auto_incr_addr == 'Y')
|
||||
fprintf(stderr, "Programmer supports auto addr increment.\n");
|
||||
|
||||
/* Get list of devices that the programmer supports. */
|
||||
/* Check support for buffered memory access, ignore if not available */
|
||||
|
||||
avr910_send(pgm, "t", 1);
|
||||
fprintf(stderr, "\nProgrammer supports the following devices:\n");
|
||||
devtype_1st = 0;
|
||||
while (1) {
|
||||
if (PDATA(pgm)->test_blockmode == 1) {
|
||||
avr910_send(pgm, "b", 1);
|
||||
avr910_recv(pgm, &c, 1);
|
||||
if (devtype_1st == 0)
|
||||
devtype_1st = c;
|
||||
if (c == 0)
|
||||
break;
|
||||
part = locate_part_by_avr910_devcode(part_list, c);
|
||||
|
||||
fprintf(stderr, " Device code: 0x%02x = %s\n", c, part ? part->desc : "(unknown)");
|
||||
|
||||
/* FIXME: Need to lookup devcode and report the device. */
|
||||
|
||||
if (p->avr910_devcode == c)
|
||||
dev_supported = 1;
|
||||
};
|
||||
fprintf(stderr,"\n");
|
||||
|
||||
if (!dev_supported) {
|
||||
fprintf(stderr,
|
||||
"%s: %s: selected device is not supported by programmer: %s\n",
|
||||
progname, ovsigck? "warning": "error", p->id);
|
||||
if (!ovsigck)
|
||||
exit(1);
|
||||
if (c == 'Y') {
|
||||
avr910_recv(pgm, &c, 1);
|
||||
PDATA(pgm)->buffersize = (unsigned int)(unsigned char)c<<8;
|
||||
avr910_recv(pgm, &c, 1);
|
||||
PDATA(pgm)->buffersize += (unsigned int)(unsigned char)c;
|
||||
fprintf(stderr,
|
||||
"Programmer supports buffered memory access with "
|
||||
"buffersize = %u bytes.\n",
|
||||
PDATA(pgm)->buffersize);
|
||||
PDATA(pgm)->use_blockmode = 1;
|
||||
} else {
|
||||
PDATA(pgm)->use_blockmode = 0;
|
||||
}
|
||||
} else {
|
||||
PDATA(pgm)->use_blockmode = 0;
|
||||
}
|
||||
|
||||
/* Tell the programmer which part we selected.
|
||||
If the user forced the selection, use the first device
|
||||
type that is supported by the programmer. */
|
||||
if (PDATA(pgm)->devcode == 0) {
|
||||
char devtype_1st;
|
||||
int dev_supported = 0;
|
||||
|
||||
/* Get list of devices that the programmer supports. */
|
||||
|
||||
avr910_send(pgm, "t", 1);
|
||||
fprintf(stderr, "\nProgrammer supports the following devices:\n");
|
||||
devtype_1st = 0;
|
||||
while (1) {
|
||||
avr910_recv(pgm, &c, 1);
|
||||
if (devtype_1st == 0)
|
||||
devtype_1st = c;
|
||||
if (c == 0)
|
||||
break;
|
||||
part = locate_part_by_avr910_devcode(part_list, c);
|
||||
|
||||
fprintf(stderr, " Device code: 0x%02x = %s\n", c, part ? part->desc : "(unknown)");
|
||||
|
||||
/* FIXME: Need to lookup devcode and report the device. */
|
||||
|
||||
if (p->avr910_devcode == c)
|
||||
dev_supported = 1;
|
||||
};
|
||||
fprintf(stderr,"\n");
|
||||
|
||||
if (!dev_supported) {
|
||||
fprintf(stderr,
|
||||
"%s: %s: selected device is not supported by programmer: %s\n",
|
||||
progname, ovsigck? "warning": "error", p->id);
|
||||
if (!ovsigck)
|
||||
exit(1);
|
||||
}
|
||||
/* If the user forced the selection, use the first device
|
||||
type that is supported by the programmer. */
|
||||
buf[1] = ovsigck? devtype_1st: p->avr910_devcode;
|
||||
} else {
|
||||
/* devcode overridden by -x devcode= option */
|
||||
buf[1] = (char)(PDATA(pgm)->devcode);
|
||||
}
|
||||
|
||||
/* Tell the programmer which part we selected. */
|
||||
buf[0] = 'T';
|
||||
buf[1] = ovsigck? devtype_1st: p->avr910_devcode;
|
||||
/* buf[1] has been set up above */
|
||||
|
||||
avr910_send(pgm, buf, 2);
|
||||
avr910_vfy_cmd_sent(pgm, "select device");
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr,
|
||||
"%s: avr910_devcode selected: 0x%02x\n",
|
||||
progname, (unsigned)buf[1]);
|
||||
|
||||
avr910_enter_prog_mode(pgm);
|
||||
|
||||
return 0;
|
||||
@@ -234,8 +299,8 @@ static void avr910_enable(PROGRAMMER * pgm)
|
||||
* transmit an AVR device command and return the results; 'cmd' and
|
||||
* 'res' must point to at least a 4 byte data buffer
|
||||
*/
|
||||
static int avr910_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4])
|
||||
static int avr910_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res)
|
||||
{
|
||||
char buf[5];
|
||||
|
||||
@@ -259,6 +324,55 @@ static int avr910_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
}
|
||||
|
||||
|
||||
static int avr910_parseextparms(PROGRAMMER * pgm, LISTID extparms)
|
||||
{
|
||||
LNODEID ln;
|
||||
const char *extended_param;
|
||||
int rv = 0;
|
||||
|
||||
for (ln = lfirst(extparms); ln; ln = lnext(ln)) {
|
||||
extended_param = ldata(ln);
|
||||
|
||||
if (strncmp(extended_param, "devcode=", strlen("devcode=")) == 0) {
|
||||
int devcode;
|
||||
if (sscanf(extended_param, "devcode=%i", &devcode) != 1 ||
|
||||
devcode <= 0 || devcode > 255) {
|
||||
fprintf(stderr,
|
||||
"%s: avr910_parseextparms(): invalid devcode '%s'\n",
|
||||
progname, extended_param);
|
||||
rv = -1;
|
||||
continue;
|
||||
}
|
||||
if (verbose >= 2) {
|
||||
fprintf(stderr,
|
||||
"%s: avr910_parseextparms(): devcode overwritten as 0x%02x\n",
|
||||
progname, devcode);
|
||||
}
|
||||
PDATA(pgm)->devcode = devcode;
|
||||
|
||||
continue;
|
||||
}
|
||||
if (strncmp(extended_param, "no_blockmode", strlen("no_blockmode")) == 0) {
|
||||
if (verbose >= 2) {
|
||||
fprintf(stderr,
|
||||
"%s: avr910_parseextparms(-x): no testing for Blockmode\n",
|
||||
progname);
|
||||
}
|
||||
PDATA(pgm)->test_blockmode = 0;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"%s: avr910_parseextparms(): invalid extended parameter '%s'\n",
|
||||
progname, extended_param);
|
||||
rv = -1;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
static int avr910_open(PROGRAMMER * pgm, char * port)
|
||||
{
|
||||
/*
|
||||
@@ -269,7 +383,9 @@ static int avr910_open(PROGRAMMER * pgm, char * port)
|
||||
}
|
||||
|
||||
strcpy(pgm->port, port);
|
||||
serial_open(port, pgm->baudrate, &pgm->fd);
|
||||
if (serial_open(port, pgm->baudrate, &pgm->fd)==-1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* drain any extraneous input
|
||||
@@ -343,33 +459,20 @@ static int avr910_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
static int avr910_read_byte_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
unsigned long addr, unsigned char * value)
|
||||
{
|
||||
static int cached = 0;
|
||||
static unsigned char cvalue;
|
||||
static unsigned long caddr;
|
||||
char buf[2];
|
||||
|
||||
if (cached && ((caddr + 1) == addr)) {
|
||||
*value = cvalue;
|
||||
cached = 0;
|
||||
avr910_set_addr(pgm, addr >> 1);
|
||||
|
||||
avr910_send(pgm, "R", 1);
|
||||
|
||||
/* Read back the program mem word (MSB first) */
|
||||
avr910_recv(pgm, buf, sizeof(buf));
|
||||
|
||||
if ((addr & 0x01) == 0) {
|
||||
*value = buf[1];
|
||||
}
|
||||
else {
|
||||
char buf[2];
|
||||
|
||||
avr910_set_addr(pgm, addr >> 1);
|
||||
|
||||
avr910_send(pgm, "R", 1);
|
||||
|
||||
/* Read back the program mem word (MSB first) */
|
||||
avr910_recv(pgm, buf, sizeof(buf));
|
||||
|
||||
if ((addr & 0x01) == 0) {
|
||||
*value = buf[1];
|
||||
// cached = 1;
|
||||
cvalue = buf[0];
|
||||
caddr = addr;
|
||||
}
|
||||
else {
|
||||
*value = buf[0];
|
||||
}
|
||||
*value = buf[0];
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -403,12 +506,12 @@ static int avr910_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
|
||||
|
||||
static int avr910_paged_write_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int page_size, int n_bytes)
|
||||
unsigned int page_size,
|
||||
unsigned int addr, unsigned int n_bytes)
|
||||
{
|
||||
unsigned char cmd[] = {'c', 'C'};
|
||||
char buf[2];
|
||||
unsigned int addr = 0;
|
||||
unsigned int max_addr = n_bytes;
|
||||
unsigned int max_addr = addr + n_bytes;
|
||||
unsigned int page_addr;
|
||||
int page_bytes = page_size;
|
||||
int page_wr_cmd_pending = 0;
|
||||
@@ -442,11 +545,9 @@ static int avr910_paged_write_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
page_addr = addr;
|
||||
page_bytes = page_size;
|
||||
}
|
||||
else if ((has_auto_incr_addr != 'Y') && ((addr & 0x01) == 0)) {
|
||||
else if ((PDATA(pgm)->has_auto_incr_addr != 'Y') && ((addr & 0x01) == 0)) {
|
||||
avr910_set_addr(pgm, addr>>1);
|
||||
}
|
||||
|
||||
report_progress (addr, max_addr, NULL);
|
||||
}
|
||||
|
||||
/* If we didn't send the page wr cmd after the last byte written in the
|
||||
@@ -464,11 +565,12 @@ static int avr910_paged_write_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
|
||||
|
||||
static int avr910_paged_write_eeprom(PROGRAMMER * pgm, AVRPART * p,
|
||||
AVRMEM * m, int page_size, int n_bytes)
|
||||
AVRMEM * m,
|
||||
unsigned int page_size,
|
||||
unsigned int addr, unsigned int n_bytes)
|
||||
{
|
||||
char cmd[2];
|
||||
unsigned int addr = 0;
|
||||
unsigned int max_addr = n_bytes;
|
||||
unsigned int max_addr = addr + n_bytes;
|
||||
|
||||
avr910_set_addr(pgm, addr);
|
||||
|
||||
@@ -482,11 +584,9 @@ static int avr910_paged_write_eeprom(PROGRAMMER * pgm, AVRPART * p,
|
||||
|
||||
addr++;
|
||||
|
||||
if (has_auto_incr_addr != 'Y') {
|
||||
if (PDATA(pgm)->has_auto_incr_addr != 'Y') {
|
||||
avr910_set_addr(pgm, addr);
|
||||
}
|
||||
|
||||
report_progress (addr, max_addr, NULL);
|
||||
}
|
||||
|
||||
return addr;
|
||||
@@ -494,68 +594,138 @@ static int avr910_paged_write_eeprom(PROGRAMMER * pgm, AVRPART * p,
|
||||
|
||||
|
||||
static int avr910_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int page_size, int n_bytes)
|
||||
unsigned int page_size,
|
||||
unsigned int addr, unsigned int n_bytes)
|
||||
{
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
return avr910_paged_write_flash(pgm, p, m, page_size, n_bytes);
|
||||
int rval = 0;
|
||||
if (PDATA(pgm)->use_blockmode == 0) {
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
rval = avr910_paged_write_flash(pgm, p, m, page_size, addr, n_bytes);
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
rval = avr910_paged_write_eeprom(pgm, p, m, page_size, addr, n_bytes);
|
||||
} else {
|
||||
rval = -2;
|
||||
}
|
||||
}
|
||||
else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
return avr910_paged_write_eeprom(pgm, p, m, page_size, n_bytes);
|
||||
}
|
||||
else {
|
||||
return -2;
|
||||
|
||||
if (PDATA(pgm)->use_blockmode == 1) {
|
||||
unsigned int max_addr = addr + n_bytes;
|
||||
char *cmd;
|
||||
unsigned int blocksize = PDATA(pgm)->buffersize;
|
||||
int wr_size;
|
||||
|
||||
if (strcmp(m->desc, "flash") && strcmp(m->desc, "eeprom"))
|
||||
return -2;
|
||||
|
||||
if (m->desc[0] == 'e') {
|
||||
blocksize = 1; /* Write to eeprom single bytes only */
|
||||
wr_size = 1;
|
||||
} else {
|
||||
wr_size = 2;
|
||||
}
|
||||
|
||||
avr910_set_addr(pgm, addr / wr_size);
|
||||
|
||||
cmd = malloc(4 + blocksize);
|
||||
if (!cmd) return -1;
|
||||
|
||||
cmd[0] = 'B';
|
||||
cmd[3] = toupper((int)(m->desc[0]));
|
||||
|
||||
while (addr < max_addr) {
|
||||
if ((max_addr - addr) < blocksize) {
|
||||
blocksize = max_addr - addr;
|
||||
};
|
||||
memcpy(&cmd[4], &m->buf[addr], blocksize);
|
||||
cmd[1] = (blocksize >> 8) & 0xff;
|
||||
cmd[2] = blocksize & 0xff;
|
||||
|
||||
avr910_send(pgm, cmd, 4 + blocksize);
|
||||
avr910_vfy_cmd_sent(pgm, "write block");
|
||||
|
||||
addr += blocksize;
|
||||
} /* while */
|
||||
free(cmd);
|
||||
|
||||
rval = addr;
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
|
||||
static int avr910_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int page_size, int n_bytes)
|
||||
static int avr910_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
unsigned int page_size,
|
||||
unsigned int addr, unsigned int n_bytes)
|
||||
{
|
||||
char cmd;
|
||||
char cmd[4];
|
||||
int rd_size;
|
||||
unsigned int addr = 0;
|
||||
unsigned int max_addr;
|
||||
char buf[2];
|
||||
int rval=0;
|
||||
|
||||
max_addr = addr + n_bytes;
|
||||
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
cmd = 'R';
|
||||
cmd[0] = 'R';
|
||||
rd_size = 2; /* read two bytes per addr */
|
||||
}
|
||||
else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
cmd = 'd';
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
cmd[0] = 'd';
|
||||
rd_size = 1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return -2;
|
||||
}
|
||||
|
||||
max_addr = n_bytes/rd_size;
|
||||
if (PDATA(pgm)->use_blockmode) {
|
||||
/* use buffered mode */
|
||||
int blocksize = PDATA(pgm)->buffersize;
|
||||
|
||||
avr910_set_addr(pgm, addr);
|
||||
cmd[0] = 'g';
|
||||
cmd[3] = toupper((int)(m->desc[0]));
|
||||
|
||||
while (addr < max_addr) {
|
||||
avr910_send(pgm, &cmd, 1);
|
||||
if (cmd == 'R') {
|
||||
/* The 'R' command returns two bytes, MSB first, we need to put the data
|
||||
into the memory buffer LSB first. */
|
||||
avr910_recv(pgm, buf, 2);
|
||||
m->buf[addr*2] = buf[1]; /* LSB */
|
||||
m->buf[addr*2+1] = buf[0]; /* MSB */
|
||||
}
|
||||
else {
|
||||
avr910_recv(pgm, (char *)&m->buf[addr], 1);
|
||||
avr910_set_addr(pgm, addr / rd_size);
|
||||
|
||||
while (addr < max_addr) {
|
||||
if ((max_addr - addr) < blocksize) {
|
||||
blocksize = max_addr - addr;
|
||||
}
|
||||
cmd[1] = (blocksize >> 8) & 0xff;
|
||||
cmd[2] = blocksize & 0xff;
|
||||
|
||||
avr910_send(pgm, cmd, 4);
|
||||
avr910_recv(pgm, (char *)&m->buf[addr], blocksize);
|
||||
|
||||
addr += blocksize;
|
||||
}
|
||||
|
||||
addr++;
|
||||
rval = addr;
|
||||
} else {
|
||||
|
||||
if (has_auto_incr_addr != 'Y') {
|
||||
avr910_set_addr(pgm, addr);
|
||||
avr910_set_addr(pgm, addr / rd_size);
|
||||
|
||||
while (addr < max_addr) {
|
||||
avr910_send(pgm, cmd, 1);
|
||||
if (rd_size == 2) {
|
||||
/* The 'R' command returns two bytes, MSB first, we need to put the data
|
||||
into the memory buffer LSB first. */
|
||||
avr910_recv(pgm, buf, 2);
|
||||
m->buf[addr] = buf[1]; /* LSB */
|
||||
m->buf[addr + 1] = buf[0]; /* MSB */
|
||||
}
|
||||
else {
|
||||
avr910_recv(pgm, (char *)&m->buf[addr], 1);
|
||||
}
|
||||
|
||||
addr += rd_size;
|
||||
|
||||
if (PDATA(pgm)->has_auto_incr_addr != 'Y') {
|
||||
avr910_set_addr(pgm, addr / rd_size);
|
||||
}
|
||||
}
|
||||
|
||||
report_progress (addr, max_addr, NULL);
|
||||
rval = addr;
|
||||
}
|
||||
|
||||
return addr * rd_size;
|
||||
return rval;
|
||||
}
|
||||
|
||||
/* Signature byte reads are always 3 bytes. */
|
||||
@@ -579,6 +749,7 @@ static int avr910_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
|
||||
return 3;
|
||||
}
|
||||
|
||||
const char avr910_desc[] = "Serial programmers using protocol described in application note AVR910";
|
||||
|
||||
void avr910_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
@@ -608,4 +779,8 @@ void avr910_initpgm(PROGRAMMER * pgm)
|
||||
pgm->paged_load = avr910_paged_load;
|
||||
|
||||
pgm->read_sig_bytes = avr910_read_sig_bytes;
|
||||
|
||||
pgm->parseextparams = avr910_parseextparms;
|
||||
pgm->setup = avr910_setup;
|
||||
pgm->teardown = avr910_teardown;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -28,6 +27,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const char avr910_desc[];
|
||||
void avr910_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\"
|
||||
.\" avrdude - A Downloader/Uploader for AVR device programmers
|
||||
.\" Copyright (C) 2001, 2002, 2003, 2005, 2006 Joerg Wunsch
|
||||
.\" Copyright (C) 2001, 2002, 2003, 2005 - 2013 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
|
||||
@@ -13,13 +13,12 @@
|
||||
.\" 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
|
||||
.\" along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\"
|
||||
.\" $Id$
|
||||
.\"
|
||||
.Dd DATE October 26, 2006
|
||||
.Dd DATE September 13, 2013
|
||||
.Os
|
||||
.Dt AVRDUDE 1
|
||||
.Sh NAME
|
||||
@@ -39,6 +38,7 @@
|
||||
.Oc
|
||||
.Op Fl F
|
||||
.Op Fl i Ar delay
|
||||
.Op Fl n logfile
|
||||
.Op Fl n
|
||||
.Op Fl O
|
||||
.Op Fl P Ar port
|
||||
@@ -48,9 +48,8 @@
|
||||
.Op Fl u
|
||||
.Op Fl U Ar memtype:op:filename:filefmt
|
||||
.Op Fl v
|
||||
.Op Fl x Ar extended_param
|
||||
.Op Fl V
|
||||
.Op Fl y
|
||||
.Op Fl Y
|
||||
.Sh DESCRIPTION
|
||||
.Nm Avrdude
|
||||
is a program for downloading code and data to Atmel AVR
|
||||
@@ -58,7 +57,8 @@ microcontrollers.
|
||||
.Nm Avrdude
|
||||
supports Atmel's STK500 programmer,
|
||||
Atmel's AVRISP and AVRISP mkII devices,
|
||||
Atmel's JTAG ICE (both mkI and mkII, the latter also in ISP mode),
|
||||
Atmel's STK600,
|
||||
Atmel's JTAG ICE (mkI, mkII and 3, the latter two also in ISP mode),
|
||||
programmers complying to AppNote AVR910 and AVR109 (including the Butterfly),
|
||||
as well as a simple hard-wired
|
||||
programmer connected directly to a
|
||||
@@ -97,6 +97,18 @@ port.
|
||||
Connecting to a serial port emulated on top of USB is likely to not
|
||||
work at all, or to work abysmally slow.
|
||||
.Pp
|
||||
If you happen to have a Linux system with at least 4 hardware GPIOs
|
||||
available (like almost all embedded Linux boards) you can do without
|
||||
any additional hardware - just connect them to the MOSI, MISO, RESET
|
||||
and SCK pins on the AVR and use the linuxgpio programmer type. It bitbangs
|
||||
the lines using the Linux sysfs GPIO interface. Of course, care should
|
||||
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
|
||||
detailed tutorial about using this programmer type.
|
||||
.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
|
||||
@@ -105,15 +117,38 @@ 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''.
|
||||
.Pp
|
||||
The Arduino (which is very similar to the STK500 1.x) is supported via
|
||||
its own programmer type specification ``arduino''.
|
||||
.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
|
||||
the section on
|
||||
.Em extended parameters
|
||||
below for details.
|
||||
.Pp
|
||||
Atmel's STK600 programmer is supported in ISP and high-voltage
|
||||
programming modes, and connects through the USB.
|
||||
For ATxmega devices, the STK600 is supported in PDI mode.
|
||||
For ATtiny4/5/9/10 devices, the STK600 and AVRISP mkII are supported in TPI mode.
|
||||
.Pp
|
||||
The simple serial programmer described in Atmel's application note
|
||||
AVR910, and the bootloader described in Atmel's application note
|
||||
AVR109 (which is also used by the AVR Butterfly evaluation board), are
|
||||
supported on a serial port.
|
||||
.Pp
|
||||
Atmel's JTAG ICE (both mkI and mkII) is supported as well to up- or download memory
|
||||
Atmel's JTAG ICE (mkI, mkII, and 3) is supported as well to up- or download memory
|
||||
areas from/to an AVR target (no support for on-chip debugging).
|
||||
For the JTAG ICE mkII, JTAG, debugWire and ISP mode are supported.
|
||||
For the JTAG ICE mkII, JTAG, debugWire and ISP mode are supported, provided
|
||||
it has a firmware revision of at least 4.14 (decimal).
|
||||
JTAGICE3 also supports all of JTAG, debugWIRE, and ISP mode.
|
||||
See below for the limitations of debugWire.
|
||||
For ATxmega devices, the JTAG ICE mkII is supported in PDI mode, provided it
|
||||
has a revision 1 hardware and firmware version of at least 5.37 (decimal).
|
||||
For ATxmega devices, the JTAGICE3 is supported in PDI mode.
|
||||
.Pp
|
||||
The AVR Dragon is supported in all modes (ISP, JTAG, HVSP, PP, debugWire).
|
||||
When used in JTAG and debugWire mode, the AVR Dragon behaves similar to a
|
||||
@@ -126,12 +161,19 @@ In particular, the Dragon starts out with a rather fast ISP clock
|
||||
frequency, so the
|
||||
.Fl B Ar bitclock
|
||||
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).
|
||||
.Pp
|
||||
The USBasp ISP adapter is also supported, provided
|
||||
The avrftdi, USBasp ISP and USBtinyISP adapters are also supported, provided
|
||||
.Nm avrdude
|
||||
has been compiled with libusb support.
|
||||
It features a simple firwmare-only USB implementation, running on
|
||||
an ATmega8 (or ATmega88).
|
||||
USBasp ISP and USBtinyISP both feature simple firmware-only USB implementations,
|
||||
running on an ATmega8 (or ATmega88), or ATtiny2313, respectively. If libftdi has
|
||||
has been compiled in
|
||||
.Nm avrdude ,
|
||||
the avrftdi device adds support for many programmers using FTDI's 2232C/D/H
|
||||
and 4232H parts running in MPSSE mode, which hard-codes (in the chip)
|
||||
SCK to bit 1, MOSI to bit 2, and MISO to bit 3. Reset is usually bit 4.
|
||||
.Pp
|
||||
Input files can be provided, and output files can be written in
|
||||
different file formats, such as raw binary files containing the data
|
||||
@@ -143,6 +185,14 @@ as a standalone assembler, or
|
||||
.Xr avr-objcopy 1
|
||||
for the final stage of the GNU toolchain for the AVR microcontroller.
|
||||
.Pp
|
||||
Provided
|
||||
.Xr libelf 3
|
||||
was present when compiling
|
||||
.Nm avrdude ,
|
||||
the input file can also be the final ELF file as produced by the linker.
|
||||
The appropriate ELF section(s) will be examined, according to the memory
|
||||
area to write to.
|
||||
.Pp
|
||||
.Nm Avrdude
|
||||
can program the EEPROM and flash ROM memory cells of supported AVR
|
||||
parts. Where supported by the serial instruction set, fuse bits and
|
||||
@@ -160,7 +210,7 @@ been code-protected previously, of course) and store the data in a
|
||||
file. Finally, a ``terminal'' mode is available that allows one to
|
||||
interactively communicate with the MCU, and to display or program
|
||||
individual memory cells.
|
||||
On the STK500 programmer, several operational parameters (target supply
|
||||
On the STK500 and STK600 programmer, several operational parameters (target supply
|
||||
voltage, target Aref voltage, master clock) can be examined and changed
|
||||
from within terminal mode as well.
|
||||
.Ss Options
|
||||
@@ -176,65 +226,25 @@ It specifies the type of the MCU connected to the programmer. These are read fr
|
||||
does not know about a part that you have, simply add it to the config
|
||||
file (be sure and submit a patch back to the author so that it can be
|
||||
incorporated for the next version). See the sample config file for
|
||||
the format. Currently, the following MCU types are understood:
|
||||
the format.
|
||||
For currently supported MCU types use ? as partno, this will print a list of partno ids and official part names on the terminal. (Both can be used with the -p option.)
|
||||
.Pp
|
||||
.TS
|
||||
ll.
|
||||
\fBOption tag\fP \fBOfficial part name\fP
|
||||
c128 AT90CAN128
|
||||
pwm2 AT90PWM2
|
||||
pwm3 AT90PWM3
|
||||
1200 AT90S1200
|
||||
2313 AT90S2313
|
||||
2333 AT90S2333
|
||||
2343 AT90S2343 (*)
|
||||
4414 AT90S4414
|
||||
4433 AT90S4433
|
||||
4434 AT90S4434
|
||||
8515 AT90S8515
|
||||
8535 AT90S8535
|
||||
m103 ATmega103
|
||||
m128 ATmega128
|
||||
m1280 ATmega1280
|
||||
m1281 ATmega1281
|
||||
m16 ATmega16
|
||||
m161 ATmega161
|
||||
m162 ATmega162
|
||||
m163 ATmega163
|
||||
m164 ATmega164
|
||||
m169 ATmega169
|
||||
m2560 ATmega2560 (**)
|
||||
m2561 ATmega2561 (**)
|
||||
m32 ATmega32
|
||||
m324 ATmega324
|
||||
m329 ATmega329
|
||||
m3290 ATmega3290
|
||||
m48 ATmega48
|
||||
m64 ATmega64
|
||||
m640 ATmega640
|
||||
m644 ATmega644
|
||||
m649 ATmega649
|
||||
m6490 ATmega6490
|
||||
m8 ATmega8
|
||||
m8515 ATmega8515
|
||||
m8535 ATmega8535
|
||||
m88 ATmega88
|
||||
t12 ATtiny12
|
||||
t13 ATtiny13
|
||||
t15 ATtiny15
|
||||
t2313 ATtiny2313
|
||||
t25 ATtiny25
|
||||
t26 ATtiny26
|
||||
t45 ATtiny45
|
||||
t85 ATtiny85
|
||||
.TE
|
||||
.Bl -tag -width "(**) "
|
||||
.It "(*)"
|
||||
Following parts need special attention:
|
||||
.Bl -tag -width "ATmega1234"
|
||||
.It "AT90S1200"
|
||||
The ISP programming protocol of the AT90S1200 differs in subtle ways
|
||||
from that of other AVRs. Thus, not all programmers support this
|
||||
device. Known to work are all direct bitbang programmers, and all
|
||||
programmers talking the STK500v2 protocol.
|
||||
.It "AT90S2343"
|
||||
The AT90S2323 and ATtiny22 use the same algorithm.
|
||||
.It "(**)"
|
||||
.It "ATmega2560, ATmega2561"
|
||||
Flash addressing above 128 KB is not supported by all
|
||||
programming hardware. Known to work are jtag2, stk500v2,
|
||||
and bit-bang programmers.
|
||||
.It "ATtiny11"
|
||||
The ATtiny11 can only be
|
||||
programmed in high-voltage serial mode.
|
||||
.El
|
||||
.It Fl b Ar baudrate
|
||||
Override the RS-232 connection baud rate specified in the respective
|
||||
@@ -249,8 +259,12 @@ Unlike certain parameters in the STK500, the JTAG ICE resets all its
|
||||
parameters to default values when the programming software signs
|
||||
off from the ICE, so for MCUs running at lower clock speeds, this
|
||||
parameter must be specified on the command-line.
|
||||
You can use the 'default_bitclock' keyword in your
|
||||
.Pa ${HOME}/.avrduderc
|
||||
file to assign a default value to keep from having to specify this
|
||||
option on every invocation.
|
||||
.It Fl c Ar programmer-id
|
||||
Use the pin configuration specified by the argument. Pin
|
||||
Use the programmer specified by the argument. Programmers and their pin
|
||||
configurations are read from the config file (see the
|
||||
.Fl C
|
||||
option). New pin configurations can be easily added or modified
|
||||
@@ -262,6 +276,8 @@ keyword in your
|
||||
.Pa ${HOME}/.avrduderc
|
||||
file to assign a default programmer to keep from having to specify
|
||||
this option on every invocation.
|
||||
A full list of all supported programmers is output to the terminal
|
||||
by using ? as programmer-id.
|
||||
.It Fl C Ar config-file
|
||||
Use the specified config file to load configuration data. This file
|
||||
contains all programmer and part definitions that
|
||||
@@ -273,6 +289,16 @@ submit a patch back to the author so that it can be incorporated for
|
||||
the next version). See the config file, located at
|
||||
.Pa ${PREFIX}/etc/avrdude.conf ,
|
||||
which contains a description of the format.
|
||||
.Pp
|
||||
If
|
||||
.Ar config-file
|
||||
is written as
|
||||
.Pa +filename
|
||||
then this file is read after the system wide and user configuration
|
||||
files. This can be used to add entries to the configuration
|
||||
without patching your system wide configuration file. It can be used
|
||||
several times, the files are read in same order as given on the command
|
||||
line.
|
||||
.It Fl D
|
||||
Disable auto erase for flash. When the
|
||||
.Fl U
|
||||
@@ -281,11 +307,18 @@ option with flash memory is specified,
|
||||
will perform a chip erase before starting any of the programming
|
||||
operations, since it generally is a mistake to program the flash
|
||||
without performing an erase first. This option disables that.
|
||||
Auto erase is not used for ATxmega devices as these devices can
|
||||
use page erase before writing each page so no explicit chip erase
|
||||
is required.
|
||||
Note however that any page not affected by the current operation
|
||||
will retain its previous contents.
|
||||
.It Fl e
|
||||
Causes a chip erase to be executed. This will reset the contents of the
|
||||
flash ROM and EEPROM to the value
|
||||
.Ql 0xff ,
|
||||
and is basically a prerequisite command before the flash ROM can be
|
||||
and clear all lock bits.
|
||||
Except for ATxmega devices which can use page erase,
|
||||
it is basically a prerequisite command before the flash ROM can be
|
||||
reprogrammed again. The only exception would be if the new
|
||||
contents would exclusively cause bits to be programmed from the value
|
||||
.Ql 1
|
||||
@@ -339,6 +372,12 @@ power to the MCU.
|
||||
This option will pull the
|
||||
.Ql Vcc
|
||||
pins of the parallel port down at program exit.
|
||||
.It Ar d_high
|
||||
This option will leave the 8 data pins on the parallel port active.
|
||||
.Pq \&i. \&e. Em high
|
||||
.It Ar d_low
|
||||
This option will leave the 8 data pins on the parallel port inactive.
|
||||
.Pq \&i. \&e. Em low
|
||||
.El
|
||||
.Pp
|
||||
Multiple
|
||||
@@ -352,6 +391,12 @@ reasonable before continuing. Since it can happen from time to time
|
||||
that a device has a broken (erased or overwritten) device signature
|
||||
but is otherwise operating normally, this options is provided to
|
||||
override the check.
|
||||
Also, for programmers like the Atmel STK500 and STK600 which can
|
||||
adjust parameters local to the programming tool (independent of an
|
||||
actual connection to a target controller), this option can be used
|
||||
together with
|
||||
.Fl t
|
||||
to continue in terminal mode.
|
||||
.It Fl i Ar delay
|
||||
For bitbang-type programmers, delay for approximately
|
||||
.Ar delay
|
||||
@@ -370,6 +415,16 @@ is running.
|
||||
On Win32 operating systems, a preconfigured number of cycles per
|
||||
microsecond is assumed that might be off a bit for very fast or very
|
||||
slow machines.
|
||||
.It Fl l Ar logfile
|
||||
Use
|
||||
.Ar logfile
|
||||
rather than
|
||||
.Va stderr
|
||||
for diagnostics output.
|
||||
Note that initial diagnostic messages (during option parsing) are still
|
||||
written to
|
||||
.Va stderr
|
||||
anyway.
|
||||
.It Fl n
|
||||
No-write - disables actually writing data to the MCU (useful for debugging
|
||||
.Nm avrdude
|
||||
@@ -392,7 +447,15 @@ serial port, the
|
||||
port is the default. If you need to use a different parallel or
|
||||
serial port, use this option to specify the alternate port name.
|
||||
.Pp
|
||||
For the JTAG ICE mkII, if
|
||||
On Win32 operating systems, the parallel ports are referred to as lpt1
|
||||
through lpt3, referring to the addresses 0x378, 0x278, and 0x3BC,
|
||||
respectively. If the parallel port can be accessed through a different
|
||||
address, this address can be specified directly, using the common C
|
||||
language notation (i. e., hexadecimal values are prefixed by
|
||||
.Ql 0x
|
||||
).
|
||||
.Pp
|
||||
For the JTAG ICE mkII and JTAGICE3, if
|
||||
.Nm
|
||||
has been configured with libusb support,
|
||||
.Ar port
|
||||
@@ -400,7 +463,7 @@ can alternatively be specified as
|
||||
.Pa usb Ns Op \&: Ns Ar serialno .
|
||||
This will cause
|
||||
.Nm
|
||||
to search a JTAG ICE mkII on USB.
|
||||
to search the programmer on USB.
|
||||
If
|
||||
.Ar serialno
|
||||
is also specified, it will be matched against the serial number read
|
||||
@@ -418,6 +481,12 @@ be specified as
|
||||
Libusb support is required on Unix 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
|
||||
serial numbers, multiple devices can be distinguished by their
|
||||
location in the USB hierarchy. See the the respective
|
||||
.Em Troubleshooting
|
||||
entry in the detailed documentation for examples.
|
||||
.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
|
||||
@@ -462,6 +531,17 @@ 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
|
||||
@@ -499,6 +579,21 @@ The low fuse byte.
|
||||
The lock byte.
|
||||
.It signature
|
||||
The three device signature bytes (device ID).
|
||||
.It fuse Ns Em N
|
||||
The fuse bytes of ATxmega devices,
|
||||
.Em N
|
||||
is an integer number
|
||||
for each fuse supported by the device.
|
||||
.It application
|
||||
The application flash area of ATxmega devices.
|
||||
.It apptable
|
||||
The application table flash area of ATxmega devices.
|
||||
.It boot
|
||||
The boot flash area of ATxmega devices.
|
||||
.It prodsig
|
||||
The production signature (calibration) area of ATxmega devices.
|
||||
.It usersig
|
||||
The user signature area of ATxmega devices.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
@@ -529,6 +624,8 @@ Intel Hex
|
||||
Motorola S-record
|
||||
.It Ar r
|
||||
raw binary; little-endian byte order, in the case of the flash ROM data
|
||||
.It Ar e
|
||||
ELF (Executable and Linkable Format)
|
||||
.It Ar m
|
||||
immediate; actual byte values specified on the command line, separated
|
||||
by commas or spaces. This is good for programming fuse bytes without
|
||||
@@ -576,32 +673,18 @@ This will only work if
|
||||
does not have a colon in it.
|
||||
.It Fl v
|
||||
Enable verbose output.
|
||||
More
|
||||
.Fl v
|
||||
options increase verbosity level.
|
||||
.It Fl V
|
||||
Disable automatic verify check when uploading data.
|
||||
.It Fl y
|
||||
Tells
|
||||
.Nm
|
||||
to use the last four bytes of the connected parts' EEPROM memory to
|
||||
track the number of times the device has been erased. When this
|
||||
option is used and the
|
||||
.Fl e
|
||||
flag is specified to generate a chip erase, the previous counter will
|
||||
be saved before the chip erase, it is then incremented, and written
|
||||
back after the erase cycle completes. Presumably, the device would
|
||||
only be erased just before being programmed, and thus, this can be
|
||||
utilized to give an indication of how many erase-rewrite cycles the
|
||||
part has undergone. Since the FLASH memory can only endure a finite
|
||||
number of erase-rewrite cycles, one can use this option to track when
|
||||
a part is nearing the limit. The typical limit for Atmel AVR FLASH is
|
||||
1000 cycles. Of course, if the application needs the last four bytes
|
||||
of EEPROM memory, this option should not be used.
|
||||
.It Fl Y Ar cycles
|
||||
Instructs
|
||||
.Nm
|
||||
to initialize the erase-rewrite cycle counter residing at the last four
|
||||
bytes of EEPROM memory to the specified value. If the application
|
||||
needs the last four bytes of EEPROM memory, this option should not be
|
||||
used.
|
||||
.It Fl x Ar extended_param
|
||||
Pass
|
||||
.Ar extended_param
|
||||
to the chosen programmer implementation as an extended parameter.
|
||||
The interpretation of the extended parameter depends on the
|
||||
programmer itself.
|
||||
See below for a list of programmers accepting extended parameters.
|
||||
.El
|
||||
.Ss Terminal mode
|
||||
In this mode,
|
||||
@@ -642,26 +725,38 @@ feature of an AVR part that is not directly supported by
|
||||
.Nm ,
|
||||
this command allows you to use it, even though
|
||||
.Nm
|
||||
does not implement the command.
|
||||
does not implement the command. When using direct SPI mode, up to 3 bytes
|
||||
can be omitted.
|
||||
.It Ar sig
|
||||
Display the device signature bytes.
|
||||
.It Ar spi
|
||||
Enter direct SPI mode. The
|
||||
.Em pgmled
|
||||
pin acts as slave select.
|
||||
.Em Only supported on parallel bitbang programmers.
|
||||
.It Ar part
|
||||
Display the current part settings and parameters. Includes chip
|
||||
specific information including all memory types supported by the
|
||||
device, read/write timing, etc.
|
||||
.It Ar pgm
|
||||
Return to programming mode (from direct SPI mode).
|
||||
.It Ar vtarg voltage
|
||||
Set the target's supply voltage to
|
||||
.Ar voltage
|
||||
Volts.
|
||||
.Em Only supported on the STK500 programmer.
|
||||
.It Ar varef voltage
|
||||
.Em Only supported on the STK500 and STK600 programmer.
|
||||
.It Ar varef Oo Ar channel Oc Ar voltage
|
||||
Set the adjustable voltage source to
|
||||
.Ar voltage
|
||||
Volts.
|
||||
This voltage is normally used to drive the target's
|
||||
.Em Aref
|
||||
input on the STK500.
|
||||
.Em Only supported on the STK500 programmer.
|
||||
On the Atmel STK600, two reference voltages are available, which
|
||||
can be selected by the optional
|
||||
.Ar channel
|
||||
argument (either 0 or 1).
|
||||
.Em Only supported on the STK500 and STK600 programmer.
|
||||
.It Ar fosc freq Ns Op M Ns \&| Ns k
|
||||
Set the master oscillator to
|
||||
.Ar freq
|
||||
@@ -671,12 +766,12 @@ An optional trailing letter
|
||||
multiplies by 1E6, a trailing letter
|
||||
.Ar \&k
|
||||
by 1E3.
|
||||
.Em Only supported on the STK500 programmer.
|
||||
.Em Only supported on the STK500 and STK600 programmer.
|
||||
.It Ar fosc off
|
||||
Turn the master oscillator off.
|
||||
.Em Only supported on the STK500 programmer.
|
||||
.Em Only supported on the STK500 and STK600 programmer.
|
||||
.It Ar sck period
|
||||
.Em STK500 programmer only:
|
||||
.Em STK500 and STK600 programmer only:
|
||||
Set the SCK clock period to
|
||||
.Ar period
|
||||
microseconds.
|
||||
@@ -688,14 +783,21 @@ microseconds.
|
||||
Note that unlike STK500 settings, this setting will be reverted to
|
||||
its default value (approximately 1 microsecond) when the programming
|
||||
software signs off from the JTAG ICE.
|
||||
This parameter can also be used on the JTAG ICE mkII to specify the
|
||||
This parameter can also be used on the JTAG ICE mkII and JTAGICE3 to specify the
|
||||
ISP clock period when operating the ICE in ISP mode.
|
||||
.It Ar parms
|
||||
.Em STK500 programmer only:
|
||||
.Em STK500 and STK600 programmer only:
|
||||
Display the current voltage and master oscillator parameters.
|
||||
.Pp
|
||||
.Em JTAG ICE only:
|
||||
Display the current target supply voltage and JTAG bit clock rate/period.
|
||||
.It Ar verbose Op Ar level
|
||||
Change (when
|
||||
.Ar level
|
||||
is provided), or display the verbosity level.
|
||||
The initial verbosity level is controlled by the number of
|
||||
.Fl v
|
||||
options given on the commandline.
|
||||
.It Ar \&?
|
||||
.It Ar help
|
||||
Give a short on-line summary of the available commands.
|
||||
@@ -726,7 +828,7 @@ line.
|
||||
DebugWire mode is initiated by activating the
|
||||
.Ql DWEN
|
||||
fuse, and then power-cycling the target.
|
||||
While this mode is mainly intented for debugging/emulation, it
|
||||
While this mode is mainly intended for debugging/emulation, it
|
||||
also offers limited programming capabilities.
|
||||
Effectively, the only memory areas that can be read or programmed
|
||||
in this mode are flash ROM and EEPROM.
|
||||
@@ -744,6 +846,165 @@ be accessed using normal ISP programming.
|
||||
This sequence is automatically initiated by using the JTAG ICE mkII
|
||||
or AVR Dragon in ISP mode, when they detect that ISP mode cannot be
|
||||
entered.
|
||||
.Ss Programmers accepting extended parameters
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar JTAG ICE mkII
|
||||
.It Ar JTAGICE3
|
||||
.It Ar AVR Dragon
|
||||
When using the JTAG ICE mkII, JTAGICE3 or AVR Dragon in JTAG mode, the
|
||||
following extended parameter is accepted:
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar jtagchain=UB,UA,BB,BA
|
||||
Setup the JTAG scan chain for
|
||||
.Ar UB
|
||||
units before,
|
||||
.Ar UA
|
||||
units after,
|
||||
.Ar BB
|
||||
bits before, and
|
||||
.Ar BA
|
||||
bits after the target AVR, respectively.
|
||||
Each AVR unit within the chain shifts by 4 bits.
|
||||
Other JTAG units might require a different bit shift count.
|
||||
.El
|
||||
.It Ar AVR910
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar devcode=VALUE
|
||||
Override the device code selection by using
|
||||
.Ar VALUE
|
||||
as the device code.
|
||||
The programmer is not queried for the list of supported
|
||||
device codes, and the specified
|
||||
.Ar VALUE
|
||||
is not verified but used directly within the
|
||||
.Ql T
|
||||
command sent to the programmer.
|
||||
.Ar VALUE
|
||||
can be specified using the conventional number notation of the
|
||||
C programming language.
|
||||
.El
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar no_blockmode
|
||||
Disables the default checking for block transfer capability.
|
||||
Use
|
||||
.Ar no_blockmode
|
||||
only if your
|
||||
.Ar AVR910
|
||||
programmer creates errors during initial sequence.
|
||||
.El
|
||||
.It Ar buspirate
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar reset={cs,aux,aux2}
|
||||
The default setup assumes the BusPirate's CS output pin connected to
|
||||
the RESET pin on AVR side. It is however possible to have multiple AVRs
|
||||
connected to the same BP with MISO, MOSI and SCK lines common for all of them.
|
||||
In such a case one AVR should have its RESET connected to BusPirate's
|
||||
.Pa CS
|
||||
pin, second AVR's RESET connected to BusPirate's
|
||||
.Pa AUX
|
||||
pin and if your BusPirate has an
|
||||
.Pa AUX2
|
||||
pin (only available on BusPirate version v1a with firmware 3.0 or newer)
|
||||
use that to activate RESET on the third AVR.
|
||||
.Pp
|
||||
It may be a good idea to decouple the BusPirate and the AVR's SPI buses from
|
||||
each other using a 3-state bus buffer. For example 74HC125 or 74HC244 are some
|
||||
good candidates with the latches driven by the appropriate reset pin (cs,
|
||||
aux or aux2). Otherwise the SPI traffic in one active circuit may interfere
|
||||
with programming the AVR in the other design.
|
||||
.It Ar spifreq=<0..7>
|
||||
The SPI speed for the Bus Pirate's binary SPI mode:
|
||||
.Bd -literal
|
||||
0 .. 30 kHz (default)
|
||||
1 .. 125 kHz
|
||||
2 .. 250 kHz
|
||||
3 .. 1 MHz
|
||||
4 .. 2 MHz
|
||||
5 .. 2.6 MHz
|
||||
6 .. 4 MHz
|
||||
7 .. 8 MHz
|
||||
.Ed
|
||||
.It Ar rawfreq=<0..3>
|
||||
Sets the SPI speed and uses the Bus Pirate's binary "raw-wire" mode:
|
||||
.Bd -literal
|
||||
0 .. 5 kHz
|
||||
1 .. 50 kHz
|
||||
2 .. 100 kHz (Firmware v4.2+ only)
|
||||
3 .. 400 kHz (v4.2+)
|
||||
.Ed
|
||||
.Pp
|
||||
The only advantage of the "raw-wire" mode is the different SPI frequencies
|
||||
available. Paged writing is not implemented in this mode.
|
||||
.It Ar ascii
|
||||
Attempt to use ASCII mode even when the firmware supports BinMode (binary
|
||||
mode).
|
||||
BinMode is supported in firmware 2.7 and newer, older FW's either don't
|
||||
have BinMode or their BinMode is buggy. ASCII mode is slower and makes
|
||||
the above
|
||||
.Ar reset= , spifreq=
|
||||
and
|
||||
.Ar rawfreq=
|
||||
parameters unavailable. Be aware that ASCII mode is not guaranteed to work
|
||||
with newer firmware versions, and is retained only to maintain compatability
|
||||
with older firmware versions.
|
||||
.It Ar nopagedwrite
|
||||
Firmware versions 5.10 and newer support a binary mode SPI command that enables
|
||||
whole pages to be written to AVR flash memory at once, resulting in a
|
||||
significant write speed increase. If use of this mode is not desirable for some
|
||||
reason, this option disables it.
|
||||
.It Ar nopagedread
|
||||
Newer firmware versions support in binary mode SPI command some AVR Extended
|
||||
Commands. Using the "Bulk Memory Read from Flash" results in a
|
||||
significant read speed increase. If use of this mode is not desirable for some
|
||||
reason, this option disables it.
|
||||
.It Ar cpufreq=<125..4000>
|
||||
This sets the AUX pin to output a frequency of
|
||||
.Ar n
|
||||
kHz. Connecting
|
||||
the AUX pin to the XTAL1 pin of your MCU, you can provide it a clock,
|
||||
for example when it needs an external clock because of wrong fuses settings.
|
||||
This setting is only available in ASCII mode. (The lower limit was chosen so
|
||||
the CPU frequency is at least for four times the SPI frequency which is in
|
||||
ASCII mode 30kHz.)
|
||||
.It Ar serial_recv_timeout=<1...>
|
||||
This sets the serial receive timeout to the given value.
|
||||
The timeout happens every time avrdude waits for the BusPirate prompt.
|
||||
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 Wiring
|
||||
When using the Wiring programmer type, the
|
||||
following optional extended parameter is accepted:
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar snooze=<0..32767>
|
||||
After performing the port open phase, AVRDUDE will wait/snooze for
|
||||
.Ar snooze
|
||||
milliseconds before continuing to the protocol sync phase.
|
||||
No toggling of DTR/RTS is performed if
|
||||
.Ar snooze
|
||||
is greater than 0.
|
||||
.El
|
||||
.It Ar PICkit2
|
||||
Connection to the PICkit2 programmer:
|
||||
.Bd -literal
|
||||
(AVR) (PICkit2)
|
||||
RST - VPP/MCLR (1)
|
||||
VDD - VDD Target (2) -- possibly optional if AVR self powered
|
||||
GND - GND (3)
|
||||
MISO - PGD (4)
|
||||
SCLK - PDC (5)
|
||||
MOSI - AUX (6)
|
||||
|
||||
.Ed
|
||||
Extended commandline parameters:
|
||||
.Bl -tag -offset indent -width indent
|
||||
.It Ar clockrate=<rate>
|
||||
Sets the SPI clocking rate in Hz (default is 100kHz). Alternately the -B or -i options can be used to set the period.
|
||||
.It Ar timeout=<usb-transaction-timeout>
|
||||
Sets the timeout for USB reads and writes in milliseconds (default is 1500 ms).
|
||||
.El
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -offset indent -width /dev/ppi0XXX
|
||||
.It Pa /dev/ppi0
|
||||
@@ -789,6 +1050,7 @@ normal ISP communication.
|
||||
.Sh SEE ALSO
|
||||
.Xr avr-objcopy 1 ,
|
||||
.Xr ppi 4 ,
|
||||
.Xr libelf 3,
|
||||
.Xr readline 3
|
||||
.Pp
|
||||
The AVR microcontroller product description can be found at
|
||||
@@ -815,8 +1077,14 @@ Page-mode programming the EEPROM through JTAG (i.e. through an
|
||||
.Fl U
|
||||
option) requires a prior chip erase.
|
||||
This is an inherent feature of the way JTAG EEPROM programming works.
|
||||
This also applies to the STK500 in parallel programming mode.
|
||||
This also applies to the STK500 and STK600 in parallel programming mode.
|
||||
.Pp
|
||||
The USBasp driver does not offer any option to distinguish multiple
|
||||
The USBasp and USBtinyISP drivers do not offer any option to distinguish multiple
|
||||
devices connected simultaneously, so effectively only a single device
|
||||
is supported.
|
||||
.Pp
|
||||
The avrftdi driver allows 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
|
||||
devices can be on the bus at the same time. For the H parts, which have multiple MPSSE
|
||||
interfaces, the interface can also be selected. It defaults to interface 'A'.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -25,7 +24,6 @@
|
||||
extern char * progname; /* name of program, for messages */
|
||||
extern char progbuf[]; /* spaces same length as progname */
|
||||
|
||||
extern int do_cycles; /* track erase-rewrite cycles (-y) */
|
||||
extern int ovsigck; /* override signature check (-F) */
|
||||
extern int verbose; /* verbosity level (-v, -vv, ...) */
|
||||
extern int quell_progress; /* quiteness level (-q, -qq) */
|
||||
@@ -39,23 +37,18 @@ extern int quell_progress; /* quiteness level (-q, -qq) */
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* usleep replacements */
|
||||
/* sleep Windows in ms, Unix usleep in us
|
||||
#define usleep(us) Sleep((us)<20000?20:us/1000)
|
||||
#define usleep(us) Sleep(us/1000)
|
||||
#define ANTIWARP 3
|
||||
#define usleep(us) Sleep(us/1000*ANTIWARP)
|
||||
*/
|
||||
void usleep(unsigned long us);
|
||||
#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 /* HAVE_GETTIMEOFDAY */
|
||||
|
||||
#endif /* defined(WIN32NATIVE) */
|
||||
|
||||
#endif
|
||||
|
||||
1379
avrdude/avrftdi.c
Normal file
1379
avrdude/avrftdi.c
Normal file
File diff suppressed because it is too large
Load Diff
40
avrdude/avrftdi.h
Normal file
40
avrdude/avrftdi.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* avrftdi - extension for avrdude, Wolfgang Moser, Ville Voipio
|
||||
* Copyright (C) 2011 Hannes Weisbach, Doug Springer
|
||||
*
|
||||
* 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$ */
|
||||
|
||||
#ifndef avrftdi_h
|
||||
#define avrfdti_h
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
extern const char avrftdi_desc[];
|
||||
void avrftdi_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
89
avrdude/avrftdi_private.h
Normal file
89
avrdude/avrftdi_private.h
Normal file
@@ -0,0 +1,89 @@
|
||||
#pragma once
|
||||
#include "ac_cfg.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(HAVE_LIBFTDI1) && defined(HAVE_LIBUSB_1_0)
|
||||
# if defined(HAVE_LIBUSB_1_0_LIBUSB_H)
|
||||
# include <libusb-1.0/libusb.h>
|
||||
# else
|
||||
# include <libusb.h>
|
||||
# endif
|
||||
# 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 */
|
||||
#include <ftdi.h>
|
||||
#else
|
||||
#warning No libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.
|
||||
#define DO_NOT_BUILD_AVRFTDI
|
||||
#endif
|
||||
|
||||
#ifndef DO_NOT_BUILD_AVRFTDI
|
||||
|
||||
#include "pgm.h"
|
||||
#include "pindefs.h"
|
||||
|
||||
enum { ERR, WARN, INFO, DEBUG, TRACE };
|
||||
|
||||
#define __log(lvl, fmt, ...) \
|
||||
do { \
|
||||
avrftdi_log(lvl, __func__, __LINE__, fmt, ##__VA_ARGS__); \
|
||||
} while(0)
|
||||
|
||||
|
||||
#define log_err(fmt, ...) __log(ERR, fmt, ##__VA_ARGS__)
|
||||
#define log_warn(fmt, ...) __log(WARN, fmt, ##__VA_ARGS__)
|
||||
#define log_info(fmt, ...) __log(INFO, fmt, ##__VA_ARGS__)
|
||||
#define log_debug(fmt, ...) __log(DEBUG, fmt, ##__VA_ARGS__)
|
||||
#define log_trace(fmt, ...) __log(TRACE, fmt, ##__VA_ARGS__)
|
||||
|
||||
#define E(x, ftdi) \
|
||||
do { \
|
||||
if ((x)) \
|
||||
{ \
|
||||
fprintf(stderr, "%s:%d %s() %s: %s (%d)\n\t%s\n", \
|
||||
__FILE__, __LINE__, __FUNCTION__, \
|
||||
#x, strerror(errno), errno, ftdi_get_error_string(ftdi)); \
|
||||
return -1; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define E_VOID(x, ftdi) \
|
||||
do { \
|
||||
if ((x)) \
|
||||
{ \
|
||||
fprintf(stderr, "%s:%d %s() %s: %s (%d)\n\t%s\n", \
|
||||
__FILE__, __LINE__, __FUNCTION__, \
|
||||
#x, strerror(errno), errno, ftdi_get_error_string(ftdi)); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
||||
#define to_pdata(pgm) \
|
||||
((avrftdi_t *)((pgm)->cookie))
|
||||
|
||||
typedef struct avrftdi_s {
|
||||
/* pointer to struct maintained by libftdi to identify the device */
|
||||
struct ftdi_context* ftdic;
|
||||
/* bitmask of values for pins. bit 0 represents pin 0 ([A|B]DBUS0) */
|
||||
uint16_t pin_value;
|
||||
/* bitmask of pin direction. a '1' make a pin an output.
|
||||
* bit 0 corresponds to pin 0. */
|
||||
uint16_t pin_direction;
|
||||
/* don't know. not useful. someone put it in. */
|
||||
uint16_t led_mask;
|
||||
/* total number of pins supported by a programmer. varies with FTDI chips */
|
||||
int pin_limit;
|
||||
/* internal RX buffer of the device. needed for INOUT transfers */
|
||||
int rx_buffer_size;
|
||||
int tx_buffer_size;
|
||||
/* use bitbanging instead of mpsse spi */
|
||||
bool use_bitbanging;
|
||||
} avrftdi_t;
|
||||
|
||||
void avrftdi_log(int level, const char * func, int line, const char * fmt, ...);
|
||||
|
||||
#endif /* DO_NOT_BUILD_AVRFDTI */
|
||||
|
||||
256
avrdude/avrftdi_tpi.c
Normal file
256
avrdude/avrftdi_tpi.c
Normal file
@@ -0,0 +1,256 @@
|
||||
#include "ac_cfg.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "avr.h"
|
||||
#include "pgm.h"
|
||||
#include "avrpart.h"
|
||||
#include "pindefs.h"
|
||||
#include "tpi.h"
|
||||
#include "usbasp.h"
|
||||
|
||||
#include "avrftdi_tpi.h"
|
||||
#include "avrftdi_private.h"
|
||||
|
||||
#ifndef DO_NOT_BUILD_AVRFTDI
|
||||
|
||||
static void avrftdi_tpi_disable(PROGRAMMER *);
|
||||
static int avrftdi_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p);
|
||||
|
||||
#ifdef notyet
|
||||
static void
|
||||
avrftdi_debug_frame(uint16_t frame)
|
||||
{
|
||||
static char bit_name[] = "IDLES01234567PSS";
|
||||
//static char bit_name[] = "SSP76543210SELDI";
|
||||
char line0[34], line1[34], line2[34];
|
||||
int bit, pos;
|
||||
|
||||
for(bit = 0; bit < 16; bit++)
|
||||
{
|
||||
pos = 16 - bit - 1;
|
||||
if(frame & (1 << pos))
|
||||
{
|
||||
line0[2*pos] = '_';
|
||||
line0[2*pos+1] = ' ';
|
||||
|
||||
line2[2*pos] = ' ';
|
||||
line2[2*pos+1] = ' ';
|
||||
}
|
||||
else
|
||||
{
|
||||
line0[2*pos] = ' ';
|
||||
line0[2*pos+1] = ' ';
|
||||
|
||||
line2[2*pos] = '-';
|
||||
line2[2*pos+1] = ' ';
|
||||
}
|
||||
|
||||
line1[2*pos] = bit_name[pos];
|
||||
line1[2*pos+1] = ' ';
|
||||
|
||||
}
|
||||
|
||||
line0[32] = 0;
|
||||
line1[32] = 0;
|
||||
line2[32] = 0;
|
||||
|
||||
log_debug("%s\n", line0);
|
||||
log_debug("%s\n", line1);
|
||||
//log_debug("%s\n", line2);
|
||||
}
|
||||
#endif /* notyet */
|
||||
|
||||
int
|
||||
avrftdi_tpi_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
int ret;
|
||||
|
||||
avrftdi_t* pdata = to_pdata(pgm);
|
||||
unsigned char buf[] = { MPSSE_DO_WRITE | MPSSE_WRITE_NEG | MPSSE_LSB, 0x01, 0x00, 0xff, 0xff };
|
||||
|
||||
log_info("Using TPI interface\n");
|
||||
|
||||
pgm->program_enable = avrftdi_tpi_program_enable;
|
||||
pgm->cmd_tpi = avrftdi_cmd_tpi;
|
||||
pgm->chip_erase = avr_tpi_chip_erase;
|
||||
pgm->disable = avrftdi_tpi_disable;
|
||||
|
||||
pgm->paged_load = NULL;
|
||||
pgm->paged_write = NULL;
|
||||
|
||||
log_info("Setting /Reset pin low\n");
|
||||
pgm->setpin(pgm, PIN_AVR_RESET, OFF);
|
||||
pgm->setpin(pgm, PIN_AVR_SCK, OFF);
|
||||
pgm->setpin(pgm, PIN_AVR_MOSI, ON);
|
||||
usleep(20 * 1000);
|
||||
|
||||
pgm->setpin(pgm, PIN_AVR_RESET, ON);
|
||||
/* worst case 128ms */
|
||||
usleep(2 * 128 * 1000);
|
||||
|
||||
/*setting rst back to 0 */
|
||||
pgm->setpin(pgm, PIN_AVR_RESET, OFF);
|
||||
/*wait at least 20ms bevor issuing spi commands to avr */
|
||||
usleep(20 * 1000);
|
||||
|
||||
log_info("Sending 16 init clock cycles ...\n");
|
||||
ret = ftdi_write_data(pdata->ftdic, buf, sizeof(buf));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define TPI_PARITY_MASK 0x2000
|
||||
|
||||
static uint16_t
|
||||
tpi_byte2frame(uint8_t byte)
|
||||
{
|
||||
uint16_t frame = 0xc00f;
|
||||
int parity = __builtin_popcount(byte) & 1;
|
||||
|
||||
frame |= ((byte << 5) & 0x1fe0);
|
||||
|
||||
if(parity)
|
||||
frame |= TPI_PARITY_MASK;
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
static int
|
||||
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_rcvd = (frame & TPI_PARITY_MASK) ? 1 : 0;
|
||||
|
||||
return parity != parity_rcvd;
|
||||
}
|
||||
|
||||
#ifdef notyet
|
||||
static int
|
||||
avrftdi_tpi_break(PROGRAMMER * pgm)
|
||||
{
|
||||
unsigned char buffer[] = { MPSSE_DO_WRITE | MPSSE_WRITE_NEG | MPSSE_LSB, 1, 0, 0, 0 };
|
||||
E(ftdi_write_data(to_pdata(pgm)->ftdic, buffer, sizeof(buffer)) != sizeof(buffer), to_pdata(pgm)->ftdic);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* notyet */
|
||||
|
||||
static int
|
||||
avrftdi_tpi_write_byte(PROGRAMMER * pgm, unsigned char byte)
|
||||
{
|
||||
uint16_t frame;
|
||||
|
||||
struct ftdi_context* ftdic = to_pdata(pgm)->ftdic;
|
||||
|
||||
unsigned char buffer[] = { MPSSE_DO_WRITE | MPSSE_WRITE_NEG | MPSSE_LSB, 1, 0, 0, 0 };
|
||||
|
||||
frame = tpi_byte2frame(byte);
|
||||
|
||||
buffer[3] = frame & 0xff;
|
||||
buffer[4] = frame >> 8;
|
||||
|
||||
log_trace("Byte %02x, frame: %04x, MPSSE: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
|
||||
byte, frame, buffer[0], buffer[1], buffer[2], buffer[3], buffer[4]);
|
||||
|
||||
//avrftdi_debug_frame(frame);
|
||||
|
||||
E(ftdi_write_data(ftdic, buffer, sizeof(buffer)) != sizeof(buffer), ftdic);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define TPI_FRAME_SIZE 12
|
||||
#define TPI_IDLE_BITS 2
|
||||
|
||||
static int
|
||||
avrftdi_tpi_read_byte(PROGRAMMER * pgm, unsigned char * byte)
|
||||
{
|
||||
uint16_t frame;
|
||||
|
||||
/* use 2 guard bits, 2 default idle bits + 12 frame bits = 16 bits total */
|
||||
const int bytes = 3;
|
||||
int err, i = 0;
|
||||
|
||||
unsigned char buffer[4];
|
||||
|
||||
buffer[0] = MPSSE_DO_READ | MPSSE_LSB;
|
||||
buffer[1] = (bytes-1) & 0xff;
|
||||
buffer[2] = ((bytes-1) >> 8) & 0xff;
|
||||
buffer[3] = SEND_IMMEDIATE;
|
||||
|
||||
log_trace("MPSSE: 0x%02x 0x%02x 0x%02x 0x%02x (Read frame)\n",
|
||||
buffer[0], buffer[1], buffer[2], buffer[3]);
|
||||
|
||||
ftdi_write_data(to_pdata(pgm)->ftdic, buffer, 4);
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
|
||||
i = 0;
|
||||
do {
|
||||
int err = ftdi_read_data(to_pdata(pgm)->ftdic, &buffer[i], bytes - i);
|
||||
E(err < 0, to_pdata(pgm)->ftdic);
|
||||
i += err;
|
||||
} while(i < bytes);
|
||||
|
||||
|
||||
log_trace("MPSSE: 0x%02x 0x%02x 0x%02x 0x%02x (Read frame)\n",
|
||||
buffer[0], buffer[1], buffer[2], buffer[3]);
|
||||
|
||||
|
||||
frame = buffer[0] | (buffer[1] << 8);
|
||||
|
||||
err = tpi_frame2byte(frame, byte);
|
||||
log_trace("Frame: 0x%04x, byte: 0x%02x\n", frame, *byte);
|
||||
|
||||
//avrftdi_debug_frame(frame);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int
|
||||
avrftdi_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
return avr_tpi_program_enable(pgm, p, TPIPCR_GT_2b);
|
||||
}
|
||||
|
||||
int
|
||||
avrftdi_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd, int cmd_len,
|
||||
unsigned char *res, int res_len)
|
||||
{
|
||||
int i, err = 0;
|
||||
|
||||
for(i = 0; i < cmd_len; i++)
|
||||
{
|
||||
err = avrftdi_tpi_write_byte(pgm, cmd[i]);
|
||||
if(err)
|
||||
return err;
|
||||
}
|
||||
|
||||
for(i = 0; i < res_len; i++)
|
||||
{
|
||||
err = avrftdi_tpi_read_byte(pgm, &res[i]);
|
||||
if(err)
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
avrftdi_tpi_disable(PROGRAMMER * pgm)
|
||||
{
|
||||
unsigned char cmd[] = {TPI_OP_SSTCS(TPIPCR), 0};
|
||||
pgm->cmd_tpi(pgm, cmd, sizeof(cmd), NULL, 0);
|
||||
|
||||
log_info("Leaving Programming mode.\n");
|
||||
}
|
||||
|
||||
#endif /* DO_NOT_BUILD_AVRFTDI */
|
||||
|
||||
12
avrdude/avrftdi_tpi.h
Normal file
12
avrdude/avrftdi_tpi.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "pgm.h"
|
||||
#include "avrpart.h"
|
||||
|
||||
//int avrftdi_tpi_write_byte(PROGRAMMER * pgm, unsigned char byte);
|
||||
//int avrftdi_tpi_read_byte(PROGRAMMER * pgm, unsigned char * byte);
|
||||
int avrftdi_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd, int cmd_len,
|
||||
unsigned char *res, int res_len);
|
||||
int avrftdi_tpi_initialize(PROGRAMMER * pgm, AVRPART * p);
|
||||
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -47,6 +46,30 @@ OPCODE * avr_new_opcode(void)
|
||||
return m;
|
||||
}
|
||||
|
||||
static OPCODE * avr_dup_opcode(OPCODE * op)
|
||||
{
|
||||
OPCODE * m;
|
||||
|
||||
/* this makes life easier */
|
||||
if (op == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
m = (OPCODE *)malloc(sizeof(*m));
|
||||
if (m == NULL) {
|
||||
fprintf(stderr, "avr_dup_opcode(): out of memory\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
memcpy(m, op, sizeof(*m));
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
void avr_free_opcode(OPCODE * op)
|
||||
{
|
||||
free(op);
|
||||
}
|
||||
|
||||
/*
|
||||
* avr_set_bits()
|
||||
@@ -162,6 +185,27 @@ int avr_get_output(OPCODE * op, unsigned char * res, unsigned char * data)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* avr_get_output_index()
|
||||
*
|
||||
* Calculate the byte number of the output data based on the
|
||||
* opcode data.
|
||||
*/
|
||||
int avr_get_output_index(OPCODE * op)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i=0; i<32; i++) {
|
||||
if (op->bit[i].type == AVR_CMDBIT_OUTPUT) {
|
||||
j = 3 - i / 8;
|
||||
return j;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static char * avr_op_str(int op)
|
||||
{
|
||||
switch (op) {
|
||||
@@ -233,6 +277,12 @@ int avr_initmem(AVRPART * p)
|
||||
progname, m->desc, m->size);
|
||||
return -1;
|
||||
}
|
||||
m->tags = (unsigned char *) malloc(m->size);
|
||||
if (m->tags == NULL) {
|
||||
fprintf(stderr, "%s: can't alloc buffer for %s size of %d bytes\n",
|
||||
progname, m->desc, m->size);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -242,23 +292,62 @@ int avr_initmem(AVRPART * p)
|
||||
AVRMEM * avr_dup_mem(AVRMEM * m)
|
||||
{
|
||||
AVRMEM * n;
|
||||
int i;
|
||||
|
||||
n = avr_new_memtype();
|
||||
|
||||
*n = *m;
|
||||
|
||||
n->buf = (unsigned char *)malloc(n->size);
|
||||
if (n->buf == NULL) {
|
||||
fprintf(stderr,
|
||||
"avr_dup_mem(): out of memory (memsize=%d)\n",
|
||||
n->size);
|
||||
exit(1);
|
||||
if (m->buf != NULL) {
|
||||
n->buf = (unsigned char *)malloc(n->size);
|
||||
if (n->buf == NULL) {
|
||||
fprintf(stderr,
|
||||
"avr_dup_mem(): out of memory (memsize=%d)\n",
|
||||
n->size);
|
||||
exit(1);
|
||||
}
|
||||
memcpy(n->buf, m->buf, n->size);
|
||||
}
|
||||
|
||||
if (m->tags != NULL) {
|
||||
n->tags = (unsigned char *)malloc(n->size);
|
||||
if (n->tags == NULL) {
|
||||
fprintf(stderr,
|
||||
"avr_dup_mem(): out of memory (memsize=%d)\n",
|
||||
n->size);
|
||||
exit(1);
|
||||
}
|
||||
memcpy(n->tags, m->tags, n->size);
|
||||
}
|
||||
|
||||
for (i = 0; i < AVR_OP_MAX; i++) {
|
||||
n->op[i] = avr_dup_opcode(n->op[i]);
|
||||
}
|
||||
memset(n->buf, 0, n->size);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
void avr_free_mem(AVRMEM * m)
|
||||
{
|
||||
int i;
|
||||
if (m->buf != NULL) {
|
||||
free(m->buf);
|
||||
m->buf = NULL;
|
||||
}
|
||||
if (m->tags != NULL) {
|
||||
free(m->tags);
|
||||
m->tags = NULL;
|
||||
}
|
||||
for(i=0;i<sizeof(m->op)/sizeof(m->op[0]);i++)
|
||||
{
|
||||
if (m->op[i] != NULL)
|
||||
{
|
||||
avr_free_opcode(m->op[i]);
|
||||
m->op[i] = NULL;
|
||||
}
|
||||
}
|
||||
free(m);
|
||||
}
|
||||
|
||||
AVRMEM * avr_locate_mem(AVRPART * p, char * desc)
|
||||
{
|
||||
@@ -371,6 +460,7 @@ AVRPART * avr_new_part(void)
|
||||
p->lineno = 0;
|
||||
memset(p->signature, 0xFF, 3);
|
||||
p->ctl_stack_type = CTL_STACK_NONE;
|
||||
p->ocdrev = -1;
|
||||
|
||||
p->mem = lcreat(NULL, 0);
|
||||
|
||||
@@ -383,6 +473,7 @@ AVRPART * avr_dup_part(AVRPART * d)
|
||||
AVRPART * p;
|
||||
LISTID save;
|
||||
LNODEID ln;
|
||||
int i;
|
||||
|
||||
p = avr_new_part();
|
||||
save = p->mem;
|
||||
@@ -395,9 +486,28 @@ AVRPART * avr_dup_part(AVRPART * d)
|
||||
ladd(p->mem, avr_dup_mem(ldata(ln)));
|
||||
}
|
||||
|
||||
for (i = 0; i < AVR_OP_MAX; i++) {
|
||||
p->op[i] = avr_dup_opcode(p->op[i]);
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void avr_free_part(AVRPART * d)
|
||||
{
|
||||
int i;
|
||||
ldestroy_cb(d->mem, (void(*)(void *))avr_free_mem);
|
||||
d->mem = NULL;
|
||||
for(i=0;i<sizeof(d->op)/sizeof(d->op[0]);i++)
|
||||
{
|
||||
if (d->op[i] != NULL)
|
||||
{
|
||||
avr_free_opcode(d->op[i]);
|
||||
d->op[i] = NULL;
|
||||
}
|
||||
}
|
||||
free(d);
|
||||
}
|
||||
|
||||
AVRPART * locate_part(LISTID parts, char * partdesc)
|
||||
{
|
||||
@@ -455,6 +565,24 @@ void walk_avrparts(LISTID avrparts, walk_avrparts_cb cb, void *cookie)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare function to sort the list of programmers
|
||||
*/
|
||||
static int sort_avrparts_compare(AVRPART * p1,AVRPART * p2)
|
||||
{
|
||||
if(p1 == NULL || p2 == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return strncasecmp(p1->desc,p2->desc,AVR_DESCLEN);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sort the list of programmers given as "programmers"
|
||||
*/
|
||||
void sort_avrparts(LISTID avrparts)
|
||||
{
|
||||
lsort(avrparts,(int (*)(void*, void*)) sort_avrparts_compare);
|
||||
}
|
||||
|
||||
|
||||
static char * reset_disp_str(int r)
|
||||
@@ -467,18 +595,6 @@ static char * reset_disp_str(int r)
|
||||
}
|
||||
|
||||
|
||||
static char * pin_name(int pinno)
|
||||
{
|
||||
switch (pinno) {
|
||||
case PIN_AVR_RESET : return "RESET";
|
||||
case PIN_AVR_MISO : return "MISO";
|
||||
case PIN_AVR_MOSI : return "MOSI";
|
||||
case PIN_AVR_SCK : return "SCK";
|
||||
default : return "<unknown>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose)
|
||||
{
|
||||
int i;
|
||||
@@ -488,28 +604,28 @@ void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose)
|
||||
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",
|
||||
"%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, pin_name(p->retry_pulse),
|
||||
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",
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -88,12 +87,21 @@ typedef struct opcode {
|
||||
#define AVRPART_ALLOWFULLPAGEBITSTREAM 0x0010 /* JTAG ICE mkII param. */
|
||||
#define AVRPART_ENABLEPAGEPROGRAMMING 0x0020 /* JTAG ICE mkII param. */
|
||||
#define AVRPART_HAS_DW 0x0040 /* part has a debugWire i/f */
|
||||
#define AVRPART_HAS_PDI 0x0080 /* part has PDI i/f rather than ISP (ATxmega) */
|
||||
#define AVRPART_AVR32 0x0100 /* part is in AVR32 family */
|
||||
#define AVRPART_INIT_SMC 0x0200 /* part will undergo chip erase */
|
||||
#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 AVR_DESCLEN 64
|
||||
#define AVR_IDLEN 32
|
||||
#define CTL_STACK_SIZE 32
|
||||
#define FLASH_INSTR_SIZE 3
|
||||
#define EEPROM_INSTR_SIZE 20
|
||||
|
||||
#define TAG_ALLOCATED 1 /* memory byte is allocated */
|
||||
|
||||
typedef struct avrpart {
|
||||
char desc[AVR_DESCLEN]; /* long part name */
|
||||
char id[AVR_IDLEN]; /* short part name */
|
||||
@@ -147,6 +155,9 @@ typedef struct avrpart {
|
||||
unsigned char rampz; /* JTAG ICE mkII XML file parameter */
|
||||
unsigned char spmcr; /* JTAG ICE mkII XML file parameter */
|
||||
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 */
|
||||
int ocdrev; /* OCD revision (JTAGICE3 parameter, from AS6 XML files) */
|
||||
|
||||
OPCODE * op[AVR_OP_MAX]; /* opcodes */
|
||||
|
||||
@@ -162,12 +173,13 @@ typedef struct avrmem {
|
||||
int size; /* total memory size in bytes */
|
||||
int page_size; /* size of memory page (if page addressed) */
|
||||
int num_pages; /* number of pages (if page addressed) */
|
||||
unsigned int offset; /* offset in IO memory (ATxmega) */
|
||||
int min_write_delay; /* microseconds */
|
||||
int max_write_delay; /* microseconds */
|
||||
int pwroff_after_write; /* after this memory type is written to,
|
||||
the device must be powered off and
|
||||
back on, see errata
|
||||
http://www.atmel.com/atmel/acrobat/doc1280.pdf */
|
||||
http://www.atmel.com/dyn/resources/prod_documents/doc1280.pdf */
|
||||
unsigned char readback[2]; /* polled read-back values */
|
||||
|
||||
int mode; /* stk500 v2 xml file parameter */
|
||||
@@ -177,6 +189,7 @@ typedef struct avrmem {
|
||||
int pollindex; /* stk500 v2 xml file parameter */
|
||||
|
||||
unsigned char * buf; /* pointer to memory buffer */
|
||||
unsigned char * tags; /* allocation tags */
|
||||
OPCODE * op[AVR_OP_MAX]; /* opcodes */
|
||||
} AVRMEM;
|
||||
|
||||
@@ -186,15 +199,18 @@ extern "C" {
|
||||
|
||||
/* Functions for OPCODE structures */
|
||||
OPCODE * avr_new_opcode(void);
|
||||
void avr_free_opcode(OPCODE * op);
|
||||
int avr_set_bits(OPCODE * op, unsigned char * cmd);
|
||||
int avr_set_addr(OPCODE * op, unsigned char * cmd, unsigned long addr);
|
||||
int avr_set_input(OPCODE * op, unsigned char * cmd, unsigned char data);
|
||||
int avr_get_output(OPCODE * op, unsigned char * res, unsigned char * data);
|
||||
int avr_get_output_index(OPCODE * op);
|
||||
|
||||
/* Functions for AVRMEM structures */
|
||||
AVRMEM * avr_new_memtype(void);
|
||||
int avr_initmem(AVRPART * p);
|
||||
AVRMEM * avr_dup_mem(AVRMEM * m);
|
||||
void avr_free_mem(AVRMEM * m);
|
||||
AVRMEM * avr_locate_mem(AVRPART * p, char * desc);
|
||||
void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, int type,
|
||||
int verbose);
|
||||
@@ -202,6 +218,7 @@ void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, int type,
|
||||
/* Functions for AVRPART structures */
|
||||
AVRPART * avr_new_part(void);
|
||||
AVRPART * avr_dup_part(AVRPART * d);
|
||||
void avr_free_part(AVRPART * d);
|
||||
AVRPART * locate_part(LISTID parts, char * partdesc);
|
||||
AVRPART * locate_part_by_avr910_devcode(LISTID parts, int devcode);
|
||||
void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose);
|
||||
@@ -209,8 +226,8 @@ void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose);
|
||||
typedef void (*walk_avrparts_cb)(const char *name, const char *desc,
|
||||
const char *cfgname, int cfglineno,
|
||||
void *cookie);
|
||||
void walk_avrparts(LISTID programmers, walk_avrparts_cb cb, void *cookie);
|
||||
|
||||
void walk_avrparts(LISTID avrparts, walk_avrparts_cb cb, void *cookie);
|
||||
void sort_avrparts(LISTID avrparts);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,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) 2011 Darell Tan <darell.tan@gmail.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
|
||||
@@ -14,8 +15,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
@@ -39,10 +39,14 @@
|
||||
#include "pgm.h"
|
||||
#include "par.h"
|
||||
#include "serbb.h"
|
||||
#include "tpi.h"
|
||||
|
||||
static int delay_decrement;
|
||||
|
||||
#if !defined(WIN32NATIVE)
|
||||
#if defined(WIN32NATIVE)
|
||||
static int has_perfcount;
|
||||
static LARGE_INTEGER freq;
|
||||
#else
|
||||
static volatile int done;
|
||||
|
||||
typedef void (*mysighandler_t)(int);
|
||||
@@ -53,22 +57,44 @@ static void alarmhandler(int signo)
|
||||
done = 1;
|
||||
signal(SIGALRM, saved_alarmhandler);
|
||||
}
|
||||
#endif /* !WIN32NATIVE */
|
||||
#endif /* WIN32NATIVE */
|
||||
|
||||
/*
|
||||
* Calibrate the microsecond delay loop below.
|
||||
*/
|
||||
static void bitbang_calibrate_delay(void)
|
||||
{
|
||||
/*
|
||||
* Right now, we don't have any Win32 implementation for this, so we
|
||||
* can only run on a preconfigured delay stepping there. The figure
|
||||
* below should at least be correct within an order of magnitude,
|
||||
* judging from the auto-calibration figures seen on various Unix
|
||||
* systems on comparable hardware.
|
||||
*/
|
||||
#if defined(WIN32NATIVE)
|
||||
delay_decrement = 100;
|
||||
/*
|
||||
* If the hardware supports a high-resolution performance counter,
|
||||
* we ultimately prefer that one, as it gives quite accurate delays
|
||||
* on modern high-speed CPUs.
|
||||
*/
|
||||
if (QueryPerformanceFrequency(&freq))
|
||||
{
|
||||
has_perfcount = 1;
|
||||
if (verbose >= 2)
|
||||
fprintf(stderr,
|
||||
"%s: Using performance counter for bitbang delays\n",
|
||||
progname);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* If a high-resolution performance counter is not available, we
|
||||
* don't have any Win32 implementation for setting up the
|
||||
* per-microsecond delay count, so we can only run on a
|
||||
* preconfigured delay stepping there. The figure below should at
|
||||
* least be correct within an order of magnitude, judging from the
|
||||
* auto-calibration figures seen on various Unix systems on
|
||||
* comparable hardware.
|
||||
*/
|
||||
if (verbose >= 2)
|
||||
fprintf(stderr,
|
||||
"%s: Using guessed per-microsecond delay count for bitbang delays\n",
|
||||
progname);
|
||||
delay_decrement = 100;
|
||||
}
|
||||
#else /* !WIN32NATIVE */
|
||||
struct itimerval itv;
|
||||
volatile int i;
|
||||
@@ -116,10 +142,27 @@ static void bitbang_calibrate_delay(void)
|
||||
*/
|
||||
void bitbang_delay(int us)
|
||||
{
|
||||
#if defined(WIN32NATIVE)
|
||||
LARGE_INTEGER countNow, countEnd;
|
||||
|
||||
if (has_perfcount)
|
||||
{
|
||||
QueryPerformanceCounter(&countNow);
|
||||
countEnd.QuadPart = countNow.QuadPart + freq.QuadPart * us / 1000000ll;
|
||||
|
||||
while (countNow.QuadPart < countEnd.QuadPart)
|
||||
QueryPerformanceCounter(&countNow);
|
||||
}
|
||||
else /* no performance counters -- run normal uncalibrated delay */
|
||||
{
|
||||
#endif /* WIN32NATIVE */
|
||||
volatile int del = us * delay_decrement;
|
||||
|
||||
while (del > 0)
|
||||
del--;
|
||||
#if defined(WIN32NATIVE)
|
||||
}
|
||||
#endif /* WIN32NATIVE */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -170,6 +213,93 @@ static unsigned char bitbang_txrx(PROGRAMMER * pgm, unsigned char byte)
|
||||
return rbyte;
|
||||
}
|
||||
|
||||
static int bitbang_tpi_clk(PROGRAMMER * pgm)
|
||||
{
|
||||
unsigned char r = 0;
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_AVR_SCK], 1);
|
||||
|
||||
r = pgm->getpin(pgm, pgm->pinno[PIN_AVR_MISO]);
|
||||
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_AVR_SCK], 0);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void bitbang_tpi_tx(PROGRAMMER * pgm, unsigned char byte)
|
||||
{
|
||||
int i;
|
||||
unsigned char b, parity;
|
||||
|
||||
/* start bit */
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_AVR_MOSI], 0);
|
||||
bitbang_tpi_clk(pgm);
|
||||
|
||||
parity = 0;
|
||||
for (i = 0; i <= 7; i++) {
|
||||
b = (byte >> i) & 0x01;
|
||||
parity ^= b;
|
||||
|
||||
/* set the data input line as desired */
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_AVR_MOSI], b);
|
||||
bitbang_tpi_clk(pgm);
|
||||
}
|
||||
|
||||
/* parity bit */
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_AVR_MOSI], parity);
|
||||
bitbang_tpi_clk(pgm);
|
||||
|
||||
/* 2 stop bits */
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_AVR_MOSI], 1);
|
||||
bitbang_tpi_clk(pgm);
|
||||
bitbang_tpi_clk(pgm);
|
||||
}
|
||||
|
||||
int bitbang_tpi_rx(PROGRAMMER * pgm)
|
||||
{
|
||||
int i;
|
||||
unsigned char b, rbyte, parity;
|
||||
|
||||
/* make sure pin is on for "pullup" */
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_AVR_MOSI], 1);
|
||||
|
||||
/* wait for start bit (up to 10 bits) */
|
||||
b = 1;
|
||||
for (i = 0; i < 10; i++) {
|
||||
b = bitbang_tpi_clk(pgm);
|
||||
if (b == 0)
|
||||
break;
|
||||
}
|
||||
if (b != 0) {
|
||||
fprintf(stderr, "bitbang_tpi_rx: start bit not received correctly\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
rbyte = 0;
|
||||
parity = 0;
|
||||
for (i=0; i<=7; i++) {
|
||||
b = bitbang_tpi_clk(pgm);
|
||||
parity ^= b;
|
||||
|
||||
rbyte |= b << i;
|
||||
}
|
||||
|
||||
/* parity bit */
|
||||
if (bitbang_tpi_clk(pgm) != parity) {
|
||||
fprintf(stderr, "bitbang_tpi_rx: parity bit is wrong\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* 2 stop bits */
|
||||
b = 1;
|
||||
b &= bitbang_tpi_clk(pgm);
|
||||
b &= bitbang_tpi_clk(pgm);
|
||||
if (b != 1) {
|
||||
fprintf(stderr, "bitbang_tpi_rx: stop bits not received correctly\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return rbyte;
|
||||
}
|
||||
|
||||
int bitbang_rdy_led(PROGRAMMER * pgm, int value)
|
||||
{
|
||||
@@ -200,8 +330,8 @@ int bitbang_vfy_led(PROGRAMMER * pgm, int value)
|
||||
* transmit an AVR device command and return the results; 'cmd' and
|
||||
* 'res' must point to at least a 4 byte data buffer
|
||||
*/
|
||||
int bitbang_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4])
|
||||
int bitbang_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -225,6 +355,77 @@ int bitbang_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bitbang_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
int cmd_len, unsigned char *res, int res_len)
|
||||
{
|
||||
int i, r;
|
||||
|
||||
pgm->pgm_led(pgm, ON);
|
||||
|
||||
for (i=0; i<cmd_len; i++) {
|
||||
bitbang_tpi_tx(pgm, cmd[i]);
|
||||
}
|
||||
|
||||
r = 0;
|
||||
for (i=0; i<res_len; i++) {
|
||||
r = bitbang_tpi_rx(pgm);
|
||||
if (r == -1)
|
||||
break;
|
||||
res[i] = r;
|
||||
}
|
||||
|
||||
if(verbose >= 2)
|
||||
{
|
||||
fprintf(stderr, "bitbang_cmd_tpi(): [ ");
|
||||
for(i = 0; i < cmd_len; i++)
|
||||
fprintf(stderr, "%02X ", cmd[i]);
|
||||
fprintf(stderr, "] [ ");
|
||||
for(i = 0; i < res_len; i++)
|
||||
{
|
||||
fprintf(stderr, "%02X ", res[i]);
|
||||
}
|
||||
fprintf(stderr, "]\n");
|
||||
}
|
||||
|
||||
pgm->pgm_led(pgm, OFF);
|
||||
if (r == -1)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* transmit bytes via SPI and return the results; 'cmd' and
|
||||
* 'res' must point to data buffers
|
||||
*/
|
||||
int bitbang_spi(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res, int count)
|
||||
{
|
||||
int i;
|
||||
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_LED_PGM], 0);
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
res[i] = bitbang_txrx(pgm, cmd[i]);
|
||||
}
|
||||
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_LED_PGM], 1);
|
||||
|
||||
if(verbose >= 2)
|
||||
{
|
||||
fprintf(stderr, "bitbang_cmd(): [ ");
|
||||
for(i = 0; i < count; i++)
|
||||
fprintf(stderr, "%02X ", cmd[i]);
|
||||
fprintf(stderr, "] [ ");
|
||||
for(i = 0; i < count; i++)
|
||||
{
|
||||
fprintf(stderr, "%02X ", res[i]);
|
||||
}
|
||||
fprintf(stderr, "]\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* issue the 'chip erase' command to the AVR device
|
||||
@@ -233,6 +434,39 @@ int bitbang_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
unsigned char cmd[4];
|
||||
unsigned char res[4];
|
||||
AVRMEM *mem;
|
||||
|
||||
if (p->flags & AVRPART_HAS_TPI) {
|
||||
pgm->pgm_led(pgm, ON);
|
||||
|
||||
while (avr_tpi_poll_nvmbsy(pgm));
|
||||
|
||||
/* NVMCMD <- CHIP_ERASE */
|
||||
bitbang_tpi_tx(pgm, TPI_CMD_SOUT | TPI_SIO_ADDR(TPI_IOREG_NVMCMD));
|
||||
bitbang_tpi_tx(pgm, TPI_NVMCMD_CHIP_ERASE); /* CHIP_ERASE */
|
||||
|
||||
/* Set Pointer Register */
|
||||
mem = avr_locate_mem(p, "flash");
|
||||
if (mem == NULL) {
|
||||
fprintf(stderr, "No flash memory to erase for part %s\n",
|
||||
p->desc);
|
||||
return -1;
|
||||
}
|
||||
bitbang_tpi_tx(pgm, TPI_CMD_SSTPR | 0);
|
||||
bitbang_tpi_tx(pgm, (mem->offset & 0xFF) | 1); /* high byte */
|
||||
bitbang_tpi_tx(pgm, TPI_CMD_SSTPR | 1);
|
||||
bitbang_tpi_tx(pgm, (mem->offset >> 8) & 0xFF);
|
||||
|
||||
/* write dummy value to start erase */
|
||||
bitbang_tpi_tx(pgm, TPI_CMD_SST);
|
||||
bitbang_tpi_tx(pgm, 0xFF);
|
||||
|
||||
while (avr_tpi_poll_nvmbsy(pgm));
|
||||
|
||||
pgm->pgm_led(pgm, OFF);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (p->op[AVR_OP_CHIP_ERASE] == NULL) {
|
||||
fprintf(stderr, "chip erase instruction not defined for part \"%s\"\n",
|
||||
@@ -261,6 +495,19 @@ int bitbang_program_enable(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
unsigned char cmd[4];
|
||||
unsigned char res[4];
|
||||
int i;
|
||||
|
||||
if (p->flags & AVRPART_HAS_TPI) {
|
||||
/* enable NVM programming */
|
||||
bitbang_tpi_tx(pgm, TPI_CMD_SKEY);
|
||||
for (i = sizeof(tpi_skey) - 1; i >= 0; i--)
|
||||
bitbang_tpi_tx(pgm, tpi_skey[i]);
|
||||
|
||||
/* check NVMEN bit */
|
||||
bitbang_tpi_tx(pgm, TPI_CMD_SLDCS | TPI_REG_TPISR);
|
||||
i = bitbang_tpi_rx(pgm);
|
||||
return (i != -1 && (i & TPI_REG_TPISR_NVMEN)) ? 0 : -2;
|
||||
}
|
||||
|
||||
if (p->op[AVR_OP_PGM_ENABLE] == NULL) {
|
||||
fprintf(stderr, "program enable instruction not defined for part \"%s\"\n",
|
||||
@@ -285,17 +532,68 @@ int bitbang_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
int rc;
|
||||
int tries;
|
||||
int i;
|
||||
|
||||
bitbang_calibrate_delay();
|
||||
|
||||
pgm->powerup(pgm);
|
||||
usleep(20000);
|
||||
|
||||
/* TPIDATA is a single line, so MISO & MOSI should be connected */
|
||||
if (p->flags & AVRPART_HAS_TPI) {
|
||||
/* make sure cmd_tpi() is defined */
|
||||
if (pgm->cmd_tpi == NULL) {
|
||||
fprintf(stderr, "%s: Error: %s programmer does not support TPI\n",
|
||||
progname, pgm->type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* bring RESET high first */
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_AVR_RESET], 1);
|
||||
usleep(1000);
|
||||
|
||||
if (verbose >= 2)
|
||||
fprintf(stderr, "doing MOSI-MISO link check\n");
|
||||
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_AVR_MOSI], 0);
|
||||
if (pgm->getpin(pgm, pgm->pinno[PIN_AVR_MISO]) != 0) {
|
||||
fprintf(stderr, "MOSI->MISO 0 failed\n");
|
||||
return -1;
|
||||
}
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_AVR_MOSI], 1);
|
||||
if (pgm->getpin(pgm, pgm->pinno[PIN_AVR_MISO]) != 1) {
|
||||
fprintf(stderr, "MOSI->MISO 1 failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (verbose >= 2)
|
||||
fprintf(stderr, "MOSI-MISO link present\n");
|
||||
}
|
||||
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_AVR_SCK], 0);
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_AVR_RESET], 0);
|
||||
usleep(20000);
|
||||
|
||||
pgm->highpulsepin(pgm, pgm->pinno[PIN_AVR_RESET]);
|
||||
if (p->flags & AVRPART_HAS_TPI) {
|
||||
/* keep TPIDATA high for 16 clock cycles */
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_AVR_MOSI], 1);
|
||||
for (i = 0; i < 16; i++)
|
||||
pgm->highpulsepin(pgm, pgm->pinno[PIN_AVR_SCK]);
|
||||
|
||||
/* remove extra guard timing bits */
|
||||
bitbang_tpi_tx(pgm, TPI_CMD_SSTCS | TPI_REG_TPIPCR);
|
||||
bitbang_tpi_tx(pgm, 0x7);
|
||||
|
||||
/* read TPI ident reg */
|
||||
bitbang_tpi_tx(pgm, TPI_CMD_SLDCS | TPI_REG_TPIIR);
|
||||
rc = bitbang_tpi_rx(pgm);
|
||||
if (rc != 0x80) {
|
||||
fprintf(stderr, "TPIIR not correct\n");
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
pgm->highpulsepin(pgm, pgm->pinno[PIN_AVR_RESET]);
|
||||
}
|
||||
|
||||
usleep(20000); /* 20 ms XXX should be a per-chip parameter */
|
||||
|
||||
@@ -307,7 +605,7 @@ int bitbang_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
* order to possibly get back into sync with the chip if we are out
|
||||
* of sync.
|
||||
*/
|
||||
if (strcmp(p->desc, "AT90S1200")==0) {
|
||||
if (p->flags & AVRPART_IS_AT90S1200) {
|
||||
pgm->program_enable(pgm, p);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -2,6 +2,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) 2011 Darell Tan <darell.tan@gmail.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
|
||||
@@ -14,8 +15,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
@@ -37,8 +37,12 @@ int bitbang_rdy_led (PROGRAMMER * pgm, int value);
|
||||
int bitbang_err_led (PROGRAMMER * pgm, int value);
|
||||
int bitbang_pgm_led (PROGRAMMER * pgm, int value);
|
||||
int bitbang_vfy_led (PROGRAMMER * pgm, int value);
|
||||
int bitbang_cmd (PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4]);
|
||||
int bitbang_cmd (PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res);
|
||||
int bitbang_cmd_tpi (PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
int cmd_len, unsigned char *res, int res_len);
|
||||
int bitbang_spi (PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res, int count);
|
||||
int bitbang_chip_erase (PROGRAMMER * pgm, AVRPART * p);
|
||||
int bitbang_program_enable (PROGRAMMER * pgm, AVRPART * p);
|
||||
void bitbang_powerup (PROGRAMMER * pgm);
|
||||
|
||||
@@ -1,37 +1,10 @@
|
||||
#! /bin/sh
|
||||
|
||||
# autoconf-2.59 is required
|
||||
|
||||
: ${AUTOHEADER="autoheader${AC_VER}"}
|
||||
: ${AUTOCONF="autoconf${AC_VER}"}
|
||||
|
||||
# automake-1.9.x is required
|
||||
|
||||
: ${ACLOCAL="aclocal${AM_VER}"}
|
||||
: ${AUTOMAKE="automake${AM_VER}"}
|
||||
|
||||
# Verify autoconf version
|
||||
|
||||
AUTOCONF_VER=`(${AUTOCONF} --version 2>/dev/null | head -n 1 | \
|
||||
cut -d ' ' -f 4) 2>/dev/null`
|
||||
if [ "$AUTOCONF_VER" != "2.59" ]
|
||||
then
|
||||
echo "You need to use autoconf version 2.59."
|
||||
echo "You are using `${AUTOCONF} --version | head -n 1`."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify automake version
|
||||
|
||||
AUTOMAKE_VER=`(${AUTOMAKE} --version | head -n 1 | \
|
||||
cut -d ' ' -f 4 | cut -d '.' -f -2) 2>/dev/null`
|
||||
if [ "$AUTOMAKE_VER" != "1.9" ]
|
||||
then
|
||||
echo "You need to use automake version 1.9."
|
||||
echo "You are using `${AUTOMAKE} --version | head -n 1`."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export ACLOCAL AUTOHEADER AUTOCONF AUTOMAKE
|
||||
|
||||
# Bootstrap the build system.
|
||||
|
||||
1315
avrdude/buspirate.c
Normal file
1315
avrdude/buspirate.c
Normal file
File diff suppressed because it is too large
Load Diff
32
avrdude/buspirate.h
Normal file
32
avrdude/buspirate.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
*
|
||||
* avrdude support for The Bus Pirate - universal serial interface
|
||||
*
|
||||
* Copyright (C) 2009 Michal Ludvig <mludvig@logix.net.nz>
|
||||
*
|
||||
* 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$ */
|
||||
|
||||
#ifndef buspirate_h
|
||||
#define buspirate_h
|
||||
|
||||
extern const char buspirate_desc[];
|
||||
extern const char buspirate_bb_desc[];
|
||||
void buspirate_initpgm (struct programmer_t *pgm);
|
||||
void buspirate_bb_initpgm (struct programmer_t *pgm);
|
||||
|
||||
#endif
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2003-2004 Theodore A. Roth <troth@openavr.org>
|
||||
* Copyright (C) 2005 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
* Copyright (C) 2005, 2007 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
|
||||
@@ -14,8 +14,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -43,6 +42,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "avr.h"
|
||||
@@ -50,23 +50,35 @@
|
||||
#include "butterfly.h"
|
||||
#include "serial.h"
|
||||
|
||||
static char has_auto_incr_addr;
|
||||
static unsigned buffersize = 0;
|
||||
/*
|
||||
* Private data for this programmer.
|
||||
*/
|
||||
struct pdata
|
||||
{
|
||||
char has_auto_incr_addr;
|
||||
unsigned int buffersize;
|
||||
};
|
||||
|
||||
/* These two defines are only for debugging. Will remove them once it starts
|
||||
working. */
|
||||
#define PDATA(pgm) ((struct pdata *)(pgm->cookie))
|
||||
|
||||
#define show_func_info() \
|
||||
fprintf(stderr, "%s: line %d: called %s()\n", \
|
||||
__FILE__, __LINE__, __FUNCTION__)
|
||||
|
||||
#define no_show_func_info()
|
||||
static void butterfly_setup(PROGRAMMER * pgm)
|
||||
{
|
||||
if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: butterfly_setup(): Out of memory allocating private data\n",
|
||||
progname);
|
||||
exit(1);
|
||||
}
|
||||
memset(pgm->cookie, 0, sizeof(struct pdata));
|
||||
}
|
||||
|
||||
static void butterfly_teardown(PROGRAMMER * pgm)
|
||||
{
|
||||
free(pgm->cookie);
|
||||
}
|
||||
|
||||
static int butterfly_send(PROGRAMMER * pgm, char * buf, size_t len)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
return serial_send(&pgm->fd, (unsigned char *)buf, len);
|
||||
}
|
||||
|
||||
@@ -75,8 +87,6 @@ static int butterfly_recv(PROGRAMMER * pgm, char * buf, size_t len)
|
||||
{
|
||||
int rv;
|
||||
|
||||
no_show_func_info();
|
||||
|
||||
rv = serial_recv(&pgm->fd, (unsigned char *)buf, len);
|
||||
if (rv < 0) {
|
||||
fprintf(stderr,
|
||||
@@ -90,8 +100,6 @@ static int butterfly_recv(PROGRAMMER * pgm, char * buf, size_t len)
|
||||
|
||||
static int butterfly_drain(PROGRAMMER * pgm, int display)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
return serial_drain(&pgm->fd, display);
|
||||
}
|
||||
|
||||
@@ -111,8 +119,6 @@ static void butterfly_vfy_cmd_sent(PROGRAMMER * pgm, char * errmsg)
|
||||
|
||||
static int butterfly_rdy_led(PROGRAMMER * pgm, int value)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
/* Do nothing. */
|
||||
|
||||
return 0;
|
||||
@@ -121,8 +127,6 @@ static int butterfly_rdy_led(PROGRAMMER * pgm, int value)
|
||||
|
||||
static int butterfly_err_led(PROGRAMMER * pgm, int value)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
/* Do nothing. */
|
||||
|
||||
return 0;
|
||||
@@ -131,8 +135,6 @@ static int butterfly_err_led(PROGRAMMER * pgm, int value)
|
||||
|
||||
static int butterfly_pgm_led(PROGRAMMER * pgm, int value)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
/* Do nothing. */
|
||||
|
||||
return 0;
|
||||
@@ -141,8 +143,6 @@ static int butterfly_pgm_led(PROGRAMMER * pgm, int value)
|
||||
|
||||
static int butterfly_vfy_led(PROGRAMMER * pgm, int value)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
/* Do nothing. */
|
||||
|
||||
return 0;
|
||||
@@ -154,8 +154,6 @@ static int butterfly_vfy_led(PROGRAMMER * pgm, int value)
|
||||
*/
|
||||
static int butterfly_chip_erase(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
butterfly_send(pgm, "e", 1);
|
||||
butterfly_vfy_cmd_sent(pgm, "chip erase");
|
||||
|
||||
@@ -182,8 +180,6 @@ static void butterfly_leave_prog_mode(PROGRAMMER * pgm)
|
||||
*/
|
||||
static int butterfly_program_enable(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -193,8 +189,6 @@ static int butterfly_program_enable(PROGRAMMER * pgm, AVRPART * p)
|
||||
*/
|
||||
static void butterfly_powerup(PROGRAMMER * pgm)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
/* Do nothing. */
|
||||
|
||||
return;
|
||||
@@ -206,13 +200,12 @@ static void butterfly_powerup(PROGRAMMER * pgm)
|
||||
*/
|
||||
static void butterfly_powerdown(PROGRAMMER * pgm)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
/* Do nothing. */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#define IS_BUTTERFLY_MK 0x0001
|
||||
|
||||
/*
|
||||
* initialize the AVR device and prepare it to accept commands
|
||||
@@ -226,33 +219,66 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
char type;
|
||||
char c, devtype_1st;
|
||||
|
||||
no_show_func_info();
|
||||
|
||||
/*
|
||||
* Send some ESC to activate butterfly bootloader. This is not needed
|
||||
* for plain avr109 bootloaders but does not harm there either.
|
||||
*/
|
||||
fprintf(stderr, "Connecting to programmer: ");
|
||||
do {
|
||||
putc('.', stderr);
|
||||
butterfly_send(pgm, "\033", 1);
|
||||
butterfly_drain(pgm, 0);
|
||||
butterfly_send(pgm, "S", 1);
|
||||
butterfly_recv(pgm, &c, 1);
|
||||
if (c != '?') {
|
||||
putc('\n', stderr);
|
||||
/*
|
||||
* Got a useful response, continue getting the programmer
|
||||
* identifier. Programmer returns exactly 7 chars _without_
|
||||
* the null.
|
||||
*/
|
||||
id[0] = c;
|
||||
butterfly_recv(pgm, &id[1], sizeof(id)-2);
|
||||
id[sizeof(id)-1] = '\0';
|
||||
if (pgm->flag & IS_BUTTERFLY_MK)
|
||||
{
|
||||
char mk_reset_cmd[6] = {"#aR@S\r"};
|
||||
unsigned char mk_timeout = 0;
|
||||
|
||||
putc('.', stderr);
|
||||
butterfly_send(pgm, mk_reset_cmd, sizeof(mk_reset_cmd));
|
||||
usleep(20000);
|
||||
|
||||
do
|
||||
{
|
||||
c = 27;
|
||||
butterfly_send(pgm, &c, 1);
|
||||
usleep(20000);
|
||||
c = 0xaa;
|
||||
usleep(80000);
|
||||
butterfly_send(pgm, &c, 1);
|
||||
if (mk_timeout % 10 == 0) putc('.', stderr);
|
||||
} while (mk_timeout++ < 10);
|
||||
|
||||
butterfly_recv(pgm, &c, 1);
|
||||
if ( c != 'M' && c != '?')
|
||||
{
|
||||
fprintf(stderr, "\nConnection FAILED.");
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
id[0] = 'M'; id[1] = 'K'; id[2] = '2'; id[3] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
do {
|
||||
putc('.', stderr);
|
||||
butterfly_send(pgm, "\033", 1);
|
||||
butterfly_drain(pgm, 0);
|
||||
butterfly_send(pgm, "S", 1);
|
||||
butterfly_recv(pgm, &c, 1);
|
||||
if (c != '?') {
|
||||
putc('\n', stderr);
|
||||
/*
|
||||
* Got a useful response, continue getting the programmer
|
||||
* identifier. Programmer returns exactly 7 chars _without_
|
||||
* the null.
|
||||
*/
|
||||
id[0] = c;
|
||||
butterfly_recv(pgm, &id[1], sizeof(id)-2);
|
||||
id[sizeof(id)-1] = '\0';
|
||||
}
|
||||
} while (c == '?');
|
||||
}
|
||||
} while (c == '?');
|
||||
|
||||
/* Get the HW and SW versions to see if the programmer is present. */
|
||||
butterfly_drain(pgm, 0);
|
||||
|
||||
butterfly_send(pgm, "V", 1);
|
||||
butterfly_recv(pgm, sw, sizeof(sw));
|
||||
@@ -279,8 +305,8 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
/* See if programmer supports autoincrement of address. */
|
||||
|
||||
butterfly_send(pgm, "a", 1);
|
||||
butterfly_recv(pgm, &has_auto_incr_addr, 1);
|
||||
if (has_auto_incr_addr == 'Y')
|
||||
butterfly_recv(pgm, &PDATA(pgm)->has_auto_incr_addr, 1);
|
||||
if (PDATA(pgm)->has_auto_incr_addr == 'Y')
|
||||
fprintf(stderr, "Programmer supports auto addr increment.\n");
|
||||
|
||||
/* Check support for buffered memory access, abort if not available */
|
||||
@@ -294,12 +320,12 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
exit(1);
|
||||
};
|
||||
butterfly_recv(pgm, &c, 1);
|
||||
buffersize = (unsigned int)(unsigned char)c<<8;
|
||||
PDATA(pgm)->buffersize = (unsigned int)(unsigned char)c<<8;
|
||||
butterfly_recv(pgm, &c, 1);
|
||||
buffersize += (unsigned int)(unsigned char)c;
|
||||
PDATA(pgm)->buffersize += (unsigned int)(unsigned char)c;
|
||||
fprintf(stderr,
|
||||
"Programmer supports buffered memory access with buffersize=%i bytes.\n",
|
||||
buffersize);
|
||||
PDATA(pgm)->buffersize);
|
||||
|
||||
/* Get list of devices that the programmer supports. */
|
||||
|
||||
@@ -331,7 +357,13 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
butterfly_send(pgm, buf, 2);
|
||||
butterfly_vfy_cmd_sent(pgm, "select device");
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr,
|
||||
"%s: devcode selected: 0x%02x\n",
|
||||
progname, (unsigned)buf[1]);
|
||||
|
||||
butterfly_enter_prog_mode(pgm);
|
||||
butterfly_drain(pgm, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -340,8 +372,6 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
|
||||
static void butterfly_disable(PROGRAMMER * pgm)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
butterfly_leave_prog_mode(pgm);
|
||||
|
||||
return;
|
||||
@@ -350,16 +380,12 @@ static void butterfly_disable(PROGRAMMER * pgm)
|
||||
|
||||
static void butterfly_enable(PROGRAMMER * pgm)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static int butterfly_open(PROGRAMMER * pgm, char * port)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
strcpy(pgm->port, port);
|
||||
/*
|
||||
* If baudrate was not specified use 19200 Baud
|
||||
@@ -367,7 +393,9 @@ static int butterfly_open(PROGRAMMER * pgm, char * port)
|
||||
if(pgm->baudrate == 0) {
|
||||
pgm->baudrate = 19200;
|
||||
}
|
||||
serial_open(port, pgm->baudrate, &pgm->fd);
|
||||
if (serial_open(port, pgm->baudrate, &pgm->fd)==-1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* drain any extraneous input
|
||||
@@ -380,8 +408,6 @@ static int butterfly_open(PROGRAMMER * pgm, char * port)
|
||||
|
||||
static void butterfly_close(PROGRAMMER * pgm)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
/* "exit programmer" */
|
||||
butterfly_send(pgm, "E", 1);
|
||||
butterfly_vfy_cmd_sent(pgm, "exit bootloader");
|
||||
@@ -393,8 +419,6 @@ static void butterfly_close(PROGRAMMER * pgm)
|
||||
|
||||
static void butterfly_display(PROGRAMMER * pgm, const char * p)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -434,13 +458,11 @@ static int butterfly_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int size;
|
||||
int use_ext_addr = m->op[AVR_OP_LOAD_EXT_ADDR] != NULL;
|
||||
|
||||
no_show_func_info();
|
||||
|
||||
if ((strcmp(m->desc, "flash") == 0) || (strcmp(m->desc, "eeprom") == 0))
|
||||
{
|
||||
cmd[0] = 'B';
|
||||
cmd[1] = 0;
|
||||
if ((cmd[3] = toupper(m->desc[0])) == 'E') { /* write to eeprom */
|
||||
if ((cmd[3] = toupper((int)(m->desc[0]))) == 'E') { /* write to eeprom */
|
||||
cmd[2] = 1;
|
||||
cmd[4] = value;
|
||||
size = 5;
|
||||
@@ -499,13 +521,13 @@ static int butterfly_read_byte_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
butterfly_recv(pgm, buf, sizeof(buf));
|
||||
|
||||
if ((addr & 0x01) == 0) {
|
||||
*value = buf[1];
|
||||
*value = buf[0];
|
||||
cached = 1;
|
||||
cvalue = buf[0];
|
||||
cvalue = buf[1];
|
||||
caddr = addr;
|
||||
}
|
||||
else {
|
||||
*value = buf[0];
|
||||
*value = buf[1];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -522,14 +544,23 @@ static int butterfly_read_byte_eeprom(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int butterfly_page_erase(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsigned int addr)
|
||||
{
|
||||
if (strcmp(m->desc, "flash") == 0)
|
||||
return -1; /* not supported */
|
||||
if (strcmp(m->desc, "eeprom") == 0)
|
||||
return 0; /* nothing to do */
|
||||
fprintf(stderr,
|
||||
"%s: butterfly_page_erase() called on memory type \"%s\"\n",
|
||||
progname, m->desc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int butterfly_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
unsigned long addr, unsigned char * value)
|
||||
{
|
||||
char cmd;
|
||||
|
||||
no_show_func_info();
|
||||
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
return butterfly_read_byte_flash(pgm, p, m, addr, value);
|
||||
}
|
||||
@@ -561,25 +592,26 @@ static int butterfly_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
|
||||
|
||||
|
||||
static int butterfly_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int page_size, int n_bytes)
|
||||
static int butterfly_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
unsigned int page_size,
|
||||
unsigned int addr, unsigned int n_bytes)
|
||||
{
|
||||
unsigned int addr = 0;
|
||||
unsigned int max_addr = n_bytes;
|
||||
unsigned int max_addr = addr + n_bytes;
|
||||
char *cmd;
|
||||
unsigned int blocksize = buffersize;
|
||||
unsigned int blocksize = PDATA(pgm)->buffersize;
|
||||
int use_ext_addr = m->op[AVR_OP_LOAD_EXT_ADDR] != NULL;
|
||||
unsigned int wr_size = 2;
|
||||
|
||||
if (strcmp(m->desc, "flash") && strcmp(m->desc, "eeprom"))
|
||||
return -2;
|
||||
|
||||
if (m->desc[0] == 'e')
|
||||
blocksize = 1; /* Write to eeprom single bytes only */
|
||||
wr_size = blocksize = 1; /* Write to eeprom single bytes only */
|
||||
|
||||
if (use_ext_addr) {
|
||||
butterfly_set_extaddr(pgm, addr);
|
||||
butterfly_set_extaddr(pgm, addr / wr_size);
|
||||
} else {
|
||||
butterfly_set_addr(pgm, addr);
|
||||
butterfly_set_addr(pgm, addr / wr_size);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -591,7 +623,7 @@ static int butterfly_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
cmd = malloc(4+blocksize);
|
||||
if (!cmd) return -1;
|
||||
cmd[0] = 'B';
|
||||
cmd[3] = toupper(m->desc[0]);
|
||||
cmd[3] = toupper((int)(m->desc[0]));
|
||||
|
||||
while (addr < max_addr) {
|
||||
if ((max_addr - addr) < blocksize) {
|
||||
@@ -605,8 +637,6 @@ static int butterfly_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
butterfly_vfy_cmd_sent(pgm, "write block");
|
||||
|
||||
addr += blocksize;
|
||||
|
||||
report_progress (addr, max_addr, NULL);
|
||||
} /* while */
|
||||
free(cmd);
|
||||
|
||||
@@ -615,29 +645,32 @@ static int butterfly_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
|
||||
|
||||
|
||||
static int butterfly_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int page_size, int n_bytes)
|
||||
static int butterfly_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
unsigned int page_size,
|
||||
unsigned int addr, unsigned int n_bytes)
|
||||
{
|
||||
unsigned int addr = 0;
|
||||
unsigned int max_addr = n_bytes;
|
||||
int rd_size = 1;
|
||||
unsigned int max_addr = addr + n_bytes;
|
||||
int rd_size = 2;
|
||||
int blocksize = PDATA(pgm)->buffersize;
|
||||
int use_ext_addr = m->op[AVR_OP_LOAD_EXT_ADDR] != NULL;
|
||||
|
||||
/* check parameter syntax: only "flash" or "eeprom" is allowed */
|
||||
if (strcmp(m->desc, "flash") && strcmp(m->desc, "eeprom"))
|
||||
return -2;
|
||||
|
||||
if (m->desc[0] == 'e')
|
||||
rd_size = blocksize = 1; /* Read from eeprom single bytes only */
|
||||
|
||||
{ /* use buffered mode */
|
||||
char cmd[4];
|
||||
int blocksize = buffersize;
|
||||
|
||||
cmd[0] = 'g';
|
||||
cmd[3] = toupper(m->desc[0]);
|
||||
cmd[3] = toupper((int)(m->desc[0]));
|
||||
|
||||
if (use_ext_addr) {
|
||||
butterfly_set_extaddr(pgm, addr);
|
||||
butterfly_set_extaddr(pgm, addr / rd_size);
|
||||
} else {
|
||||
butterfly_set_addr(pgm, addr);
|
||||
butterfly_set_addr(pgm, addr / rd_size);
|
||||
}
|
||||
while (addr < max_addr) {
|
||||
if ((max_addr - addr) < blocksize) {
|
||||
@@ -650,8 +683,6 @@ static int butterfly_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
butterfly_recv(pgm, (char *)&m->buf[addr], blocksize);
|
||||
|
||||
addr += blocksize;
|
||||
|
||||
report_progress (addr, max_addr, NULL);
|
||||
} /* while */
|
||||
}
|
||||
|
||||
@@ -664,8 +695,6 @@ static int butterfly_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
|
||||
{
|
||||
unsigned char tmp;
|
||||
|
||||
no_show_func_info();
|
||||
|
||||
if (m->size < 3) {
|
||||
fprintf(stderr, "%s: memsize too small for sig byte read", progname);
|
||||
return -1;
|
||||
@@ -681,12 +710,11 @@ static int butterfly_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
|
||||
return 3;
|
||||
}
|
||||
|
||||
const char butterfly_desc[] = "Atmel Butterfly evaluation board; Atmel AppNotes AVR109, AVR911";
|
||||
|
||||
void butterfly_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
no_show_func_info();
|
||||
|
||||
strcpy(pgm->type, "avr910");
|
||||
strcpy(pgm->type, "butterfly");
|
||||
|
||||
/*
|
||||
* mandatory functions
|
||||
@@ -712,8 +740,22 @@ void butterfly_initpgm(PROGRAMMER * pgm)
|
||||
* optional functions
|
||||
*/
|
||||
|
||||
pgm->page_erase = butterfly_page_erase;
|
||||
pgm->paged_write = butterfly_paged_write;
|
||||
pgm->paged_load = butterfly_paged_load;
|
||||
|
||||
pgm->read_sig_bytes = butterfly_read_sig_bytes;
|
||||
|
||||
pgm->setup = butterfly_setup;
|
||||
pgm->teardown = butterfly_teardown;
|
||||
pgm->flag = 0;
|
||||
}
|
||||
|
||||
const char butterfly_mk_desc[] = "Mikrokopter.de Butterfly";
|
||||
|
||||
void butterfly_mk_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
butterfly_initpgm(pgm);
|
||||
strcpy(pgm->type, "butterfly_mk");
|
||||
pgm->flag = IS_BUTTERFLY_MK;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -26,7 +25,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const char butterfly_desc[];
|
||||
extern const char butterfly_mk_desc[];
|
||||
void butterfly_initpgm (PROGRAMMER * pgm);
|
||||
void butterfly_mk_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -35,6 +34,8 @@
|
||||
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;
|
||||
@@ -54,6 +55,13 @@ extern char * yytext;
|
||||
|
||||
#define DEBUG 0
|
||||
|
||||
void cleanup_config(void)
|
||||
{
|
||||
ldestroy_cb(part_list, (void(*)(void*))avr_free_part);
|
||||
ldestroy_cb(programmers, (void(*)(void*))pgm_free);
|
||||
ldestroy_cb(string_list, (void(*)(void*))free_token);
|
||||
ldestroy_cb(number_list, (void(*)(void*))free_token);
|
||||
}
|
||||
|
||||
int init_config(void)
|
||||
{
|
||||
@@ -61,7 +69,7 @@ int init_config(void)
|
||||
number_list = lcreat(NULL, 0);
|
||||
current_prog = NULL;
|
||||
current_part = NULL;
|
||||
current_mem = 0;
|
||||
current_mem = NULL;
|
||||
part_list = lcreat(NULL, 0);
|
||||
programmers = lcreat(NULL, 0);
|
||||
|
||||
@@ -81,7 +89,7 @@ int yywrap()
|
||||
|
||||
int yyerror(char * errmsg)
|
||||
{
|
||||
fprintf(stderr, "%s at %s:%d\n", errmsg, infile, lineno);
|
||||
fprintf(stderr, "%s: %s at %s:%d\n", progname, errmsg, infile, lineno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -107,15 +115,14 @@ TOKEN * new_token(int primary)
|
||||
void free_token(TOKEN * tkn)
|
||||
{
|
||||
if (tkn) {
|
||||
switch (tkn->primary) {
|
||||
case TKN_STRING:
|
||||
case TKN_ID:
|
||||
switch (tkn->value.type) {
|
||||
case V_STR:
|
||||
if (tkn->value.string)
|
||||
free(tkn->value.string);
|
||||
tkn->value.string = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
free(tkn);
|
||||
}
|
||||
}
|
||||
@@ -142,15 +149,29 @@ TOKEN * number(char * text)
|
||||
|
||||
tkn = new_token(TKN_NUMBER);
|
||||
tkn->value.type = V_NUM;
|
||||
tkn->value.number = atof(text);
|
||||
tkn->value.number = atoi(text);
|
||||
|
||||
#if DEBUG
|
||||
fprintf(stderr, "NUMBER(%g)\n", tkn->value.number);
|
||||
fprintf(stderr, "NUMBER(%d)\n", tkn->value.number);
|
||||
#endif
|
||||
|
||||
return tkn;
|
||||
}
|
||||
|
||||
TOKEN * number_real(char * text)
|
||||
{
|
||||
struct token_t * tkn;
|
||||
|
||||
tkn = new_token(TKN_NUMBER);
|
||||
tkn->value.type = V_NUM_REAL;
|
||||
tkn->value.number_real = atof(text);
|
||||
|
||||
#if DEBUG
|
||||
fprintf(stderr, "NUMBER(%g)\n", tkn->value.number_real);
|
||||
#endif
|
||||
|
||||
return tkn;
|
||||
}
|
||||
|
||||
TOKEN * hexnumber(char * text)
|
||||
{
|
||||
@@ -199,31 +220,6 @@ TOKEN * string(char * text)
|
||||
}
|
||||
|
||||
|
||||
TOKEN * id(char * text)
|
||||
{
|
||||
struct token_t * tkn;
|
||||
int len;
|
||||
|
||||
tkn = new_token(TKN_ID);
|
||||
|
||||
len = strlen(text);
|
||||
|
||||
tkn->value.type = V_STR;
|
||||
tkn->value.string = (char *) malloc(len+1);
|
||||
if (tkn->value.string == NULL) {
|
||||
fprintf(stderr, "id(): out of memory\n");
|
||||
exit(1);
|
||||
}
|
||||
strcpy(tkn->value.string, text);
|
||||
|
||||
#if DEBUG
|
||||
fprintf(stderr, "ID(%s)\n", tkn->value.string);
|
||||
#endif
|
||||
|
||||
return tkn;
|
||||
}
|
||||
|
||||
|
||||
TOKEN * keyword(int primary)
|
||||
{
|
||||
struct token_t * tkn;
|
||||
@@ -240,21 +236,21 @@ void print_token(TOKEN * tkn)
|
||||
return;
|
||||
|
||||
fprintf(stderr, "token = %d = ", tkn->primary);
|
||||
switch (tkn->primary) {
|
||||
case TKN_NUMBER:
|
||||
fprintf(stderr, "NUMBER, value=%g", tkn->value.number);
|
||||
switch (tkn->value.type) {
|
||||
case V_NUM:
|
||||
fprintf(stderr, "NUMBER, value=%d", tkn->value.number);
|
||||
break;
|
||||
|
||||
case TKN_STRING:
|
||||
fprintf(stderr, "STRING, value=%s", tkn->value.string);
|
||||
case V_NUM_REAL:
|
||||
fprintf(stderr, "NUMBER, value=%g", tkn->value.number_real);
|
||||
break;
|
||||
|
||||
case TKN_ID:
|
||||
fprintf(stderr, "ID, value=%s", tkn->value.string);
|
||||
case V_STR:
|
||||
fprintf(stderr, "STRING, value=%s", tkn->value.string);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "<other>");
|
||||
default:
|
||||
fprintf(stderr, "<other>");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -283,6 +279,11 @@ char * dup_string(const char * str)
|
||||
return s;
|
||||
}
|
||||
|
||||
#ifdef HAVE_YYLEX_DESTROY
|
||||
/* reset lexer and free any allocated memory */
|
||||
extern int yylex_destroy(void);
|
||||
#endif
|
||||
|
||||
int read_config(const char * file)
|
||||
{
|
||||
FILE * f;
|
||||
@@ -300,6 +301,11 @@ int read_config(const char * file)
|
||||
|
||||
yyparse();
|
||||
|
||||
#ifdef HAVE_YYLEX_DESTROY
|
||||
/* reset lexer and free any allocated memory */
|
||||
yylex_destroy();
|
||||
#endif
|
||||
|
||||
fclose(f);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -29,11 +28,14 @@
|
||||
|
||||
#define MAX_STR_CONST 1024
|
||||
|
||||
enum { V_NONE, V_NUM, V_STR };
|
||||
enum { V_NONE, V_NUM, V_NUM_REAL, V_STR };
|
||||
typedef struct value_t {
|
||||
int type;
|
||||
double number;
|
||||
char * string;
|
||||
/*union { TODO: use an anonymous union here ? */
|
||||
int number;
|
||||
double number_real;
|
||||
char * string;
|
||||
/*};*/
|
||||
} VALUE;
|
||||
|
||||
|
||||
@@ -57,7 +59,12 @@ extern LISTID programmers;
|
||||
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. */
|
||||
#define DEFAULT_USB "usb"
|
||||
|
||||
|
||||
#if !defined(HAS_YYSTYPE)
|
||||
@@ -77,6 +84,8 @@ int yyparse(void);
|
||||
|
||||
int init_config(void);
|
||||
|
||||
void cleanup_config(void);
|
||||
|
||||
TOKEN * new_token(int primary);
|
||||
|
||||
void free_token(TOKEN * tkn);
|
||||
@@ -85,12 +94,12 @@ void free_tokens(int n, ...);
|
||||
|
||||
TOKEN * number(char * text);
|
||||
|
||||
TOKEN * number_real(char * text);
|
||||
|
||||
TOKEN * hexnumber(char * text);
|
||||
|
||||
TOKEN * string(char * text);
|
||||
|
||||
TOKEN * id(char * text);
|
||||
|
||||
TOKEN * keyword(int primary);
|
||||
|
||||
void print_token(TOKEN * tkn);
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -36,15 +35,8 @@
|
||||
#include "pindefs.h"
|
||||
#include "ppi.h"
|
||||
#include "pgm.h"
|
||||
#include "stk500.h"
|
||||
#include "stk500v2.h"
|
||||
#include "stk500generic.h"
|
||||
#include "avr910.h"
|
||||
#include "butterfly.h"
|
||||
#include "usbasp.h"
|
||||
#include "pgm_type.h"
|
||||
#include "avr.h"
|
||||
#include "jtagmkI.h"
|
||||
#include "jtagmkII.h"
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
#define strtok_r( _s, _sep, _lasts ) \
|
||||
@@ -55,9 +47,11 @@ int yylex(void);
|
||||
int yyerror(char * errmsg);
|
||||
|
||||
static int assign_pin(int pinno, TOKEN * v, int invert);
|
||||
static int assign_pin_list(int invert);
|
||||
static int which_opcode(TOKEN * opcode);
|
||||
static int parse_cmdbits(OPCODE * op);
|
||||
|
||||
|
||||
static int pin_name;
|
||||
%}
|
||||
|
||||
%token K_READ
|
||||
@@ -82,17 +76,15 @@ static int parse_cmdbits(OPCODE * op);
|
||||
%token K_BS2
|
||||
%token K_BUFF
|
||||
%token K_CHIP_ERASE_DELAY
|
||||
%token K_CONNTYPE
|
||||
%token K_DEDICATED
|
||||
%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_DEVICECODE
|
||||
%token K_DRAGON_DW
|
||||
%token K_DRAGON_HVSP
|
||||
%token K_DRAGON_ISP
|
||||
%token K_DRAGON_JTAG
|
||||
%token K_DRAGON_PP
|
||||
%token K_STK500_DEVCODE
|
||||
%token K_AVR910_DEVCODE
|
||||
%token K_EEPROM
|
||||
@@ -100,19 +92,19 @@ static int parse_cmdbits(OPCODE * op);
|
||||
%token K_FLASH
|
||||
%token K_ID
|
||||
%token K_IO
|
||||
%token K_JTAG_MKI
|
||||
%token K_JTAG_MKII
|
||||
%token K_JTAG_MKII_DW
|
||||
%token K_JTAG_MKII_ISP
|
||||
%token K_LOADPAGE
|
||||
%token K_MAX_WRITE_DELAY
|
||||
%token K_MCU_BASE
|
||||
%token K_MIN_WRITE_DELAY
|
||||
%token K_MISO
|
||||
%token K_MOSI
|
||||
%token K_NUM_PAGES
|
||||
%token K_NVM_BASE
|
||||
%token K_OCDREV
|
||||
%token K_OFFSET
|
||||
%token K_PAGEL
|
||||
%token K_PAR
|
||||
%token K_PARALLEL
|
||||
%token K_PARENT
|
||||
%token K_PART
|
||||
%token K_PGMLED
|
||||
%token K_PROGRAMMER
|
||||
@@ -124,19 +116,17 @@ static int parse_cmdbits(OPCODE * op);
|
||||
%token K_READMEM
|
||||
%token K_RESET
|
||||
%token K_RETRY_PULSE
|
||||
%token K_SERBB
|
||||
%token K_SERIAL
|
||||
%token K_SCK
|
||||
%token K_SIGNATURE
|
||||
%token K_SIZE
|
||||
%token K_STK500
|
||||
%token K_STK500HVSP
|
||||
%token K_STK500PP
|
||||
%token K_STK500V2
|
||||
%token K_STK500GENERIC
|
||||
%token K_AVR910
|
||||
%token K_USBASP
|
||||
%token K_BUTTERFLY
|
||||
%token K_USB
|
||||
%token K_USBDEV
|
||||
%token K_USBSN
|
||||
%token K_USBPID
|
||||
%token K_USBPRODUCT
|
||||
%token K_USBVENDOR
|
||||
%token K_USBVID
|
||||
%token K_TYPE
|
||||
%token K_VCC
|
||||
%token K_VFYLED
|
||||
@@ -196,7 +186,11 @@ static int parse_cmdbits(OPCODE * op);
|
||||
%token K_ENABLEPAGEPROGRAMMING /* ? yes for mega256*, mega406 */
|
||||
%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_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) */
|
||||
%token K_IS_AVR32 /* chip is in the avr32 family */
|
||||
%token K_RAMPZ /* address of RAMPZ reg. in IO space */
|
||||
%token K_SPMCR /* address of SPMC[S]R in memory space */
|
||||
%token K_EECR /* address of EECR in memory space */
|
||||
@@ -207,14 +201,27 @@ static int parse_cmdbits(OPCODE * op);
|
||||
%token TKN_EQUAL
|
||||
%token TKN_SEMI
|
||||
%token TKN_TILDE
|
||||
%token TKN_LEFT_PAREN
|
||||
%token TKN_RIGHT_PAREN
|
||||
%token TKN_NUMBER
|
||||
%token TKN_NUMBER_REAL
|
||||
%token TKN_STRING
|
||||
%token TKN_ID
|
||||
|
||||
%start configuration
|
||||
|
||||
%%
|
||||
|
||||
number_real :
|
||||
TKN_NUMBER {
|
||||
$$ = $1;
|
||||
/* convert value to real */
|
||||
$$->value.number_real = $$->value.number;
|
||||
$$->value.type = V_NUM_REAL;
|
||||
} |
|
||||
TKN_NUMBER_REAL {
|
||||
$$ = $1;
|
||||
}
|
||||
|
||||
configuration :
|
||||
/* empty */ | config
|
||||
;
|
||||
@@ -246,46 +253,87 @@ def :
|
||||
strncpy(default_serial, $3->value.string, PATH_MAX);
|
||||
default_serial[PATH_MAX-1] = 0;
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
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);
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
prog_def :
|
||||
K_PROGRAMMER
|
||||
{ current_prog = pgm_new();
|
||||
strcpy(current_prog->config_file, infile);
|
||||
current_prog->lineno = lineno;
|
||||
}
|
||||
prog_parms
|
||||
{
|
||||
prog_decl prog_parms
|
||||
{
|
||||
PROGRAMMER * existing_prog;
|
||||
char * id;
|
||||
if (lsize(current_prog->id) == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: error at %s:%d: required parameter id not specified\n",
|
||||
progname, infile, lineno);
|
||||
exit(1);
|
||||
}
|
||||
if (current_prog->type[0] == 0) {
|
||||
if (current_prog->initpgm == NULL) {
|
||||
fprintf(stderr, "%s: error at %s:%d: programmer type not specified\n",
|
||||
progname, infile, lineno);
|
||||
exit(1);
|
||||
}
|
||||
PUSH(programmers, current_prog);
|
||||
current_prog = NULL;
|
||||
id = ldata(lfirst(current_prog->id));
|
||||
existing_prog = locate_programmer(programmers, id);
|
||||
if (existing_prog) {
|
||||
fprintf(stderr, "%s: warning at %s:%d: programmer %s overwrites "
|
||||
"previous definition %s:%d.\n",
|
||||
progname, infile, current_prog->lineno,
|
||||
id, existing_prog->config_file, existing_prog->lineno);
|
||||
lrmv_d(programmers, existing_prog);
|
||||
pgm_free(existing_prog);
|
||||
}
|
||||
PUSH(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;
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
prog_decl :
|
||||
K_PROGRAMMER
|
||||
{ current_prog = pgm_new();
|
||||
strcpy(current_prog->config_file, infile);
|
||||
current_prog->lineno = lineno;
|
||||
}
|
||||
|
|
||||
K_PROGRAMMER K_PARENT TKN_STRING
|
||||
{
|
||||
struct programmer_t * pgm = locate_programmer(programmers, $3->value.string);
|
||||
if (pgm == NULL) {
|
||||
fprintf(stderr,
|
||||
"%s: error at %s:%d: parent programmer %s not found\n",
|
||||
progname, infile, lineno, $3->value.string);
|
||||
exit(1);
|
||||
}
|
||||
current_prog = pgm_dup(pgm);
|
||||
strcpy(current_prog->config_file, infile);
|
||||
current_prog->lineno = lineno;
|
||||
free_token($3);
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
part_def :
|
||||
K_PART
|
||||
{
|
||||
current_part = avr_new_part();
|
||||
strcpy(current_part->config_file, infile);
|
||||
current_part->lineno = lineno;
|
||||
}
|
||||
part_parms
|
||||
part_decl part_parms
|
||||
{
|
||||
LNODEID ln;
|
||||
AVRMEM * m;
|
||||
AVRPART * existing_part;
|
||||
|
||||
if (current_part->id[0] == 0) {
|
||||
fprintf(stderr,
|
||||
@@ -331,11 +379,44 @@ part_def :
|
||||
}
|
||||
}
|
||||
|
||||
existing_part = locate_part(part_list, current_part->id);
|
||||
if (existing_part) {
|
||||
fprintf(stderr, "%s: warning at %s:%d: part %s overwrites "
|
||||
"previous definition %s:%d.\n",
|
||||
progname, infile, current_part->lineno, current_part->id,
|
||||
existing_part->config_file, existing_part->lineno);
|
||||
lrmv_d(part_list, existing_part);
|
||||
avr_free_part(existing_part);
|
||||
}
|
||||
PUSH(part_list, current_part);
|
||||
current_part = NULL;
|
||||
}
|
||||
;
|
||||
|
||||
part_decl :
|
||||
K_PART
|
||||
{
|
||||
current_part = avr_new_part();
|
||||
strcpy(current_part->config_file, infile);
|
||||
current_part->lineno = lineno;
|
||||
} |
|
||||
K_PART K_PARENT TKN_STRING
|
||||
{
|
||||
AVRPART * parent_part = locate_part(part_list, $3->value.string);
|
||||
if (parent_part == NULL) {
|
||||
fprintf(stderr,
|
||||
"%s: error at %s:%d: can't find parent part",
|
||||
progname, infile, lineno);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
current_part = avr_dup_part(parent_part);
|
||||
strcpy(current_part->config_file, infile);
|
||||
current_part->lineno = lineno;
|
||||
|
||||
free_token($3);
|
||||
}
|
||||
;
|
||||
|
||||
string_list :
|
||||
TKN_STRING { ladd(string_list, $1); } |
|
||||
@@ -348,16 +429,14 @@ num_list :
|
||||
num_list TKN_COMMA TKN_NUMBER { ladd(number_list, $3); }
|
||||
;
|
||||
|
||||
|
||||
prog_parms :
|
||||
prog_parm TKN_SEMI |
|
||||
prog_parms prog_parm TKN_SEMI
|
||||
;
|
||||
|
||||
|
||||
prog_parm :
|
||||
K_ID TKN_EQUAL string_list {
|
||||
{
|
||||
{
|
||||
TOKEN * t;
|
||||
while (lsize(string_list)) {
|
||||
t = lrmv_n(string_list, 1);
|
||||
@@ -366,190 +445,148 @@ prog_parm :
|
||||
}
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_PAR {
|
||||
{
|
||||
par_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_SERBB {
|
||||
{
|
||||
serbb_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_STK500 {
|
||||
{
|
||||
stk500_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_STK500V2 {
|
||||
{
|
||||
stk500v2_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_STK500HVSP {
|
||||
{
|
||||
stk500hvsp_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_STK500PP {
|
||||
{
|
||||
stk500pp_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_STK500GENERIC {
|
||||
{
|
||||
stk500generic_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_AVR910 {
|
||||
{
|
||||
avr910_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_USBASP {
|
||||
{
|
||||
usbasp_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_BUTTERFLY {
|
||||
{
|
||||
butterfly_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_JTAG_MKI {
|
||||
{
|
||||
jtagmkI_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_JTAG_MKII {
|
||||
{
|
||||
jtagmkII_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_JTAG_MKII_DW {
|
||||
{
|
||||
jtagmkII_dw_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_JTAG_MKII_ISP {
|
||||
{
|
||||
stk500v2_jtagmkII_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_DRAGON_DW {
|
||||
{
|
||||
jtagmkII_dragon_dw_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_DRAGON_HVSP {
|
||||
{
|
||||
stk500v2_dragon_hvsp_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_DRAGON_ISP {
|
||||
{
|
||||
stk500v2_dragon_isp_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_DRAGON_JTAG {
|
||||
{
|
||||
jtagmkII_dragon_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
K_TYPE TKN_EQUAL K_DRAGON_PP {
|
||||
{
|
||||
stk500v2_dragon_pp_initpgm(current_prog);
|
||||
}
|
||||
} |
|
||||
|
||||
prog_parm_type
|
||||
|
|
||||
prog_parm_pins
|
||||
|
|
||||
prog_parm_usb
|
||||
|
|
||||
prog_parm_conntype
|
||||
|
|
||||
K_DESC TKN_EQUAL TKN_STRING {
|
||||
strncpy(current_prog->desc, $3->value.string, PGM_DESCLEN);
|
||||
current_prog->desc[PGM_DESCLEN-1] = 0;
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_VCC TKN_EQUAL num_list {
|
||||
{
|
||||
TOKEN * t;
|
||||
int pin;
|
||||
|
||||
current_prog->pinno[PPI_AVR_VCC] = 0;
|
||||
|
||||
while (lsize(number_list)) {
|
||||
t = lrmv_n(number_list, 1);
|
||||
pin = t->value.number;
|
||||
current_prog->pinno[PPI_AVR_VCC] |= (1 << pin);
|
||||
|
||||
free_token(t);
|
||||
}
|
||||
}
|
||||
} |
|
||||
|
||||
K_BUFF TKN_EQUAL num_list {
|
||||
{
|
||||
TOKEN * t;
|
||||
int pin;
|
||||
|
||||
current_prog->pinno[PPI_AVR_BUFF] = 0;
|
||||
|
||||
while (lsize(number_list)) {
|
||||
t = lrmv_n(number_list, 1);
|
||||
pin = t->value.number;
|
||||
current_prog->pinno[PPI_AVR_BUFF] |= (1 << pin);
|
||||
|
||||
free_token(t);
|
||||
}
|
||||
}
|
||||
} |
|
||||
|
||||
K_BAUDRATE TKN_EQUAL TKN_NUMBER {
|
||||
{
|
||||
current_prog->baudrate = $3->value.number;
|
||||
free_token($3);
|
||||
}
|
||||
} |
|
||||
|
||||
K_RESET TKN_EQUAL TKN_NUMBER { free_token($1);
|
||||
assign_pin(PIN_AVR_RESET, $3, 0); } |
|
||||
K_SCK TKN_EQUAL TKN_NUMBER { free_token($1);
|
||||
assign_pin(PIN_AVR_SCK, $3, 0); } |
|
||||
K_MOSI TKN_EQUAL TKN_NUMBER { assign_pin(PIN_AVR_MOSI, $3, 0); } |
|
||||
K_MISO TKN_EQUAL TKN_NUMBER { assign_pin(PIN_AVR_MISO, $3, 0); } |
|
||||
K_ERRLED TKN_EQUAL TKN_NUMBER { assign_pin(PIN_LED_ERR, $3, 0); } |
|
||||
K_RDYLED TKN_EQUAL TKN_NUMBER { assign_pin(PIN_LED_RDY, $3, 0); } |
|
||||
K_PGMLED TKN_EQUAL TKN_NUMBER { assign_pin(PIN_LED_PGM, $3, 0); } |
|
||||
K_VFYLED TKN_EQUAL TKN_NUMBER { assign_pin(PIN_LED_VFY, $3, 0); } |
|
||||
|
||||
K_RESET TKN_EQUAL TKN_TILDE TKN_NUMBER { free_token($1);
|
||||
assign_pin(PIN_AVR_RESET, $4, 1); } |
|
||||
K_SCK TKN_EQUAL TKN_TILDE TKN_NUMBER { free_token($1);
|
||||
assign_pin(PIN_AVR_SCK, $4, 1); } |
|
||||
K_MOSI TKN_EQUAL TKN_TILDE TKN_NUMBER { assign_pin(PIN_AVR_MOSI, $4, 1); } |
|
||||
K_MISO TKN_EQUAL TKN_TILDE TKN_NUMBER { assign_pin(PIN_AVR_MISO, $4, 1); } |
|
||||
K_ERRLED TKN_EQUAL TKN_TILDE TKN_NUMBER { assign_pin(PIN_LED_ERR, $4, 1); } |
|
||||
K_RDYLED TKN_EQUAL TKN_TILDE TKN_NUMBER { assign_pin(PIN_LED_RDY, $4, 1); } |
|
||||
K_PGMLED TKN_EQUAL TKN_TILDE TKN_NUMBER { assign_pin(PIN_LED_PGM, $4, 1); } |
|
||||
K_VFYLED TKN_EQUAL TKN_TILDE TKN_NUMBER { assign_pin(PIN_LED_VFY, $4, 1); }
|
||||
}
|
||||
;
|
||||
|
||||
prog_parm_type:
|
||||
K_TYPE TKN_EQUAL prog_parm_type_id
|
||||
;
|
||||
|
||||
prog_parm_type_id:
|
||||
TKN_STRING {
|
||||
const struct programmer_type_t * pgm_type = locate_programmer_type($1->value.string);
|
||||
if (pgm_type == NULL) {
|
||||
fprintf(stderr,
|
||||
"%s: error at %s:%d: programmer type %s not found\n",
|
||||
progname, infile, lineno, $1->value.string);
|
||||
exit(1);
|
||||
}
|
||||
current_prog->initpgm = pgm_type->initpgm;
|
||||
free_token($1);
|
||||
}
|
||||
| error
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: error at %s:%d: programmer type must be written as \"id_type\"\n",
|
||||
progname, infile, lineno);
|
||||
exit(1);
|
||||
}
|
||||
;
|
||||
|
||||
prog_parm_conntype:
|
||||
K_CONNTYPE TKN_EQUAL prog_parm_conntype_id
|
||||
;
|
||||
|
||||
prog_parm_conntype_id:
|
||||
K_PARALLEL { current_prog->conntype = CONNTYPE_PARALLEL; } |
|
||||
K_SERIAL { current_prog->conntype = CONNTYPE_SERIAL; } |
|
||||
K_USB { current_prog->conntype = CONNTYPE_USB; }
|
||||
;
|
||||
|
||||
prog_parm_usb:
|
||||
K_USBDEV TKN_EQUAL TKN_STRING {
|
||||
{
|
||||
strncpy(current_prog->usbdev, $3->value.string, PGM_USBSTRINGLEN);
|
||||
current_prog->usbdev[PGM_USBSTRINGLEN-1] = 0;
|
||||
free_token($3);
|
||||
}
|
||||
} |
|
||||
K_USBVID TKN_EQUAL TKN_NUMBER {
|
||||
{
|
||||
current_prog->usbvid = $3->value.number;
|
||||
free_token($3);
|
||||
}
|
||||
} |
|
||||
K_USBPID TKN_EQUAL TKN_NUMBER {
|
||||
{
|
||||
current_prog->usbpid = $3->value.number;
|
||||
free_token($3);
|
||||
}
|
||||
} |
|
||||
K_USBSN TKN_EQUAL TKN_STRING {
|
||||
{
|
||||
strncpy(current_prog->usbsn, $3->value.string, PGM_USBSTRINGLEN);
|
||||
current_prog->usbsn[PGM_USBSTRINGLEN-1] = 0;
|
||||
free_token($3);
|
||||
}
|
||||
} |
|
||||
K_USBVENDOR TKN_EQUAL TKN_STRING {
|
||||
{
|
||||
strncpy(current_prog->usbvendor, $3->value.string, PGM_USBSTRINGLEN);
|
||||
current_prog->usbvendor[PGM_USBSTRINGLEN-1] = 0;
|
||||
free_token($3);
|
||||
}
|
||||
} |
|
||||
K_USBPRODUCT TKN_EQUAL TKN_STRING {
|
||||
{
|
||||
strncpy(current_prog->usbproduct, $3->value.string, PGM_USBSTRINGLEN);
|
||||
current_prog->usbproduct[PGM_USBSTRINGLEN-1] = 0;
|
||||
free_token($3);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
pin_number_non_empty:
|
||||
TKN_NUMBER { assign_pin(pin_name, $1, 0); }
|
||||
|
|
||||
TKN_TILDE TKN_NUMBER { assign_pin(pin_name, $2, 1); }
|
||||
;
|
||||
|
||||
pin_number:
|
||||
pin_number_non_empty
|
||||
|
|
||||
/* empty */ { pin_clear_all(&(current_prog->pin[pin_name])); }
|
||||
;
|
||||
|
||||
pin_list_element:
|
||||
pin_number_non_empty
|
||||
|
|
||||
TKN_TILDE TKN_LEFT_PAREN num_list TKN_RIGHT_PAREN { assign_pin_list(1); }
|
||||
;
|
||||
|
||||
pin_list_non_empty:
|
||||
pin_list_element
|
||||
|
|
||||
pin_list_non_empty TKN_COMMA pin_list_element
|
||||
;
|
||||
|
||||
|
||||
pin_list:
|
||||
pin_list_non_empty
|
||||
|
|
||||
/* empty */ { pin_clear_all(&(current_prog->pin[pin_name])); }
|
||||
;
|
||||
|
||||
prog_parm_pins:
|
||||
K_VCC TKN_EQUAL {pin_name = PPI_AVR_VCC; } pin_list |
|
||||
K_BUFF TKN_EQUAL {pin_name = PPI_AVR_BUFF; } pin_list |
|
||||
K_RESET TKN_EQUAL {pin_name = PIN_AVR_RESET;} pin_number { free_token($1); } |
|
||||
K_SCK TKN_EQUAL {pin_name = PIN_AVR_SCK; } pin_number { free_token($1); } |
|
||||
K_MOSI TKN_EQUAL {pin_name = PIN_AVR_MOSI; } pin_number |
|
||||
K_MISO TKN_EQUAL {pin_name = PIN_AVR_MISO; } pin_number |
|
||||
K_ERRLED TKN_EQUAL {pin_name = PIN_LED_ERR; } pin_number |
|
||||
K_RDYLED TKN_EQUAL {pin_name = PIN_LED_RDY; } pin_number |
|
||||
K_PGMLED TKN_EQUAL {pin_name = PIN_LED_PGM; } pin_number |
|
||||
K_VFYLED TKN_EQUAL {pin_name = PIN_LED_VFY; } pin_number
|
||||
;
|
||||
|
||||
opcode :
|
||||
K_READ |
|
||||
@@ -641,19 +678,11 @@ part_parm :
|
||||
unsigned nbytes;
|
||||
int ok;
|
||||
|
||||
if (current_part->ctl_stack_type != CTL_STACK_NONE)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: error at line %d of %s: "
|
||||
"control stack already defined\n",
|
||||
progname, lineno, infile);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
current_part->ctl_stack_type = CTL_STACK_PP;
|
||||
nbytes = 0;
|
||||
ok = 1;
|
||||
|
||||
memset(current_part->controlstack, 0, CTL_STACK_SIZE);
|
||||
while (lsize(number_list)) {
|
||||
t = lrmv_n(number_list, 1);
|
||||
if (nbytes < CTL_STACK_SIZE)
|
||||
@@ -683,19 +712,11 @@ part_parm :
|
||||
unsigned nbytes;
|
||||
int ok;
|
||||
|
||||
if (current_part->ctl_stack_type != CTL_STACK_NONE)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: error at line %d of %s: "
|
||||
"control stack already defined\n",
|
||||
progname, lineno, infile);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
current_part->ctl_stack_type = CTL_STACK_HVSP;
|
||||
nbytes = 0;
|
||||
ok = 1;
|
||||
|
||||
memset(current_part->controlstack, 0, CTL_STACK_SIZE);
|
||||
while (lsize(number_list)) {
|
||||
t = lrmv_n(number_list, 1);
|
||||
if (nbytes < CTL_STACK_SIZE)
|
||||
@@ -728,6 +749,7 @@ part_parm :
|
||||
nbytes = 0;
|
||||
ok = 1;
|
||||
|
||||
memset(current_part->flash_instr, 0, FLASH_INSTR_SIZE);
|
||||
while (lsize(number_list)) {
|
||||
t = lrmv_n(number_list, 1);
|
||||
if (nbytes < FLASH_INSTR_SIZE)
|
||||
@@ -760,6 +782,7 @@ part_parm :
|
||||
nbytes = 0;
|
||||
ok = 1;
|
||||
|
||||
memset(current_part->eeprom_instr, 0, EEPROM_INSTR_SIZE);
|
||||
while (lsize(number_list)) {
|
||||
t = lrmv_n(number_list, 1);
|
||||
if (nbytes < EEPROM_INSTR_SIZE)
|
||||
@@ -999,6 +1022,46 @@ part_parm :
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_HAS_PDI TKN_EQUAL yesno
|
||||
{
|
||||
if ($3->primary == K_YES)
|
||||
current_part->flags |= AVRPART_HAS_PDI;
|
||||
else if ($3->primary == K_NO)
|
||||
current_part->flags &= ~AVRPART_HAS_PDI;
|
||||
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_HAS_TPI TKN_EQUAL yesno
|
||||
{
|
||||
if ($3->primary == K_YES)
|
||||
current_part->flags |= AVRPART_HAS_TPI;
|
||||
else if ($3->primary == K_NO)
|
||||
current_part->flags &= ~AVRPART_HAS_TPI;
|
||||
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_IS_AT90S1200 TKN_EQUAL yesno
|
||||
{
|
||||
if ($3->primary == K_YES)
|
||||
current_part->flags |= AVRPART_IS_AT90S1200;
|
||||
else if ($3->primary == K_NO)
|
||||
current_part->flags &= ~AVRPART_IS_AT90S1200;
|
||||
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_IS_AVR32 TKN_EQUAL yesno
|
||||
{
|
||||
if ($3->primary == K_YES)
|
||||
current_part->flags |= AVRPART_AVR32;
|
||||
else if ($3->primary == K_NO)
|
||||
current_part->flags &= ~AVRPART_AVR32;
|
||||
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_ALLOWFULLPAGEBITSTREAM TKN_EQUAL yesno
|
||||
{
|
||||
if ($3->primary == K_YES)
|
||||
@@ -1043,6 +1106,24 @@ part_parm :
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_MCU_BASE TKN_EQUAL TKN_NUMBER
|
||||
{
|
||||
current_part->mcu_base = $3->value.number;
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_NVM_BASE TKN_EQUAL TKN_NUMBER
|
||||
{
|
||||
current_part->nvm_base = $3->value.number;
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_OCDREV TKN_EQUAL TKN_NUMBER
|
||||
{
|
||||
current_part->ocdrev = $3->value.number;
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_SERIAL TKN_EQUAL yesno
|
||||
{
|
||||
if ($3->primary == K_YES)
|
||||
@@ -1098,11 +1179,19 @@ part_parm :
|
||||
K_MEMORY TKN_STRING
|
||||
{
|
||||
current_mem = avr_new_memtype();
|
||||
strcpy(current_mem->desc, strdup($2->value.string));
|
||||
strncpy(current_mem->desc, $2->value.string, AVR_MEMDESCLEN);
|
||||
current_mem->desc[AVR_MEMDESCLEN-1] = 0;
|
||||
free_token($2);
|
||||
}
|
||||
mem_specs
|
||||
{
|
||||
AVRMEM * existing_mem;
|
||||
|
||||
existing_mem = avr_locate_mem(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);
|
||||
current_mem = NULL;
|
||||
} |
|
||||
@@ -1115,6 +1204,12 @@ part_parm :
|
||||
opnum = which_opcode($1);
|
||||
op = avr_new_opcode();
|
||||
parse_cmdbits(op);
|
||||
if (current_part->op[opnum] != NULL) {
|
||||
/*fprintf(stderr,
|
||||
"%s: warning at %s:%d: operation redefined\n",
|
||||
progname, infile, lineno);*/
|
||||
avr_free_opcode(current_part->op[opnum]);
|
||||
}
|
||||
current_part->op[opnum] = op;
|
||||
|
||||
free_token($1);
|
||||
@@ -1160,6 +1255,12 @@ mem_spec :
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_OFFSET TKN_EQUAL TKN_NUMBER
|
||||
{
|
||||
current_mem->offset = $3->value.number;
|
||||
free_token($3);
|
||||
} |
|
||||
|
||||
K_MIN_WRITE_DELAY TKN_EQUAL TKN_NUMBER
|
||||
{
|
||||
current_mem->min_write_delay = $3->value.number;
|
||||
@@ -1230,6 +1331,12 @@ mem_spec :
|
||||
opnum = which_opcode($1);
|
||||
op = avr_new_opcode();
|
||||
parse_cmdbits(op);
|
||||
if (current_mem->op[opnum] != NULL) {
|
||||
/*fprintf(stderr,
|
||||
"%s: warning at %s:%d: operation redefined\n",
|
||||
progname, infile, lineno);*/
|
||||
avr_free_opcode(current_mem->op[opnum]);
|
||||
}
|
||||
current_mem->op[opnum] = op;
|
||||
|
||||
free_token($1);
|
||||
@@ -1244,7 +1351,8 @@ mem_spec :
|
||||
static char * vtypestr(int type)
|
||||
{
|
||||
switch (type) {
|
||||
case V_NUM : return "NUMERIC";
|
||||
case V_NUM : return "INTEGER";
|
||||
case V_NUM_REAL: return "REAL";
|
||||
case V_STR : return "STRING";
|
||||
default:
|
||||
return "<UNKNOWN>";
|
||||
@@ -1258,22 +1366,44 @@ static int assign_pin(int pinno, TOKEN * v, int invert)
|
||||
int value;
|
||||
|
||||
value = v->value.number;
|
||||
free_token(v);
|
||||
|
||||
if ((value <= 0) || (value >= 18)) {
|
||||
if ((value < PIN_MIN) || (value > PIN_MAX)) {
|
||||
fprintf(stderr,
|
||||
"%s: error at line %d of %s: pin must be in the "
|
||||
"range 1-17\n",
|
||||
progname, lineno, infile);
|
||||
"range %d-%d\n",
|
||||
progname, lineno, infile, PIN_MIN, PIN_MAX);
|
||||
exit(1);
|
||||
}
|
||||
if (invert)
|
||||
value |= PIN_INVERSE;
|
||||
|
||||
current_prog->pinno[pinno] = value;
|
||||
pin_set_value(&(current_prog->pin[pinno]), value, invert);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int assign_pin_list(int invert)
|
||||
{
|
||||
TOKEN * t;
|
||||
int pin;
|
||||
|
||||
current_prog->pinno[pin_name] = 0;
|
||||
while (lsize(number_list)) {
|
||||
t = lrmv_n(number_list, 1);
|
||||
pin = t->value.number;
|
||||
if ((pin < PIN_MIN) || (pin > PIN_MAX)) {
|
||||
fprintf(stderr,
|
||||
"%s: error at line %d of %s: pin must be in the "
|
||||
"range %d-%d\n",
|
||||
progname, lineno, infile, PIN_MIN, PIN_MAX);
|
||||
exit(1);
|
||||
/* TODO clear list and free tokens if no exit is done */
|
||||
}
|
||||
pin_set_value(&(current_prog->pin[pin_name]), pin, invert);
|
||||
free_token(t);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int which_opcode(TOKEN * opcode)
|
||||
{
|
||||
@@ -1308,7 +1438,7 @@ static int parse_cmdbits(OPCODE * op)
|
||||
char * e;
|
||||
char * q;
|
||||
int len;
|
||||
char * s, *brkt;
|
||||
char * s, *brkt = NULL;
|
||||
|
||||
bitno = 32;
|
||||
while (lsize(string_list)) {
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
# 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
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
#
|
||||
@@ -23,8 +22,8 @@
|
||||
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.57)
|
||||
AC_INIT(avrdude, 5.4, avrdude-dev@nongnu.org)
|
||||
AC_PREREQ(2.60)
|
||||
AC_INIT(avrdude, 6.0.1, avrdude-dev@nongnu.org)
|
||||
|
||||
AC_CANONICAL_BUILD
|
||||
AC_CANONICAL_HOST
|
||||
@@ -32,19 +31,71 @@ AC_CANONICAL_TARGET
|
||||
|
||||
AC_CONFIG_SRCDIR([main.c])
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_CONFIG_HEADER(ac_cfg.h)
|
||||
AC_CONFIG_HEADERS(ac_cfg.h)
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_SED
|
||||
AC_PROG_YACC
|
||||
AM_PROG_LEX
|
||||
AC_PROG_LEX
|
||||
AN_MAKEVAR([RANLIB], [AC_PROG_RANLIB])
|
||||
AN_PROGRAM([ranlib], [AC_PROG_RANLIB])
|
||||
AC_DEFUN([AC_PROG_RANLIB], [AC_CHECK_TARGET_TOOL(RANLIB, ranlib, :)])
|
||||
AC_PROG_RANLIB
|
||||
AN_MAKEVAR([AR], [AC_PROG_AR])
|
||||
AN_PROGRAM([ar], [AC_PROG_AR])
|
||||
AC_DEFUN([AC_PROG_AR], [AC_CHECK_TARGET_TOOL(AR, ar, :)])
|
||||
AC_PROG_AR
|
||||
AH_TEMPLATE([HAVE_YYLEX_DESTROY],
|
||||
[Define if lex/flex has yylex_destroy])
|
||||
# flex should have this
|
||||
if test "x$LEX" == xflex; then
|
||||
AC_MSG_CHECKING([whether yylex_destroy is generated by flex])
|
||||
flex_version=`$LEX -V -v --version 2>/dev/null | $SED -e 's/^.* //'`
|
||||
case $flex_version in
|
||||
[[0-1].*)]
|
||||
AC_MSG_RESULT([version $flex_version => no])
|
||||
;;
|
||||
[2.[0-4].*)]
|
||||
AC_MSG_RESULT([version $flex_version => no])
|
||||
;;
|
||||
[2.5.[0-8])]
|
||||
AC_MSG_RESULT([version $flex_version => no])
|
||||
;;
|
||||
[2.5.[0-8][A-Za-z]*)]
|
||||
AC_MSG_RESULT([version $flex_version => no])
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT([version $flex_version => yes])
|
||||
AC_DEFINE([HAVE_YYLEX_DESTROY])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
dnl Makefile.am:77: compiling `config_gram.c' with per-target flags requires `AM_PROG_CC_C_O' in `configure.ac'
|
||||
AM_PROG_CC_C_O
|
||||
|
||||
# Checks for libraries.
|
||||
AC_CHECK_LIB([termcap], [tputs])
|
||||
AC_CHECK_LIB([ncurses], [tputs])
|
||||
AC_CHECK_LIB([readline], [readline])
|
||||
AH_TEMPLATE([HAVE_LIBELF],
|
||||
[Define if ELF support is enabled via libelf])
|
||||
AC_CHECK_LIB([elf], [elf_begin], [have_libelf=yes])
|
||||
if test x$have_libelf = xyes; then
|
||||
case $target in
|
||||
*)
|
||||
LIBELF="-lelf"
|
||||
;;
|
||||
esac
|
||||
AC_DEFINE([HAVE_LIBELF])
|
||||
AC_CHECK_HEADERS([libelf.h libelf/libelf.h])
|
||||
fi
|
||||
AC_SUBST(LIBELF, $LIBELF)
|
||||
|
||||
AC_SEARCH_LIBS([gethostent], [nsl])
|
||||
AC_SEARCH_LIBS([setsockopt], [socket])
|
||||
AH_TEMPLATE([HAVE_LIBUSB],
|
||||
[Define if USB support is enabled via libusb])
|
||||
AC_CHECK_LIB([usb], [usb_get_string_simple], [have_libusb=yes])
|
||||
@@ -58,24 +109,91 @@ if test x$have_libusb = xyes; then
|
||||
;;
|
||||
esac
|
||||
AC_DEFINE([HAVE_LIBUSB])
|
||||
AC_CHECK_HEADERS([usb.h])
|
||||
AC_CHECK_HEADERS([lusb0_usb.h])
|
||||
fi
|
||||
AC_SUBST(LIBUSB, $LIBUSB)
|
||||
|
||||
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
|
||||
case $target in
|
||||
*-*-darwin*)
|
||||
LIBUSB_1_0="-lusb-1.0 -framework CoreFoundation -framework IOKit"
|
||||
;;
|
||||
*)
|
||||
LIBUSB_1_0="-lusb-1.0"
|
||||
;;
|
||||
esac
|
||||
AC_DEFINE([HAVE_LIBUSB_1_0])
|
||||
AC_CHECK_HEADERS([libusb-1.0/libusb.h])
|
||||
AC_CHECK_HEADERS([libusb.h])
|
||||
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
|
||||
case $target in
|
||||
*-*-freebsd*)
|
||||
# FreeBSD 8+ has a native libusb-1.0 API compatible
|
||||
# library offered by -lusb (which is also libusb-0.1
|
||||
# compatible). FreeBSD <8 does not have a libusb-1.0
|
||||
# at all so probing will fail but we do not have to
|
||||
# special-case that.
|
||||
LIBUSB_1_0="-lusb"
|
||||
;;
|
||||
*)
|
||||
LIBUSB_1_0="-lusb-1.0"
|
||||
;;
|
||||
esac
|
||||
AC_DEFINE([HAVE_LIBUSB_1_0])
|
||||
AC_CHECK_HEADERS([libusb.h])
|
||||
fi
|
||||
AC_SUBST(LIBUSB_1_0, $LIBUSB_1_0)
|
||||
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([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)
|
||||
else
|
||||
if test x$have_libftdi = xyes; then
|
||||
LIBFTDI="-lftdi -lusb"
|
||||
AC_DEFINE([HAVE_LIBFTDI])
|
||||
AC_SUBST(LIBFTDI, $LIBFTDI)
|
||||
AC_CHECK_DECL(TYPE_232H,[have_libftdi_FT232H=yes], [], [[#include <ftdi.h>]])
|
||||
if test x$have_libftdi_FT232H = xyes; then
|
||||
AC_DEFINE([HAVE_LIBFTDI_TYPE_232H])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_CHECK_HEADERS([pthread.h])
|
||||
# as there exits header file only pthread implementations for Windows, check if we have a library
|
||||
AC_CHECK_LIB([pthread], [pthread_create], [have_pthread=yes])
|
||||
if test x$have_pthread = xyes; then
|
||||
LIBPTHREAD="-lpthread"
|
||||
fi
|
||||
AC_SUBST(LIBPTHREAD, $LIBPTHREAD)
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([limits.h stdlib.h string.h])
|
||||
AC_CHECK_HEADERS([fcntl.h sys/ioctl.h sys/time.h termios.h unistd.h])
|
||||
AC_CHECK_HEADERS([ddk/hidsdi.h],,,[#include <windows.h>
|
||||
#include <setupapi.h>])
|
||||
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_HEADER_TIME
|
||||
|
||||
# Checks for library functions.
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_FUNC_MALLOC
|
||||
AC_CHECK_FUNCS([memset select strcasecmp strdup strerror strncasecmp strtol strtoul gettimeofday])
|
||||
AC_CHECK_FUNCS([memset select strcasecmp strdup strerror strncasecmp strtol strtoul gettimeofday usleep])
|
||||
|
||||
AC_MSG_CHECKING([for a Win32 HID libray])
|
||||
SAVED_LIBS="${LIBS}"
|
||||
@@ -119,6 +237,13 @@ fi
|
||||
LIBS="${SAVED_LIBS}"
|
||||
AC_SUBST(LIBHID, $LIBHID)
|
||||
|
||||
# Check for types
|
||||
|
||||
# Solaris has uint_t and ulong_t typedefs in <sys/types.h>, avoid
|
||||
# the redeclaration in usbtiny.c.
|
||||
AC_CHECK_TYPES([uint_t], [], [], [#include <sys/types.h>])
|
||||
AC_CHECK_TYPES([ulong_t], [], [], [#include <sys/types.h>])
|
||||
|
||||
# Checks for misc stuff.
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
@@ -162,13 +287,25 @@ AC_ARG_ENABLE(
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for enable-parport option) ;;
|
||||
esac],
|
||||
[enabled_parport=yes])
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
[linuxgpio],
|
||||
AC_HELP_STRING(
|
||||
[--enable-linuxgpio],
|
||||
[Enable the Linux sysfs GPIO interface programmer type]),
|
||||
[case "${enableval}" in
|
||||
yes) enabled_linuxgpio=yes ;;
|
||||
no) enabled_linuxgpio=no ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for enable-linuxgpio option) ;;
|
||||
esac],
|
||||
[enabled_linuxgpio=no])
|
||||
|
||||
DIST_SUBDIRS_AC='doc windows'
|
||||
|
||||
if test "$enabled_doc" = "yes"; then
|
||||
SUBDIRS_AC='doc @WINDOWS_DIRS@'
|
||||
SUBDIRS_AC='doc'
|
||||
else
|
||||
SUBDIRS_AC='@WINDOWS_DIRS@'
|
||||
SUBDIRS_AC=''
|
||||
fi
|
||||
|
||||
AC_SUBST(DOC_INST_DIR, $DOC_INST_DIR)
|
||||
@@ -187,13 +324,13 @@ case $target in
|
||||
DEFAULT_PAR_PORT="unknown"
|
||||
DEFAULT_SER_PORT="/dev/ttyS0"
|
||||
;;
|
||||
i[[3456]]86-*-freebsd*|amd64-*-freebsd*)
|
||||
i[[3456]]86-*-*freebsd*|amd64-*-*freebsd*)
|
||||
DEFAULT_PAR_PORT="/dev/ppi0"
|
||||
DEFAULT_SER_PORT="/dev/cuaa0"
|
||||
DEFAULT_SER_PORT="/dev/cuad0"
|
||||
;;
|
||||
*-*-freebsd*)
|
||||
*-*-*freebsd*)
|
||||
DEFAULT_PAR_PORT="unknown"
|
||||
DEFAULT_SER_PORT="/dev/cuaa0"
|
||||
DEFAULT_SER_PORT="/dev/cuad0"
|
||||
;;
|
||||
*-*-solaris*)
|
||||
DEFAULT_PAR_PORT="/dev/printers/0"
|
||||
@@ -230,24 +367,94 @@ if test "$enabled_parport" = "yes"; then
|
||||
else
|
||||
confsubst="-e /^@HAVE_PARPORT_BEGIN@/,/^@HAVE_PARPORT_END@/d"
|
||||
fi
|
||||
export confsubst
|
||||
|
||||
# See if we need to drop into the windows subdir.
|
||||
case $target in
|
||||
*-*-mingw32* | *-*-cygwin* | *-*-windows*)
|
||||
WINDOWS_DIRS="windows"
|
||||
CFLAGS="${CFLAGS} -mno-cygwin -DWIN32NATIVE"
|
||||
LDFLAGS="${LDFLAGS} -static"
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(WINDOWS_DIRS,$WINDOWS_DIRS)
|
||||
|
||||
if test "$enabled_linuxgpio" = "yes"; then
|
||||
AC_DEFINE(HAVE_LINUXGPIO, 1, [Linux sysfs GPIO support enabled])
|
||||
confsubst="$confsubst -e /^@HAVE_LINUXGPIO_/d"
|
||||
else
|
||||
confsubst="$confsubst -e /^@HAVE_LINUXGPIO_BEGIN@/,/^@HAVE_LINUXGPIO_END@/d"
|
||||
fi
|
||||
|
||||
|
||||
# If we are compiling with gcc, enable all warning and make warnings errors.
|
||||
if test "$GCC" = yes; then
|
||||
ENABLE_WARNINGS="-Wall"
|
||||
|
||||
# does this compiler support -Wno-pointer-sign ?
|
||||
AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ])
|
||||
|
||||
safe_CFLAGS=$CFLAGS
|
||||
CFLAGS="$ENABLE_WARNINGS -Wno-pointer-sign"
|
||||
|
||||
AC_TRY_COMPILE(, [ int main () { return 0 ; } ], [
|
||||
no_pointer_sign=yes
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
no_pointer_sign=no
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
CFLAGS=$safe_CFLAGS
|
||||
|
||||
if test x$no_pointer_sign = xyes; then
|
||||
ENABLE_WARNINGS="$ENABLE_WARNINGS -Wno-pointer-sign"
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(ENABLE_WARNINGS,$ENABLE_WARNINGS)
|
||||
|
||||
# See if we need to drop into the windows subdir.
|
||||
case $target in
|
||||
*-*-mingw32* | *-*-cygwin* | *-*-windows*)
|
||||
if test "$GCC" = yes -a \( "$CC" = "cc" -o "$CC" = "gcc" \); then
|
||||
# does this compiler support -mno-cygwin?
|
||||
AC_MSG_CHECKING([if $CC accepts -mno-cygwin])
|
||||
|
||||
safe_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$ENABLE_WARNINGS -mno-cygwin"
|
||||
|
||||
AC_TRY_COMPILE(, [ int main () { return 0 ; } ], [
|
||||
no_cygwin=yes
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
no_cygwin=no
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
CFLAGS="$safe_CFLAGS"
|
||||
|
||||
if test x$no_cygwin = xyes; then
|
||||
CFLAGS="${CFLAGS} -mno-cygwin"
|
||||
else
|
||||
AC_MSG_NOTICE([Your compiler does not understand the -mno-cygwin option.])
|
||||
AC_MSG_NOTICE([You might want to select an alternative compiler, like])
|
||||
AC_MSG_NOTICE([])
|
||||
AC_MSG_NOTICE([CC=mingw32-gcc ./configure])
|
||||
AC_MSG_NOTICE([])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([if linker accepts -static])
|
||||
|
||||
safe_LDFLAGS="$LDFLAGS"
|
||||
LDFLAGS="${LDFLAGS} -static"
|
||||
AC_TRY_LINK(, [ int main () { return 0 ; } ], [
|
||||
can_link_static=yes
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
can_link_static_cygwin=no
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
LDFLAGS="$safe_LDFLAGS"
|
||||
|
||||
if test x$can_link_static = xyes; then
|
||||
LDFLAGS="${LDFLAGS} -static"
|
||||
fi
|
||||
|
||||
WINDOWS_DIRS="windows"
|
||||
CFLAGS="${CFLAGS} -DWIN32NATIVE"
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(WINDOWS_DIRS,$WINDOWS_DIRS)
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
doc/Makefile
|
||||
windows/Makefile
|
||||
@@ -263,6 +470,77 @@ AC_CONFIG_FILES([
|
||||
# avrdude.conf file.
|
||||
|
||||
AC_CONFIG_FILES([avrdude.conf.tmp:avrdude.conf.in],
|
||||
[sed $confsubst avrdude.conf.tmp > avrdude.conf])
|
||||
[sed $confsubst avrdude.conf.tmp > avrdude.conf],
|
||||
[confsubst="$confsubst"])
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Configuration summary:"
|
||||
echo "----------------------"
|
||||
|
||||
if test x$have_libelf = xyes; then
|
||||
echo "DO HAVE libelf"
|
||||
else
|
||||
echo "DON'T HAVE libelf"
|
||||
fi
|
||||
|
||||
if test x$have_libusb = xyes; then
|
||||
echo "DO HAVE libusb"
|
||||
else
|
||||
echo "DON'T HAVE libusb"
|
||||
fi
|
||||
|
||||
if test x$have_libusb_1_0 = xyes; then
|
||||
echo "DO HAVE libusb_1_0"
|
||||
else
|
||||
echo "DON'T HAVE libusb_1_0"
|
||||
fi
|
||||
|
||||
if test x$have_libftdi1 = xyes; then
|
||||
echo "DO HAVE libftdi1"
|
||||
else
|
||||
echo "DON'T HAVE libftdi1"
|
||||
fi
|
||||
|
||||
if test x$have_libftdi = xyes; then
|
||||
if test x$have_libftdi1 = xyes; then
|
||||
echo "DO HAVE libftdi (but prefer to use libftdi1)"
|
||||
else
|
||||
echo "DO HAVE libftdi"
|
||||
fi
|
||||
else
|
||||
echo "DON'T HAVE libftdi"
|
||||
fi
|
||||
|
||||
if test x$have_libhid = xyes; then
|
||||
echo "DO HAVE libhid"
|
||||
else
|
||||
echo "DON'T HAVE libhid"
|
||||
fi
|
||||
|
||||
if test x$have_pthread = xyes; then
|
||||
echo "DO HAVE pthread"
|
||||
else
|
||||
echo "DON'T HAVE pthread"
|
||||
fi
|
||||
|
||||
if test x$enabled_doc = xyes; then
|
||||
echo "ENABLED doc"
|
||||
else
|
||||
echo "DISABLED doc"
|
||||
fi
|
||||
|
||||
if test x$enabled_parport = xyes; then
|
||||
echo "ENABLED parport"
|
||||
else
|
||||
echo "DISABLED parport"
|
||||
fi
|
||||
|
||||
if test x$enabled_linuxgpio = xyes; then
|
||||
echo "ENABLED linuxgpio"
|
||||
else
|
||||
echo "DISABLED linuxgpio"
|
||||
fi
|
||||
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "avrdude.h"
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -20,3 +20,6 @@ mdate-sh
|
||||
stamp-vti
|
||||
texinfo.tex
|
||||
version.texi
|
||||
programmer_types.texi
|
||||
parts.texi
|
||||
programmers.texi
|
||||
|
||||
@@ -13,25 +13,33 @@
|
||||
# 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
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
GENERATED_TEXINFOS = \
|
||||
$(builddir)/programmers.texi \
|
||||
$(builddir)/parts.texi \
|
||||
$(builddir)/programmer_types.texi \
|
||||
$(builddir)/version.texi
|
||||
|
||||
CLEANFILES = \
|
||||
version.texi \
|
||||
stamp-vti
|
||||
$(GENERATED_TEXINFOS) \
|
||||
$(builddir)/stamp-vti
|
||||
|
||||
info_TEXINFOS = avrdude.texi
|
||||
|
||||
EXTRA_DIST = \
|
||||
parts_comments.txt
|
||||
|
||||
all-local: info html ps pdf
|
||||
|
||||
html: avrdude-html/avrdude.html
|
||||
|
||||
avrdude-html/avrdude.html: $(srcdir)/$(info_TEXINFOS)
|
||||
avrdude-html/avrdude.html: $(srcdir)/$(info_TEXINFOS) $(GENERATED_TEXINFOS)
|
||||
texi2html -split_node $(srcdir)/$(info_TEXINFOS)
|
||||
if [ -e ./avrdude.html -o -e ./avrdude_1.html ]; then \
|
||||
mkdir -p avrdude-html ; \
|
||||
@@ -40,6 +48,32 @@ avrdude-html/avrdude.html: $(srcdir)/$(info_TEXINFOS)
|
||||
mv -f avrdude avrdude-html; \
|
||||
fi;
|
||||
|
||||
$(builddir)/avrdude.info: $(GENERATED_TEXINFOS)
|
||||
$(builddir)/avrdude.dvi: $(GENERATED_TEXINFOS)
|
||||
$(builddir)/avrdude.pdf: $(GENERATED_TEXINFOS)
|
||||
|
||||
# if it does not exist make this first
|
||||
../avrdude$(EXEEXT):
|
||||
$(MAKE) -C .. avrdude$(EXEEXT)
|
||||
|
||||
$(builddir)/programmers.texi: ../avrdude$(EXEEXT) ../avrdude.conf Makefile
|
||||
../avrdude$(EXEEXT) -C ../avrdude.conf -c \? 2>&1 \
|
||||
| $(AWK) '$$2 ~ /^=$$/ {printf("@item @code{%s} @tab %s\n",$$1,gensub("[^=]+=[ \t]*","",1))}' \
|
||||
| sed "s# *,\? *<\?\(http://[^ \t>]*\)>\?#,@*\n@url{\1}#g" \
|
||||
>programmers.texi
|
||||
|
||||
$(builddir)/programmer_types.texi: ../avrdude$(EXEEXT) ../avrdude.conf Makefile
|
||||
../avrdude$(EXEEXT) -C ../avrdude.conf -c \?type 2>&1 \
|
||||
| $(AWK) '$$2 ~ /^=$$/ {printf("@item @code{%s} @tab %s\n",$$1,gensub("[^=]+=[ \t]*","",1))}' \
|
||||
| sed "s#<\?\(http://[^ \t,>]*\)>\?#@url{\1}#g" \
|
||||
>programmer_types.texi
|
||||
|
||||
$(builddir)/parts.texi: ../avrdude$(EXEEXT) ../avrdude.conf parts_comments.txt Makefile
|
||||
../avrdude$(EXEEXT) -C ../avrdude.conf -p \? 2>&1 \
|
||||
| $(AWK) '$$2 ~ /^=$$/ {printf("@item @code{%s} @tab %s\n",$$1,$$3)}' \
|
||||
| sed -e "`sed 's:\([^ \t]*\)[ \t]*\(.*\):s/\1$$/\1 \2/g:g' <parts_comments.txt`" \
|
||||
>parts.texi
|
||||
|
||||
clean-local:
|
||||
rm -rf avrdude-html *.info
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
5
avrdude/doc/parts_comments.txt
Normal file
5
avrdude/doc/parts_comments.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
AT90S1200 (****)
|
||||
AT90S2343 (*)
|
||||
ATmega2560 (**)
|
||||
ATmega2561 (**)
|
||||
ATtiny11 (***)
|
||||
661
avrdude/fileio.c
661
avrdude/fileio.c
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -27,6 +26,16 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef HAVE_LIBELF
|
||||
#ifdef HAVE_LIBELF_H
|
||||
#include <libelf.h>
|
||||
#elif defined(HAVE_LIBELF_LIBELF_H)
|
||||
#include <libelf/libelf.h>
|
||||
#endif
|
||||
#define EM_AVR32 0x18ad /* inofficial */
|
||||
#endif
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "avr.h"
|
||||
@@ -52,30 +61,40 @@ static int b2ihex(unsigned char * inbuf, int bufsize,
|
||||
char * outfile, FILE * outf);
|
||||
|
||||
static int ihex2b(char * infile, FILE * inf,
|
||||
unsigned char * outbuf, int bufsize);
|
||||
AVRMEM * mem, int bufsize, unsigned int fileoffset);
|
||||
|
||||
static int b2srec(unsigned char * inbuf, int bufsize,
|
||||
int recsize, int startaddr,
|
||||
char * outfile, FILE * outf);
|
||||
|
||||
static int srec2b(char * infile, FILE * inf,
|
||||
unsigned char * outbuf, int bufsize);
|
||||
AVRMEM * mem, int bufsize, unsigned int fileoffset);
|
||||
|
||||
static int ihex_readrec(struct ihexrec * ihex, char * rec);
|
||||
|
||||
static int srec_readrec(struct ihexrec * srec, char * rec);
|
||||
|
||||
static int fileio_rbin(struct fioparms * fio,
|
||||
char * filename, FILE * f, unsigned char * buf, int size);
|
||||
char * filename, FILE * f, AVRMEM * mem, int size);
|
||||
|
||||
static int fileio_ihex(struct fioparms * fio,
|
||||
char * filename, FILE * f, unsigned char * buf, int size);
|
||||
char * filename, FILE * f, AVRMEM * mem, int size);
|
||||
|
||||
static int fileio_srec(struct fioparms * fio,
|
||||
char * filename, FILE * f, unsigned char * buf, int size);
|
||||
char * filename, FILE * f, AVRMEM * mem, int size);
|
||||
|
||||
#ifdef HAVE_LIBELF
|
||||
static int elf2b(char * infile, FILE * inf,
|
||||
AVRMEM * mem, struct avrpart * p,
|
||||
int bufsize, unsigned int fileoffset);
|
||||
|
||||
static int fileio_elf(struct fioparms * fio,
|
||||
char * filename, FILE * f, AVRMEM * mem,
|
||||
struct avrpart * p, int size);
|
||||
#endif
|
||||
|
||||
static int fileio_num(struct fioparms * fio,
|
||||
char * filename, FILE * f, unsigned char * buf, int size,
|
||||
char * filename, FILE * f, AVRMEM * mem, int size,
|
||||
FILEFMT fmt);
|
||||
|
||||
static int fmt_autodetect(char * fname);
|
||||
@@ -89,6 +108,7 @@ char * fmtstr(FILEFMT format)
|
||||
case FMT_SREC : return "Motorola S-Record"; break;
|
||||
case FMT_IHEX : return "Intel Hex"; break;
|
||||
case FMT_RBIN : return "raw binary"; break;
|
||||
case FMT_ELF : return "ELF"; break;
|
||||
default : return "invalid format"; break;
|
||||
};
|
||||
}
|
||||
@@ -261,12 +281,10 @@ static int ihex_readrec(struct ihexrec * ihex, char * rec)
|
||||
* If an error occurs, return -1.
|
||||
*
|
||||
* */
|
||||
|
||||
static int ihex2b(char * infile, FILE * inf,
|
||||
unsigned char * outbuf, int bufsize)
|
||||
AVRMEM * mem, int bufsize, unsigned int fileoffset)
|
||||
{
|
||||
char buffer [ MAX_LINE_LEN ];
|
||||
unsigned char * buf;
|
||||
unsigned int nextaddr, baseaddr, maxaddr;
|
||||
int i;
|
||||
int lineno;
|
||||
@@ -275,9 +293,9 @@ static int ihex2b(char * infile, FILE * inf,
|
||||
int rc;
|
||||
|
||||
lineno = 0;
|
||||
buf = outbuf;
|
||||
baseaddr = 0;
|
||||
maxaddr = 0;
|
||||
nextaddr = 0;
|
||||
|
||||
while (fgets((char *)buffer,MAX_LINE_LEN,inf)!=NULL) {
|
||||
lineno++;
|
||||
@@ -301,9 +319,14 @@ static int ihex2b(char * infile, FILE * inf,
|
||||
}
|
||||
|
||||
switch (ihex.rectyp) {
|
||||
|
||||
case 0: /* data record */
|
||||
nextaddr = ihex.loadofs + baseaddr;
|
||||
if (fileoffset != 0 && baseaddr < fileoffset) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: address 0x%04x out of range (below fileoffset 0x%x) at line %d of %s\n",
|
||||
progname, baseaddr, fileoffset, lineno, infile);
|
||||
return -1;
|
||||
}
|
||||
nextaddr = ihex.loadofs + baseaddr - fileoffset;
|
||||
if (nextaddr + ihex.reclen > bufsize) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: address 0x%04x out of range at line %d of %s\n",
|
||||
@@ -311,7 +334,8 @@ static int ihex2b(char * infile, FILE * inf,
|
||||
return -1;
|
||||
}
|
||||
for (i=0; i<ihex.reclen; i++) {
|
||||
buf[nextaddr+i] = ihex.data[i];
|
||||
mem->buf[nextaddr+i] = ihex.data[i];
|
||||
mem->tags[nextaddr+i] = TAG_ALLOCATED;
|
||||
}
|
||||
if (nextaddr+ihex.reclen > maxaddr)
|
||||
maxaddr = nextaddr+ihex.reclen;
|
||||
@@ -348,15 +372,24 @@ static int ihex2b(char * infile, FILE * inf,
|
||||
|
||||
} /* while */
|
||||
|
||||
fprintf(stderr,
|
||||
"%s: WARNING: no end of file record found for Intel Hex "
|
||||
"file \"%s\"\n",
|
||||
progname, infile);
|
||||
if (maxaddr == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: No valid record found in Intel Hex "
|
||||
"file \"%s\"\n",
|
||||
progname, infile);
|
||||
|
||||
return maxaddr;
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr,
|
||||
"%s: WARNING: no end of file record found for Intel Hex "
|
||||
"file \"%s\"\n",
|
||||
progname, infile);
|
||||
|
||||
return maxaddr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int b2srec(unsigned char * inbuf, int bufsize,
|
||||
int recsize, int startaddr,
|
||||
char * outfile, FILE * outf)
|
||||
@@ -540,11 +573,10 @@ static int srec_readrec(struct ihexrec * srec, char * rec)
|
||||
|
||||
|
||||
static int srec2b(char * infile, FILE * inf,
|
||||
unsigned char * outbuf, int bufsize)
|
||||
AVRMEM * mem, int bufsize, unsigned int fileoffset)
|
||||
{
|
||||
char buffer [ MAX_LINE_LEN ];
|
||||
unsigned char * buf;
|
||||
unsigned int nextaddr, baseaddr, maxaddr;
|
||||
unsigned int nextaddr, maxaddr;
|
||||
int i;
|
||||
int lineno;
|
||||
int len;
|
||||
@@ -556,8 +588,6 @@ static int srec2b(char * infile, FILE * inf,
|
||||
char * msg = 0;
|
||||
|
||||
lineno = 0;
|
||||
buf = outbuf;
|
||||
baseaddr = 0;
|
||||
maxaddr = 0;
|
||||
reccount = 0;
|
||||
|
||||
@@ -591,17 +621,17 @@ static int srec2b(char * infile, FILE * inf,
|
||||
|
||||
case 0x31: /* S1 - 16 bit address data record */
|
||||
datarec=1;
|
||||
msg="%s: ERROR: address 0x%04x out of range at line %d of %s\n";
|
||||
msg="%s: ERROR: address 0x%04x out of range %sat line %d of %s\n";
|
||||
break;
|
||||
|
||||
case 0x32: /* S2 - 24 bit address data record */
|
||||
datarec=1;
|
||||
msg="%s: ERROR: address 0x%06x out of range at line %d of %s\n";
|
||||
msg="%s: ERROR: address 0x%06x out of range %sat line %d of %s\n";
|
||||
break;
|
||||
|
||||
case 0x33: /* S3 - 32 bit address data record */
|
||||
datarec=1;
|
||||
msg="%s: ERROR: address 0x%08x out of range at line %d of %s\n";
|
||||
msg="%s: ERROR: address 0x%08x out of range %sat line %d of %s\n";
|
||||
break;
|
||||
|
||||
case 0x34: /* S4 - symbol record (LSI extension) */
|
||||
@@ -637,13 +667,23 @@ static int srec2b(char * infile, FILE * inf,
|
||||
}
|
||||
|
||||
if (datarec == 1) {
|
||||
nextaddr = srec.loadofs + baseaddr;
|
||||
if (nextaddr + srec.reclen > bufsize) {
|
||||
fprintf(stderr, msg, progname, nextaddr+srec.reclen, lineno, infile);
|
||||
nextaddr = srec.loadofs;
|
||||
if (nextaddr < fileoffset) {
|
||||
fprintf(stderr, msg, progname, nextaddr,
|
||||
"(below fileoffset) ",
|
||||
lineno, infile);
|
||||
return -1;
|
||||
}
|
||||
for (i=0; i<srec.reclen; i++)
|
||||
buf[nextaddr+i] = srec.data[i];
|
||||
nextaddr -= fileoffset;
|
||||
if (nextaddr + srec.reclen > bufsize) {
|
||||
fprintf(stderr, msg, progname, nextaddr+srec.reclen, "",
|
||||
lineno, infile);
|
||||
return -1;
|
||||
}
|
||||
for (i=0; i<srec.reclen; i++) {
|
||||
mem->buf[nextaddr+i] = srec.data[i];
|
||||
mem->tags[nextaddr+i] = TAG_ALLOCATED;
|
||||
}
|
||||
if (nextaddr+srec.reclen > maxaddr)
|
||||
maxaddr = nextaddr+srec.reclen;
|
||||
reccount++;
|
||||
@@ -659,6 +699,385 @@ static int srec2b(char * infile, FILE * inf,
|
||||
return maxaddr;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBELF
|
||||
/*
|
||||
* Determine whether the ELF file section pointed to by `sh' fits
|
||||
* completely into the program header segment pointed to by `ph'.
|
||||
*
|
||||
* Assumes the section has been checked already before to actually
|
||||
* contain data (SHF_ALLOC, SHT_PROGBITS, sh_size > 0).
|
||||
*
|
||||
* Sometimes, program header segments might be larger than the actual
|
||||
* file sections. On VM architectures, this is used to allow mmapping
|
||||
* the entire ELF file "as is" (including things like the program
|
||||
* header table itself).
|
||||
*/
|
||||
static inline
|
||||
int is_section_in_segment(Elf32_Shdr *sh, Elf32_Phdr *ph)
|
||||
{
|
||||
if (sh->sh_offset < ph->p_offset)
|
||||
return 0;
|
||||
if (sh->sh_offset + sh->sh_size > ph->p_offset + ph->p_filesz)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the ELF section descriptor that corresponds to program
|
||||
* header `ph'. The program header is expected to be of p_type
|
||||
* PT_LOAD, and to have a nonzero p_filesz. (PT_LOAD sections with a
|
||||
* zero p_filesz are typically RAM sections that are not initialized
|
||||
* by file data, e.g. ".bss".)
|
||||
*/
|
||||
static Elf_Scn *elf_get_scn(Elf *e, Elf32_Phdr *ph, Elf32_Shdr **shptr)
|
||||
{
|
||||
Elf_Scn *s = NULL;
|
||||
|
||||
while ((s = elf_nextscn(e, s)) != NULL) {
|
||||
Elf32_Shdr *sh;
|
||||
size_t ndx = elf_ndxscn(s);
|
||||
if ((sh = elf32_getshdr(s)) == NULL) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: Error reading section #%u header: %s\n",
|
||||
progname, (unsigned int)ndx, elf_errmsg(-1));
|
||||
continue;
|
||||
}
|
||||
if ((sh->sh_flags & SHF_ALLOC) == 0 ||
|
||||
sh->sh_type != SHT_PROGBITS)
|
||||
/* we are only interested in PROGBITS, ALLOC sections */
|
||||
continue;
|
||||
if (sh->sh_size == 0)
|
||||
/* we are not interested in empty sections */
|
||||
continue;
|
||||
if (is_section_in_segment(sh, ph)) {
|
||||
/* yeah, we found it */
|
||||
*shptr = sh;
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: Cannot find a matching section for "
|
||||
"program header entry @p_vaddr 0x%x\n",
|
||||
progname, ph->p_vaddr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int elf_mem_limits(AVRMEM *mem, struct avrpart * p,
|
||||
unsigned int *lowbound,
|
||||
unsigned int *highbound,
|
||||
unsigned int *fileoff)
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
if (p->flags & AVRPART_AVR32) {
|
||||
if (strcmp(mem->desc, "flash") == 0) {
|
||||
*lowbound = 0x80000000;
|
||||
*highbound = 0xffffffff;
|
||||
*fileoff = 0;
|
||||
} else {
|
||||
rv = -1;
|
||||
}
|
||||
} else {
|
||||
if (strcmp(mem->desc, "flash") == 0 ||
|
||||
strcmp(mem->desc, "boot") == 0 ||
|
||||
strcmp(mem->desc, "application") == 0 ||
|
||||
strcmp(mem->desc, "apptable") == 0) {
|
||||
*lowbound = 0;
|
||||
*highbound = 0x7ffff; /* max 8 MiB */
|
||||
*fileoff = 0;
|
||||
} else if (strcmp(mem->desc, "eeprom") == 0) {
|
||||
*lowbound = 0x810000;
|
||||
*highbound = 0x81ffff; /* max 64 KiB */
|
||||
*fileoff = 0;
|
||||
} else if (strcmp(mem->desc, "lfuse") == 0) {
|
||||
*lowbound = 0x820000;
|
||||
*highbound = 0x82ffff;
|
||||
*fileoff = 0;
|
||||
} else if (strcmp(mem->desc, "hfuse") == 0) {
|
||||
*lowbound = 0x820000;
|
||||
*highbound = 0x82ffff;
|
||||
*fileoff = 1;
|
||||
} else if (strcmp(mem->desc, "efuse") == 0) {
|
||||
*lowbound = 0x820000;
|
||||
*highbound = 0x82ffff;
|
||||
*fileoff = 2;
|
||||
} else if (strncmp(mem->desc, "fuse", 4) == 0 &&
|
||||
(mem->desc[4] >= '0' && mem->desc[4] <= '9')) {
|
||||
/* Xmega fuseN */
|
||||
*lowbound = 0x820000;
|
||||
*highbound = 0x82ffff;
|
||||
*fileoff = mem->desc[4] - '0';
|
||||
} else if (strcmp(mem->desc, "lock") == 0) {
|
||||
*lowbound = 0x830000;
|
||||
*highbound = 0x83ffff;
|
||||
*fileoff = 0;
|
||||
} else {
|
||||
rv = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
static int elf2b(char * infile, FILE * inf,
|
||||
AVRMEM * mem, struct avrpart * p,
|
||||
int bufsize, unsigned int fileoffset)
|
||||
{
|
||||
Elf *e;
|
||||
int rv = -1;
|
||||
unsigned int low, high, foff;
|
||||
|
||||
if (elf_mem_limits(mem, p, &low, &high, &foff) != 0) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: Cannot handle \"%s\" memory region from ELF file\n",
|
||||
progname, mem->desc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* The Xmega memory regions for "boot", "application", and
|
||||
* "apptable" are actually sub-regions of "flash". Refine the
|
||||
* applicable limits. This allows to select only the appropriate
|
||||
* sections out of an ELF file that contains section data for more
|
||||
* than one sub-segment.
|
||||
*/
|
||||
if ((p->flags & AVRPART_HAS_PDI) != 0 &&
|
||||
(strcmp(mem->desc, "boot") == 0 ||
|
||||
strcmp(mem->desc, "application") == 0 ||
|
||||
strcmp(mem->desc, "apptable") == 0)) {
|
||||
AVRMEM *flashmem = avr_locate_mem(p, "flash");
|
||||
if (flashmem == NULL) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: No \"flash\" memory region found, "
|
||||
"cannot compute bounds of \"%s\" sub-region.\n",
|
||||
progname, mem->desc);
|
||||
return -1;
|
||||
}
|
||||
/* The config file offsets are PDI offsets, rebase to 0. */
|
||||
low = mem->offset - flashmem->offset;
|
||||
high = low + mem->size - 1;
|
||||
}
|
||||
|
||||
if (elf_version(EV_CURRENT) == EV_NONE) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: ELF library initialization failed: %s\n",
|
||||
progname, elf_errmsg(-1));
|
||||
return -1;
|
||||
}
|
||||
if ((e = elf_begin(fileno(inf), ELF_C_READ, NULL)) == NULL) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: Cannot open \"%s\" as an ELF file: %s\n",
|
||||
progname, infile, elf_errmsg(-1));
|
||||
return -1;
|
||||
}
|
||||
if (elf_kind(e) != ELF_K_ELF) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: Cannot use \"%s\" as an ELF input file\n",
|
||||
progname, infile);
|
||||
goto done;
|
||||
}
|
||||
|
||||
size_t i, isize;
|
||||
const char *id = elf_getident(e, &isize);
|
||||
|
||||
if (id == NULL) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: Error reading ident area of \"%s\": %s\n",
|
||||
progname, infile, elf_errmsg(-1));
|
||||
goto done;
|
||||
}
|
||||
|
||||
const char *endianname;
|
||||
unsigned char endianess;
|
||||
if (p->flags & AVRPART_AVR32) {
|
||||
endianess = ELFDATA2MSB;
|
||||
endianname = "little";
|
||||
} else {
|
||||
endianess = ELFDATA2LSB;
|
||||
endianname = "big";
|
||||
}
|
||||
if (id[EI_CLASS] != ELFCLASS32 ||
|
||||
id[EI_DATA] != endianess) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: ELF file \"%s\" is not a "
|
||||
"32-bit, %s-endian file that was expected\n",
|
||||
progname, infile, endianname);
|
||||
goto done;
|
||||
}
|
||||
|
||||
Elf32_Ehdr *eh;
|
||||
if ((eh = elf32_getehdr(e)) == NULL) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: Error reading ehdr of \"%s\": %s\n",
|
||||
progname, infile, elf_errmsg(-1));
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (eh->e_type != ET_EXEC) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: ELF file \"%s\" is not an executable file\n",
|
||||
progname, infile);
|
||||
goto done;
|
||||
}
|
||||
|
||||
const char *mname;
|
||||
uint16_t machine;
|
||||
if (p->flags & AVRPART_AVR32) {
|
||||
machine = EM_AVR32;
|
||||
mname = "AVR32";
|
||||
} else {
|
||||
machine = EM_AVR;
|
||||
mname = "AVR";
|
||||
}
|
||||
if (eh->e_machine != machine) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: ELF file \"%s\" is not for machine %s\n",
|
||||
progname, infile, mname);
|
||||
goto done;
|
||||
}
|
||||
if (eh->e_phnum == 0xffff /* PN_XNUM */) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: ELF file \"%s\" uses extended "
|
||||
"program header numbers which are not expected\n",
|
||||
progname, infile);
|
||||
goto done;
|
||||
}
|
||||
|
||||
Elf32_Phdr *ph;
|
||||
if ((ph = elf32_getphdr(e)) == NULL) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: Error reading program header table of \"%s\": %s\n",
|
||||
progname, infile, elf_errmsg(-1));
|
||||
goto done;
|
||||
}
|
||||
|
||||
size_t sndx;
|
||||
if (elf_getshdrstrndx(e, &sndx) != 0) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: Error obtaining section name string table: %s\n",
|
||||
progname, elf_errmsg(-1));
|
||||
sndx = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Walk the program header table, pick up entries that are of type
|
||||
* PT_LOAD, and have a non-zero p_filesz.
|
||||
*/
|
||||
for (i = 0; i < eh->e_phnum; i++) {
|
||||
if (ph[i].p_type != PT_LOAD ||
|
||||
ph[i].p_filesz == 0)
|
||||
continue;
|
||||
|
||||
if (verbose >= 2) {
|
||||
fprintf(stderr,
|
||||
"%s: Considering PT_LOAD program header entry #%d:\n"
|
||||
" p_vaddr 0x%x, p_paddr 0x%x, p_filesz %d\n",
|
||||
progname, i, ph[i].p_vaddr, ph[i].p_paddr, ph[i].p_filesz);
|
||||
}
|
||||
|
||||
Elf32_Shdr *sh;
|
||||
Elf_Scn *s = elf_get_scn(e, ph + i, &sh);
|
||||
if (s == NULL)
|
||||
continue;
|
||||
|
||||
if ((sh->sh_flags & SHF_ALLOC) && sh->sh_size) {
|
||||
const char *sname;
|
||||
|
||||
if (sndx != 0) {
|
||||
sname = elf_strptr(e, sndx, sh->sh_name);
|
||||
} else {
|
||||
sname = "*unknown*";
|
||||
}
|
||||
|
||||
unsigned int lma;
|
||||
lma = ph[i].p_paddr + sh->sh_offset - ph[i].p_offset;
|
||||
|
||||
if (verbose >= 2) {
|
||||
fprintf(stderr,
|
||||
"%s: Found section \"%s\", LMA 0x%x, sh_size %u\n",
|
||||
progname, sname, lma, sh->sh_size);
|
||||
}
|
||||
|
||||
if (lma >= low &&
|
||||
lma + sh->sh_size < high) {
|
||||
/* OK */
|
||||
} else {
|
||||
if (verbose >= 2) {
|
||||
fprintf(stderr,
|
||||
" => skipping, inappropriate for \"%s\" memory region\n",
|
||||
mem->desc);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* 1-byte sized memory regions are special: they are used for fuse
|
||||
* bits, where multiple regions (in the config file) map to a
|
||||
* single, larger region in the ELF file (e.g. "lfuse", "hfuse",
|
||||
* and "efuse" all map to ".fuse"). We silently accept a larger
|
||||
* ELF file region for these, and extract the actual byte to write
|
||||
* from it, using the "foff" offset obtained above.
|
||||
*/
|
||||
if (mem->size != 1 &&
|
||||
sh->sh_size > mem->size) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: section \"%s\" does not fit into \"%s\" memory:\n"
|
||||
" 0x%x + %u > %u\n",
|
||||
progname, sname, mem->desc,
|
||||
lma, sh->sh_size, mem->size);
|
||||
continue;
|
||||
}
|
||||
|
||||
Elf_Data *d = NULL;
|
||||
while ((d = elf_getdata(s, d)) != NULL) {
|
||||
if (verbose >= 2) {
|
||||
fprintf(stderr,
|
||||
" Data block: d_buf %p, d_off 0x%x, d_size %d\n",
|
||||
d->d_buf, (unsigned int)d->d_off, d->d_size);
|
||||
}
|
||||
if (mem->size == 1) {
|
||||
if (d->d_off != 0) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: unexpected data block at offset != 0\n",
|
||||
progname);
|
||||
} else if (foff >= d->d_size) {
|
||||
fprintf(stderr,
|
||||
"%s: ERROR: ELF file section does not contain byte at offset %d\n",
|
||||
progname, foff);
|
||||
} else {
|
||||
if (verbose >= 2) {
|
||||
fprintf(stderr,
|
||||
" Extracting one byte from file offset %d\n",
|
||||
foff);
|
||||
}
|
||||
mem->buf[0] = ((unsigned char *)d->d_buf)[foff];
|
||||
mem->tags[0] = TAG_ALLOCATED;
|
||||
rv = 1;
|
||||
}
|
||||
} else {
|
||||
unsigned int idx;
|
||||
|
||||
idx = lma - low + d->d_off;
|
||||
if ((int)(idx + d->d_size) > rv)
|
||||
rv = idx + d->d_size;
|
||||
if (verbose >= 3) {
|
||||
fprintf(stderr,
|
||||
" Writing %d bytes to mem offset 0x%x\n",
|
||||
d->d_size, idx);
|
||||
}
|
||||
memcpy(mem->buf + idx, d->d_buf, d->d_size);
|
||||
memset(mem->tags + idx, TAG_ALLOCATED, d->d_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
done:
|
||||
(void)elf_end(e);
|
||||
return rv;
|
||||
}
|
||||
#endif /* HAVE_LIBELF */
|
||||
|
||||
/*
|
||||
* Simple itoa() implementation. Caller needs to allocate enough
|
||||
* space in buf. Only positive integers are handled.
|
||||
@@ -700,13 +1119,16 @@ static char *itoa_simple(int n, char *buf, int base)
|
||||
|
||||
|
||||
static int fileio_rbin(struct fioparms * fio,
|
||||
char * filename, FILE * f, unsigned char * buf, int size)
|
||||
char * filename, FILE * f, AVRMEM * mem, int size)
|
||||
{
|
||||
int rc;
|
||||
unsigned char *buf = mem->buf;
|
||||
|
||||
switch (fio->op) {
|
||||
case FIO_READ:
|
||||
rc = fread(buf, 1, size, f);
|
||||
if (rc > 0)
|
||||
memset(mem->tags, TAG_ALLOCATED, rc);
|
||||
break;
|
||||
case FIO_WRITE:
|
||||
rc = fwrite(buf, 1, size, f);
|
||||
@@ -730,7 +1152,7 @@ static int fileio_rbin(struct fioparms * fio,
|
||||
|
||||
|
||||
static int fileio_imm(struct fioparms * fio,
|
||||
char * filename, FILE * f, unsigned char * buf, int size)
|
||||
char * filename, FILE * f, AVRMEM * mem, int size)
|
||||
{
|
||||
int rc = 0;
|
||||
char * e, * p;
|
||||
@@ -743,13 +1165,18 @@ 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 */
|
||||
b = (strncmp (p, "0b", 2))?
|
||||
strtoul (p, &e, 0):
|
||||
strtoul (p + 2, &e, 2);
|
||||
if (*e != 0) {
|
||||
fprintf(stderr,
|
||||
"%s: invalid byte value (%s) specified for immediate mode\n",
|
||||
progname, p);
|
||||
return -1;
|
||||
}
|
||||
buf[loc++] = b;
|
||||
mem->buf[loc] = b;
|
||||
mem->tags[loc++] = TAG_ALLOCATED;
|
||||
p = strtok(NULL, " ,");
|
||||
rc = loc;
|
||||
}
|
||||
@@ -773,20 +1200,20 @@ static int fileio_imm(struct fioparms * fio,
|
||||
|
||||
|
||||
static int fileio_ihex(struct fioparms * fio,
|
||||
char * filename, FILE * f, unsigned char * buf, int size)
|
||||
char * filename, FILE * f, AVRMEM * mem, int size)
|
||||
{
|
||||
int rc;
|
||||
|
||||
switch (fio->op) {
|
||||
case FIO_WRITE:
|
||||
rc = b2ihex(buf, size, 32, 0, filename, f);
|
||||
rc = b2ihex(mem->buf, size, 32, fio->fileoffset, filename, f);
|
||||
if (rc < 0) {
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case FIO_READ:
|
||||
rc = ihex2b(filename, f, buf, size);
|
||||
rc = ihex2b(filename, f, mem, size, fio->fileoffset);
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
break;
|
||||
@@ -803,20 +1230,20 @@ static int fileio_ihex(struct fioparms * fio,
|
||||
|
||||
|
||||
static int fileio_srec(struct fioparms * fio,
|
||||
char * filename, FILE * f, unsigned char * buf, int size)
|
||||
char * filename, FILE * f, AVRMEM * mem, int size)
|
||||
{
|
||||
int rc;
|
||||
|
||||
switch (fio->op) {
|
||||
case FIO_WRITE:
|
||||
rc = b2srec(buf, size, 32, 0, filename, f);
|
||||
rc = b2srec(mem->buf, size, 32, fio->fileoffset, filename, f);
|
||||
if (rc < 0) {
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case FIO_READ:
|
||||
rc = srec2b(filename, f, buf, size);
|
||||
rc = srec2b(filename, f, mem, size, fio->fileoffset);
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
break;
|
||||
@@ -833,8 +1260,38 @@ static int fileio_srec(struct fioparms * fio,
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_LIBELF
|
||||
static int fileio_elf(struct fioparms * fio,
|
||||
char * filename, FILE * f, AVRMEM * mem,
|
||||
struct avrpart * p, int size)
|
||||
{
|
||||
int rc;
|
||||
|
||||
switch (fio->op) {
|
||||
case FIO_WRITE:
|
||||
fprintf(stderr, "%s: ERROR: write operation not (yet) "
|
||||
"supported for ELF\n",
|
||||
progname);
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case FIO_READ:
|
||||
rc = elf2b(filename, f, mem, p, size, fio->fileoffset);
|
||||
return rc;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "%s: ERROR: invalid ELF file I/O "
|
||||
"operation=%d\n",
|
||||
progname, fio->op);
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int fileio_num(struct fioparms * fio,
|
||||
char * filename, FILE * f, unsigned char * buf, int size,
|
||||
char * filename, FILE * f, AVRMEM * mem, int size,
|
||||
FILEFMT fmt)
|
||||
{
|
||||
const char *prefix;
|
||||
@@ -879,7 +1336,7 @@ static int fileio_num(struct fioparms * fio,
|
||||
if (putc(',', f) == EOF)
|
||||
goto writeerr;
|
||||
}
|
||||
num = (unsigned int)buf[i];
|
||||
num = (unsigned int)(mem->buf[i]);
|
||||
/*
|
||||
* For a base of 8 and a value < 8 to convert, don't write the
|
||||
* prefix. The conversion will be indistinguishable from a
|
||||
@@ -905,7 +1362,8 @@ static int fileio_num(struct fioparms * fio,
|
||||
}
|
||||
|
||||
|
||||
int fileio_setparms(int op, struct fioparms * fp)
|
||||
int fileio_setparms(int op, struct fioparms * fp,
|
||||
struct avrpart * p, AVRMEM * m)
|
||||
{
|
||||
fp->op = op;
|
||||
|
||||
@@ -931,6 +1389,19 @@ int fileio_setparms(int op, struct fioparms * fp)
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* AVR32 devices maintain their load offset within the file itself,
|
||||
* but AVRDUDE maintains all memory images 0-based.
|
||||
*/
|
||||
if ((p->flags & AVRPART_AVR32) != 0)
|
||||
{
|
||||
fp->fileoffset = m->offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
fp->fileoffset = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -943,6 +1414,7 @@ static int fmt_autodetect(char * fname)
|
||||
int i;
|
||||
int len;
|
||||
int found;
|
||||
int first = 1;
|
||||
|
||||
f = fopen(fname, "r");
|
||||
if (f == NULL) {
|
||||
@@ -952,6 +1424,14 @@ static int fmt_autodetect(char * fname)
|
||||
}
|
||||
|
||||
while (fgets((char *)buf, MAX_LINE_LEN, f)!=NULL) {
|
||||
/* check for ELF file */
|
||||
if (first &&
|
||||
(buf[0] == 0177 && buf[1] == 'E' &&
|
||||
buf[2] == 'L' && buf[3] == 'F')) {
|
||||
fclose(f);
|
||||
return FMT_ELF;
|
||||
}
|
||||
|
||||
buf[MAX_LINE_LEN-1] = 0;
|
||||
len = strlen((char *)buf);
|
||||
if (buf[len-1] == '\n')
|
||||
@@ -965,8 +1445,10 @@ static int fmt_autodetect(char * fname)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
if (found) {
|
||||
fclose(f);
|
||||
return FMT_RBIN;
|
||||
}
|
||||
|
||||
/* check for lines that look like intel hex */
|
||||
if ((buf[0] == ':') && (len >= 11)) {
|
||||
@@ -977,8 +1459,10 @@ static int fmt_autodetect(char * fname)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
if (found) {
|
||||
fclose(f);
|
||||
return FMT_IHEX;
|
||||
}
|
||||
}
|
||||
|
||||
/* check for lines that look like motorola s-record */
|
||||
@@ -990,11 +1474,16 @@ static int fmt_autodetect(char * fname)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
if (found) {
|
||||
fclose(f);
|
||||
return FMT_SREC;
|
||||
}
|
||||
}
|
||||
|
||||
first = 0;
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1006,7 +1495,6 @@ int fileio(int op, char * filename, FILEFMT format,
|
||||
int rc;
|
||||
FILE * f;
|
||||
char * fname;
|
||||
unsigned char * buf;
|
||||
struct fioparms fio;
|
||||
AVRMEM * mem;
|
||||
int using_stdio;
|
||||
@@ -1019,34 +1507,18 @@ int fileio(int op, char * filename, FILEFMT format,
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = fileio_setparms(op, &fio);
|
||||
rc = fileio_setparms(op, &fio, p, mem);
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
/* Open Raw Binary format in binary mode on Windows.*/
|
||||
if(format == FMT_RBIN)
|
||||
{
|
||||
if(fio.op == FIO_READ)
|
||||
{
|
||||
fio.mode = "rb";
|
||||
}
|
||||
if(fio.op == FIO_WRITE)
|
||||
{
|
||||
fio.mode = "wb";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* point at the requested memory buffer */
|
||||
buf = mem->buf;
|
||||
if (fio.op == FIO_READ)
|
||||
size = mem->size;
|
||||
|
||||
if (fio.op == FIO_READ) {
|
||||
/* 0xff fill unspecified memory */
|
||||
memset(buf, 0xff, size);
|
||||
memset(mem->buf, 0xff, size);
|
||||
}
|
||||
memset(mem->tags, 0, size);
|
||||
|
||||
using_stdio = 0;
|
||||
|
||||
@@ -1070,9 +1542,9 @@ int fileio(int op, char * filename, FILEFMT format,
|
||||
if (using_stdio) {
|
||||
fprintf(stderr,
|
||||
"%s: can't auto detect file format when using stdin/out.\n"
|
||||
" Please specify a file format using the -f option and try again.\n",
|
||||
progname);
|
||||
exit(1);
|
||||
"%s Please specify a file format and try again.\n",
|
||||
progname, progbuf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
format = fmt_autodetect(fname);
|
||||
@@ -1089,6 +1561,21 @@ int fileio(int op, char * filename, FILEFMT format,
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
/* Open Raw Binary format in binary mode on Windows.*/
|
||||
if(format == FMT_RBIN)
|
||||
{
|
||||
if(fio.op == FIO_READ)
|
||||
{
|
||||
fio.mode = "rb";
|
||||
}
|
||||
if(fio.op == FIO_WRITE)
|
||||
{
|
||||
fio.mode = "wb";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (format != FMT_IMM) {
|
||||
if (!using_stdio) {
|
||||
f = fopen(fname, fio.mode);
|
||||
@@ -1102,26 +1589,38 @@ int fileio(int op, char * filename, FILEFMT format,
|
||||
|
||||
switch (format) {
|
||||
case FMT_IHEX:
|
||||
rc = fileio_ihex(&fio, fname, f, buf, size);
|
||||
rc = fileio_ihex(&fio, fname, f, mem, size);
|
||||
break;
|
||||
|
||||
case FMT_SREC:
|
||||
rc = fileio_srec(&fio, fname, f, buf, size);
|
||||
rc = fileio_srec(&fio, fname, f, mem, size);
|
||||
break;
|
||||
|
||||
case FMT_RBIN:
|
||||
rc = fileio_rbin(&fio, fname, f, buf, size);
|
||||
rc = fileio_rbin(&fio, fname, f, mem, size);
|
||||
break;
|
||||
|
||||
case FMT_ELF:
|
||||
#ifdef HAVE_LIBELF
|
||||
rc = fileio_elf(&fio, fname, f, mem, p, size);
|
||||
#else
|
||||
fprintf(stderr,
|
||||
"%s: can't handle ELF file %s, "
|
||||
"ELF file support was not compiled in\n",
|
||||
progname, fname);
|
||||
rc = -1;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case FMT_IMM:
|
||||
rc = fileio_imm(&fio, fname, f, buf, size);
|
||||
rc = fileio_imm(&fio, fname, f, mem, size);
|
||||
break;
|
||||
|
||||
case FMT_HEX:
|
||||
case FMT_DEC:
|
||||
case FMT_OCT:
|
||||
case FMT_BIN:
|
||||
rc = fileio_num(&fio, fname, f, buf, size, format);
|
||||
rc = fileio_num(&fio, fname, f, mem, size, format);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1131,7 +1630,10 @@ int fileio(int op, char * filename, FILEFMT format,
|
||||
}
|
||||
|
||||
if (rc > 0) {
|
||||
if ((op == FIO_READ) && (strcasecmp(mem->desc, "flash") == 0)) {
|
||||
if ((op == FIO_READ) && (strcasecmp(mem->desc, "flash") == 0 ||
|
||||
strcasecmp(mem->desc, "application") == 0 ||
|
||||
strcasecmp(mem->desc, "apptable") == 0 ||
|
||||
strcasecmp(mem->desc, "boot") == 0)) {
|
||||
/*
|
||||
* if we are reading flash, just mark the size as being the
|
||||
* highest non-0xff byte
|
||||
@@ -1139,6 +1641,9 @@ int fileio(int op, char * filename, FILEFMT format,
|
||||
rc = avr_mem_hiaddr(mem);
|
||||
}
|
||||
}
|
||||
if (format != FMT_IMM && !using_stdio) {
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -31,7 +30,8 @@ typedef enum {
|
||||
FMT_HEX,
|
||||
FMT_DEC,
|
||||
FMT_OCT,
|
||||
FMT_BIN
|
||||
FMT_BIN,
|
||||
FMT_ELF
|
||||
} FILEFMT;
|
||||
|
||||
struct fioparms {
|
||||
@@ -40,6 +40,7 @@ struct fioparms {
|
||||
char * iodesc;
|
||||
char * dir;
|
||||
char * rw;
|
||||
unsigned int fileoffset;
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -53,8 +54,6 @@ extern "C" {
|
||||
|
||||
char * fmtstr(FILEFMT format);
|
||||
|
||||
int fileio_setparms(int op, struct fioparms * fp);
|
||||
|
||||
int fileio(int op, char * filename, FILEFMT format,
|
||||
struct avrpart * p, char * memtype, int size);
|
||||
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
945
avrdude/ft245r.c
Normal file
945
avrdude/ft245r.c
Normal file
@@ -0,0 +1,945 @@
|
||||
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2003-2004 Theodore A. Roth <troth@openavr.org>
|
||||
* some code:
|
||||
* Copyright (C) 2011-2012 Roger E. Wolff <R.E.Wolff@BitWizard.nl>
|
||||
*
|
||||
* 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$ */
|
||||
|
||||
/* ft245r -- FT245R/FT232R Synchronous BitBangMode Programmer
|
||||
default pin assign
|
||||
FT232R / FT245R
|
||||
miso = 1; # RxD / D1
|
||||
sck = 0; # RTS / D0
|
||||
mosi = 2; # TxD / D2
|
||||
reset = 4; # DTR / D4
|
||||
*/
|
||||
|
||||
/*
|
||||
The ft232r is very similar, or even "identical" in the synchronous
|
||||
bitbang mode that we use here.
|
||||
|
||||
This allows boards that have an ft232r for communication and an avr
|
||||
as the processor to function as their own "ICSP". Boards that fit
|
||||
this description include the Arduino Duemilanove, Arduino Diecimila,
|
||||
Arduino NG (http://arduino.cc/it/main/boards) and the BitWizard
|
||||
ftdi_atmega board (http://www.bitwizard.nl/wiki/index.php/FTDI_ATmega)
|
||||
|
||||
The Arduinos have to be patched to bring some of the control lines
|
||||
to the ICSP header. The BitWizard board already has the neccessary
|
||||
wiring on the PCB.
|
||||
|
||||
How to add the wires to an arduino is documented here:
|
||||
http://www.geocities.jp/arduino_diecimila/bootloader/index_en.html
|
||||
*/
|
||||
|
||||
|
||||
#include "ac_cfg.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "avr.h"
|
||||
#include "avrpart.h"
|
||||
#include "pindefs.h"
|
||||
#include "pgm.h"
|
||||
#include "config.h"
|
||||
#include "bitbang.h"
|
||||
#include "ft245r.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LIBFTDI1) && defined(HAVE_LIBUSB_1_0)
|
||||
# if defined(HAVE_LIBUSB_1_0_LIBUSB_H)
|
||||
# include <libusb-1.0/libusb.h>
|
||||
# else
|
||||
# include <libusb.h>
|
||||
# endif
|
||||
# include <libftdi1/ftdi.h>
|
||||
#elif defined(HAVE_LIBFTDI) && defined(HAVE_USB_H)
|
||||
/* ftdi.h includes usb.h */
|
||||
#include <ftdi.h>
|
||||
#else
|
||||
#warning No libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.
|
||||
#define DO_NOT_BUILD_FT245R
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PTHREAD_H
|
||||
|
||||
static int ft245r_nopthread_open (struct programmer_t *pgm, char * name) {
|
||||
fprintf(stderr,
|
||||
"%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)
|
||||
|
||||
static int ft245r_noftdi_open (struct programmer_t *pgm, char * name) {
|
||||
fprintf(stderr,
|
||||
"%s: error: no libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.\n",
|
||||
progname);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ft245r_initpgm(PROGRAMMER * pgm) {
|
||||
strcpy(pgm->type, "ftdi_syncbb");
|
||||
pgm->open = ft245r_noftdi_open;
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
static struct ftdi_context *handle;
|
||||
|
||||
static unsigned char ft245r_ddr;
|
||||
static unsigned char ft245r_out;
|
||||
static unsigned char ft245r_in;
|
||||
|
||||
#define BUFSIZE 0x2000
|
||||
|
||||
// libftdi / libftd2xx compatibility functions.
|
||||
|
||||
static pthread_t readerthread;
|
||||
static sem_t buf_data, buf_space;
|
||||
static unsigned char buffer[BUFSIZE];
|
||||
static int head, tail;
|
||||
|
||||
static void add_to_buf (unsigned char c) {
|
||||
int nh;
|
||||
|
||||
sem_wait (&buf_space);
|
||||
if (head == (BUFSIZE -1)) nh = 0;
|
||||
else nh = head + 1;
|
||||
|
||||
if (nh == tail) {
|
||||
fprintf (stderr, "buffer overflow. Cannot happen!\n");
|
||||
//exit (1);
|
||||
}
|
||||
buffer[head] = c;
|
||||
head = nh;
|
||||
sem_post (&buf_data);
|
||||
}
|
||||
|
||||
static void *reader (void *arg) {
|
||||
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 int ft245r_send(PROGRAMMER * pgm, unsigned char * buf, size_t len) {
|
||||
int rv;
|
||||
|
||||
rv = ftdi_write_data(handle, buf, len);
|
||||
if (len != rv) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ft245r_recv(PROGRAMMER * pgm, unsigned char * buf, size_t len) {
|
||||
int i;
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
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
|
||||
if (r) return -1;
|
||||
r = ftdi_set_bitmode(handle, ft245r_ddr, BITMODE_SYNCBB); // set Synchronuse BitBang
|
||||
if (r) return -1;
|
||||
|
||||
// drain our buffer.
|
||||
while (head != tail) {
|
||||
ft245r_recv (pgm, &t, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int ft245r_chip_erase(PROGRAMMER * pgm, AVRPART * p) {
|
||||
unsigned char cmd[4] = {0,0,0,0};
|
||||
unsigned char res[4];
|
||||
|
||||
if (p->op[AVR_OP_CHIP_ERASE] == NULL) {
|
||||
fprintf(stderr, "chip erase instruction not defined for part \"%s\"\n",
|
||||
p->desc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
avr_set_bits(p->op[AVR_OP_CHIP_ERASE], cmd);
|
||||
pgm->cmd(pgm, cmd, res);
|
||||
usleep(p->chip_erase_delay);
|
||||
return pgm->initialize(pgm, p);
|
||||
}
|
||||
|
||||
|
||||
static int ft245r_set_bitclock(PROGRAMMER * pgm) {
|
||||
int r;
|
||||
int rate = 0;
|
||||
|
||||
/* bitclock is second. 1us = 0.000001. Max rate for ft232r 750000 */
|
||||
if(pgm->bitclock) {
|
||||
rate = (uint32_t)(1.0/pgm->bitclock) * 2;
|
||||
} else if (pgm->baudrate) {
|
||||
rate = pgm->baudrate * 2;
|
||||
} else {
|
||||
rate = 150000; /* should work for all ftdi chips and the avr default internal clock of 1MHz */
|
||||
}
|
||||
|
||||
if ((verbose>1) || FT245R_DEBUG) {
|
||||
fprintf(stderr," ft245r: spi bitclk %d -> ft baudrate %d\n",
|
||||
rate / 2, rate);
|
||||
}
|
||||
r = ftdi_set_baudrate(handle, rate);
|
||||
if (r) {
|
||||
fprintf(stderr, "Set baudrate (%d) failed with error '%s'.\n",
|
||||
rate, ftdi_get_error_string (handle));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_pin(PROGRAMMER * pgm, int pinname, int val) {
|
||||
unsigned char buf[1];
|
||||
|
||||
if (pgm->pin[pinname].mask[0] == 0) {
|
||||
// ignore not defined pins (might be the led or vcc or buff if not needed)
|
||||
return 0;
|
||||
}
|
||||
|
||||
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];
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_reset(PROGRAMMER * pgm, int value) {
|
||||
return set_pin(pgm, PIN_AVR_RESET, value);
|
||||
}
|
||||
|
||||
static int set_buff(PROGRAMMER * pgm, int value) {
|
||||
return set_pin(pgm, PPI_AVR_BUFF, value);
|
||||
}
|
||||
|
||||
static int set_vcc(PROGRAMMER * pgm, int value) {
|
||||
return set_pin(pgm, PPI_AVR_VCC, value);
|
||||
}
|
||||
|
||||
/* these functions are callbacks, which go into the
|
||||
* PROGRAMMER data structure ("optional functions")
|
||||
*/
|
||||
static int set_led_pgm(struct programmer_t * pgm, int value) {
|
||||
return set_pin(pgm, PIN_LED_PGM, value);
|
||||
}
|
||||
|
||||
static int set_led_rdy(struct programmer_t * pgm, int value) {
|
||||
return set_pin(pgm, PIN_LED_RDY, value);
|
||||
}
|
||||
|
||||
static int set_led_err(struct programmer_t * pgm, int value) {
|
||||
return set_pin(pgm, PIN_LED_ERR, value);
|
||||
}
|
||||
|
||||
static int set_led_vfy(struct programmer_t * pgm, int value) {
|
||||
return set_pin(pgm, PIN_LED_VFY, value);
|
||||
}
|
||||
|
||||
/*
|
||||
* apply power to the AVR processor
|
||||
*/
|
||||
static void ft245r_powerup(PROGRAMMER * pgm)
|
||||
{
|
||||
set_vcc(pgm, ON); /* power up */
|
||||
usleep(100);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* remove power from the AVR processor
|
||||
*/
|
||||
static void ft245r_powerdown(PROGRAMMER * pgm)
|
||||
{
|
||||
set_vcc(pgm, OFF); /* power down */
|
||||
}
|
||||
|
||||
|
||||
static void ft245r_disable(PROGRAMMER * pgm) {
|
||||
set_buff(pgm, OFF);
|
||||
}
|
||||
|
||||
|
||||
static void ft245r_enable(PROGRAMMER * pgm) {
|
||||
/*
|
||||
* Prepare to start talking to the connected device - pull reset low
|
||||
* first, delay a few milliseconds, then enable the buffer. 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.
|
||||
*/
|
||||
set_reset(pgm, OFF);
|
||||
usleep(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
|
||||
*/
|
||||
static int ft245r_program_enable(PROGRAMMER * pgm, AVRPART * p) {
|
||||
unsigned char cmd[4] = {0,0,0,0};
|
||||
unsigned char res[4];
|
||||
int i;
|
||||
|
||||
if (p->op[AVR_OP_PGM_ENABLE] == NULL) {
|
||||
fprintf(stderr,
|
||||
"%s: AVR_OP_PGM_ENABLE command not defined for %s\n", progname, p->desc);
|
||||
fflush(stderr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
avr_set_bits(p->op[AVR_OP_PGM_ENABLE], cmd);
|
||||
|
||||
for(i = 0; i < 4; i++) {
|
||||
ft245r_cmd(pgm, cmd, res);
|
||||
|
||||
if (res[p->pollindex-1] == p->pollvalue) return 0;
|
||||
|
||||
if ((verbose>=1) || FT245R_DEBUG) {
|
||||
fprintf(stderr,
|
||||
"%s: Program enable command not successful. Retrying.\n", progname);
|
||||
fflush(stderr);
|
||||
}
|
||||
set_pin(pgm, PIN_AVR_RESET, ON);
|
||||
usleep(20);
|
||||
set_pin(pgm, PIN_AVR_RESET, OFF);
|
||||
|
||||
if (i == 3) {
|
||||
ft245r_drain(pgm, 0);
|
||||
tail = head;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"%s: Device is not responding to program enable. Check connection.\n", progname);
|
||||
fflush(stderr);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* initialize the AVR device and prepare it to accept commands
|
||||
*/
|
||||
static int ft245r_initialize(PROGRAMMER * pgm, AVRPART * p) {
|
||||
|
||||
ft245r_powerup(pgm);
|
||||
|
||||
set_reset(pgm, OFF);
|
||||
usleep(5000); // 5ms
|
||||
set_reset(pgm, ON);
|
||||
usleep(5000); // 5ms
|
||||
set_reset(pgm, OFF);
|
||||
usleep(5000); // 5ms
|
||||
|
||||
return ft245r_program_enable(pgm, p);
|
||||
}
|
||||
|
||||
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++;
|
||||
|
||||
bit >>= 1;
|
||||
}
|
||||
return buf_pos;
|
||||
}
|
||||
|
||||
static inline unsigned char extract_data(PROGRAMMER * pgm, unsigned char *buf, int offset) {
|
||||
int j;
|
||||
int buf_pos = 1;
|
||||
unsigned char bit = 0x80;
|
||||
unsigned char r = 0;
|
||||
|
||||
buf += offset * (8 * FT245R_CYCLES);
|
||||
for (j=0; j<8; j++) {
|
||||
if (GET_BITS_0(buf[buf_pos],pgm,PIN_AVR_MISO)) {
|
||||
r |= bit;
|
||||
}
|
||||
buf_pos += FT245R_CYCLES;
|
||||
bit >>= 1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/* to check data */
|
||||
static inline unsigned char extract_data_out(PROGRAMMER * pgm, unsigned char *buf, int offset) {
|
||||
int j;
|
||||
int buf_pos = 1;
|
||||
unsigned char bit = 0x80;
|
||||
unsigned char r = 0;
|
||||
|
||||
buf += offset * (8 * FT245R_CYCLES);
|
||||
for (j=0; j<8; j++) {
|
||||
if (GET_BITS_0(buf[buf_pos],pgm,PIN_AVR_MOSI)) {
|
||||
r |= bit;
|
||||
}
|
||||
buf_pos += FT245R_CYCLES;
|
||||
bit >>= 1;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* transmit an AVR device command and return the results; 'cmd' and
|
||||
* 'res' must point to at least a 4 byte data buffer
|
||||
*/
|
||||
static int ft245r_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res) {
|
||||
int i,buf_pos;
|
||||
unsigned char buf[128];
|
||||
|
||||
buf_pos = 0;
|
||||
for (i=0; i<4; i++) {
|
||||
buf_pos += set_data(pgm, buf+buf_pos, cmd[i]);
|
||||
}
|
||||
buf[buf_pos] = 0;
|
||||
buf_pos++;
|
||||
|
||||
ft245r_send (pgm, buf, buf_pos);
|
||||
ft245r_recv (pgm, buf, buf_pos);
|
||||
res[0] = extract_data(pgm, buf, 0);
|
||||
res[1] = extract_data(pgm, buf, 1);
|
||||
res[2] = extract_data(pgm, buf, 2);
|
||||
res[3] = extract_data(pgm, buf, 3);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* lower 8 pins are accepted, they might be also inverted */
|
||||
static const struct pindef_t valid_pins = {{0xff},{0xff}} ;
|
||||
|
||||
static const struct pin_checklist_t pin_checklist[] = {
|
||||
{ PIN_AVR_SCK, 1, &valid_pins},
|
||||
{ PIN_AVR_MOSI, 1, &valid_pins},
|
||||
{ PIN_AVR_MISO, 1, &valid_pins},
|
||||
{ PIN_AVR_RESET,1, &valid_pins},
|
||||
{ PPI_AVR_BUFF, 0, &valid_pins},
|
||||
};
|
||||
|
||||
static int ft245r_open(PROGRAMMER * pgm, char * port) {
|
||||
int rv;
|
||||
int devnum = -1;
|
||||
|
||||
rv = pins_check(pgm,pin_checklist,sizeof(pin_checklist)/sizeof(pin_checklist[0]), true);
|
||||
if(rv) {
|
||||
pgm->display(pgm, progbuf);
|
||||
return rv;
|
||||
}
|
||||
|
||||
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) {
|
||||
fprintf(stderr,
|
||||
"%s: invalid portname '%s': use 'ft[0-9]+'\n",
|
||||
progname,port);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
devnum = 0;
|
||||
}
|
||||
|
||||
handle = malloc (sizeof (struct ftdi_context));
|
||||
ftdi_init(handle);
|
||||
rv = ftdi_usb_open_desc_index(handle,
|
||||
pgm->usbvid?pgm->usbvid:0x0403,
|
||||
pgm->usbpid?pgm->usbpid:0x6001,
|
||||
pgm->usbproduct[0]?pgm->usbproduct:NULL,
|
||||
pgm->usbsn[0]?pgm->usbsn:NULL,
|
||||
devnum);
|
||||
if (rv) {
|
||||
fprintf (stderr, "can't open ftdi device %d. (%s)\n", devnum, ftdi_get_error_string(handle));
|
||||
goto cleanup_no_usb;
|
||||
}
|
||||
|
||||
ft245r_ddr =
|
||||
pgm->pin[PIN_AVR_SCK].mask[0]
|
||||
| pgm->pin[PIN_AVR_MOSI].mask[0]
|
||||
| pgm->pin[PIN_AVR_RESET].mask[0]
|
||||
| pgm->pin[PPI_AVR_BUFF].mask[0]
|
||||
| pgm->pin[PPI_AVR_VCC].mask[0]
|
||||
| pgm->pin[PIN_LED_ERR].mask[0]
|
||||
| pgm->pin[PIN_LED_RDY].mask[0]
|
||||
| pgm->pin[PIN_LED_PGM].mask[0]
|
||||
| pgm->pin[PIN_LED_VFY].mask[0];
|
||||
|
||||
/* set initial values for outputs, no reset everything else is off */
|
||||
ft245r_out = 0;
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_RESET,1);
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0);
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_MOSI,0);
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PPI_AVR_BUFF,0);
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PPI_AVR_VCC,0);
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_LED_ERR,0);
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_LED_RDY,0);
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_LED_PGM,0);
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_LED_VFY,0);
|
||||
|
||||
|
||||
rv = ftdi_set_bitmode(handle, ft245r_ddr, BITMODE_SYNCBB); // set Synchronous BitBang
|
||||
if (rv) {
|
||||
fprintf(stderr,
|
||||
"%s: Synchronous BitBangMode is not supported (%s)\n",
|
||||
progname, ftdi_get_error_string(handle));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
rv = ft245r_set_bitclock(pgm);
|
||||
if (rv) {
|
||||
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);
|
||||
|
||||
return 0;
|
||||
|
||||
cleanup:
|
||||
ftdi_usb_close(handle);
|
||||
cleanup_no_usb:
|
||||
ftdi_deinit (handle);
|
||||
free(handle);
|
||||
handle = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static void ft245r_close(PROGRAMMER * pgm) {
|
||||
if (handle) {
|
||||
// I think the switch to BB mode and back flushes the buffer.
|
||||
ftdi_set_bitmode(handle, 0, BITMODE_SYNCBB); // set Synchronous BitBang, all in puts
|
||||
ftdi_set_bitmode(handle, 0, BITMODE_RESET); // disable Synchronous BitBang
|
||||
pthread_cancel(readerthread);
|
||||
pthread_join(readerthread, NULL);
|
||||
ftdi_usb_close(handle);
|
||||
ftdi_deinit (handle); // TODO this works with libftdi 0.20, but hangs with 1.0
|
||||
free(handle);
|
||||
handle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void ft245r_display(PROGRAMMER * pgm, const char * p) {
|
||||
fprintf(stderr, "%sPin assignment : 0..7 = DBUS0..7\n",p);/* , 8..11 = GPIO0..3\n",p);*/
|
||||
pgm_display_generic_mask(pgm, p, SHOW_ALL_PINS);
|
||||
}
|
||||
|
||||
static int ft245r_paged_write_gen(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
unsigned int page_size, unsigned int addr,
|
||||
unsigned int n_bytes) {
|
||||
unsigned long i, pa;
|
||||
int rc;
|
||||
|
||||
for (i=0; i<n_bytes; i++, addr++) {
|
||||
rc = avr_write_byte_default(pgm, p, m, addr, m->buf[addr]);
|
||||
if (rc != 0) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (m->paged) {
|
||||
// Can this piece of code ever be activated?? Do AVRs exist that
|
||||
// have paged non-flash memories? -- REW
|
||||
// XXX Untested code below.
|
||||
/*
|
||||
* check to see if it is time to flush the page with a page
|
||||
* write
|
||||
*/
|
||||
|
||||
if (((addr % m->page_size) == m->page_size-1) || (i == n_bytes-1)) {
|
||||
pa = addr - (addr % m->page_size);
|
||||
|
||||
rc = avr_write_page(pgm, p, m, pa);
|
||||
if (rc != 0) {
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
static struct ft245r_request {
|
||||
int addr;
|
||||
int bytes;
|
||||
int n;
|
||||
struct ft245r_request *next;
|
||||
} *req_head,*req_tail,*req_pool;
|
||||
|
||||
static void put_request(int addr, int bytes, int n) {
|
||||
struct ft245r_request *p;
|
||||
if (req_pool) {
|
||||
p = req_pool;
|
||||
req_pool = p->next;
|
||||
} else {
|
||||
p = malloc(sizeof(struct ft245r_request));
|
||||
if (!p) {
|
||||
fprintf(stderr, "can't alloc memory\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
memset(p, 0, sizeof(struct ft245r_request));
|
||||
p->addr = addr;
|
||||
p->bytes = bytes;
|
||||
p->n = n;
|
||||
if (req_tail) {
|
||||
req_tail->next = p;
|
||||
req_tail = p;
|
||||
} else {
|
||||
req_head = req_tail = p;
|
||||
}
|
||||
}
|
||||
|
||||
static int do_request(PROGRAMMER * pgm, AVRMEM *m) {
|
||||
struct ft245r_request *p;
|
||||
int addr, bytes, j, n;
|
||||
unsigned char buf[FT245R_FRAGMENT_SIZE+1+128];
|
||||
|
||||
if (!req_head) return 0;
|
||||
p = req_head;
|
||||
req_head = p->next;
|
||||
if (!req_head) req_tail = req_head;
|
||||
|
||||
addr = p->addr;
|
||||
bytes = p->bytes;
|
||||
n = p->n;
|
||||
memset(p, 0, sizeof(struct ft245r_request));
|
||||
p->next = req_pool;
|
||||
req_pool = p;
|
||||
|
||||
ft245r_recv(pgm, buf, bytes);
|
||||
for (j=0; j<n; j++) {
|
||||
m->buf[addr++] = extract_data(pgm, buf , (j * 4 + 3));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ft245r_paged_write_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int page_size, int addr, int n_bytes) {
|
||||
unsigned int i,j;
|
||||
int addr_save,buf_pos,do_page_write,req_count;
|
||||
unsigned char buf[FT245R_FRAGMENT_SIZE+1+128];
|
||||
|
||||
req_count = 0;
|
||||
for (i=0; i<n_bytes; ) {
|
||||
addr_save = addr;
|
||||
buf_pos = 0;
|
||||
do_page_write = 0;
|
||||
for (j=0; j< FT245R_FRAGMENT_SIZE/8/FT245R_CYCLES/4; j++) {
|
||||
buf_pos += set_data(pgm, buf+buf_pos, (addr & 1)?0x48:0x40 );
|
||||
buf_pos += set_data(pgm, buf+buf_pos, (addr >> 9) & 0xff );
|
||||
buf_pos += set_data(pgm, buf+buf_pos, (addr >> 1) & 0xff );
|
||||
buf_pos += set_data(pgm, buf+buf_pos, m->buf[addr]);
|
||||
addr ++;
|
||||
i++;
|
||||
if ( (m->paged) &&
|
||||
(((i % m->page_size) == 0) || (i == n_bytes))) {
|
||||
do_page_write = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if defined(USE_INLINE_WRITE_PAGE)
|
||||
if (do_page_write) {
|
||||
int addr_wk = addr_save - (addr_save % m->page_size);
|
||||
/* If this device has a "load extended address" command, issue it. */
|
||||
if (m->op[AVR_OP_LOAD_EXT_ADDR]) {
|
||||
unsigned char cmd[4];
|
||||
OPCODE *lext = m->op[AVR_OP_LOAD_EXT_ADDR];
|
||||
|
||||
memset(cmd, 0, 4);
|
||||
avr_set_bits(lext, cmd);
|
||||
avr_set_addr(lext, cmd, addr_wk/2);
|
||||
buf_pos += set_data(pgm, buf+buf_pos, cmd[0]);
|
||||
buf_pos += set_data(pgm, buf+buf_pos, cmd[1]);
|
||||
buf_pos += set_data(pgm, buf+buf_pos, cmd[2]);
|
||||
buf_pos += set_data(pgm, buf+buf_pos, cmd[3]);
|
||||
}
|
||||
buf_pos += set_data(pgm, buf+buf_pos, 0x4C); /* Issue Page Write */
|
||||
buf_pos += set_data(pgm, buf+buf_pos,(addr_wk >> 9) & 0xff);
|
||||
buf_pos += set_data(pgm, buf+buf_pos,(addr_wk >> 1) & 0xff);
|
||||
buf_pos += set_data(pgm, buf+buf_pos, 0);
|
||||
}
|
||||
#endif
|
||||
if (i >= n_bytes) {
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0); // sck down
|
||||
buf[buf_pos++] = ft245r_out;
|
||||
}
|
||||
ft245r_send(pgm, buf, buf_pos);
|
||||
put_request(addr_save, buf_pos, 0);
|
||||
//ft245r_sync(pgm);
|
||||
#if 0
|
||||
fprintf(stderr, "send addr 0x%04x bufsize %d [%02x %02x] page_write %d\n",
|
||||
addr_save,buf_pos,
|
||||
extract_data_out(pgm, buf , (0*4 + 3) ),
|
||||
extract_data_out(pgm, buf , (1*4 + 3) ),
|
||||
do_page_write);
|
||||
#endif
|
||||
req_count++;
|
||||
if (req_count > REQ_OUTSTANDINGS)
|
||||
do_request(pgm, m);
|
||||
if (do_page_write) {
|
||||
#if defined(USE_INLINE_WRITE_PAGE)
|
||||
while (do_request(pgm, m))
|
||||
;
|
||||
usleep(m->max_write_delay);
|
||||
#else
|
||||
int addr_wk = addr_save - (addr_save % m->page_size);
|
||||
int rc;
|
||||
while (do_request(pgm, m))
|
||||
;
|
||||
rc = avr_write_page(pgm, p, m, addr_wk);
|
||||
if (rc != 0) {
|
||||
return -2;
|
||||
}
|
||||
#endif
|
||||
req_count = 0;
|
||||
}
|
||||
}
|
||||
while (do_request(pgm, m))
|
||||
;
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
static int ft245r_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
unsigned int page_size, unsigned int addr, unsigned int n_bytes) {
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
return ft245r_paged_write_flash(pgm, p, m, page_size, addr, n_bytes);
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
return ft245r_paged_write_gen(pgm, p, m, page_size, addr, n_bytes);
|
||||
} else {
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
static int ft245r_paged_load_gen(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
unsigned int page_size, unsigned int addr,
|
||||
int n_bytes) {
|
||||
unsigned char rbyte;
|
||||
unsigned long i;
|
||||
int rc;
|
||||
|
||||
for (i=0; i<n_bytes; i++) {
|
||||
rc = avr_read_byte_default(pgm, p, m, i+addr, &rbyte);
|
||||
if (rc != 0) {
|
||||
return -2;
|
||||
}
|
||||
m->buf[i+addr] = rbyte;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ft245r_paged_load_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
unsigned int page_size, unsigned int addr,
|
||||
unsigned int n_bytes) {
|
||||
unsigned long i,j,n;
|
||||
int addr_save,buf_pos;
|
||||
int req_count = 0;
|
||||
unsigned char buf[FT245R_FRAGMENT_SIZE+1];
|
||||
|
||||
for (i=0; i<n_bytes; ) {
|
||||
buf_pos = 0;
|
||||
addr_save = addr;
|
||||
for (j=0; j< FT245R_FRAGMENT_SIZE/8/FT245R_CYCLES/4; j++) {
|
||||
if (i >= n_bytes) break;
|
||||
buf_pos += set_data(pgm, buf+buf_pos, (addr & 1)?0x28:0x20 );
|
||||
buf_pos += set_data(pgm, buf+buf_pos, (addr >> 9) & 0xff );
|
||||
buf_pos += set_data(pgm, buf+buf_pos, (addr >> 1) & 0xff );
|
||||
buf_pos += set_data(pgm, buf+buf_pos, 0);
|
||||
addr ++;
|
||||
i++;
|
||||
}
|
||||
if (i >= n_bytes) {
|
||||
ft245r_out = SET_BITS_0(ft245r_out,pgm,PIN_AVR_SCK,0); // sck down
|
||||
buf[buf_pos++] = ft245r_out;
|
||||
}
|
||||
n = j;
|
||||
ft245r_send(pgm, buf, buf_pos);
|
||||
put_request(addr_save, buf_pos, n);
|
||||
req_count++;
|
||||
if (req_count > REQ_OUTSTANDINGS)
|
||||
do_request(pgm, m);
|
||||
|
||||
}
|
||||
while (do_request(pgm, m))
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ft245r_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
unsigned int page_size, unsigned int addr,
|
||||
unsigned int n_bytes) {
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
return ft245r_paged_load_flash(pgm, p, m, page_size, addr, n_bytes);
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
return ft245r_paged_load_gen(pgm, p, m, page_size, addr, n_bytes);
|
||||
} else {
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
void ft245r_initpgm(PROGRAMMER * pgm) {
|
||||
strcpy(pgm->type, "ftdi_syncbb");
|
||||
|
||||
/*
|
||||
* mandatory functions
|
||||
*/
|
||||
pgm->initialize = ft245r_initialize;
|
||||
pgm->display = ft245r_display;
|
||||
pgm->enable = ft245r_enable;
|
||||
pgm->disable = ft245r_disable;
|
||||
pgm->program_enable = ft245r_program_enable;
|
||||
pgm->chip_erase = ft245r_chip_erase;
|
||||
pgm->cmd = ft245r_cmd;
|
||||
pgm->open = ft245r_open;
|
||||
pgm->close = ft245r_close;
|
||||
pgm->read_byte = avr_read_byte_default;
|
||||
pgm->write_byte = avr_write_byte_default;
|
||||
|
||||
/*
|
||||
* optional functions
|
||||
*/
|
||||
pgm->paged_write = ft245r_paged_write;
|
||||
pgm->paged_load = ft245r_paged_load;
|
||||
|
||||
pgm->rdy_led = set_led_rdy;
|
||||
pgm->err_led = set_led_err;
|
||||
pgm->pgm_led = set_led_pgm;
|
||||
pgm->vfy_led = set_led_vfy;
|
||||
pgm->powerup = ft245r_powerup;
|
||||
pgm->powerdown = ft245r_powerdown;
|
||||
|
||||
handle = NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
const char ft245r_desc[] = "FT245R/FT232R Synchronous BitBangMode Programmer";
|
||||
10
avrdude/ft245r.h
Normal file
10
avrdude/ft245r.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef ft245r_h
|
||||
#define ft245r_h
|
||||
|
||||
#include "pgm.h"
|
||||
|
||||
extern const char ft245r_desc[];
|
||||
void ft245r_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
|
||||
#endif /* ft245r_h */
|
||||
1997
avrdude/jtag3.c
Normal file
1997
avrdude/jtag3.c
Normal file
File diff suppressed because it is too large
Load Diff
59
avrdude/jtag3.h
Normal file
59
avrdude/jtag3.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2012 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
|
||||
* 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$ */
|
||||
|
||||
#ifndef jtag3_h
|
||||
#define jtag3_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int jtag3_send(PROGRAMMER * pgm, unsigned char * data, size_t len);
|
||||
int jtag3_recv(PROGRAMMER * pgm, unsigned char **msg);
|
||||
void jtag3_close(PROGRAMMER * pgm);
|
||||
int jtag3_getsync(PROGRAMMER * pgm, int mode);
|
||||
int jtag3_getparm(PROGRAMMER * pgm, unsigned char scope,
|
||||
unsigned char section, unsigned char parm,
|
||||
unsigned char *value, unsigned char length);
|
||||
int jtag3_setparm(PROGRAMMER * pgm, unsigned char scope,
|
||||
unsigned char section, unsigned char parm,
|
||||
unsigned char *value, unsigned char length);
|
||||
int jtag3_command(PROGRAMMER *pgm, unsigned char *cmd, unsigned int cmdlen,
|
||||
unsigned char **resp, const char *descr);
|
||||
extern const char jtag3_desc[];
|
||||
extern const char jtag3_dw_desc[];
|
||||
extern const char jtag3_pdi_desc[];
|
||||
void jtag3_initpgm (PROGRAMMER * pgm);
|
||||
void jtag3_dw_initpgm (PROGRAMMER * pgm);
|
||||
void jtag3_pdi_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
/*
|
||||
* These functions are referenced from stk500v2.c for JTAGICE3 in
|
||||
* one of the STK500v2 modi.
|
||||
*/
|
||||
void jtag3_setup(PROGRAMMER * pgm);
|
||||
void jtag3_teardown(PROGRAMMER * pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
278
avrdude/jtag3_private.h
Normal file
278
avrdude/jtag3_private.h
Normal file
@@ -0,0 +1,278 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2012 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
|
||||
* 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$ */
|
||||
|
||||
|
||||
/*
|
||||
* JTAGICE3 definitions
|
||||
* Reverse-engineered from various USB traces.
|
||||
*/
|
||||
|
||||
#if !defined(JTAG3_PRIVATE_EXPORTED)
|
||||
/*
|
||||
* Communication with the JTAGICE3 uses three data endpoints:
|
||||
*
|
||||
* Endpoint 0x01 (OUT) and 0x82 (IN) are the usual conversation
|
||||
* endpoints, with a maximal packet size of 512 octets. The
|
||||
* JTAGICE3 does *not* work on older USB 1.1 hubs that would only
|
||||
* allow for 64-octet max packet size.
|
||||
*
|
||||
* Endpoint 0x83 (IN) is also a bulk endpoint, with a max packetsize
|
||||
* of 64 octets. This endpoint is used by the ICE to deliver events
|
||||
* from the ICE.
|
||||
*
|
||||
* The request (host -> ICE, EP 0x01) format is:
|
||||
*
|
||||
* +---------------------------------------------
|
||||
* | 0 | 1 | 2 . 3 | 4 | 5 | 6 | ...
|
||||
* | | | | | | |
|
||||
* | token |dummy|serial# |scope| cmd |dummy| optional data
|
||||
* | 0x0e | 0 | NNNN | SS | CC | 0 | ...
|
||||
* +---------------------------------------------
|
||||
*
|
||||
* Both dummy bytes are always 0. The "scope" identifier appears
|
||||
* to distinguish commands (responses, events, parameters) roughly:
|
||||
*
|
||||
* 0x01 - general scope ("hello", "goodbye", firmware info, target
|
||||
* voltage readout)
|
||||
* 0x11 - scope for AVR in ISP mode (basically a wrapper around
|
||||
* the AVRISPmkII commands, as usual)
|
||||
* 0x12 - scope for AVR (JTAG, PDI, debugWIRE)
|
||||
*
|
||||
* The serial number is counted up.
|
||||
*
|
||||
*
|
||||
* The response (ICE -> host, EP 0x82) format is:
|
||||
*
|
||||
* +--------------------------------------------------+
|
||||
* | 0 | 1 . 2 | 3 | 4 | ... | N |
|
||||
* | | | | | | |
|
||||
* | token |serial# |scope| rsp | optional data |dummy|
|
||||
* | 0x0e | NNNN | SS | RR | ... | 0 |
|
||||
* +--------------------------------------------------+
|
||||
*
|
||||
* The response's serial number is mirrored from the request, but the
|
||||
* dummy byte before the serial number is left out. However, another
|
||||
* zero dummy byte is always attached to the end of the response data.
|
||||
* Response codes are similar to the JTAGICEmkII, 0x80 is a generic
|
||||
* "OK" response, other responses above 0x80 indicate various data
|
||||
* responses (parameter read, memory read, PC value), and 0xa0 is a
|
||||
* generic "failure" response. It appears the failure response gets
|
||||
* another byte appended (probably indicating the reason) after the
|
||||
* 0 dummy byte, but there's not enough analysis material so far.
|
||||
*
|
||||
*
|
||||
* The event format (EP 0x83) is:
|
||||
*
|
||||
* +----------------------------------------
|
||||
* | 0 | 1 | 2 . 3 | 4 | 5 | ...
|
||||
* | | | | | |
|
||||
* | token |dummy|serial# |scope| evt | data
|
||||
* | 0x0e | 0 | NNNN | SS | EV | ...
|
||||
* +----------------------------------------
|
||||
*/
|
||||
#define TOKEN 0x0e
|
||||
|
||||
#endif /* JTAG3_PRIVATE_EXPORTED */
|
||||
|
||||
#define SCOPE_INFO 0x00
|
||||
#define SCOPE_GENERAL 0x01
|
||||
#define SCOPE_AVR_ISP 0x11
|
||||
#define SCOPE_AVR 0x12
|
||||
|
||||
/* Info scope */
|
||||
#define CMD3_GET_INFO 0x00
|
||||
|
||||
/* byte after GET_INFO is always 0, next is: */
|
||||
# define CMD3_INFO_NAME 0x80 /* JTAGICE3 */
|
||||
# define CMD3_INFO_SERIAL 0x81 /* J3xxxxxxxxxx */
|
||||
|
||||
/* Generic scope */
|
||||
#define CMD3_SET_PARAMETER 0x01
|
||||
#define CMD3_GET_PARAMETER 0x02
|
||||
#define CMD3_SIGN_ON 0x10
|
||||
#define CMD3_SIGN_OFF 0x11 /* takes one parameter? */
|
||||
#define CMD3_START_DW_DEBUG 0x13
|
||||
#define CMD3_MONCON_DISABLE 0x17
|
||||
|
||||
/* AVR ISP scope: no commands of its own */
|
||||
|
||||
/* AVR scope */
|
||||
//#define CMD3_SET_PARAMETER 0x01
|
||||
//#define CMD3_GET_PARAMETER 0x02
|
||||
//#define CMD3_SIGN_ON 0x10 /* an additional signon/-off pair */
|
||||
//#define CMD3_SIGN_OFF 0x11
|
||||
#define CMD3_ENTER_PROGMODE 0x15
|
||||
#define CMD3_LEAVE_PROGMODE 0x16
|
||||
#define CMD3_ERASE_MEMORY 0x20
|
||||
#define CMD3_READ_MEMORY 0x21
|
||||
#define CMD3_WRITE_MEMORY 0x23
|
||||
#define CMD3_READ_PC 0x35
|
||||
|
||||
/* ICE responses */
|
||||
#define RSP3_OK 0x80
|
||||
#define RSP3_INFO 0x81
|
||||
#define RSP3_PC 0x83
|
||||
#define RSP3_DATA 0x84
|
||||
#define RSP3_FAILED 0xA0
|
||||
|
||||
#define RSP3_STATUS_MASK 0xE0
|
||||
|
||||
/* possible failure codes that could be appended to RSP3_FAILED: */
|
||||
# define RSP3_FAIL_DEBUGWIRE 0x10
|
||||
# define RSP3_FAIL_PDI 0x1B
|
||||
# define RSP3_FAIL_NO_ANSWER 0x20
|
||||
# define RSP3_FAIL_NO_TARGET_POWER 0x22
|
||||
# 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_NOT_UNDERSTOOD 0x91
|
||||
|
||||
/* ICE events */
|
||||
#define EVT3_BREAK 0x40 /* AVR scope */
|
||||
#define EVT3_SLEEP 0x11 /* General scope, also wakeup */
|
||||
#define EVT3_POWER 0x10 /* General scope */
|
||||
|
||||
/* memory types */
|
||||
#define MTYPE_SRAM 0x20 /* target's SRAM or [ext.] IO registers */
|
||||
#define MTYPE_EEPROM 0x22 /* EEPROM, what way? */
|
||||
#define MTYPE_SPM 0xA0 /* flash through LPM/SPM */
|
||||
#define MTYPE_FLASH_PAGE 0xB0 /* flash in programming mode */
|
||||
#define MTYPE_EEPROM_PAGE 0xB1 /* EEPROM in programming mode */
|
||||
#define MTYPE_FUSE_BITS 0xB2 /* fuse bits in programming mode */
|
||||
#define MTYPE_LOCK_BITS 0xB3 /* lock bits in programming mode */
|
||||
#define MTYPE_SIGN_JTAG 0xB4 /* signature in programming mode */
|
||||
#define MTYPE_OSCCAL_BYTE 0xB5 /* osccal cells in programming mode */
|
||||
#define MTYPE_FLASH 0xc0 /* xmega (app.) flash - undocumented in AVR067 */
|
||||
#define MTYPE_BOOT_FLASH 0xc1 /* xmega boot flash - undocumented in AVR067 */
|
||||
#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 */
|
||||
|
||||
/*
|
||||
* Parameters are divided into sections, where the section number
|
||||
* precedes each parameter address. There are distinct parameter
|
||||
* sets for generic and AVR scope.
|
||||
*/
|
||||
#define PARM3_HW_VER 0x00 /* section 0, generic scope, 1 byte */
|
||||
#define PARM3_FW_MAJOR 0x01 /* section 0, generic scope, 1 byte */
|
||||
#define PARM3_FW_MINOR 0x02 /* section 0, generic scope, 1 byte */
|
||||
#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_DEVICEDESC 0x00 /* section 2, memory etc. configuration,
|
||||
* 31 bytes for tiny/mega AVR, 47 bytes
|
||||
* for Xmega; is also used in command
|
||||
* 0x36 in JTAGICEmkII, starting with
|
||||
* firmware 7.x */
|
||||
|
||||
#define PARM3_ARCH 0x00 /* section 0, AVR scope, 1 byte */
|
||||
# define PARM3_ARCH_TINY 1 /* also small megaAVR with ISP/DW only */
|
||||
# define PARM3_ARCH_MEGA 2
|
||||
# define PARM3_ARCH_XMEGA 3
|
||||
|
||||
#define PARM3_SESS_PURPOSE 0x01 /* section 0, AVR scope, 1 byte */
|
||||
# define PARM3_SESS_PROGRAMMING 1
|
||||
# define PARM3_SESS_DEBUGGING 2
|
||||
|
||||
#define PARM3_CONNECTION 0x00 /* section 1, AVR scope, 1 byte */
|
||||
# define PARM3_CONN_ISP 1
|
||||
# define PARM3_CONN_JTAG 4
|
||||
# define PARM3_CONN_DW 5
|
||||
# define PARM3_CONN_PDI 6
|
||||
|
||||
|
||||
#define PARM3_JTAGCHAIN 0x01 /* JTAG chain info, AVR scope (units
|
||||
* before/after, bits before/after), 4
|
||||
* bytes */
|
||||
|
||||
#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) */
|
||||
|
||||
|
||||
|
||||
/* Xmega erase memory types, for CMND_XMEGA_ERASE */
|
||||
#define XMEGA_ERASE_CHIP 0x00
|
||||
#define XMEGA_ERASE_APP 0x01
|
||||
#define XMEGA_ERASE_BOOT 0x02
|
||||
#define XMEGA_ERASE_EEPROM 0x03
|
||||
#define XMEGA_ERASE_APP_PAGE 0x04
|
||||
#define XMEGA_ERASE_BOOT_PAGE 0x05
|
||||
#define XMEGA_ERASE_EEPROM_PAGE 0x06
|
||||
#define XMEGA_ERASE_USERSIG 0x07
|
||||
|
||||
#if !defined(JTAG3_PRIVATE_EXPORTED)
|
||||
|
||||
struct mega_device_desc {
|
||||
unsigned char flash_page_size[2]; // in bytes
|
||||
unsigned char flash_size[4]; // in bytes
|
||||
unsigned char dummy1[4]; // always 0
|
||||
unsigned char boot_address[4]; // maximal (BOOTSZ = 3) bootloader
|
||||
// address, in 16-bit words (!)
|
||||
unsigned char sram_offset[2]; // pointing behind IO registers
|
||||
unsigned char eeprom_size[2];
|
||||
unsigned char eeprom_page_size;
|
||||
unsigned char ocd_revision; // see XML; basically:
|
||||
// t13*, t2313*, t4313: 0
|
||||
// all other DW devices: 1
|
||||
// ATmega128(A): 1 (!)
|
||||
// ATmega16*,162,169*,32*,64*: 2
|
||||
// ATmega2560/2561: 4
|
||||
// all other megaAVR devices: 3
|
||||
unsigned char always_one; // always = 1
|
||||
unsigned char allow_full_page_bitstream; // old AVRs, see XML
|
||||
unsigned char dummy2[2]; // always 0
|
||||
// all IO addresses below are given
|
||||
// in IO number space (without
|
||||
// offset 0x20), even though e.g.
|
||||
// OSCCAL always resides outside
|
||||
unsigned char idr_address; // IDR, aka. OCDR
|
||||
unsigned char eearh_address; // EEPROM access
|
||||
unsigned char eearl_address;
|
||||
unsigned char eecr_address;
|
||||
unsigned char eedr_address;
|
||||
unsigned char spmcr_address;
|
||||
unsigned char osccal_address;
|
||||
};
|
||||
|
||||
|
||||
/* Xmega device descriptor */
|
||||
struct xmega_device_desc {
|
||||
unsigned char nvm_app_offset[4]; // NVM offset for application flash
|
||||
unsigned char nvm_boot_offset[4]; // NVM offset for boot flash
|
||||
unsigned char nvm_eeprom_offset[4]; // NVM offset for EEPROM
|
||||
unsigned char nvm_fuse_offset[4]; // NVM offset for fuses
|
||||
unsigned char nvm_lock_offset[4]; // NVM offset for lock bits
|
||||
unsigned char nvm_user_sig_offset[4]; // NVM offset for user signature row
|
||||
unsigned char nvm_prod_sig_offset[4]; // NVM offset for production sign. row
|
||||
unsigned char nvm_data_offset[4]; // NVM offset for data memory (SRAM + IO)
|
||||
unsigned char app_size[4]; // size of application flash
|
||||
unsigned char boot_size[2]; // size of boot flash
|
||||
unsigned char flash_page_size[2]; // flash page size
|
||||
unsigned char eeprom_size[2]; // size of EEPROM
|
||||
unsigned char eeprom_page_size; // EEPROM page size
|
||||
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
|
||||
};
|
||||
#endif /* JTAG3_PRIVATE_EXPORTED */
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2005 Joerg Wunsch <j@uriah.heep.sax.de>
|
||||
* Copyright (C) 2005, 2007 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
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -37,28 +36,34 @@
|
||||
#include "avr.h"
|
||||
#include "crc16.h"
|
||||
#include "pgm.h"
|
||||
#include "jtagmkI.h"
|
||||
#include "jtagmkI_private.h"
|
||||
#include "serial.h"
|
||||
|
||||
/*
|
||||
* XXX There should really be a programmer-specific private data
|
||||
* pointer in struct PROGRAMMER.
|
||||
* Private data for this programmer.
|
||||
*/
|
||||
static int initial_baudrate;
|
||||
struct pdata
|
||||
{
|
||||
int initial_baudrate;
|
||||
|
||||
/*
|
||||
* See jtagmkI_read_byte() for an explanation of the flash and
|
||||
* EEPROM page caches.
|
||||
*/
|
||||
static unsigned char *flash_pagecache;
|
||||
static unsigned long flash_pageaddr;
|
||||
static unsigned int flash_pagesize;
|
||||
/*
|
||||
* See jtagmkI_read_byte() for an explanation of the flash and
|
||||
* EEPROM page caches.
|
||||
*/
|
||||
unsigned char *flash_pagecache;
|
||||
unsigned long flash_pageaddr;
|
||||
unsigned int flash_pagesize;
|
||||
|
||||
static unsigned char *eeprom_pagecache;
|
||||
static unsigned long eeprom_pageaddr;
|
||||
static unsigned int eeprom_pagesize;
|
||||
unsigned char *eeprom_pagecache;
|
||||
unsigned long eeprom_pageaddr;
|
||||
unsigned int eeprom_pagesize;
|
||||
|
||||
int prog_enabled; /* Cached value of PROGRAMMING status. */
|
||||
};
|
||||
|
||||
#define PDATA(pgm) ((struct pdata *)(pgm->cookie))
|
||||
|
||||
static int prog_enabled; /* Cached value of PROGRAMMING status. */
|
||||
/*
|
||||
* The OCDEN fuse is bit 7 of the high fuse (hfuse). In order to
|
||||
* perform memory operations on MTYPE_SPM and MTYPE_EEPROM, OCDEN
|
||||
@@ -104,6 +109,23 @@ static void jtagmkI_print_parms1(PROGRAMMER * pgm, const char * p);
|
||||
|
||||
static int jtagmkI_resync(PROGRAMMER *pgm, int maxtries, int signon);
|
||||
|
||||
static void jtagmkI_setup(PROGRAMMER * pgm)
|
||||
{
|
||||
if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: jtagmkI_setup(): Out of memory allocating private data\n",
|
||||
progname);
|
||||
exit(1);
|
||||
}
|
||||
memset(pgm->cookie, 0, sizeof(struct pdata));
|
||||
}
|
||||
|
||||
static void jtagmkI_teardown(PROGRAMMER * pgm)
|
||||
{
|
||||
free(pgm->cookie);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
u32_to_b3(unsigned char *b, unsigned long l)
|
||||
{
|
||||
@@ -131,7 +153,7 @@ static void jtagmkI_prmsg(PROGRAMMER * pgm, unsigned char * data, size_t len)
|
||||
if (i % 16 == 15)
|
||||
putc('\n', stderr);
|
||||
else
|
||||
putchar(' ');
|
||||
putc(' ', stderr);
|
||||
}
|
||||
if (i % 16 != 0)
|
||||
putc('\n', stderr);
|
||||
@@ -178,8 +200,8 @@ static int jtagmkI_send(PROGRAMMER * pgm, unsigned char * data, size_t len)
|
||||
unsigned char *buf;
|
||||
|
||||
if (verbose >= 3)
|
||||
fprintf(stderr, "\n%s: jtagmkI_send(): sending %zd bytes\n",
|
||||
progname, len);
|
||||
fprintf(stderr, "\n%s: jtagmkI_send(): sending %u bytes\n",
|
||||
progname, (unsigned int)len);
|
||||
|
||||
if ((buf = malloc(len + 2)) == NULL)
|
||||
{
|
||||
@@ -381,10 +403,10 @@ static void jtagmkI_set_devdescr(PROGRAMMER * pgm, AVRPART * p)
|
||||
for (ln = lfirst(p->mem); ln; ln = lnext(ln)) {
|
||||
m = ldata(ln);
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
flash_pagesize = m->page_size;
|
||||
u16_to_b2(sendbuf.dd.uiFlashPageSize, flash_pagesize);
|
||||
PDATA(pgm)->flash_pagesize = m->page_size;
|
||||
u16_to_b2(sendbuf.dd.uiFlashPageSize, PDATA(pgm)->flash_pagesize);
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
sendbuf.dd.ucEepromPageSize = eeprom_pagesize = m->page_size;
|
||||
sendbuf.dd.ucEepromPageSize = PDATA(pgm)->eeprom_pagesize = m->page_size;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,7 +470,7 @@ static int jtagmkI_program_enable(PROGRAMMER * pgm)
|
||||
{
|
||||
unsigned char buf[1], resp[2];
|
||||
|
||||
if (prog_enabled)
|
||||
if (PDATA(pgm)->prog_enabled)
|
||||
return 0;
|
||||
|
||||
buf[0] = CMD_ENTER_PROGMODE;
|
||||
@@ -472,7 +494,7 @@ static int jtagmkI_program_enable(PROGRAMMER * pgm)
|
||||
fprintf(stderr, "OK\n");
|
||||
}
|
||||
|
||||
prog_enabled = 1;
|
||||
PDATA(pgm)->prog_enabled = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -481,7 +503,7 @@ static int jtagmkI_program_disable(PROGRAMMER * pgm)
|
||||
{
|
||||
unsigned char buf[1], resp[2];
|
||||
|
||||
if (!prog_enabled)
|
||||
if (!PDATA(pgm)->prog_enabled)
|
||||
return 0;
|
||||
|
||||
if (pgm->fd.ifd != -1) {
|
||||
@@ -506,7 +528,7 @@ static int jtagmkI_program_disable(PROGRAMMER * pgm)
|
||||
fprintf(stderr, "OK\n");
|
||||
}
|
||||
}
|
||||
prog_enabled = 0;
|
||||
PDATA(pgm)->prog_enabled = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -528,7 +550,7 @@ static unsigned char jtagmkI_get_baud(long baud)
|
||||
static int jtagmkI_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
{
|
||||
AVRMEM hfuse;
|
||||
char cmd[1], resp[5];
|
||||
unsigned char cmd[1], resp[5];
|
||||
unsigned char b;
|
||||
|
||||
if (!(p->flags & AVRPART_HAS_JTAG)) {
|
||||
@@ -539,7 +561,7 @@ static int jtagmkI_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
|
||||
jtagmkI_drain(pgm, 0);
|
||||
|
||||
if ((serdev->flags & SERDEV_FL_CANSETSPEED) && initial_baudrate != pgm->baudrate) {
|
||||
if ((serdev->flags & SERDEV_FL_CANSETSPEED) && PDATA(pgm)->initial_baudrate != pgm->baudrate) {
|
||||
if ((b = jtagmkI_get_baud(pgm->baudrate)) == 0) {
|
||||
fprintf(stderr, "%s: jtagmkI_initialize(): unsupported baudrate %d\n",
|
||||
progname, pgm->baudrate);
|
||||
@@ -549,7 +571,7 @@ static int jtagmkI_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
"trying to set baudrate to %d\n",
|
||||
progname, pgm->baudrate);
|
||||
if (jtagmkI_setparm(pgm, PARM_BITRATE, b) == 0) {
|
||||
initial_baudrate = pgm->baudrate; /* don't adjust again later */
|
||||
PDATA(pgm)->initial_baudrate = pgm->baudrate; /* don't adjust again later */
|
||||
serial_setspeed(&pgm->fd, pgm->baudrate);
|
||||
}
|
||||
}
|
||||
@@ -584,24 +606,24 @@ static int jtagmkI_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
*/
|
||||
jtagmkI_set_devdescr(pgm, p);
|
||||
|
||||
jtagmkI_setparm(pgm, PARM_FLASH_PAGESIZE_LOW, flash_pagesize & 0xff);
|
||||
jtagmkI_setparm(pgm, PARM_FLASH_PAGESIZE_HIGH, flash_pagesize >> 8);
|
||||
jtagmkI_setparm(pgm, PARM_EEPROM_PAGESIZE, eeprom_pagesize & 0xff);
|
||||
jtagmkI_setparm(pgm, PARM_FLASH_PAGESIZE_LOW, PDATA(pgm)->flash_pagesize & 0xff);
|
||||
jtagmkI_setparm(pgm, PARM_FLASH_PAGESIZE_HIGH, PDATA(pgm)->flash_pagesize >> 8);
|
||||
jtagmkI_setparm(pgm, PARM_EEPROM_PAGESIZE, PDATA(pgm)->eeprom_pagesize & 0xff);
|
||||
|
||||
free(flash_pagecache);
|
||||
free(eeprom_pagecache);
|
||||
if ((flash_pagecache = malloc(flash_pagesize)) == NULL) {
|
||||
free(PDATA(pgm)->flash_pagecache);
|
||||
free(PDATA(pgm)->eeprom_pagecache);
|
||||
if ((PDATA(pgm)->flash_pagecache = malloc(PDATA(pgm)->flash_pagesize)) == NULL) {
|
||||
fprintf(stderr, "%s: jtagmkI_initialize(): Out of memory\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
if ((eeprom_pagecache = malloc(eeprom_pagesize)) == NULL) {
|
||||
if ((PDATA(pgm)->eeprom_pagecache = malloc(PDATA(pgm)->eeprom_pagesize)) == NULL) {
|
||||
fprintf(stderr, "%s: jtagmkI_initialize(): Out of memory\n",
|
||||
progname);
|
||||
free(flash_pagecache);
|
||||
free(PDATA(pgm)->flash_pagecache);
|
||||
return -1;
|
||||
}
|
||||
flash_pageaddr = eeprom_pageaddr = (unsigned long)-1L;
|
||||
PDATA(pgm)->flash_pageaddr = PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
|
||||
|
||||
if (jtagmkI_reset(pgm) < 0)
|
||||
return -1;
|
||||
@@ -622,10 +644,10 @@ static int jtagmkI_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
static void jtagmkI_disable(PROGRAMMER * pgm)
|
||||
{
|
||||
|
||||
free(flash_pagecache);
|
||||
flash_pagecache = NULL;
|
||||
free(eeprom_pagecache);
|
||||
eeprom_pagecache = NULL;
|
||||
free(PDATA(pgm)->flash_pagecache);
|
||||
PDATA(pgm)->flash_pagecache = NULL;
|
||||
free(PDATA(pgm)->eeprom_pagecache);
|
||||
PDATA(pgm)->eeprom_pagecache = NULL;
|
||||
|
||||
(void)jtagmkI_program_disable(pgm);
|
||||
}
|
||||
@@ -644,14 +666,16 @@ static int jtagmkI_open(PROGRAMMER * pgm, char * port)
|
||||
fprintf(stderr, "%s: jtagmkI_open()\n", progname);
|
||||
|
||||
strcpy(pgm->port, port);
|
||||
initial_baudrate = -1L;
|
||||
PDATA(pgm)->initial_baudrate = -1L;
|
||||
|
||||
for (i = 0; i < sizeof(baudtab) / sizeof(baudtab[0]); i++) {
|
||||
if (verbose >= 2)
|
||||
fprintf(stderr,
|
||||
"%s: jtagmkI_open(): trying to sync at baud rate %ld:\n",
|
||||
progname, baudtab[i].baud);
|
||||
serial_open(port, baudtab[i].baud, &pgm->fd);
|
||||
if (serial_open(port, baudtab[i].baud, &pgm->fd)==-1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* drain any extraneous input
|
||||
@@ -659,7 +683,7 @@ static int jtagmkI_open(PROGRAMMER * pgm, char * port)
|
||||
jtagmkI_drain(pgm, 0);
|
||||
|
||||
if (jtagmkI_getsync(pgm) == 0) {
|
||||
initial_baudrate = baudtab[i].baud;
|
||||
PDATA(pgm)->initial_baudrate = baudtab[i].baud;
|
||||
if (verbose >= 2)
|
||||
fprintf(stderr, "%s: jtagmkI_open(): succeeded\n", progname);
|
||||
return 0;
|
||||
@@ -689,15 +713,15 @@ static void jtagmkI_close(PROGRAMMER * pgm)
|
||||
* appears to make AVR Studio happier when it is about to access the
|
||||
* ICE later on.
|
||||
*/
|
||||
if ((serdev->flags & SERDEV_FL_CANSETSPEED) && initial_baudrate != pgm->baudrate) {
|
||||
if ((b = jtagmkI_get_baud(initial_baudrate)) == 0) {
|
||||
if ((serdev->flags & SERDEV_FL_CANSETSPEED) && PDATA(pgm)->initial_baudrate != pgm->baudrate) {
|
||||
if ((b = jtagmkI_get_baud(PDATA(pgm)->initial_baudrate)) == 0) {
|
||||
fprintf(stderr, "%s: jtagmkI_close(): unsupported baudrate %d\n",
|
||||
progname, initial_baudrate);
|
||||
progname, PDATA(pgm)->initial_baudrate);
|
||||
} else {
|
||||
if (verbose >= 2)
|
||||
fprintf(stderr, "%s: jtagmkI_close(): "
|
||||
"trying to set baudrate to %d\n",
|
||||
progname, initial_baudrate);
|
||||
progname, PDATA(pgm)->initial_baudrate);
|
||||
if (jtagmkI_setparm(pgm, PARM_BITRATE, b) == 0) {
|
||||
serial_setspeed(&pgm->fd, pgm->baudrate);
|
||||
}
|
||||
@@ -713,9 +737,11 @@ static void jtagmkI_close(PROGRAMMER * pgm)
|
||||
|
||||
|
||||
static int jtagmkI_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int page_size, int n_bytes)
|
||||
unsigned int page_size,
|
||||
unsigned int addr, unsigned int n_bytes)
|
||||
{
|
||||
int addr, block_size, send_size, tries;
|
||||
int block_size, send_size, tries;
|
||||
unsigned int maxaddr = addr + n_bytes;
|
||||
unsigned char cmd[6], *datacmd;
|
||||
unsigned char resp[2];
|
||||
int is_flash = 0;
|
||||
@@ -746,20 +772,18 @@ static int jtagmkI_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
cmd[0] = CMD_WRITE_MEM;
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
cmd[1] = MTYPE_FLASH_PAGE;
|
||||
flash_pageaddr = (unsigned long)-1L;
|
||||
page_size = flash_pagesize;
|
||||
PDATA(pgm)->flash_pageaddr = (unsigned long)-1L;
|
||||
page_size = PDATA(pgm)->flash_pagesize;
|
||||
is_flash = 1;
|
||||
} else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
cmd[1] = MTYPE_EEPROM_PAGE;
|
||||
eeprom_pageaddr = (unsigned long)-1L;
|
||||
page_size = eeprom_pagesize;
|
||||
PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
|
||||
page_size = PDATA(pgm)->eeprom_pagesize;
|
||||
}
|
||||
datacmd[0] = CMD_DATA;
|
||||
|
||||
serial_recv_timeout = 1000;
|
||||
for (addr = 0; addr < n_bytes; addr += page_size) {
|
||||
report_progress(addr, n_bytes,NULL);
|
||||
|
||||
for (; addr < maxaddr; addr += page_size) {
|
||||
tries = 0;
|
||||
again:
|
||||
|
||||
@@ -851,9 +875,11 @@ static int jtagmkI_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
}
|
||||
|
||||
static int jtagmkI_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int page_size, int n_bytes)
|
||||
unsigned int page_size,
|
||||
unsigned int addr, unsigned int n_bytes)
|
||||
{
|
||||
int addr, block_size, read_size, is_flash = 0, tries;
|
||||
int block_size, read_size, is_flash = 0, tries;
|
||||
unsigned int maxaddr = addr + n_bytes;
|
||||
unsigned char cmd[6], resp[256 * 2 + 3];
|
||||
long otimeout = serial_recv_timeout;
|
||||
#define MAXTRIES 3
|
||||
@@ -882,9 +908,7 @@ static int jtagmkI_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
}
|
||||
|
||||
serial_recv_timeout = 1000;
|
||||
for (addr = 0; addr < n_bytes; addr += page_size) {
|
||||
report_progress(addr, n_bytes,NULL);
|
||||
|
||||
for (; addr < maxaddr; addr += page_size) {
|
||||
tries = 0;
|
||||
again:
|
||||
if (tries != 0 && jtagmkI_resync(pgm, 2000, 0) < 0) {
|
||||
@@ -968,15 +992,15 @@ static int jtagmkI_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
cmd[1] = MTYPE_FLASH_PAGE;
|
||||
pagesize = mem->page_size;
|
||||
paddr = addr & ~(pagesize - 1);
|
||||
paddr_ptr = &flash_pageaddr;
|
||||
cache_ptr = flash_pagecache;
|
||||
paddr_ptr = &PDATA(pgm)->flash_pageaddr;
|
||||
cache_ptr = PDATA(pgm)->flash_pagecache;
|
||||
is_flash = 1;
|
||||
} else if (strcmp(mem->desc, "eeprom") == 0) {
|
||||
cmd[1] = MTYPE_EEPROM_PAGE;
|
||||
pagesize = mem->page_size;
|
||||
paddr = addr & ~(pagesize - 1);
|
||||
paddr_ptr = &eeprom_pageaddr;
|
||||
cache_ptr = eeprom_pagecache;
|
||||
paddr_ptr = &PDATA(pgm)->eeprom_pageaddr;
|
||||
cache_ptr = PDATA(pgm)->eeprom_pagecache;
|
||||
} else if (strcmp(mem->desc, "lfuse") == 0) {
|
||||
cmd[1] = MTYPE_FUSE_BITS;
|
||||
addr = 0;
|
||||
@@ -1078,11 +1102,11 @@ static int jtagmkI_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
|
||||
if (strcmp(mem->desc, "flash") == 0) {
|
||||
cmd[1] = MTYPE_SPM;
|
||||
need_progmode = 0;
|
||||
flash_pageaddr = (unsigned long)-1L;
|
||||
PDATA(pgm)->flash_pageaddr = (unsigned long)-1L;
|
||||
} else if (strcmp(mem->desc, "eeprom") == 0) {
|
||||
cmd[1] = MTYPE_EEPROM;
|
||||
need_progmode = 0;
|
||||
eeprom_pageaddr = (unsigned long)-1L;
|
||||
PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
|
||||
} else if (strcmp(mem->desc, "lfuse") == 0) {
|
||||
cmd[1] = MTYPE_FUSE_BITS;
|
||||
addr = 0;
|
||||
@@ -1348,6 +1372,7 @@ static void jtagmkI_print_parms(PROGRAMMER * pgm)
|
||||
jtagmkI_print_parms1(pgm, "");
|
||||
}
|
||||
|
||||
const char jtagmkI_desc[] = "Atmel JTAG ICE mkI";
|
||||
|
||||
void jtagmkI_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
@@ -1374,5 +1399,7 @@ void jtagmkI_initpgm(PROGRAMMER * pgm)
|
||||
pgm->paged_load = jtagmkI_paged_load;
|
||||
pgm->print_parms = jtagmkI_print_parms;
|
||||
pgm->set_sck_period = jtagmkI_set_sck_period;
|
||||
pgm->setup = jtagmkI_setup;
|
||||
pgm->teardown = jtagmkI_teardown;
|
||||
pgm->page_size = 256;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -26,6 +25,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const char jtagmkI_desc[];
|
||||
void jtagmkI_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
2286
avrdude/jtagmkII.c
2286
avrdude/jtagmkII.c
File diff suppressed because it is too large
Load Diff
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -33,10 +32,28 @@ int jtagmkII_getsync(PROGRAMMER * pgm, int mode);
|
||||
int jtagmkII_getparm(PROGRAMMER * pgm, unsigned char parm,
|
||||
unsigned char * value);
|
||||
|
||||
extern const char jtagmkII_desc[];
|
||||
extern const char jtagmkII_avr32_desc[];
|
||||
extern const char jtagmkII_dw_desc[];
|
||||
extern const char jtagmkII_pdi_desc[];
|
||||
extern const char jtagmkII_dragon_desc[];
|
||||
extern const char jtagmkII_dragon_dw_desc[];
|
||||
extern const char jtagmkII_dragon_pdi_desc[];
|
||||
void jtagmkII_initpgm (PROGRAMMER * pgm);
|
||||
void jtagmkII_avr32_initpgm (PROGRAMMER * pgm);
|
||||
void jtagmkII_dw_initpgm (PROGRAMMER * pgm);
|
||||
void jtagmkII_pdi_initpgm (PROGRAMMER * pgm);
|
||||
void jtagmkII_dragon_initpgm (PROGRAMMER * pgm);
|
||||
void jtagmkII_dragon_dw_initpgm (PROGRAMMER * pgm);
|
||||
void jtagmkII_dragon_pdi_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
/*
|
||||
* These functions are referenced from stk500v2.c for JTAG ICE mkII
|
||||
* and AVR Dragon programmers running in one of the STK500v2
|
||||
* modi.
|
||||
*/
|
||||
void jtagmkII_setup(PROGRAMMER * pgm);
|
||||
void jtagmkII_teardown(PROGRAMMER * pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -75,166 +74,230 @@
|
||||
#endif /* JTAGMKII_PRIVATE_EXPORTED */
|
||||
|
||||
/* ICE command codes */
|
||||
#define CMND_CHIP_ERASE 0x13
|
||||
#define CMND_CLEAR_EVENTS 0x22
|
||||
#define CMND_CLR_BREAK 0x1A
|
||||
#define CMND_ENTER_PROGMODE 0x14
|
||||
#define CMND_ERASEPAGE_SPM 0x0D
|
||||
#define CMND_FORCED_STOP 0x0A
|
||||
#define CMND_GET_BREAK 0x12
|
||||
#define CMND_GET_PARAMETER 0x03
|
||||
#define CMND_GET_SIGN_ON 0x01
|
||||
#define CMND_GET_SYNC 0x0f
|
||||
#define CMND_GO 0x08
|
||||
#define CMND_ISP_PACKET 0x2F
|
||||
#define CMND_LEAVE_PROGMODE 0x15
|
||||
#define CMND_READ_MEMORY 0x05
|
||||
#define CMND_READ_PC 0x07
|
||||
#define CMND_RESET 0x0B
|
||||
#define CMND_RESTORE_TARGET 0x23
|
||||
#define CMND_RUN_TO_ADDR 0x1C
|
||||
#define CMND_SELFTEST 0x10
|
||||
#define CMND_SET_BREAK 0x11
|
||||
#define CMND_SIGN_OFF 0x00
|
||||
#define CMND_GET_SIGN_ON 0x01
|
||||
#define CMND_SET_PARAMETER 0x02
|
||||
#define CMND_GET_PARAMETER 0x03
|
||||
#define CMND_WRITE_MEMORY 0x04
|
||||
#define CMND_READ_MEMORY 0x05
|
||||
#define CMND_WRITE_PC 0x06
|
||||
#define CMND_READ_PC 0x07
|
||||
#define CMND_GO 0x08
|
||||
#define CMND_SINGLE_STEP 0x09
|
||||
#define CMND_FORCED_STOP 0x0A
|
||||
#define CMND_RESET 0x0B
|
||||
#define CMND_SET_DEVICE_DESCRIPTOR 0x0C
|
||||
#define CMND_SET_N_PARAMETERS 0x16
|
||||
#define CMND_SET_PARAMETER 0x02
|
||||
#define CMND_SIGN_OFF 0x00
|
||||
#define CMND_SINGLE_STEP 0x09
|
||||
#define CMND_SPI_CMD 0x1D
|
||||
#define CMND_WRITE_MEMORY 0x04
|
||||
#define CMND_WRITE_PC 0x06
|
||||
#define CMND_ERASEPAGE_SPM 0x0D
|
||||
#define CMND_GET_SYNC 0x0f
|
||||
#define CMND_SELFTEST 0x10
|
||||
#define CMND_SET_BREAK 0x11
|
||||
#define CMND_GET_BREAK 0x12
|
||||
#define CMND_CHIP_ERASE 0x13
|
||||
#define CMND_ENTER_PROGMODE 0x14
|
||||
#define CMND_LEAVE_PROGMODE 0x15
|
||||
#define CMND_SET_N_PARAMETERS 0x16
|
||||
#define CMND_CLR_BREAK 0x1A
|
||||
#define CMND_RUN_TO_ADDR 0x1C
|
||||
#define CMND_SPI_CMD 0x1D
|
||||
#define CMND_CLEAR_EVENTS 0x22
|
||||
#define CMND_RESTORE_TARGET 0x23
|
||||
#define CMND_GET_IR 0x24
|
||||
#define CMND_GET_xxx 0x25
|
||||
#define CMND_WRITE_SAB 0x28
|
||||
#define CMND_READ_SAB 0x29
|
||||
#define CMND_RESET_AVR 0x2B
|
||||
#define CMND_READ_MEMORY32 0x2C
|
||||
#define CMND_WRITE_MEMORY32 0x2D
|
||||
#define CMND_ISP_PACKET 0x2F
|
||||
#define CMND_XMEGA_ERASE 0x34
|
||||
#define CMND_SET_XMEGA_PARAMS 0x36 // undocumented in AVR067
|
||||
|
||||
|
||||
/* ICE responses */
|
||||
#define RSP_DEBUGWIRE_SYNC_FAILED 0xAC
|
||||
#define RSP_FAILED 0xA0
|
||||
#define RSP_GET_BREAK 0x83
|
||||
#define RSP_ILLEGAL_BREAKPOINT 0xA8
|
||||
#define RSP_ILLEGAL_COMMAND 0xAA
|
||||
#define RSP_ILLEGAL_EMULATOR_MODE 0xA4
|
||||
#define RSP_ILLEGAL_JTAG_ID 0xA9
|
||||
#define RSP_ILLEGAL_MCU_STATE 0xA5
|
||||
#define RSP_ILLEGAL_MEMORY_TYPE 0xA2
|
||||
#define RSP_ILLEGAL_MEMORY_RANGE 0xA3
|
||||
#define RSP_ILLEGAL_PARAMETER 0xA1
|
||||
#define RSP_ILLEGAL_POWER_STATE 0xAD
|
||||
#define RSP_ILLEGAL_VALUE 0xA6
|
||||
#define RSP_MEMORY 0x82
|
||||
#define RSP_NO_TARGET_POWER 0xAB
|
||||
#define RSP_OK 0x80
|
||||
#define RSP_PARAMETER 0x81
|
||||
#define RSP_PC 0x84
|
||||
#define RSP_SELFTEST 0x85
|
||||
#define RSP_SET_N_PARAMETERS 0xA7
|
||||
#define RSP_SIGN_ON 0x86
|
||||
#define RSP_SPI_DATA 0x88
|
||||
#define RSP_OK 0x80
|
||||
#define RSP_PARAMETER 0x81
|
||||
#define RSP_MEMORY 0x82
|
||||
#define RSP_GET_BREAK 0x83
|
||||
#define RSP_PC 0x84
|
||||
#define RSP_SELFTEST 0x85
|
||||
#define RSP_SIGN_ON 0x86
|
||||
#define RSP_SPI_DATA 0x88
|
||||
#define RSP_FAILED 0xA0
|
||||
#define RSP_ILLEGAL_PARAMETER 0xA1
|
||||
#define RSP_ILLEGAL_MEMORY_TYPE 0xA2
|
||||
#define RSP_ILLEGAL_MEMORY_RANGE 0xA3
|
||||
#define RSP_ILLEGAL_EMULATOR_MODE 0xA4
|
||||
#define RSP_ILLEGAL_MCU_STATE 0xA5
|
||||
#define RSP_ILLEGAL_VALUE 0xA6
|
||||
#define RSP_SET_N_PARAMETERS 0xA7
|
||||
#define RSP_ILLEGAL_BREAKPOINT 0xA8
|
||||
#define RSP_ILLEGAL_JTAG_ID 0xA9
|
||||
#define RSP_ILLEGAL_COMMAND 0xAA
|
||||
#define RSP_NO_TARGET_POWER 0xAB
|
||||
#define RSP_DEBUGWIRE_SYNC_FAILED 0xAC
|
||||
#define RSP_ILLEGAL_POWER_STATE 0xAD
|
||||
|
||||
/* ICE events */
|
||||
#define EVT_BREAK 0xE0
|
||||
#define EVT_DEBUG 0xE6
|
||||
#define EVT_ERROR_PHY_FORCE_BREAK_TIMEOUT 0xE2
|
||||
#define EVT_ERROR_PHY_MAX_BIT_LENGTH_DIFF 0xED
|
||||
#define EVT_ERROR_PHY_OPT_RECEIVE_TIMEOUT 0xF9
|
||||
#define EVT_ERROR_PHY_OPT_RECEIVED_BREAK 0xFA
|
||||
#define EVT_ERROR_PHY_RECEIVED_BREAK 0xF8
|
||||
#define EVT_ERROR_PHY_RECEIVE_TIMEOUT 0xF7
|
||||
#define EVT_BREAK 0xE0
|
||||
#define EVT_RUN 0xE1
|
||||
#define EVT_ERROR_PHY_FORCE_BREAK_TIMEOUT 0xE2
|
||||
#define EVT_ERROR_PHY_RELEASE_BREAK_TIMEOUT 0xE3
|
||||
#define EVT_ERROR_PHY_SYNC_OUT_OF_RANGE 0xF5
|
||||
#define EVT_ERROR_PHY_SYNC_TIMEOUT 0xF0
|
||||
#define EVT_ERROR_PHY_SYNC_TIMEOUT_BAUD 0xF4
|
||||
#define EVT_ERROR_PHY_SYNC_WAIT_TIMEOUT 0xF6
|
||||
#define EVT_RESULT_PHY_NO_ACTIVITY 0xFB
|
||||
#define EVT_EXT_RESET 0xE7
|
||||
#define EVT_ICE_POWER_ERROR_STATE 0xEA
|
||||
#define EVT_ICE_POWER_OK 0xEB
|
||||
#define EVT_IDR_DIRTY 0xEC
|
||||
#define EVT_NONE 0xEF
|
||||
#define EVT_PDSB_BREAK 0xF2
|
||||
#define EVT_PDSMB_BREAK 0xF3
|
||||
#define EVT_PROGRAM_BREAK 0xF1
|
||||
#define EVT_RUN 0xE1
|
||||
#define EVT_TARGET_POWER_OFF 0xE5
|
||||
#define EVT_TARGET_POWER_ON 0xE4
|
||||
#define EVT_TARGET_SLEEP 0xE8
|
||||
#define EVT_TARGET_WAKEUP 0xE9
|
||||
#define EVT_TARGET_POWER_ON 0xE4
|
||||
#define EVT_TARGET_POWER_OFF 0xE5
|
||||
#define EVT_DEBUG 0xE6
|
||||
#define EVT_EXT_RESET 0xE7
|
||||
#define EVT_TARGET_SLEEP 0xE8
|
||||
#define EVT_TARGET_WAKEUP 0xE9
|
||||
#define EVT_ICE_POWER_ERROR_STATE 0xEA
|
||||
#define EVT_ICE_POWER_OK 0xEB
|
||||
#define EVT_IDR_DIRTY 0xEC
|
||||
#define EVT_ERROR_PHY_MAX_BIT_LENGTH_DIFF 0xED
|
||||
#define EVT_NONE 0xEF
|
||||
#define EVT_ERROR_PHY_SYNC_TIMEOUT 0xF0
|
||||
#define EVT_PROGRAM_BREAK 0xF1
|
||||
#define EVT_PDSB_BREAK 0xF2
|
||||
#define EVT_PDSMB_BREAK 0xF3
|
||||
#define EVT_ERROR_PHY_SYNC_TIMEOUT_BAUD 0xF4
|
||||
#define EVT_ERROR_PHY_SYNC_OUT_OF_RANGE 0xF5
|
||||
#define EVT_ERROR_PHY_SYNC_WAIT_TIMEOUT 0xF6
|
||||
#define EVT_ERROR_PHY_RECEIVE_TIMEOUT 0xF7
|
||||
#define EVT_ERROR_PHY_RECEIVED_BREAK 0xF8
|
||||
#define EVT_ERROR_PHY_OPT_RECEIVE_TIMEOUT 0xF9
|
||||
#define EVT_ERROR_PHY_OPT_RECEIVED_BREAK 0xFA
|
||||
#define EVT_RESULT_PHY_NO_ACTIVITY 0xFB
|
||||
|
||||
/* memory types for CMND_{READ,WRITE}_MEMORY */
|
||||
#define MTYPE_IO_SHADOW 0x30 /* cached IO registers? */
|
||||
#define MTYPE_SRAM 0x20 /* target's SRAM or [ext.] IO registers */
|
||||
#define MTYPE_EEPROM 0x22 /* EEPROM, what way? */
|
||||
#define MTYPE_EVENT 0x60 /* ICE event memory */
|
||||
#define MTYPE_SPM 0xA0 /* flash through LPM/SPM */
|
||||
#define MTYPE_FLASH_PAGE 0xB0 /* flash in programming mode */
|
||||
#define MTYPE_IO_SHADOW 0x30 /* cached IO registers? */
|
||||
#define MTYPE_SRAM 0x20 /* target's SRAM or [ext.] IO registers */
|
||||
#define MTYPE_EEPROM 0x22 /* EEPROM, what way? */
|
||||
#define MTYPE_EVENT 0x60 /* ICE event memory */
|
||||
#define MTYPE_SPM 0xA0 /* flash through LPM/SPM */
|
||||
#define MTYPE_FLASH_PAGE 0xB0 /* flash in programming mode */
|
||||
#define MTYPE_EEPROM_PAGE 0xB1 /* EEPROM in programming mode */
|
||||
#define MTYPE_FUSE_BITS 0xB2 /* fuse bits in programming mode */
|
||||
#define MTYPE_LOCK_BITS 0xB3 /* lock bits in programming mode */
|
||||
#define MTYPE_SIGN_JTAG 0xB4 /* signature in programming mode */
|
||||
#define MTYPE_FUSE_BITS 0xB2 /* fuse bits in programming mode */
|
||||
#define MTYPE_LOCK_BITS 0xB3 /* lock bits in programming mode */
|
||||
#define MTYPE_SIGN_JTAG 0xB4 /* signature in programming mode */
|
||||
#define MTYPE_OSCCAL_BYTE 0xB5 /* osccal cells in programming mode */
|
||||
#define MTYPE_CAN 0xB6 /* CAN mailbox */
|
||||
#define MTYPE_CAN 0xB6 /* CAN mailbox */
|
||||
#define MTYPE_FLASH 0xc0 /* xmega (app.) flash - undocumented in AVR067 */
|
||||
#define MTYPE_BOOT_FLASH 0xc1 /* xmega boot flash - undocumented in AVR067 */
|
||||
#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 */
|
||||
|
||||
/* (some) ICE parameters, for CMND_{GET,SET}_PARAMETER */
|
||||
#define PAR_HW_VERSION 0x01
|
||||
#define PAR_FW_VERSION 0x02
|
||||
#define PAR_EMULATOR_MODE 0x03
|
||||
# define EMULATOR_MODE_DEBUGWIRE 0x00
|
||||
# define EMULATOR_MODE_JTAG 0x01
|
||||
# define EMULATOR_MODE_HV 0x02 /* HVSP or PP mode of AVR Dragon */
|
||||
# define EMULATOR_MODE_SPI 0x03
|
||||
#define PAR_IREG 0x04
|
||||
#define PAR_BAUD_RATE 0x05
|
||||
# define PAR_BAUD_2400 0x01
|
||||
# define PAR_BAUD_4800 0x02
|
||||
# define PAR_BAUD_9600 0x03
|
||||
# define PAR_BAUD_19200 0x04 /* default */
|
||||
# define PAR_BAUD_38400 0x05
|
||||
# define PAR_BAUD_57600 0x06
|
||||
# define PAR_BAUD_115200 0x07
|
||||
# define PAR_BAUD_14400 0x08
|
||||
#define PAR_OCD_VTARGET 0x06
|
||||
#define PAR_OCD_JTAG_CLK 0x07
|
||||
#define PAR_OCD_BREAK_CAUSE 0x08
|
||||
#define PAR_TIMERS_RUNNING 0x09
|
||||
#define PAR_BREAK_ON_CHANGE_FLOW 0x0A
|
||||
#define PAR_BREAK_ADDR1 0x0B
|
||||
#define PAR_BREAK_ADDR2 0x0C
|
||||
#define PAR_COMBBREAKCTRL 0x0D
|
||||
#define PAR_JTAGID 0x0E
|
||||
#define PAR_UNITS_BEFORE 0x0F
|
||||
#define PAR_UNITS_AFTER 0x10
|
||||
#define PAR_BIT_BEFORE 0x11
|
||||
#define PAR_BIT_ATER 0x12
|
||||
#define PAR_EXTERNAL_RESET 0x13
|
||||
#define PAR_FLASH_PAGE_SIZE 0x14
|
||||
#define PAR_EEPROM_PAGE_SIZE 0x15
|
||||
#define PAR_UNUSED1 0x16
|
||||
#define PAR_PSB0 0x17
|
||||
#define PAR_PSB1 0x18
|
||||
#define PAR_PROTOCOL_DEBUG_EVENT 0x19
|
||||
#define PAR_MCU_STATE 0x1A
|
||||
# define STOPPED 0x00
|
||||
# define RUNNING 0x01
|
||||
# define PROGRAMMING 0x02
|
||||
#define PAR_DAISY_CHAIN_INFO 0x1B
|
||||
#define PAR_BOOT_ADDRESS 0x1C
|
||||
#define PAR_TARGET_SIGNATURE 0x1D
|
||||
#define PAR_DEBUGWIRE_BAUDRATE 0x1E
|
||||
#define PAR_PROGRAM_ENTRY_POINT 0x1F
|
||||
#define PAR_PACKET_PARSING_ERRORS 0x40
|
||||
#define PAR_VALID_PACKETS_RECEIVED 0x41
|
||||
#define PAR_INTERCOMMUNICATION_TX_FAILURES 0x42
|
||||
#define PAR_INTERCOMMUNICATION_RX_FAILURES 0x43
|
||||
#define PAR_CRC_ERRORS 0x44
|
||||
#define PAR_POWER_SOURCE 0x45
|
||||
# define POWER_EXTERNAL 0x00
|
||||
# define POWER_USB 0x01
|
||||
#define PAR_CAN_FLAG 0x22
|
||||
# define DONT_READ_CAN_MAILBOX 0x00
|
||||
# define READ_CAN_MAILBOX 0x01
|
||||
#define PAR_ENABLE_IDR_IN_RUN_MODE 0x23
|
||||
# define ACCESS_OSCCAL 0x00
|
||||
# define ACCESS_IDR 0x01
|
||||
#define PAR_HW_VERSION 0x01
|
||||
#define PAR_FW_VERSION 0x02
|
||||
#define PAR_EMULATOR_MODE 0x03
|
||||
# define EMULATOR_MODE_DEBUGWIRE 0x00
|
||||
# define EMULATOR_MODE_JTAG 0x01
|
||||
# define EMULATOR_MODE_HV 0x02 /* HVSP or PP mode of AVR Dragon */
|
||||
# define EMULATOR_MODE_SPI 0x03
|
||||
# define EMULATOR_MODE_JTAG_AVR32 0x04
|
||||
# define EMULATOR_MODE_JTAG_XMEGA 0x05
|
||||
# define EMULATOR_MODE_PDI 0x06
|
||||
#define PAR_IREG 0x04
|
||||
#define PAR_BAUD_RATE 0x05
|
||||
# define PAR_BAUD_2400 0x01
|
||||
# define PAR_BAUD_4800 0x02
|
||||
# define PAR_BAUD_9600 0x03
|
||||
# define PAR_BAUD_19200 0x04 /* default */
|
||||
# define PAR_BAUD_38400 0x05
|
||||
# define PAR_BAUD_57600 0x06
|
||||
# define PAR_BAUD_115200 0x07
|
||||
# define PAR_BAUD_14400 0x08
|
||||
#define PAR_OCD_VTARGET 0x06
|
||||
#define PAR_OCD_JTAG_CLK 0x07
|
||||
#define PAR_OCD_BREAK_CAUSE 0x08
|
||||
#define PAR_TIMERS_RUNNING 0x09
|
||||
#define PAR_BREAK_ON_CHANGE_FLOW 0x0A
|
||||
#define PAR_BREAK_ADDR1 0x0B
|
||||
#define PAR_BREAK_ADDR2 0x0C
|
||||
#define PAR_COMBBREAKCTRL 0x0D
|
||||
#define PAR_JTAGID 0x0E
|
||||
#define PAR_UNITS_BEFORE 0x0F
|
||||
#define PAR_UNITS_AFTER 0x10
|
||||
#define PAR_BIT_BEFORE 0x11
|
||||
#define PAR_BIT_ATER 0x12
|
||||
#define PAR_EXTERNAL_RESET 0x13
|
||||
#define PAR_FLASH_PAGE_SIZE 0x14
|
||||
#define PAR_EEPROM_PAGE_SIZE 0x15
|
||||
#define PAR_UNUSED1 0x16
|
||||
#define PAR_PSB0 0x17
|
||||
#define PAR_PSB1 0x18
|
||||
#define PAR_PROTOCOL_DEBUG_EVENT 0x19
|
||||
#define PAR_MCU_STATE 0x1A
|
||||
# define STOPPED 0x00
|
||||
# define RUNNING 0x01
|
||||
# define PROGRAMMING 0x02
|
||||
#define PAR_DAISY_CHAIN_INFO 0x1B
|
||||
#define PAR_BOOT_ADDRESS 0x1C
|
||||
#define PAR_TARGET_SIGNATURE 0x1D
|
||||
#define PAR_DEBUGWIRE_BAUDRATE 0x1E
|
||||
#define PAR_PROGRAM_ENTRY_POINT 0x1F
|
||||
#define PAR_PDI_OFFSET_START 0x32
|
||||
#define PAR_PDI_OFFSET_END 0x33
|
||||
#define PAR_PACKET_PARSING_ERRORS 0x40
|
||||
#define PAR_VALID_PACKETS_RECEIVED 0x41
|
||||
#define PAR_INTERCOMMUNICATION_TX_FAILURES 0x42
|
||||
#define PAR_INTERCOMMUNICATION_RX_FAILURES 0x43
|
||||
#define PAR_CRC_ERRORS 0x44
|
||||
#define PAR_POWER_SOURCE 0x45
|
||||
# define POWER_EXTERNAL 0x00
|
||||
# define POWER_USB 0x01
|
||||
#define PAR_CAN_FLAG 0x22
|
||||
# define DONT_READ_CAN_MAILBOX 0x00
|
||||
# define READ_CAN_MAILBOX 0x01
|
||||
#define PAR_ENABLE_IDR_IN_RUN_MODE 0x23
|
||||
# define ACCESS_OSCCAL 0x00
|
||||
# define ACCESS_IDR 0x01
|
||||
#define PAR_ALLOW_PAGEPROGRAMMING_IN_SCANCHAIN 0x24
|
||||
# define PAGEPROG_NOT_ALLOWED 0x00
|
||||
# define PAGEPROG_ALLOWED 0x01
|
||||
# define PAGEPROG_NOT_ALLOWED 0x00
|
||||
# define PAGEPROG_ALLOWED 0x01
|
||||
|
||||
/* Xmega erase memory types, for CMND_XMEGA_ERASE */
|
||||
#define XMEGA_ERASE_CHIP 0x00
|
||||
#define XMEGA_ERASE_APP 0x01
|
||||
#define XMEGA_ERASE_BOOT 0x02
|
||||
#define XMEGA_ERASE_EEPROM 0x03
|
||||
#define XMEGA_ERASE_APP_PAGE 0x04
|
||||
#define XMEGA_ERASE_BOOT_PAGE 0x05
|
||||
#define XMEGA_ERASE_EEPROM_PAGE 0x06
|
||||
#define XMEGA_ERASE_USERSIG 0x07
|
||||
|
||||
/* AVR32 related definitions */
|
||||
#define AVR32_FLASHC_FCR 0xFFFE1400
|
||||
#define AVR32_FLASHC_FCMD 0xFFFE1404
|
||||
#define AVR32_FLASHC_FCMD_KEY 0xA5000000
|
||||
#define AVR32_FLASHC_FCMD_WRITE_PAGE 1
|
||||
#define AVR32_FLASHC_FCMD_ERASE_PAGE 2
|
||||
#define AVR32_FLASHC_FCMD_CLEAR_PAGE_BUFFER 3
|
||||
#define AVR32_FLASHC_FCMD_LOCK 4
|
||||
#define AVR32_FLASHC_FCMD_UNLOCK 5
|
||||
#define AVR32_FLASHC_FSR 0xFFFE1408
|
||||
#define AVR32_FLASHC_FSR_RDY 0x00000001
|
||||
#define AVR32_FLASHC_FSR_ERR 0x00000008
|
||||
#define AVR32_FLASHC_FGPFRHI 0xFFFE140C
|
||||
#define AVR32_FLASHC_FGPFRLO 0xFFFE1410
|
||||
|
||||
#define AVR32_DC 0x00000008
|
||||
#define AVR32_DS 0x00000010
|
||||
#define AVR32_DINST 0x00000104
|
||||
#define AVR32_DCCPU 0x00000110
|
||||
#define AVR32_DCEMU 0x00000114
|
||||
#define AVR32_DCSR 0x00000118
|
||||
|
||||
#define AVR32_DC_ABORT 0x80000000
|
||||
#define AVR32_DC_RESET 0x40000000
|
||||
#define AVR32_DC_DBE 0x00002000
|
||||
#define AVR32_DC_DBR 0x00001000
|
||||
|
||||
#define AVR32_RESET_READ 0x0001
|
||||
#define AVR32_RESET_WRITE 0x0002
|
||||
#define AVR32_RESET_CHIP_ERASE 0x0004
|
||||
#define AVR32_SET4RUNNING 0x0008
|
||||
//#define AVR32_RESET_COMMON (AVR32_RESET_READ | AVR32_RESET_WRITE | AVR32_RESET_CHIP_ERASE )
|
||||
|
||||
|
||||
#if !defined(JTAGMKII_PRIVATE_EXPORTED)
|
||||
/*
|
||||
@@ -293,4 +356,30 @@ struct device_descriptor
|
||||
/* new as of early 2005, firmware 4.x */
|
||||
unsigned char EECRAddress[2]; /* EECR memory-mapped IO address */
|
||||
};
|
||||
|
||||
/* New Xmega device descriptor, for firmware version 7 and above */
|
||||
struct xmega_device_desc {
|
||||
unsigned char whatever[2]; // cannot guess; must be 0x0002
|
||||
unsigned char datalen; // length of the following data, = 47
|
||||
unsigned char nvm_app_offset[4]; // NVM offset for application flash
|
||||
unsigned char nvm_boot_offset[4]; // NVM offset for boot flash
|
||||
unsigned char nvm_eeprom_offset[4]; // NVM offset for EEPROM
|
||||
unsigned char nvm_fuse_offset[4]; // NVM offset for fuses
|
||||
unsigned char nvm_lock_offset[4]; // NVM offset for lock bits
|
||||
unsigned char nvm_user_sig_offset[4]; // NVM offset for user signature row
|
||||
unsigned char nvm_prod_sig_offset[4]; // NVM offset for production sign. row
|
||||
unsigned char nvm_data_offset[4]; // NVM offset for data memory (SRAM + IO)
|
||||
unsigned char app_size[4]; // size of application flash
|
||||
unsigned char boot_size[2]; // size of boot flash
|
||||
unsigned char flash_page_size[2]; // flash page size
|
||||
unsigned char eeprom_size[2]; // size of EEPROM
|
||||
unsigned char eeprom_page_size; // EEPROM page size
|
||||
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
|
||||
};
|
||||
#endif /* JTAGMKII_PRIVATE_EXPORTED */
|
||||
|
||||
/* return code from jtagmkII_getsync() to indicate a "graceful"
|
||||
* failure, i.e. an attempt to enable ISP failed and should be
|
||||
* eventually retried */
|
||||
#define JTAGII_GETSYNC_FAIL_GRACEFUL (-2)
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
176
avrdude/lexer.l
176
avrdude/lexer.l
@@ -14,8 +14,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -35,29 +34,34 @@
|
||||
#include "config_gram.h"
|
||||
#include "lists.h"
|
||||
|
||||
#define YY_NO_UNPUT
|
||||
#ifndef YYERRCODE
|
||||
#define YYERRCODE 256
|
||||
#endif
|
||||
|
||||
%}
|
||||
|
||||
DIGIT [0-9]
|
||||
HEXDIGIT [0-9a-fA-F]
|
||||
ID [_a-zA-Z][_a-zA-Z0-9]*
|
||||
SIGN [+-]
|
||||
|
||||
%x strng
|
||||
%x incl
|
||||
%x comment
|
||||
%option nounput
|
||||
|
||||
/* Bump resources for classic lex. */
|
||||
%e2000
|
||||
%p5000
|
||||
%p10000
|
||||
%n1000
|
||||
|
||||
%%
|
||||
|
||||
{SIGN}*{DIGIT}+ { yylval = number(yytext); return TKN_NUMBER; }
|
||||
{SIGN}*{DIGIT}+"."{DIGIT}* { yylval = number(yytext); return TKN_NUMBER; }
|
||||
{SIGN}*"."{DIGIT}* { yylval = number(yytext); return TKN_NUMBER; }
|
||||
#{SIGN}*{DIGIT}+ { yylval = number(yytext); return TKN_NUMBER; }
|
||||
#{SIGN}*{DIGIT}+"."{DIGIT}* { yylval = number_real(yytext); return TKN_NUMBER_REAL; }
|
||||
#{SIGN}*"."{DIGIT}* { yylval = number_real(yytext); return TKN_NUMBER_REAL; }
|
||||
{DIGIT}+ { yylval = number(yytext); return TKN_NUMBER; }
|
||||
{DIGIT}+"."{DIGIT}* { yylval = number_real(yytext); return TKN_NUMBER_REAL; }
|
||||
"."{DIGIT}+ { yylval = number_real(yytext); return TKN_NUMBER_REAL; }
|
||||
|
||||
"\"" { string_buf_ptr = string_buf; BEGIN(strng); }
|
||||
|
||||
@@ -117,139 +121,136 @@ SIGN [+-]
|
||||
exit(1); }
|
||||
|
||||
allowfullpagebitstream { yylval=NULL; return K_ALLOWFULLPAGEBITSTREAM; }
|
||||
avr910 { yylval=NULL; return K_AVR910; }
|
||||
avr910_devcode { yylval=NULL; return K_AVR910_DEVCODE; }
|
||||
usbasp { yylval=NULL; return K_USBASP; }
|
||||
bank_size { yylval=NULL; return K_PAGE_SIZE; }
|
||||
banked { yylval=NULL; return K_PAGED; }
|
||||
baudrate { yylval=NULL; return K_BAUDRATE; }
|
||||
blocksize { yylval=NULL; return K_BLOCKSIZE; }
|
||||
bs2 { yylval=NULL; return K_BS2; }
|
||||
buff { yylval=NULL; return K_BUFF; }
|
||||
butterfly { yylval=NULL; return K_BUTTERFLY; }
|
||||
bytedelay { yylval=NULL; return K_BYTEDELAY; }
|
||||
chip_erase { yylval=new_token(K_CHIP_ERASE); return K_CHIP_ERASE; }
|
||||
chip_erase_delay { yylval=NULL; return K_CHIP_ERASE_DELAY; }
|
||||
desc { yylval=NULL; return K_DESC; }
|
||||
chiperasepolltimeout { yylval=NULL; return K_CHIPERASEPOLLTIMEOUT; }
|
||||
chiperasepulsewidth { yylval=NULL; return K_CHIPERASEPULSEWIDTH; }
|
||||
chiperasetime { yylval=NULL; return K_CHIPERASETIME; }
|
||||
cmdexedelay { yylval=NULL; return K_CMDEXEDELAY; }
|
||||
connection_type { yylval=NULL; return K_CONNTYPE; }
|
||||
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; }
|
||||
devicecode { yylval=NULL; return K_DEVICECODE; }
|
||||
dragon_dw { yylval=NULL; return K_DRAGON_DW; }
|
||||
dragon_hvsp { yylval=NULL; return K_DRAGON_HVSP; }
|
||||
dragon_isp { yylval=NULL; return K_DRAGON_ISP; }
|
||||
dragon_jtag { yylval=NULL; return K_DRAGON_JTAG; }
|
||||
dragon_pp { yylval=NULL; return K_DRAGON_PP; }
|
||||
eecr { yylval=NULL; return K_EECR; }
|
||||
eeprom { yylval=NULL; return K_EEPROM; }
|
||||
eeprom_instr { yylval=NULL; return K_EEPROM_INSTR; }
|
||||
enablepageprogramming { yylval=NULL; return K_ENABLEPAGEPROGRAMMING; }
|
||||
errled { yylval=NULL; return K_ERRLED; }
|
||||
flash { yylval=NULL; return K_FLASH; }
|
||||
has_jtag { yylval=NULL; return K_HAS_JTAG; }
|
||||
flash_instr { yylval=NULL; return K_FLASH_INSTR; }
|
||||
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; }
|
||||
hventerstabdelay { yylval=NULL; return K_HVENTERSTABDELAY; }
|
||||
hvleavestabdelay { yylval=NULL; return K_HVLEAVESTABDELAY; }
|
||||
hvsp_controlstack { yylval=NULL; return K_HVSP_CONTROLSTACK; }
|
||||
hvspcmdexedelay { yylval=NULL; return K_HVSPCMDEXEDELAY; }
|
||||
id { yylval=NULL; return K_ID; }
|
||||
idr { yylval=NULL; return K_IDR; }
|
||||
jtagmki { yylval=NULL; return K_JTAG_MKI; }
|
||||
jtagmkii { yylval=NULL; return K_JTAG_MKII; }
|
||||
jtagmkii_dw { yylval=NULL; return K_JTAG_MKII_DW; }
|
||||
jtagmkii_isp { yylval=NULL; return K_JTAG_MKII_ISP; }
|
||||
io { yylval=new_token(K_IO); return K_IO; }
|
||||
is_at90s1200 { yylval=NULL; return K_IS_AT90S1200; }
|
||||
is_avr32 { yylval=NULL; return K_IS_AVR32; }
|
||||
latchcycles { yylval=NULL; return K_LATCHCYCLES; }
|
||||
load_ext_addr { yylval=new_token(K_LOAD_EXT_ADDR); return K_LOAD_EXT_ADDR; }
|
||||
loadpage_hi { yylval=new_token(K_LOADPAGE_HI); return K_LOADPAGE_HI; }
|
||||
loadpage_lo { yylval=new_token(K_LOADPAGE_LO); return K_LOADPAGE_LO; }
|
||||
max_write_delay { yylval=NULL; return K_MAX_WRITE_DELAY; }
|
||||
mcu_base { yylval=NULL; return K_MCU_BASE; }
|
||||
memory { yylval=NULL; return K_MEMORY; }
|
||||
min_write_delay { yylval=NULL; return K_MIN_WRITE_DELAY; }
|
||||
miso { yylval=NULL; return K_MISO; }
|
||||
mode { yylval=NULL; return K_MODE; }
|
||||
mosi { yylval=NULL; return K_MOSI; }
|
||||
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; }
|
||||
ocdrev { yylval=NULL; return K_OCDREV; }
|
||||
offset { yylval=NULL; return K_OFFSET; }
|
||||
page_size { yylval=NULL; return K_PAGE_SIZE; }
|
||||
paged { yylval=NULL; return K_PAGED; }
|
||||
pagel { yylval=NULL; return K_PAGEL; }
|
||||
par { yylval=NULL; return K_PAR; }
|
||||
parallel { yylval=NULL; return K_PARALLEL; }
|
||||
parent { yylval=NULL; return K_PARENT; }
|
||||
part { yylval=NULL; return K_PART; }
|
||||
pgm_enable { yylval=new_token(K_PGM_ENABLE); return K_PGM_ENABLE; }
|
||||
pgmled { yylval=NULL; return K_PGMLED; }
|
||||
pollindex { yylval=NULL; return K_POLLINDEX; }
|
||||
pollmethod { yylval=NULL; return K_POLLMETHOD; }
|
||||
pollvalue { yylval=NULL; return K_POLLVALUE; }
|
||||
postdelay { yylval=NULL; return K_POSTDELAY; }
|
||||
poweroffdelay { yylval=NULL; return K_POWEROFFDELAY; }
|
||||
pp_controlstack { yylval=NULL; return K_PP_CONTROLSTACK; }
|
||||
predelay { yylval=NULL; return K_PREDELAY; }
|
||||
progmodedelay { yylval=NULL; return K_PROGMODEDELAY; }
|
||||
programfusepolltimeout { yylval=NULL; return K_PROGRAMFUSEPOLLTIMEOUT; }
|
||||
programfusepulsewidth { yylval=NULL; return K_PROGRAMFUSEPULSEWIDTH; }
|
||||
programlockpolltimeout { yylval=NULL; return K_PROGRAMLOCKPOLLTIMEOUT; }
|
||||
programlockpulsewidth { yylval=NULL; return K_PROGRAMLOCKPULSEWIDTH; }
|
||||
programmer { yylval=NULL; return K_PROGRAMMER; }
|
||||
pseudo { yylval=new_token(K_PSEUDO); return K_PSEUDO; }
|
||||
pwroff_after_write { yylval=NULL; return K_PWROFF_AFTER_WRITE; }
|
||||
rampz { yylval=NULL; return K_RAMPZ; }
|
||||
rdyled { yylval=NULL; return K_RDYLED; }
|
||||
read { yylval=new_token(K_READ); return K_READ; }
|
||||
read_hi { yylval=new_token(K_READ_HI); return K_READ_HI; }
|
||||
read_lo { yylval=new_token(K_READ_LO); return K_READ_LO; }
|
||||
readback_p1 { yylval=NULL; return K_READBACK_P1; }
|
||||
readback_p2 { yylval=NULL; return K_READBACK_P2; }
|
||||
readsize { yylval=NULL; return K_READSIZE; }
|
||||
reset { yylval=new_token(K_RESET); return K_RESET; }
|
||||
resetdelay { yylval=NULL; return K_RESETDELAY; }
|
||||
resetdelayms { yylval=NULL; return K_RESETDELAYMS; }
|
||||
resetdelayus { yylval=NULL; return K_RESETDELAYUS; }
|
||||
retry_pulse { yylval=NULL; return K_RETRY_PULSE; }
|
||||
serbb { yylval=NULL; return K_SERBB; }
|
||||
sck { yylval=new_token(K_SCK); return K_SCK; }
|
||||
serial { yylval=NULL; return K_SERIAL; }
|
||||
signature { yylval=NULL; return K_SIGNATURE; }
|
||||
size { yylval=NULL; return K_SIZE; }
|
||||
spmcr { yylval=NULL; return K_SPMCR; }
|
||||
stk500 { yylval=NULL; return K_STK500; }
|
||||
stk500hvsp { yylval=NULL; return K_STK500HVSP; }
|
||||
stk500pp { yylval=NULL; return K_STK500PP; }
|
||||
stk500v2 { yylval=NULL; return K_STK500V2; }
|
||||
stk500generic { yylval=NULL; return K_STK500GENERIC; }
|
||||
stabdelay { yylval=NULL; return K_STABDELAY; }
|
||||
stk500_devcode { yylval=NULL; return K_STK500_DEVCODE; }
|
||||
synchcycles { yylval=NULL; return K_SYNCHCYCLES; }
|
||||
synchloops { yylval=NULL; return K_SYNCHLOOPS; }
|
||||
timeout { yylval=NULL; return K_TIMEOUT; }
|
||||
togglevtg { yylval=NULL; return K_TOGGLEVTG; }
|
||||
type { yylval=NULL; return K_TYPE; }
|
||||
usb { yylval=NULL; return K_USB; }
|
||||
usbdev { yylval=NULL; return K_USBDEV; }
|
||||
usbpid { yylval=NULL; return K_USBPID; }
|
||||
usbproduct { yylval=NULL; return K_USBPRODUCT; }
|
||||
usbsn { yylval=NULL; return K_USBSN; }
|
||||
usbvendor { yylval=NULL; return K_USBVENDOR; }
|
||||
usbvid { yylval=NULL; return K_USBVID; }
|
||||
vcc { yylval=NULL; return K_VCC; }
|
||||
vfyled { yylval=NULL; return K_VFYLED; }
|
||||
|
||||
timeout { yylval=NULL; return K_TIMEOUT; }
|
||||
stabdelay { yylval=NULL; return K_STABDELAY; }
|
||||
cmdexedelay { yylval=NULL; return K_CMDEXEDELAY; }
|
||||
hvspcmdexedelay { yylval=NULL; return K_HVSPCMDEXEDELAY; }
|
||||
synchloops { yylval=NULL; return K_SYNCHLOOPS; }
|
||||
bytedelay { yylval=NULL; return K_BYTEDELAY; }
|
||||
pollvalue { yylval=NULL; return K_POLLVALUE; }
|
||||
pollindex { yylval=NULL; return K_POLLINDEX; }
|
||||
predelay { yylval=NULL; return K_PREDELAY; }
|
||||
postdelay { yylval=NULL; return K_POSTDELAY; }
|
||||
pollmethod { yylval=NULL; return K_POLLMETHOD; }
|
||||
mode { yylval=NULL; return K_MODE; }
|
||||
delay { yylval=NULL; return K_DELAY; }
|
||||
blocksize { yylval=NULL; return K_BLOCKSIZE; }
|
||||
readsize { yylval=NULL; return K_READSIZE; }
|
||||
pp_controlstack { yylval=NULL; return K_PP_CONTROLSTACK; }
|
||||
hvsp_controlstack { yylval=NULL; return K_HVSP_CONTROLSTACK; }
|
||||
hventerstabdelay { yylval=NULL; return K_HVENTERSTABDELAY; }
|
||||
progmodedelay { yylval=NULL; return K_PROGMODEDELAY; }
|
||||
latchcycles { yylval=NULL; return K_LATCHCYCLES; }
|
||||
togglevtg { yylval=NULL; return K_TOGGLEVTG; }
|
||||
poweroffdelay { yylval=NULL; return K_POWEROFFDELAY; }
|
||||
resetdelayms { yylval=NULL; return K_RESETDELAYMS; }
|
||||
resetdelayus { yylval=NULL; return K_RESETDELAYUS; }
|
||||
hvleavestabdelay { yylval=NULL; return K_HVLEAVESTABDELAY; }
|
||||
resetdelay { yylval=NULL; return K_RESETDELAY; }
|
||||
synchcycles { yylval=NULL; return K_SYNCHCYCLES; }
|
||||
chiperasepulsewidth { yylval=NULL; return K_CHIPERASEPULSEWIDTH; }
|
||||
chiperasepolltimeout { yylval=NULL; return K_CHIPERASEPOLLTIMEOUT; }
|
||||
chiperasetime { yylval=NULL; return K_CHIPERASETIME; }
|
||||
programfusepulsewidth { yylval=NULL; return K_PROGRAMFUSEPULSEWIDTH; }
|
||||
programfusepolltimeout { yylval=NULL; return K_PROGRAMFUSEPOLLTIMEOUT; }
|
||||
programlockpulsewidth { yylval=NULL; return K_PROGRAMLOCKPULSEWIDTH; }
|
||||
programlockpolltimeout { yylval=NULL; return K_PROGRAMLOCKPOLLTIMEOUT; }
|
||||
flash_instr { yylval=NULL; return K_FLASH_INSTR; }
|
||||
eeprom_instr { yylval=NULL; return K_EEPROM_INSTR; }
|
||||
|
||||
dedicated { yylval=new_token(K_DEDICATED); return K_DEDICATED; }
|
||||
io { yylval=new_token(K_IO); return K_IO; }
|
||||
pseudo { yylval=new_token(K_PSEUDO); return K_PSEUDO; }
|
||||
|
||||
reset { yylval=new_token(K_RESET); return K_RESET; }
|
||||
sck { yylval=new_token(K_SCK); return K_SCK; }
|
||||
|
||||
read { yylval=new_token(K_READ); return K_READ; }
|
||||
write { yylval=new_token(K_WRITE); return K_WRITE; }
|
||||
read_lo { yylval=new_token(K_READ_LO); return K_READ_LO; }
|
||||
read_hi { yylval=new_token(K_READ_HI); return K_READ_HI; }
|
||||
write_lo { yylval=new_token(K_WRITE_LO); return K_WRITE_LO; }
|
||||
write_hi { yylval=new_token(K_WRITE_HI); return K_WRITE_HI; }
|
||||
loadpage_lo { yylval=new_token(K_LOADPAGE_LO); return K_LOADPAGE_LO; }
|
||||
loadpage_hi { yylval=new_token(K_LOADPAGE_HI); return K_LOADPAGE_HI; }
|
||||
load_ext_addr { yylval=new_token(K_LOAD_EXT_ADDR); return K_LOAD_EXT_ADDR; }
|
||||
write_lo { yylval=new_token(K_WRITE_LO); return K_WRITE_LO; }
|
||||
writepage { yylval=new_token(K_WRITEPAGE); return K_WRITEPAGE; }
|
||||
chip_erase { yylval=new_token(K_CHIP_ERASE); return K_CHIP_ERASE; }
|
||||
pgm_enable { yylval=new_token(K_PGM_ENABLE); return K_PGM_ENABLE; }
|
||||
|
||||
no { yylval=new_token(K_NO); return K_NO; }
|
||||
yes { yylval=new_token(K_YES); return K_YES; }
|
||||
|
||||
"," { yylval = NULL; pyytext(); return TKN_COMMA; }
|
||||
"=" { yylval = NULL; pyytext(); return TKN_EQUAL; }
|
||||
";" { yylval = NULL; pyytext(); return TKN_SEMI; }
|
||||
"~" { yylval = NULL; pyytext(); return TKN_TILDE; }
|
||||
"(" { yylval = NULL; pyytext(); return TKN_LEFT_PAREN; }
|
||||
")" { yylval = NULL; pyytext(); return TKN_RIGHT_PAREN; }
|
||||
|
||||
"\n" { lineno++; }
|
||||
[ \r\t]+ { /* ignore whitespace */ }
|
||||
@@ -258,10 +259,9 @@ c: { fprintf(stderr, "error at %s:%d: possible old-style config file entry\n",
|
||||
infile, lineno);
|
||||
fprintf(stderr, " Update your config file (see %s%s for a sample)\n",
|
||||
CONFIG_DIR, "/avrdude.conf.sample");
|
||||
exit(1); }
|
||||
return YYERRCODE; }
|
||||
|
||||
. { fprintf(stderr, "error at %s:%d unrecognized character: \"%s\"\n",
|
||||
infile, lineno, yytext); exit(1); }
|
||||
. { return YYERRCODE; }
|
||||
|
||||
%%
|
||||
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -25,8 +24,10 @@
|
||||
#define OBSOLETE__IOW _IOW
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#ifdef HAVE_PARPORT
|
||||
#include <linux/parport.h>
|
||||
#include <linux/ppdev.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
352
avrdude/linuxgpio.c
Normal file
352
avrdude/linuxgpio.c
Normal file
@@ -0,0 +1,352 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Support for bitbanging GPIO pins using the /sys/class/gpio interface
|
||||
*
|
||||
* Copyright (C) 2013 Radoslav Kolev <radoslav@kolev.info>
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include "ac_cfg.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "avr.h"
|
||||
#include "pindefs.h"
|
||||
#include "pgm.h"
|
||||
#include "bitbang.h"
|
||||
|
||||
#if HAVE_LINUXGPIO
|
||||
|
||||
/*
|
||||
* GPIO user space helpers
|
||||
*
|
||||
* Copyright 2009 Analog Devices Inc.
|
||||
* Michael Hennerich (hennerich@blackfin.uclinux.org)
|
||||
*
|
||||
* Licensed under the GPL-2 or later
|
||||
*/
|
||||
|
||||
/*
|
||||
* GPIO user space helpers
|
||||
* The following functions are acting on an "unsigned gpio" argument, which corresponds to the
|
||||
* gpio numbering scheme in the kernel (starting from 0).
|
||||
* The higher level functions use "int pin" to specify the pins with an offset of 1:
|
||||
* gpio = pin - 1;
|
||||
*/
|
||||
|
||||
#define GPIO_DIR_IN 0
|
||||
#define GPIO_DIR_OUT 1
|
||||
|
||||
static int linuxgpio_export(unsigned int gpio)
|
||||
{
|
||||
int fd, len, r;
|
||||
char buf[11];
|
||||
|
||||
fd = open("/sys/class/gpio/export", O_WRONLY);
|
||||
if (fd < 0) {
|
||||
perror("Can't open /sys/class/gpio/export");
|
||||
return fd;
|
||||
}
|
||||
|
||||
len = snprintf(buf, sizeof(buf), "%d", gpio);
|
||||
r = write(fd, buf, len);
|
||||
close(fd);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static int linuxgpio_unexport(unsigned int gpio)
|
||||
{
|
||||
int fd, len, r;
|
||||
char buf[11];
|
||||
|
||||
fd = open("/sys/class/gpio/unexport", O_WRONLY);
|
||||
if (fd < 0) {
|
||||
perror("Can't open /sys/class/gpio/unexport");
|
||||
return fd;
|
||||
}
|
||||
|
||||
len = snprintf(buf, sizeof(buf), "%d", gpio);
|
||||
r = write(fd, buf, len);
|
||||
close(fd);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static int linuxgpio_openfd(unsigned int gpio)
|
||||
{
|
||||
char filepath[60];
|
||||
|
||||
snprintf(filepath, sizeof(filepath), "/sys/class/gpio/gpio%d/value", gpio);
|
||||
return (open(filepath, O_RDWR));
|
||||
}
|
||||
|
||||
static int linuxgpio_dir(unsigned int gpio, unsigned int dir)
|
||||
{
|
||||
int fd, r;
|
||||
char buf[60];
|
||||
|
||||
snprintf(buf, sizeof(buf), "/sys/class/gpio/gpio%d/direction", gpio);
|
||||
|
||||
fd = open(buf, O_WRONLY);
|
||||
if (fd < 0) {
|
||||
perror("Can't open gpioX/direction");
|
||||
return fd;
|
||||
}
|
||||
|
||||
if (dir == GPIO_DIR_OUT)
|
||||
r = write(fd, "out", 4);
|
||||
else
|
||||
r = write(fd, "in", 3);
|
||||
|
||||
close(fd);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static int linuxgpio_dir_out(unsigned int gpio)
|
||||
{
|
||||
return linuxgpio_dir(gpio, GPIO_DIR_OUT);
|
||||
}
|
||||
|
||||
static int linuxgpio_dir_in(unsigned int gpio)
|
||||
{
|
||||
return linuxgpio_dir(gpio, GPIO_DIR_IN);
|
||||
}
|
||||
|
||||
/*
|
||||
* End of GPIO user space helpers
|
||||
*/
|
||||
|
||||
#define N_GPIO (PIN_MAX + 1)
|
||||
|
||||
/*
|
||||
* an array which holds open FDs to /sys/class/gpio/gpioXX/value for all needed pins
|
||||
*/
|
||||
static int linuxgpio_fds[N_GPIO] ;
|
||||
|
||||
|
||||
static int linuxgpio_setpin(PROGRAMMER * pgm, int pin, int value)
|
||||
{
|
||||
int r;
|
||||
|
||||
if (pin & PIN_INVERSE)
|
||||
{
|
||||
value = !value;
|
||||
pin &= PIN_MASK;
|
||||
}
|
||||
|
||||
if ( linuxgpio_fds[pin] < 0 )
|
||||
return -1;
|
||||
|
||||
if (value)
|
||||
r = write(linuxgpio_fds[pin], "1", 1);
|
||||
else
|
||||
r = write(linuxgpio_fds[pin], "0", 1);
|
||||
|
||||
if (r!=1) return -1;
|
||||
|
||||
if (pgm->ispdelay > 1)
|
||||
bitbang_delay(pgm->ispdelay);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int linuxgpio_getpin(PROGRAMMER * pgm, int pin)
|
||||
{
|
||||
unsigned char invert=0;
|
||||
char c;
|
||||
|
||||
if (pin & PIN_INVERSE)
|
||||
{
|
||||
invert = 1;
|
||||
pin &= PIN_MASK;
|
||||
}
|
||||
|
||||
if ( linuxgpio_fds[pin] < 0 )
|
||||
return -1;
|
||||
|
||||
if (lseek(linuxgpio_fds[pin], 0, SEEK_SET)<0)
|
||||
return -1;
|
||||
|
||||
if (read(linuxgpio_fds[pin], &c, 1)!=1)
|
||||
return -1;
|
||||
|
||||
if (c=='0')
|
||||
return 0+invert;
|
||||
else if (c=='1')
|
||||
return 1-invert;
|
||||
else
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
static int linuxgpio_highpulsepin(PROGRAMMER * pgm, int pin)
|
||||
{
|
||||
|
||||
if ( linuxgpio_fds[pin & PIN_MASK] < 0 )
|
||||
return -1;
|
||||
|
||||
linuxgpio_setpin(pgm, pin, 1);
|
||||
linuxgpio_setpin(pgm, pin, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void linuxgpio_display(PROGRAMMER *pgm, const char *p)
|
||||
{
|
||||
fprintf(stderr, "%sPin assignment : /sys/class/gpio/gpio{n}\n",p);
|
||||
pgm_display_generic_mask(pgm, p, SHOW_AVR_PINS);
|
||||
}
|
||||
|
||||
static void linuxgpio_enable(PROGRAMMER *pgm)
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
static void linuxgpio_disable(PROGRAMMER *pgm)
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
static void linuxgpio_powerup(PROGRAMMER *pgm)
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
static void linuxgpio_powerdown(PROGRAMMER *pgm)
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
static int linuxgpio_open(PROGRAMMER *pgm, char *port)
|
||||
{
|
||||
int r, i, pin;
|
||||
|
||||
bitbang_check_prerequisites(pgm);
|
||||
|
||||
|
||||
for (i=0; i<N_GPIO; i++)
|
||||
linuxgpio_fds[i] = -1;
|
||||
//Avrdude assumes that if a pin number is 0 it means not used/available
|
||||
//this causes a problem because 0 is a valid GPIO number in Linux sysfs.
|
||||
//To avoid annoying off by one pin numbering we assume SCK, MOSI, MISO
|
||||
//and RESET pins are always defined in avrdude.conf, even as 0. If they're
|
||||
//not programming will not work anyway. The drawbacks of this approach are
|
||||
//that unwanted toggling of GPIO0 can occur and that other optional pins
|
||||
//mostry LED status, can't be set to GPIO0. It can be fixed when a better
|
||||
//solution exists.
|
||||
for (i=0; i<N_PINS; i++) {
|
||||
if ( pgm->pinno[i] != 0 ||
|
||||
i == PIN_AVR_RESET ||
|
||||
i == PIN_AVR_SCK ||
|
||||
i == PIN_AVR_MOSI ||
|
||||
i == PIN_AVR_MISO ) {
|
||||
pin = pgm->pinno[i] & PIN_MASK;
|
||||
if ((r=linuxgpio_export(pin)) < 0) {
|
||||
fprintf(stderr, "Can't export GPIO %d, already exported/busy?: %s",
|
||||
pin, strerror(errno));
|
||||
return r;
|
||||
}
|
||||
if (i == PIN_AVR_MISO)
|
||||
r=linuxgpio_dir_in(pin);
|
||||
else
|
||||
r=linuxgpio_dir_out(pin);
|
||||
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if ((linuxgpio_fds[pin]=linuxgpio_openfd(pin)) < 0)
|
||||
return linuxgpio_fds[pin];
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void linuxgpio_close(PROGRAMMER *pgm)
|
||||
{
|
||||
int i, reset_pin;
|
||||
|
||||
reset_pin = pgm->pinno[PIN_AVR_RESET] & PIN_MASK;
|
||||
|
||||
//first configure all pins as input, except RESET
|
||||
//this should avoid possible conflicts when AVR firmware starts
|
||||
for (i=0; i<N_GPIO; i++) {
|
||||
if (linuxgpio_fds[i] >= 0 && i != reset_pin) {
|
||||
close(linuxgpio_fds[i]);
|
||||
linuxgpio_dir_in(i);
|
||||
linuxgpio_unexport(i);
|
||||
}
|
||||
}
|
||||
//configure RESET as input, if there's external pull up it will go high
|
||||
if (linuxgpio_fds[reset_pin] >= 0) {
|
||||
close(linuxgpio_fds[reset_pin]);
|
||||
linuxgpio_dir_in(reset_pin);
|
||||
linuxgpio_unexport(reset_pin);
|
||||
}
|
||||
}
|
||||
|
||||
void linuxgpio_initpgm(PROGRAMMER *pgm)
|
||||
{
|
||||
strcpy(pgm->type, "linuxgpio");
|
||||
|
||||
pgm_fill_old_pins(pgm); // TODO to be removed if old pin data no longer needed
|
||||
|
||||
pgm->rdy_led = bitbang_rdy_led;
|
||||
pgm->err_led = bitbang_err_led;
|
||||
pgm->pgm_led = bitbang_pgm_led;
|
||||
pgm->vfy_led = bitbang_vfy_led;
|
||||
pgm->initialize = bitbang_initialize;
|
||||
pgm->display = linuxgpio_display;
|
||||
pgm->enable = linuxgpio_enable;
|
||||
pgm->disable = linuxgpio_disable;
|
||||
pgm->powerup = linuxgpio_powerup;
|
||||
pgm->powerdown = linuxgpio_powerdown;
|
||||
pgm->program_enable = bitbang_program_enable;
|
||||
pgm->chip_erase = bitbang_chip_erase;
|
||||
pgm->cmd = bitbang_cmd;
|
||||
pgm->open = linuxgpio_open;
|
||||
pgm->close = linuxgpio_close;
|
||||
pgm->setpin = linuxgpio_setpin;
|
||||
pgm->getpin = linuxgpio_getpin;
|
||||
pgm->highpulsepin = linuxgpio_highpulsepin;
|
||||
pgm->read_byte = avr_read_byte_default;
|
||||
pgm->write_byte = avr_write_byte_default;
|
||||
}
|
||||
|
||||
const char linuxgpio_desc[] = "GPIO bitbanging using the Linux sysfs interface";
|
||||
|
||||
#else /* !HAVE_LINUXGPIO */
|
||||
|
||||
void linuxgpio_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: Linux sysfs GPIO support not available in this configuration\n",
|
||||
progname);
|
||||
}
|
||||
|
||||
const char linuxgpio_desc[] = "GPIO bitbanging using the Linux sysfs interface (not available)";
|
||||
|
||||
#endif /* HAVE_LINUXGPIO */
|
||||
36
avrdude/linuxgpio.h
Normal file
36
avrdude/linuxgpio.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2013 Radoslav Kolev <radoslav@kolev.info>
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* $Id: par.h 722 2007-01-24 22:43:46Z joerg_wunsch $ */
|
||||
|
||||
#ifndef linuxgpio_h
|
||||
#define linuxgpio_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const char linuxgpio_desc[];
|
||||
void linuxgpio_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -478,7 +477,7 @@ lcreat ( void * liststruct, int elements )
|
||||
| at the same time.
|
||||
--------------------------------------------------*/
|
||||
void
|
||||
ldestroy_cb ( LISTID lid, void (*ucleanup)() )
|
||||
ldestroy_cb ( LISTID lid, void (*ucleanup)(void * data_ptr) )
|
||||
{
|
||||
LIST * l;
|
||||
LISTNODE * ln;
|
||||
@@ -1280,6 +1279,43 @@ lsrch ( LISTID lid, void * p, int (* compare)(void * p1, void * p2) )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
| lsort
|
||||
|
|
||||
| sort list - sorts list inplace (using bubble sort)
|
||||
|
|
||||
----------------------------------------------------------------------*/
|
||||
void
|
||||
lsort ( LISTID lid, int (* compare)(void * p1, void * p2) )
|
||||
{
|
||||
LIST * l;
|
||||
LISTNODE * lt; /* this */
|
||||
LISTNODE * ln; /* next */
|
||||
int unsorted = 1;
|
||||
|
||||
l = (LIST *)lid;
|
||||
|
||||
CKLMAGIC(l);
|
||||
|
||||
while(unsorted){
|
||||
lt = l->top;
|
||||
unsorted = 0;
|
||||
while (lt!=NULL) {
|
||||
CKMAGIC(lt);
|
||||
ln = lt->next;
|
||||
if (ln!= NULL && compare(lt->data,ln->data) > 0) {
|
||||
void * p = ln->data;
|
||||
ln->data = lt->data;
|
||||
lt->data = p;
|
||||
unsorted = 1;
|
||||
}
|
||||
lt = ln;
|
||||
}
|
||||
}
|
||||
|
||||
CKLMAGIC(l);
|
||||
}
|
||||
|
||||
|
||||
int lprint ( FILE * f, LISTID lid )
|
||||
{
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -75,7 +74,7 @@ extern "C" {
|
||||
|
||||
LISTID lcreat ( void * liststruct, int poolsize );
|
||||
void ldestroy ( LISTID lid );
|
||||
void ldestroy_cb ( LISTID lid, void (*ucleanup)() );
|
||||
void ldestroy_cb ( LISTID lid, void (*ucleanup)(void * data_ptr) );
|
||||
|
||||
LNODEID lfirst ( LISTID ); /* head of the list */
|
||||
LNODEID llast ( LISTID ); /* tail of the list */
|
||||
@@ -104,6 +103,8 @@ void * lrmv_d ( LISTID lid, void * data_ptr );
|
||||
|
||||
LISTID lcat ( LISTID lid1, LISTID lid2 );
|
||||
|
||||
void lsort ( LISTID lid, int (*compare)(void * p1, void * p2));
|
||||
|
||||
void * lsrch ( LISTID lid, void * p, int (*compare)(void *p1,void *p2));
|
||||
|
||||
int lprint ( FILE * f, LISTID lid );
|
||||
|
||||
658
avrdude/main.c
658
avrdude/main.c
File diff suppressed because it is too large
Load Diff
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
112
avrdude/par.c
112
avrdude/par.c
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -28,11 +27,11 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
# include "freebsd_ppi.h"
|
||||
#elif defined(__linux__)
|
||||
# include "linux_ppdev.h"
|
||||
#elif defined(__sun__) && defined(__svr4__) /* Solaris */
|
||||
#elif defined(__sun__) || defined(__sun) /* Solaris */
|
||||
# include "solaris_ecpp.h"
|
||||
#endif
|
||||
|
||||
@@ -42,6 +41,7 @@
|
||||
#include "pgm.h"
|
||||
#include "ppi.h"
|
||||
#include "bitbang.h"
|
||||
#include "par.h"
|
||||
|
||||
#if HAVE_PARPORT
|
||||
|
||||
@@ -105,11 +105,14 @@ static int par_setpin(PROGRAMMER * pgm, int pin, int value)
|
||||
|
||||
static void par_setmany(PROGRAMMER * pgm, unsigned int pinset, int value)
|
||||
{
|
||||
int pin;
|
||||
int pin, mask;
|
||||
|
||||
/* mask is anything non-pin - needs to be applied to each par_setpin to preserve inversion */
|
||||
mask = pinset & (~PIN_MASK);
|
||||
|
||||
for (pin = 1; pin <= 17; pin++) {
|
||||
if (pinset & (1 << pin))
|
||||
par_setpin(pgm, pin, value);
|
||||
par_setpin(pgm, pin | mask, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,25 +180,6 @@ static int par_highpulsepin(PROGRAMMER * pgm, int pin)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char * pins_to_str(unsigned int pmask)
|
||||
{
|
||||
static char buf[64];
|
||||
int pin;
|
||||
char b2[8];
|
||||
|
||||
buf[0] = 0;
|
||||
for (pin = 1; pin <= 17; pin++) {
|
||||
if (pmask & (1 << pin)) {
|
||||
sprintf(b2, "%d", pin);
|
||||
if (buf[0] != 0)
|
||||
strcat(buf, ",");
|
||||
strcat(buf, b2);
|
||||
}
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*
|
||||
* apply power to the AVR processor
|
||||
*/
|
||||
@@ -285,7 +269,7 @@ static void par_close(PROGRAMMER * pgm)
|
||||
ppi_setall(&pgm->fd, PPIDATA, pgm->ppidata);
|
||||
ppi_setall(&pgm->fd, PPICTRL, pgm->ppictrl);
|
||||
|
||||
par_setpin(pgm, pgm->pinno[PPI_AVR_BUFF], 1);
|
||||
par_setmany(pgm, pgm->pinno[PPI_AVR_BUFF], 1);
|
||||
|
||||
/*
|
||||
* Handle exit specs.
|
||||
@@ -303,6 +287,21 @@ static void par_close(PROGRAMMER * pgm)
|
||||
/* Leave it alone. */
|
||||
break;
|
||||
}
|
||||
|
||||
switch (pgm->exit_datahigh) {
|
||||
case EXIT_DATAHIGH_ENABLED:
|
||||
ppi_setall(&pgm->fd, PPIDATA, 0xff);
|
||||
break;
|
||||
|
||||
case EXIT_DATAHIGH_DISABLED:
|
||||
ppi_setall(&pgm->fd, PPIDATA, 0x00);
|
||||
break;
|
||||
|
||||
case EXIT_DATAHIGH_UNSPEC:
|
||||
/* Leave it alone. */
|
||||
break;
|
||||
}
|
||||
|
||||
switch (pgm->exit_vcc) {
|
||||
case EXIT_VCC_ENABLED:
|
||||
par_setmany(pgm, pgm->pinno[PPI_AVR_VCC], 1);
|
||||
@@ -321,52 +320,6 @@ static void par_close(PROGRAMMER * pgm)
|
||||
pgm->fd.ifd = -1;
|
||||
}
|
||||
|
||||
static void par_display(PROGRAMMER * pgm, const char * p)
|
||||
{
|
||||
char vccpins[64];
|
||||
char buffpins[64];
|
||||
|
||||
if (pgm->pinno[PPI_AVR_VCC]) {
|
||||
snprintf(vccpins, sizeof(vccpins), "%s",
|
||||
pins_to_str(pgm->pinno[PPI_AVR_VCC]));
|
||||
}
|
||||
else {
|
||||
strcpy(vccpins, " (not used)");
|
||||
}
|
||||
|
||||
if (pgm->pinno[PPI_AVR_BUFF]) {
|
||||
snprintf(buffpins, sizeof(buffpins), "%s",
|
||||
pins_to_str(pgm->pinno[PPI_AVR_BUFF]));
|
||||
}
|
||||
else {
|
||||
strcpy(buffpins, " (not used)");
|
||||
}
|
||||
|
||||
fprintf(stderr,
|
||||
"%s VCC = %s\n"
|
||||
"%s BUFF = %s\n"
|
||||
"%s RESET = %d\n"
|
||||
"%s SCK = %d\n"
|
||||
"%s MOSI = %d\n"
|
||||
"%s MISO = %d\n"
|
||||
"%s ERR LED = %d\n"
|
||||
"%s RDY LED = %d\n"
|
||||
"%s PGM LED = %d\n"
|
||||
"%s VFY LED = %d\n",
|
||||
|
||||
p, vccpins,
|
||||
p, buffpins,
|
||||
p, pgm->pinno[PIN_AVR_RESET],
|
||||
p, pgm->pinno[PIN_AVR_SCK],
|
||||
p, pgm->pinno[PIN_AVR_MOSI],
|
||||
p, pgm->pinno[PIN_AVR_MISO],
|
||||
p, pgm->pinno[PIN_LED_ERR],
|
||||
p, pgm->pinno[PIN_LED_RDY],
|
||||
p, pgm->pinno[PIN_LED_PGM],
|
||||
p, pgm->pinno[PIN_LED_VFY]);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* parse the -E string
|
||||
*/
|
||||
@@ -387,6 +340,12 @@ static int par_parseexitspecs(PROGRAMMER * pgm, char *s)
|
||||
else if (strcmp(cp, "novcc") == 0) {
|
||||
pgm->exit_vcc = EXIT_VCC_DISABLED;
|
||||
}
|
||||
else if (strcmp(cp, "d_high") == 0) {
|
||||
pgm->exit_datahigh = EXIT_DATAHIGH_ENABLED;
|
||||
}
|
||||
else if (strcmp(cp, "d_low") == 0) {
|
||||
pgm->exit_datahigh = EXIT_DATAHIGH_DISABLED;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
@@ -400,15 +359,18 @@ void par_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
strcpy(pgm->type, "PPI");
|
||||
|
||||
pgm_fill_old_pins(pgm); // TODO to be removed if old pin data no longer needed
|
||||
|
||||
pgm->exit_vcc = EXIT_VCC_UNSPEC;
|
||||
pgm->exit_reset = EXIT_RESET_UNSPEC;
|
||||
pgm->exit_datahigh = EXIT_DATAHIGH_UNSPEC;
|
||||
|
||||
pgm->rdy_led = bitbang_rdy_led;
|
||||
pgm->err_led = bitbang_err_led;
|
||||
pgm->pgm_led = bitbang_pgm_led;
|
||||
pgm->vfy_led = bitbang_vfy_led;
|
||||
pgm->initialize = bitbang_initialize;
|
||||
pgm->display = par_display;
|
||||
pgm->display = pgm_display_generic;
|
||||
pgm->enable = par_enable;
|
||||
pgm->disable = par_disable;
|
||||
pgm->powerup = par_powerup;
|
||||
@@ -416,6 +378,8 @@ void par_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->spi = bitbang_spi;
|
||||
pgm->open = par_open;
|
||||
pgm->close = par_close;
|
||||
pgm->setpin = par_setpin;
|
||||
@@ -436,3 +400,5 @@ void par_initpgm(PROGRAMMER * pgm)
|
||||
}
|
||||
|
||||
#endif /* HAVE_PARPORT */
|
||||
|
||||
const char par_desc[] = "Parallel port bitbanging";
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -26,6 +25,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const char par_desc[];
|
||||
void par_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
102
avrdude/pgm.c
102
avrdude/pgm.c
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2002-2004 Brian S. Dean <bsd@bsdhome.com>
|
||||
* Copyright 2007 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
|
||||
@@ -13,8 +14,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -81,9 +81,12 @@ PROGRAMMER * pgm_new(void)
|
||||
pgm->config_file[0] = 0;
|
||||
pgm->lineno = 0;
|
||||
pgm->baudrate = 0;
|
||||
pgm->initpgm = NULL;
|
||||
|
||||
for (i=0; i<N_PINS; i++)
|
||||
for (i=0; i<N_PINS; i++) {
|
||||
pgm->pinno[i] = 0;
|
||||
pin_clear_all(&(pgm->pin[i]));
|
||||
}
|
||||
|
||||
/*
|
||||
* mandatory functions - these are called without checking to see
|
||||
@@ -117,6 +120,8 @@ PROGRAMMER * pgm_new(void)
|
||||
* assigned before they are called
|
||||
*/
|
||||
pgm->cmd = NULL;
|
||||
pgm->cmd_tpi = NULL;
|
||||
pgm->spi = NULL;
|
||||
pgm->paged_write = NULL;
|
||||
pgm->paged_load = NULL;
|
||||
pgm->write_setup = NULL;
|
||||
@@ -125,6 +130,39 @@ PROGRAMMER * pgm_new(void)
|
||||
pgm->set_varef = NULL;
|
||||
pgm->set_fosc = NULL;
|
||||
pgm->perform_osccal = NULL;
|
||||
pgm->parseextparams = NULL;
|
||||
pgm->setup = NULL;
|
||||
pgm->teardown = NULL;
|
||||
|
||||
return pgm;
|
||||
}
|
||||
|
||||
void pgm_free(PROGRAMMER * const p)
|
||||
{
|
||||
ldestroy_cb(p->id,free);
|
||||
p->id = NULL;
|
||||
/* this is done by pgm_teardown, but usually cookie is not set to NULL */
|
||||
/* if (p->cookie !=NULL) {
|
||||
free(p->cookie);
|
||||
p->cookie = NULL;
|
||||
}*/
|
||||
free(p);
|
||||
}
|
||||
|
||||
PROGRAMMER * pgm_dup(const PROGRAMMER const * src)
|
||||
{
|
||||
PROGRAMMER * pgm;
|
||||
|
||||
pgm = (PROGRAMMER *)malloc(sizeof(*pgm));
|
||||
if (pgm == NULL) {
|
||||
fprintf(stderr, "%s: out of memory allocating programmer structure\n",
|
||||
progname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
memcpy(pgm, src, sizeof(*pgm));
|
||||
|
||||
pgm->id = lcreat(NULL, 0);
|
||||
|
||||
return pgm;
|
||||
}
|
||||
@@ -175,6 +213,36 @@ void programmer_display(PROGRAMMER * pgm, const char * p)
|
||||
pgm->display(pgm, p);
|
||||
}
|
||||
|
||||
|
||||
void pgm_display_generic_mask(PROGRAMMER * pgm, const char * p, unsigned int show)
|
||||
{
|
||||
if(show & (1<<PPI_AVR_VCC))
|
||||
fprintf(stderr, "%s VCC = %s\n", p, pins_to_str(&pgm->pin[PPI_AVR_VCC]));
|
||||
if(show & (1<<PPI_AVR_BUFF))
|
||||
fprintf(stderr, "%s BUFF = %s\n", p, pins_to_str(&pgm->pin[PPI_AVR_BUFF]));
|
||||
if(show & (1<<PIN_AVR_RESET))
|
||||
fprintf(stderr, "%s RESET = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_RESET]));
|
||||
if(show & (1<<PIN_AVR_SCK))
|
||||
fprintf(stderr, "%s SCK = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_SCK]));
|
||||
if(show & (1<<PIN_AVR_MOSI))
|
||||
fprintf(stderr, "%s MOSI = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_MOSI]));
|
||||
if(show & (1<<PIN_AVR_MISO))
|
||||
fprintf(stderr, "%s MISO = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_MISO]));
|
||||
if(show & (1<<PIN_LED_ERR))
|
||||
fprintf(stderr, "%s ERR LED = %s\n", p, pins_to_str(&pgm->pin[PIN_LED_ERR]));
|
||||
if(show & (1<<PIN_LED_RDY))
|
||||
fprintf(stderr, "%s RDY LED = %s\n", p, pins_to_str(&pgm->pin[PIN_LED_RDY]));
|
||||
if(show & (1<<PIN_LED_PGM))
|
||||
fprintf(stderr, "%s PGM LED = %s\n", p, pins_to_str(&pgm->pin[PIN_LED_PGM]));
|
||||
if(show & (1<<PIN_LED_VFY))
|
||||
fprintf(stderr, "%s VFY LED = %s\n", p, pins_to_str(&pgm->pin[PIN_LED_VFY]));
|
||||
}
|
||||
|
||||
void pgm_display_generic(PROGRAMMER * pgm, const char * p)
|
||||
{
|
||||
pgm_display_generic_mask(pgm, p, SHOW_ALL_PINS);
|
||||
}
|
||||
|
||||
PROGRAMMER * locate_programmer(LISTID programmers, const char * configid)
|
||||
{
|
||||
LNODEID ln1, ln2;
|
||||
@@ -212,11 +280,37 @@ PROGRAMMER * locate_programmer(LISTID programmers, const char * configid)
|
||||
void walk_programmers(LISTID programmers, walk_programmers_cb cb, void *cookie)
|
||||
{
|
||||
LNODEID ln1;
|
||||
LNODEID ln2;
|
||||
PROGRAMMER * p;
|
||||
|
||||
for (ln1 = lfirst(programmers); ln1; ln1 = lnext(ln1)) {
|
||||
p = ldata(ln1);
|
||||
cb((char *)ldata(lfirst(p->id)), p->desc, p->config_file, p->lineno, cookie);
|
||||
for (ln2=lfirst(p->id); ln2; ln2=lnext(ln2)) {
|
||||
cb(ldata(ln2), p->desc, p->config_file, p->lineno, cookie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare function to sort the list of programmers
|
||||
*/
|
||||
static int sort_programmer_compare(PROGRAMMER * p1,PROGRAMMER * p2)
|
||||
{
|
||||
char* id1;
|
||||
char* id2;
|
||||
if(p1 == NULL || p2 == NULL) {
|
||||
return 0;
|
||||
}
|
||||
id1 = ldata(lfirst(p1->id));
|
||||
id2 = ldata(lfirst(p2->id));
|
||||
return strncasecmp(id1,id2,AVR_IDLEN);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sort the list of programmers given as "programmers"
|
||||
*/
|
||||
void sort_programmers(LISTID programmers)
|
||||
{
|
||||
lsort(programmers,(int (*)(void*, void*)) sort_programmer_compare);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2002-2004 Brian S. Dean <bsd@bsdhome.com>
|
||||
* Copyright 2007 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
|
||||
@@ -13,8 +14,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -35,6 +35,7 @@
|
||||
#define PGM_DESCLEN 80
|
||||
#define PGM_PORTLEN PATH_MAX
|
||||
#define PGM_TYPELEN 32
|
||||
#define PGM_USBSTRINGLEN 256
|
||||
|
||||
typedef enum {
|
||||
EXIT_VCC_UNSPEC,
|
||||
@@ -48,17 +49,36 @@ typedef enum {
|
||||
EXIT_RESET_DISABLED
|
||||
} exit_reset_t;
|
||||
|
||||
typedef enum {
|
||||
EXIT_DATAHIGH_UNSPEC,
|
||||
EXIT_DATAHIGH_ENABLED,
|
||||
EXIT_DATAHIGH_DISABLED
|
||||
} exit_datahigh_t;
|
||||
|
||||
typedef enum {
|
||||
CONNTYPE_PARALLEL,
|
||||
CONNTYPE_SERIAL,
|
||||
CONNTYPE_USB
|
||||
} conntype_t;
|
||||
|
||||
typedef struct programmer_t {
|
||||
LISTID id;
|
||||
char desc[PGM_DESCLEN];
|
||||
char type[PGM_TYPELEN];
|
||||
char port[PGM_PORTLEN];
|
||||
void (*initpgm)(struct programmer_t * pgm);
|
||||
unsigned int pinno[N_PINS];
|
||||
struct pindef_t pin[N_PINS];
|
||||
exit_vcc_t exit_vcc;
|
||||
exit_reset_t exit_reset;
|
||||
exit_datahigh_t exit_datahigh;
|
||||
conntype_t conntype;
|
||||
int ppidata;
|
||||
int ppictrl;
|
||||
int baudrate;
|
||||
int usbvid, usbpid;
|
||||
char usbdev[PGM_USBSTRINGLEN], usbsn[PGM_USBSTRINGLEN];
|
||||
char usbvendor[PGM_USBSTRINGLEN], usbproduct[PGM_USBSTRINGLEN];
|
||||
double bitclock; /* JTAG ICE clock period in microseconds */
|
||||
int ispdelay; /* ISP clock delay */
|
||||
union filedescriptor fd;
|
||||
@@ -75,14 +95,22 @@ 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 (*cmd) (struct programmer_t * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4]);
|
||||
int (*cmd) (struct programmer_t * pgm, const unsigned char *cmd,
|
||||
unsigned char *res);
|
||||
int (*cmd_tpi) (struct programmer_t * pgm, const unsigned char *cmd,
|
||||
int cmd_len, unsigned char res[], int res_len);
|
||||
int (*spi) (struct programmer_t * pgm, const unsigned char *cmd,
|
||||
unsigned char *res, int count);
|
||||
int (*open) (struct programmer_t * pgm, char * port);
|
||||
void (*close) (struct programmer_t * pgm);
|
||||
int (*paged_write) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m,
|
||||
int page_size, int n_bytes);
|
||||
unsigned int page_size, unsigned int baseaddr,
|
||||
unsigned int n_bytes);
|
||||
int (*paged_load) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m,
|
||||
int page_size, int n_bytes);
|
||||
unsigned int page_size, unsigned int baseaddr,
|
||||
unsigned int n_bytes);
|
||||
int (*page_erase) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m,
|
||||
unsigned int baseaddr);
|
||||
void (*write_setup) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m);
|
||||
int (*write_byte) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m,
|
||||
unsigned long addr, unsigned char value);
|
||||
@@ -91,7 +119,7 @@ typedef struct programmer_t {
|
||||
int (*read_sig_bytes) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m);
|
||||
void (*print_parms) (struct programmer_t * pgm);
|
||||
int (*set_vtarget) (struct programmer_t * pgm, double v);
|
||||
int (*set_varef) (struct programmer_t * pgm, double v);
|
||||
int (*set_varef) (struct programmer_t * pgm, unsigned int chan, double v);
|
||||
int (*set_fosc) (struct programmer_t * pgm, double v);
|
||||
int (*set_sck_period) (struct programmer_t * pgm, double v);
|
||||
int (*setpin) (struct programmer_t * pgm, int pin, int value);
|
||||
@@ -99,8 +127,12 @@ typedef struct programmer_t {
|
||||
int (*highpulsepin) (struct programmer_t * pgm, int pin);
|
||||
int (*parseexitspecs) (struct programmer_t * pgm, char *s);
|
||||
int (*perform_osccal) (struct programmer_t * pgm);
|
||||
int (*parseextparams) (struct programmer_t * pgm, LISTID xparams);
|
||||
void (*setup) (struct programmer_t * pgm);
|
||||
void (*teardown) (struct programmer_t * pgm);
|
||||
char config_file[PATH_MAX]; /* config file where defined */
|
||||
int lineno; /* config file line number */
|
||||
void *cookie; /* for private use by the programmer */
|
||||
char flag; /* for private use of the programmer */
|
||||
} PROGRAMMER;
|
||||
|
||||
@@ -109,8 +141,19 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
PROGRAMMER * pgm_new(void);
|
||||
PROGRAMMER * pgm_dup(const PROGRAMMER const * src);
|
||||
void pgm_free(PROGRAMMER * const p);
|
||||
|
||||
void programmer_display(PROGRAMMER * pgm, const char * p);
|
||||
|
||||
/* show is a mask like this (1<<PIN_AVR_SCK)|(1<<PIN_AVR_MOSI)| ... */
|
||||
#define SHOW_ALL_PINS (~0u)
|
||||
#define SHOW_PPI_PINS ((1<<PPI_AVR_VCC)|(1<<PPI_AVR_BUFF))
|
||||
#define SHOW_AVR_PINS ((1<<PIN_AVR_RESET)|(1<<PIN_AVR_SCK)|(1<<PIN_AVR_MOSI)|(1<<PIN_AVR_MISO))
|
||||
#define SHOW_LED_PINS ((1<<PIN_LED_ERR)|(1<<PIN_LED_RDY)|(1<<PIN_LED_PGM)|(1<<PIN_LED_VFY))
|
||||
void pgm_display_generic_mask(PROGRAMMER * pgm, const char * p, unsigned int show);
|
||||
void pgm_display_generic(PROGRAMMER * pgm, const char * p);
|
||||
|
||||
PROGRAMMER * locate_programmer(LISTID programmers, const char * configid);
|
||||
|
||||
typedef void (*walk_programmers_cb)(const char *name, const char *desc,
|
||||
@@ -118,6 +161,8 @@ typedef void (*walk_programmers_cb)(const char *name, const char *desc,
|
||||
void *cookie);
|
||||
void walk_programmers(LISTID programmers, walk_programmers_cb cb, void *cookie);
|
||||
|
||||
void sort_programmers(LISTID programmers);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
150
avrdude/pgm_type.c
Normal file
150
avrdude/pgm_type.c
Normal file
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2002-2004 Brian S. Dean <bsd@bsdhome.com>
|
||||
* Copyright 2007 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
|
||||
* 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: pgm.c 976 2011-08-23 21:03:36Z joerg_wunsch $ */
|
||||
|
||||
#include "ac_cfg.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "pgm_type.h"
|
||||
|
||||
#include "arduino.h"
|
||||
#include "avr.h"
|
||||
#include "avr910.h"
|
||||
#include "avrftdi.h"
|
||||
#include "buspirate.h"
|
||||
#include "butterfly.h"
|
||||
#include "ft245r.h"
|
||||
#include "jtagmkI.h"
|
||||
#include "jtagmkII.h"
|
||||
#include "jtag3.h"
|
||||
#include "linuxgpio.h"
|
||||
#include "par.h"
|
||||
#include "pickit2.h"
|
||||
#include "ppi.h"
|
||||
#include "serbb.h"
|
||||
#include "stk500.h"
|
||||
#include "stk500generic.h"
|
||||
#include "stk500v2.h"
|
||||
#include "usbasp.h"
|
||||
#include "usbtiny.h"
|
||||
#include "wiring.h"
|
||||
|
||||
|
||||
const PROGRAMMER_TYPE const programmers_types[] = {
|
||||
{"arduino", arduino_initpgm, arduino_desc},
|
||||
{"avr910", avr910_initpgm, avr910_desc},
|
||||
{"avrftdi", avrftdi_initpgm, avrftdi_desc},
|
||||
{"buspirate", buspirate_initpgm, buspirate_desc},
|
||||
{"buspirate_bb", buspirate_bb_initpgm, buspirate_bb_desc},
|
||||
{"butterfly", butterfly_initpgm, butterfly_desc},
|
||||
{"butterfly_mk", butterfly_mk_initpgm, butterfly_mk_desc},
|
||||
{"dragon_dw", jtagmkII_dragon_dw_initpgm, jtagmkII_dragon_dw_desc},
|
||||
{"dragon_hvsp", stk500v2_dragon_hvsp_initpgm, stk500v2_dragon_hvsp_desc},
|
||||
{"dragon_isp", stk500v2_dragon_isp_initpgm, stk500v2_dragon_isp_desc},
|
||||
{"dragon_jtag", jtagmkII_dragon_initpgm, jtagmkII_dragon_desc},
|
||||
{"dragon_pdi", jtagmkII_dragon_pdi_initpgm, jtagmkII_dragon_pdi_desc},
|
||||
{"dragon_pp", stk500v2_dragon_pp_initpgm, stk500v2_dragon_pp_desc},
|
||||
{"ftdi_syncbb", ft245r_initpgm, ft245r_desc},
|
||||
{"jtagmki", jtagmkI_initpgm, jtagmkI_desc},
|
||||
{"jtagmkii", jtagmkII_initpgm, jtagmkII_desc},
|
||||
{"jtagmkii_avr32", jtagmkII_avr32_initpgm, jtagmkII_avr32_desc},
|
||||
{"jtagmkii_dw", jtagmkII_dw_initpgm, jtagmkII_dw_desc},
|
||||
{"jtagmkii_isp", stk500v2_jtagmkII_initpgm, stk500v2_jtagmkII_desc},
|
||||
{"jtagmkii_pdi", jtagmkII_pdi_initpgm, jtagmkII_pdi_desc},
|
||||
{"jtagice3", jtag3_initpgm, jtag3_desc},
|
||||
{"jtagice3_pdi", jtag3_pdi_initpgm, jtag3_pdi_desc},
|
||||
{"jtagice3_dw", jtag3_dw_initpgm, jtag3_dw_desc},
|
||||
{"jtagice3_isp", stk500v2_jtag3_initpgm, stk500v2_jtag3_desc},
|
||||
{"linuxgpio", linuxgpio_initpgm, linuxgpio_desc},
|
||||
{"par", par_initpgm, par_desc},
|
||||
{"pickit2", pickit2_initpgm, pickit2_desc},
|
||||
{"serbb", serbb_initpgm, serbb_desc},
|
||||
{"stk500", stk500_initpgm, stk500_desc},
|
||||
{"stk500generic", stk500generic_initpgm, stk500generic_desc},
|
||||
{"stk500v2", stk500v2_initpgm, stk500v2_desc},
|
||||
{"stk500hvsp", stk500hvsp_initpgm, stk500hvsp_desc},
|
||||
{"stk500pp", stk500pp_initpgm, stk500pp_desc},
|
||||
{"stk600", stk600_initpgm, stk600_desc},
|
||||
{"stk600hvsp", stk600hvsp_initpgm, stk600hvsp_desc},
|
||||
{"stk600pp", stk600pp_initpgm, stk600pp_desc},
|
||||
{"usbasp", usbasp_initpgm, usbasp_desc},
|
||||
{"usbtiny", usbtiny_initpgm, usbtiny_desc},
|
||||
{"wiring", wiring_initpgm, wiring_desc},
|
||||
};
|
||||
|
||||
const PROGRAMMER_TYPE * locate_programmer_type(const char * id)
|
||||
{
|
||||
const PROGRAMMER_TYPE * p = NULL;
|
||||
int i;
|
||||
int found;
|
||||
|
||||
found = 0;
|
||||
|
||||
for (i = 0; i < sizeof(programmers_types)/sizeof(programmers_types[0]) && !found; i++) {
|
||||
p = &(programmers_types[i]);
|
||||
if (strcasecmp(id, p->id) == 0)
|
||||
found = 1;
|
||||
}
|
||||
|
||||
if (found)
|
||||
return p;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Iterate over the list of programmers given as "programmers", and
|
||||
* call the callback function cb for each entry found. cb is being
|
||||
* passed the following arguments:
|
||||
* . the name of the programmer (for -c)
|
||||
* . the descriptive text given in the config file
|
||||
* . the name of the config file this programmer has been defined in
|
||||
* . the line number of the config file this programmer has been defined at
|
||||
* . the "cookie" passed into walk_programmers() (opaque client data)
|
||||
*/
|
||||
/*
|
||||
void walk_programmer_types(LISTID programmer_types, walk_programmer_types_cb cb, void *cookie)
|
||||
{
|
||||
LNODEID ln1;
|
||||
PROGRAMMER * p;
|
||||
|
||||
for (ln1 = lfirst(programmers); ln1; ln1 = lnext(ln1)) {
|
||||
p = ldata(ln1);
|
||||
cb(p->id, p->desc, cookie);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
void walk_programmer_types(walk_programmer_types_cb cb, void *cookie)
|
||||
{
|
||||
const PROGRAMMER_TYPE * p;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof(programmers_types)/sizeof(programmers_types[0]); i++) {
|
||||
p = &(programmers_types[i]);
|
||||
cb(p->id, p->desc, cookie);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
50
avrdude/pgm_type.h
Normal file
50
avrdude/pgm_type.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2002-2004 Brian S. Dean <bsd@bsdhome.com>
|
||||
* Copyright 2007 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
|
||||
* 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: pgm.h 1007 2011-09-14 21:49:42Z joerg_wunsch $ */
|
||||
|
||||
#ifndef pgm_type_h
|
||||
#define pgm_type_h
|
||||
|
||||
#include "lists.h"
|
||||
#include "pgm.h"
|
||||
|
||||
/*LISTID programmer_types;*/
|
||||
|
||||
typedef struct programmer_type_t {
|
||||
const char * const id;
|
||||
void (*initpgm)(struct programmer_t * pgm);
|
||||
const char * const desc;
|
||||
} PROGRAMMER_TYPE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
const PROGRAMMER_TYPE * locate_programmer_type(/*LISTID programmer_types, */const char * id);
|
||||
|
||||
typedef void (*walk_programmer_types_cb)(const char *id, const char *desc,
|
||||
void *cookie);
|
||||
void walk_programmer_types(/*LISTID programmer_types,*/ walk_programmer_types_cb cb, void *cookie);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
1362
avrdude/pickit2.c
Normal file
1362
avrdude/pickit2.c
Normal file
File diff suppressed because it is too large
Load Diff
37
avrdude/pickit2.h
Normal file
37
avrdude/pickit2.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2006 Thomas Fischl
|
||||
*
|
||||
* 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: pickit2.h 2010-05-03 dbrown $ */
|
||||
|
||||
#ifndef pickit2_h
|
||||
#define pickit2_h
|
||||
|
||||
#include "avrpart.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const char pickit2_desc[];
|
||||
void pickit2_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // pickit2_h
|
||||
365
avrdude/pindefs.c
Normal file
365
avrdude/pindefs.c
Normal file
@@ -0,0 +1,365 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2000-2004 Brian S. Dean <bsd@bsdhome.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/>.
|
||||
*/
|
||||
|
||||
/* $Id: pindefs.h 1132 2013-01-09 19:23:30Z rliebscher $ */
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "avrdude.h"
|
||||
#include "pindefs.h"
|
||||
#include "pgm.h"
|
||||
|
||||
/**
|
||||
* Adds a pin in the pin definition as normal or inverse pin.
|
||||
*
|
||||
* @param[out] pindef pin definition to update
|
||||
* @param[in] pin number of pin [0..PIN_MAX]
|
||||
* @param[in] inverse inverse (true) or normal (false) pin
|
||||
*/
|
||||
void pin_set_value(struct pindef_t * const pindef, const int pin, const bool inverse) {
|
||||
|
||||
pindef->mask[pin / PIN_FIELD_ELEMENT_SIZE] |= 1 << (pin % PIN_FIELD_ELEMENT_SIZE);
|
||||
if(inverse) {
|
||||
pindef->inverse[pin / PIN_FIELD_ELEMENT_SIZE] |= (1 << (pin % PIN_FIELD_ELEMENT_SIZE));
|
||||
} else {
|
||||
pindef->inverse[pin / PIN_FIELD_ELEMENT_SIZE] &= ~(1 << (pin % PIN_FIELD_ELEMENT_SIZE));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all defined pins in pindef.
|
||||
*
|
||||
* @param[out] pindef pin definition to clear
|
||||
*/
|
||||
void pin_clear_all(struct pindef_t * const pindef) {
|
||||
memset(pindef, 0, sizeof(struct pindef_t));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert new pin definition to old pin number
|
||||
*
|
||||
* @param[in] pindef new pin definition structure
|
||||
* @param[out] pinno old pin definition integer
|
||||
*/
|
||||
static void pin_fill_old_pinno(const struct pindef_t * const pindef, unsigned int * const pinno) {
|
||||
bool found = false;
|
||||
int i;
|
||||
for(i = 0; i < PIN_MAX; i++) {
|
||||
if(pindef->mask[i / PIN_FIELD_ELEMENT_SIZE] & (1 << (i % PIN_FIELD_ELEMENT_SIZE))) {
|
||||
if(found) {
|
||||
fprintf(stderr, "Multiple pins found\n"); //TODO
|
||||
exit(1);
|
||||
}
|
||||
found = true;
|
||||
*pinno = i;
|
||||
if(pindef->inverse[i / PIN_FIELD_ELEMENT_SIZE] & (1 << (i % PIN_FIELD_ELEMENT_SIZE))) {
|
||||
*pinno |= PIN_INVERSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert new pin definition to old pinlist, does not support mixed inverted/non-inverted pin
|
||||
*
|
||||
* @param[in] pindef new pin definition structure
|
||||
* @param[out] pinno old pin definition integer
|
||||
*/
|
||||
static void pin_fill_old_pinlist(const struct pindef_t * const pindef, unsigned int * const pinno) {
|
||||
int i;
|
||||
|
||||
for(i = 0; i < PIN_FIELD_SIZE; i++) {
|
||||
if(i == 0) {
|
||||
if((pindef->mask[i] & ~PIN_MASK) != 0) {
|
||||
fprintf(stderr, "Pins of higher index than max field size for old pinno found\n");
|
||||
exit(1);
|
||||
}
|
||||
if(pindef->mask[i] == pindef->inverse[i]) { /* all set bits in mask are set in inverse */
|
||||
*pinno = pindef->mask[i];
|
||||
*pinno |= PIN_INVERSE;
|
||||
} else if(pindef->mask[i] == ((~pindef->inverse[i]) & pindef->mask[i])) { /* all set bits in mask are cleared in inverse */
|
||||
*pinno = pindef->mask[i];
|
||||
} else {
|
||||
fprintf(stderr, "pins have different polarity set\n");
|
||||
exit(1);
|
||||
}
|
||||
} else if(pindef->mask[i] != 0) {
|
||||
fprintf(stderr, "Pins have higher number than fit in old format\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert for given programmer new pin definitions to old pin definitions.
|
||||
*
|
||||
* @param[inout] pgm programmer whose pins shall be converted.
|
||||
*/
|
||||
void pgm_fill_old_pins(struct programmer_t * const pgm) {
|
||||
|
||||
pin_fill_old_pinlist(&(pgm->pin[PPI_AVR_VCC]), &(pgm->pinno[PPI_AVR_VCC]));
|
||||
pin_fill_old_pinlist(&(pgm->pin[PPI_AVR_BUFF]), &(pgm->pinno[PPI_AVR_BUFF]));
|
||||
pin_fill_old_pinno(&(pgm->pin[PIN_AVR_RESET]), &(pgm->pinno[PIN_AVR_RESET]));
|
||||
pin_fill_old_pinno(&(pgm->pin[PIN_AVR_SCK]), &(pgm->pinno[PIN_AVR_SCK]));
|
||||
pin_fill_old_pinno(&(pgm->pin[PIN_AVR_MOSI]), &(pgm->pinno[PIN_AVR_MOSI]));
|
||||
pin_fill_old_pinno(&(pgm->pin[PIN_AVR_MISO]), &(pgm->pinno[PIN_AVR_MISO]));
|
||||
pin_fill_old_pinno(&(pgm->pin[PIN_LED_ERR]), &(pgm->pinno[PIN_LED_ERR]));
|
||||
pin_fill_old_pinno(&(pgm->pin[PIN_LED_RDY]), &(pgm->pinno[PIN_LED_RDY]));
|
||||
pin_fill_old_pinno(&(pgm->pin[PIN_LED_PGM]), &(pgm->pinno[PIN_LED_PGM]));
|
||||
pin_fill_old_pinno(&(pgm->pin[PIN_LED_VFY]), &(pgm->pinno[PIN_LED_VFY]));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This function returns a string representation of pins in the mask eg. 1,3,5-7,9,12
|
||||
* Another execution of this function will overwrite the previous result in the static buffer.
|
||||
* Consecutive pin number are representated as start-end.
|
||||
*
|
||||
* @param[in] pinmask the pin mask for which we want the string representation
|
||||
* @returns pointer to a static string.
|
||||
*/
|
||||
const char * pinmask_to_str(const pinmask_t * const pinmask) {
|
||||
static char buf[(PIN_MAX + 1) * 5]; // should be enough for PIN_MAX=255
|
||||
char *p = buf;
|
||||
int n;
|
||||
int pin;
|
||||
const char * fmt;
|
||||
int start = -1;
|
||||
int end = -1;
|
||||
|
||||
buf[0] = 0;
|
||||
for(pin = PIN_MIN; pin <= PIN_MAX; pin++) {
|
||||
int index = pin / PIN_FIELD_ELEMENT_SIZE;
|
||||
int bit = pin % PIN_FIELD_ELEMENT_SIZE;
|
||||
if(pinmask[index] & (1 << bit)) {
|
||||
bool output = false;
|
||||
if(start == -1) {
|
||||
output = true;
|
||||
start = pin;
|
||||
end = start;
|
||||
} else if(pin == end + 1) {
|
||||
end = pin;
|
||||
} else {
|
||||
if(start != end) {
|
||||
n = sprintf(p, "-%d", end);
|
||||
p += n;
|
||||
}
|
||||
output = true;
|
||||
start = pin;
|
||||
end = start;
|
||||
}
|
||||
if(output) {
|
||||
fmt = (buf[0] == 0) ? "%d" : ",%d";
|
||||
n = sprintf(p, fmt, pin);
|
||||
p += n;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(start != end) {
|
||||
n = sprintf(p, "-%d", end);
|
||||
p += n;
|
||||
}
|
||||
|
||||
if(buf[0] == 0)
|
||||
return "(no pins)";
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function checks all pin of pgm against the constraints given in the checklist.
|
||||
* It checks if
|
||||
* @li any invalid pins are used
|
||||
* @li valid pins are used inverted when not allowed
|
||||
* @li any pins are used by more than one function
|
||||
* @li any mandatory pin is not set all.
|
||||
*
|
||||
* In case of any error it report the wrong function and the pin numbers.
|
||||
* For verbose >= 2 it also reports the possible correct values.
|
||||
* For verbose >=3 it shows also which pins were ok.
|
||||
*
|
||||
* @param[in] pgm the programmer to check
|
||||
* @param[in] checklist the constraint for the pins
|
||||
* @param[in] size the number of entries in checklist
|
||||
* @returns 0 if all pin definitions are valid, -1 otherwise
|
||||
*/
|
||||
int pins_check(const struct programmer_t * const pgm, const struct pin_checklist_t * const checklist, const int size, bool output) {
|
||||
static const struct pindef_t no_valid_pins = {{0}, {0}}; // default value if check list does not contain anything else
|
||||
int rv = 0; // return value
|
||||
int pinname; // loop counter through pinnames
|
||||
pinmask_t already_used_all[PIN_FIELD_SIZE] = {0}; // collect pin definitions of all pin names for check of double use
|
||||
// loop over all possible pinnames
|
||||
for(pinname = 0; pinname < N_PINS; pinname++) {
|
||||
bool used = false;
|
||||
bool invalid = false;
|
||||
bool inverse = false;
|
||||
int index;
|
||||
int segment;
|
||||
bool mandatory_used = false;
|
||||
pinmask_t invalid_used[PIN_FIELD_SIZE] = {0};
|
||||
pinmask_t inverse_used[PIN_FIELD_SIZE] = {0};
|
||||
pinmask_t already_used[PIN_FIELD_SIZE] = {0};
|
||||
const struct pindef_t * valid_pins = &no_valid_pins;
|
||||
bool is_mandatory = false;
|
||||
bool is_ok = true;
|
||||
//find corresponding check pattern
|
||||
for(index = 0; index < size; index++) {
|
||||
if(checklist[index].pinname == pinname) {
|
||||
valid_pins = checklist[index].valid_pins;
|
||||
is_mandatory = checklist[index].mandatory;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for(segment = 0; segment < PIN_FIELD_SIZE; segment++) {
|
||||
// check if for mandatory any pin is defined
|
||||
invalid_used[segment] = pgm->pin[pinname].mask[segment] & ~valid_pins->mask[segment];
|
||||
if(is_mandatory && (0 != (pgm->pin[pinname].mask[segment] & valid_pins->mask[segment]))) {
|
||||
mandatory_used = true;
|
||||
}
|
||||
// check if it does not use any non valid pins
|
||||
invalid_used[segment] = pgm->pin[pinname].mask[segment] & ~valid_pins->mask[segment];
|
||||
if(invalid_used[segment]) {
|
||||
invalid = true;
|
||||
}
|
||||
// check if it does not use any valid pins as inverse if not allowed
|
||||
inverse_used[segment] = pgm->pin[pinname].inverse[segment] & valid_pins->mask[segment] & ~valid_pins->inverse[segment];
|
||||
if(inverse_used[segment]) {
|
||||
inverse = true;
|
||||
}
|
||||
// check if it does not use same pins as other function
|
||||
already_used[segment] = pgm->pin[pinname].mask[segment] & already_used_all[segment];
|
||||
if(already_used[segment]) {
|
||||
used = true;
|
||||
}
|
||||
already_used_all[segment] |= pgm->pin[pinname].mask[segment];
|
||||
}
|
||||
if(invalid) {
|
||||
if(output) {
|
||||
fprintf(stderr,
|
||||
"%s: %s: Following pins are not valid pins for this function: %s\n",
|
||||
progname, avr_pin_name(pinname), pinmask_to_str(invalid_used));
|
||||
if(verbose >= 2) {
|
||||
fprintf(stderr,
|
||||
"%s: %s: Valid pins for this function are: %s\n",
|
||||
progname, avr_pin_name(pinname), pinmask_to_str(valid_pins->mask));
|
||||
}
|
||||
}
|
||||
is_ok = false;
|
||||
}
|
||||
if(inverse) {
|
||||
if(output) {
|
||||
fprintf(stderr,
|
||||
"%s: %s: Following pins are not usable as inverse pins for this function: %s\n",
|
||||
progname, avr_pin_name(pinname), pinmask_to_str(inverse_used));
|
||||
if(verbose >= 2) {
|
||||
fprintf(stderr,
|
||||
"%s: %s: Valid inverse pins for this function are: %s\n",
|
||||
progname, avr_pin_name(pinname), pinmask_to_str(valid_pins->inverse));
|
||||
}
|
||||
}
|
||||
is_ok = false;
|
||||
}
|
||||
if(used) {
|
||||
if(output) {
|
||||
fprintf(stderr,
|
||||
"%s: %s: Following pins are set for other functions too: %s\n",
|
||||
progname, avr_pin_name(pinname), pinmask_to_str(already_used));
|
||||
is_ok = false;
|
||||
}
|
||||
}
|
||||
if(!mandatory_used && is_mandatory && !invalid) {
|
||||
if(output) {
|
||||
fprintf(stderr,
|
||||
"%s: %s: Mandatory pin is not defined.\n",
|
||||
progname, avr_pin_name(pinname));
|
||||
}
|
||||
is_ok = false;
|
||||
}
|
||||
if(!is_ok) {
|
||||
rv = -1;
|
||||
} else if(output && verbose >= 3) {
|
||||
fprintf(stderr,
|
||||
"%s: %s: Pin is ok.\n",
|
||||
progname, avr_pin_name(pinname));
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function returns a string representation of defined pins eg. ~1,2,~4,~5,7
|
||||
* Another execution of this function will overwrite the previous result in the static buffer.
|
||||
*
|
||||
* @param[in] pindef the pin definition for which we want the string representation
|
||||
* @returns pointer to a static string.
|
||||
*/
|
||||
const char * pins_to_str(const struct pindef_t * const pindef) {
|
||||
static char buf[(PIN_MAX + 1) * 5]; // should be enough for PIN_MAX=255
|
||||
char *p = buf;
|
||||
int n;
|
||||
int pin;
|
||||
const char * fmt;
|
||||
|
||||
buf[0] = 0;
|
||||
for(pin = PIN_MIN; pin <= PIN_MAX; pin++) {
|
||||
int index = pin / PIN_FIELD_ELEMENT_SIZE;
|
||||
int bit = pin % PIN_FIELD_ELEMENT_SIZE;
|
||||
if(pindef->mask[index] & (1 << bit)) {
|
||||
if(pindef->inverse[index] & (1 << bit)) {
|
||||
fmt = (buf[0] == 0) ? "~%d" : ",~%d";
|
||||
} else {
|
||||
fmt = (buf[0] == 0) ? " %d" : ",%d";
|
||||
}
|
||||
n = sprintf(p, fmt, pin);
|
||||
p += n;
|
||||
}
|
||||
}
|
||||
|
||||
if(buf[0] == 0)
|
||||
return " (not used)";
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the pin as string.
|
||||
*
|
||||
* @param pinname the pinname which we want as string.
|
||||
* @returns a string with the pinname, or <unknown> if pinname is invalid.
|
||||
*/
|
||||
const char * avr_pin_name(int pinname) {
|
||||
switch(pinname) {
|
||||
case PPI_AVR_VCC : return "VCC";
|
||||
case PPI_AVR_BUFF : return "BUFF";
|
||||
case PIN_AVR_RESET : return "RESET";
|
||||
case PIN_AVR_SCK : return "SCK";
|
||||
case PIN_AVR_MOSI : return "MOSI";
|
||||
case PIN_AVR_MISO : return "MISO";
|
||||
case PIN_LED_ERR : return "ERRLED";
|
||||
case PIN_LED_RDY : return "RDYLED";
|
||||
case PIN_LED_PGM : return "PGMLED";
|
||||
case PIN_LED_VFY : return "VFYLED";
|
||||
default : return "<unknown>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -22,8 +21,27 @@
|
||||
#ifndef __pindefs_h__
|
||||
#define __pindefs_h__
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include "ac_cfg.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
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
enum {
|
||||
PPI_AVR_VCC=1,
|
||||
PPI_AVR_VCC = 1,
|
||||
PPI_AVR_BUFF,
|
||||
PIN_AVR_RESET,
|
||||
PIN_AVR_SCK,
|
||||
@@ -35,10 +53,150 @@ enum {
|
||||
PIN_LED_VFY,
|
||||
N_PINS
|
||||
};
|
||||
#define PIN_INVERSE 0x80 /* flag for inverted pin in serbb */
|
||||
#define PIN_MASK 0x7f
|
||||
|
||||
#define LED_ON(fd,pin) ppi_setpin(fd,pin,0)
|
||||
#define LED_OFF(fd,pin) ppi_setpin(fd,pin,1)
|
||||
#define PIN_MASK (UINT_MAX>>1)
|
||||
#define PIN_INVERSE (~(PIN_MASK)) /* flag for inverted pin in serbb */
|
||||
#define PIN_MIN 0 /* smallest allowed pin number */
|
||||
#define PIN_MAX 31 /* largest allowed pin number */
|
||||
|
||||
#ifdef HAVE_LINUX_GPIO
|
||||
/* Embedded systems might have a lot more gpio than only 0-31 */
|
||||
#undef PIN_MAX
|
||||
#define PIN_MAX 255 /* largest allowed pin number */
|
||||
#endif
|
||||
|
||||
/** Number of pins in each element of the bitfield */
|
||||
#define PIN_FIELD_ELEMENT_SIZE (sizeof(pinmask_t) * 8)
|
||||
/** Numer of elements to store the complete bitfield of all pins */
|
||||
#define PIN_FIELD_SIZE ((PIN_MAX + PIN_FIELD_ELEMENT_SIZE)/PIN_FIELD_ELEMENT_SIZE)
|
||||
|
||||
/**
|
||||
* This sets the corresponding bits to 1 or 0, the inverse mask is used to invert the value in necessary.
|
||||
* It uses only the lowest element (index=0) of the bitfield, which should be enough for most
|
||||
* programmers.
|
||||
*
|
||||
* @param[in] x input value
|
||||
* @param[in] pgm the programmer whose pin definitions to use
|
||||
* @param[in] pinname the logical name of the pin (PIN_AVR_*, ...)
|
||||
* @param[in] level the logical level (level != 0 => 1, level == 0 => 0),
|
||||
* if the pin is defined as inverted the resulting bit is also inverted
|
||||
* @returns the input value with the relevant bits modified
|
||||
*/
|
||||
#define SET_BITS_0(x,pgm,pinname,level) (((x) & ~(pgm)->pin[pinname].mask[0]) \
|
||||
| (\
|
||||
(pgm)->pin[pinname].mask[0] & ( \
|
||||
(level) \
|
||||
?~((pgm)->pin[pinname].inverse[0]) \
|
||||
: ((pgm)->pin[pinname].inverse[0]) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
/**
|
||||
* Check if the corresponding bit is set (returns != 0) or cleared.
|
||||
* The inverse mask is used, to invert the relevant bits.
|
||||
* If the pin definition contains multiple pins, then a single set pin leads to return value != 0.
|
||||
* Then you have to check the relevant bits of the returned value, if you need more information.
|
||||
* It uses only the lowest element (index=0) of the bitfield, which should be enough for most
|
||||
* programmers.
|
||||
*
|
||||
* @param[in] x input value
|
||||
* @param[in] pgm the programmer whose pin definitions to use
|
||||
* @param[in] pinname the logical name of the pin (PIN_AVR_*, ...)
|
||||
* @returns the input value with only the relevant bits (which are already inverted,
|
||||
* so you get always the logical level)
|
||||
*/
|
||||
#define GET_BITS_0(x,pgm,pinname) (((x) ^ (pgm)->pin[pinname].inverse[0]) & (pgm)->pin[pinname].mask[0])
|
||||
|
||||
/**
|
||||
* Data structure to hold used pins by logical function (PIN_AVR_*, ...)
|
||||
*/
|
||||
struct pindef_t {
|
||||
pinmask_t mask[PIN_FIELD_SIZE]; ///< bitfield of used pins
|
||||
pinmask_t inverse[PIN_FIELD_SIZE]; ///< bitfield of inverse/normal usage of used pins
|
||||
};
|
||||
|
||||
/**
|
||||
* Data structure to define a checklist of valid pins for each function.
|
||||
*/
|
||||
struct pin_checklist_t {
|
||||
int pinname; ///< logical pinname eg. PIN_AVR_SCK
|
||||
int mandatory; ///< is this a mandatory pin
|
||||
const struct pindef_t* valid_pins; ///< mask defines allowed pins, inverse define is they might be used inverted
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a pin in the pin definition as normal or inverse pin.
|
||||
*
|
||||
* @param[out] pindef pin definition to update
|
||||
* @param[in] pin number of pin [0..PIN_MAX]
|
||||
* @param[in] inverse inverse (true) or normal (false) pin
|
||||
*/
|
||||
void pin_set_value(struct pindef_t * const pindef, const int pin, const bool inverse);
|
||||
|
||||
/**
|
||||
* Clear all defined pins in pindef.
|
||||
*
|
||||
* @param[out] pindef pin definition to clear
|
||||
*/
|
||||
void pin_clear_all(struct pindef_t * const pindef);
|
||||
|
||||
struct programmer_t; /* forward declaration */
|
||||
|
||||
/**
|
||||
* Convert for given programmer new pin definitions to old pin definitions.
|
||||
*
|
||||
* @param[inout] pgm programmer whose pins shall be converted.
|
||||
*/
|
||||
void pgm_fill_old_pins(struct programmer_t * const pgm);
|
||||
|
||||
/**
|
||||
* This function checks all pin of pgm against the constraints given in the checklist.
|
||||
* It checks if
|
||||
* @li any invalid pins are used
|
||||
* @li valid pins are used inverted when not allowed
|
||||
* @li any pins are used by more than one function
|
||||
* @li any mandatory pin is not set all.
|
||||
*
|
||||
* In case of any error it report the wrong function and the pin numbers.
|
||||
* For verbose >= 2 it also reports the possible correct values.
|
||||
* For verbose >=3 it shows also which pins were ok.
|
||||
*
|
||||
* @param[in] pgm the programmer to check
|
||||
* @param[in] checklist the constraint for the pins
|
||||
* @param[in] size the number of entries in checklist
|
||||
* @param[in] output false suppresses error messages to the user
|
||||
* @returns 0 if all pin definitions are valid, -1 otherwise
|
||||
*/
|
||||
int pins_check(const struct programmer_t * const pgm, const struct pin_checklist_t * const checklist, const int size, const bool output);
|
||||
|
||||
/**
|
||||
* Returns the name of the pin as string.
|
||||
*
|
||||
* @param pinname the pinname which we want as string.
|
||||
* @returns a string with the pinname, or <unknown> if pinname is invalid.
|
||||
*/
|
||||
const char * avr_pin_name(int pinname);
|
||||
|
||||
/**
|
||||
* This function returns a string representation of defined pins eg. ~1,2,~4,~5,7
|
||||
* Another execution of this function will overwrite the previous result in the static buffer.
|
||||
*
|
||||
* @param[in] pindef the pin definition for which we want the string representation
|
||||
* @returns pointer to a static string.
|
||||
*/
|
||||
const char * pins_to_str(const struct pindef_t * const pindef);
|
||||
|
||||
/**
|
||||
* This function returns a string representation of pins in the mask eg. 1,3,5-7,9,12
|
||||
* Another execution of this function will overwrite the previous result in the static buffer.
|
||||
* Consecutive pin number are representated as start-end.
|
||||
*
|
||||
* @param[in] pinmask the pin mask for which we want the string representation
|
||||
* @returns pointer to a static string.
|
||||
*/
|
||||
const char * pinmask_to_str(const pinmask_t * const pinmask);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -33,11 +32,11 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
# include "freebsd_ppi.h"
|
||||
#elif defined(__linux__)
|
||||
# include "linux_ppdev.h"
|
||||
#elif defined(__sun__) && defined(__svr4__) /* Solaris */
|
||||
#elif defined(__sun__) || defined(__sun) /* Solaris */
|
||||
# include "solaris_ecpp.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2003, 2004, 2006
|
||||
* Eric B. Weddington <eweddington@cso.atmel.com>
|
||||
* Copyright 2008, 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
|
||||
@@ -14,8 +15,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -31,6 +31,7 @@ reg = register as defined in an enum in ppi.h. This must be converted
|
||||
|
||||
|
||||
#include "ac_cfg.h"
|
||||
#include "avrdude.h"
|
||||
|
||||
#if defined (WIN32NATIVE)
|
||||
|
||||
@@ -44,7 +45,6 @@ reg = register as defined in an enum in ppi.h. This must be converted
|
||||
#include <sys/time.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "serial.h"
|
||||
#include "ppi.h"
|
||||
|
||||
@@ -107,6 +107,24 @@ void ppi_open(char *port, union filedescriptor *fdp)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(fd == -1)
|
||||
{
|
||||
/*
|
||||
* Supplied port name did not match any of the pre-defined
|
||||
* names. Try interpreting it as a numeric
|
||||
* (hexadecimal/decimal/octal) address.
|
||||
*/
|
||||
char *cp;
|
||||
|
||||
fd = strtol(port, &cp, 0);
|
||||
if(*port == '\0' || *cp != '\0')
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: port name \"%s\" is neither lpt1/2/3 nor valid number\n",
|
||||
progname, port);
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
if(fd < 0)
|
||||
{
|
||||
fprintf(stderr, "%s: can't open device \"%s\"\n\n", progname, port);
|
||||
@@ -355,7 +373,8 @@ int gettimeofday(struct timeval *tv, struct timezone *unused){
|
||||
|
||||
#endif
|
||||
|
||||
void usleep(unsigned long us)
|
||||
#if !defined(HAVE_USLEEP)
|
||||
int usleep(unsigned int us)
|
||||
{
|
||||
int has_highperf;
|
||||
LARGE_INTEGER freq,start,stop,loopend;
|
||||
@@ -365,7 +384,7 @@ void usleep(unsigned long us)
|
||||
// verify - increasing the delay helps sometimes but not
|
||||
// realiably. There must be some other problem. Maybe just
|
||||
// with my test-hardware maybe in the code-base.
|
||||
//// us=(unsigned long) (us*1.5);
|
||||
//// us=(unsigned long) (us*1.5);
|
||||
|
||||
has_highperf=QueryPerformanceFrequency(&freq);
|
||||
|
||||
@@ -374,7 +393,7 @@ void usleep(unsigned long us)
|
||||
if (has_highperf) {
|
||||
QueryPerformanceCounter(&start);
|
||||
loopend.QuadPart=start.QuadPart+freq.QuadPart*us/(1000*1000);
|
||||
do {
|
||||
do {
|
||||
QueryPerformanceCounter(&stop);
|
||||
} while (stop.QuadPart<=loopend.QuadPart);
|
||||
}
|
||||
@@ -386,9 +405,12 @@ void usleep(unsigned long us)
|
||||
|
||||
DEBUG_QueryPerformanceCounter(&stop);
|
||||
}
|
||||
|
||||
|
||||
DEBUG_DisplayTimingInfo(start, stop, freq, us, has_highperf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* !HAVE_USLEEP */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
@@ -150,7 +149,7 @@ int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse,
|
||||
return -1;
|
||||
}
|
||||
else if ((fusegood == 1) && (verbose > 0)) {
|
||||
printf("%s: safemode: fuse reads as %X\n", progname, safemode_fuse);
|
||||
fprintf(stderr, "%s: safemode: fuse reads as %X\n", progname, safemode_fuse);
|
||||
}
|
||||
|
||||
|
||||
@@ -205,7 +204,7 @@ int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse,
|
||||
return -1;
|
||||
}
|
||||
else if ((fusegood == 1) && (verbose > 0)) {
|
||||
printf("%s: safemode: lfuse reads as %X\n", progname, safemode_lfuse);
|
||||
fprintf(stderr, "%s: safemode: lfuse reads as %X\n", progname, safemode_lfuse);
|
||||
}
|
||||
|
||||
/* Read hfuse three times */
|
||||
@@ -258,7 +257,7 @@ int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse,
|
||||
return -2;
|
||||
}
|
||||
else if ((fusegood == 1) && (verbose > 0)){
|
||||
printf("%s: safemode: hfuse reads as %X\n", progname, safemode_hfuse);
|
||||
fprintf(stderr, "%s: safemode: hfuse reads as %X\n", progname, safemode_hfuse);
|
||||
}
|
||||
|
||||
/* Read efuse three times */
|
||||
@@ -311,7 +310,7 @@ int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse,
|
||||
return -3;
|
||||
}
|
||||
else if ((fusegood == 1) && (verbose > 0)) {
|
||||
printf("%s: safemode: efuse reads as %X\n", progname, safemode_efuse);
|
||||
fprintf(stderr, "%s: safemode: efuse reads as %X\n", progname, safemode_efuse);
|
||||
}
|
||||
|
||||
*lfuse = safemode_lfuse;
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -31,6 +30,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "serial.h"
|
||||
@@ -92,6 +92,7 @@ static void convertUniToAscii(char *buffer)
|
||||
while(*uni != 0){
|
||||
if(*uni >= 256){
|
||||
*ascii++ = '?';
|
||||
uni++;
|
||||
}else{
|
||||
*ascii++ = *uni++;
|
||||
}
|
||||
@@ -246,7 +247,13 @@ static int usbGetReport(union filedescriptor *fdp, int reportType, int reportNum
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#include <usb.h>
|
||||
#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
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
@@ -425,7 +432,7 @@ static int usbGetReport(union filedescriptor *fdp, int reportType, int reportNum
|
||||
*len = bytesReceived;
|
||||
if(!usesReportIDs){
|
||||
buffer[-1] = reportNumber; /* add dummy report ID */
|
||||
*len++;
|
||||
len++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -503,7 +510,7 @@ static char *usbErrorText(int usbErrno)
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static void avrdoper_open(char *port, long baud, union filedescriptor *fdp)
|
||||
static int avrdoper_open(char *port, long baud, union filedescriptor *fdp)
|
||||
{
|
||||
int rval;
|
||||
char *vname = "obdev.at";
|
||||
@@ -513,7 +520,9 @@ static void avrdoper_open(char *port, long baud, union filedescriptor *fdp)
|
||||
if(rval != 0){
|
||||
fprintf(stderr, "%s: avrdoper_open(): %s\n", progname, usbErrorText(rval));
|
||||
exit(1);
|
||||
//return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -633,6 +642,14 @@ static int avrdoper_drain(union filedescriptor *fdp, int display)
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static int avrdoper_set_dtr_rts(union filedescriptor *fdp, int is_on)
|
||||
{
|
||||
fprintf(stderr, "%s: AVR-Doper doesn't support DTR/RTS setting\n", progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
struct serial_device avrdoper_serdev =
|
||||
{
|
||||
.open = avrdoper_open,
|
||||
@@ -640,6 +657,7 @@ struct serial_device avrdoper_serdev =
|
||||
.send = avrdoper_send,
|
||||
.recv = avrdoper_recv,
|
||||
.drain = avrdoper_drain,
|
||||
.set_dtr_rts = avrdoper_set_dtr_rts,
|
||||
.flags = SERDEV_FL_NONE,
|
||||
};
|
||||
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -32,6 +31,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
@@ -61,9 +61,15 @@ static struct baud_mapping baud_lookup_table [] = {
|
||||
{ 9600, B9600 },
|
||||
{ 19200, B19200 },
|
||||
{ 38400, B38400 },
|
||||
#ifdef B57600
|
||||
{ 57600, B57600 },
|
||||
#endif
|
||||
#ifdef B115200
|
||||
{ 115200, B115200 },
|
||||
#endif
|
||||
#ifdef B230400
|
||||
{ 230400, B230400 },
|
||||
#endif
|
||||
{ 0, 0 } /* Terminator. */
|
||||
};
|
||||
|
||||
@@ -80,9 +86,15 @@ static speed_t serial_baud_lookup(long baud)
|
||||
map++;
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s: serial_baud_lookup(): unknown baud rate: %ld\n",
|
||||
progname, baud);
|
||||
exit(1);
|
||||
/*
|
||||
* If a non-standard BAUD rate is used, issue
|
||||
* a warning (if we are verbose) and return the raw rate
|
||||
*/
|
||||
if (verbose > 0)
|
||||
fprintf(stderr, "%s: serial_baud_lookup(): Using non-standard baud rate: %ld",
|
||||
progname, baud);
|
||||
|
||||
return baud;
|
||||
}
|
||||
|
||||
static int ser_setspeed(union filedescriptor *fd, long baud)
|
||||
@@ -120,10 +132,10 @@ static int ser_setspeed(union filedescriptor *fd, long baud)
|
||||
|
||||
cfsetospeed(&termios, speed);
|
||||
cfsetispeed(&termios, speed);
|
||||
|
||||
rc = tcsetattr(fd->ifd, TCSANOW | TCSAFLUSH, &termios);
|
||||
|
||||
rc = tcsetattr(fd->ifd, TCSANOW, &termios);
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "%s: ser_setspeed(): tcsetattr() failed",
|
||||
fprintf(stderr, "%s: ser_setspeed(): tcsetattr() failed\n",
|
||||
progname);
|
||||
return -errno;
|
||||
}
|
||||
@@ -145,7 +157,7 @@ static int ser_setspeed(union filedescriptor *fd, long baud)
|
||||
* terminal/console server with serial parameters configured
|
||||
* appropriately (e. g. 115200-8-N-1 for a STK500.)
|
||||
*/
|
||||
static void
|
||||
static int
|
||||
net_open(const char *port, union filedescriptor *fdp)
|
||||
{
|
||||
char *hstr, *pstr, *end;
|
||||
@@ -157,14 +169,14 @@ net_open(const char *port, union filedescriptor *fdp)
|
||||
if ((hstr = strdup(port)) == NULL) {
|
||||
fprintf(stderr, "%s: net_open(): Out of memory!\n",
|
||||
progname);
|
||||
exit(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (((pstr = strchr(hstr, ':')) == NULL) || (pstr == hstr)) {
|
||||
fprintf(stderr, "%s: net_open(): Mangled host:port string \"%s\"\n",
|
||||
progname, hstr);
|
||||
free(hstr);
|
||||
exit(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -178,14 +190,14 @@ net_open(const char *port, union filedescriptor *fdp)
|
||||
fprintf(stderr, "%s: net_open(): Bad port number \"%s\"\n",
|
||||
progname, pstr);
|
||||
free(hstr);
|
||||
exit(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((hp = gethostbyname(hstr)) == NULL) {
|
||||
fprintf(stderr, "%s: net_open(): unknown host \"%s\"\n",
|
||||
progname, hstr);
|
||||
free(hstr);
|
||||
exit(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
free(hstr);
|
||||
@@ -193,7 +205,7 @@ net_open(const char *port, union filedescriptor *fdp)
|
||||
if ((fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
|
||||
fprintf(stderr, "%s: net_open(): Cannot open socket: %s\n",
|
||||
progname, strerror(errno));
|
||||
exit(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(&sockaddr, 0, sizeof(struct sockaddr_in));
|
||||
@@ -204,13 +216,44 @@ net_open(const char *port, union filedescriptor *fdp)
|
||||
if (connect(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr))) {
|
||||
fprintf(stderr, "%s: net_open(): Connect failed: %s\n",
|
||||
progname, strerror(errno));
|
||||
exit(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fdp->ifd = fd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ser_open(char * port, long baud, union filedescriptor *fdp)
|
||||
|
||||
static int ser_set_dtr_rts(union filedescriptor *fdp, int is_on)
|
||||
{
|
||||
unsigned int ctl;
|
||||
int r;
|
||||
|
||||
r = ioctl(fdp->ifd, TIOCMGET, &ctl);
|
||||
if (r < 0) {
|
||||
perror("ioctl(\"TIOCMGET\")");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (is_on) {
|
||||
/* Set DTR and RTS */
|
||||
ctl |= (TIOCM_DTR | TIOCM_RTS);
|
||||
}
|
||||
else {
|
||||
/* Clear DTR and RTS */
|
||||
ctl &= ~(TIOCM_DTR | TIOCM_RTS);
|
||||
}
|
||||
|
||||
r = ioctl(fdp->ifd, TIOCMSET, &ctl);
|
||||
if (r < 0) {
|
||||
perror("ioctl(\"TIOCMSET\")");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ser_open(char * port, long baud, union filedescriptor *fdp)
|
||||
{
|
||||
int rc;
|
||||
int fd;
|
||||
@@ -220,8 +263,7 @@ static void ser_open(char * port, long baud, union filedescriptor *fdp)
|
||||
* handle it as a TCP connection to a terminal server.
|
||||
*/
|
||||
if (strncmp(port, "net:", strlen("net:")) == 0) {
|
||||
net_open(port + strlen("net:"), fdp);
|
||||
return;
|
||||
return net_open(port + strlen("net:"), fdp);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -231,7 +273,7 @@ static void ser_open(char * port, long baud, union filedescriptor *fdp)
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "%s: ser_open(): can't open device \"%s\": %s\n",
|
||||
progname, port, strerror(errno));
|
||||
exit(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fdp->ifd = fd;
|
||||
@@ -244,8 +286,10 @@ static void ser_open(char * port, long baud, union filedescriptor *fdp)
|
||||
fprintf(stderr,
|
||||
"%s: ser_open(): can't set attributes for device \"%s\": %s\n",
|
||||
progname, port, strerror(-rc));
|
||||
exit(1);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -270,7 +314,6 @@ static void ser_close(union filedescriptor *fd)
|
||||
|
||||
static int ser_send(union filedescriptor *fd, unsigned char * buf, size_t buflen)
|
||||
{
|
||||
struct timeval timeout, to2;
|
||||
int rc;
|
||||
unsigned char * p = buf;
|
||||
size_t len = buflen;
|
||||
@@ -299,10 +342,6 @@ static int ser_send(union filedescriptor *fd, unsigned char * buf, size_t buflen
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 500000;
|
||||
to2 = timeout;
|
||||
|
||||
while (len) {
|
||||
rc = write(fd->ifd, p, (len > 1024) ? 1024 : len);
|
||||
if (rc < 0) {
|
||||
@@ -455,6 +494,7 @@ struct serial_device serial_serdev =
|
||||
.send = ser_send,
|
||||
.recv = ser_recv,
|
||||
.drain = ser_drain,
|
||||
.set_dtr_rts = ser_set_dtr_rts,
|
||||
.flags = SERDEV_FL_CANSETSPEED,
|
||||
};
|
||||
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -24,13 +23,14 @@
|
||||
* Native Win32 serial interface for avrdude.
|
||||
*/
|
||||
|
||||
#include "avrdude.h"
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h> /* for isprint */
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "serial.h"
|
||||
|
||||
long serial_recv_timeout = 5000; /* ms */
|
||||
@@ -66,9 +66,15 @@ static DWORD serial_baud_lookup(long baud)
|
||||
map++;
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s: serial_baud_lookup(): unknown baud rate: %ld",
|
||||
progname, baud);
|
||||
exit(1);
|
||||
/*
|
||||
* If a non-standard BAUD rate is used, issue
|
||||
* a warning (if we are verbose) and return the raw rate
|
||||
*/
|
||||
if (verbose > 0)
|
||||
fprintf(stderr, "%s: serial_baud_lookup(): Using non-standard baud rate: %ld",
|
||||
progname, baud);
|
||||
|
||||
return baud;
|
||||
}
|
||||
|
||||
|
||||
@@ -105,10 +111,11 @@ static int ser_setspeed(union filedescriptor *fd, long baud)
|
||||
}
|
||||
|
||||
|
||||
static void ser_open(char * port, long baud, union filedescriptor *fdp)
|
||||
static int ser_open(char * port, long baud, union filedescriptor *fdp)
|
||||
{
|
||||
LPVOID lpMsgBuf;
|
||||
HANDLE hComPort=INVALID_HANDLE_VALUE;
|
||||
char *newname = 0;
|
||||
|
||||
/*
|
||||
* If the port is of the form "net:<host>:<port>", then
|
||||
@@ -121,13 +128,25 @@ static void ser_open(char * port, long baud, union filedescriptor *fdp)
|
||||
"%s: ser_open(): network connects are currently not"
|
||||
"implemented for Win32 environments\n",
|
||||
progname);
|
||||
exit(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* if (hComPort!=INVALID_HANDLE_VALUE)
|
||||
fprintf(stderr, "%s: ser_open(): \"%s\" is already open\n",
|
||||
progname, port);
|
||||
*/
|
||||
if (strncasecmp(port, "com", strlen("com")) == 0) {
|
||||
|
||||
// prepend "\\\\.\\" to name, required for port # >= 10
|
||||
newname = malloc(strlen("\\\\.\\") + strlen(port) + 1);
|
||||
|
||||
if (newname == 0) {
|
||||
fprintf(stderr,
|
||||
"%s: ser_open(): out of memory\n",
|
||||
progname);
|
||||
exit(1);
|
||||
}
|
||||
strcpy(newname, "\\\\.\\");
|
||||
strcat(newname, port);
|
||||
|
||||
port = newname;
|
||||
}
|
||||
|
||||
hComPort = CreateFile(port, GENERIC_READ | GENERIC_WRITE, 0, NULL,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
@@ -146,7 +165,7 @@ static void ser_open(char * port, long baud, union filedescriptor *fdp)
|
||||
fprintf(stderr, "%s: ser_open(): can't open device \"%s\": %s\n",
|
||||
progname, port, (char*)lpMsgBuf);
|
||||
LocalFree( lpMsgBuf );
|
||||
exit(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!SetupComm(hComPort, W32SERBUFSIZE, W32SERBUFSIZE))
|
||||
@@ -154,7 +173,7 @@ static void ser_open(char * port, long baud, union filedescriptor *fdp)
|
||||
CloseHandle(hComPort);
|
||||
fprintf(stderr, "%s: ser_open(): can't set buffers for \"%s\"\n",
|
||||
progname, port);
|
||||
exit(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fdp->pfd = (void *)hComPort;
|
||||
@@ -163,7 +182,7 @@ static void ser_open(char * port, long baud, union filedescriptor *fdp)
|
||||
CloseHandle(hComPort);
|
||||
fprintf(stderr, "%s: ser_open(): can't set com-state for \"%s\"\n",
|
||||
progname, port);
|
||||
exit(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!serial_w32SetTimeOut(hComPort,0))
|
||||
@@ -171,8 +190,13 @@ static void ser_open(char * port, long baud, union filedescriptor *fdp)
|
||||
CloseHandle(hComPort);
|
||||
fprintf(stderr, "%s: ser_open(): can't set initial timeout for \"%s\"\n",
|
||||
progname, port);
|
||||
exit(1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (newname != 0) {
|
||||
free(newname);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -185,6 +209,20 @@ static void ser_close(union filedescriptor *fd)
|
||||
hComPort = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
static int ser_set_dtr_rts(union filedescriptor *fd, int is_on)
|
||||
{
|
||||
HANDLE hComPort=(HANDLE)fd->pfd;
|
||||
|
||||
if (is_on) {
|
||||
EscapeCommFunction(hComPort, SETDTR);
|
||||
EscapeCommFunction(hComPort, SETRTS);
|
||||
} else {
|
||||
EscapeCommFunction(hComPort, CLRDTR);
|
||||
EscapeCommFunction(hComPort, CLRRTS);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int ser_send(union filedescriptor *fd, unsigned char * buf, size_t buflen)
|
||||
{
|
||||
@@ -245,7 +283,6 @@ static int ser_recv(union filedescriptor *fd, unsigned char * buf, size_t buflen
|
||||
{
|
||||
unsigned char c;
|
||||
unsigned char * p = buf;
|
||||
size_t len = 0;
|
||||
DWORD read;
|
||||
|
||||
HANDLE hComPort=(HANDLE)fd->pfd;
|
||||
@@ -276,13 +313,22 @@ static int ser_recv(union filedescriptor *fd, unsigned char * buf, size_t buflen
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* time out detected */
|
||||
if (read == 0) {
|
||||
if (verbose > 1)
|
||||
fprintf(stderr,
|
||||
"%s: ser_recv(): programmer is not responding\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
p = buf;
|
||||
|
||||
if (verbose > 3)
|
||||
{
|
||||
fprintf(stderr, "%s: Recv: ", progname);
|
||||
|
||||
while (len) {
|
||||
while (read) {
|
||||
c = *p;
|
||||
if (isprint(c)) {
|
||||
fprintf(stderr, "%c ", c);
|
||||
@@ -293,7 +339,7 @@ static int ser_recv(union filedescriptor *fd, unsigned char * buf, size_t buflen
|
||||
fprintf(stderr, "[%02x] ", c);
|
||||
|
||||
p++;
|
||||
len--;
|
||||
read--;
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
@@ -361,6 +407,7 @@ struct serial_device serial_serdev =
|
||||
.send = ser_send,
|
||||
.recv = ser_recv,
|
||||
.drain = ser_drain,
|
||||
.set_dtr_rts = ser_set_dtr_rts,
|
||||
.flags = SERDEV_FL_CANSETSPEED,
|
||||
};
|
||||
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
@@ -26,6 +25,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const char serbb_desc[];
|
||||
void serbb_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
@@ -42,6 +41,7 @@
|
||||
#include "pindefs.h"
|
||||
#include "pgm.h"
|
||||
#include "bitbang.h"
|
||||
#include "serbb.h"
|
||||
|
||||
#undef DEBUG
|
||||
|
||||
@@ -97,7 +97,7 @@ static int serbb_setpin(PROGRAMMER * pgm, int pin, int value)
|
||||
perror("ioctl(\"TIOCxBRK\")");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case 4: /* dtr */
|
||||
case 7: /* rts */
|
||||
@@ -115,11 +115,16 @@ static int serbb_setpin(PROGRAMMER * pgm, int pin, int value)
|
||||
perror("ioctl(\"TIOCMSET\")");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
|
||||
default: /* impossible */
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pgm->ispdelay > 1)
|
||||
bitbang_delay(pgm->ispdelay);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int serbb_getpin(PROGRAMMER * pgm, int pin)
|
||||
@@ -174,16 +179,11 @@ static int serbb_getpin(PROGRAMMER * pgm, int pin)
|
||||
|
||||
static int serbb_highpulsepin(PROGRAMMER * pgm, int pin)
|
||||
{
|
||||
if ( pin < 1 || pin > DB9PINS )
|
||||
if ( (pin & PIN_MASK) < 1 || (pin & PIN_MASK) > DB9PINS )
|
||||
return -1;
|
||||
|
||||
serbb_setpin(pgm, pin, 1);
|
||||
if (pgm->ispdelay > 1)
|
||||
bitbang_delay(pgm->ispdelay);
|
||||
|
||||
serbb_setpin(pgm, pin, 0);
|
||||
if (pgm->ispdelay > 1)
|
||||
bitbang_delay(pgm->ispdelay);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -283,10 +283,14 @@ static void serbb_close(PROGRAMMER *pgm)
|
||||
return;
|
||||
}
|
||||
|
||||
const char serbb_desc[] = "Serial port bitbanging";
|
||||
|
||||
void serbb_initpgm(PROGRAMMER *pgm)
|
||||
{
|
||||
strcpy(pgm->type, "SERBB");
|
||||
|
||||
pgm_fill_old_pins(pgm); // TODO to be removed if old pin data no longer needed
|
||||
|
||||
pgm->rdy_led = bitbang_rdy_led;
|
||||
pgm->err_led = bitbang_err_led;
|
||||
pgm->pgm_led = bitbang_pgm_led;
|
||||
@@ -300,6 +304,7 @@ void serbb_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 = serbb_open;
|
||||
pgm->close = serbb_close;
|
||||
pgm->setpin = serbb_setpin;
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* $Id$ */
|
||||
|
||||
@@ -24,6 +23,8 @@
|
||||
* Win32 serial bitbanging interface for avrdude.
|
||||
*/
|
||||
|
||||
#include "avrdude.h"
|
||||
|
||||
#if defined(WIN32NATIVE)
|
||||
|
||||
|
||||
@@ -32,11 +33,11 @@
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "avr.h"
|
||||
#include "pindefs.h"
|
||||
#include "pgm.h"
|
||||
#include "bitbang.h"
|
||||
#include "serbb.h"
|
||||
|
||||
/* cached status lines */
|
||||
static int dtr, rts, txd;
|
||||
@@ -124,6 +125,10 @@ static int serbb_setpin(PROGRAMMER * pgm, int pin, int value)
|
||||
LocalFree(lpMsgBuf);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (pgm->ispdelay > 1)
|
||||
bitbang_delay(pgm->ispdelay);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -222,16 +227,11 @@ static int serbb_getpin(PROGRAMMER * pgm, int pin)
|
||||
|
||||
static int serbb_highpulsepin(PROGRAMMER * pgm, int pin)
|
||||
{
|
||||
if (pin < 1 || pin > 7)
|
||||
return -1;
|
||||
if ( (pin & PIN_MASK) < 1 || (pin & PIN_MASK) > DB9PINS )
|
||||
return -1;
|
||||
|
||||
serbb_setpin(pgm, pin, 1);
|
||||
if (pgm->ispdelay > 1)
|
||||
bitbang_delay(pgm->ispdelay);
|
||||
|
||||
serbb_setpin(pgm, pin, 0);
|
||||
if (pgm->ispdelay > 1)
|
||||
bitbang_delay(pgm->ispdelay);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -344,10 +344,14 @@ static void serbb_close(PROGRAMMER *pgm)
|
||||
hComPort = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
const char serbb_desc[] = "Serial port bitbanging";
|
||||
|
||||
void serbb_initpgm(PROGRAMMER *pgm)
|
||||
{
|
||||
strcpy(pgm->type, "SERBB");
|
||||
|
||||
pgm_fill_old_pins(pgm); // TODO to be removed if old pin data no longer needed
|
||||
|
||||
pgm->rdy_led = bitbang_rdy_led;
|
||||
pgm->err_led = bitbang_err_led;
|
||||
pgm->pgm_led = bitbang_pgm_led;
|
||||
@@ -361,6 +365,7 @@ void serbb_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 = serbb_open;
|
||||
pgm->close = serbb_close;
|
||||
pgm->setpin = serbb_setpin;
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -35,11 +34,20 @@ union filedescriptor
|
||||
{
|
||||
int ifd;
|
||||
void *pfd;
|
||||
struct
|
||||
{
|
||||
void *handle;
|
||||
int rep; /* bulk read endpoint */
|
||||
int wep; /* bulk write endpoint */
|
||||
int eep; /* event read endpoint */
|
||||
int max_xfer; /* max transfer size */
|
||||
} usb;
|
||||
};
|
||||
|
||||
struct serial_device
|
||||
{
|
||||
void (*open)(char * port, long baud, union filedescriptor *fd);
|
||||
// open should return -1 on error, other values on success
|
||||
int (*open)(char * port, long baud, union filedescriptor *fd);
|
||||
int (*setspeed)(union filedescriptor *fd, long baud);
|
||||
void (*close)(union filedescriptor *fd);
|
||||
|
||||
@@ -47,6 +55,8 @@ struct serial_device
|
||||
int (*recv)(union filedescriptor *fd, unsigned char * buf, size_t buflen);
|
||||
int (*drain)(union filedescriptor *fd, int display);
|
||||
|
||||
int (*set_dtr_rts)(union filedescriptor *fd, int is_on);
|
||||
|
||||
int flags;
|
||||
#define SERDEV_FL_NONE 0x0000 /* no flags */
|
||||
#define SERDEV_FL_CANSETSPEED 0x0001 /* device can change speed */
|
||||
@@ -64,5 +74,6 @@ extern struct serial_device avrdoper_serdev;
|
||||
#define serial_send (serdev->send)
|
||||
#define serial_recv (serdev->recv)
|
||||
#define serial_drain (serdev->drain)
|
||||
#define serial_set_dtr_rts (serdev->set_dtr_rts)
|
||||
|
||||
#endif /* serial_h */
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
307
avrdude/stk500.c
307
avrdude/stk500.c
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* avrdude - A Downloader/Uploader for AVR device programmers
|
||||
* Copyright (C) 2002-2004 Brian S. Dean <bsd@bsdhome.com>
|
||||
* Copyright (C) 2008 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
|
||||
@@ -13,8 +14,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -39,16 +39,16 @@
|
||||
#include "avrdude.h"
|
||||
#include "avr.h"
|
||||
#include "pgm.h"
|
||||
#include "stk500.h"
|
||||
#include "stk500_private.h"
|
||||
#include "serial.h"
|
||||
|
||||
#define STK500_XTAL 7372800U
|
||||
#define MAX_SYNC_ATTEMPTS 10
|
||||
|
||||
static int stk500_getparm(PROGRAMMER * pgm, unsigned parm, unsigned * value);
|
||||
static int stk500_setparm(PROGRAMMER * pgm, unsigned parm, unsigned value);
|
||||
static void stk500_print_parms1(PROGRAMMER * pgm, const char * p);
|
||||
static int stk500_is_page_empty(unsigned int address, int page_size,
|
||||
const unsigned char *buf);
|
||||
|
||||
|
||||
static int stk500_send(PROGRAMMER * pgm, unsigned char * buf, size_t len)
|
||||
@@ -72,15 +72,16 @@ static int stk500_recv(PROGRAMMER * pgm, unsigned char * buf, size_t len)
|
||||
}
|
||||
|
||||
|
||||
static int stk500_drain(PROGRAMMER * pgm, int display)
|
||||
int stk500_drain(PROGRAMMER * pgm, int display)
|
||||
{
|
||||
return serial_drain(&pgm->fd, display);
|
||||
}
|
||||
|
||||
|
||||
static int stk500_getsync(PROGRAMMER * pgm)
|
||||
int stk500_getsync(PROGRAMMER * pgm)
|
||||
{
|
||||
unsigned char buf[32], resp[32];
|
||||
int attempt;
|
||||
|
||||
/*
|
||||
* get in sync */
|
||||
@@ -96,13 +97,17 @@ static int stk500_getsync(PROGRAMMER * pgm)
|
||||
stk500_send(pgm, buf, 2);
|
||||
stk500_drain(pgm, 0);
|
||||
|
||||
stk500_send(pgm, buf, 2);
|
||||
if (stk500_recv(pgm, resp, 1) < 0)
|
||||
return -1;
|
||||
if (resp[0] != Resp_STK_INSYNC) {
|
||||
fprintf(stderr,
|
||||
"%s: stk500_getsync(): not in sync: resp=0x%02x\n",
|
||||
progname, resp[0]);
|
||||
for (attempt = 0; attempt < MAX_SYNC_ATTEMPTS; attempt++) {
|
||||
stk500_send(pgm, buf, 2);
|
||||
stk500_recv(pgm, resp, 1);
|
||||
if (resp[0] == Resp_STK_INSYNC){
|
||||
break;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"%s: stk500_getsync() attempt %d of %d: not in sync: resp=0x%02x\n",
|
||||
progname, attempt + 1, MAX_SYNC_ATTEMPTS, resp[0]);
|
||||
}
|
||||
if (attempt == MAX_SYNC_ATTEMPTS) {
|
||||
stk500_drain(pgm, 0);
|
||||
return -1;
|
||||
}
|
||||
@@ -125,8 +130,8 @@ static int stk500_getsync(PROGRAMMER * pgm)
|
||||
* transmit an AVR device command and return the results; 'cmd' and
|
||||
* 'res' must point to at least a 4 byte data buffer
|
||||
*/
|
||||
static int stk500_cmd(PROGRAMMER * pgm, unsigned char cmd[4],
|
||||
unsigned char res[4])
|
||||
static int stk500_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
|
||||
unsigned char *res)
|
||||
{
|
||||
unsigned char buf[32];
|
||||
|
||||
@@ -330,6 +335,77 @@ static int stk500_set_extended_parms(PROGRAMMER * pgm, int n,
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Crossbow MIB510 initialization and shutdown. Use cmd = 1 to
|
||||
* initialize, cmd = 0 to close.
|
||||
*/
|
||||
static int mib510_isp(PROGRAMMER * pgm, unsigned char cmd)
|
||||
{
|
||||
unsigned char buf[9];
|
||||
int tries = 0;
|
||||
|
||||
buf[0] = 0xaa;
|
||||
buf[1] = 0x55;
|
||||
buf[2] = 0x55;
|
||||
buf[3] = 0xaa;
|
||||
buf[4] = 0x17;
|
||||
buf[5] = 0x51;
|
||||
buf[6] = 0x31;
|
||||
buf[7] = 0x13;
|
||||
buf[8] = cmd;
|
||||
|
||||
|
||||
retry:
|
||||
|
||||
tries++;
|
||||
|
||||
stk500_send(pgm, buf, 9);
|
||||
if (stk500_recv(pgm, buf, 1) < 0)
|
||||
exit(1);
|
||||
if (buf[0] == Resp_STK_NOSYNC) {
|
||||
if (tries > 33) {
|
||||
fprintf(stderr, "%s: mib510_isp(): can't get into sync\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
if (stk500_getsync(pgm) < 0)
|
||||
return -1;
|
||||
goto retry;
|
||||
}
|
||||
else if (buf[0] != Resp_STK_INSYNC) {
|
||||
fprintf(stderr,
|
||||
"%s: mib510_isp(): protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_INSYNC, buf[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (stk500_recv(pgm, buf, 1) < 0)
|
||||
exit(1);
|
||||
if (buf[0] == Resp_STK_OK) {
|
||||
return 0;
|
||||
}
|
||||
else if (buf[0] == Resp_STK_NODEVICE) {
|
||||
fprintf(stderr, "%s: mib510_isp(): no device\n",
|
||||
progname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf[0] == Resp_STK_FAILED)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s: mib510_isp(): command %d failed\n",
|
||||
progname, cmd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
fprintf(stderr, "%s: mib510_isp(): unknown response=0x%02x\n",
|
||||
progname, buf[0]);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* initialize the AVR device and prepare it to accept commands
|
||||
@@ -341,13 +417,18 @@ static int stk500_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
int tries;
|
||||
unsigned maj, min;
|
||||
int rc;
|
||||
int n_extparms = 3;
|
||||
int n_extparms;
|
||||
|
||||
stk500_getparm(pgm, Parm_STK_SW_MAJOR, &maj);
|
||||
stk500_getparm(pgm, Parm_STK_SW_MINOR, &min);
|
||||
|
||||
if ((maj > 1) || ((maj == 1) && (min > 10)))
|
||||
// MIB510 does not need extparams
|
||||
if (strcmp(ldata(lfirst(pgm->id)), "mib510") == 0)
|
||||
n_extparms = 0;
|
||||
else if ((maj > 1) || ((maj == 1) && (min > 10)))
|
||||
n_extparms = 4;
|
||||
else
|
||||
n_extparms = 3;
|
||||
|
||||
tries = 0;
|
||||
|
||||
@@ -462,7 +543,6 @@ static int stk500_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
if (stk500_getsync(pgm) < 0)
|
||||
return -1;
|
||||
goto retry;
|
||||
return -1;
|
||||
}
|
||||
else if (buf[0] != Resp_STK_INSYNC) {
|
||||
fprintf(stderr,
|
||||
@@ -484,37 +564,40 @@ static int stk500_initialize(PROGRAMMER * pgm, AVRPART * p)
|
||||
|
||||
if (n_extparms) {
|
||||
if ((p->pagel == 0) || (p->bs2 == 0)) {
|
||||
fprintf(stderr,
|
||||
"%s: please define PAGEL and BS2 signals in the configuration "
|
||||
"file for part %s\n",
|
||||
progname, p->desc);
|
||||
if (verbose > 1)
|
||||
fprintf(stderr,
|
||||
"%s: PAGEL and BS2 signals not defined in the configuration "
|
||||
"file for part %s, using dummy values\n",
|
||||
progname, p->desc);
|
||||
buf[2] = 0xD7; /* they look somehow possible, */
|
||||
buf[3] = 0xA0; /* don't they? ;) */
|
||||
}
|
||||
else {
|
||||
buf[0] = n_extparms+1;
|
||||
|
||||
/*
|
||||
* m is currently pointing to eeprom memory if the part has it
|
||||
*/
|
||||
if (m)
|
||||
buf[1] = m->page_size;
|
||||
else
|
||||
buf[1] = 0;
|
||||
|
||||
buf[2] = p->pagel;
|
||||
buf[3] = p->bs2;
|
||||
|
||||
if (n_extparms == 4) {
|
||||
if (p->reset_disposition == RESET_DEDICATED)
|
||||
buf[4] = 0;
|
||||
else
|
||||
buf[4] = 1;
|
||||
}
|
||||
|
||||
rc = stk500_set_extended_parms(pgm, n_extparms+1, buf);
|
||||
if (rc) {
|
||||
fprintf(stderr, "%s: stk500_initialize(): failed\n", progname);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
buf[0] = n_extparms+1;
|
||||
|
||||
/*
|
||||
* m is currently pointing to eeprom memory if the part has it
|
||||
*/
|
||||
if (m)
|
||||
buf[1] = m->page_size;
|
||||
else
|
||||
buf[1] = 0;
|
||||
|
||||
|
||||
if (n_extparms == 4) {
|
||||
if (p->reset_disposition == RESET_DEDICATED)
|
||||
buf[4] = 0;
|
||||
else
|
||||
buf[4] = 1;
|
||||
}
|
||||
|
||||
rc = stk500_set_extended_parms(pgm, n_extparms+1, buf);
|
||||
if (rc) {
|
||||
fprintf(stderr, "%s: stk500_initialize(): failed\n", progname);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,13 +664,20 @@ static void stk500_enable(PROGRAMMER * pgm)
|
||||
static int stk500_open(PROGRAMMER * pgm, char * port)
|
||||
{
|
||||
strcpy(pgm->port, port);
|
||||
serial_open(port, pgm->baudrate? pgm->baudrate: 115200, &pgm->fd);
|
||||
if (serial_open(port, pgm->baudrate? pgm->baudrate: 115200, &pgm->fd)==-1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* drain any extraneous input
|
||||
*/
|
||||
stk500_drain(pgm, 0);
|
||||
|
||||
// MIB510 init
|
||||
if (strcmp(ldata(lfirst(pgm->id)), "mib510") == 0 &&
|
||||
mib510_isp(pgm, 1) != 0)
|
||||
return -1;
|
||||
|
||||
if (stk500_getsync(pgm) < 0)
|
||||
return -1;
|
||||
|
||||
@@ -597,6 +687,10 @@ static int stk500_open(PROGRAMMER * pgm, char * port)
|
||||
|
||||
static void stk500_close(PROGRAMMER * pgm)
|
||||
{
|
||||
// MIB510 close
|
||||
if (strcmp(ldata(lfirst(pgm->id)), "mib510") == 0)
|
||||
(void)mib510_isp(pgm, 0);
|
||||
|
||||
serial_close(&pgm->fd);
|
||||
pgm->fd.ifd = -1;
|
||||
}
|
||||
@@ -652,30 +746,23 @@ static int stk500_loadaddr(PROGRAMMER * pgm, unsigned int addr)
|
||||
}
|
||||
|
||||
|
||||
static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int page_size, int n_bytes)
|
||||
static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
unsigned int page_size,
|
||||
unsigned int addr, unsigned int n_bytes)
|
||||
{
|
||||
unsigned char buf[page_size + 16];
|
||||
int memtype;
|
||||
unsigned int addr;
|
||||
int a_div;
|
||||
int block_size;
|
||||
int tries;
|
||||
unsigned int n;
|
||||
unsigned int i;
|
||||
int flash;
|
||||
|
||||
if (page_size == 0) {
|
||||
page_size = 128;
|
||||
}
|
||||
|
||||
if (strcmp(m->desc, "flash") == 0) {
|
||||
memtype = 'F';
|
||||
flash = 1;
|
||||
}
|
||||
else if (strcmp(m->desc, "eeprom") == 0) {
|
||||
memtype = 'E';
|
||||
flash = 0;
|
||||
}
|
||||
else {
|
||||
return -2;
|
||||
@@ -686,19 +773,7 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
else
|
||||
a_div = 1;
|
||||
|
||||
if (n_bytes > m->size) {
|
||||
n_bytes = m->size;
|
||||
n = m->size;
|
||||
}
|
||||
else {
|
||||
if ((n_bytes % page_size) != 0) {
|
||||
n = n_bytes + page_size - (n_bytes % page_size);
|
||||
}
|
||||
else {
|
||||
n = n_bytes;
|
||||
}
|
||||
}
|
||||
|
||||
n = addr + n_bytes;
|
||||
#if 0
|
||||
fprintf(stderr,
|
||||
"n_bytes = %d\n"
|
||||
@@ -708,21 +783,15 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
n_bytes, n, a_div, page_size);
|
||||
#endif
|
||||
|
||||
for (addr = 0; addr < n; addr += page_size) {
|
||||
report_progress (addr, n_bytes, NULL);
|
||||
|
||||
if (addr + page_size > n_bytes) {
|
||||
block_size = n_bytes % page_size;
|
||||
}
|
||||
else {
|
||||
block_size = page_size;
|
||||
}
|
||||
|
||||
/* Only skip on empty page if programming flash. */
|
||||
if (flash) {
|
||||
if (stk500_is_page_empty(addr, block_size, m->buf)) {
|
||||
continue;
|
||||
}
|
||||
for (; addr < n; addr += block_size) {
|
||||
// MIB510 uses fixed blocks size of 256 bytes
|
||||
if (strcmp(ldata(lfirst(pgm->id)), "mib510") == 0) {
|
||||
block_size = 256;
|
||||
} else {
|
||||
if (n - addr < page_size)
|
||||
block_size = n - addr;
|
||||
else
|
||||
block_size = page_size;
|
||||
}
|
||||
tries = 0;
|
||||
retry:
|
||||
@@ -775,27 +844,12 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
return n_bytes;
|
||||
}
|
||||
|
||||
static int stk500_is_page_empty(unsigned int address, int page_size,
|
||||
const unsigned char *buf)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < page_size; i++) {
|
||||
if(buf[address + i] != 0xFF) {
|
||||
/* Page is not empty. */
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* Page is empty. */
|
||||
return(1);
|
||||
}
|
||||
|
||||
static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
int page_size, int n_bytes)
|
||||
static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
unsigned int page_size,
|
||||
unsigned int addr, unsigned int n_bytes)
|
||||
{
|
||||
unsigned char buf[16];
|
||||
int memtype;
|
||||
unsigned int addr;
|
||||
int a_div;
|
||||
int tries;
|
||||
unsigned int n;
|
||||
@@ -816,29 +870,18 @@ static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
else
|
||||
a_div = 1;
|
||||
|
||||
if (n_bytes > m->size) {
|
||||
n_bytes = m->size;
|
||||
n = m->size;
|
||||
}
|
||||
else {
|
||||
if ((n_bytes % page_size) != 0) {
|
||||
n = n_bytes + page_size - (n_bytes % page_size);
|
||||
n = addr + n_bytes;
|
||||
for (; addr < n; addr += block_size) {
|
||||
// MIB510 uses fixed blocks size of 256 bytes
|
||||
if (strcmp(ldata(lfirst(pgm->id)), "mib510") == 0) {
|
||||
block_size = 256;
|
||||
} else {
|
||||
if (n - addr < page_size)
|
||||
block_size = n - addr;
|
||||
else
|
||||
block_size = page_size;
|
||||
}
|
||||
else {
|
||||
n = n_bytes;
|
||||
}
|
||||
}
|
||||
|
||||
for (addr = 0; addr < n; addr += page_size) {
|
||||
report_progress (addr, n_bytes, NULL);
|
||||
|
||||
if (addr + page_size > n_bytes) {
|
||||
block_size = n_bytes % page_size;
|
||||
}
|
||||
else {
|
||||
block_size = page_size;
|
||||
}
|
||||
|
||||
tries = 0;
|
||||
retry:
|
||||
tries++;
|
||||
@@ -875,7 +918,9 @@ static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
|
||||
if (stk500_recv(pgm, buf, 1) < 0)
|
||||
exit(1);
|
||||
if (buf[0] != Resp_STK_OK) {
|
||||
|
||||
if(strcmp(ldata(lfirst(pgm->id)), "mib510") == 0) {
|
||||
if (buf[0] != Resp_STK_INSYNC) {
|
||||
fprintf(stderr,
|
||||
"\n%s: stk500_paged_load(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
@@ -883,6 +928,16 @@ static int stk500_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
|
||||
return -5;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (buf[0] != Resp_STK_OK) {
|
||||
fprintf(stderr,
|
||||
"\n%s: stk500_paged_load(): (a) protocol error, "
|
||||
"expect=0x%02x, resp=0x%02x\n",
|
||||
progname, Resp_STK_OK, buf[0]);
|
||||
return -5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return n_bytes;
|
||||
}
|
||||
@@ -913,7 +968,8 @@ static int stk500_set_vtarget(PROGRAMMER * pgm, double v)
|
||||
}
|
||||
|
||||
|
||||
static int stk500_set_varef(PROGRAMMER * pgm, double v)
|
||||
static int stk500_set_varef(PROGRAMMER * pgm, unsigned int chan /* unused */,
|
||||
double v)
|
||||
{
|
||||
unsigned uaref, utarg;
|
||||
|
||||
@@ -1220,6 +1276,7 @@ static void stk500_print_parms(PROGRAMMER * pgm)
|
||||
stk500_print_parms1(pgm, "");
|
||||
}
|
||||
|
||||
const char stk500_desc[] = "Atmel STK500 Version 1.x firmware";
|
||||
|
||||
void stk500_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -26,8 +25,13 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const char stk500_desc[];
|
||||
void stk500_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
/* used by arduino.c to avoid duplicate code */
|
||||
int stk500_getsync(PROGRAMMER * pgm);
|
||||
int stk500_drain(PROGRAMMER * pgm, int display);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -34,6 +33,7 @@
|
||||
|
||||
#include "avrdude.h"
|
||||
#include "pgm.h"
|
||||
#include "stk500generic.h"
|
||||
#include "stk500.h"
|
||||
#include "stk500v2.h"
|
||||
|
||||
@@ -65,9 +65,28 @@ static int stk500generic_open(PROGRAMMER * pgm, char * port)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void stk500generic_setup(PROGRAMMER * pgm)
|
||||
{
|
||||
/*
|
||||
* Only STK500v2 needs setup/teardown.
|
||||
*/
|
||||
stk500v2_initpgm(pgm);
|
||||
pgm->setup(pgm);
|
||||
}
|
||||
|
||||
static void stk500generic_teardown(PROGRAMMER * pgm)
|
||||
{
|
||||
stk500v2_initpgm(pgm);
|
||||
pgm->teardown(pgm);
|
||||
}
|
||||
|
||||
const char stk500generic_desc[] = "Atmel STK500, autodetect firmware version";
|
||||
|
||||
void stk500generic_initpgm(PROGRAMMER * pgm)
|
||||
{
|
||||
strcpy(pgm->type, "STK500GENERIC");
|
||||
|
||||
pgm->open = stk500generic_open;
|
||||
pgm->setup = stk500generic_setup;
|
||||
pgm->teardown = stk500generic_teardown;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -22,6 +21,7 @@
|
||||
#ifndef stk500generic_h__
|
||||
#define stk500generic_h__
|
||||
|
||||
extern const char stk500generic_desc[];
|
||||
void stk500generic_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
#endif
|
||||
|
||||
2753
avrdude/stk500v2.c
2753
avrdude/stk500v2.c
File diff suppressed because it is too large
Load Diff
@@ -14,8 +14,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -27,13 +26,33 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern const char stk500v2_desc[];
|
||||
extern const char stk500hvsp_desc[];
|
||||
extern const char stk500pp_desc[];
|
||||
extern const char stk500v2_jtagmkII_desc[];
|
||||
extern const char stk500v2_dragon_hvsp_desc[];
|
||||
extern const char stk500v2_dragon_isp_desc[];
|
||||
extern const char stk500v2_dragon_pp_desc[];
|
||||
extern const char stk500v2_jtag3_desc[];
|
||||
extern const char stk600_desc[];
|
||||
extern const char stk600hvsp_desc[];
|
||||
extern const char stk600pp_desc[];
|
||||
void stk500v2_initpgm (PROGRAMMER * pgm);
|
||||
void stk500hvsp_initpgm (PROGRAMMER * pgm);
|
||||
void stk500pp_initpgm (PROGRAMMER * pgm);
|
||||
void stk500v2_jtagmkII_initpgm(PROGRAMMER * pgm);
|
||||
void stk500v2_jtag3_initpgm(PROGRAMMER * pgm);
|
||||
void stk500v2_dragon_hvsp_initpgm(PROGRAMMER * pgm);
|
||||
void stk500v2_dragon_isp_initpgm(PROGRAMMER * pgm);
|
||||
void stk500v2_dragon_pp_initpgm(PROGRAMMER * pgm);
|
||||
void stk600_initpgm (PROGRAMMER * pgm);
|
||||
void stk600hvsp_initpgm (PROGRAMMER * pgm);
|
||||
void stk600pp_initpgm (PROGRAMMER * pgm);
|
||||
|
||||
void stk500v2_setup(PROGRAMMER * pgm);
|
||||
void stk500v2_teardown(PROGRAMMER * pgm);
|
||||
int stk500v2_drain(PROGRAMMER * pgm, int display);
|
||||
int stk500v2_getsync(PROGRAMMER * pgm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
//*
|
||||
//**************************************************************************
|
||||
|
||||
#include "pgm.h"
|
||||
|
||||
// *****************[ STK message constants ]***************************
|
||||
|
||||
#define MESSAGE_START 0x1B //= ESC = 27 decimal
|
||||
@@ -23,6 +25,9 @@
|
||||
#define CMD_OSCCAL 0x05
|
||||
#define CMD_LOAD_ADDRESS 0x06
|
||||
#define CMD_FIRMWARE_UPGRADE 0x07
|
||||
#define CMD_CHECK_TARGET_CONNECTION 0x0D
|
||||
#define CMD_LOAD_RC_ID_TABLE 0x0E
|
||||
#define CMD_LOAD_EC_ID_TABLE 0x0F
|
||||
|
||||
|
||||
// *****************[ STK ISP command constants ]******************************
|
||||
@@ -40,7 +45,10 @@
|
||||
#define CMD_READ_LOCK_ISP 0x1A
|
||||
#define CMD_READ_SIGNATURE_ISP 0x1B
|
||||
#define CMD_READ_OSCCAL_ISP 0x1C
|
||||
#define CMD_SPI_MULTI 0x1D
|
||||
#define CMD_SPI_MULTI 0x1D /* STK500v2, AVRISPmkII,
|
||||
* JTAGICEmkII */
|
||||
#define CMD_SET_SCK 0x1D /* JTAGICE3 */
|
||||
#define CMD_GET_SCK 0x1E /* JTAGICE3 */
|
||||
|
||||
// *****************[ STK PP command constants ]*******************************
|
||||
|
||||
@@ -75,6 +83,27 @@
|
||||
#define CMD_READ_LOCK_HVSP 0x3A
|
||||
#define CMD_READ_SIGNATURE_HVSP 0x3B
|
||||
#define CMD_READ_OSCCAL_HVSP 0x3C
|
||||
// These two are redefined since 0x30/0x31 collide
|
||||
// with the STK600 bootloader.
|
||||
#define CMD_ENTER_PROGMODE_HVSP_STK600 0x3D
|
||||
#define CMD_LEAVE_PROGMODE_HVSP_STK600 0x3E
|
||||
|
||||
// *** XPROG command constants ***
|
||||
|
||||
#define CMD_XPROG 0x50
|
||||
#define CMD_XPROG_SETMODE 0x51
|
||||
|
||||
|
||||
// *** AVR32 JTAG Programming command ***
|
||||
|
||||
#define CMD_JTAG_AVR32 0x80
|
||||
#define CMD_ENTER_PROGMODE_JTAG_AVR32 0x81
|
||||
#define CMD_LEAVE_PROGMODE_JTAG_AVR32 0x82
|
||||
|
||||
|
||||
// *** AVR JTAG Programming command ***
|
||||
|
||||
#define CMD_JTAG_AVR 0x90
|
||||
|
||||
// *****************[ STK test command constants ]***************************
|
||||
|
||||
@@ -110,25 +139,191 @@
|
||||
#define STATUS_CMD_FAILED 0xC0
|
||||
#define STATUS_CKSUM_ERROR 0xC1
|
||||
#define STATUS_CMD_UNKNOWN 0xC9
|
||||
#define STATUS_CMD_ILLEGAL_PARAMETER 0xCA
|
||||
|
||||
// Status
|
||||
#define STATUS_ISP_READY 0x00
|
||||
#define STATUS_CONN_FAIL_MOSI 0x01
|
||||
#define STATUS_CONN_FAIL_RST 0x02
|
||||
#define STATUS_CONN_FAIL_SCK 0x04
|
||||
#define STATUS_TGT_NOT_DETECTED 0x10
|
||||
#define STATUS_TGT_REVERSE_INSERTED 0x20
|
||||
|
||||
// hw_status
|
||||
// Bits in status variable
|
||||
// Bit 0-3: Slave MCU
|
||||
// Bit 4-7: Master MCU
|
||||
|
||||
#define STATUS_AREF_ERROR 0
|
||||
// Set to '1' if AREF is short circuited
|
||||
|
||||
#define STATUS_VTG_ERROR 4
|
||||
// Set to '1' if VTG is short circuited
|
||||
|
||||
#define STATUS_RC_CARD_ERROR 5
|
||||
// Set to '1' if board id changes when board is powered
|
||||
|
||||
#define STATUS_PROGMODE 6
|
||||
// Set to '1' if board is in programming mode
|
||||
|
||||
#define STATUS_POWER_SURGE 7
|
||||
// Set to '1' if board draws excessive current
|
||||
|
||||
// *****************[ STK parameter constants ]***************************
|
||||
#define PARAM_BUILD_NUMBER_LOW 0x80
|
||||
#define PARAM_BUILD_NUMBER_HIGH 0x81
|
||||
#define PARAM_BUILD_NUMBER_LOW 0x80 /* ??? */
|
||||
#define PARAM_BUILD_NUMBER_HIGH 0x81 /* ??? */
|
||||
#define PARAM_HW_VER 0x90
|
||||
#define PARAM_SW_MAJOR 0x91
|
||||
#define PARAM_SW_MINOR 0x92
|
||||
#define PARAM_VTARGET 0x94
|
||||
#define PARAM_VADJUST 0x95
|
||||
#define PARAM_OSC_PSCALE 0x96
|
||||
#define PARAM_OSC_CMATCH 0x97
|
||||
#define PARAM_SCK_DURATION 0x98
|
||||
#define PARAM_TOPCARD_DETECT 0x9A
|
||||
#define PARAM_STATUS 0x9C
|
||||
#define PARAM_DATA 0x9D
|
||||
#define PARAM_RESET_POLARITY 0x9E
|
||||
#define PARAM_VADJUST 0x95 /* STK500 only */
|
||||
#define PARAM_OSC_PSCALE 0x96 /* STK500 only */
|
||||
#define PARAM_OSC_CMATCH 0x97 /* STK500 only */
|
||||
#define PARAM_SCK_DURATION 0x98 /* STK500 only */
|
||||
#define PARAM_TOPCARD_DETECT 0x9A /* STK500 only */
|
||||
#define PARAM_STATUS 0x9C /* STK500 only */
|
||||
#define PARAM_DATA 0x9D /* STK500 only */
|
||||
#define PARAM_RESET_POLARITY 0x9E /* STK500 only, and STK600 FW
|
||||
* version <= 2.0.3 */
|
||||
#define PARAM_CONTROLLER_INIT 0x9F
|
||||
|
||||
/* STK600 parameters */
|
||||
#define PARAM_STATUS_TGT_CONN 0xA1
|
||||
#define PARAM_DISCHARGEDELAY 0xA4
|
||||
#define PARAM_SOCKETCARD_ID 0xA5
|
||||
#define PARAM_ROUTINGCARD_ID 0xA6
|
||||
#define PARAM_EXPCARD_ID 0xA7
|
||||
#define PARAM_SW_MAJOR_SLAVE1 0xA8
|
||||
#define PARAM_SW_MINOR_SLAVE1 0xA9
|
||||
#define PARAM_SW_MAJOR_SLAVE2 0xAA
|
||||
#define PARAM_SW_MINOR_SLAVE2 0xAB
|
||||
#define PARAM_BOARD_ID_STATUS 0xAD
|
||||
#define PARAM_RESET 0xB4
|
||||
|
||||
#define PARAM_JTAG_ALLOW_FULL_PAGE_STREAM 0x50
|
||||
#define PARAM_JTAG_EEPROM_PAGE_SIZE 0x52
|
||||
#define PARAM_JTAG_DAISY_BITS_BEFORE 0x53
|
||||
#define PARAM_JTAG_DAISY_BITS_AFTER 0x54
|
||||
#define PARAM_JTAG_DAISY_UNITS_BEFORE 0x55
|
||||
#define PARAM_JTAG_DAISY_UNITS_AFTER 0x56
|
||||
|
||||
// *** Parameter constants for 2 byte values ***
|
||||
#define PARAM2_SCK_DURATION 0xC0
|
||||
#define PARAM2_CLOCK_CONF 0xC1
|
||||
#define PARAM2_AREF0 0xC2
|
||||
#define PARAM2_AREF1 0xC3
|
||||
|
||||
#define PARAM2_JTAG_FLASH_SIZE_H 0xC5
|
||||
#define PARAM2_JTAG_FLASH_SIZE_L 0xC6
|
||||
#define PARAM2_JTAG_FLASH_PAGE_SIZE 0xC7
|
||||
#define PARAM2_RC_ID_TABLE_REV 0xC8
|
||||
#define PARAM2_EC_ID_TABLE_REV 0xC9
|
||||
|
||||
/* STK600 XPROG section */
|
||||
// XPROG modes
|
||||
#define XPRG_MODE_PDI 0
|
||||
#define XPRG_MODE_JTAG 1
|
||||
#define XPRG_MODE_TPI 2
|
||||
|
||||
// XPROG commands
|
||||
#define XPRG_CMD_ENTER_PROGMODE 0x01
|
||||
#define XPRG_CMD_LEAVE_PROGMODE 0x02
|
||||
#define XPRG_CMD_ERASE 0x03
|
||||
#define XPRG_CMD_WRITE_MEM 0x04
|
||||
#define XPRG_CMD_READ_MEM 0x05
|
||||
#define XPRG_CMD_CRC 0x06
|
||||
#define XPRG_CMD_SET_PARAM 0x07
|
||||
|
||||
// Memory types
|
||||
#define XPRG_MEM_TYPE_APPL 1
|
||||
#define XPRG_MEM_TYPE_BOOT 2
|
||||
#define XPRG_MEM_TYPE_EEPROM 3
|
||||
#define XPRG_MEM_TYPE_FUSE 4
|
||||
#define XPRG_MEM_TYPE_LOCKBITS 5
|
||||
#define XPRG_MEM_TYPE_USERSIG 6
|
||||
#define XPRG_MEM_TYPE_FACTORY_CALIBRATION 7
|
||||
|
||||
// Erase types
|
||||
#define XPRG_ERASE_CHIP 1
|
||||
#define XPRG_ERASE_APP 2
|
||||
#define XPRG_ERASE_BOOT 3
|
||||
#define XPRG_ERASE_EEPROM 4
|
||||
#define XPRG_ERASE_APP_PAGE 5
|
||||
#define XPRG_ERASE_BOOT_PAGE 6
|
||||
#define XPRG_ERASE_EEPROM_PAGE 7
|
||||
#define XPRG_ERASE_USERSIG 8
|
||||
#define XPRG_ERASE_CONFIG 9 // TPI only, prepare fuse write
|
||||
|
||||
// Write mode flags
|
||||
#define XPRG_MEM_WRITE_ERASE 0
|
||||
#define XPRG_MEM_WRITE_WRITE 1
|
||||
|
||||
// CRC types
|
||||
#define XPRG_CRC_APP 1
|
||||
#define XPRG_CRC_BOOT 2
|
||||
#define XPRG_CRC_FLASH 3
|
||||
|
||||
// Error codes
|
||||
#define XPRG_ERR_OK 0
|
||||
#define XPRG_ERR_FAILED 1
|
||||
#define XPRG_ERR_COLLISION 2
|
||||
#define XPRG_ERR_TIMEOUT 3
|
||||
|
||||
// XPROG parameters of different sizes
|
||||
// 4-byte address
|
||||
#define XPRG_PARAM_NVMBASE 0x01
|
||||
// 2-byte page size
|
||||
#define XPRG_PARAM_EEPPAGESIZE 0x02
|
||||
// 1-byte, undocumented TPI param
|
||||
#define XPRG_PARAM_TPI_3 0x03
|
||||
// 1-byte, undocumented TPI param
|
||||
#define XPRG_PARAM_TPI_4 0x04
|
||||
|
||||
// *****************[ STK answer constants ]***************************
|
||||
|
||||
#define ANSWER_CKSUM_ERROR 0xB0
|
||||
|
||||
/*
|
||||
* Private data for this programmer.
|
||||
*/
|
||||
struct pdata
|
||||
{
|
||||
/*
|
||||
* See stk500pp_read_byte() for an explanation of the flash and
|
||||
* EEPROM page caches.
|
||||
*/
|
||||
unsigned char *flash_pagecache;
|
||||
unsigned long flash_pageaddr;
|
||||
unsigned int flash_pagesize;
|
||||
|
||||
unsigned char *eeprom_pagecache;
|
||||
unsigned long eeprom_pageaddr;
|
||||
unsigned int eeprom_pagesize;
|
||||
|
||||
unsigned char command_sequence;
|
||||
|
||||
enum
|
||||
{
|
||||
PGMTYPE_UNKNOWN,
|
||||
PGMTYPE_STK500,
|
||||
PGMTYPE_AVRISP,
|
||||
PGMTYPE_AVRISP_MKII,
|
||||
PGMTYPE_JTAGICE_MKII,
|
||||
PGMTYPE_STK600,
|
||||
PGMTYPE_JTAGICE3
|
||||
}
|
||||
pgmtype;
|
||||
|
||||
AVRPART *lastpart;
|
||||
|
||||
/* Start address of Xmega boot area */
|
||||
unsigned long boot_start;
|
||||
|
||||
/*
|
||||
* Chained pdata for the JTAG ICE mkII backend. This is used when
|
||||
* calling the backend functions for ISP/HVSP/PP programming
|
||||
* functionality of the JTAG ICE mkII and AVR Dragon.
|
||||
*/
|
||||
void *chained_pdata;
|
||||
};
|
||||
|
||||
|
||||
132
avrdude/term.c
132
avrdude/term.c
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
@@ -88,6 +87,14 @@ static int cmd_fosc (PROGRAMMER * pgm, struct avrpart * p,
|
||||
static int cmd_sck (PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char *argv[]);
|
||||
|
||||
static int cmd_spi (PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char *argv[]);
|
||||
|
||||
static int cmd_pgm (PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char *argv[]);
|
||||
|
||||
static int cmd_verbose (PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char *argv[]);
|
||||
|
||||
struct command cmd[] = {
|
||||
{ "dump", cmd_dump, "dump memory : %s <memtype> <addr> <N-Bytes>" },
|
||||
@@ -102,6 +109,9 @@ struct command cmd[] = {
|
||||
{ "varef", cmd_varef, "set <V[aref]> (STK500 only)" },
|
||||
{ "fosc", cmd_fosc, "set <oscillator frequency> (STK500 only)" },
|
||||
{ "sck", cmd_sck, "set <SCK period> (STK500 only)" },
|
||||
{ "spi", cmd_spi, "enter direct SPI mode" },
|
||||
{ "pgm", cmd_pgm, "return to programming mode" },
|
||||
{ "verbose", cmd_verbose, "change verbosity" },
|
||||
{ "help", cmd_help, "help" },
|
||||
{ "?", cmd_help, "help" },
|
||||
{ "quit", cmd_quit, "quit" }
|
||||
@@ -111,19 +121,19 @@ struct command cmd[] = {
|
||||
|
||||
|
||||
|
||||
|
||||
static int spi_mode = 0;
|
||||
|
||||
static int nexttok(char * buf, char ** tok, char ** next)
|
||||
{
|
||||
char * q, * n;
|
||||
|
||||
q = buf;
|
||||
while (isspace(*q))
|
||||
while (isspace((int)*q))
|
||||
q++;
|
||||
|
||||
|
||||
/* isolate first token */
|
||||
n = q+1;
|
||||
while (*n && !isspace(*n))
|
||||
while (*n && !isspace((int)*n))
|
||||
n++;
|
||||
|
||||
if (*n) {
|
||||
@@ -132,7 +142,7 @@ static int nexttok(char * buf, char ** tok, char ** next)
|
||||
}
|
||||
|
||||
/* find start of next token */
|
||||
while (isspace(*n))
|
||||
while (isspace((int)*n))
|
||||
n++;
|
||||
|
||||
*tok = q;
|
||||
@@ -182,9 +192,9 @@ static int chardump_line(char * buffer, unsigned char * p, int n, int pad)
|
||||
for (i=0; i<n; i++) {
|
||||
memcpy(b, p, n);
|
||||
buffer[i] = '.';
|
||||
if (isalpha(b[i]) || isdigit(b[i]) || ispunct(b[i]))
|
||||
if (isalpha((int)(b[i])) || isdigit((int)(b[i])) || ispunct((int)(b[i])))
|
||||
buffer[i] = b[i];
|
||||
else if (isspace(b[i]))
|
||||
else if (isspace((int)(b[i])))
|
||||
buffer[i] = ' ';
|
||||
}
|
||||
|
||||
@@ -200,13 +210,12 @@ static int chardump_line(char * buffer, unsigned char * p, int n, int pad)
|
||||
static int hexdump_buf(FILE * f, int startaddr, unsigned char * buf, int len)
|
||||
{
|
||||
int addr;
|
||||
int i, n;
|
||||
int n;
|
||||
unsigned char * p;
|
||||
char dst1[80];
|
||||
char dst2[80];
|
||||
|
||||
addr = startaddr;
|
||||
i = 0;
|
||||
p = (unsigned char *)buf;
|
||||
while (len) {
|
||||
n = 16;
|
||||
@@ -445,8 +454,18 @@ static int cmd_send(PROGRAMMER * pgm, struct avrpart * p,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (argc != 5) {
|
||||
fprintf(stderr, "Usage: send <byte1> <byte2> <byte3> <byte4>\n");
|
||||
if (spi_mode && (pgm->spi == NULL)) {
|
||||
fprintf(stderr,
|
||||
"The %s programmer does not support direct SPI transfers.\n",
|
||||
pgm->type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if ((argc > 5) || ((argc < 5) && (!spi_mode))) {
|
||||
fprintf(stderr, spi_mode?
|
||||
"Usage: send <byte1> [<byte2> [<byte3> [<byte4>]]]\n":
|
||||
"Usage: send <byte1> <byte2> <byte3> <byte4>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -465,7 +484,10 @@ static int cmd_send(PROGRAMMER * pgm, struct avrpart * p,
|
||||
|
||||
pgm->err_led(pgm, OFF);
|
||||
|
||||
pgm->cmd(pgm, cmd, res);
|
||||
if (spi_mode)
|
||||
pgm->spi(pgm, cmd, res, argc-1);
|
||||
else
|
||||
pgm->cmd(pgm, cmd, res);
|
||||
|
||||
/*
|
||||
* display results
|
||||
@@ -662,25 +684,42 @@ static int cmd_varef(PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char * argv[])
|
||||
{
|
||||
int rc;
|
||||
unsigned int chan;
|
||||
double v;
|
||||
char *endp;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: varef <value>\n");
|
||||
if (argc != 2 && argc != 3) {
|
||||
fprintf(stderr, "Usage: varef [channel] <value>\n");
|
||||
return -1;
|
||||
}
|
||||
v = strtod(argv[1], &endp);
|
||||
if (endp == argv[1]) {
|
||||
fprintf(stderr, "%s (varef): can't parse voltage \"%s\"\n",
|
||||
progname, argv[1]);
|
||||
return -1;
|
||||
if (argc == 2) {
|
||||
chan = 0;
|
||||
v = strtod(argv[1], &endp);
|
||||
if (endp == argv[1]) {
|
||||
fprintf(stderr, "%s (varef): can't parse voltage \"%s\"\n",
|
||||
progname, argv[1]);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
chan = strtoul(argv[1], &endp, 10);
|
||||
if (endp == argv[1]) {
|
||||
fprintf(stderr, "%s (varef): can't parse channel \"%s\"\n",
|
||||
progname, argv[1]);
|
||||
return -1;
|
||||
}
|
||||
v = strtod(argv[2], &endp);
|
||||
if (endp == argv[2]) {
|
||||
fprintf(stderr, "%s (varef): can't parse voltage \"%s\"\n",
|
||||
progname, argv[2]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (pgm->set_varef == NULL) {
|
||||
fprintf(stderr, "%s (varef): the %s programmer cannot set V[aref]\n",
|
||||
progname, pgm->type);
|
||||
return -2;
|
||||
}
|
||||
if ((rc = pgm->set_varef(pgm, v)) != 0) {
|
||||
if ((rc = pgm->set_varef(pgm, chan, v)) != 0) {
|
||||
fprintf(stderr, "%s (varef): failed to set V[aref] (rc = %d)\n",
|
||||
progname, rc);
|
||||
return -3;
|
||||
@@ -707,6 +746,53 @@ static int cmd_help(PROGRAMMER * pgm, struct avrpart * p,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_spi(PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char * argv[])
|
||||
{
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_AVR_RESET], 1);
|
||||
spi_mode = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_pgm(PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char * argv[])
|
||||
{
|
||||
pgm->setpin(pgm, pgm->pinno[PIN_AVR_RESET], 0);
|
||||
spi_mode = 0;
|
||||
pgm->initialize(pgm, p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_verbose(PROGRAMMER * pgm, struct avrpart * p,
|
||||
int argc, char * argv[])
|
||||
{
|
||||
int nverb;
|
||||
char *endp;
|
||||
|
||||
if (argc != 1 && argc != 2) {
|
||||
fprintf(stderr, "Usage: verbose [<value>]\n");
|
||||
return -1;
|
||||
}
|
||||
if (argc == 1) {
|
||||
fprintf(stderr, "Verbosity level: %d\n", verbose);
|
||||
return 0;
|
||||
}
|
||||
nverb = strtol(argv[1], &endp, 0);
|
||||
if (endp == argv[2]) {
|
||||
fprintf(stderr, "%s: can't parse verbosity level \"%s\"\n",
|
||||
progname, argv[2]);
|
||||
return -1;
|
||||
}
|
||||
if (nverb < 0) {
|
||||
fprintf(stderr, "%s: verbosity level must be positive: %d\n",
|
||||
progname, nverb);
|
||||
return -1;
|
||||
}
|
||||
verbose = nverb;
|
||||
fprintf(stderr, "New verbosity level: %d\n", verbose);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tokenize(char * s, char *** argv)
|
||||
{
|
||||
@@ -856,7 +942,7 @@ int terminal_mode(PROGRAMMER * pgm, struct avrpart * p)
|
||||
* find the start of the command, skipping any white space
|
||||
*/
|
||||
q = cmdbuf;
|
||||
while (*q && isspace(*q))
|
||||
while (*q && isspace((int)*q))
|
||||
q++;
|
||||
|
||||
/* skip blank lines and comments */
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user