Compare commits

...

1201 Commits

Author SHA1 Message Date
Marius Greuel 73383e7169 Update README.md 2023-01-09 19:56:42 +01:00
Marius Greuel e54ded6db3 GitHub deploy action: Only deploy on Windows tags 2023-01-09 19:43:17 +01:00
Marius Greuel 8b147b4bcd Merge main branch 2023-01-09 19:27:38 +01:00
Joerg Wunsch a8931a4eb1 Post-release 7.1 changes 2023-01-08 22:40:45 +01:00
Joerg Wunsch 2e0be1e1ae This is AVRDUDE release 7.1 2023-01-08 22:28:14 +01:00
mcuee e226add045
Merge pull request #1268 from mariusgreuel/pr-update-actions
Update GitHub actions
2023-01-06 13:10:14 +08:00
Stefan Rueger 1b8a4d48ab
Update NEWS 2023-01-05 17:40:07 +00:00
Stefan Rueger 5642cecb82
Merge pull request #1269 from mariusgreuel/pr-update-windows-hidapi
Update to latest MSVC fork of hidapi to include bug fixes
2023-01-05 17:39:02 +00:00
Marius Greuel 6e1f14bc7a Update to latest MSVC fork of hidapi to include bug fixes 2023-01-05 18:21:01 +01:00
Stefan Rueger 7250d3fea3
Update NEWS 2023-01-05 16:55:05 +00:00
Stefan Rueger 4c1192e884
Merge pull request #1266 from stefanrueger/avrcache
Silence page erase in cache code
2023-01-05 16:44:05 +00:00
Stefan Rueger 653d66b014
Ensure full words are loaded, low-byte first, for ISP programming (#1265) 2023-01-05 16:43:35 +00:00
Stefan Rueger 5328b798e4
Merge pull request #1264 from mariusgreuel/pr-msvc-readline-plan-b
Add readline library replacement for MSVC
2023-01-05 16:42:54 +00:00
Marius Greuel 739d3f85c3 GitHub actions: Use latest versions to remove warning 'Node.js 12 actions are deprecated' 2023-01-05 16:25:08 +01:00
Marius Greuel 0b9999610c Add x86 targets to Visual Studio settings file 2023-01-05 16:23:53 +01:00
Stefan Rueger cf64837391
Silence page erase in cache code 2023-01-04 19:04:16 +00:00
Stefan Rueger fdcfb543fc
Improve guessBootloaderStart() for modern AVR 2023-01-04 18:52:51 +00:00
Marius Greuel c2a90f41f0 Set MSVC readline version to 0x0502, some cleanup 2023-01-04 18:02:01 +01:00
Marius Greuel 7b3cfd2724 Add readline library replacement for MSVC 2023-01-04 08:02:48 +01:00
Stefan Rueger 8b0c9988fc
Update NEWS 2023-01-03 23:16:27 +00:00
Stefan Rueger 2ca87126e5
Merge pull request #1260 from stefanrueger/avrintel
Clean up avrdude.conf.in fixing a couple of bugs
2023-01-03 20:50:41 +00:00
Stefan Rueger b5e4ea62b9
Remove butterfly_page_erase() function
... as it raises expectations but
  - Wrongly claims to page erase eeprom but doesn't
  - Prints errors messages for all other memory types only
2023-01-03 20:46:36 +00:00
Stefan Rueger eeb92b3c52
Change libreadline version from which it's OK to run from a pipeline 2023-01-03 16:31:50 +00:00
Joerg Wunsch b6da4c167e Add a commented-out example for enabling parport 2023-01-03 13:53:03 +01:00
Stefan Rueger 1d6f23cae7
Update avrintel.[ch] fixing boot section sizes 2023-01-03 00:21:55 +00:00
Stefan Rueger 872af44fcd
Fix boot section size of AT90SPWM2 and related parts 2023-01-03 00:19:38 +00:00
Stefan Rueger f8635451a2
Change avdude.conf.in into canonical form
avrdude -p*/s -c*/s outputs how avrdude understands the programmers
and parts defined in avrdude.conf.in that syntax (the canonical
form). This commit ensures that avrdude.conf.in is in canonical
form, typically removing assignments that are redundant owing to
inheritance.

Also changes a couple of comments and one programmer description
string to be more expressive.
2023-01-03 00:06:37 +00:00
Stefan Rueger 5eddc33864
Set pin number or pin list rather than adding them
Pin definitions in config_gram.y fail to clear existing pin
definitions when setting them for the second time, eg, through
inheritance, For example,

programmer parent "ft2232h"
    id                     = "tigard";
    reset                  = 5; # BD5 (GPIOL1)
;

would add pin 5 to the existing pin 3 for reset from the partent
programmer rather than overwriting the reset pin.

This commit clears any pre-existing pin definition first before
assigning the new pin number or pin list (for vcc or buff).
2023-01-02 23:57:53 +00:00
Stefan Rueger c44d0e9c73
Fix duplicate lockbits memory output of -p*/s
In order to output memories of a part always in the same order the
developer options use an odered list of all known memories. Owing
to the partial match feature of dev_locate_mem_noalias() they
would therefore print an existing lockbits memory twice, once for
the memory lock and once for the memory lockbits.
2023-01-02 22:22:34 +00:00
Stefan Rueger 82cf688357
Stop printing redundant usbpid and hvupdi_support lists for -c*/s 2023-01-02 21:59:51 +00:00
Stefan Rueger abdc65d79f
Shift initial current_struct setting from grammar to parser 2023-01-02 21:48:53 +00:00
Stefan Rueger a301a3c4bc
Update NEWS 2023-01-02 17:36:26 +00:00
Stefan Rueger eca0fab1f7
Merge pull request #1258 from stefanrueger/usbsn
Move static usbsn into serdev structure, remove serno access function
2023-01-02 17:33:36 +00:00
Stefan Rueger 74cbb51ef5
Clarify comment on copying usbsn 2023-01-02 17:10:15 +00:00
Stefan Rueger 0a883973a2
Move static usbsn into serdev structure, remove serno access function 2023-01-02 16:55:33 +00:00
Stefan Rueger 8d8157bf8b
Merge pull request #1255 from dl8dtl/add_q_terminal_command
Add a "q" command to the terminal
2023-01-02 14:28:49 +00:00
Stefan Rueger b5cabc1dcf
Move q command to end of list 2023-01-02 14:26:11 +00:00
Stefan Rueger bc198fd18d
Merge pull request #1256 from stefanrueger/partial-matches
Fix partial matches for locate_mem() and do_cmd()
2023-01-02 14:23:25 +00:00
Bas Wijnen dc0ab33a58
Change definition of NO_PIN to 1+PIN_MAX (#1231)
Fixes bug #1228 that gpio 0 could not be used by the linuxgpio system.

* Add sanity checks
* Loop over defined pins only

Co-authored-by: Stefan Rueger <stefan.rueger@urclocks.com>
2023-01-02 14:23:01 +00:00
Stefan Rueger 17e2feff26
Fix partial matches for locate_mem() and do_cmd() 2023-01-01 23:29:06 +00:00
Joerg Wunsch b6d50ef0a9 Extend the comment for the serial number function
Hint that it is actually a function pointer rather than a serial
number itself (in whatever form).
2023-01-01 22:36:50 +01:00
Joerg Wunsch e45195d643 Add a "q" command to the terminal
"q" used to be a unique abbrevation for "quit" before the introduction
of the "quell" command, and it was an easy way to exit terminal mode.

By adding it as an explicit command (must be before all longer
commands starting with "q"), this functionality is regained.
2023-01-01 22:33:30 +01:00
Joerg Wunsch 06e999b8c5 Check whether serial_serno is not NULL before calling it.
For devices connected through a real serial device rather than
USB, there is no transport-layer serial number available.

stk500v2.c (and jtag3.c) tried to always call this function.

Closes #1254
2023-01-01 22:23:44 +01:00
Stefan Rueger b2c03f5d40
Update NEWS 2022-12-31 16:14:49 +00:00
Stefan Rueger f0649d76da
Merge pull request #1251 from stefanrueger/urclock-drain
Guard urclock_getsync() against initial spurious input
2022-12-31 14:59:43 +00:00
Stefan Rueger d09b83079c
Merge pull request #1248 from mariusgreuel/pr-fix-win32-ser_recv-timeout
Make WIN32 implementation of ser_recv() fail on time-out
2022-12-31 14:58:42 +00:00
Stefan Rueger 9c3263a851
Merge pull request #1247 from mariusgreuel/pr-silence-conf-path-detection
Silence conf path detection debug output
2022-12-31 14:57:27 +00:00
Stefan Rueger 90dfee80ba
Change info on libreadline to notice2 level 2022-12-31 12:42:12 +00:00
Stefan Rueger ac10272bb6
Lengthen delay after reset for benefit of autobaud bootloaders 2022-12-31 12:27:07 +00:00
Stefan Rueger ab3da9f87c
Guard urclock_getsync() against initial spurious input 2022-12-30 21:05:57 +00:00
Marius Greuel 161e25e886 Correct messages in WIN32 net_recv() 2022-12-30 12:13:36 +01:00
Marius Greuel 894d4cba10 Make WIN32 implementation of ser_recv() fail on time-out 2022-12-29 15:35:20 +01:00
Marius Greuel d001172b46 Silence conf path detection debug output 2022-12-29 11:55:15 +01:00
Stefan Rueger 0f956e90eb
Update NEWS 2022-12-29 03:05:09 +00:00
Stefan Rueger d91c33b5e3
Merge pull request #1243 from mariusgreuel/pr-cmake-updates
CMake updates
2022-12-29 03:03:57 +00:00
Stefan Rueger e2dc3621db
Update NEWS 2022-12-29 03:03:08 +00:00
Stefan Rueger b11475f077
Merge pull request #1246 from stefanrueger/urclock-sync-ftdi
Modify recv timeouts to accommodate urclock sync with ftdi
2022-12-29 02:59:42 +00:00
Stefan Rueger 50a5d87a4e
Modify recv timeouts to accommodate urclock sync with ftdi 2022-12-28 15:30:38 +00:00
Stefan Rueger 92f980d15f
Update NEWS 2022-12-28 13:21:28 +00:00
Stefan Rueger 71b7e6d51f
Downgrade flash read unsupported err msg to notice 2022-12-28 13:16:53 +00:00
Joerg Wunsch 8a4ab97360 Remove trailing white space in NEWS 2022-12-28 08:58:33 +01:00
Marius Greuel 724fd9d572 CMake: Add Visual Studio settings file 2022-12-27 16:38:48 +01:00
Marius Greuel a138ec259f CMake: Rename option USE_EXTERNAL to USE_EXTERNAL_LIBS 2022-12-27 16:35:36 +01:00
Marius Greuel 80740071e2 CMake: Remove unused MSVC disable warning options 2022-12-27 16:31:49 +01:00
Marius Greuel 7a5883b75d CMake: Bump minimum version to 3.14 2022-12-27 16:31:28 +01:00
mcuee 46368b7059
Update NEWS 2022-12-27 22:43:27 +08:00
mcuee 3e08177450
Merge pull request #1242 from mariusgreuel/pr-add-ft2232h-support
Add FT2232H support for Windows, Tigard programmer
2022-12-27 22:12:36 +08:00
Marius Greuel f220656e0b CMake: For MSVC builds, use latest libftdi for Windows 2022-12-27 13:35:52 +01:00
Marius Greuel 805db5b13e Add tigard programmer 2022-12-27 13:17:27 +01:00
Marius Greuel aed9e1b7fa Improve FTDI programmer documentation 2022-12-27 13:09:00 +01:00
Marius Greuel 9412413fca Make 2232hio programmer derive from ft2232h 2022-12-27 13:05:38 +01:00
Marius Greuel 252d6833d4 Add ft4232h programmer 2022-12-27 13:03:41 +01:00
Marius Greuel 5d0f151f4a Add ft2232h programmer for consistency with existing ft232h programmer 2022-12-27 13:00:57 +01:00
mcuee 0c0da9162c
Merge pull request #1237 from MCUdude/print-expected-signature
Print expected signature when the one read by the programmer doesn't match the expected one
2022-12-27 08:56:25 +08:00
mcuee afb72c998e
Merge pull request #1241 from mcuee/build_sh_netbsd
Update build.sh for NetBSD
2022-12-27 08:53:51 +08:00
mcuee d4bef10e30
Update build.sh for NetBSD
https://github.com/avrdudes/avrdude/issues/1177#issuecomment-1336364197

This is to address issue https://github.com/avrdudes/avrdude/issues/1177 for NetBSD
2022-12-27 08:43:26 +08:00
mcuee eba5cea8e1
Merge pull request #1240 from mcuee/build_sh_linux
To work around Issue #1107
2022-12-27 08:36:25 +08:00
mcuee 2c4f2ada3f
To work around Issue #1107
https://github.com/avrdudes/avrdude/issues/1107#issuecomment-1265873339
2022-12-27 08:25:43 +08:00
mcuee 49834a47cd
Merge pull request #1239 from mcuee/macos_action
Temporarily disable brew update in macOS github action
2022-12-27 08:02:10 +08:00
mcuee 39ab053937
Temporary disable brew update in macOS github action 2022-12-27 07:52:31 +08:00
MCUdude 57cfced151 Print expected signature
... when the one read by the programmer doesn't match the expected one.
2022-12-25 18:23:53 +01:00
Stefan Rueger 857344295c
Merge pull request #1234 from stefanrueger/docs
Mention developer options in documentation and Usage()
2022-12-23 13:17:43 +00:00
Stefan Rueger 292f1d54b9
Update NEWS 2022-12-21 19:14:50 +00:00
Stefan Rueger 217adc543b
Merge pull request #1233 from janegilruud/fix-pickit4-snap-jtag
#1052 Add JTAG support for PICkit4 and Snap.
2022-12-21 19:12:33 +00:00
Stefan Rueger c2070d44c7
Merge pull request #1226 from stefanrueger/optiboot-eeprom
Hint at -xeepromrw option in EEPROM error messages
2022-12-21 19:12:06 +00:00
Hans c991ae9739
Read programmer serial number from libusb or hidusb (#1223)
* Silence compiler warnings

* Fix a fall-through error in switch

* Slightly reformat programmer info printout
Now the target voltage is printed out along with the HW version, FW version and serial number, and they all allign nicely. When in ISP mode, the "SCK period" value is printed _after_ the target voltage readout, and _before_ the additional clocks the programmer holds, such as JTAG, PDI and UPDI clocks.

Co-authored-by: Stefan Rueger <stefan.rueger@urclocks.com>
2022-12-21 19:11:31 +00:00
Stefan Rueger a696c94d8f
Merge pull request #1220 from stefanrueger/terminal-prompt
Remove extraneous avrdude> prompt at end of terminal session
2022-12-21 19:09:51 +00:00
Stefan Rueger b29dfb77e9
Merge pull request #1219 from MCUdude/pic-mode-recovery
Add alternative USB PID for PICkit4/SNAP in PIC mode
2022-12-21 19:09:34 +00:00
Stefan Rueger 3c152dc122
Merge pull request #1216 from MCUdude/slow-clock-error
Print meaningful error when a too slow ISP clock is detected
2022-12-21 19:09:11 +00:00
Stefan Rueger 41c9ed02e3
Mention developer options in documentation and Usage() 2022-12-21 19:06:26 +00:00
Stefan Rueger 435343bab3
Add more bootloader hashes 2022-12-20 23:25:43 +00:00
Stefan Rueger c6633fedce
Emphasise -xeepromrw and -xbootsize=<n> in documentation 2022-12-20 22:40:27 +00:00
Jan Egil Ruud a2ae465484 #1052 Update PICkit4 and Snap documentation with new modes. 2022-12-20 22:47:06 +01:00
Stefan Rueger 4d9d4050e0
Add hashes for optiboot bootloader instantiations 2022-12-20 21:37:20 +00:00
Jan Egil Ruud 918e01d93d #1052 Remove AVR32JTAG support for PICkit4 and Snap. 2022-12-20 12:02:42 +01:00
Jan Egil Ruud d1010fd46f #1052 Add JTAG support for PICkit4 and Snap. 2022-12-20 11:59:00 +01:00
Stefan Rueger 3b14c2df77
Hint at -xeepromrw option in EEPROM error messages 2022-12-17 18:40:09 +00:00
MCUdude 0be8f3b82d Start sentence with lower case character 2022-12-16 20:27:20 +01:00
Stefan Rueger 412eb9503e
Remove extraneous avrdude> prompt at end of terminal session 2022-12-14 23:17:44 +00:00
MCUdude 30e90bdfd2 Add alternative USB PID for PICkit4/SNAP in PIC mode 2022-12-14 20:11:43 +01:00
Stefan Rueger 159d12693e
Update NEWS 2022-12-14 00:27:13 +00:00
Hans 95363a11a7
Terminal read improvements (#1209)
* Preserve last address read from and length when reading a memory
* Add support for "graceful" memory read rollover
* Add extra padding for memories larger than 64kiB
* Bu default, don't read more bytes than the memory contains
* Prevent users from reading the same memory address twice
* Remove >>> echo and print read/dump command
* Only echo dump command in verbose mode
2022-12-14 00:10:30 +00:00
Stefan Rueger bbd3ed21ef
Merge pull request #1208 from stefanrueger/urclock-updi
Add urclock support for parts with bootloaders in low flash
2022-12-14 00:08:27 +00:00
Jörg Wunsch b10854677d
Consider libedit only in interactive mode (#1207) 2022-12-14 00:07:41 +00:00
Stefan Rueger 72f097502f
Merge pull request #1206 from stefanrueger/nsafety
Fix reading of .elf files
2022-12-14 00:06:47 +00:00
Stefan Rueger e4f10a33ab
Clarify comment 2022-12-13 23:59:58 +00:00
Stefan Rueger 9bd4dee254
Merge pull request #1205 from janegilruud/jtag3-tpi-jer
Added TPI support for Microchip tools
2022-12-13 23:56:25 +00:00
Jan Egil Ruud f08f771ab4 #822 Fixed print_parms for TPI. 2022-12-13 15:07:14 +01:00
Jan Egil Ruud af43a7757d #822 Print Vtarget when using TPI. 2022-12-12 14:31:41 +01:00
Jan Egil Ruud 2561d87fbd #822 Removed JTAGICE3 TPI support. 2022-12-12 14:10:42 +01:00
Stefan Rueger db0258a7d8
Add fuses, usersig, userrow, signature and data to elf_mem_limits() 2022-12-10 23:28:56 +00:00
Stefan Rueger 8024bfd4fb
Add partial urclock support for parts with bootloaders in low flash 2022-12-03 23:20:05 +00:00
Stefan Rueger 6b03d7dc5a
Correct upper flash boundary for 8-bit AVR parts in elf_mem_limits() 2022-12-03 13:39:28 +00:00
Stefan Rueger 23dddef64b
Mark unused function parameters as such 2022-12-02 19:03:06 +00:00
Stefan Rueger f688baabb7
Improve error messaging 2022-12-02 18:45:47 +00:00
Stefan Rueger 2e98ee3a1c
Check elf section fits into memory and fail elf2b() on elf handling errors 2022-12-02 18:28:19 +00:00
Stefan Rueger 3b30e5d424
Fix elf2b() to consider all sections in segments 2022-12-01 20:29:54 +00:00
Stefan Rueger 0ae632070f
Rewrite elf2b() in equivalent way absorbing elf_get_scn() 2022-12-01 20:21:33 +00:00
Jan Egil Ruud 8db18e64ed Remove redundant mem-check. 2022-12-01 20:12:26 +01:00
Jan Egil Ruud dc64fb716f Fix wrongfully call to initCache() according to stefanrueger's instructions. 2022-12-01 20:05:55 +01:00
Jan Egil Ruud f78e14ee96 Revert "Skip chaching when size of memory is 0."
This reverts commit bb808e8d5f.
2022-12-01 20:01:11 +01:00
Jan Egil Ruud bb808e8d5f Skip chaching when size of memory is 0. 2022-12-01 15:16:23 +01:00
Jan Egil Ruud e18b5c4fb0 Made the code a little prettier. 2022-12-01 00:01:29 +01:00
Jan Egil Ruud b643f0a1a0 #822 Fixed bug in TPI byte write for ATtiny20 and ATtiny40. 2022-11-30 23:49:20 +01:00
Jan Egil Ruud b52bd393de #822 Added TPI support for JTAGICE3. 2022-11-30 23:39:37 +01:00
Jan Egil Ruud 95160e8801 Changed verbose level on TPI initialize notice. 2022-11-30 23:21:30 +01:00
Jan Egil Ruud e87a9b59b6 #822 Added and tested TPI support for AtmelICE, PowerDebugger, PICkit4 and Snap. 2022-11-30 23:08:55 +01:00
Jan Egil Ruud 1eb6a06055 #822 Small refactoring and clean up. 2022-11-30 23:07:05 +01:00
Jan Egil Ruud cad296f780 Attempt to fix msvc builds. 2022-11-30 00:27:25 +01:00
Jan Egil Ruud 90bd24a902 #822 Added support for TPI page write. 2022-11-30 00:14:19 +01:00
Stefan Rueger ea2d7eec95
Fix fopen() file mode in fileio_fmt_autodetect() 2022-11-29 19:46:48 +00:00
Jan Egil Ruud 2f5566a8ed #822 Added support for TPI page load. 2022-11-29 20:34:05 +01:00
Jan Egil Ruud f2156b834d #822 Added sigrow memory to tiny102 and tiny 104, and removed duplicate lockbits. 2022-11-29 09:52:45 +01:00
MCUdude 2d7ad8e373 Print meaningful ISP clock error message
Currently, only some JTAG3 compatible programmers are able to detect that the connected target's main clock speed actually is too low for for the programmer.
In this case, these will return 0xCC.
2022-11-27 22:52:45 +01:00
MCUdude 6385fb09f7 Add missing stk500v2 status constants 2022-11-27 22:41:29 +01:00
Stefan Rueger 2f2a6c0008
Update NEWS 2022-11-27 19:12:19 +00:00
Stefan Rueger bb14386f63
Merge pull request #1199 from stefanrueger/userrow
Fix userrow size and page_size for ATtiny3216 and ATtiny3217
2022-11-27 19:05:25 +00:00
Stefan Rueger 2ac582fa02
Merge pull request #1198 from stefanrueger/delay
Tie up loose ends for urclock programmer
2022-11-27 19:04:07 +00:00
Stefan Rueger 58e2bca42c
Update n_interrupts in avrdude.conf.in and introduce eind 2022-11-27 16:56:49 +00:00
Stefan Rueger 5a0975aee7
Allow / as path deliminator in Windows for urclock metadata 2022-11-27 14:44:46 +00:00
Stefan Rueger 0c96f5d6dc
Calibrate urboot's -xdelay for windows 2022-11-27 13:57:37 +00:00
Stefan Rueger ba9d24fdd2
Fix userrow size and page_size for ATtiny3216 and ATtiny3217 2022-11-26 17:37:51 +00:00
Stefan Rueger 0e0a0ba0eb
Get boot section info from avrdude.conf and not from avrintel.c 2022-11-26 13:53:46 +00:00
Stefan Rueger d774e87a59
Update documentation re the urclock programmer 2022-11-26 13:23:25 +00:00
Stefan Rueger 3a5f3735ba
Adapt urclock_getsync() to consider legacy bootloaders 2022-11-26 12:54:42 +00:00
Stefan Rueger baa52e3a02
Update NEWS 2022-11-25 23:35:37 +00:00
Stefan Rueger 1cb169ec93
Establish avr_*timestamp() routines for timing 2022-11-25 22:09:02 +00:00
Stefan Rueger 231e88aaf9
Add autobaud_sync to avrdude.conf part description 2022-11-25 19:20:45 +00:00
Stefan Rueger d2a2ec1d1b
Merge pull request #1194 from stefanrueger/exitrc
Fix shell exit value when chip erase is delayed to next flash write
2022-11-25 17:50:01 +00:00
Stefan Rueger bbc52499e7
Merge branch 'main' into exitrc 2022-11-25 17:43:13 +00:00
Stefan Rueger 2cecf66a61
Merge pull request #1191 from stefanrueger/jtagice_mkii
Fix parameters for JTAGICE mkII and devices with bootloaders
2022-11-25 17:40:54 +00:00
Stefan Rueger 10ca3661bb
Merge pull request #1190 from stefanrueger/bootloader-hash
Provide bootloader-hash tool
2022-11-25 17:40:36 +00:00
Stefan Rueger 664b1aa1f6
Merge pull request #1189 from stefanrueger/culture
Deprecate mosi/miso in favour of sdo/sdi
2022-11-25 17:40:25 +00:00
Stefan Rueger 607f0c48be
Merge pull request #1188 from stefanrueger/not-all-is-nor-memory
Pad pages with input file contents before avr_write()
2022-11-25 17:40:11 +00:00
Stefan Rueger 289ca4f34c
Add optiboot_lgt8f328p.hex bootloader hashes to urclock.c 2022-11-25 17:26:17 +00:00
Stefan Rueger 7269370bf6
Change notices about libreadline presence in urclock.c 2022-11-25 13:58:11 +00:00
Stefan Rueger e6f7e158cd
Change periphery to peripheral; document deprecated miso/mosi are now sdi/sdo 2022-11-24 13:18:06 +00:00
Stefan Rueger 2b3534ea8a
Remove tabs and reformat 2022-11-24 12:36:49 +00:00
Stefan Rueger 8e79b7dc52
Fix error detection for reading a page to pad unset bytes 2022-11-24 12:16:43 +00:00
Stefan Rueger 68c6ffd7fc
Silence compiler warnings, change comments, remove typos 2022-11-24 12:14:54 +00:00
Stefan Rueger afa57ace84
Merge pull request #1196 from mcuee/disable_readline_msvc
Disable GNU Readline for MSVC build
2022-11-24 10:13:51 +00:00
mcuee 01ed17bd5c
Disable GNU Readline for MSVC build
This is to work around the issue of finding the wrong libreadline.a from Strawberry Perl for Windows MSVC github action.

Reference:
https://github.com/avrdudes/avrdude/pull/1194#issuecomment-1325824150
2022-11-24 13:22:12 +08:00
Stefan Rueger c3413ff0f4
Fix shell exit value when chip erase is delayed to next flash write 2022-11-23 19:53:55 +00:00
Jan Egil Ruud f9a2bd0327 Got added support for reading and writing fuses, and chiperase. 2022-11-23 14:25:14 +01:00
Stefan Rueger 19cd7d8c69
Remove non-stk500v1 bootloaders from urclock hash table 2022-11-22 22:38:43 +00:00
Stefan Rueger d3b14f21f9
Provide bootloader-hash tool 2022-11-22 22:38:09 +00:00
Stefan Rueger b925b5113d
Silence compiler warnings 2022-11-22 21:49:26 +00:00
Stefan Rueger 25ca91371d
Pad pages with input file contents before avr_write() 2022-11-22 21:32:42 +00:00
Stefan Rueger 33dd231e4c
Silence some compiler warnings 2022-11-22 21:17:39 +00:00
Stefan Rueger 8c73609c0e
Fix parameters for JTAGICE mkII and devices with bootloaders 2022-11-22 21:02:25 +00:00
Stefan Rueger 796e97ee3a
Update avrdude.conf.in wrt n_boot_sections, boot_section_size, eecr, spmcr 2022-11-22 20:49:12 +00:00
Stefan Rueger 9599bf2243
Add n_boot_sections and boot_section_size to part definitions 2022-11-22 20:44:12 +00:00
Stefan Rueger 7d5ab433ca
Replace gratuitous references to slave and master with technical terms 2022-11-22 17:11:33 +00:00
Stefan Rueger adc333ea54
Deprecate mosi/miso in favour of sdo/sdi
See https://www.oshwa.org/a-resolution-to-redefine-spi-signal-names/
2022-11-22 17:04:05 +00:00
Jan Egil Ruud 5dc2545716 Cleaned and improved TPI send and receive. 2022-11-22 14:05:01 +01:00
Jan Egil Ruud 3afdd55089 Get rid of TPI magic numbers. 2022-11-22 13:23:57 +01:00
Jan Egil Ruud 32a6ca39e4 Cleaned up whitespace in jtag3.c so it at least is consistent within the file. 2022-11-22 13:05:14 +01:00
Stefan Rueger 883d9494c8
Silence compiler warnings for urclock.c 2022-11-22 01:39:27 +00:00
Stefan Rueger 05d78828e0
Update NEWS 2022-11-22 01:29:07 +00:00
Stefan Rueger eee17ab096
Merge pull request #1187 from mcuee/revert_pr1156
Revert PR #1156
2022-11-22 01:19:10 +00:00
Stefan Rueger ef824d4d89
Merge pull request #1184 from mcuee/cmake_print_readline
Print HAVE_LIBREADLINE status
2022-11-22 01:18:56 +00:00
Stefan Rueger 9c30ccc6ea
Merge pull request #1175 from stefanrueger/terminal
Make terminal write's automatic number width less surprising
2022-11-22 01:18:30 +00:00
Stefan Rueger 3400527c7d
Merge pull request #1174 from stefanrueger/default_programmer
Ensure default_programmer from config files is used
2022-11-22 01:17:55 +00:00
Cristiano De Alti c3acdccbe5
Fix JTAGICE mkII by removing the initialize call after CMD_CHIP_ERASE_ISP (#1172)
- The extra call to initialize() sends CMD_ENTER_PROGMODE_ISP causing a flash
   verification mismatch
2022-11-22 01:17:19 +00:00
Stefan Rueger 02e02be6f9
Merge pull request #1171 from stefanrueger/urclock
Provide Urclock programmer
2022-11-22 01:13:57 +00:00
Stefan Rueger 2063671a02
Merge pull request #1147 from mcuee/Xplained_Pro_PDI
Add xplainedpro_pdi programmer
2022-11-22 01:13:23 +00:00
Stefan Rueger f9aea24fba
Reduce drain timeout value for Windows in urclock.c 2022-11-22 00:49:34 +00:00
Stefan Rueger 2e398916a7
Hash known bootloaders for urclock; they don't need -xbootsize=.... 2022-11-22 00:47:26 +00:00
mcuee b1b8d95154
Update build.yml to remove readline under macOS
This commmit updates github action to remove the needs of GNU Readline under macOS, after the merge of PR avrdudes#1185.
2022-11-22 06:59:29 +08:00
mcuee 4c8a900452
Remove the needs of readline under macOS
This commmit updates build.sh to remove the needs of GNU Readline under macOS, after the merge of PR #1185.
2022-11-22 06:56:37 +08:00
Joerg Wunsch 8a61ae5acf PR 1181 and 1185 done 2022-11-21 23:33:37 +01:00
Jörg Wunsch 3892c5a459
Merge pull request #1181 from dl8dtl/add_em_evr_for_openbsd
Add fallback for EM_AVR
2022-11-21 23:31:14 +01:00
Jan Egil Ruud 10ccf0f515 Initial commit for jtag3 TPI support. Can read signature on ATtiny104 XPlained mini, but nothing else yet. 2022-11-21 21:18:13 +01:00
Jörg Wunsch 13e0bd030f
Merge pull request #1185 from dl8dtl/workaround_1173
Add a workaround for issue #1173
2022-11-21 15:56:40 +01:00
Joerg Wunsch 461d75bbc7 Add Marius to the dev team as well
Marius handles the MSVC and CMake staff as well as the Github
runners.
2022-11-21 09:41:46 +01:00
Joerg Wunsch f90e36f231 Add a workaround for issue #1173
The readline compat layer for libedit which otherwise provides native
readline functionality in NetBSD and MacOS appears to have a bug that
causes subsequent prompts to be delayed until another line is being
processed.

Re-installing the callback over and over again works around that, and
does not seem to harm with GNU libreadline.
2022-11-20 22:52:41 +01:00
Stefan Rueger 7f4474f049
Delete previous metadata when writing new file to flash in urclock 2022-11-20 13:02:51 +00:00
Stefan Rueger c0e4dd494e
Use file basename in -c urclock metadata under WIN32 2022-11-20 01:48:39 +00:00
mcuee df4dccabfc
Update configure.ac to print libreadline status 2022-11-20 09:46:07 +08:00
Stefan Rueger 53de22cb83
Update avrintel.c for LGT8F(8|16|32)8P parts 2022-11-20 01:12:14 +00:00
Stefan Rueger f276d325ec
Handle verification errors in read only memory areas gracefully 2022-11-20 00:27:49 +00:00
Stefan Rueger ee25a62df6
Emulate chip erase in terminal when pgm->chip_erase() soft fails 2022-11-19 23:09:18 +00:00
Stefan Rueger d65a9a3cee
Adapt -c urclock to new reset vector protection in urboot v7.7 2022-11-19 19:39:39 +00:00
mcuee c9357132fa
Print HAVE_LIBREADLINE status 2022-11-19 17:22:04 +08:00
Joerg Wunsch ff478dcb83 PR 1182 done 2022-11-19 10:00:20 +01:00
Jörg Wunsch 6c3ce22b1e
Merge pull request #1182 from dl8dtl/rewrite_authors
Rewrite authors/copyrights
2022-11-19 09:55:23 +01:00
Joerg Wunsch 77ad26ddf4 Replace the hint to AUTHORS by an URL
Suggested by: Hans
2022-11-18 21:24:10 +01:00
Joerg Wunsch efad24e3de Rewrite authors/copyrights 2022-11-18 10:31:45 +01:00
Joerg Wunsch 2fc351750e Add Stefan and Xiaofan to the list of authors 2022-11-18 10:26:01 +01:00
Joerg Wunsch 908e6b15da Add NetBSD and OpenBSD to the build script 2022-11-17 21:20:07 +01:00
Joerg Wunsch 9df522a219 Add <sys/select.h> where appropriate
Under Posix systems, this header is documented to be required
when using select().
2022-11-17 14:14:22 +01:00
Joerg Wunsch 01be288b18 Add fallback for EM_AVR
OpenBSD still lacks this definition, so provide our own for
them.
2022-11-16 21:21:51 +01:00
Stefan Rueger a3eeedd176
Silence some compiler warnings 2022-11-16 02:32:32 +00:00
Stefan Rueger 2abb666bd2
Prepare urclock for autobaud synchronisation 2022-11-16 02:08:13 +00:00
Stefan Rueger d901e0a768
Update urbootPutVersion() to reflect urboot v7.7 changes 2022-11-16 00:42:36 +00:00
Stefan Rueger 82b9491cbd
Harden urclock against bootloader bricking
- Detect write restrictions with new pgm->readonly(..., addr)
 - Check in byte-wise cached write whether mem/addr allows write
 - Emulated chip erase tells user CE is delayed until first -U
 - After bootloader CE urclock_chip_erase will init reset vector
 - Low level paged write @ 0 unconditionally protects reset vector
 - Low level paged read @ 0 checks and repairs reset vector
2022-11-16 00:08:46 +00:00
Stefan Rueger afc2f7cf0c
Hint at option -xdelay=... for urclock programmer not responding messages 2022-11-12 13:47:48 +00:00
Stefan Rueger ff9c8bbe46
Silence min()/max() compiler warnings, fix urclock.c typo etc 2022-11-12 13:32:53 +00:00
Stefan Rueger e2b69dec75
Remove MacOS compiler warnings for urclock.c 2022-11-12 01:12:31 +00:00
Stefan Rueger b178deef5f
Handle n_page_erase in urclock for parts t441, t841 and t1634 2022-11-11 01:33:42 +00:00
Stefan Rueger 6e3a99be87
Add write statistics for patched flash input files at notice2 level 2022-11-11 01:27:55 +00:00
Stefan Rueger 22bd977365
Indent erasing chip message in main 2022-11-10 23:18:43 +00:00
Stefan Rueger c67bfe39a3
Show input file staistics before patching in update.c 2022-11-10 23:00:18 +00:00
Stefan Rueger 321bddbf7b
Rename urclock's option forcetrim to restore 2022-11-10 22:35:40 +00:00
Stefan Rueger 2434c3f7f6
Make terminal write's automatic number width less surprising 2022-11-10 19:38:21 +00:00
Stefan Rueger 4c4952d4f6
Ensure default_programmer from config files is used 2022-11-10 18:20:13 +00:00
Stefan Rueger afa408e2c6
Make urclock.c iron out a bug in some bootloaders 2022-11-09 21:00:16 +00:00
Stefan Rueger d5d0b940cc
Harden vector bootloaders more against reset overwrites 2022-11-09 19:28:29 +00:00
Stefan Rueger 84a3e2cc2b
Fix avr.c comment 2022-11-09 19:27:34 +00:00
Stefan Rueger c7ba53bca0
Harden urclock against terminal time outs and vector overwrites 2022-11-09 16:16:59 +00:00
Stefan Rueger ea65918dca
Omit verify after write failure in term.c 2022-11-09 15:43:57 +00:00
Stefan Rueger 20b86fb739
Warn in uclock when bootloader cannot read/write memories 2022-11-08 20:16:05 +00:00
Stefan Rueger 6a6d333849
Update urclock documentation 2022-11-08 15:18:30 +00:00
Stefan Rueger cf3c81f714
Update urclock's -x parameters 2022-11-07 18:01:23 +00:00
Stefan Rueger 715db4c690
Make -A default for urclock programmer 2022-11-07 02:43:34 +00:00
Stefan Rueger 21d93ec8cb
Update urclock programmer 2022-11-07 01:26:47 +00:00
Stefan Rueger e6c26d8db4
Provide urclock programmer 2022-11-06 01:29:07 +00:00
Stefan Rueger 4c92030e3a
Update NEWS 2022-11-01 18:20:06 +00:00
Stefan Rueger d211c4e5f5
Merge pull request #1164 from MCUdude/hvupdi-type2-fix
Fix Type 2 HV UPDI
2022-11-01 18:17:52 +00:00
Stefan Rueger 02fe08aed2
Open programmer before allocating part
So any programmer that knows exactly which part it is connected to
can set the -p part option should the user not have done so.

Also no longer exits main without closing open programmer.
2022-11-01 18:12:00 +00:00
MCUdude 577ee72db7 Fix Type 2 HV UPDI
Used on AVR-DD and AVR-Ex targets
2022-10-31 11:06:14 +01:00
Stefan Rueger b5699663c4
Update NEWS 2022-10-29 11:05:25 +01:00
Stefan Rueger 50046da923
Merge pull request #1151 from dbuchwald/serialupdi_page_erase
Implementation of SerialUPDI page erase operation
2022-10-29 11:02:17 +01:00
Stefan Rueger a3c04d294e
Merge pull request #1156 from mcuee/readline_macos
Readline macos
2022-10-29 11:00:06 +01:00
Stefan Rueger d87eb14dc9
Make -p variable partdesc global 2022-10-29 10:55:58 +01:00
Stefan Rueger 87df3216cb
Make fileio() and do_op() arguments const where possible 2022-10-29 10:48:47 +01:00
Stefan Rueger a1018999c4
Correct plural for message writing %d bytes in term.c 2022-10-26 08:42:03 +01:00
Stefan Rueger 418cf08e84
Change avrdude.conf.in comment on location of per-user config file 2022-10-25 18:13:28 +01:00
mcuee 5862a5b7e9
Use readline for github action macOS Homebrew
Update github action to use readline keg and not the default libedit under Homebrew
2022-10-24 08:50:57 +08:00
mcuee 79c43789a9
Update build.sh to use readline keg
For macOS Homebrew, readline is a keg. This change makes avrdude uses readline keg.
2022-10-24 08:47:02 +08:00
mcuee f2a413d2dc
Merge branch 'avrdudes:main' into Xplained_Pro_PDI 2022-10-24 07:57:55 +08:00
Stefan Rueger 1dba916e06
Update NEWS 2022-10-23 23:33:56 +01:00
Stefan Rueger 3769332afd
Merge pull request #1142 from MCUdude/stk600-pdi
STK600 supports programming using PDI
2022-10-23 23:10:10 +01:00
Stefan Rueger ec1e7156bd
Merge pull request #1154 from avrdudes/revert-1148-readline_mingw
Revert "Add readline for MSYS2 mingw32/mingw64 build"
2022-10-23 23:09:18 +01:00
Stefan Rueger 960bf7b959
Revert "Add readline for MSYS2 mingw32/mingw64 build" 2022-10-23 23:04:16 +01:00
Stefan Rueger 0ebf220315
Merge pull request #1148 from mcuee/readline_mingw
Add readline for MSYS2 mingw32/mingw64 build
2022-10-23 22:42:10 +01:00
Stefan Rueger b1b4a180ba
Merge pull request #1146 from mcuee/readline_action
Add libreadline-dev for Linux github action build
2022-10-23 22:39:54 +01:00
Stefan Rueger ae5b460859
Merge pull request #1141 from stefanrueger/paged
Always use paged access for programmers that serve bootloaders
2022-10-23 22:33:31 +01:00
Stefan Rueger baaad71aa5
Support optiboot, optiboot_dx and optiboot_x bootloaders for -c arduino (#1140)
* If bootloaders are served, send word addresses for classic parts and
  byte addresses for newer parts, eg, UPDI and PDI
* Load ext addr for stk500v1 bootloaders after grazing 64k boundaries
* Fix bootloader stk500v1 EEPROM r/w for classic parts with page size 1
2022-10-23 22:32:29 +01:00
Stefan Rueger 16922842be
Improve -B bitclock documentation 2022-10-23 22:26:07 +01:00
Stefan Rueger 2c7083f001
Merge pull request #1139 from steelman/isp-clock-error-message
Mention -B in the error message and document -F better
2022-10-23 21:59:21 +01:00
Stefan Rueger 4f6bab6303
Merge pull request #1138 from MCUdude/pic-detect-mode-cherry
Detect PICkit4 and SNAP in PIC mode
2022-10-23 21:57:26 +01:00
Stefan Rueger 5b008a04cf
Revamp terminal output: progress bar, callback and stdout/stderr (#1132)
* Print parms output to stdout
* Flush terminal writes and other minor changes
* Prepare terminal for periodic calls to programmer to reset bootloader WDT
* Only show progress reports for memories > 32 bytes or on -vv
* Freeze progress bar on serious error
* Allow cached r/w byte routines to be used in pgm->read_byte and pgm->write_byte
2022-10-23 21:56:45 +01:00
steelman 34fa2faba5
Look for ~/.config/avrdude/avrduce.rc configuration file (#1131)
* Look for ~/.config/avrdude/config configuration file

Traditionally per-user configuration files have been placed
in user's home directory with their names beginnig with a dot
to hide them from some tools like ls(1). However, the number
of programs following this convention have grown over time
to the point where the number of hidden files becomes inconvenient to
some users. For this reason the XDG Base Directory Specification[1]
specifies an alternate place to store configuration files under
~/.config directory.

This patch enables avrdude to look for ~/.config/avrdude/config
configuration file, if ~/.avrduderc doesn't exist.

[1] https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.8.html

* Safely concatenate directories and configurations files and minor changes in docs

* Make stats variable available for WIN32 again in main.c

* Utilise full usr_config[] array space

* Check for xdg-style avrdude.rc file first before fallback ~/.avrduderc

Co-authored-by: Stefan Rueger <stefan.rueger@urclocks.com>
2022-10-23 21:52:54 +01:00
Dawid Buchwald fa1c081a94 Implemented page erase operation for SerialUPDI 2022-10-23 15:06:06 +02:00
Dawid Buchwald 2230c05871
Merge pull request #1 from avrdudes/main
Merge latest avrdudes/avrdude main branch
2022-10-23 13:56:52 +02:00
mcuee e300861505
Add readline for MSYS2 mingw32/mingw64 build 2022-10-23 14:40:04 +08:00
mcuee 4a5efa7635
Add xplainedpro_pdi programmer
This will fix https://github.com/avrdudes/avrdude/issues/1143.

Xplained Pro should be able to support PDI mode as per the documentation.

Reference: take note that the following document does not cover UPDI support.
https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42096-Microcontrollers-Embedded-Debugger_User-Guide.pdf

Reference discussion:
* https://github.com/avrdudes/avrdude/pull/1139#issuecomment-1286760773
* https://github.com/avrdudes/avrdude/discussions/1019#discussioncomment-3569440
2022-10-23 14:24:57 +08:00
mcuee 21e372f639
Add libreadline-dev for Linux github action build 2022-10-23 14:03:33 +08:00
MCUdude 992e9666a3 STK600 supports programming using PDI 2022-10-22 12:51:03 +02:00
Łukasz Stelmach c890ff90eb Mention -B in the error message
One of possible problems of failed initialization is too hight frequency
of ISP clock. Mention using -B option as a possible solution.

Closes #1133
2022-10-21 02:33:34 +02:00
Stefan Rueger b9396bcd02
Always use paged access for programmers that serve bootloaders 2022-10-21 00:56:43 +01:00
Łukasz Stelmach 9977f1ed12 Document meaning of -F during initialization 2022-10-20 19:52:35 +02:00
MCUdude 72da5c73db Fix formatting and replace tabs with spaces 2022-10-20 12:39:11 +02:00
MCUdude 867d83c215 Print error message if no HID device is connected when using hidapi 2022-10-20 12:27:59 +02:00
MCUdude 14446950df Check for PICkit4 or SNAP in PIC mode 2022-10-20 12:19:10 +02:00
MCUdude b083416e3b Let Avrdude use the valid SNAP USB PID first 2022-10-20 12:19:10 +02:00
MCUdude 13817459e1 Add missing USB VID/PIDs 2022-10-20 12:19:10 +02:00
MCUdude c999083b8f Change message type from error to warning and add additional USB info 2022-10-20 12:18:42 +02:00
Stefan Rueger b864d7e73a
Update NEWS and resolve minor residual messaging issues 2022-10-17 16:39:45 +01:00
Stefan Rueger e172877724
Review and overhaul AVRDUDE's messaging system (#1126)
* Change avrdude_message(MSG_XYZ, ...) to msg_xyz(...)
* Define and use pmsg_xyz(...) instead of msg_xyz("%s: ...", progname, ...)
* Review and change avrdude_message() levels
   - Introduce new levels warning, error and ext_error
   - Distribute info level to info, warning, error, ext_error
   - Assign levels (more) consistently
   - Unify grammar, punctuation and style of messages
* Use imsg_xyz() to print indented messages
* Show function name in errors and warnings on -v
* Reduce effective verbosity level by number of -q above one
2022-10-17 15:44:55 +01:00
Stefan Rueger 2503ae03ce
Merge pull request #1125 from MCUdude/updi-lock-fix
Fix UPDI erase when target is locked
2022-10-17 14:17:32 +01:00
Stefan Rueger ff1d26ad18
Merge pull request #1122 from mariusgreuel/pr-teensy-warning
Suppress Teensy USB communication error message on reboot
2022-10-17 14:17:07 +01:00
Stefan Rueger 8e879cfae6
Merge pull request #1121 from stefanrueger/avr_cache
Use byte-wise read/write when page size is 1 in terminal cache
2022-10-17 14:16:43 +01:00
Dan Applegate 946b701b08
Fix writing of last word on DWORD TPI parts (#1115)
* Fix writing of last word on DWORD TPI parts

* Add n_word_writes AVRMEM config option

* TPI word chunk mode in avr_write_mem

* Simplify addition of n_words_write mem component to grammar

Co-authored-by: Stefan Rueger <stefan.rueger@urclocks.com>
2022-10-17 14:15:50 +01:00
Stefan Rueger 08f4f6c63f
Merge pull request #1112 from MCUdude/jtag3-page-erase-updi
Fix jtag3_page_erase for targets with UPDI
2022-10-17 14:12:17 +01:00
MCUdude bfec594ffd Fix issue where locked UPDI devices couldn't be erased
Resolves issue #1124
2022-10-13 14:14:46 +02:00
Stefan Rueger 714c2fbf95
Rename variable for clarity in avrcache.c 2022-10-12 15:55:22 +01:00
Stefan Rueger 8a3864d263
Fall back on bytewise r/w if paged access fails for avr cache 2022-10-12 15:53:54 +01:00
Marius Greuel 86155bdf66 Suppress Teensy USB communication error message on reboot 2022-10-11 18:23:03 +02:00
Stefan Rueger 48919f59b3
Use byte-wise read/write when page size is 1 in terminal cache 2022-10-11 15:31:18 +01:00
Stefan Rueger e14e5d2f74
Update NEWS 2022-10-11 14:49:44 +01:00
Stefan Rueger 929441eb82
Merge pull request #1119 from mariusgreuel/pr-pointer-truncation
Fix pointer truncation for Windows x64
2022-10-11 14:43:41 +01:00
Stefan Rueger 22362e9f08
Merge branch 'main' into pr-pointer-truncation 2022-10-11 14:43:19 +01:00
Stefan Rueger d3a3257cf7
Improve help message in terminal and provide new command pgerase (#1113) 2022-10-11 14:40:37 +01:00
Marius Greuel 9377acee0e Fix pointer truncation for Windows x64 2022-10-08 19:02:03 +02:00
MCUdude 1ca1be0447 Use avr_mem_is_flash_type() instead of checking m->desc directly 2022-10-06 20:59:32 +02:00
Stefan Rueger 44fe5bec2d
Update NEWS 2022-10-05 23:21:52 +01:00
MCUdude d5e4ed9f89 Fix jtag3_page_erase for targets with UPDI
Very handy to have now that #1106 is merged
2022-10-05 23:52:05 +02:00
Stefan Rueger cd79f81747
Merge pull request #1109 from MCUdude/jtag-mki-targets
Add missing AVR variants the original JTAG ICE supports
2022-10-05 22:21:42 +01:00
Stefan Rueger f2fb3b45b4
Merge pull request #1108 from MCUdude/avr109-xmega
AVR109: support for prodsig read and usersig read/write
2022-10-05 22:20:16 +01:00
Stefan Rueger d74b17b9b4
Provide cached byte-wise read/write API (#1106)
* Provide cached byte-wise read/write API

int avr_read_byte_cached(const PROGRAMMER *pgm, const AVRPART *p, const
  AVRMEM *mem, unsigned long addr, unsigned char *value);

int avr_write_byte_cached(const PROGRAMMER *pgm, const AVRPART *p, const
 AVRMEM *mem, unsigned long addr, unsigned char data);

int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p);

int avr_chip_erase_cached(const PROGRAMMER *pgm, const AVRPART *p);

int avr_reset_cache(const PROGRAMMER *pgm, const AVRPART *p);

avr_read_byte_cached() and avr_write_byte_cached() use a cache if paged
routines are available and if the device memory is EEPROM or flash,
otherwise they fall back to pgm->read_byte() and pgm->write_byte(),
respectively. Byte-wise cached read always gets its data from the cache,
possibly after reading a page from the device memory. Byte-wise cached
write with an address in memory range only ever modifies the cache. Any
modifications are written to the device after calling avr_flush_cache() or
when attempting to read or write from a location outside the address range
of the device memory.

avr_flush_cache() synchronises pending writes to EEPROM and flash with the
device. With some programmer and part combinations, flash (and sometimes
EEPROM, too) looks like a NOR memory, ie, one can only write 0 bits, not 1
bits. When this is detected, either page erase is deployed (eg, with parts
that have PDI/UPDI interfaces), or if that is not available, both EEPROM
and flash caches are fully read in, a pgm->chip_erase() command is issued
and both EEPROM and flash are written back to the device. Hence, it can
take minutes to ensure that a single previously cleared bit is set and,
therefore, this routine should be called sparingly.

avr_chip_erase_cached() erases the chip and discards pending writes() to
flash or EEPROM. It presets the flash cache to all 0xff alleviating the
need to read from the device flash. However, if the programmer serves
bootloaders (pgm->prog_modes & PM_SPM) then the flash cache is reset
instead, necessitating flash memory be fetched from the device on first
read; the reason for this is that bootloaders emulate chip erase and they
won't overwrite themselves (some bootloaders, eg, optiboot ignore chip
erase commands altogether) making it truly unknowable what the flash
contents on device is after a chip erase. 

For EEPROM avr_chip_erase_cached() concludes that it has been deleted if a
previously cached EEPROM page that contained cleared bits now no longer
has these clear bits on the device. Only with this evidence is the EEPROM
cache preset to all 0xff otherwise the cache discards all pending writes
to EEPROM and is left unchanged otherwise.

Finally, avr_reset_cache() resets the cache without synchronising pending
writes() to the device.
2022-10-05 22:16:15 +01:00
Stefan Rueger c4cb242823
Merge pull request #1105 from MCUdude/power-debugger-features
Support for Power Debugger analog readings in terminal mode
2022-10-05 22:03:52 +01:00
Stefan Rueger bc9137854b
Merge pull request #1103 from s-wakaba/sunxi_linuxspi_support
saving errno of ioctl() call in a temporary variable to prevent overwrite
2022-10-05 22:02:42 +01:00
Stefan Rueger 83232bc7e1
Merge pull request #1102 from MCUdude/flip2-reset
Add support for Flip 2 reset on exit
2022-10-05 22:02:22 +01:00
Stefan Rueger 59a191ee2c
Merge pull request #1101 from MCUdude/avr109-fix
Fix avr109 extended address
2022-10-05 22:00:59 +01:00
Hans da275f8ef2 Adjust prog_modes on a few chip variants
Now variants of chips that the JTAG ICE supports will not cause a warning when used with the original JTAG ICE mkI.
Also, The ATmega165 isn't officially supported by the ICE mkI, so this should be properly tested with the ICE mkI first.
2022-10-05 19:24:40 +02:00
Hans 2c8cef2712
Merge branch 'avrdudes:main' into avr109-xmega 2022-10-02 22:43:03 +02:00
MCUdude 31c3db2617 Add support for prodsig read and usersig read/write
Currently only supported by the Xboot bootloader
2022-10-02 22:36:43 +02:00
MCUdude ffabab1fb2 Improve pgm->id detection handling 2022-10-02 11:48:30 +02:00
MCUdude 4bc9e020f1 Merge branch 'flip2-reset' of https://github.com/MCUdude/avrdude into flip2-reset 2022-10-01 22:13:06 +02:00
MCUdude 419fd35b72 Mention linuxspi and flip2 programmers
in the -E exitspecs section. linuxspi and flip2 supports "-E reset" and "-E noreset".
2022-10-01 22:12:37 +02:00
Marius Greuel ef209fe44e GitHub Actions: Update apt index before installing packages 2022-10-01 22:12:37 +02:00
MCUdude e05aa16510 use pgm->id to identify Power Debugger instead of USB PID 2022-10-01 21:17:55 +02:00
MCUdude e39133daf5 Initial support for Power Debugger analog reading
Voltage and current though channel A and B
2022-10-01 21:17:01 +02:00
Hans 52eb2e36a7
Merge branch 'avrdudes:main' into flip2-reset 2022-09-30 20:16:58 +02:00
MCUdude 01ccab08b4 Improve exitspecs (-E) parsing
Use the same implementation as linuxspi does, instead of the one suggested in #733
2022-09-30 20:16:16 +02:00
MCUdude 521155c1c2 Improve punctuation in error message 2022-09-30 20:03:04 +02:00
Marius Greuel 3b8f41ca20 GitHub Actions: Update apt index before installing packages 2022-09-29 22:02:04 +02:00
MCUdude e1a317c670 Remove Flip 2 stub functions
Used when compiling without libusb. Print reasonable error instead
2022-09-27 19:35:25 +02:00
Shunichi Wakabayashi 2a64e78c7b bugfix: saving errno of ioctl() call in a temporary variable to prevent overwriting by following avrdude_message() call 2022-09-25 16:46:10 +09:00
MCUdude 80ca8a644e Add support for Flip 2 reset on exit
This makes it possible for the application to start immedeatly after the program has been loaded.
Simply use '-E reset' or '-E noreset'. Default is no reset.
Closes #733
2022-09-24 22:48:14 +02:00
MCUdude 62aa480876 Fix avr109 extended address
Closes #360 #454
2022-09-24 20:42:42 +02:00
Stefan Rueger 8f478f0098
Update NEWS 2022-09-24 13:29:04 +01:00
Stefan Rueger 9a59941dfe
Merge pull request #1100 from s-wakaba/sunxi_linuxspi_support
add extended parameter "disable_no_sc" for linuxspi programmer
2022-09-24 13:23:38 +01:00
Stefan Rueger 94203eb441
Merge pull request #1099 from stefanrueger/prog_modes
Print compatible parts for programmer and vice versa using -c? or -p?
2022-09-24 13:23:12 +01:00
Stefan Rueger f172f05372
Merge pull request #1096 from mariusgreuel/pr-cmake-texinfo
CMake: Build docs
2022-09-24 13:22:55 +01:00
Stefan Rueger 7743051926
Merge pull request #1095 from mariusgreuel/pr-fix-multiline-configure
CMake: Fix dependency chain between avrdude.conf.in and avrdude.conf
2022-09-24 13:22:37 +01:00
Stefan Rueger db8b04f423
Merge pull request #1094 from papazoga/main
avrdude.conf.in: Adds digilent-hs2 dongle
2022-09-24 13:22:14 +01:00
Stefan Rueger 3b8ac76246
Merge pull request #1093 from stefanrueger/gemmaBoot
Create two bootloader programmers for gemmaBoot boards
2022-09-24 13:21:44 +01:00
Stefan Rueger fe991b8214
Merge pull request #917 from asmirnou/iss45256-sysfs-gpio
Fix permission denied error in linuxgpio programmer
2022-09-24 13:21:08 +01:00
Stefan Rueger f17a012325
Update documentation for linuxspi extended parameter disable_no_cs 2022-09-24 00:16:55 +01:00
Stefan Rueger 097c78098d
Change printf() to avrdude_message() in linuxgio.c 2022-09-23 23:28:47 +01:00
Stefan Rueger ca154f812f
Improve error messaging in linuxspi.c 2022-09-23 16:53:52 +01:00
Stefan Rueger aa789d4662
Change error messages in linuxspi.c to maintain single style 2022-09-22 10:39:31 +01:00
Stefan Rueger 93df07866a
Inform user of -x disable_no_spi when needed (without -v) 2022-09-22 10:31:59 +01:00
Stefan Rueger d8ff9bef6c
Improve error messaging when part or programmer are invalid 2022-09-21 15:38:05 +01:00
Stefan Rueger 9e836d7988
Ensure avrdude.conf (programmer, part) pairs allow max one programming mode 2022-09-21 12:12:06 +01:00
Stefan Rueger 4c29edbc41
Warn if a part shares multiple programming modes with a programmer 2022-09-21 12:10:24 +01:00
Stefan Rueger 0175ffd21f
Shorten more redundant programmer description for -c \? -p part 2022-09-20 22:03:40 +01:00
Stefan Rueger 505d53c2e1
Shorten redundant for bootloader description in -c ? -p part output 2022-09-20 21:55:29 +01:00
Stefan Rueger b04a83b1a2
Document conditional options -c ? -p part and -p ? -c programmer 2022-09-20 21:39:15 +01:00
Stefan Rueger 97c5ac312a
Shorten redundant programmer description for -c \? -p part 2022-09-20 21:37:49 +01:00
Stefan Rueger 4070ca9012
Distinguish different JTAG programming modes 2022-09-20 18:36:46 +01:00
Shunichi Wakabayashi be40d3b260 add extended parameter "disable_no_sc" for linuxspi programmer 2022-09-20 01:32:12 +09:00
Stefan Rueger 07f1f60020 Make cosmetic changes to avrdude.conf.in 2022-09-16 19:10:39 +01:00
Stefan Rueger fba2ac0330 Align = of -p? and -c? output 2022-09-16 19:09:35 +01:00
Stefan Rueger 7a76967851 Clarify desc lines for SPM programmers in avrdude.conf.in 2022-09-16 16:14:18 +01:00
Stefan Rueger 669796119a Add prog_modes lines for par programmers in avrdude.conf.in 2022-09-16 16:13:18 +01:00
Stefan Rueger f8a62cca34
Print compatible parts for programmer and vice versa using -c? or -p?
For example:
 $ avrdude -p m328p -c?
 $ avrdude -p? -c jtag2dw
2022-09-14 23:00:57 +01:00
Stefan Rueger 0d411f2879
Add prog_modes lines for programmers in avrdude.conf.in 2022-09-14 18:36:37 +01:00
Stefan Rueger ac8fbadff4
Add assignment injection code for -c*/si 2022-09-14 18:04:12 +01:00
Stefan Rueger 7087fd9f3e
Raise info level for overwriting mcuid to MSG_DEBUG 2022-09-11 23:08:48 +01:00
Stefan Rueger 168a8b92e9
Default mcuid without warning for parts known at compile time 2022-09-11 15:33:23 +01:00
Stefan Rueger a5f3885b50 Add and modify programmers for gemmaBoot in avrdude.conf.in 2022-09-07 09:56:28 +01:00
Marius Greuel 8ecae62f4a CMake: Add install commands for docs 2022-09-04 17:48:12 +02:00
Marius Greuel c633255c01 CMake: Add initial support for texinfo docs 2022-09-04 16:55:16 +02:00
Marius Greuel 07ed4746be CMake: Fix dependency chain between avrdude.conf.in and avrdude.conf 2022-09-04 16:19:01 +02:00
Stefan Rueger b99df388bd
Change comment for diligent-hs2 in avrdude.conf.in 2022-09-01 13:08:44 +01:00
Alex Papazoglou bf70b5fc8c avrdude.conf.in: Cosmetic changes
Corrected formatting using /s. Added a URL for the
reference manual.
2022-08-31 20:43:27 -07:00
Alex Papazoglou 4af49bb5fb avrdude.conf.in: Adds digilent-hs2 dongle
Adds support for Digilint JTAG HS2 in MPSSE mode.
2022-08-31 11:45:08 -07:00
Stefan Rueger a536a01ebf
Create a bespoke bootloader programmer for gammaBoot trinkets 2022-08-31 18:15:35 +01:00
Stefan Rueger dab99c0823
Update NEWS 2022-08-31 17:35:03 +01:00
Stefan Rueger 0d1b49a4e4
Merge pull request #1091 from stefanrueger/config_file
Add new components in `avrdude.conf.in`
2022-08-31 17:27:05 +01:00
Stefan Rueger 602fab481c
Relax uniqueness check of mcuid for parts that might be variants
Two parts are considered variants here if one part name starts with the name
of the other, flash memory sizes are the same, flash page sizes are the same
and the number of interrupts are the same.
2022-08-31 11:59:19 +01:00
Stefan Rueger fc970226b6
Add avrintel.[ch] to Makefile.am 2022-08-31 11:31:58 +01:00
Stefan Rueger 40896802af
Allow integer expressions in config file where numbers are expected
Notable exceptions are for pin numbers and where numbers are separated by
space only, eg, in signature and readback assignments.
2022-08-31 11:29:06 +01:00
Stefan Rueger b328067f87
Remove has_jtag, has_debugwire, etc assignments in avrdude.conf.in
These assignments have been removed as they are redundant and only
imitate the single prog_modes = PM_... | PM_....; assignment. They
are still allowed in the grammar, and would still work.
2022-08-30 23:25:00 +01:00
Stefan Rueger ffb8b7fcdf
Try different header files for Windows compatibility 2022-08-30 21:31:11 +01:00
Stefan Rueger 4f7868ef4b
Declare rather than define extern const uPcore_t uP_table[372]; 2022-08-30 19:54:41 +01:00
Stefan Rueger 626a43b139
Add avrintel.[ch] to the project and warn if mcuid incompatible with avrintel.c 2022-08-30 19:48:17 +01:00
Stefan Rueger b0198a319f
Offload the programming interface info from part->flags to part->prog_modes
flags now just hold parameters of the JTAG interface and some secondary
serial, parallel, pseudo parallel info. This separation brings clarity. It
used to be hard to augur whether a part has an ISP interface:

   (part->flags & (AVRPART_HAS_PDI | AVRPART_AVR32 | AVRPART_HAS_TPI
    | AVRPART_HAS_UPDI)) == 0 && (part->flags & AVRPART_SERIALOK) != 0

or had HVSP or HVPP capability, for that matter. Now it is just, eg,

  part->prog_modes & PM_ISP
  part->prog_modes & PM_HVPP
2022-08-30 16:33:42 +01:00
Stefan Rueger 0756b8e3ad
Declare rather than define current_strct in header config.h 2022-08-30 02:49:37 +01:00
Stefan Rueger 0df8b87eda
Set part prog_modes, mcuid, n_interrupts and n_page_erase in avrdude.conf.in 2022-08-30 02:31:57 +01:00
Stefan Rueger ed2b8342df
Prepare for new components in avrdude.conf incl prog_modes
- Add prog_modes to part and programmer definitions; prog_mode is a bitwise
   or of programming modes
     + PM_SPM: Bootloaders, self-programming with SPM/NVM Controllers
     + PM_TPI: t4, t5, t9, t10, t20, t40, t102, t104
     + PM_ISP: SPI programming for In-System Programming (typ classic parts)
     + PM_PDI: Program and Debug Interface (xmega parts)
     + PM_UPDI: Unified Program and Debug Interface
     + PM_HVSP: High Voltage Serial Programming (some classic parts)
     + PM_HVPP: High Voltage Parallel Programming (most non-HVSP classic parts)
     + PM_debugWIRE: Simpler alternative to JTAG (a subset of HVPP/HVSP parts)
     + PM_JTAG: some classic parts, some xmega
     + PM_aWire: AVR32 parts
 - Add mcuid, a unique id in 0..2039, to part definition for urclock programmer
 - Add n_interrupts, the number of interrupts, to part definition
 - Add n_page_erase to part definition (# of pages erased during NVM erase)

 - Implement a simple calculator in config_gram.y so numeric values can be
   expressed as simple expressions such as PM_SPM | PM_UPDI

 - Introduce a new method of assigning simple components to the grammar without
   touching config_gram.y via an eligible-component list in config.c; numeric
   expressions on the rhs of an assignment resolve to integer values

 - Update documentation in avrdude.conf.in and avrdude.texi
2022-08-30 02:08:15 +01:00
Stefan Rueger eb7bdfd422
Merge pull request #1086 from stefanrueger/config_file
Rewrite avrdude.conf.in with developer options
2022-08-30 01:19:00 +01:00
Stefan Rueger cddf2943eb
Line up assignment operators in avrdude.conf.in 2022-08-30 01:10:45 +01:00
Stefan Rueger 0ccdd24d7e
Ensure arrays in developer_opts.c have at least one element 2022-08-24 13:50:07 +01:00
Stefan Rueger c97eb85cd8
Fix reset=dedicated|io; in avrdude.conf.in
Done by adding code in developer_opts.c that allows to inject part
or memory parameters into a semi-automated rewrite of avrdude.conf
This is a generic method, whereby an external program can, eg.,
scrape atdf files for the right parameters and put them into a
source table into developer_opts.c
  - Then write parts description with -p*/i
  - Use the output in a new avrdude.conf
  - Output again with -p* (no /i) and use that for final avrdude.conf
  - Remove table entries
2022-08-24 12:55:00 +01:00
Stefan Rueger 7fab75336e
Replace tabs in avrdude.conf.in with spaces 2022-08-24 11:46:24 +01:00
Stefan Rueger 716984dbb1
Reformat conditional programmers in avrdude.conf.in using -c* 2022-08-24 10:57:25 +01:00
Stefan Rueger 57ebd36a01
Rewrite avrdude.conf.in file from avrdude -c* -p* output
Some manual editing is still necessary to cater for the
@HAVE_PARPORT_BEGIN@ etc sections. This commit also fixes
superfluous whitesapce at the end of avrdude.conf.in lines

Although the avrdude.conf file has changed much, the internal
representation in avrdude has not. This can be verified by
exporting the raw internal data through

  avrdude -c*/r -p*/r >/tmp/avrdude.raw

before the change and by comparing again after the change:

  avrdude -c*/r -p*/r | diff - /tmp/avrdude.raw
2022-08-24 01:10:51 +01:00
Stefan Rueger 09d14601af
Fix 4 parts wrt to their interfaces in avrdude.conf 2022-08-24 00:54:11 +01:00
Stefan Rueger 3e49f078b3
Harden list management in pgm.c/config_gram.y 2022-08-24 00:03:45 +01:00
Stefan Rueger 731d581398
Update NEWS 2022-08-23 17:23:47 +01:00
Stefan Rueger 88c48cdf82
Merge pull request #1074 from stefanrueger/1073
Correct flash paged write for avrftdi.c
2022-08-23 17:09:46 +01:00
Stefan Rueger fc6ef68b98
Merge pull request #1083 from stefanrueger/1081
Make avr910 programmer initialize() less verbose
2022-08-23 17:08:23 +01:00
Stefan Rueger 61efb02ef8
Merge pull request #1078 from stefanrueger/terminal
Use const for programmer functions where useful
2022-08-23 17:06:53 +01:00
Stefan Rueger 5f910580b7
Extend const args to avr_set_*() and developer_opts.c
... and print programming modes for -p*/d
2022-08-23 16:57:49 +01:00
Stefan Rueger c6ef6a9b9b
Adapt indentation of a line in buspirate.c to neighbouring lines 2022-08-22 00:00:39 +01:00
Stefan Rueger c7951813ef
Make avr910 programmer initialize() less verbose 2022-08-21 23:49:54 +01:00
Stefan Rueger 56aae55737
Replace loop/if condition and reduce signed comparison warnings in avrftfi.c
Change (int) poll_index >= (int) addr to poll_index+1 > addr as the former
might turn out to be implementation-defined. The latter is always defined
and what we want here (poll_index+1 won't overflow). Originally, the
condition was poll_index > addr-1, which was always false for addr=0 owing to
2^n modulo arithmetic of unsigned.

Also changed a few comparisons so they no longer are between signed
and unsigned integers reducing compiler warnings.
2022-08-21 00:05:44 +01:00
Stefan Rueger f8dd9bc97d
Correct flash paged write for avrftdi.c 2022-08-20 14:08:04 +01:00
Stefan Rueger 38aa1313f9
Print device code in avr910.c as unsigned char 2022-08-19 23:14:19 +01:00
Stefan Rueger c03f4a7925
Use const in PROGRAMMER function arguments where appropriate
In order to get meaningful const properties for the PROGRAMMER, AVRPART and
AVRMEM arguments, some code needed to be moved around, otherwise a network of
"tainted" assignments risked rendering nothing const:

 - Change void (*enable)(PROGRAMMER *pgm) to void (*enable)(PROGRAMMER *pgm,
   const AVRPART *p); this allows changes in the PROGRAMMER structure after
   the part is known. For example, use TPI, UPDI, PDI functions in that
   programmer appropriate to the part. This used to be done later in the
   process, eg, in the initialize() function, which "taints" all other
   programmer functions wrt const and sometimes requires other finessing with
   flags etc. Much clearer with the modified enable() interface.

 - Move TPI initpgm-type code from initialize() to enable() --- note that
   initpgm() does not have the info at the time when it is called whether or
   not TPI is required

 - buspirate.c: move pgm->flag to PDATA(pgm)->flag (so legitimate
   modification of the flag does not change PROGRAMMER structure)

 - Move AVRPART_INIT_SMC and AVRPART_WRITE bits from the flags field in
   AVRPART to jtagmkII.c's private data flags32 fiels as FLAGS32_INIT_SMC and
   FLAGS32_WRITE bits

 - Move the xbeeResetPin component to private data in stk500.c as this is
   needed by xbee when it saddles on the stk500 code (previously, the flags
   component of the part was re-dedicated to this)

 - Change the way the "chained" private data are used in jtag3.c whilst
   keeping the PROGRAMMER structure read-only otherwise

 - In stk500v2.c move the STK600 pgm update from stk500v2_initialize() to
   stk500v2_enable() so the former keeps the PROGRAMMER structure read-only
   (for const assertion).

 - In usbasp change the code from changing PROGRAMMER functions late to
   dispatching to TPI or regular SPI protocol functions at runtime; reason
   being the decision whether to use TPI protocol is done at run-time
   depending on the capability of the attached programmer

Also fixes Issue #1071, the treatment of default eecr value.
2022-08-17 16:05:28 +01:00
Stefan Rueger dfef8bb0a8
Add libavrdude functions avr_mem_is_flash_type() and avr_mem_is_eeprom_type() 2022-08-15 14:57:12 +01:00
Stefan Rueger e332ecf0b4
Change array for copy mem->desc to const char * in term.c 2022-08-15 14:25:58 +01:00
Stefan Rueger a4bfa8247d
Update NEWS 2022-08-15 00:56:38 +01:00
Stefan Rueger 4c6ba0aae6
Merge pull request #1063 from sbngross/main
man-page: Fix logfile short option
2022-08-15 00:49:39 +01:00
Stefan Rueger 0b94ffdd3b
Merge pull request #1059 from stefanrueger/programmer-devopts
Implement -c <wildcard>/dev_options for printing programmer entries of avrdude.conf
2022-08-15 00:48:35 +01:00
Stefan Rueger 0987416387
Merge pull request #1056 from stefanrueger/dry-run
Implement a dry run for -U updates before opening the programmer
2022-08-15 00:46:06 +01:00
Stefan Rueger 297740db0e
Stop listing programmers where id starts with . 2022-08-13 22:57:54 +01:00
Stefan Rueger c9736a9db5
Specifying the full memory name now always works
... even if a memory with longer name and same initial part exists
2022-08-13 20:51:31 +01:00
brutzzl3r 266eb23207 man-page: Fix install dir
`avrdude.1` is installed into `man` dir instead of its proper section
location.
This is due to the definition of `TYPE MAN` which points to
`<DATAROOT>/man` according to cmake docs.

Use `DESTINATION` and add proper section subdir.

This allows for `man -M <YOUR INSTALL dir>/share/man -w 1 avrdude` to succeed
instead of throwing `No manual entry for avrdude in section 1`

Signed-off-by: brutzzl3r <s3b.gr0ss@gmail.com>
2022-08-12 19:49:47 +02:00
Stefan Rueger 533feec4ed
Revert grammar to remove introduced shift/reduce conflicts 2022-08-12 15:52:51 +01:00
Stefan Rueger 8420b27233
Address compiler warnings in 4 source files 2022-08-12 14:58:21 +01:00
Stefan Rueger c2c9053b13
Show comments with -p*/s or -c*/s and reduce -p */r raw output 2022-08-12 00:28:54 +01:00
brutzzl3r 346de71cd5 man-page: Fix logfile short option
man synopsis states [-n -logfile] option. Later on in avrdude.1 as well as in
main.c -l is used.
Also '-logfile' is no option alternative but a parameter.
This is a minor issue but still confusing when one uses / to search
through man pages.

-- Always leave the code cleaner than you found it --

Signed-off-by: brutzzl3r <s3b.gr0ss@gmail.com>
2022-08-11 20:11:48 +02:00
Stefan Rueger ccb576ebc1
Ensure memories are printed at most once for -p */S 2022-08-10 22:25:19 +01:00
Stefan Rueger c9cf308037
Include ctype.h in term.c to resolve missing functions 2022-08-10 16:24:39 +01:00
Stefan Rueger f4c5a8350d
Replace string arrays with const char * and allocated space (part 2)
This commit replaces fixed-string buffers in PROGRAMMER, AVRPART and AVRMEM
that are dealt with by the parser and grammar. Now, string assignments are
always to const char *, ie, these are read-only strings with arbitrary
length.

config_gram.y now only needs to consider one type of string assignment.

This commit also

  - Replaces the simple linear-search cache_string() function with faster
    hashed cache_string(). Either way, the returned value is likely to be
    shared, so should never be free()'d.

  - Duplicates hvupdi_support list in pgm_dup() and frees it in pgm_free()

  - Adds const qualifier to some function args in avrpart.c and pgm.c

  - Hardens some functions against being called with NULL pointers

  - Ensures _new() and _dup() functions for parts, programmers and memory
    return a suitable memory. Out of memory triggers exit in one of three
    functions, cfg_malloc(), cfg_realloc() and cfg_strdup(); there is
    rarely anything useful that AVRDUDE or, for that matter, any
    application compiled against libavrdude can do once you run out of
    memory as AVRDUDE/libavrdude rely heavily on allocation of memory.
2022-08-10 16:14:56 +01:00
Stefan Rueger 7375477f70
Replace string arrays with const char * and allocated space (part 1)
This commit deals with default_programmer, default_serial, default_parallel
and default_spi. The long term objective is to remove all fixed-size buffers
from the structures that lexer.l and config_gram.y deal with.
2022-08-10 11:36:17 +01:00
Stefan Rueger 22c4dbf23e
Harden string processing during parsing in lexer.l, config_gram.y and otherwise
- Replace strdup(s) with cfg_strdup(funname, s) that exits on out of mem
 - Replace malloc(n) with cfg_malloc(funname, n) that exits on out of mem
 - Change multiline string scanning in lexer.l to avoid core dump
 - Remove global variables string_buf and string_bug_ptr
 - Ensure reading strings unescapes strings C-Style
 - Ensure writing strings escapes strings C-Style again

Commit looks longer than needed as unescape() and auxiliary functions needed
to be moved from term.c (not in libavrdude) to config.c (in libavrdude).
2022-08-09 21:20:44 +01:00
Stefan Rueger 8a717987ec
Change unsigned short eecr; to unsigned char eecr; in libavrdude's AVRPART 2022-08-09 13:19:40 +01:00
Stefan Rueger 7c8d336e27
Change dev_info() to stdout and no longer redirect stderr to stdout 2022-08-09 09:23:26 +01:00
Stefan Rueger c21be27a7d
Replace const char array indexing with equivalent code in pindefs.c 2022-08-08 17:27:38 +01:00
Stefan Rueger 1da97f6825
Adjust declaration of locate_programmer_type_id() to definition 2022-08-08 17:21:21 +01:00
Stefan Rueger f25bc55806
Treat -c* the same as -c*/s 2022-08-08 17:03:06 +01:00
Stefan Rueger 49fcd8a96e
Implement -c */[sSA] (syntax-correct dump of programmer structure) 2022-08-08 16:52:09 +01:00
Stefan Rueger 075dee1dd3
Implement -c */r (raw dump of programmer structure) 2022-08-07 17:52:17 +01:00
Stefan Rueger 08049a40ea
Implement dev option -c */[ASsrt] skeleton
Also changed usbdev, usbsn, usbvendor and usbproduct components from
PROGRAMMER structure to be cached string pointers rather than fixed-size
arrays. These will be initialised by pgm_new() with a pointer to nul;
2022-08-07 14:06:04 +01:00
Stefan Rueger 81136688f6
Establish a third option to print out part definitions
Introduced -p <part>/A, which prints what -p <part>/S used to print, ie, all
components of the part structures including the default ones. Now -p <part>/S
prints the expanded part structure without use of parent and without printing
default values. This functionality is new and predominantly needed for
checking specific avrdude.conf entries, eg, avrdude -p*/St | grep pollindex

The option -p <part>/s continues to print a short entry of `avrdude.conf`
using its parent if so defined:

$ avrdude -p m328p/s

part parent "m328"
    desc                = "ATmega328P";
    id                  = "m328p";
    signature           = 0x1e 0x95 0x0f;
;
2022-08-07 08:53:24 +01:00
Stefan Rueger a8bbedcde3
Switch from strerror_r() to strerror() in update.c for portability 2022-08-06 00:20:43 +01:00
Stefan Rueger e681035cc4
Add strerror_r() and access() modes to MSVC compat file 2022-08-05 18:47:40 +01:00
Stefan Rueger e590aead93
Treat comparison of different signedness warning in fileio.c 2022-08-05 18:04:46 +01:00
Stefan Rueger b24a1cf667
Implement a dry run for -U updates before opening the programmer
This commit checks -U update requests for
  - Typos in memory names
  - Whether the files can be written or read
  - Automatic format detection if necessary

before opening the programmer. This to reduce the chances of the
programming failing midway through.

Minor additional changes:
  - Give strerror() system info when files are not read/writeable
  - Lift the auto detection message from MSG_INFO to MSG_NOTICE
  - Provide fileio_fmt_autodetect() in the AVRDUDE library
  - Rename fmtstr() in the AVRDUDE library to fileio_fmtstr() to
    avoid name clashes when an application links with it

Example:

$ avrdude -U - -U typo:r:.:h -U eeprom:w:testin:r -p ... -c ...
avrdude: can't auto detect file format for stdin/out, specify explicitly
avrdude: unknown memory type typo
avrdude: file . is not writeable (not a regular or character file?)
avrdude: file testin is not readable. No such file or directory
2022-08-05 17:38:59 +01:00
Stefan Rueger 5f5002eeaa Change name of update helper functions for print messages 2022-08-04 18:25:14 +01:00
Stefan Rueger 4eec8d15db Update NEWS 2022-08-04 18:19:43 +01:00
Stefan Rueger bdfeb0ad34
Merge pull request #1042 from dl8dtl/fix_1041
Handle invalid -U file format specifiers for input
2022-08-04 18:11:21 +01:00
Stefan Rueger ed36c7e1f6
Merge branch 'main' into fix_1041 2022-08-04 18:03:49 +01:00
Stefan Rueger 5f01d900f5
Merge pull request #1053 from stefanrueger/main
Enable stdin verification and display correct number of bytes written/verified
2022-08-04 17:58:15 +01:00
Stefan Rueger 3412196cd9 Weaken -U memory type check and move after config file parsing in main.c
The check for typos in -U memory names against a list of known memory names
now happens after the config files have been read, so newly declared memory
names can be considered. This commit also weakens the check against existence
of a known memory: it is now sufficent for a name to pass when it could be
the initial string of any known memory of any part. Any -U memory that cannot
possibly be matched up with a known memory is considered a typo and leads to
an exit before the programmer is opened.

This to protect users from typos that leave a device partially programmed.

When every -U memory name might be matching one of the known memories, the
programming is attempted. If the part to be programmed turns out not to have
a particular -U memory, AVRDUDE warns the user and skips this -U update.

This to support unifying interfaces that call AVRDUDE with potentially more
memories than the actual part has (eg, efuse on ATmega8).
2022-08-04 00:14:19 +01:00
Stefan Rueger 53ece53862 Update NEWS 2022-08-03 01:19:48 +01:00
Stefan Rueger 648f3319a9 Ignore target memories not present in part
$ avrdude -qp m8 -c ... -U efuse:w:0xff:m && echo OK

avrdude: AVR device initialized and ready to accept instructions
avrdude: skipping -U efuse:... as memory not defined for part ATmega8

avrdude done.  Thank you.

OK
2022-08-03 00:23:15 +01:00
Stefan Rueger 9604a3ef36 Check -U option for unknown memories during parsing
$ avrdude -qp ATmega2560 -c usbtiny -U flesh:w:blink-mega2560+lext-test.hex:i
avrdude: unknown memory type flesh
avrdude: error parsing update operation 'flesh:w:blink-mega2560+lext-test.hex:i'
2022-08-03 00:04:14 +01:00
Stefan Rueger 42c8169c37 Add ordered list of known memories to avr.c with access functions 2022-08-02 23:53:00 +01:00
Stefan Rueger 02027ab766 Enable stdin verification and display correct number of bytes written/verified
Counting the number of bytes written to a memory and/or verified is not
trivial owing to potential holes in the input file and to potential trailing
0xff bytes in flash memory that are not written per default (but see -A). The
new function memstats(), which is best called just after an input file has
been read into mem->buf/mem->tags, computes the right number of bytes written
and allows easy computation of the number of bytes verified.

This commit also changes the strategy for the default verification after
writing to a chip memory, so that the input file only needs reading once thus
enabling successful verification of stdin input files.

Other, minor changes:
 - Improving the grammar of AVRDUDE output, eg, 1 byte written instead of
   1 bytes written
 - Better description of the input file structure in terms of its sections,
   the interval it spans, the number  of pages, the number of padding bytes
   in pages, and the number of actually cut off trailing 0xff bytes for flash
 - Printing <stdin> or <stdout> instead of - in the -U routines
 - Option -V no longer needs to be specified before option -U in order to work

As an aside this commit also provides useful helper functions for printing
plural(), inname(), outname() and interval() all of which return strings fit
for printing.

$ avrdude -qp ATmega2560 -c usbtiny -U blink-mega2560+lext-test.hex

avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: input file blink-mega2560+lext-test.hex auto detected as Intel Hex
avrdude: reading input file blink-mega2560+lext-test.hex for flash
         with 1346 bytes in 4 sections within [0, 0x3106d]
         using 7 pages and 446 pad bytes
avrdude: writing 1346 bytes flash ...
avrdude: 1346 bytes of flash written
avrdude: verifying flash memory against blink-mega2560+lext-test.hex
avrdude: 1346 bytes of flash verified

avrdude done.  Thank you.

$ avrdude -qp ATmega328P -c usb-bub-ii -U sketch-ending-in-ff.hex

avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: input file sketch-ending-in-ff.hex auto detected as Intel Hex
avrdude: reading input file sketch-ending-in-ff.hex for flash
         with 2160 bytes in 1 section within [0, 0x888]
         using 17 pages and 16 pad bytes, cutting off 25 trailing 0xff bytes
avrdude: writing 2160 bytes flash ...
avrdude: 2160 bytes of flash written
avrdude: verifying flash memory against sketch-ending-in-ff.hex
avrdude: 2185 bytes of flash verified

avrdude done.  Thank you.

$ echo "Hello, world..." | avrdude -qp ATmega328P -c ... -U eeprom:w:-:r

avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file <stdin> for eeprom
avrdude: writing 16 bytes eeprom ...
avrdude: 16 bytes of eeprom written
avrdude: verifying eeprom memory against <stdin>
avrdude: 16 bytes of eeprom verified

avrdude done.  Thank you.
2022-08-02 23:26:01 +01:00
Stefan Rueger e91f73392c
Merge pull request #1048 from MCUdude/jtagmkii-updi
Add `jtagmkii_updi` programmer option
2022-08-02 18:32:12 +01:00
Stefan Rueger 310b801c59
Merge pull request #1046 from stefanrueger/stk500
Deprecate original STK500 v1 protocol in favour of optiboot and Arduino as ISP
2022-08-02 18:30:21 +01:00
Stefan Rueger 7f63632c6e
Merge pull request #1040 from stefanrueger/partdesc
Developer options to describe parts and extend avrdude.conf syntax
2022-08-02 18:27:42 +01:00
Stefan Rueger 18e5bfd203
Merge pull request #1033 from MCUdude/ignore-safemode-flag
Ignore `-s` flag as safemode is no longer supported
2022-08-02 18:26:58 +01:00
Stefan Rueger 33ae3719e3
Merge pull request #1031 from MCUdude/jtagmki-fuses-fix
Apply jtagmki patch provided in #443
2022-08-02 18:24:25 +01:00
Stefan Rueger 7730706498
Merge pull request #1030 from stefanrueger/ihexcomments
Provide file format I: Intel HEX with comments that ignores checksum errors
2022-08-02 18:23:23 +01:00
Stefan Rueger 5e9be93100
Merge pull request #1016 from ffontaine/main
CMakeLists.txt: fix build without C++
2022-08-02 18:22:16 +01:00
MCUdude de124bfd9b Improve error detection logic 2022-07-29 12:48:53 +02:00
Stefan Rueger f299439b97 Move developer_opts* file names from library section to main section for c/make 2022-07-27 00:18:06 +01:00
Stefan Rueger 004b46b594 Move useful CMDBIT/part functions from developer_opts.c to avrpart.c 2022-07-27 00:12:57 +01:00
Stefan Rueger 62dcc2e6e8 Declare useful CMDBIT/part functions of developer_opts.c in libavrdude.h 2022-07-26 23:55:42 +01:00
Stefan Rueger 78754b8ccc Add parent id output for developer options -p*/s for parts 2022-07-26 23:43:56 +01:00
MCUdude 104dcf6052 Add new jtagmkii_updi programmer type option
in order to resolve issue #1037
2022-07-26 11:36:50 +02:00
Stefan Rueger 1549273529 Add comments with part names to -p*/s output 2022-07-25 20:30:40 +01:00
Stefan Rueger d5d3a0e09e Improve help message -p/h for developer option -p 2022-07-24 23:38:51 +01:00
Stefan Rueger 3d06457a16
Deprecate original STK500 v1 protocol in favour of optiboot and Arduino as ISP
For paged read/write early AVRDUDE implementations of the STK500 v1 protocol
communicated a word address (below a_div=2) or byte address (a_div=1) based
on the following code irrespective of which memories were used:

  if(m->op[AVR_OP_LOADPAGE_LO] || m->op[AVR_OP_READ_LO])
    a_div = 2;
  else
    a_div = 1;

This turned out to be a bug: it really should have been a_div=2 for flash and
a_div=1 for eeprom. At the time presumably no one noted because Atmel was at
the cusp of replacing their FW 1.x with FW 2 (and the STK500 v2 protocol).

It seems that the world (optiboot, Arduino as ISP, ...) has compensated for
the bug by assuming AVRDUDE sends *all* eeprom addresses as word addresses.
Actually these programmers overcompensated for the bug because for six out of
the 146 known SPI programmable parts with eeprom and page size > 1, AVRDUDE
would still send the eeprom addresses as byte addresses (ATmega8 ATmega8A
ATmega64 ATmega64A ATmega128 ATmega128A) owing to above code.

It makes no sense to correct the bug now seeing that virtually no one uses
the old 2005 STK 500 v1 firmware. This commit now follows optiboot, Arduino
as ISP and other projects, and simply sends all addresses for paged read or
write as word addresses. There are no longer (little known) exceptions for
ATmega8 et al that surprised some optiboot etc users.
2022-07-24 20:39:14 +01:00
Stefan Rueger 29c6645abc
Resolve signed/unsigned comparisons in stk500.c and stk500v2.c 2022-07-24 19:41:42 +01:00
Stefan Rueger 535004ee3d
Consolidate error messages for stk500.c 2022-07-24 19:27:07 +01:00
Stefan Rueger 7310df030f
Check stk500_recv() actually worked before accepting SYNC byte 2022-07-24 18:48:22 +01:00
Stefan Rueger 4babe183da
Initialise memory before avr_set_bits() calls in stk500.c and stk500v2.c 2022-07-24 18:20:35 +01:00
Joerg Wunsch cc93bd2c83 Move the error handling for invalid file formats to fileio.c
The checks used to be in update.c, but as they are related to
the intended file operation, they are better placed in fileio.c.

The checks affected are to refuse 'm' on output (file write),
and 'd', 'h', 'o', and 'b' formats on input (file read).
2022-07-23 22:47:38 +02:00
MCUdude 248c17177c Mention -s and -u in the docs 2022-07-23 22:33:11 +02:00
Joerg Wunsch ce1ae41dd6 Document that 'h', 'o', and 'd' file formats are output-only. 2022-07-23 16:30:38 +02:00
Joerg Wunsch 26f431c944 Handle invalid -U file format specifiers for input
The file format specifiers 'h', 'd', 'o', and 'b' are only valid for
outputting data. Reject them with a proper error message when
attempting to use them for input.
2022-07-23 10:26:17 +02:00
Stefan Rueger 5a517fb74d Make developer opts portable: change statement exprs and index(); use size_t 2022-07-22 23:50:22 +01:00
Stefan Rueger a95d169ccc Warn whenever address bits in avrdude.conf SPI commands are misplaced 2022-07-21 23:11:44 +01:00
Stefan Rueger 02788fb48a Warn whenever address bits in avrdude.conf SPI commands miss 2022-07-21 22:43:08 +01:00
Stefan Rueger 572849ec2a Provide avr_set_addr_mem() to set addresses in SPI opcodes within boundaries
The function avr_set_addr_mem(AVRMEM *mem, int opnum, unsigned char *cmd,
unsigned long addr) is meant to replace avr_set_addr(OPCODE *op, unsigned
char *cmd, unsigned long addr) in future.

avr_set_addr_mem() has more information about the context of the task in that
it knows the memory size, memory page size, whether or not the memory is a
flash memory (which gets words addressees supplied) and, crucially, knows
which SPI operation it is meant to compute the address bits for.

avr_set_addr_mem() first computes the interval of bit numbers that must be
supplied for the SPI command to stand a chance to work. The function only
sets those address bits that are needed. Once all avr_set_addr() function
calls have been replaced by avr_set_addr_mem(), the SPI commands that need an
address can afford to declare in avrdude.conf all 16 address bits in the
middle two bytes of the SPI command. This over-declaration will be corrected
during runtime by avr_set_addr_mem(). One consequence of this is that parts
can inherit smaller or larger memories from parents without the need to use
different SPI codes in avrdude.conf. Another consequence is that
avr_set_addr_mem() can, and does, tell the caller whether vital address bits
were not declared in the SPI opcode. During parsing of avrdude.conf this
might be utilised to generate a corresponding warning. This will uncover
problematic SPI codes in avrdude.conf that in the past went undetected.
2022-07-21 21:42:07 +01:00
Stefan Rueger 55f6765ea5 Make more useful functions from developer_optc.c available 2022-07-21 18:47:48 +01:00
Stefan Rueger 192e118d2c Make useful functions from developer_optc.c available 2022-07-21 18:36:04 +01:00
Stefan Rueger 696574d1eb Replace !fnmatch(p, s, 0) with own part_match(p, s) 2022-07-21 18:04:41 +01:00
Stefan Rueger 4ada98a1a8 Udate the avrdude.conf introductory documentation 2022-07-20 00:57:35 +01:00
Stefan Rueger 6afa115a5f Make -p*/s print SPI opcodes like "0100.0000--000.aaaa--aaaa.aaaa--iiii.iiii" 2022-07-19 23:44:58 +01:00
Stefan Rueger 30041e3f5f Add compact alternative specification for SPI opcodes in avrdude.conf
As the address bit numbers in the SPI opcodes are highly systematic, they
don't really need to be specified. Each bit can therefore be described as one
of the characters 0 (always 0), 1 (always 1), x (don't care, but will be set
as 0), a (a copy of the correct bit of the byte or word address of read,
write, load, pagewrite or load extended address command of memories with more
than one byte), i (input bit for a load/write) or o (output bit from a read).
The bits therefore do not need to be individually separated.

If a string in the list of strings that describe an SPI opcode does *not*
contain a space *and* is longer than 7 characters, it is interpreted as a
compact bit-pattern  representation. The characters 0, 1, x, a, i and o will
be recognised as the corresponding bit, whilst any of the characters ., -, _
or / can act as arbitrary visual separators, which are ignored. Examples:

  loadpage_lo = "0100.0000--000x.xxxx--xxaa.aaaa--iiii.iiii";

  loadpage_lo = "0100.0000", "000x.xxxx", "xxaa.aaaa", "iiii.iiii";

  loadpage_lo = "0100.0000", "000x.xxxx.xxaa.aaaa", "iiii.iiii";

  loadpage_lo = "0100.0000-000x.xxxx--xxaa.aaaa-iiii.iiii";

  loadpage_lo = "0100.0000/000x.xxxx/xxaa.aaaa/iiii.iiii";

The compact format is an extension of the current format, which remains
valid. Both, the compact and the traditional specification can be mixed in
different strings, albeit not in the same string:

  load_ext_addr = "0100.1101", "0000.0000.0000", "0 0 0 a16", "0000.0000";
2022-07-19 22:59:46 +01:00
MCUdude bfdad78fcb Add EEPROM dummy read 2022-07-19 23:44:22 +02:00
Stefan Rueger db37c9d286 Extend rather than reset memory entries in avrdude.conf
This commit changes the philosophy whenever avrdude.conf encounters the
same memory of a part for the second time or whenever a memory is
described that, through inheritance, already existed: AVRDUDE no longer
zaps the memory, it rather extends it.

Therefore, avrdude.conf.in's entry for ATmega128RFA1, which inherits from
the ATmega2561, needs a line `load_ext_addr = NULL;` in its flash memory
description to zap the inherited load_ext_addr SPI command.

Other than this, avrdude.conf.in needs no other change in order to effect
the same internal representation proving earlier updates to the .conf.in
file correct that manually ensured inheritance of memory contents.
2022-07-19 20:00:17 +01:00
Stefan Rueger bdb5ba6055 Add avrdude.conf syntax ((pp|hvsp)_controlstack|(eeprom|flash)_instr) = NULL; 2022-07-19 16:16:55 +01:00
Stefan Rueger 1555906604 Add avrdude.conf syntax memory "name" = NULL; 2022-07-19 15:58:40 +01:00
Stefan Rueger 8503f2d2d5 Add avrdude.conf syntax opcode = NULL; for SPI programming 2022-07-19 15:38:54 +01:00
Stefan Rueger f8b6a246ef Add in lexer.l capability to scan negative decimal integers or reals 2022-07-19 15:17:00 +01:00
Stefan Rueger bb6e1bbaec Add avrdude.conf new syntax: readback = 0x80 0x7f; 2022-07-19 15:01:51 +01:00
Stefan Rueger 8da9c2bbf6 Correct bit number for lone 'a' in config_gram.y
When an SPI command has a lone 'a' the initialisation now is as would be
expected by all commands that take an address. Atmel's opcodes for SPI
programming are consistent in this respect. This commit makes specifying
the bit number in avrdude.conf optional. Instead of

 read_lo = "0 0 1 0 0 0 0 0  0 0 a13 a12 a11 a10 a9 a8  a7 a6 a5 a4 a3 a2 a1 a0  o o o o o o o o";

one can now use

 read_lo = "0 0 1 0 0 0 0 0  0 0 a a a a a a  a a a a a a a a  o o o o o o o o";
2022-07-19 14:46:08 +01:00
Stefan Rueger 8989e6515b Change macros __f() to _f() and adapt to config_file and hvupdi changes 2022-07-19 14:38:34 +01:00
Stefan Rueger 43e2955c61
Merge branch 'avrdudes:main' into partdesc 2022-07-19 13:20:25 +01:00
Stefan Rueger affe4cb50a
Merge pull request #1034 from stefanrueger/config_file
Cache config_file components in AVRPART and PROGRAMMER structures
2022-07-19 13:05:42 +01:00
Stefan Rueger 3b5a1f63c6
Merge branch 'avrdudes:main' into partdesc 2022-07-19 12:57:13 +01:00
Stefan Rueger 3c05fe6412
Merge branch 'avrdudes:main' into config_file 2022-07-19 12:33:12 +01:00
Stefan Rueger e52bd2b99b Move realpath() compatibility definition from config_gram.y to config.h 2022-07-19 08:05:42 +01:00
Stefan Rueger eba67e56fc Make realpath() available for MSC and MINGW32 2022-07-19 07:42:44 +01:00
Stefan Rueger f95a1d3448 Cache config_file components in AVRPART and PROGRAMMER structures
Some 90% of the space of AVRPART and some 50% of PROGRAMMER is occupied by a
4 kB array config_file[] that contains the configuration file name. In
preparation of developer options that output a raw dump of the part
descriptions, this commit changes the config_file components from a large
array, which is duplicated in each part and programmer description, to a
cached string for each config file allowing for smaller raw dumps.

This commit also changes the config file name to its realpath(), eg, shortens
unwarranted `/bin/../etc/` file name components. It also changes the global
variable names `infile` and `fileno` to cfg_infile and cfg_fileno for an ever
so slight improvement of code clarity.
2022-07-18 18:10:09 +01:00
Stefan Rueger 0e7c1512e4 Avoid the warning: enumeration value ‘CONNTYPE_SPI’ not handled in switch 2022-07-18 17:34:06 +01:00
MCUdude ec467c465e Ignore -s flag as safemode is no longer supported
Resolves #1032
2022-07-18 17:13:10 +02:00
Stefan Rueger 068e78e832
Merge branch 'avrdudes:main' into partdesc 2022-07-18 16:02:01 +01:00
Stefan Rueger 87401d341e
Merge branch 'main' into main 2022-07-18 15:56:43 +01:00
Stefan Rueger a5552f64cf Update NEWS 2022-07-18 14:38:37 +01:00
Stefan Rueger 6e5bf3bc8d
Merge pull request #1029 from stefanrueger/issue992
Fix usbtiny read/verify for parts with more than 64 kB flash
2022-07-18 14:32:15 +01:00
Stefan Rueger 494199fa78
Merge pull request #1025 from stefanrueger/terminal
Fix terminal write edge cases; add one read mode and add quell command
2022-07-18 14:30:45 +01:00
Stefan Rueger 6fa7400e4e
Merge pull request #1015 from MCUdude/hv-updi
Add support for high-voltage UPDI
2022-07-18 14:28:39 +01:00
Stefan Rueger 1d3a7591ea
Merge pull request #933 from MCUdude/linuxspi-default-port-fix
Fix linuxspi default port
2022-07-18 14:25:52 +01:00
MCUdude 5904611928 Apply jtagmki patch provided in #443 2022-07-17 12:51:43 +02:00
Stefan Rueger 79921e52dc Provide file format I: Intel HEX with comments that ignores checksum errors
The new file type I is essentially Intel HEX that, on download, inserts
comments next to data records with the resolved effective address and an
ASCII dump of that same record. On upload the `I` format is permissive
with respect to check sum errors, eg, after manipulated an Intel HEX file
for debugging.
2022-07-16 23:40:36 +01:00
Stefan Rueger d05ddd188d Fix usbtiny read/verify for parts with more than 64 kB flash
Usbtiny has a protocol or firmware problem that prevents it from reading
flash above 64 kB in page mode (used by -U flash:r:... and -U flash✌️...).
This commit fixes that problem by falling back on byte access for flash paged
reads above 64k. It also issues the correct load extended address command for
parts with more than 128 kB flash thus extending support to ATmega2560 et al.
2022-07-16 11:06:18 +01:00
Stefan Rueger e7e062ec05 Fix terminal line parsing for strings (to some extent) 2022-07-15 18:50:20 +01:00
Stefan Rueger 7ceb163cba Echo terminal command line on Apple 2022-07-14 18:31:44 +01:00
Stefan Rueger 14b27726d4 Protect terminal dump from vagaries of C libray implementation of isalpha() etc
Some C libraries assign true to isalpha(0xff), isdigit(0xff) or
ispunct(0xff), which means that the Operating System terminal sees a
character 0xff which it may not have a useful display character for.

This commit only outputs printable ASCII characters for an AVRDUDE
terminal dump reducing the risk of the OS terminal not being able
to print the character properly.
2022-07-14 17:16:30 +01:00
Stefan Rueger 5721908e63 Revert to double/float only in terminal write and clarify usage 2022-07-14 17:13:13 +01:00
MCUdude dde35018eb Exit if programmer can't send HV pulse to target 2022-07-13 23:49:14 +02:00
Stefan Rueger 901d49c4e6 Change terminal write usage message to accommodate long double 2022-07-13 12:37:10 +01:00
Stefan Rueger b02cce38d7 Added long double data type for terminal write 2022-07-13 12:25:09 +01:00
Stefan Rueger 0b3a5781fc Flush stderr and stdout with all terminal error messages
Error messages are written to stderr whilst normal terminal output is stdout.
When redirecting output to pipelines or files these two streams can get
separated as they are buffered separately. To avoid this, term.c now provides
a function terminal_message() that works just like avrdude_message() but
flushes stderr and stdout before printing on stderr, and it flushes stderr
afterwards.

This commit replaces all avrdude_message() calls except for progress report
with terminal_message() to ensure stdout and stderr streams keep together.
2022-07-13 11:48:29 +01:00
Stefan Rueger 1efbc64922 Add terminal_setup_update_progress() library interface to term.c
This enables the new quell terminal command to switch on and off progress
reports to the terminal. The code for this was moved from main.c to term.c.

It can be used as library call for other frontends than main.c
2022-07-13 11:38:43 +01:00
Stefan Rueger ea226936b7 Fix isspace() and other isxxx() calls in term.c 2022-07-13 11:19:21 +01:00
Stefan Rueger f8145ae1c4 Echo >>> terminal command line for Windows or non-libreadline 2022-07-12 21:53:37 +01:00
Stefan Rueger 5690352676
Merge branch 'avrdudes:main' into main 2022-07-12 18:19:57 +01:00
Stefan Rueger 3ef8122d90
Merge branch 'avrdudes:main' into partdesc 2022-07-12 18:19:17 +01:00
Stefan Rueger feb38b83ef
Merge branch 'avrdudes:main' into terminal 2022-07-12 18:18:39 +01:00
Hans dc6c10dc6c
Merge pull request #3 from janegilruud/hv-updi
Clean up and simplify hvupdi handling, and set default hvupdi_variant
2022-07-12 19:09:07 +02:00
Stefan Rueger c81f52ff10 Update NEWS 2022-07-12 15:52:37 +01:00
Stefan Rueger 09a95a3717
Merge pull request #936 from stefanrueger/issue918
Fix Issue #918: Enable avrdude to send full input file incl trailing 0xff
2022-07-12 15:34:17 +01:00
Stefan Rueger b6204b181a Provide echo of terminal command line prompt under Windows 2022-07-12 15:22:52 +01:00
Stefan Rueger 0edb77bdf8
Merge branch 'main' into issue918 2022-07-12 15:05:45 +01:00
Stefan Rueger 04f790ad85
Merge pull request #1018 from stefanrueger/issue995
Fix Issue #995 ft245r paged read for ATmega2560 et al
2022-07-12 14:55:44 +01:00
Stefan Rueger e867486f3f
Merge pull request #1023 from stefanrueger/issue1004
Fix PICKit2 ATmega2560 flash paged flash read
2022-07-12 14:51:56 +01:00
Stefan Rueger 1e8b56751e Add quell command in terminal
Sets the quell_progress global variable that can be, and is, consulted by
programmers.

Setting quell_progress to a positive number also switches off progress
bars. It is currently not possible to switch on progress bars again: that
is enabled in main.c once at the start of AVRDUDE.

That code in main should move to avr.c to enable report_update() to consult
quell_progress directly. Will do at another time when touching main.c and
avr.c. smr
2022-07-12 13:19:09 +01:00
Stefan Rueger d9cb9772d7 Fix verbosity level parsing in term.c 2022-07-12 12:30:29 +01:00
Stefan Rueger 63fb79accb Consolidate more error messages in term.c 2022-07-12 12:24:30 +01:00
Stefan Rueger f871a4dc1e Adapt capitalisation of comments in term.c to existing style 2022-07-12 12:02:43 +01:00
Stefan Rueger 7c766ef9bd Refine type detection in terminal write
The code no longer accepts valid mantissa-only doubles that are integer
rejects, eg, 078 or ULL overflows. These are most likely input errors by
the user: 8 is not an octal digit, they might have typed 17 hex digits,
not 16. It's just too hard to explain that 0xffffFFFFffffFFFFf writes
0x4430000000000000, which is the correct double representation of the
valid 17-digit hex mantissa that strtod() is perfectly happy to accept.
2022-07-12 12:01:14 +01:00
Stefan Rueger 704d253636 Remove comparisons between signed and unsigned integers in term.c 2022-07-12 11:59:42 +01:00
Stefan Rueger 8140c9c90b Consolidate error messages in term.c 2022-07-12 11:58:51 +01:00
Stefan Rueger 56113f6d8a Remove echo of tokenised terminal command 2022-07-12 11:51:04 +01:00
Stefan Rueger c5f522342d Improve terminal help message 2022-07-12 11:50:23 +01:00
Stefan Rueger 92425af0cc Improve terminal dump usage message 2022-07-12 11:47:33 +01:00
Stefan Rueger 602e9bb80c Change size for memory type variable in terminal read 2022-07-12 11:44:20 +01:00
Stefan Rueger 7205bbae80 Enhance terminal read with new mode: read <memory> <addr> 2022-07-12 11:43:45 +01:00
Stefan Rueger aa09bcf900 Ensure terminal writes little endian numbers 2022-07-12 11:42:59 +01:00
Stefan Rueger ddffabe86a Improve terminal write usage message 2022-07-12 11:40:40 +01:00
Stefan Rueger 0b2f38c67d Allow optional comma separators for data items in terminal write 2022-07-12 11:39:52 +01:00
Stefan Rueger 5c4cfa642a Parse terminal writes of string and character constants in C-style 2022-07-12 11:39:02 +01:00
Stefan Rueger 9fe6820236 Add double type for terminal write in anticipation of future avr-libc extension 2022-07-12 11:36:57 +01:00
Stefan Rueger feda75b60a Remove unnecessary bool is_float in terminal write 2022-07-12 11:35:27 +01:00
Stefan Rueger 51355d04fb Remodel logic of the size that integer items occupy in terminal write
Integers can be hexadecimal, decimal or octal. An optional case-insensitive
suffix specifies their size: HH: 8 bit, H/S: 16 bit, L: 32 bit, LL: 64 bit

An optional U suffix makes a number unsigned. Ordinary 0x hex numbers are
always treated as unsigned. +0x or -0x hex numbers are treated as signed
unless they have a U suffix. Unsigned integers cannot be larger than 2^64-1.

If n is an unsigned integer then -n is also a valid unsigned integer as in C.

Signed integers must fall into the [-2^63, 2^63-1] range or a correspondingly
smaller range when a suffix specifies a smaller type. Out of range signed
numbers trigger a warning.

Ordinary 0x hex numbers with n hex digits (counting leading zeros) use
the smallest size of 1, 2, 4 and 8 bytes that can accommodate any n-digit hex
number. If a suffix specifies a size explicitly the corresponding number of
least significant bytes are written. Otherwise, signed and unsigned integers
alike occupy the smallest of 1, 2, 4, or 8 bytes needed to accommodate them
in their respective representation.
2022-07-12 11:32:38 +01:00
Stefan Rueger 62d3eebd56 Fix 64-bit integer terminal write where high bit set
Using strtoll() can only return numbers in the range [-2^63, 2^63-1]. This
means that 0xffffFFFFffffFFFF (2^64-1) will be out of range and is written as
max LL. Actually, every 64-bit number with high-bit set will wrongly be
written as max LL.

This commit uses strtoull() instead to fix this, and checks for unsiged out-
of-range error. strtoull() also has the neat benefit that input with a minus
sign is treated like C unsigned numbers, ie, -u is also a valid unsigned
number if only u is one. In case the input is meant to be treated as signed,
it is therefore still OK to use strtoull() in the first instance only that in
this case a second check against the range of the signed domain is necessary.
2022-07-12 11:19:47 +01:00
Stefan Rueger 9afa56381e Remove unused component is_signed in terminal write 2022-07-12 11:19:05 +01:00
Stefan Rueger ff43e0544d Correct a parse message in terminal write 2022-07-12 11:18:15 +01:00
Stefan Rueger 177834ae7c Ensure enough memory is allocated for buf in terminal write 2022-07-12 11:16:16 +01:00
Stefan Rueger d3ad078577 Ensure terminal write fill mode ... always fills with last data item 2022-07-12 11:15:30 +01:00
Stefan Rueger 39a00bc71e Ensure +0x...f does not strip suffix f in terminal write 2022-07-12 11:14:41 +01:00
Stefan Rueger 360d7c502b Make suffix fully case insensitive (allow Hh, Ll, ...) in terminal write 2022-07-12 11:13:46 +01:00
Stefan Rueger d9450058c8 Cache strlen(argv[i]) in term.c cmd_write() and prevent negative array index 2022-07-12 11:12:20 +01:00
Jan Egil Ruud 69ee5da613 Improve error handling for devices that does not support HVUPDI. 2022-07-12 12:01:17 +02:00
Jan Egil Ruud 2478c18745 Do not let the hvupdi extended option take any configuration values. The hvupdi type is implied by the part configuration. 2022-07-11 15:26:41 +02:00
Jan Egil Ruud 173b4f9d0a Clean up and simplify hvupdi handling, and set default hvupdi_variant to -1. 2022-07-11 14:07:45 +02:00
Stefan Rueger ff8f519a34 Fix PICKit2 ATmega2560 flash paged flash read
The paged read in pickit2.c has two errors:
  - It drops load extended address commands unless a paged read happens at a
    64k byte boundary; this is invalid when reading files with holes
  - It wrongly assumed that flash memory is byte addressed

The fix is to carry out a load extended address command, if needed, at the
beginning of each paged flash read with the correct word address. Although the
pickit2_paged_load() has independent parameters page_size, addr and n_bytes,
AVRDUDE only ever calls paged read/write functions with page_size and n_bytes
both set to mem->page_size and addr aligned with a page boundary. Therefore, it
is sufficient to set the load extended address at the beginning of each page
read.
2022-07-10 23:41:44 +01:00
Hans 913509d6e6
Merge pull request #2 from janegilruud/hv-updi
Add HVUPDI_SUPPORT list for programmers.
2022-07-07 20:12:43 +02:00
Stefan Rueger 215ea1af5c Merge branch 'partdesc' of github.com:stefanrueger/avrdude into partdesc 2022-07-07 18:34:26 +01:00
Stefan Rueger 9e2cea3ada Implement developer options -p */[*cdosSrwt] for part descriptions 2022-07-07 18:32:19 +01:00
Jan Egil Ruud 91310e6f50 Move hvupdi_support list to a new prog_parm_updi group, and initialize the list. 2022-07-07 12:23:05 +02:00
Ruud, Jan Egil 9e5ea25b9e Add HVUPDI_SUPPORT list for programmers. 2022-07-05 14:14:37 +02:00
Stefan Rueger 64ee4858fd Update 2nd debug message in avr.c with correct function name 2022-07-05 01:00:45 +01:00
Stefan Rueger d3b22fa3c6 Update debug message in avr.c with correct function name 2022-07-05 00:57:40 +01:00
Stefan Rueger 9742c7b97a Add #474 and #976 to NEWS 2022-07-05 00:55:58 +01:00
Stefan Rueger 00ea21597e
Merge pull request #1001 from MCUdude/add-missing-bits-and-pieces
Add missing delays in avrdude.conf
2022-07-05 00:05:32 +01:00
Stefan Rueger 9ea02c4431
Merge pull request #998 from stefanrueger/issue474
Fix Issue #474 FT232H support for ATmega2560 et al (load extended address)
2022-07-05 00:00:54 +01:00
Stefan Rueger 2b6ee8f4d1 Adapt whitespace to existing style in avrftdi.c 2022-07-04 23:54:02 +01:00
Stefan Rueger 7aad03cbcd Fix paged read for ATmega2560 et al for ft245r.c 2022-07-04 23:11:32 +01:00
Stefan Rueger a721e485cb Refactor paged read/write routines in ft245r.c 2022-07-04 23:04:36 +01:00
Stefan Rueger bb049a085e Merge branch 'issue474' of github.com:stefanrueger/avrdude into issue474 2022-07-04 12:31:11 +01:00
Stefan Rueger 237cb63211 Steamline avrftdi support for ATmega2560 et al 2022-07-04 12:30:37 +01:00
Stefan Rueger 2827c2695e Update NEWS 2022-07-04 12:30:37 +01:00
Joerg Wunsch bdab12d8fb PR 996 and 1013 done 2022-07-04 12:30:37 +01:00
MCUdude d2bb964fc7 Attempt to fix EEPROM write issue #1009 2022-07-04 12:30:37 +01:00
Joerg Wunsch f22b81c00e Fix a number of logic errors in the previous commits
RSP3_FAIL_CRC_FAILURE is 0x43 rather than 0x47.

jtag3_errcode() must only be applied to a reason code, not
to any general status code.
2022-07-04 12:30:37 +01:00
Joerg Wunsch 8953967fc3 Replace internal knowledge in jtag3.c by a public API
In certain situations (CRC failure, device locked), that JTAG3
read functions need to return an indication to the caller that
it is OK to proceed, and allow erasing the device anyway.

Historically, the JTAG3 code passed the respective protocol
errors directly (and unexplained) up to the caller, leaving
the decision to the caller how to handle the situation.

Replace that by a more common return value API. New code should
prefer this API instead of any hardcoded return values.
2022-07-04 12:30:37 +01:00
Stefan Rueger ef785a617a Treat x bits in .conf SPI commands as 0 2022-07-04 12:30:37 +01:00
Joerg Wunsch ad2be990b7 PR 993 done 2022-07-04 12:30:37 +01:00
prchal 134509cc6f adding support for all Linux baud rates v.2
If optiboot can work at higher bauds, why not avrdude.
Versoin 2 of #985.
Linux uses the old-style bitmapped version of the Bxxxx macros.
2022-07-04 12:30:37 +01:00
Joerg Wunsch 8bd39157c1 Closing PR 979 2022-07-04 12:30:37 +01:00
MCUdude 963a1e54af Fix JTAG transaction close issue
Fixes issue #366
2022-07-04 12:30:37 +01:00
Joerg Wunsch 37026cad52 PR #1000 is done now 2022-07-04 12:30:37 +01:00
MCUdude b167e88422 Reduce programmer description string length
to less than 80 characters. #941 related
2022-07-04 12:30:37 +01:00
Stefan Rueger 3893a21164 Fix avrftdi support for ATmega2560 et al (load extended address) 2022-07-04 12:30:25 +01:00
Stefan Rueger d95c1a91f7 Steamline avrftdi support for ATmega2560 et al 2022-07-04 12:25:50 +01:00
Stefan Rueger c4add116d6
Merge branch 'avrdudes:main' into issue474 2022-07-04 10:07:05 +01:00
MCUdude 6473a6d71a Add avrdude_message to verbose mode 2022-07-01 07:36:07 +02:00
MCUdude 30c1b31b8d Send 12V pulse to HV_UPDI_VARIANT_2 targets as well 2022-06-29 17:12:57 +02:00
Ruud, Jan Egil 65763b5700 Correct hvupdi_variant for AVR DD devices. 2022-06-29 17:12:57 +02:00
Ruud, Jan Egil 39008ac2c1 Add UPDI HV type to device description. 2022-06-29 17:12:57 +02:00
MCUdude 577856cf15 Use HV UPDI constants rather than arbitrary numbers 2022-06-29 17:12:57 +02:00
MCUdude 50220289bb Add high-voltage UPDI info to docs 2022-06-29 17:12:57 +02:00
MCUdude e068341716 Make sure "-x hvupdi" is only valid for Pickit4 and Powerdebugger 2022-06-29 17:12:57 +02:00
MCUdude f67c35744e add support for "-x hvupdi" that triggers HV UPDI 2022-06-29 17:12:57 +02:00
MCUdude ba98e48880 add "hvupdi_variant" property to avrdude.conf 2022-06-29 17:12:52 +02:00
Stefan Rueger 0240b361f5
Merge branch 'avrdudes:main' into partdesc 2022-06-28 22:53:22 +01:00
Stefan Rueger 66c69a7584
Merge pull request #943 from stefanrueger/issue942
Fix Issue #942: Treat x bits in .conf SPI commands as 0
2022-06-28 22:50:53 +01:00
Stefan Rueger 43c6b04226 Update NEWS 2022-06-28 22:46:06 +01:00
Stefan Rueger a21f3d20af
Merge branch 'avrdudes:main' into issue942 2022-06-28 22:38:47 +01:00
Joerg Wunsch a6ea797c1c PR 996 and 1013 done 2022-06-28 22:53:24 +02:00
Jörg Wunsch 8cd6f357b1
Merge pull request #1013 from MCUdude/jtag3-eeprom-fix
JTAG3 UPDI EEPROM fix
2022-06-28 22:36:19 +02:00
Jörg Wunsch 7ec51a5185
Merge pull request #996 from dl8dtl/jtag3_retcode
Replace internal knowledge in jtag3.c by a public API

Supersedes #982
2022-06-28 22:21:50 +02:00
Stefan Rueger 09c168a186
Merge branch 'avrdudes:main' into issue942 2022-06-28 20:56:49 +01:00
Stefan Rueger d8a30aa8c4
Merge branch 'avrdudes:main' into partdesc 2022-06-28 20:44:34 +01:00
Stefan Rueger 3bd75e74c6 Move developer options into own source file and expand part description -p \*
-p \*/c  check address bits in SPI commands
  -p \*/d  description of core part features
  -p \*/o  opcodes for SPI programming parts and memories
  -p \*/s  show avrdude.conf entries of parts
  -p \*/ss show full avrdude.conf entry as tab separated table
  -p \*/w  wd_... constants for ISP parts
  -p \*/\* all of the above except -p \*/s
  -p \*    same as -p\*/\*
2022-06-28 20:34:31 +01:00
Stefan Rueger cef3abac14
Merge branch 'avrdudes:main' into issue474 2022-06-26 23:54:43 +01:00
Joerg Wunsch 362e6993ac PR 993 done 2022-06-26 23:00:32 +02:00
Jörg Wunsch 6d1c83e182
Merge pull request #993 from prchal/patch-1
adding support for all Linux baud rates
2022-06-26 22:59:49 +02:00
Joerg Wunsch 1b997968a5 Closing PR 979 2022-06-26 22:58:25 +02:00
Jörg Wunsch 55dddc57cc
Merge pull request #979 from MCUdude/dragon-jtag-fix
Dragon JTAG fix: restart firmware after programming
2022-06-26 22:53:32 +02:00
Fabrice Fontaine 17509d2ef4 CMakeLists.txt: fix build without C++
Fix the following build failure without a C++ compiler:

CMake Error at CMakeLists.txt:24 (project):
  No CMAKE_CXX_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2022-06-26 21:35:42 +02:00
Stefan Rueger 0a7f2645c9 Merge branch 'partdesc' of github.com:stefanrueger/avrdude into partdesc 2022-06-26 15:15:37 +01:00
Stefan Rueger 54d590b9c1
Merge branch 'avrdudes:main' into issue474 2022-06-26 15:12:17 +01:00
Stefan Rueger 317cc6d492 Add part type to -p \* .desc output 2022-06-26 15:10:19 +01:00
Stefan Rueger 40425ffac4
Merge branch 'avrdudes:main' into partdesc 2022-06-26 14:49:07 +01:00
Hans 8159c46013
Merge branch 'avrdudes:main' into hv-updi 2022-06-25 22:47:27 +02:00
MCUdude 89b0aa72e0 Attempt to fix EEPROM write issue #1009 2022-06-25 11:39:16 +02:00
Joerg Wunsch ae0e3e2f8e Fix a number of logic errors in the previous commits
RSP3_FAIL_CRC_FAILURE is 0x43 rather than 0x47.

jtag3_errcode() must only be applied to a reason code, not
to any general status code.
2022-06-22 23:33:53 +02:00
Joerg Wunsch 1aa59aaa98 PR #1000 is done now 2022-06-19 19:56:56 +02:00
Jörg Wunsch 6b5ca522d7
Merge pull request #1000 from MCUdude/reduce-str-length
Reduce programmer desc string length in avrdude.conf to < 80 characters
2022-06-19 19:56:02 +02:00
MCUdude 692c13ed98 Add missing chip erase delay for ATmega48/88/168/328PB 2022-06-19 19:40:31 +02:00
MCUdude aa211f7580 Add missing efuse write delay for ATmega169/A/P/PA and ATmega328P 2022-06-19 19:23:34 +02:00
MCUdude 3b0a2abc20 Reduce programmer description string length
to less than 80 characters. #941 related
2022-06-19 10:53:07 +02:00
Stefan Rueger c8350f816c Fix support for ATmega2560 et al (load extended address) 2022-06-18 22:34:54 +01:00
Joerg Wunsch 3082630430 Replace internal knowledge in jtag3.c by a public API
In certain situations (CRC failure, device locked), that JTAG3
read functions need to return an indication to the caller that
it is OK to proceed, and allow erasing the device anyway.

Historically, the JTAG3 code passed the respective protocol
errors directly (and unexplained) up to the caller, leaving
the decision to the caller how to handle the situation.

Replace that by a more common return value API. New code should
prefer this API instead of any hardcoded return values.
2022-06-15 23:32:22 +02:00
Marius Greuel cb114233ef
Mention PR #945, #962, #972 2022-06-10 20:38:54 +02:00
Marius Greuel 3148b31e01
Merge pull request #972 from earies/cmake-libdir-fix
Fix src/CMakeLists.txt to honor CMAKE_INSTALL_LIBDIR
2022-06-08 21:53:22 +02:00
Marius Greuel fc9d640f0b
Merge pull request #945 from mariusgreuel/pr-micronucleus-macos-usb-issue
Fix micronucleus bootloader to check for unresponsive USB devices
2022-06-08 21:46:40 +02:00
Marius Greuel d9f8fded51
Merge pull request #962 from mariusgreuel/pr-cmake-enhancements
CMake Enhancements
2022-06-08 17:32:54 +02:00
prchal bd8c17b35f
adding support for all Linux baud rates v.2
If optiboot can work at higher bauds, why not avrdude.
Versoin 2 of #985.
Linux uses the old-style bitmapped version of the Bxxxx macros.
2022-06-07 11:50:03 +02:00
MCUdude bdb4128de3 Fix JTAG transaction close issue
Fixes issue #366
2022-05-30 19:22:20 +02:00
Joerg Wunsch feaa1c6a6b PR 950 done 2022-05-30 07:02:38 +02:00
Jörg Wunsch 5695b0d55a
Merge pull request #950 from hallard/patch-1
fix M1 homebrew path
2022-05-30 07:00:38 +02:00
Stefan Rueger 952ad72fb9 Add -p \* to summarise properties of parts in conf 2022-05-24 16:56:11 +01:00
Ebben Aries 3b0d7e5d5d
Fix src/CMakeLists.txt to honor CMAKE_INSTALL_LIBDIR 2022-05-21 14:25:27 -06:00
Marius Greuel 65bb41f8e9 CMake: Add build option to select static or shared libraries 2022-05-11 21:08:05 +02:00
Marius Greuel 0ea4b08b2f CMake: If installed, use static version of libreadline for MSYS2 2022-05-11 21:02:03 +02:00
Marius Greuel 053c2dcdd3 CMake: Include GCC specific options also for MSYS2 2022-05-11 20:57:14 +02:00
Marius Greuel 8b61c9dd8f CMake: Move MSVC compatibility shim into library 2022-05-11 20:56:05 +02:00
Marius Greuel 15fe12b1a9 Add CMakeSettings.json for Visual Studio 2022 2022-05-09 15:42:48 +02:00
Marius Greuel b8420ee52d Update GitHub deploy action 2022-05-09 15:42:48 +02:00
Marius Greuel 6ebbd4e162 Update README.md 2022-05-09 15:42:48 +02:00
Marius Greuel 4b2bf38849 Add support for COM port discovery via USB VID/PID Add support for Leonardo USB bootloader auto-reset 2022-05-09 15:41:06 +02:00
Marius Greuel 9d6420e723 Correct endpoint direction for control messages of USBtinyISP devices 2022-05-09 15:41:06 +02:00
Marius Greuel bc9b67a153 Change Intel HEX line length from 32 to 16 to match line length of avr-objcopy 2022-05-09 15:41:06 +02:00
Marius Greuel 93b2a56c0e Change program URL to github.com 2022-05-09 15:41:06 +02:00
Charles a23055d648
fix typo 2022-05-09 14:51:16 +02:00
Charles 75bfbf7bef
fix M1 homebrew path 2022-05-09 02:02:42 +02:00
Joerg Wunsch 4601bee4af Mention PR 949 2022-05-08 20:39:12 +02:00
Jörg Wunsch 5f091a6c1c
Merge pull request #949 from subnut/manpage
Fix `.Dd` macro in manpage
2022-05-08 18:20:09 +02:00
Subhaditya Nath b9a012cebb Fix .Dd macro in manpage
The correct format for .Dd according to mdoc(7) is -

	.Dd month day, year
2022-05-08 20:35:32 +05:30
Jörg Wunsch 1797c62c25
Merge pull request #948 from avrdudes/7.0-branch
Correctly name the release in CMakeLists.txt as well
2022-05-08 14:06:18 +02:00
Joerg Wunsch d6347f4187 Correctly name the release in CMakeLists.txt as well 2022-05-08 14:00:53 +02:00
Joerg Wunsch a855692d97 Correctly name the release in CMakeLists.txt as well 2022-05-08 13:58:44 +02:00
Joerg Wunsch 9bc28d410e Post-7.0 changes
Update version date in configure.ac.
Update template in NEWS
2022-05-07 22:57:49 +02:00
Joerg Wunsch ec50337434 Correctly name the release in NEWS 2022-05-07 22:39:47 +02:00
Joerg Wunsch a2e456ca8a v7.0 release preparation 2022-05-07 22:20:31 +02:00
Joerg Wunsch 43ddea9102 Calibration memory of ATtiny43U is only 1 byte
Closes issue #921.
2022-05-05 22:58:45 +02:00
Marius Greuel 01a9e42d7d Fix typo in micronucleus message 2022-05-05 22:08:46 +02:00
Marius Greuel c64f2030a1 Improve micronucleus bootloader user experience for unresponsive USB devices 2022-05-05 21:42:27 +02:00
Marius Greuel 3bdf138721 Fix micronucleus bootloader to check for unresponsive USB devices 2022-05-05 20:45:47 +02:00
Joerg Wunsch a4c9fcdcd7 More fixes for PR #915 2022-05-02 22:51:22 +02:00
Joerg Wunsch 28ccd82edc PR 930 931 issue 927 are done 2022-05-01 22:32:54 +02:00
Jörg Wunsch ca16fc2ce6
Merge pull request #930 from cederom/cederom-programmer-avrftdi-ktlink
Added KT-LINK FT2232H interface with IO switching and voltage buffers.
2022-05-01 22:29:46 +02:00
Jörg Wunsch d7c59ca2f9
Merge pull request #931 from MCUdude/linuxspi-baud-fix
Fix linuxspi baud to clock period calculation
2022-05-01 22:26:23 +02:00
Joerg Wunsch 4bcd0eaa1d Fix a number of mistakes in avrdude.conf.in
Stefan Rueger found a lot of mistakes in this file.

Closes #915
2022-05-01 21:55:50 +02:00
Stefan Rueger 033b2ed796 Treat x bits in .conf SPI commands as 0 2022-04-29 00:37:28 +01:00
Stefan Rueger 580c37fbfe Describe -A in the man and .texi documentation 2022-04-29 00:14:45 +01:00
Stefan Rueger f47ec634f8 On verify always verify full input file 2022-04-28 17:53:10 +01:00
Stefan Rueger 52734bafc6 Add option -A to separately disable trailing-0xff removal 2022-04-28 17:29:06 +01:00
Stefan Rueger 52b20f4a28 Provide self-documenting API for disabling trailing-0xff removal 2022-04-28 17:26:09 +01:00
Stefan Rueger 2397984d2b Disable trailing-0xff removal when invoking arduino programmer 2022-04-27 18:54:13 +01:00
Joerg Wunsch 08ad5ea445 Fix broken texinfo
@ must be escaped as @@
2022-04-26 23:19:20 +02:00
Joerg Wunsch 5a3ff78844 Fix syntax error in workflow build.yml file 2022-04-26 21:41:03 +02:00
Joerg Wunsch 74a92d7991 Try to exclude the 'onlinedocs' branch from actions
There's no sourcecode within that branch, anyway.
2022-04-26 21:29:46 +02:00
Stefan Rueger e18d436f88 Move evaluating 'is flash' from caller to callee avr_mem_hiaddr() 2022-04-15 20:48:46 +01:00
Stefan Rueger ed38456f83 Piggy-back 'Do not remove trailing 0xff' onto option -D 2022-04-15 20:46:40 +01:00
MCUdude 6fceea8f71 Fix linuxspi default port
If no port is specified, Avrdude will try to use the default port specified in avrdude.conf. If not present, use port specified in linuxspi.c
2022-04-11 22:28:12 +02:00
MCUdude 9d025e6a70 Fix linuxspi baud to clock period calculation
#927 related
2022-04-10 23:36:53 +02:00
Tomasz 'CeDeROM' CEDRO b99a145b9f Added KT-LINK FT2232H interface with IO switching and voltage buffers.
Example TPI run: https://github.com/avrdudes/avrdude/issues/928

Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
2022-04-10 22:28:44 +02:00
Joerg Wunsch 60960ba590 Closed 922, 924, 929 2022-04-10 22:20:11 +02:00
Jörg Wunsch 99a75701b1
Merge pull request #924 from MCUdude/terminal-overflow-fix
Fix terminal write buffer overflow issue
2022-04-10 22:19:27 +02:00
Jörg Wunsch abe7180bb8
Merge pull request #929 from per1234/update-docs-link
Update documentation link to new URL
2022-04-10 22:15:23 +02:00
per1234 157b6a63c1
Update documentation link to new URL
The project documentation is now hosted on GitHub pages. Pointing the documentation link to the documentation site home page will offer the reader easy access to the documentation for the latest and previous releases while also avoiding the maintenance burden of updating the readme on every release
2022-04-10 11:28:39 -07:00
MCUdude 1363c7fe76 Fix buffer overflow issue
when in terminal fill mode
2022-04-09 20:08:44 +02:00
Joerg Wunsch 7e26a15375 PRs/Issues 900, 901, 913, 914 done 2022-04-05 20:55:23 +02:00
Jörg Wunsch e84210c6b0
Merge pull request #914 from MCUdude/terminal-write-str
Add terminal write string functionality
2022-04-05 20:54:20 +02:00
MCUdude 08bd5fa938 Add string write to terminal example 2022-04-05 19:37:45 +02:00
MCUdude 17b67da03e Make sure memory can be filled with a string
... and not just the last character
2022-04-04 09:38:02 +02:00
Alexander Smirnov 3dc1e4e72b Wait and retry until deplayed udev permission rule applies after exporting gpio pin 2022-04-03 20:29:56 +01:00
MCUdude 795dd91575 Code cleanup + formatting 2022-04-01 22:23:55 +02:00
MCUdude 8f100f5df3 Initial support for string write 2022-04-01 21:57:53 +02:00
MCUdude f0f9059ade Tweak nexttok for better string handling
Now a string that starts and ends with a quote (") is combined into a single (argc) argument rather than being split where spaces used to be
2022-04-01 16:52:59 +02:00
Nav e069871c8e
Increased timeout passed to hid_read_timeout() - set to 10000 for consistency (#901) 2022-03-31 23:26:53 +02:00
Joerg Wunsch 0aa43968a0 Add PR 908, 909, 910, 912 2022-03-31 23:14:35 +02:00
Hans f22bc62b06
Mask out unused ATmega32U4 efuse bits (#909)
Closes #446
2022-03-31 23:13:57 +02:00
Hans d09a4e93a2
Add ATmega16U4 to avrdude.conf (#910)
Closes #447
2022-03-31 23:12:32 +02:00
Hans aa7ae7bb87
Add MacOS serial/parallel port note (#908)
Closes #510
2022-03-31 22:32:57 +02:00
Hans 1d0cbc2246
Add progressbar for read and write command (#912) 2022-03-31 22:21:49 +02:00
Joerg Wunsch 79c4137289 Mention the new search order for avrdude.conf 2022-03-22 08:49:04 +01:00
Joerg Wunsch 8697f6def7 Remove remnants of the old erase-cycle counter from examples 2022-03-21 06:38:28 +01:00
Joerg Wunsch 981a6f1f20 Restore the -u option as a dummy.
Closes #890
2022-03-20 21:50:45 +01:00
Joerg Wunsch c64db5fb76 Link the project's "Pages" for documentation 2022-03-19 23:26:27 +01:00
Joerg Wunsch 50c373bf71 Mention issues #771, #897, PRs #898, #899, #902, #903 2022-03-19 23:05:19 +01:00
Jörg Wunsch 0c722bf288
Merge pull request #903 from dl8dtl/term-docs
Terminal mode documentation
2022-03-19 23:04:50 +01:00
Jörg Wunsch 28d1442fc8
Merge pull request #902 from MCUdude/terminal-fix
Minor terminal write improvements
2022-03-19 23:02:24 +01:00
Jörg Wunsch 75e4d06463
Merge pull request #899 from MCUdude/avrdude-conf-fix
Fix errors in Avrdude.conf

This also closes #897
2022-03-19 23:01:12 +01:00
Jörg Wunsch 99f191a0ca
Merge pull request #898 from dl8dtl/macos-nonstandard-baudrates
Macos nonstandard baudrates

closes #266
2022-03-19 22:57:37 +01:00
Joerg Wunsch 33bace0cee Provide an example for the second form of the "write" command
In terminal mode, there are two forms of "write", one that
explicitly mentions all data values, and a second one that
instead specifies a total range to write, where the last data
value given is replicated as needed.
2022-03-19 17:30:55 +01:00
Joerg Wunsch 0c912a201f Try making the cindex (concept index) meaningful
Rearrange existing @cindex entries, add a lot of new ones.
2022-03-19 00:03:17 +01:00
Joerg Wunsch 31feb9ff75 Link the concept index 2022-03-19 00:00:54 +01:00
Joerg Wunsch c5a28eedc0 Also tweak smallexample 2022-03-19 00:00:41 +01:00
Joerg Wunsch 29a01c1047 Terminal mode: fix documentation of second version of "write"
Right after start_addr, the next element is the number of bytes
to be written.
2022-03-18 23:42:32 +01:00
MCUdude 426ea1fa78 Add missing free()'s 2022-03-18 21:20:58 +01:00
MCUdude 6a5988ad64 Print write info message when in verbose mode 2022-03-18 21:19:36 +01:00
MCUdude dcf771424b Increase buffer size to prevent potential overflow 2022-03-18 19:17:17 +01:00
Joerg Wunsch 67b56d322b Update texinfo documentation for terminal-mode changes
This documents the recent changes that have been implemented in
terminal mode.
2022-03-17 23:13:52 +01:00
Joerg Wunsch 27d201acb1 Also tweak smallexample 2022-03-17 07:21:33 +01:00
Joerg Wunsch ded30f86bc CSS test 2022-03-16 23:22:14 +01:00
Joerg Wunsch 9bc4a2463d Attempt to tweak CSS of the generated HTML docs a bit 2022-03-16 23:19:45 +01:00
Joerg Wunsch 8ad55e07ac Update generated documentation 2022-03-13 22:55:33 +01:00
Joerg Wunsch d89817ddb9 Merge branch 'main' into pages-test 2022-03-13 22:54:24 +01:00
Joerg Wunsch fc6a71a142 Merge remote-tracking branch 'upstream/main' 2022-03-13 22:53:46 +01:00
Joerg Wunsch da1271642e Remove the pointer to the mailing list
It makes more sense to point people to Github issue trackers now,
even for questions.
2022-03-13 22:52:44 +01:00
Joerg Wunsch 0e441013e9 Update docs 2022-03-13 00:31:27 +01:00
Joerg Wunsch c5f7939fca Merge branch 'main' into pages-test 2022-03-13 00:29:54 +01:00
Joerg Wunsch 297d81818a Merge remote-tracking branch 'upstream/main' 2022-03-13 00:25:50 +01:00
Joerg Wunsch 7391e569b3 Bring the texinfo doc up to date
* remove copyright years; they are not meaningful anyway
* reflect the project move from Savannah to Github
2022-03-13 00:21:35 +01:00
Joerg Wunsch 67ab74cd6a Fix a one-bit error in ATmega165* signature read command. 2022-03-13 00:21:35 +01:00
Joerg Wunsch 631f671fe8 Mention PRs #893, #894, #896, bug #889 2022-03-13 00:21:20 +01:00
MCUdude 248b554e8d Add support for read with ... "operator"
This means that you can use ... to read the "rest" of the memory.
$ read eeprom ...   will dump the entire memory
$ read eeorm 0x80 ...   will dump the memory from address 0x80 to the end address
2022-03-13 00:20:07 +01:00
MCUdude 40e3aa1790 Incread default read size to 256 bytes 2022-03-13 00:20:07 +01:00
MCUdude dca5fc92bf Restructure "write mode" code 2022-03-13 00:20:07 +01:00
MCUdude 4e05a8fa41 Update description 2022-03-13 00:20:07 +01:00
MCUdude 1299d6b8bd Fix terminal write bug
Wouldn't write data properly after an integer >= 2 bytes was written
2022-03-13 00:20:07 +01:00
MCUdude da315d7323 Support both userrow and usersig names 2022-03-13 00:20:07 +01:00
Joerg Wunsch 416c465ec0 Bring the texinfo doc up to date
* remove copyright years; they are not meaningful anyway
* reflect the project move from Savannah to Github
2022-03-13 00:13:29 +01:00
MCUdude 41f524c1ba Use the same device signature on ATmega165 and ATmega165A 2022-03-08 13:17:01 +01:00
MCUdude 5ebb9047be Fix incorrect ATxmega128D4 flash page size 2022-03-08 12:50:17 +01:00
MCUdude fde7881611 Fix incorrect ATmega64M1 flash and eeprom size
#897 related
2022-03-08 12:34:06 +01:00
MCUdude 1c94c95f1c Fix target names not following the standard 2022-03-08 12:32:41 +01:00
Joerg Wunsch e2995857ac Remove verboseness from build.sh
Got accidentally committed.
2022-03-07 23:27:54 +01:00
Joerg Wunsch a4cbd5c6fc Append a newline to the nonstandard baudrate warning 2022-03-07 23:25:36 +01:00
Joerg Wunsch 87b39637ff Implement nonstandard baudrate handling on MacOS
Alas, MacOS doesn't handle nonstandard baud rates like other systems
in regular tcsetattr() calls. Instead, they invented a new ioctl
(IOSSIOSPEED). So, if we notice we are going to configure a
nonstandard rate on MacOS, issue that ioctl after configuring
everything else using tcsetattr().
2022-03-07 23:20:50 +01:00
Joerg Wunsch 34168759b0 Fix a one-bit error in ATmega165* signature read command. 2022-03-07 22:52:14 +01:00
Joerg Wunsch c746c9bc9e Fix a one-bit error in ATmega165* signature read command. 2022-03-07 22:49:46 +01:00
Joerg Wunsch 65618ed655 Fix a one-bit error in the signature read command for ATmega165* 2022-03-07 21:38:17 +01:00
Joerg Wunsch 00ea962abe Add link to docs 2022-03-07 00:22:59 +01:00
Joerg Wunsch d62f309a00 Add symlink for index.html 2022-03-07 00:18:04 +01:00
Joerg Wunsch 92a5ae20a6 Test for Github pages 2022-03-07 00:09:47 +01:00
Joerg Wunsch 5cbc9c37fc Mention PRs #893, #894, #896, bug #889 2022-03-03 23:15:20 +01:00
Jörg Wunsch 0f4b5b223b
Merge pull request #894 from MCUdude/terminal
Improve terminal read functionality
2022-03-03 23:14:37 +01:00
Jörg Wunsch 0b82b5c573
Merge pull request #896 from MCUdude/terminal-write
Fix ugly terminal write bug
2022-03-03 23:12:47 +01:00
Jörg Wunsch 9355d67e0f
Merge pull request #893 from MCUdude/userrow-fix
Support both userrow and usersig names
2022-03-03 23:09:20 +01:00
MCUdude d9c52249a9 Restructure "write mode" code 2022-03-03 19:37:42 +01:00
MCUdude c7174d7678 Update description 2022-03-02 20:24:51 +01:00
MCUdude df6e2eea12 Fix terminal write bug
Wouldn't write data properly after an integer >= 2 bytes was written
2022-03-02 20:09:59 +01:00
Joerg Wunsch 0d58adb10a Close #892 #895 2022-03-01 23:30:11 +01:00
Jörg Wunsch ebb1849724
Merge pull request #895 from janegilruud/bugfix/fix-cnano-updi-flash-read
For UPDI devices do not add offset when accessing flash.
2022-03-01 23:26:11 +01:00
Jan Egil Ruud 0c8b42524e For UPDI devices do not add offset when accessing flash. 2022-03-01 14:24:33 +01:00
MCUdude b688b1f601 Add support for read with ... "operator"
This means that you can use ... to read the "rest" of the memory.
$ read eeprom ...   will dump the entire memory
$ read eeorm 0x80 ...   will dump the memory from address 0x80 to the end address
2022-02-28 23:59:30 +01:00
MCUdude d89f695c31 Incread default read size to 256 bytes 2022-02-28 23:59:30 +01:00
MCUdude 1f2b570216 Support both userrow and usersig names 2022-02-28 19:46:47 +01:00
Joerg Wunsch 64cc54ac35 PR #888 done 2022-02-21 23:28:50 +01:00
Jörg Wunsch e2e5e44bab
Merge pull request #888 from MCUdude/userrow-alias
Add userrow and usersig aliases
2022-02-21 23:28:05 +01:00
MCUdude 07ea8f5e09 Add userrow and usersig aliases 2022-02-21 22:36:06 +01:00
Joerg Wunsch 0269817217 Add a missing @end table
Has been slipped when adding some -x documentation before.
2022-02-21 22:01:05 +01:00
Joerg Wunsch fe6290072a PR #880 done 2022-02-21 21:54:47 +01:00
Jörg Wunsch 008f95f6ff
Merge pull request #880 from MCUdude/terminal-write
Avrdude terminal write improvements
2022-02-21 21:53:38 +01:00
MCUdude a73567893b Properly handle negative number sizes 2022-02-21 13:43:38 +01:00
MCUdude fa706f0d01 Handle data size warning better
Now it only outputs a warning when the size of the data the user input is actually ambiguous
2022-02-20 23:03:31 +01:00
MCUdude 3532c567ac Add suffix for 8-bit data
use [val]HH or [val]hh to force 8-bit writes to memory
2022-02-20 22:23:15 +01:00
Joerg Wunsch 14f646822c PR #886 done 2022-02-20 20:59:28 +01:00
Jörg Wunsch bb73ade70b
Merge pull request #886 from dbuchwald/ser_posix_cleanup
Cleanup of POSIX serial init code
2022-02-20 20:58:22 +01:00
MCUdude bb99a36a14 Formatting
Use enums for write mode, and change datatypes from int/long/char to int32_t/uint8_t where possible
2022-02-20 19:08:30 +01:00
Joerg Wunsch 0d7d034d24 Issue #884 closed 2022-02-20 16:58:39 +01:00
Joerg Wunsch c7d1ebcf1f Issue #881 also fixed 2022-02-20 14:37:04 +01:00
Joerg Wunsch b891b7c64b Issue #874 is closed 2022-02-20 14:35:50 +01:00
MCUdude a9b756e5c7 Add struct initialization list 2022-02-20 12:46:53 +01:00
Dawid Buchwald cf67a76c23 Merge branch 'main' into ser_posix_cleanup 2022-02-20 12:37:19 +01:00
MCUdude 0e29b43bd0 Add support for 64-bit integers
Also, move everything data related into a struct, to keep tings a little more organized
2022-02-19 23:34:50 +01:00
MCUdude 4b9219edee Add support for suffixes for manually specifying data size
H/h/S/s: 16-bit, L/l: 32-bit, F/f: 32-bit float
2022-02-19 22:48:58 +01:00
Joerg Wunsch 428cd89e8d PRs #878, #873, #885 done 2022-02-19 21:54:23 +01:00
Jörg Wunsch 3efd3b2052
Merge pull request #873 from MCUdude/add-arduino-programmers
Add missing USBtiny derived programmers
2022-02-19 21:51:31 +01:00
Jörg Wunsch 7c65adba26
Merge pull request #885 from dbuchwald/simple_updi_fix
Smallest possible fix for PL2303HX
2022-02-19 21:50:41 +01:00
Dawid Buchwald 75ab3c418e Fixed warning with unsigned char 2022-02-19 21:18:03 +01:00
MCUdude 62f3b84eee Use union for simpler data representation
It is a bit hacky, but for this purpose it fits surprisingly well
2022-02-19 20:15:52 +01:00
Dawid Buchwald 066f54fbfa Cleanup of POSIX serial init code 2022-02-19 18:00:58 +01:00
Dawid Buchwald de19f203e0 Smallest possible fix for PL2303HX 2022-02-19 15:07:32 +01:00
Jörg Wunsch d054c68b19
Merge pull request #878 from MCUdude/fix-pkob-target-voltage
Fix Curiosity Nano target voltage
2022-02-18 23:01:49 +01:00
Joerg Wunsch 5c90fbbaae PR #877 done 2022-02-18 22:53:45 +01:00
Jörg Wunsch c2fe68ef7d
Merge pull request #877 from MCUdude/jtag3-verbosity
Reduce jtag3 output verbosity
2022-02-18 22:38:40 +01:00
Hans c345985928
Merge branch 'avrdudes:main' into terminal-write 2022-02-18 22:09:42 +01:00
Joerg Wunsch c1ec836fbd PR #882 done 2022-02-18 21:37:27 +01:00
Jörg Wunsch ba01fd7e30
Merge pull request #882 from mariusgreuel/pr-libhid-cleanup-part1
Remove libhid support in ser_avrdoper.c in favor of libhidapi
2022-02-18 21:36:12 +01:00
Marius Greuel 59ecd4cc65 Remove libhid support in ser_avrdoper.c in favor of libhidapi 2022-02-18 20:05:52 +01:00
Marius Greuel e31be88ce0 Add LIB_LIBHID to CMake project to fix MinGW build issue 2022-02-18 19:58:13 +01:00
MCUdude 6e7f38e81f Properly handle negative numbers
Now -3.141592 and -32768 are valid numbers that's stored correctly in memory
2022-02-18 09:58:16 +01:00
MCUdude 10e05eed21 Require single quotes when writing characters 2022-02-18 09:58:16 +01:00
MCUdude 551046052e Add support for writing floats 2022-02-18 09:58:16 +01:00
MCUdude 2a92b8cce4 Add support for memory "fill" with arbitrary data too
If you run the following command: $ write eeprom 0x00 0x10 A B C ...

It will write the following data to EEPROM:
|ABCCCCCCCCCCCCCC|
starting from address 0x00
2022-02-18 09:58:16 +01:00
MCUdude c007dc7d24 Add support for writing single characters
Now this is possible: write eeprom 0x00 a b c d e f 0x80 0x90 ! H E L L O
2022-02-18 09:58:16 +01:00
MCUdude 2589b17640 Add support for memory "fill" mode
Syntax: write <memtype> <start addr> <no. byte to write> <byte to write> ...
2022-02-18 09:58:13 +01:00
MCUdude 19e2cae053 Add Curiosity Nano to terminal list 2022-02-14 10:30:21 +01:00
MCUdude 932f68f24c Set target voltage even thoug not target is detected 2022-02-14 10:28:54 +01:00
MCUdude b1d34a510c Reduce jtag3 output verbosity 2022-02-13 19:23:48 +01:00
MCUdude f2bdcbe977 Add missing USBtiny derived programmers
ArduinoISP and the Arduino.org ISP are commercial versions of the USBtiny programmer with different USB VIDs/PIDs
2022-02-11 22:46:11 +01:00
Joerg Wunsch 7b79b72794 PR #872 done 2022-02-11 22:17:24 +01:00
Jörg Wunsch 76a17be4d0
Merge pull request #872 from MCUdude/jtag-string-formatting
Tweak programmer info formatting strings
2022-02-11 22:16:39 +01:00
MCUdude 80f1d96e07 Tweak programmer info formatting strings
Now all colons are on a straight line, just like #853 did to all jtag3 compatible programmers
2022-02-11 22:10:52 +01:00
Joerg Wunsch 09fe08e51c PR #853 done 2022-02-11 21:45:31 +01:00
Jörg Wunsch f2c73c2bb8
Merge pull request #853 from MCUdude/jtag3-clock-update
Print JTAG3 clocks after configuration + string formatting
2022-02-11 21:44:54 +01:00
MCUdude b581d14823 String formatting
Allign colons, only print clocks that are actually present (>0 kHz)
2022-02-11 21:35:07 +01:00
Joerg Wunsch 354a1c4f1f PR #869 closed 2022-02-11 21:17:01 +01:00
Jörg Wunsch 23a09a6197
Merge pull request #869 from MCUdude/alias-memories
Add fuse name aliases to avrdude.conf + tweak update.c
2022-02-11 21:15:34 +01:00
MCUdude 3fc39c47ad Print memory name alias together with the canonical name if present
in avrdude.conf. An example would be "avrdude: reading fuse0/wdtcfg memory:"
2022-02-11 21:10:05 +01:00
MCUdude d6ccf7a3ff Add memory alias names for megaAVR0/tinyAVR0,1,2/AVR-Dx/AVR-Ex fuses 2022-02-10 22:34:33 +01:00
Joerg Wunsch 452f673f38 Back out the last "alias" commit (search for existing alias).
It breaks the alias handling completely as the search happens
way too late. So instead, just keep any possibly duplicate
name as it won't be in our way anyway.
2022-02-10 21:26:05 +01:00
Joerg Wunsch 38a3af37e2 Mention PRs #863 and #868. 2022-02-10 20:39:51 +01:00
Jörg Wunsch d134dc8fff
Alias keyword (#868)
Implementation for an "alias" keyword.

By now, only applied inside memory descriptions.

* Make "mem_alias" a separate nonterminal.

The previous implementation attempt caused a syntax error in
yacc code, and separating mem_alias on the same level as
mem_spec appears to be the cleaner solution anyway.

* Maintain real memory aliases.

Instead of duplicating the aliased memory with a new name, maintain a
second list of memory aliases (per device) that contains a pointer to
the memory area it is aliased to. That way, a memory name can be
clearly distinguished between the canonical one and any aliases.

* Check p->mem_alias != NULL before touching it

* Add avr_find_memalias()

This takes a memory region as input, and searches whether an
alias can be found for it.

* We need to add a list structure for the mem_alias list, always.

By that means, mem_alias won't ever be NULL, so no need to check
later.

Also, in avr_dup_part(), duplicate the alias list.

* In a memory alias, actually remember the current name.

* In avr_dup_part(), adjust pointers of aliased memories

While walking the list of memories, for each entry, see if there is an
alias pointing to it. If so, allocate a duplicated one, and fix its
aliased_mem pointer to point to the duplicated memory region instead
of the original one.

* Add avr_locate_mem_noalias()

When looking whether any memory region has already been defined for
the current part while parsing the config file, only non-aliased names
must be considered. Otherwise, a newly defined alias would kick out
the memory definition it is being aliased to.

* When defining a mem_alias, drop any existing one of that name.

* Actually use avr_find_memalias() to find aliases

* Add declaration for avr_find_memalias()

* When defining a memory, also search for an existing alias

If the newly defined name has the same as an existing alias, the alias
can be removed.

Note that we do explicitly *not* remove any memory by the same name of
a later defined alias, as this might invalidate another alias'es
pointer. If someone defines that, the alias name just won't ever be
found by avr_locate_mem().
2022-02-10 20:39:19 +01:00
Jörg Wunsch ba314f23e9
Merge pull request #863 from MCUdude/jtag3-read-memory-alias
Add support for reading from more memory sections
2022-02-10 20:35:06 +01:00
MCUdude a43f220ef9 Add support for reading from more memory sections
It's now possible to read the following memories if present: osccal16, osccal20, tempsense, osc16err, osc20err
2022-02-07 21:51:35 +01:00
Joerg Wunsch 1c0b70da89 PR #859 done 2022-02-05 22:03:59 +01:00
Jörg Wunsch b6a6c681df
Merge pull request #859 from dl8dtl/safemode-removal
Remove the "safemode" feature.
2022-02-05 22:03:12 +01:00
Joerg Wunsch 3eda1d15f9 Mention PR #858 2022-02-05 21:59:04 +01:00
Marius Greuel c6438532f0
Merge pull request #858 from yegorich/cmake-install-fix
CMake: use CMAKE_CURRENT_BINARY_DIR to locate avrdude.conf
2022-02-05 21:46:38 +01:00
MCUdude 625027a807 Add HV UPDI pulse command 2022-02-05 14:44:13 +01:00
Joerg Wunsch 6fd68ed7fe Mention Hans Eirik Bull for his recent contributions 2022-02-01 23:26:20 +01:00
Joerg Wunsch 36de84ab48 Mention Dawid and Marius for their recent contributions. 2022-02-01 20:35:15 +01:00
Joerg Wunsch 8c6c6a14ec Remove the "safemode" feature.
This feature has been designed with the sometimes quite flakey direct
(parallel or serial port attached) bitbang programming adapters in
mind that were quite common about two decades ago.

With parallel ports vanishing from modern PCs almost completely, and
the advent of various USB-attached low-cost programming devices,
this class of programmers disappeared almost completely.

Furthermore, the fuse combinations that were covered by the feature
are no longer around on all recent AVR devices, so for an ever
increasing number of devices, safemode already became meaningless and
was turned off anyway.

With the prospective version 7.x release, it's a good point in time to
introduce a major change like this one.
2022-01-31 20:44:32 +01:00
Yegor Yefremov 7ed3632902 CMake: use CMAKE_CURRENT_BINARY_DIR to locate avrdude.conf
With the split CMakeLists.txt infrastructure avrdude.conf
will be created in the build/src and not build folder. Hence,
fix its location in the install command.
2022-01-31 07:18:59 +01:00
Joerg Wunsch e28e28d7c3 With the new CMake file structure, no need to dive into "src" 2022-01-30 10:46:27 +01:00
Joerg Wunsch a3868a8260 Mention PR/issue 855, 856, 857 2022-01-30 10:45:53 +01:00
Jörg Wunsch e0bc6a8bd6
Merge pull request #855 from MCUdude/fix-arduino-retry-attempts
Fix Arduino retry attempts
2022-01-30 10:45:24 +01:00
Jörg Wunsch 69177dfe3f
Merge pull request #857 from dl8dtl/fix-856
Assign proper type to msg[] in errstr()
2022-01-30 10:41:53 +01:00
Joerg Wunsch b84e6862a7 Assign proper type to msg[] in errstr()
Obviously, the array ought to be of type char.

Closes Issue #856
2022-01-29 23:32:39 +01:00
MCUdude 7144a9f2ae Replace incorrect warning message
Was mistakenly added in PR #854.
2022-01-29 20:08:43 +01:00
MCUdude 28be45d8b6 Fix Ardino sync attempts
In order for the Arduino bootloader to re-sync with Avrdude, the microcontroller needs to be reset to start the bootloader again.
2022-01-29 19:53:42 +01:00
Joerg Wunsch 4ff72ac462 Mention all closed PRs and bug issues. 2022-01-27 23:20:26 +01:00
Jörg Wunsch 4ea4ff7fba
Merge pull request #850 from dl8dtl/usbasp-errstr
Fix libusb-1.0 error strings
2022-01-27 23:18:51 +01:00
Jörg Wunsch 7e7c4e630e
Merge pull request #854 from MCUdude/arduino-stk500
Set number of connection retry attempts for Arduino/STK500 programmer
2022-01-27 23:17:28 +01:00
Jörg Wunsch 39deb3a600
Merge pull request #852 from yegorich/cmake-split
CMake: split configuration in two files
2022-01-27 23:16:37 +01:00
Jörg Wunsch dd8c3ff830
Merge pull request #843 from mariusgreuel/pr-ftdi-syncbb
Fix receive buffer implementation in ftdi_syncbb programmer
2022-01-27 23:15:10 +01:00
MCUdude ad6eff0f76 Set number of Arduino/STK500 connection retry attempts
Using the extended parameter flag -x. Usage: . Default number of attempts is still 10 if not -x flag is specified
2022-01-25 09:40:24 +01:00
MCUdude 286c0f5e2a Don't print irrelevant information for the Arduino programmer 2022-01-24 22:16:31 +01:00
MCUdude f6bbaadfa6 Print clock info after the correct clock speeds has been set
The "new" clock speed set by the -B flag wasn't reflected in the output log
2022-01-23 22:45:54 +01:00
Yegor Yefremov acee6afa4e CMake: split configuration in two files
The main CMakeLists.txt file in the project's root directory takes
care of the main project settings like project name and version,
handling the options, finding dependencies, etc.

The src/CMakeLists.txt handles options that are necessary to build
libavrdude library and avrdude binary.
2022-01-23 21:22:07 +01:00
Joerg Wunsch 42a154dddf Fix libusb-1.0 error strings
Previously, all libusb-1.0 error strings have been translated
by libusb_to_errno() into an errno-like integer, only in order
to pass that one straight into strerror().

For unhandled libusb-1.0 error codes, ERANGE was returned, which
is just nonsense ("Result too large", bug #848).

Instead, use a single function errstr() now that either can
use strerror() on some well-defined errno-like code, or otherwise
just return a string that mentions the numeric value.
2022-01-21 23:13:56 +01:00
Joerg Wunsch de3d7c1659 PR #849 merged 2022-01-21 21:56:36 +01:00
Joerg Wunsch a8f7e96222 PR #815 merged 2022-01-21 21:56:07 +01:00
Joerg Wunsch 37b0659951 PR #816 merged
Copy over man page additions into texinfo file as well.
2022-01-21 21:56:07 +01:00
Joerg Wunsch 4538d91091 PR #829 merged 2022-01-21 21:56:07 +01:00
Jörg Wunsch 6d762a835b
Merge pull request #849 from dl8dtl/buildscripts
Add a build script for Unix-like systems
2022-01-21 21:55:57 +01:00
Jörg Wunsch cce7a934d6
Merge pull request #815 from MCUdude/add-memory-sections
Add more memory sections to read from
2022-01-21 21:49:29 +01:00
Jörg Wunsch 490558049e
Merge pull request #816 from andrewshadura/usbtiny-spi
Add SPI support to USBtiny
2022-01-21 21:40:00 +01:00
Jörg Wunsch 512cce405c
Merge pull request #829 from yegorich/cmake-install-liavrdude
CMake: add initial support for installing lib and include files
2022-01-21 21:37:21 +01:00
Joerg Wunsch e5ac9e943c Add a build script for Unix-like systems 2022-01-21 21:33:10 +01:00
Joerg Wunsch 0b1db09daf PR #944 merged 2022-01-21 21:28:15 +01:00
Jörg Wunsch 1b8b1d69e7
Merge pull request #844 from MCUdude/jtagmkii-retry-attempts
jtagmkii: Reduce the number of sync attempts to 10 + print number of attempts
2022-01-21 21:27:30 +01:00
Hans d401b2224e
Merge branch 'main' into jtagmkii-retry-attempts 2022-01-21 13:28:20 +01:00
Joerg Wunsch 950583323f PR #845 merged 2022-01-20 10:23:31 +01:00
Jörg Wunsch 0682af212c
Merge pull request #845 from MCUdude/reduce-verbosity
Reduce verbosity when setting fuses and uploading programs
2022-01-20 10:22:52 +01:00
MCUdude b1cbbfc9f0 Reduce verbosity when setting fuses and uploading programs
Affects commands with no -v flag and one -v flag
2022-01-20 09:45:34 +01:00
MCUdude dbac0ecf8c Reduce the number of attempts to 10
+ print number of attempts
2022-01-19 23:25:47 +01:00
Joerg Wunsch 325604f970 PR #842 done 2022-01-19 22:56:47 +01:00
Yegor Yefremov 8be18c788e CMake: add initial support for installing lib and include files 2022-01-18 14:54:42 +01:00
Joerg Wunsch 090920298d PR #842 done 2022-01-18 13:26:52 +01:00
Jörg Wunsch fa58267643
Merge pull request #842 from mariusgreuel/pr-ft232r
Add a new programmer ft232h
2022-01-18 13:25:25 +01:00
Marius Greuel 44b0c0715f Fix receive buffer implementation in ftdi_syncbb programmer 2022-01-17 22:53:58 +01:00
Marius Greuel 7b9f258806 Add a new programmer 'ft232h', similar to ft232r. Improve and correct pinout documentation for um232h and c232hm programmer. 2022-01-17 22:49:03 +01:00
MCUdude 0e451f73cf Print alias names if present 2022-01-17 21:34:09 +01:00
Joerg Wunsch b3c76f3e54 PR #836 is merged, mention all new devices brought by that 2022-01-16 23:01:10 +01:00
Jörg Wunsch 54d143d4a5
Merge pull request #836 from MCUdude/add-missing-targets
Add missing tinyAVR-2, AVR DD and AVR EA targets
2022-01-16 22:59:41 +01:00
MCUdude 4453d54296 Add memory name aliases for AVR DA/DB
+ add sernum and tempsense memory sections to read from
2022-01-15 21:53:58 +01:00
MCUdude 9c08c0c164 Attempt to fix incorrect readsize values
Values copied AVR64DD__.atdf and AVR64EA__.atdf. The order atdf files doesn't exist at the moment
2022-01-15 12:47:58 +01:00
MCUdude 628c48aff6 Add AVR EA targets
This includes AVR8EA28/32, AVR16EA28/32/48, AVR32EA28/32/48 and AVR64EA28/32/64
2022-01-14 20:30:49 +01:00
MCUdude 8e47768600 Add AVR DD targets
This includes AVR16DD14/20/28/32, AVR32DD14/20/28/32 and AVR64DD14/20/28/32
2022-01-14 19:52:22 +01:00
Joerg Wunsch e5edecf95e PR #811 is merged 2022-01-14 08:25:43 +01:00
Jörg Wunsch b99687f33c
Merge pull request #811 from dbuchwald/main
Added missing RTS/DTR management feature to serialupdi programmer
2022-01-14 08:24:58 +01:00
Joerg Wunsch 153031d6d6 Copy over description of extended parameters to avrdude.1 2022-01-14 08:18:56 +01:00
Joerg Wunsch c31578cbbd Add cscope.out to list of ignored files 2022-01-13 22:43:03 +01:00
MCUdude 310fe49b73 Add missing tinyAVR-2 series targets
Includes ATtiny3224, ATtiny3226 and ATtiny3227
2022-01-13 22:29:22 +01:00
Joerg Wunsch 5c264992fc PR #832 is done 2022-01-13 21:47:53 +01:00
Jörg Wunsch 77a5703c5c
Merge pull request #832 from MCUdude/add-even-more-missing-targets
Add missing ATmega and ATtiny targets
2022-01-13 21:26:43 +01:00
Joerg Wunsch 822578cffd Mention PR #809
Also fix signatures for ATmega169A, ATmega165 and ATmega165A.
2022-01-13 20:08:40 +01:00
Jörg Wunsch d1634e4d96
Merge pull request #809 from MCUdude/add-missing-atmega-targets
Add missing ATmega__5 and ATmega__9 targets to avrdude.conf
2022-01-13 19:59:42 +01:00
MCUdude 99d8fa5d88 Add missing ATtiny targets
+ a little formatting
2022-01-13 19:45:45 +01:00
MCUdude cc77f89953 Add missing ATmega targets
+ a little formatting
2022-01-13 19:45:30 +01:00
MCUdude 7064447378 Add all possible ATmega__5 and ATmega__9 targets
This includes the "non-P", A, P and PA suffixes
2022-01-13 18:27:36 +01:00
MCUdude 77ed8b98c5 Add ATmega165A/P targets 2022-01-13 18:27:36 +01:00
MCUdude 32232faa2b Add missing ATmega targets 2022-01-13 18:27:34 +01:00
Dawid Buchwald ab57f38387 Replaced tabs by spaces 2022-01-13 10:01:01 +01:00
Dawid Buchwald 90d0fa7346 Merge remote-tracking branch 'avrdudes/main' into main 2022-01-13 09:57:42 +01:00
Marius Greuel 956a274abd Remove libreadline from GitHub build action 2022-01-12 23:19:28 +01:00
Marius Greuel 3fbac230b3 Enable printf %n format specifier for MSVC 2022-01-12 20:41:52 +01:00
Marius Greuel 0ba4d2eaee Change GitHub build action to create separate artifacts for executables 2022-01-12 18:16:02 +01:00
Joerg Wunsch 1faa02b9cb Mention PR #828 and issue #823 2022-01-11 22:13:57 +01:00
Jörg Wunsch dc2f5b25a2
Merge pull request #828 from dl8dtl/fix-tpi-fuse-write
Fix for TPI fuse write (closes #823)
2022-01-11 22:12:37 +01:00
Joerg Wunsch 65d5cfadc1 Fix for TPI fuse write
In get_fuse_bitmask(), ensure the AVR_OP_READ and AVR_OP_WRITE
m->op[] fields are actually filled in, before referencing them.
If they are missing, just return a full byte mask (0xFF).

In avr_write(), for TPI memory, if the write consist of one byte onle
(which is the case for fuse byte writing), resort to avr_write_byte()
instead as it already implements everything needed. This leaves the
avr_write() implementation to handle full paged writes with an even
number of bytes only.
2022-01-11 22:00:22 +01:00
Joerg Wunsch 1049777283 PR #826 is done 2022-01-11 15:41:32 +01:00
Jörg Wunsch 4e1bbf07ac
Merge pull request #826 from yegorich/cmake-dll
CMake: enable dynamic-link library for libavrdude
2022-01-11 15:40:58 +01:00
Yegor Yefremov e72fa01073 Fix libavrdude library file name
CMake adds "lib" prefix to the library name and hence we get the
following name "liblibavrdude". Use set_target_properties to
set the prefix to "".
2022-01-11 14:58:40 +01:00
Joerg Wunsch 60bda0bcc4 PR #820 is merged 2022-01-11 12:45:04 +01:00
Jörg Wunsch 2d833e7ceb
Merge pull request #820 from dl8dtl/libavrdude-remove-ac_cfg_h
Remove ac_cfg.h from libavrdude.h
2022-01-11 12:44:26 +01:00
Yegor Yefremov 8374564665 CMake: enable dynamic-link library for libavrdude
Add on option BUILD_SHARED_LIBS to also build a DLL variant
of the libavrdude library. Turn it off by default to preserve
current behavior.
2022-01-11 12:02:36 +01:00
Joerg Wunsch b33709bc04 Mention Micronucleus bootloader (PR #786 - thanks, Hans!) 2022-01-10 22:15:14 +01:00
Joerg Wunsch c7f7fcda8e Fix URL for linuxgpio programmer
Closes #419
2022-01-10 22:12:36 +01:00
Joerg Wunsch 6870417860 Merge branch 'main' of github.com:avrdudes/avrdude 2022-01-10 21:45:14 +01:00
Joerg Wunsch 829425f246 Mention PR #818 2022-01-10 21:33:31 +01:00
Jörg Wunsch 22e6c4b325
Merge pull request #818 from yegorich/pindefs-fix-warning
pindefs: conform to the function declaration
2022-01-10 21:33:04 +01:00
Joerg Wunsch a3bf6cc4c5 Fix names of Logic Green devices
There's some confusion as the datasheet calls the device family
LGT8FX8P but the devices itself are LGT8F88P through LGT8F328P.
Obviously, the "X" is actually a wildcard denoting the flash size.
2022-01-10 21:29:09 +01:00
Joerg Wunsch b1b80bfa4a Mention PR #817 and issue #812 2022-01-10 21:27:01 +01:00
Jörg Wunsch 0a4193f742
Merge pull request #817 from mariusgreuel/pr-print-expected-part
Print expected part
2022-01-10 21:25:39 +01:00
Joerg Wunsch 48bcc269e2 Remove ac_cfg.h from libavrdude.h 2022-01-10 15:12:33 +01:00
Joerg Wunsch cf35b7fe32 Include ac_cfg.h before libavrdude.h
On MSVC, this is required in order to have a definition of
PATH_MAX in place.
2022-01-10 14:51:48 +01:00
Joerg Wunsch fa8a31740f Remove ac_cfg.h from libavrdude.h 2022-01-10 14:27:08 +01:00
Dawid Buchwald 92a3eb1080 Merge remote-tracking branch 'avrdudes/main' into main 2022-01-09 23:39:09 +01:00
Joerg Wunsch ea29434568 Mention PR #814 and the issues it closes 2022-01-09 20:33:05 +01:00
Jörg Wunsch 5746bb2670
Merge pull request #814 from dl8dtl/notify-open-failure
Notify user about open failure

Closes #813 (also closes #471)
2022-01-09 20:30:10 +01:00
Marius Greuel f043e1b484 Work around choco failure in build.yml 2022-01-09 20:13:11 +01:00
MCUdude 2fd967866c Don't display target info that's not present in Avrdude.conf
I still have to figure out why all parts are flagged with support for both serial and parallel programming interfaces, even when this is not the case
2022-01-09 18:13:07 +01:00
Yegor Yefremov 1a85e01b63 pindefs: conform to the function declaration
The last parameter in the pins_check() routine is declared as
"const bool". Add the missing "const" specifier.
2022-01-09 15:57:45 +01:00
Marius Greuel f67cb3c224 Preserve the insertion order of programmers and parts when parsing the avrdude.conf file 2022-01-09 11:52:52 +01:00
Marius Greuel 1297098eae When the specified part has a matching signature, print the specified part instead of one from the parts list 2022-01-09 11:52:47 +01:00
David Fries 40f0fae5a4
Update manpage for USBtiny and direct SPI 2022-01-09 10:57:22 +01:00
David Fries cffa6c7ca0
Add direct SPI mode to USBtiny
It is limited to exactly sending (and receiving) multiples of 4 bytes,
and unlike programming mode where slave select isn't required, SS must
be held low for SPI to work. USBtiny programmers don't usually have
a wire for SS.
2022-01-09 10:57:22 +01:00
David Fries 112b6edd1c
Set back to programming mode on quit
Otherwise it can't read the fuses and the safe fuse code complains.
2022-01-09 10:27:36 +01:00
MCUdude 8f16c2a1e4 Add more memory sections to read from
+ improve Avrdude output in verbose mode
2022-01-08 23:57:37 +01:00
Joerg Wunsch a182ef5a26 Notify user if pgm->open() failes
This is supposed to fix issue #813
2022-01-08 22:02:25 +01:00
Jörg Wunsch a447673b07
Merge branch 'avrdudes:main' into main 2022-01-08 21:46:12 +01:00
Dawid Buchwald a8de8b8b8f
Merge branch 'avrdudes:main' into main 2022-01-08 19:44:20 +01:00
Dawid Buchwald 4a26aac5c8 Added RTS/DTR release message 2022-01-08 19:14:33 +01:00
Dawid Buchwald b70fe0e956 Added RTS/DTR status message 2022-01-08 18:53:46 +01:00
Joerg Wunsch e3338c428f Add PR #810 2022-01-08 18:27:48 +01:00
Jörg Wunsch f1dbb2aae8
Merge pull request #810 from yegorich/ignore-ac-cfg-h-in
Ignore ac_cfg.h.in~
2022-01-08 18:27:12 +01:00
Yegor Yefremov b13c61893b Ignore ac_cfg.h.in~
Ignore temporary ac_cfg.h.in~ file.
2022-01-08 18:06:39 +01:00
Marius Greuel d2ae6a824f Add C code alternative to __builtin_popcount. 2022-01-08 16:13:32 +01:00
Marius Greuel 21d7fc58b6 Add -Wall to CMake compiler options 2022-01-08 16:13:26 +01:00
Dawid Buchwald 1631fc4dd8 Implemented extended parameter for RTS/DTR lines management 2022-01-08 10:04:25 +01:00
Marius Greuel c71fab0889 Move README.md build instructions to wiki 2022-01-08 00:33:11 +01:00
Marius Greuel 47b5d1af73 Add build status to README.md 2022-01-08 00:30:48 +01:00
Marius Greuel 872f3a3a8d Add GitHub deploy action 2022-01-07 23:57:54 +01:00
Marius Greuel 428f5828b4 Add cross-compile to GitHub build actions 2022-01-07 23:57:54 +01:00
Marius Greuel b87b527b3a Add advapi32.lib to MSVC builds 2022-01-07 23:57:54 +01:00
Marius Greuel 80d53839dd Replace MSVC implementation of __builtin_popcount with C code 2022-01-07 23:57:54 +01:00
Marius Greuel e1221e22ff Fix -Wpointer-sign warning in micronucleus.c 2022-01-07 23:48:56 +01:00
Joerg Wunsch 7d574ccf0b PR #808 is done 2022-01-07 21:40:59 +01:00
Jörg Wunsch 366a368882
Merge pull request #808 from yegorich/fix-invalid-sscanf-arg-type
buspirate: fix invalidScanfArgType_int warning
2022-01-07 21:40:25 +01:00
Yegor Yefremov f2d6342d21 buspirate: fix invalidScanfArgType_int warning
"%x" specifies an unsigned int, hence change the type of spi_write, spi_read
accordingly.
2022-01-07 19:22:57 +01:00
Joerg Wunsch 11f7692cc0 Mention PR #798 - all those Windows changes 2022-01-07 18:31:54 +01:00
Jörg Wunsch 6a737a0c13
Merge pull request #798 from mariusgreuel/pr-msvc
Add MSVC builds and better WinUSB/FTDI support
2022-01-07 18:30:19 +01:00
Marius Greuel fc54ef5e59 Clean up legacy code 2022-01-07 17:57:02 +01:00
Marius Greuel fe6f08d48f Use alloca for stack based memory allocation 2022-01-07 17:54:36 +01:00
Marius Greuel d05c2db3fb Add a missing define to the MSVC compatiblity shim 2022-01-07 17:54:36 +01:00
Marius Greuel 1fb88c3040 Add external libraries to CMake project 2022-01-07 17:54:36 +01:00
Marius Greuel c035c91db5 Add compatibility shim for MSVC 2022-01-07 17:54:36 +01:00
Joerg Wunsch 3a3250322d Mention PR #807 2022-01-07 13:17:25 +01:00
Jörg Wunsch a91e389a5e
Merge pull request #807 from yegorich/src-typos
Fix typos all over the code
2022-01-07 13:15:14 +01:00
Yegor Yefremov f29b2a283a Fix typos all over the code 2022-01-07 11:31:16 +01:00
Joerg Wunsch 8c4c9d0090 Add PR #801 2022-01-07 09:23:49 +01:00
Jörg Wunsch 539eec79e6
Merge pull request #801 from dl8dtl/conffile-clean-up
Conffile clean up
2022-01-07 09:23:17 +01:00
Joerg Wunsch 32d78cc9a0 Mention new ATtinys supported 2022-01-07 09:10:30 +01:00
Joerg Wunsch 5cbd6a5160 Mention PR #802 2022-01-07 09:08:58 +01:00
Jörg Wunsch ac7a794b70
Merge pull request #802 from mariusgreuel/pr-teensy
Add support for Teensy bootloader
2022-01-07 09:07:40 +01:00
Marius Greuel f20c4bd9e6 Add support for Teensy bootloader 2022-01-06 23:39:17 +01:00
Joerg Wunsch 67df9b0782 Mention closed PR #803 (and its related issues) 2022-01-06 22:58:46 +01:00
Jörg Wunsch 118993a584
Merge pull request #803 from MCUdude/add-missing-targets
Add missing ATtiny targets to avrdude.conf
2022-01-06 22:51:57 +01:00
Joerg Wunsch 6cfdb3a04b Remove obsolete file 2022-01-06 22:39:36 +01:00
Joerg Wunsch fffbd09767 Mention PR #806 as fixed 2022-01-06 15:55:51 +01:00
Jörg Wunsch 75fd2d5ea4
Merge pull request #806 from yegorich/fix-realloc
term: fix memleakOnRealloc
2022-01-06 15:55:19 +01:00
Yegor Yefremov d5b2106644 term: fix memleakOnRealloc
Assign the newly allocated value to a temporary variable and in the
case where we cannot allocate memory, free the initial pointer.
2022-01-06 11:28:39 +01:00
Jörg Wunsch a61707bb65
Merge branch 'avrdudes:main' into main 2022-01-06 10:06:04 +01:00
Joerg Wunsch 7bf9711392 Mention PR #804 2022-01-05 22:46:36 +01:00
Jörg Wunsch 3069105134
Merge pull request #804 from yegorich/add-tags-to-gitignore
Ignore ctags index file
2022-01-05 22:43:29 +01:00
Yegor Yefremov a6ad88d9c4 Ignore ctags index file
ctags creates an index file called 'tags'.
2022-01-05 22:30:13 +01:00
Joerg Wunsch 8c1c803fb2 Mention PR #792 as closed 2022-01-05 17:54:49 +01:00
Jörg Wunsch 97c34f7b26
Merge pull request #792 from yegorich/ftdi-fix-deprecated-call
avrftdi: don't use the deprecated ftdi_usb_purge_buffers routine
2022-01-05 17:41:08 +01:00
Joerg Wunsch 1529277477 When finding LIBFTDI, don't clobber LIBS but extend it 2022-01-05 17:26:39 +01:00
MCUdude 50e15a5cf8 Add missing ATtiny targets
ATtiny48, 87, 102, 104, 167 and 828
2022-01-05 11:50:31 +01:00
Jörg Wunsch 48a8388b09
Merge pull request #789 from MCUdude/main
Add jtag2updi support
2022-01-05 08:26:55 +01:00
Hans 4b76ccc951
Merge branch 'main' into main 2022-01-05 08:05:38 +01:00
Jörg Wunsch e27990bd54
Merge pull request #786 from mariusgreuel/pr-micronucleus
Add support for Micronucleus bootloader
2022-01-04 23:52:00 +01:00
Jörg Wunsch b8c825c9af
Merge pull request #795 from MCUdude/add-pkobn_updi-vtarg
Add target voltage adjustment for Curiosity Nano boards
2022-01-04 23:50:20 +01:00
Joerg Wunsch 124ef7fe3d Move the backslash replacement out into a separate function 2022-01-04 23:10:14 +01:00
Joerg Wunsch 6a87a110cc Move the config file names out as #define into avrdude.h 2022-01-04 23:03:47 +01:00
Joerg Wunsch 374861f62e Move the system config file search after option processing
For one, this allows us to use MSG_DEBUG in order to emit debug
messages (requires -v processing).

As another effect, if the -C conffile option was given, there is no
need at all to run through all the process of looking up a system
config file - it's right there already.

Also, move it after the logfile creation if -l logfile was given, so
the respective debug message can go to the logfile.
2022-01-04 22:45:47 +01:00
Marius Greuel 3747db516a Add support for Micronucleus bootloader 2022-01-04 18:37:57 +01:00
Joerg Wunsch dba89e7269 Mention PR #796 as fixed 2022-01-04 14:07:15 +01:00
Joerg Wunsch 863f77d827 Fix a (valid) warning about comparison of char vs. int against EOF
Closes PR #796
2022-01-04 13:48:11 +01:00
Joerg Wunsch 9c7bb3787d Revert "Hint about possibly differing licensing terms."
This reverts commit fa079bec8c.

Changing the COPYING file prevents automatic license detections
from working correctly.
2022-01-04 12:53:27 +01:00
Joerg Wunsch eff180353e Merge branch 'main' of github.com:dl8dtl/avrdude 2022-01-03 23:55:27 +01:00
Joerg Wunsch f9ea588525 Update the man page to reflect the search order for avrdude.conf 2022-01-03 23:53:51 +01:00
Joerg Wunsch fa079bec8c Hint about possibly differing licensing terms.
With the advent of whereami.[ch], not all files have a uniform
license anymore.
2022-01-03 23:35:59 +01:00
Joerg Wunsch 3a77394d67 Mention recent PRs and fixed issues 2022-01-03 23:35:10 +01:00
Kristof Mulier 5c896992cd
Find 'avrdude.conf' based on absolute path to executable (#780)
* Find 'avrdude.conf' based on absolute path to executable

* Update coding style

* Update coding style

* Update 'src/doc/avrdude.texi' to reflect the new search method for 'avrdude.conf'
2022-01-03 23:20:31 +01:00
Jörg Wunsch 6aa65683ad
Merge pull request #794 from mariusgreuel/pr-auto-version
Derive program version string from last commit

(Works on CMake only.)
2022-01-03 23:06:37 +01:00
MCUdude ecca860972 Add target voltage adjustment for Curiosity Nano boards
in Avrdude terminal mode
2022-01-03 18:51:33 +01:00
Yegor Yefremov dc1fed40bf avrftdi: don't use the deprecated ftdi_usb_purge_buffers routine
Since commit ed46f09c1ccd1351e003a200ba50e3e4778ac478 (Implement
tc[io]flush methods & deprecate broken purge_buffers methods.)
ftdi_usb_purge_buffers() routine is deprecated. Use HAVE_FTDI_TCIOFLUSH
macro to invoke the newly introduced ftdi_tcioflush() routine.
2022-01-03 17:59:05 +01:00
Marius Greuel 4d5af6370d Change version URL from Savannah to GitHub 2022-01-03 15:13:00 +01:00
Marius Greuel 12a67554d9 Derive program version from last commit 2022-01-03 15:04:25 +01:00
Jörg Wunsch aa2f132b24
Merge pull request #793 from mariusgreuel/pr-yacc
Use yacc/byacc as an alternative to bison, closes #785
2022-01-03 14:05:11 +01:00
Marius Greuel e843db55ae Use yacc/byacc as an alternative to bison 2022-01-03 13:10:54 +01:00
MCUdude f96b98e9df Mute "flash and boot" warning if s UPDI programmer is used
Currently, no UPDI compatible AVR has a dedicated boot section like the Xmegas do
2022-01-02 19:20:05 +01:00
MCUdude dcd5374ae9 Print meaningful error if programmer doesn't support target 2022-01-02 12:57:42 +01:00
MCUdude b9f03b1377 Fix typo in URL 2022-01-02 12:13:15 +01:00
MCUdude f5bec43812 Add jtag2updi programmer to docs 2022-01-02 12:13:15 +01:00
MCUdude a2a276a8cc Add support for UPDI devices though jtag2updi
'Hack' borrowed from https://github.com/facchinm/avrdude
2022-01-02 12:13:15 +01:00
MCUdude 71d5dbec48 Add more jtagmkii baud rates 2022-01-02 12:13:13 +01:00
Joerg Wunsch c69627a87c Update NEWS
Structure has also been changed to use the Github terminology
(issues and pull requests, rather than bugs and patches).
2022-01-01 21:11:31 +01:00
Joerg Wunsch a6a06f47f6 Prevent `spi' and `pgm' commands from crashing terminal mode
These commands are been meaningful only on direct bitbang programming
adapters which implement a pgm->setpin method.

Disable these commands for all other programmers, and issue an
informational message.

This is a partial fix for bug #790.
2022-01-01 20:58:26 +01:00
Jörg Wunsch 69231d7ad0
Merge pull request #791 from MCUdude/add-programmers
Add PicKit4 and SNAP programmers
2022-01-01 20:31:59 +01:00
MCUdude 2623e7a9fa Update docs to reflect new programmers 2022-01-01 12:06:52 +01:00
MCUdude 302b6eb05a Add PicKit4 and SNAP ISP and PDI programmer options 2022-01-01 12:04:16 +01:00
Joerg Wunsch 89c4ab0375 Remove the License subclause 2021-12-31 00:07:52 +01:00
Marius Greuel 5246cf1750 Make Windows version resource accept fewer than four version numbers 2021-12-29 22:28:19 +01:00
Marius Greuel 65e3fe358a Always upload GitHub Build artifacts, even on failure 2021-12-29 22:27:36 +01:00
MCUdude 0a335e2f73 Add jtag2updi programmer 2021-12-29 14:27:51 +01:00
Joerg Wunsch e3520aba9d Merge remote-tracking branch 'upstream/main' 2021-12-28 23:42:08 +01:00
Jörg Wunsch 4c3530e199
Merge pull request #787 from dl8dtl/serialupdi-manpage
Serialupdi manpage
2021-12-28 23:41:22 +01:00
Joerg Wunsch a369f9d28f SerialUPDI man page addition 2021-12-28 23:34:34 +01:00
Joerg Wunsch fd276c1e88 Add SerialUPDI documentation to man page 2021-12-28 23:32:48 +01:00
Joerg Wunsch 805ca48ffa Merge remote-tracking branch 'upstream/main' 2021-12-28 23:24:13 +01:00
Jörg Wunsch b14459dc04
Merge pull request #782 from dbuchwald/main
Documentation for SerialUPDI programmer
2021-12-28 23:23:37 +01:00
Joerg Wunsch a625db23e0 Merge remote-tracking branch 'upstream/main' 2021-12-28 15:00:53 +01:00
Jörg Wunsch f531af70db
Merge pull request #783 from mariusgreuel/pr-improve-cmake
Improve CMake project
2021-12-28 14:47:58 +01:00
Jörg Wunsch 5520bd6711
Merge pull request #784 from mariusgreuel/pr-bugfix-avr_read
Fix avr_read() for page reads

Closes issue #481
2021-12-26 18:34:39 +01:00
Marius Greuel 55251ea6f5 Fix avr_read() for page reads with page sizes that are not a multiple of the memory size 2021-12-26 16:57:23 +01:00
Marius Greuel 3840468e36 Improve CMake project to filter conditional sections 2021-12-26 16:46:15 +01:00
Marius Greuel f391b7138b Improve CMake project for FreeBSD builds 2021-12-26 16:40:28 +01:00
Dawid Buchwald c48c5135d8 Added SerialUPDI related documentation 2021-12-26 14:34:01 +01:00
Dawid Buchwald 993b8d7792 Another addition to .gitignore file 2021-12-26 14:22:39 +01:00
Dawid Buchwald b78170397a Added missing entry to .gitignore 2021-12-26 13:06:21 +01:00
Jörg Wunsch c60c5c4b83
Merge pull request #779 from yegorich/memleaks
Fix memory leaks

In jtag3_send() and jtagmkI_send(), free the buffer when returning an error.
2021-12-26 00:44:33 +01:00
Yegor Yefremov d14bb02dca Fix memory leaks
Free buf in the case of an error. Found via cppcheck.
2021-12-24 10:14:16 +01:00
Jörg Wunsch 3d39f3f232
Merge pull request #777 from yegorich/typos
Fix typos in src/avrftdi.c.

No actual code change imposed.
2021-12-23 17:52:36 +01:00
Yegor Yefremov f2dc95ea01 Fix typos 2021-12-23 17:17:08 +01:00
Joerg Wunsch 025ebd4ae8 Ah OK, CMAKE doesn't like dashes in the version number.
Turn 6.99-20211218 into 6.99.20211218
2021-12-22 23:33:20 +01:00
Joerg Wunsch 47947fb35c Make version numbers of configure.ac and CMakeLists.txt match
We are moving towards AVRDUDE 7.0, so express this by using
6.99 by now.
2021-12-22 23:27:05 +01:00
Marius Greuel 86cef2559f Add serialupdi to CMakeLists.txt 2021-12-22 22:40:21 +01:00
Jörg Wunsch 1f44ec5e0c
Merge pull request #768 from mariusgreuel/pr-migration2
GitHub Migration part 2: start a CMake infrastructure
2021-12-22 22:20:21 +01:00
Jörg Wunsch 2c0ccfed3a
Merge pull request #772 from dbuchwald/main
SerialUPDI implementation - release candidate 1
2021-12-22 20:01:35 +01:00
Dawid Buchwald c093b21a67 Moved SerialUPDI sources to correct location 2021-12-21 21:45:36 +01:00
Dawid Buchwald 291549d021 Merged AVRDUDES/main into SerialUPDI branch 2021-12-21 21:38:51 +01:00
Dawid Buchwald 0bb1b758a4 Removed files from old location 2021-12-21 21:30:31 +01:00
Jörg Wunsch cef773d17f
Merge pull request #769 from mariusgreuel/pr-windows-cleanup
Remove 'windows' folder with giveio.sys driver
2021-12-21 18:11:10 +01:00
Marius Greuel 764c0f6e19 Add credits for giveio.sys driver contributions 2021-12-21 17:57:39 +01:00
Marius Greuel 60cb548075 Remove 'windows' folder with giveio.sys driver 2021-12-21 17:45:35 +01:00
Marius Greuel 89c345c6a6 Add GitHub build action for CMake project 2021-12-20 17:52:37 +01:00
Marius Greuel e4ebfe420c Add Windows version resource 2021-12-20 17:51:44 +01:00
Marius Greuel fbdb6a98c0 Add CMake project 2021-12-20 17:50:42 +01:00
Joerg Wunsch 868895e2e0 Make `bootstrap' executable
That bit appears to get lost during transition from SVN.
2021-12-19 00:35:52 +01:00
Jörg Wunsch 6454bd79a8
Merge pull request #767 from dl8dtl/toplevel-updates
Update toplevel files.
2021-12-18 22:35:02 +01:00
Joerg Wunsch 3a8af359f3 Update toplevel files.
Integrate old INSTALL into README.md, both files had a lot
of (potential) overlap.

Add template for new entries in NEWS, targetting next release.

Bump version number to 6.99-20211218

Tentatively, with the Github migration and all ongoing code
restructuring, we aim for a version 7.0 release at some point
in the future.
2021-12-18 22:32:50 +01:00
Jörg Wunsch 6404e78154
Merge pull request #765 from mariusgreuel/pr-migration1
GitHub Migration
* Move source files to src/ subdir
* Remove ChangeLog* - meta information is kept in VCS anyway
* replace old README by readme.md
2021-12-18 21:38:03 +01:00
Dawid Buchwald d1dddad896 Added support for writing USERROW memory 2021-12-18 16:47:37 +01:00
Dawid Buchwald c3100763cb Implemented lockbits programming and forced chip erase procedure
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/branches/serialupdi@1522 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-18 15:25:30 +01:00
Dawid Buchwald dc846ba7e8 Fix candidate for EEPROM writing issue
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/branches/serialupdi@1520 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-18 15:25:30 +01:00
Dawid Buchwald 189f829c3f Fix candidate for write fuse operation
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/branches/serialupdi@1519 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-18 15:25:30 +01:00
Dawid Buchwald 9ff14b7a42 Fix candidate for issue with atmega4809
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/branches/serialupdi@1518 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-18 15:25:30 +01:00
Dawid Buchwald e941d4d3f1 Implemented faster flash programming method
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/branches/serialupdi@1517 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-18 15:25:30 +01:00
Dawid Buchwald c6902553be First successful programming
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/branches/serialupdi@1516 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-18 15:25:30 +01:00
Dawid Buchwald 8f67f9c50b Implemented byte and page read operations
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/branches/serialupdi@1514 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-18 15:25:29 +01:00
Dawid Buchwald 748bee8ecf Basic read operations implemented
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/branches/serialupdi@1513 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-18 15:25:29 +01:00
Dawid Buchwald b6e72dce4c Implemented basic serial code refactoring for upcoming SerialUPDI implementation
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/branches/serial_refactoring@1511 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-18 15:25:27 +01:00
Marius Greuel 062fa8c77b Add link of original AVRDUDE repository to README.md 2021-12-17 22:52:27 +01:00
Marius Greuel e6427d3420 Add AUTHORS file back in 2021-12-17 22:47:12 +01:00
Marius Greuel 5633a6d88a Move source files to 'src' folder 2021-12-17 09:17:42 +01:00
Marius Greuel d5959d27b8 Remove README, AUTHORS, ChangeLog*, BUILD-FROM-SVN 2021-12-16 23:25:06 +01:00
Marius Greuel 5596d06d93 Add README.md 2021-12-16 23:24:32 +01:00
Marius Greuel 9d916b31a0 Add .editorconfig 2021-12-16 23:24:32 +01:00
Marius Greuel e85d112891 Add .gitattributes and .gitignore, remove .cvsignore 2021-12-16 23:24:32 +01:00
Joerg Wunsch 7015ebe0d6 Update for release of version 6.4
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1523 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-16 21:02:35 +00:00
Joerg Wunsch 02a2cab296 Add a project-related INSTALL file
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1521 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-14 22:03:51 +00:00
Joerg Wunsch 6264404cc1 Allow for overriding make tool from environment
gmake (GNU make) appears to handle some dependencies better here than
bmake (BSD make).



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1515 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-10 22:34:57 +00:00
Joerg Wunsch 2df2587155 bug #57338: if safemode has to change fuses avrdude should exit with non-zero exit code
In main.c, drop unused variable `fuses_specified'.
Variable ran out of service in r519, but never got removed.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1509 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-06 21:46:41 +00:00
Joerg Wunsch 202b6cab39 bug #58994: VPP PWM still enabled at the end of programming process
Submitted by Dmitrii Chernukhin:
* pickit2.c (pickit2_disable): turn off VPP before shutting down




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1508 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-06 21:13:00 +00:00
Joerg Wunsch 6f69ddb068 Disable parport support by default; bump version date
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1507 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-05 21:57:12 +00:00
Joerg Wunsch 1214f99c2b patch #10153: linuxspi: Support "-E reset" and "-E noreset"
Submitted by Alex Sverdlin:
* linuxspi.c (linuxspi_parseexitspecs): New function




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1506 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-03 22:30:05 +00:00
Joerg Wunsch eb7ccaf92b Turn off FT245R_BITBANG_VARIABLE_PULSE_WIDTH_WORKAROUND by default
Seems it's not really needed for modern FT245, and it has the
potential to break bulk readout.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1505 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-01 22:17:50 +00:00
Joerg Wunsch b376b6acdc In ft245r.c, move forward function declaratons up-front.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1504 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-30 06:32:27 +00:00
Joerg Wunsch f09f308ff8 Bug #55462 was fixed in the course of patch #9757
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1503 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-27 23:15:06 +00:00
Joerg Wunsch 53de300b6e bug #58440: linuxgpio PIN limit too low
* libavrdude.h (PIN_MAX): bump (for HAVE_LINUXGPIO) to 400



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1502 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-27 21:54:56 +00:00
Joerg Wunsch 03132d7338 patch #8923: Enable TPI for linuxgpio
Submitted by David Mosberger-Tang:
* linuxgpio.c (linuxgpio_initpgm): add cmd_tpi entry




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1501 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-27 21:41:44 +00:00
Joerg Wunsch 15bd30d442 patch #8996: Remove lock byte read mask (bug#21954, bug#46759)
Submitted by: Milan Kupcevic <milan@debian.org>
* avrdude.conf.in (ATmega48, ATmega88, ATmega168, ATmega328)
(ATmega32U4, ATmega640, ATmega1280, ATmega1281, ATmega2560)
(ATmega2561, ATmega8, ATtiny13, ATmega64, ATmega128, ATmega16)
(AT90CAN32, AT90CAN64, AT90CAN128, ATmega324, ATmega644)
(ATmega1284, ATmega161, ATmega162, ATmega163, ATmega169, ATmega32)
(ATmega329, ATmega649, ATmega8515, ATmega8535, ATtiny2313, ATtiny4313)
(AT90PWM2, AT90USB646, AT90USB1286, AT90USB162, AT90USB82, ATmega32U2)
(ATmega16U2, ATmega8U2, ATmega325, ATmega645, ATtiny1634): Remove
lock byte read mask (bug#46759).




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1500 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-27 21:28:45 +00:00
Joerg Wunsch 4396674aa7 patch #9304: [Bug #48767] Implemented WinSock variation of "ser_drain(...)" functionality
Submitted by Christopher Cooper:
* ser_win32.c (ser_drain): Implement a network drain
function.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1499 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-27 21:15:55 +00:00
Joerg Wunsch c9a1405547 * linux_spi.c (linuxspi_open): ensure correct SPI mode is
Submitted by Lars Ollén:
set (submitted in the audit trail of patch #9816).




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1498 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-27 20:18:44 +00:00
Joerg Wunsch 2aee540bfa Use -B <bitclock> rather than -b <baudrate> to specify the clock rate
in linuxspi driver.

This offers the additional advantage of being able to parse kHz and
MHz values (in main.c).


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1497 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-27 18:21:44 +00:00
Joerg Wunsch dd1255b0c8 Improve defaults and documentation of linuxspi
* avrdude.conf.in: use @HAVE_LINUXGPIO_BEGIN/END@ and
@HAVE_LINUXSPI_BEGIN/END@ brackets around respective config
snippets; values were already set in configure.ac.
* linuxspi.c (linuxspi_open): Provide a reasonable (for the
Raspberry Pi) default for the -P option
* avrdude.1: Extend linuxspi documentation
* doc/avrdude.texi: (Dito.)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1496 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-27 17:33:49 +00:00
Joerg Wunsch 18fe8ef834 patch #10031: linuxspi: Support GPIO uAPI v2
Submitted by Alex Sverdlin:
* linuxspi.c (linuxspi_reset_mcu, linuxspi_open): Since Linux
v5.10 GPIO ABI Version 1 is optional and depends on
CONFIG_GPIO_CDEV_V1.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1495 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-27 15:51:24 +00:00
Joerg Wunsch bd4f46b1ff patch #10030: linuxspi: Support inverted GPIO pin
Submitted by Alex Sverdlin:
* linuxspi.c (linuxspi_open): Clear the inversion mask on request
and set default state to avoid short glitches on the GPIO line.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1494 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-27 15:48:30 +00:00
Joerg Wunsch 6f183d427c patch #10029: linuxspi: Report GPIO_GET_LINEHANDLE_IOCTL errors
Submitted by Alex Sverdlin:
* linuxspi.c (linuxspi_open): Report ioctl error




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1493 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-27 15:46:10 +00:00
Joerg Wunsch d208503911 Actually apply patch #10028 :)
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1492 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-27 15:43:57 +00:00
Joerg Wunsch 93767e0de1 patch #10028: linuxspi: close() only when necessary
Submitted by Alex Sverdlin:
* linuxspi.c: unify descriptor closing




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1491 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-27 15:42:33 +00:00
Joerg Wunsch 711323e7cc Submitted by Alex Sverdlin:
patch #10027: linuxspi: Add reset pulse, according to AVR programming algorithm
* linuxspi.c (linuxspi_open, linuxspi_program_enable):
movw out reset code into linuxspi_reset_mcu()



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1490 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-27 15:40:12 +00:00
Joerg Wunsch 6887f4f373 Add David Mosberger's email address (with permission)
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1489 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-25 18:51:54 +00:00
Joerg Wunsch 49e5f2451c patch #9328: ft245r.c: add TPI support (patches 5-7)
Submitted by David Mosberger-Tang:
* ft245r.c (ft245r_set_bitclock): add workaround for
FT245 hardware bugs in bitclock setting

Correct baud rate calculation (multiplying with factor of 2 was wrong)
and add compile-time workaround for FTDI chips suffering for the
variable pulse-width errata.  The workaround entails always running
the chip at 3MHz and stuffing the channel with repeated bytes to
achieve the desired baudrate.

This has no effect on programming speed.  Note, however, that now a
baudrate option -b750000 has to be used to achieve maximum speed.

(Option enabled by default now.)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1488 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-25 09:17:11 +00:00
Joerg Wunsch 2015a874e0 patch #9328: ft245r.c: add TPI support (patches 5-7)
Submitted by David Mosberger-Tang:
* ft245r.c: Remove the reader thread (also removes
patch #9079)

Eliminate separate reader thread by tracking how many bytes are queued
in the FTDI chip's RX FIFO and reading those bytes when it fills up
(since in synchronous bitbang mode, the chip won't send any more bytes
until it has space in the RX FIFO).  This reduces TPI programming time
by another 33%.

Since write data is now queued as much as possible, we need flush this
queued data (a) before reading and (b) before sleeping.  For the
latter case, a new helper function ft245r_usleep() is introduced.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1487 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-25 09:10:30 +00:00
Joerg Wunsch 5bf24e4e96 patch #9327: ft245r.c: add TPI support (patches 1-4)
Submitted by David Mosberger-Tang:

ft245r.c (set_pin, ft245r_open): use
ft245r_send_and_discard() so ft245r_in can go away




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1486 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-24 22:27:59 +00:00
Joerg Wunsch 105cebb389 patch #9327: ft245r.c: add TPI support (patches 1-4)
Submitted by David Mosberger-Tang:

Optimize TPI programming speed by reducing number of USB reads.
Specifically, when writing to the FTDI chip (without needing the data
it accumulates), simply increment a count of how many bytes the next
read should ignore.  Thus, if there is one or more write followed by a
read, we only need to read from the device once.

Improves TPI programming speed by another factor of 2.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1485 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-24 22:06:31 +00:00
Joerg Wunsch 7ff5652edc patch #9327: ft245r.c: add TPI support (patches 1-4)
Submitted by David Mosberger-Tang

With newer versions of the Linux kernel (e.g., Ubuntu's
linux-image-4.4.0-75-generic), the default for the latency timer is
set to a high value.  Since this driver needs quick turnaround times,
set it explicitly to the minium.  This improves TPI programming speed
by almost a factor of 10.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1484 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-24 22:00:45 +00:00
Joerg Wunsch 6de6c0ffce patch #9327: ft245r.c: add TPI support (patches 1-4)
Submitted by David Mosberger-Tang:
* ft245r.c: add TPI support
* avrdude.conf.in (tc2030): New programmer




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1483 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-24 21:25:45 +00:00
Joerg Wunsch d947e5893f * ft245r.c (ft245r_open): allow for picking a default
device if none has been provided by -P



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1482 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-24 21:09:33 +00:00
Joerg Wunsch 391439493d * jtag3.c (jtag3_edbg_recv_frame): Better handling for
fragment_info == 0x00 (no response available)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1481 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-24 21:04:47 +00:00
Joerg Wunsch 265aa3296b Fix logic bug in previous commit
Comparison against "usb" was done the wrong way.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1480 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-23 09:54:18 +00:00
Joerg Wunsch 172fcb7c7e Now that we have a matches() function, prefer it over strncmp()
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1479 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-23 09:48:15 +00:00
Joerg Wunsch bd50422644 patch #9757: Fix ATtiny817 Xplained Mini programmer
* jtag3.c (jtag3_getsync, jtag3_close): correctly extract
programmer name from list of names



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1478 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-23 09:42:39 +00:00
Joerg Wunsch 8004e38403 patch #8719: Support Over-the-Air bootloading with XBeeBoot
Submitted by David Sainty:
* xbee.c: New programmer
* xbee.h: (Dito.)
* pgm_type.c: Add xbee.h
* avrdude.conf.in (xbee): New programmer
* Makefile.am (libavrdude_a_SOURCES): add xbee.c, xbee.h
* avrdude.1: document the new programmer
* doc/avrdude.texi: (Dito.)




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1477 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-22 21:35:26 +00:00
Joerg Wunsch 9a15fcb25f Update ChangeLog for ft245r.c patches
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1476 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-14 15:48:53 +00:00
Joerg Wunsch f821bfc03d patch #9123: ftdi_syncbb: use FT245R_CYCLES in ft245r_set_bitclock()
Submitted by Ivan Frederiks:

Replace magic numbers by #defined constant



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1475 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-14 15:47:29 +00:00
Joerg Wunsch e8c5ed0fcd patch #9122: Fixed MISO sampling in ftdi_syncbb
Submitted by Ivan Frederiks

Fix MISO sampling on falling edge of SCK.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1474 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-14 15:44:54 +00:00
Joerg Wunsch ebea9b5237 Submitted by Ivan Frederiks:
patch #9079: Fix ftdi_syncbb teardown

Fix teardown sequence between reader thread and libusb.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1473 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-14 13:34:20 +00:00
Joerg Wunsch 5e6a662e8a Submitted by David Mosberger-Tang:
patch #9320: fix TPI RESET in bitbang.c
* bitbang.c (bitbang_initialize): wait for 128 ms after deasserting
/RESET (per datasheet), and keep /RESET low during MOSI/MISO link check



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1472 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-14 13:17:44 +00:00
Joerg Wunsch 3d1b0ff308 Submitted by Jon Thacker:
patch #9253: Fix for giving terminal_mode commands more than 20 arguments
* term.c (tokenize): fix realloc usage, pointer returned not necessarily
the same as pointer passed



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1471 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-12 22:11:49 +00:00
Joerg Wunsch db7249bf57 Submitted by Martino Facchin:
patch #9110: Let reserved fuse bits to be read as *don't care*
* avr.c (compare_memory_masked): New function
* libavrdude.h: declare compare_memory_masked(); also, insist on C99
so <stdint.h> is required now
* main.c: Use compare_memory_masked() in safemode comparisons

C99 / stdint.h has basically already been required before, as types
like uint8_t are in use in a number of other locations throughout the
source.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1470 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-12 22:02:29 +00:00
Joerg Wunsch 10df0ff15a Submitted by Joseph Coffland:
patch #8957: Allow reading prodsig memory from stk500v2 on xmega devices
* stk500v2.c (stk600_xprog_read_byte, stk600_xprog_paged_load):
treat "prodsig" memory space as equivalent to "calibration"



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1469 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-11 20:59:25 +00:00
Joerg Wunsch 91948428a6 Submitted by Martin Thierer:
patch #10017: uspasp / tpi: Automatically clear configuration byte (fuse) before writing it
* usbasp.c (usbasp_tpi_paged_write): clear fuse region before writing it



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1468 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-07 20:10:24 +00:00
Joerg Wunsch 62a00cedc7 Submitted by Michael Petersen:
patch #9697: Add iseavrprog support
* avrdude.conf.in (iseavrprog): New programmer



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1467 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-07 19:37:50 +00:00
Joerg Wunsch 8841a9cd93 bug #50630: Erase Cycle Counter options ( -y -Y n ) should be removed from usage Message
* main.c (usage): remove -y / -Y descriptions



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1466 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-07 16:51:42 +00:00
Joerg Wunsch 46628eb3c6 Add ATmega8A as an alias for ATmega8
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1465 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-07 16:49:12 +00:00
Joerg Wunsch 84af4b36a1 bug #50517: Reading fails if "immediate mode" for output file format
is selected - fileio: invalid operation=1

* update.c (do_op): refuse to write to "immediate format" argument




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1464 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-07 16:22:00 +00:00
Joerg Wunsch 1b3afa4cef Move ATmega164P definition after its parent ATmega324P
Error was introduced in r1458.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1463 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-07 16:06:42 +00:00
Joerg Wunsch eb461f706f Submitted by Martin Thierer:
bug #60863: avrftdi programming error probably caused by multiple, consecutive empty pages
* avrftdi.c (avrftdi_flash_write): Skip empty pages



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1462 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-07 16:00:16 +00:00
Joerg Wunsch 9cf4edf76f Submitted by Matwey V. Kornilov:
bug #58495: Add atmega324pb support to avrdude.conf.in
* avrdude.conf.in (ATmega324PB): new entry



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1461 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-07 15:50:53 +00:00
Joerg Wunsch ea27bfef1e bug #51409: Can't program EFUSE on ATmega32M1
Was already fixed, adjust bug id in NEWS



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1460 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-07 15:48:01 +00:00
Joerg Wunsch 7c554b0035 bug #55734: USBtiny programming of ATmega328p broken by Patch #9278
* usbtiny.c (usbtiny_initialize): undo change from patch #9728



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1459 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-07 15:44:18 +00:00
Joerg Wunsch 8907155291 Fix entry for ATmega164P, by deriving it from ATmega324P
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1458 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-07 15:28:24 +00:00
Joerg Wunsch aedc3b0c2a Submitted by evan Venn:
bug #59227: Add new part. How does one get a part added to the CONF file?
* avrdude.conf.in (LGT8FX88P, LGT8FX168P, LGT8FX328P): new parts



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1457 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-07 09:18:32 +00:00
Joerg Wunsch b05e8af0a7 Submitted by Britton Kerin:
bug #57453: [PATCH] fix reference to nonexistant -m option by changing to -U
* avrdude.1: replace -m option by -U



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1456 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-06 22:44:21 +00:00
Joerg Wunsch 60f5885849 Submitted by Andrew D'Addesio:
bug #58078: [PATCH] buspirate: remove compound literals (fixes GCC>=9)
* buspirate.c (buspirate_start_mode_bin):
avoid propagating local scope compound literals



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1455 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-06 22:34:29 +00:00
Joerg Wunsch e074edf4cb Submitted by Jan Egil Ruud:
patch #10000: Add support for extended UPDI device context
* avrdude.conf.in (pickit4_updi, snap_updi, pkobn_updi):
new programmers
* avrdude.conf.in (ATmega808, ATmega809, ATmega1608, ATmega1609)
(AVR DA, AVR DB): new devices
* jtag3.c: Add support for extended UPDI device context
* jtag3_private.h: (Dito.)
* tools/atdf-to-avrdude.xslt: Bug fixes
* usbdevs.h: Bump USBDEV_MAX_XFER_3 to 912
* doc/avrdude.texi: Document changes
* avrdude.1: (Dito)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1454 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-06 22:13:51 +00:00
Joerg Wunsch c9aeaf8928 Submitted by gerardoallende:
bug #59525: Bogus error message because Copy/Paste typo in stk500.c
* stk500.c (stk500_getparm): Fix bogus ID in error message




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1453 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-06-27 20:42:06 +00:00
Joerg Wunsch 38e5aa33ea bug #60753: Patch #1436 breaks multiple programmer/device combinations on MacOS BigSur
* avr.c: compare page_size > 1 instead of != 0
* stk500v2.c: (Ditto.)




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1452 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-06-27 20:26:05 +00:00
Joerg Wunsch 69a771317f ChangeLog rotation
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1451 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-06-27 20:24:30 +00:00
Joerg Wunsch 1b650f594d * avrdude.conf.in (m32m1): add "size" parameter in "efuse"
section

Reported by Hannes Wallnöfer:



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1450 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-22 07:36:45 +00:00
Joerg Wunsch c934f95f5e patch #9744: Patch for ATMega324A support
* avrdude.conf.in (m324a): New entry.

Submitted by Björn Mellström



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1449 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-20 20:51:51 +00:00
Joerg Wunsch e98f9854b7 patch #9811: ATmega328pb has efuse bit 3
* avrdude.conf.in (m328pb): Add own efuse definition

Submitted by Ronald Sutherland



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1448 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-20 18:29:03 +00:00
Joerg Wunsch 40b0b104d6 patch #9816: Implement new programmer type: linuxspi
* linuxspi.c: (New file.)
* linuxspi.h: (New file.)
* Makefile.am: Add new files
* configure.ac: Add "linuxspi" --enable option
* avrdude.conf.in: Add "linuxspi" programmer template
* pgm_type.c: Include linuxspi programmer
* doc/avrdude.texi: Document new programmer
* avrdude.1: (Dito.)

Submitted by Ralf Ramsauer



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1447 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-19 21:32:38 +00:00
Joerg Wunsch 9b3762a812 patch #9963: UsbAsp 3 MHz patch for UsbAsp-flash firmware
* usbasp.c: Implement 3 MHz clock option including capability check
* usbasp.h: (Dito.)

Submitted by Marcin Miskiewic



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1446 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-18 21:52:12 +00:00
Joerg Wunsch 1d2e4ef388 patch #9966: Add JTAGICE3 in UPDI mode
* avrdude.conf (jtag3updi): New entry.

Submitted by Sven Schwermer:



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1445 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-18 21:24:03 +00:00
Joerg Wunsch 2c4f9d23b4 patch #9732: usbtiny_paged_load overflows buffer e.g. when reading EEPROM
* usbtiny.c (usbtiny_paged_load, usbtiny_paged_write): ensure chunk
does not overflow memory area

Submitted by Joel Ray Holveck




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1444 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-18 21:16:13 +00:00
Joerg Wunsch 3f5e101f09 Fix various typos.
Submitted by Adrian Klieber
patch #9818: correct typos in SVN rev 1429



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1443 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-16 21:31:19 +00:00
Joerg Wunsch e35e8f414a Document patch #9820 has been applied
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1442 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-16 21:26:42 +00:00
Joerg Wunsch 4278300d8e Fix some possibly uninitialized variables in stk500v2_display()
Submitted by Adrian Klieber
patch #9820: Fix some out-of-bounds/uninitialized issues



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1441 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-16 21:19:50 +00:00
Joerg Wunsch 34a1c8394c Fix handling of SCK parameter table in AVRISP2
Submitted by Adrian Klieber
patch #9820: Fix some out-of-bounds/uninitialized issues



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1440 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-16 21:15:30 +00:00
Joerg Wunsch acd2aa6417 Use correct pmg->type field in WIN32 implementation
Submitted by Adrian Klieber
patch #9820: Fix some out-of-bounds/uninitialized issues



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1439 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-16 21:13:24 +00:00
Joerg Wunsch b23c506cbd Enforce correct length of target string constraints in strncpy().
Clang did warn about these.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1438 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-10 21:43:23 +00:00
Joerg Wunsch 60529b4e50 ChangeLog entry for previous commit
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1437 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-10 21:40:40 +00:00
Joerg Wunsch da0e437eaa Ensure page_size is always at least 1
This avoids potential divisions by 0, and possibly also other mistakes
in case of malformed avrdude.conf entries.

The solution is different than the one in patch #9820 but is supposed
to cover that condition as well.

patch #9820: Fix some out-of-bounds/uninitialized issues



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1436 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-09-10 21:37:34 +00:00
Joerg Wunsch 785b0cea55 patch #9819: Address several leaks in SVN rev 1429
Submitted by Adrian Klieber



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1435 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-03-14 22:34:45 +00:00
Joerg Wunsch c34fb88844 Submitted by: kautism
patch #9893: [PATCH] Reader reads ftdi handle after main thread close it
* ft245r.c: Wait until reader thread has been stopped before closing FTDI



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1434 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-03-11 12:39:57 +00:00
Joerg Wunsch ae24d7a284 Add changelog entry for previous commit (fix compiler warnings)
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1433 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-03-11 09:43:15 +00:00
Joerg Wunsch e43c47a93f Annual ChangeLog rotation
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1432 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-03-11 09:42:02 +00:00
Joerg Wunsch 061406c602 Fix compiler warnings
* misleading indentation after spin loop
* EM_AVR32 might be defined in system <libelf.h> already


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1431 81a1dc3b-b13d-400b-aceb-764788c761c2
2020-03-11 09:41:15 +00:00
Joerg Wunsch 4648eca956 bug #57428: [PATCH] document when 'arduino' or 'wiring' should be used, and -D requirement of latter
* avrdude.1: Clarify
* doc/avrdude.texi: (dito)

Submitted by Britton Kerin




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1430 81a1dc3b-b13d-400b-aceb-764788c761c2
2019-12-17 22:31:51 +00:00
Joerg Wunsch bb7be5efe6 Submitted by Martino Facchin:
patch #9728: Fix UsbTiny programmer
* usbtiny.c (usbtiny_initialize): Only consider
pgm->program_enable successful if returning 0




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1429 81a1dc3b-b13d-400b-aceb-764788c761c2
2019-01-05 23:16:11 +00:00
Joerg Wunsch 536816087b Submitted by Milan Kupcevic:
patch #9735: spelling error fix: psuedo -> pseudo
* avrpart.c (avr_display): Spelling fix




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1428 81a1dc3b-b13d-400b-aceb-764788c761c2
2019-01-05 23:01:56 +00:00
Joerg Wunsch 0a3faafd57 Annual ChangeLog rotation.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1427 81a1dc3b-b13d-400b-aceb-764788c761c2
2019-01-05 22:59:06 +00:00
Joerg Wunsch 46e573cde6 Fix author name in some files.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1426 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-03-15 22:03:36 +00:00
Joerg Wunsch f36484ed19 patch #8444: Proposal for modifications in -B and -U command options managment
* update.c (parse_op): Default -U filename to RBIN for output
files



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1425 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-21 22:45:45 +00:00
Joerg Wunsch d4b40ef6ee Fix a typo in previous commit.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1424 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-21 22:21:25 +00:00
Joerg Wunsch 9cb9f504ae Submitted by Simone:
patch #8128: Added new option to configure.ac script
* configure.ac (disable-libusb_1_0): New option




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1423 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-18 22:15:08 +00:00
Joerg Wunsch 7de935d3ad Submitted by Jan Egil Ruud:
patch #9542: Correct "usersig" on avr8x devices
* avrdude.conf.in (.avr8x_tiny, .avr8x_mega): rename "userrow" to
"usersig", and fix its page size for .avr8x_mega
* jtag3.c: Remove all "userrow" handling



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1422 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-18 21:52:00 +00:00
Joerg Wunsch e5aca9db5b Submitted by Reinhard Max
patch #8311: Add IPv6 support to the -Pnet:host:port option
* ser_posix.c (net_open): Rewrite to use getaddrinfo()
rather than gethostbyname()
* avrdude.1: Document IPv6 feature
* doc/avrdude.texi: (Dito)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1421 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-17 07:39:29 +00:00
Joerg Wunsch f8cbb6ddad Add patch #9185 in NEWS file.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1420 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-16 22:42:30 +00:00
Joerg Wunsch 0bd9e3e48b Submitted by Maciej:
patch #9185: Add extended_param to usbasp.c - erasing
configuration section in ATtiny 4...40 (TPI)
* usbasp.c: Implement extended parameter parsing, and modify
usbasp_tpi_chip_erase() appropriately
* avrdude.1: Document USBasp extended parameters
* doc/avrdude.texi: (Dito)




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1419 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-16 22:40:28 +00:00
Joerg Wunsch 6543ee1df6 Submitted by Tom Carney:
patch #8219: Fix boot_start for xmega devices on jtagmkII
* jtagmkII.c (jtagmkII_initialize): Determine boarder between
application and boot area correctly.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1418 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-16 22:01:36 +00:00
Joerg Wunsch c3ec8d5229 Submitted by Jan Egil Ruud <janegil.ruud@microchip.com>
patch #9507: Fix UPDI chip erase
* libavrdude.h (PROGRAMMER): add unlock method
* avr.c (avr_unlock): Generic unlock function
* jtag3.c: Implement unlock feature; avoid calling
jtag3_edbg_prepare() and jtag3_edbg_signoff() on XplainedMini
boards to work around a bug in early firmware versions;
implement "userrow" memory region
* main.c: Call avr_unlock() rather than avr_chip_erase() when
encountering a locked UPDI chip



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1417 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-16 21:17:04 +00:00
Joerg Wunsch 7eb498992c Submitted by Nicolas BRULEZ
patch #8910: ATxmega32c4 and ATxmega16c4 have wrong signatures
bug #41388: ATxmega32c4 and ATxmega16c4 have wrong signatures
* avrdude.conf.in (ATxmega16C4, ATxmega32C4): Fix signatures



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1416 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-15 23:14:27 +00:00
Joerg Wunsch 7140312c17 Submitted by Dennis Reimers:
patch #8580: FT245r support to select device by serial number
* ft245r.c (ft245r_open): Add serial number parsing.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1415 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-15 22:44:22 +00:00
Joerg Wunsch 845abf1d08 Submitted by Axel Simon:
patch #9033: avrdoper backend uses libhidapi instead of libusb
* ser_avrdoper: Add libhidapi implementation
* stk500v2.c: Adapt #ifdefs for LIBHIDAPI
* avrdude.1: Document change
* doc/avrdude.texi: (Dito)




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1414 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-14 23:12:06 +00:00
Joerg Wunsch b46c10e661 Clarify TPI connections for USBtiny.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1413 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-14 20:30:30 +00:00
Joerg Wunsch 2b9108b58f Submitted by David Mosberger-Tang
patch #8924: Enable TPI for usbtiny
* usbtiny.c: Extend to handle TPI targets
* configure.ac: Probe for <netinet/in.h>



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1412 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-12 23:31:35 +00:00
Joerg Wunsch aab6f0bd35 Submitted by Yegor Yefremov:
patch #9222: Enable silent build
* configure.ac: Add AM_SILENT_RULES
* Makefile.am: Document how to run "make" to get verbose
build messages




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1411 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-12 22:07:39 +00:00
Joerg Wunsch df4cd5e8a2 Submitted by: Kjetil Kjeka:
patch #9317: Support atmega64m1 as part
* avrdue.conf.in (ATmega64M1): New entry.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1410 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-12 21:55:40 +00:00
Joerg Wunsch 4de2d7c8c4 Submitted by Submitted David Griffith:
patch #9530: Update URL to Ladyada's USBtinyISP page.
* avrdude.conf.in (usbtiny): Update URL



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1409 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-12 21:45:09 +00:00
Joerg Wunsch 6744c9e48a Submitted by Milan Kupcevic:
patch #9423: Support ATtiny841 and ATtiny441
bug #47376: ATtiny841 description missing in configuration file
bug #49455: support for tiny441
* avrdude.conf.in (ATtiny841, ATtiny441): New entries



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1408 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-12 21:38:09 +00:00
Joerg Wunsch 164ee65147 Add various ChangeLog files to distribution.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1407 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-10 07:06:23 +00:00
Joerg Wunsch 85a2eed129 patch #9506: Script to create device configuration stub from Atmel ATDF files
Thanks to Morten Engelhardt Olsen for his contribution!



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1406 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-10 06:59:26 +00:00
Joerg Wunsch 47112a4734 Submitted by Jan Egil Ruud <janegil.ruud@microchip.com>
patch #9507: Fix UPDI chip erase
* lexer.l (family_id): New keyword.
* config_gram.y: (Ditto)
* doc/avrdude.texi: Document new keyword
* avrdude.conf.in: Add family_id for avr8x devices
* avr.c: Pass error code up.
* jtag3.c: Pass error code from memory read up; implement
jtag3_read_sib()
* libavrdude.h: Add new items.
* main.c: Implement different chip erase handling required
for UPDI devices.

Submitted by Jan Egil Ruud <janegil.ruud@microchip.com>
patch #9506: Script to create device configuration stub from Atmel ATDF files
* avrdude.conf.in (ATtiny202, ATtiny204, ATtiny402, ATtiny404)
(ATtiny406, ATtiny804, ATtiny806, ATtiny807, ATtiny1604)
(ATtiny1606, ATtiny1607, ATtiny212, ATtiny214, ATtiny412)
(ATTiny414, ATtiny416, ATtiny417, ATtiny814, ATtiny816)
(ATtiny1614, ATtiny1616, ATtiny3214, ATtiny3216, ATtiny3217)
(ATmega3208, ATmega3209, ATmega4808, ATmega4809): New devices




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1405 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-09 23:29:31 +00:00
Joerg Wunsch 6b57f3dc8b Annual ChangeLog rotation.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1404 81a1dc3b-b13d-400b-aceb-764788c761c2
2018-01-09 23:17:54 +00:00
Joerg Wunsch 559c20f207 Submitted by Jan Egil Ruud <janegil.ruud@microchip.com>
patch #9507: Fix UPDI chip erase
* jtag3.c (jtag3_chip_erase_updi): New function
* jtag3_private.h: More constants




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1403 81a1dc3b-b13d-400b-aceb-764788c761c2
2017-12-30 00:05:54 +00:00
Joerg Wunsch ecaaa1e1d5 Submitted by Jan Egil Ruud <janegil.ruud@microchip.com>
patch #9508: Add PowerDebugger and XPlained Mini in UPDI mode
* avrdude.conf.in (xplainedmini_updi, powerdebugger,
powerdebugger_pdi, powerdebugger_updi, powerdebugger_dw,
powerdebugger_isp): New programmers

(extends previous commit)


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1402 81a1dc3b-b13d-400b-aceb-764788c761c2
2017-12-29 23:33:54 +00:00
Joerg Wunsch 7ac874ffe1 Add Xplained Mini in UPDI mode as new programmer.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1401 81a1dc3b-b13d-400b-aceb-764788c761c2
2017-12-29 23:16:50 +00:00
Joerg Wunsch 82dc3bf679 bootstrap: Detect whether libtoolize is named `glibtoolize' (MacOS)
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1400 81a1dc3b-b13d-400b-aceb-764788c761c2
2017-12-29 22:23:06 +00:00
Joerg Wunsch 6e57e225e7 Bump version date to indicate added UPDI support.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1399 81a1dc3b-b13d-400b-aceb-764788c761c2
2017-11-29 23:11:35 +00:00
Joerg Wunsch 186656b855 Submitted by Jan Egil Ruud <janegil.ruud@microchip.com>
patch #9482: Add support for UPDI and AVR8X
* avrdude.conf.in (xplainedpro_updi): New programmer
* avrdude.conf.in (.avr8x, ATtiny1617, ATtiny817): New device
family and devices
* config_gram.y: add K_OCD_BASE and K_HAS_UPDI
* lexer.l: (Ditto.)
* doc/avrdude.texi: Document "has_updi" flag
* jtag3.c: Implement UPDI
* jtag3.h: (Ditto.)
* jtag3_private.h: (Ditto.)
* libavrdude.h: Add ocd_base value and AVRPART_HAS_UPDI flag
* pgm_type.c: Add jtagice3_updi




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1398 81a1dc3b-b13d-400b-aceb-764788c761c2
2017-11-29 23:09:51 +00:00
Joerg Wunsch 492a7b6709 Submitted by Jan Egil Ruud <janegil.ruud@microchip.com>
avrdude.conf.in (ATmega328PB): New part



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1397 81a1dc3b-b13d-400b-aceb-764788c761c2
2017-11-29 22:44:56 +00:00
Joerg Wunsch 1c83889f8f bug #48084: Avoid compiled-in timestamp for reproducible release builds
Remove "compiled on/at" string in main.c.
 



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1396 81a1dc3b-b13d-400b-aceb-764788c761c2
2017-11-13 16:47:51 +00:00
Joerg Wunsch 9099352871 Fix bug-id for last change.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1395 81a1dc3b-b13d-400b-aceb-764788c761c2
2017-03-06 21:12:00 +00:00
Joerg Wunsch d6deb43957 Reported by Roger A. Krupski:
safemode.c: Display lfuse at correct MSG level



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1394 81a1dc3b-b13d-400b-aceb-764788c761c2
2017-03-05 18:23:18 +00:00
Joerg Wunsch f0c62a3ff8 Annual changelog rotation.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1393 81a1dc3b-b13d-400b-aceb-764788c761c2
2017-03-05 18:21:08 +00:00
Joerg Wunsch 7e32be2599 Define DEBUG and DEBUGRECV unconditionally, as MSG_TRACE2 messages.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1392 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-09-14 06:17:59 +00:00
Joerg Wunsch 86ce06c189 Add ehajo-isp programmer (commercial version of USBtiny).
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1391 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-05-09 22:05:59 +00:00
Joerg Wunsch b5b37c30f2 * configure.ac (libftdi1): Rather than hardcoding the library
providing the libusb-1.0 API, use the result from the previous
probe.  This helps detecting libftdi1 on FreeBSD where the
libusb-1.0 API is provided by the system's libusb.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1390 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-04-20 20:40:58 +00:00
Joerg Wunsch 71be95b16a In usbhid_open(), correctly calculate the
offset for serial number matching.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1389 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-04-18 14:47:53 +00:00
Joerg Wunsch 185b615245 bug #47550: Linux GPIO broken
* linuxgpio.c: Replace %ud by %u in snprintf calls.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1388 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-03-28 17:29:30 +00:00
Joerg Wunsch 02e6082312 Bump read timeout in usbhid_recv() to 300 ms.
In some situations (e.g. when accessing a DW-fused device),
100 ms have proven to be too short.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1387 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-03-02 21:04:36 +00:00
Joerg Wunsch a6dc66fb9e Back out rev 1385, it was committed accidentally.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1386 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-03-02 16:49:01 +00:00
Joerg Wunsch 0634e4eb92 Support packet fragmentation and reassembly in hid_thread(), for
mEDBG devices.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1385 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-03-02 16:45:10 +00:00
Joerg Wunsch 5dba081585 Summary: Before returning, call hid_free_enumeration().
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1384 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-02-24 22:14:06 +00:00
Joerg Wunsch 3afd51e7d5 Summary: Fix walking the list of HID matches
When walking the list of matches returned by hid_enumerate(),
actually proceed to the next element.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1383 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-02-24 22:08:36 +00:00
Joerg Wunsch 9db53455a9 Fix an off-by-one error in usbhid_send().
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1382 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-02-22 09:23:20 +00:00
Joerg Wunsch 081b6fe229 Use libhidapi as (optional) transport for CMSIS-DAP compliant
debuggers (JTAGICE3 with firmware 3+, AtmelICE, EDBG, mEDBG).



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1381 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-02-20 22:50:13 +00:00
Joerg Wunsch 45cdd4a906 (Obtained from patch #8717: pattch for mcprog and libhidapi support)
* configure.ac: Probe for libhidapi
* Makefile.am: Add @LIBHIDAPI@




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1380 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-02-17 21:48:37 +00:00
Joerg Wunsch aac9fc6365 Bump copyright year.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1379 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-02-16 22:28:19 +00:00
Joerg Wunsch 8b6b83043a Bump for post-release 6.3.
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1378 81a1dc3b-b13d-400b-aceb-764788c761c2
2016-02-16 22:08:17 +00:00
215 changed files with 65224 additions and 40942 deletions

39
.editorconfig Normal file
View File

@ -0,0 +1,39 @@
# EditorConfig: https://editorconfig.org
root = true
[{CMakeLists.txt,*.cmake}]
charset = utf-8
tab_width = 4
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
[{bootstrap,configure.ac,avrdude.spec.in,Makefile.am}]
charset = utf-8
tab_width = 4
indent_size = 4
indent_style = tab
[avrdude.conf.in]
indent_size = 4
indent_style = space
[*.{c,h,cpp,y}]
tab_width = 4
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
charset = utf-8
tab_width = 2
indent_size = 2
indent_style = space
[*.yml]
charset = utf-8
tab_width = 2
indent_size = 2
indent_style = space

4
.gitattributes vendored Normal file
View File

@ -0,0 +1,4 @@
* text=auto eol=lf
*.sln text eol=crlf
*.vcxproj text eol=crlf
*.vcxproj.filters text eol=crlf

293
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,293 @@
#
# build.yml - GitHub build action for AVRDUDE
# Copyright (C) 2021 Marius Greuel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
name: Build
on:
push:
branches-ignore:
- 'onlinedocs'
pull_request:
branches-ignore:
- 'onlinedocs'
workflow_call:
env:
BUILD_TYPE: RelWithDebInfo
jobs:
linux-x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install prerequisites
run: >-
sudo apt-get update
sudo apt-get install -y
build-essential
cmake
flex
bison
libelf-dev
libusb-dev
libusb-1.0-0-dev
libhidapi-dev
libftdi1-dev
libreadline-dev
texinfo
texlive
texi2html
- name: Configure
run: >-
cmake
-D BUILD_DOC=1
-D DEBUG_CMAKE=1
-D HAVE_LINUXGPIO=1
-D HAVE_LINUXSPI=1
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-B build
- name: Build
run: cmake --build build
- name: Archive build artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: build-linux-x86_64
path: |
build/
!**/*.d
!**/*.o
- name: Archive executables
uses: actions/upload-artifact@v3
with:
name: avrdude-linux-x86_64
path: |
build/src/avrdude
build/src/avrdude.conf
linux:
runs-on: ubuntu-latest
container: debian:11
strategy:
matrix:
include:
- { arch: i386, processor: i686, prefix: i686-linux-gnu, inc-lib: i386-linux-gnu }
- { arch: armhf, processor: armhf, prefix: arm-linux-gnueabihf, inc-lib: arm-linux-gnueabihf }
- { arch: arm64, processor: aarch64, prefix: aarch64-linux-gnu, inc-lib: aarch64-linux-gnu }
steps:
- uses: actions/checkout@v3
- name: Add architecture
run: |
dpkg --add-architecture ${{matrix.arch}}
apt-get update
- name: Install prerequisites
run: >-
apt-get update
apt-get install -y
git
cmake
flex
bison
crossbuild-essential-${{matrix.arch}}
libelf-dev:${{matrix.arch}}
libusb-dev:${{matrix.arch}}
libusb-1.0-0-dev:${{matrix.arch}}
libhidapi-dev:${{matrix.arch}}
libftdi1-dev:${{matrix.arch}}
libreadline-dev:${{matrix.arch}}
- name: Configure
run: >-
cmake
-D DEBUG_CMAKE=1
-D HAVE_LINUXGPIO=1
-D HAVE_LINUXSPI=1
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-D CMAKE_SYSTEM_NAME=Linux
-D CMAKE_SYSTEM_PROCESSOR=${{matrix.processor}}
-D CMAKE_C_COMPILER=${{matrix.prefix}}-gcc
-D CMAKE_FIND_ROOT_PATH=/usr/${{matrix.prefix}}
-D CMAKE_INCLUDE_PATH=/usr/include/${{matrix.inc-lib}}
-D CMAKE_LIBRARY_PATH=/usr/lib/${{matrix.inc-lib}}
-B build
- name: Build
run: cmake --build build
- name: Archive build artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: build-linux-${{matrix.processor}}
path: |
build/
!**/*.d
!**/*.o
- name: Archive executables
uses: actions/upload-artifact@v3
with:
name: avrdude-linux-${{matrix.processor}}
path: |
build/src/avrdude
build/src/avrdude.conf
macos-x86_64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install prerequisites
run: >-
# brew update
brew install
cmake
flex
bison
libelf
libusb
hidapi
libftdi
readline
- name: Configure
run: >-
cmake
-D CMAKE_C_FLAGS=-I/usr/local/include
-D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/Cellar
-D DEBUG_CMAKE=1
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-B build
- name: Build
run: cmake --build build
- name: Archive build artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: build-macos-x86_64
path: |
build/
!**/*.d
!**/*.o
- name: Archive executables
uses: actions/upload-artifact@v3
with:
name: avrdude-macos-x86_64
path: |
build/src/avrdude
build/src/avrdude.conf
msvc:
runs-on: windows-latest
strategy:
matrix:
include:
- { arch: x86, platform: Win32 }
- { arch: x64, platform: x64 }
- { arch: arm64, platform: ARM64 }
steps:
- uses: actions/checkout@v3
- name: Install prerequisites
# As Chocolatey is notoriously unreliable, install winflexbison3 directly from GitHub.
# run: choco install winflexbison3
run: |
curl https://github.com/lexxmark/winflexbison/releases/download/v2.5.24/win_flex_bison-2.5.24.zip --location --output winflexbison.zip
unzip winflexbison.zip -d ${{github.workspace}}\winflexbison
echo "${{github.workspace}}\winflexbison" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Configure
run: >-
cmake
-A ${{matrix.platform}}
-D DEBUG_CMAKE=1
-D CMAKE_SYSTEM_VERSION=11
-D CMAKE_C_FLAGS_RELWITHDEBINFO="/MT /GL /Zi /O2 /Ob1 /DNDEBUG"
-D CMAKE_CXX_FLAGS_RELWITHDEBINFO="/MT /GL /Zi /O2 /Ob1 /DNDEBUG"
-D CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO="/DEBUG /INCREMENTAL:NO /LTCG /OPT:REF /OPT:ICF"
-D HAVE_LIBREADLINE=HAVE_LIBREADLINE-NOTFOUND
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-D USE_EXTERNAL_LIBS=1
-B build
- name: Build
run: cmake --build build --config ${{env.BUILD_TYPE}}
- name: Archive build artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: build-msvc-${{matrix.arch}}
path: |
build/
!**/_deps/
!**/*.obj
- name: Move executables
run: |
mv build/src/RelWithDebInfo/avrdude.exe build/src
mv build/src/RelWithDebInfo/avrdude.pdb build/src
- name: Archive executables
uses: actions/upload-artifact@v3
with:
name: avrdude-msvc-${{matrix.arch}}
path: |
build/src/avrdude.exe
build/src/avrdude.pdb
build/src/avrdude.conf
mingw:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
strategy:
matrix:
include:
- { sys: mingw32, env: i686 }
- { sys: mingw64, env: x86_64 }
steps:
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
update: true
install: >-
base-devel
mingw-w64-${{matrix.env}}-gcc
mingw-w64-${{matrix.env}}-cmake
mingw-w64-${{matrix.env}}-libelf
mingw-w64-${{matrix.env}}-libusb
mingw-w64-${{matrix.env}}-libusb-compat-git
mingw-w64-${{matrix.env}}-hidapi
mingw-w64-${{matrix.env}}-libftdi
- name: Configure
run: >-
cmake
-G"MSYS Makefiles"
-D DEBUG_CMAKE=1
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-B build
- name: Build
run: cmake --build build
- name: Archive build artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: build-mingw-${{matrix.env}}
path: |
build/
- name: Archive executables
uses: actions/upload-artifact@v3
with:
name: avrdude-mingw-${{matrix.env}}
path: |
build/src/avrdude.exe
build/src/avrdude.conf

78
.github/workflows/deploy.yml vendored Normal file
View File

@ -0,0 +1,78 @@
#
# deploy.yml - GitHub deploy action for AVRDUDE
# Copyright (C) 2021 Marius Greuel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
name: Deploy
on:
push:
tags:
- 'v*-windows'
jobs:
build:
uses: mariusgreuel/avrdude/.github/workflows/build.yml@windows
release:
needs: build
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: ${{github.ref}}
release_name: AVRDUDE ${{github.ref}}
body: "See **[Release Notes](https://github.com/avrdudes/avrdude/blob/main/NEWS)** for changes"
draft: false
prerelease: false
asset-msvc:
needs: release
runs-on: ubuntu-latest
strategy:
matrix:
include:
- { arch: x86 }
- { arch: x64 }
- { arch: arm64 }
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: avrdude-msvc-${{matrix.arch}}
- name: Create release asset
run: >-
zip -j asset.zip
avrdude.exe
avrdude.pdb
avrdude.conf
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{needs.release.outputs.upload_url}}
asset_path: ./asset.zip
asset_name: avrdude-${{github.ref_name}}-windows-${{matrix.arch}}.zip
asset_content_type: application/zip

View File

@ -1,3 +1,7 @@
.DS_Store
.deps/
.libs/
m4/
*.diff
*.patch
y.output
@ -5,16 +9,16 @@ y.tab.h
lexer.c
config_gram.c
config_gram.h
.cvsignore
.depend
.deps
INSTALL
Makefile.in
Makefile
ac_cfg.h.in
ac_cfg.h.in~
aclocal.m4
autom4te.cache
configure
configure~
depcomp
install-sh
compile
@ -31,3 +35,33 @@ config.log
config.status
config.sub
avrdude
libtool
ltmain.sh
ylwrap
tags
cscope.out
*.o
*.lo
*.a
*.la
# CMake
out/
build/
build_*/
# Visual Studio
.vs/
[Dd]ebug/
[Rr]elease/
x64/
x86/
*.suo
*.user
*.userosscache
*.sln.docstates
*.log
# Visual Studio code
.vscode/

26
AUTHORS
View File

@ -2,6 +2,14 @@ AVRDUDE was written by:
Brian S. Dean <bsd@bdmicro.com>
AVRDUDE is currently maintained by:
Hans Eirik Bull
Stefan Rueger
Xiaofan Chen
Marius Greuel
Joerg Wunsch
Contributors:
Joerg Wunsch <j@uriah.heep.sax.de>
@ -10,7 +18,7 @@ Contributors:
Alex Shepherd <maillists@ajsystems.co.nz>
Martin Thomas <mthomas@rhrk.uni-kl.de>
Theodore A. Roth <troth@openavr.org>
Michael Holzt <kju-avr@fqdn.org>
Juliane Holzt <avrdude@juliane.holzt.de>
Colin O'Flynn <coflynn@newae.com>
Thomas Fischl <tfischl@gmx.de>
David Hoerl <dhoerl@mac.com>
@ -23,6 +31,20 @@ Contributors:
Brett Hagman <bhagman@roguerobotics.com>
Rene Liebscher <r.liebscher@gmx.de>
Jim Paris <jim@jtan.com>
Jan Egil Ruud <janegil.ruud@microchip.com>
David Mosberger <davidm@egauge.net>
David Sainty
Marius Greuel <greuelm@mgtek.com>
Dawid Buchwald <dawid.buchwald@hotmail.com>
Hans Eirik Bull
Stefan Rueger
Xiaofan Chen
For minor contributions, please see the ChangeLog files.
Contributors to code no longer present:
Dale Roberts for the giveio driver
Paula Tomlinson for the loaddrv sources
Chris Liechti for loaddrv modifications
For minor contributions, please see the ChangeLog files / Git log.

View File

@ -1,13 +0,0 @@
$Id$
How to build avrdude from SVN:
1. svn co svn://svn.savannah.nongnu.org/avrdude/trunk
2. cd trunk/avrdude
3. ./bootstrap
4. ./configure
5. make

396
CMakeLists.txt Normal file
View File

@ -0,0 +1,396 @@
#
# CMakeLists.txt - CMake project for AVRDUDE
# Copyright (C) 2021 Marius Greuel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Typical usage:
# cmake -B build
# cmake --build build
cmake_minimum_required(VERSION 3.14)
project(avrdude VERSION 7.1 LANGUAGES C)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED True)
option(BUILD_DOC "Enable building documents" OFF)
option(HAVE_LINUXGPIO "Enable Linux sysfs GPIO support" OFF)
option(HAVE_LINUXSPI "Enable Linux SPI support" OFF)
option(HAVE_PARPORT "Enable parallel port support" OFF)
option(USE_EXTERNAL_LIBS "Use external libraries from AVRDUDE GitHub repositories" OFF)
option(USE_LIBUSBWIN32 "Prefer libusb-win32 over libusb" OFF)
option(DEBUG_CMAKE "Enable debugging output for this CMake project" OFF)
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
if(WIN32)
# Prefer static libraries over DLLs on Windows
option(USE_STATIC_LIBS "Use static libraries" ON)
else()
option(USE_STATIC_LIBS "Use static libraries" OFF)
endif()
include(CheckIncludeFile)
include(CheckSymbolExists)
include(FetchContent)
include(FindPackageMessage)
include(GNUInstallDirs)
set(CONFIG_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}")
set(AVRDUDE_FULL_VERSION ${CMAKE_PROJECT_VERSION})
# =====================================
# Get Git commit info
# =====================================
# GIT_COMMIT_HASH -> hash of latest commit, e.g. b8b859f5
# GIT_COMMIT_DATE -> date of latest commit, e.g. 20201231
# GIT_COMMIT_YEAR -> year of latest commit, e.g. 2020
find_package(Git)
if(Git_FOUND)
execute_process(
COMMAND "${GIT_EXECUTABLE}" log -1 --format=%h
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT_HASH
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND "${GIT_EXECUTABLE}" log -1 --format=%ad --date=format:%Y%m%d
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT_DATE
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND "${GIT_EXECUTABLE}" log -1 --format=%ad --date=format:%Y
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT_YEAR
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND "${GIT_EXECUTABLE}" log -1 --tags --format=%h
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_TAG_HASH
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
# If the commit is not tagged, include the date and commit hash in the full version string.
if(NOT GIT_COMMIT_HASH STREQUAL GIT_TAG_HASH)
set(AVRDUDE_FULL_VERSION "${CMAKE_PROJECT_VERSION}-${GIT_COMMIT_DATE} (${GIT_COMMIT_HASH})")
endif()
endif()
find_package(FLEX)
if(NOT FLEX_FOUND)
message(SEND_ERROR "This CMake project requires 'flex', which is not installed on your system." )
endif()
find_package(BISON QUIET)
if(BISON_FOUND)
find_package_message(BISON "Found BISON: ${BISON_EXECUTABLE} (found version \"${BISON_VERSION}\")" "[${BISON_EXECUTABLE}][${BISON_VERSION}]")
else()
find_program(YACC_EXECUTABLE NAMES yacc byacc DOC "path to the yacc executable")
mark_as_advanced(YACC_EXECUTABLE)
if(YACC_EXECUTABLE)
find_package_message(YACC "Found YACC: ${YACC_EXECUTABLE}" "[${YACC_EXECUTABLE}]")
else()
message(SEND_ERROR "This CMake project requires 'bison', 'yacc', or 'byacc', which is not installed on your system." )
endif()
endif()
# =====================================
# Detect installed libraries
# =====================================
if(USE_STATIC_LIBS)
set(PREFERRED_LIBELF libelf.a elf)
set(PREFERRED_LIBUSB libusb.a usb)
set(PREFERRED_LIBUSB_1_0 libusb-1.0.a usb-1.0)
set(PREFERRED_LIBHIDAPI libhidapi.a libhidapi-libusb.a libhidapi-hidraw.a hidapi hidapi-libusb hidapi-hidraw)
set(PREFERRED_LIBFTDI libftdi.a ftdi)
set(PREFERRED_LIBFTDI1 libftdi1.a ftdi1)
set(PREFERRED_LIBREADLINE libreadline.a)
else()
set(PREFERRED_LIBELF elf)
set(PREFERRED_LIBUSB usb)
set(PREFERRED_LIBUSB_1_0 usb-1.0)
set(PREFERRED_LIBHIDAPI hidapi hidapi-libusb hidapi-hidraw)
set(PREFERRED_LIBFTDI ftdi)
set(PREFERRED_LIBFTDI1 ftdi1)
set(PREFERRED_LIBREADLINE readline)
endif()
# -------------------------------------
# Find libelf
find_library(HAVE_LIBELF NAMES ${PREFERRED_LIBELF})
if(HAVE_LIBELF)
set(LIB_LIBELF ${HAVE_LIBELF})
check_include_file(libelf.h HAVE_LIBELF_H)
check_include_file(libelf/libelf.h HAVE_LIBELF_LIBELF_H)
endif()
# -------------------------------------
# Find libusb
find_library(HAVE_LIBUSB NAMES ${PREFERRED_LIBUSB})
if(HAVE_LIBUSB)
set(LIB_LIBUSB ${HAVE_LIBUSB})
endif()
find_library(HAVE_LIBUSB_1_0 NAMES ${PREFERRED_LIBUSB_1_0})
if(HAVE_LIBUSB_1_0)
set(LIB_LIBUSB_1_0 ${HAVE_LIBUSB_1_0})
endif()
# FreeBSD's library 'libusb' supports both the libusb-0.1 and libusb-1.0 API.
if (HAVE_LIBUSB AND CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set(HAVE_LIBUSB_1_0 ${HAVE_LIBUSB})
endif()
find_library(HAVE_LIBUSB_WIN32 NAMES libusb0.a usb0)
if(HAVE_LIBUSB OR HAVE_LIBUSB_1_0 OR HAVE_LIBUSB_WIN32)
check_include_file(usb.h HAVE_USB_H)
check_include_file(lusb0_usb.h HAVE_LUSB0_USB_H)
check_include_file(libusb.h HAVE_LIBUSB_H)
check_include_file(libusb-1.0/libusb.h HAVE_LIBUSB_1_0_LIBUSB_H)
if((USE_LIBUSBWIN32 OR NOT HAVE_LIBUSB) AND HAVE_LIBUSB_WIN32)
set(HAVE_LIBUSB ${HAVE_LIBUSB_WIN32})
set(LIB_LIBUSB ${HAVE_LIBUSB_WIN32})
unset(HAVE_USB_H CACHE)
elseif(NOT HAVE_USB_H)
find_path(LIBUSB_COMPAT_DIR libusb-compat/usb.h)
if(LIBUSB_COMPAT_DIR)
set(LIBUSB_COMPAT_DIR ${LIBUSB_COMPAT_DIR}/libusb-compat)
set(HAVE_USB_H 1)
else()
unset(LIBUSB_COMPAT_DIR CACHE)
endif()
endif()
endif()
# -------------------------------------
# Find libhidapi
find_library(HAVE_LIBHID NAMES hid)
if(HAVE_LIBHID)
set(LIB_LIBHID ${HAVE_LIBHID})
endif()
find_library(HAVE_LIBHIDAPI NAMES ${PREFERRED_LIBHIDAPI})
if(HAVE_LIBHIDAPI)
set(LIB_LIBHIDAPI ${HAVE_LIBHIDAPI})
check_include_file(hidapi/hidapi.h HAVE_HIDAPI_HIDAPI_H)
endif()
# -------------------------------------
# Find libftdi
find_library(HAVE_LIBFTDI NAMES ${PREFERRED_LIBFTDI})
if(HAVE_LIBFTDI)
set(LIB_LIBFTDI ${HAVE_LIBFTDI})
set(HAVE_LIBFTDI_TYPE_232H 1)
endif()
find_library(HAVE_LIBFTDI1 NAMES ${PREFERRED_LIBFTDI1})
if(HAVE_LIBFTDI1)
set(LIB_LIBFTDI1 ${HAVE_LIBFTDI1})
set(HAVE_LIBFTDI_TYPE_232H 1)
set(CMAKE_REQUIRED_LIBRARIES ${LIB_LIBFTDI1} ${LIB_LIBUSB} ${LIB_LIBUSB_1_0})
check_symbol_exists(ftdi_tcioflush "libftdi1/ftdi.h" HAVE_FTDI_TCIOFLUSH)
endif()
# -------------------------------------
# Find libreadline
find_library(HAVE_LIBREADLINE NAMES ${PREFERRED_LIBREADLINE})
if(HAVE_LIBREADLINE)
set(LIB_LIBREADLINE ${HAVE_LIBREADLINE})
elseif(MSVC)
set(HAVE_LIBREADLINE 1)
endif()
# =====================================
# Use external libraries if requested
# =====================================
if(USE_EXTERNAL_LIBS)
FetchContent_Declare(libelf
GIT_REPOSITORY https://github.com/avrdudes/libelf.git
GIT_TAG e5a39bf19bd6598c42e09172be5a78ceec2a065c
)
FetchContent_Declare(libusb
GIT_REPOSITORY https://github.com/avrdudes/libusb.git
GIT_TAG 632bc25d04eff563cc00de29435b9a7ed6f4654c
)
FetchContent_Declare(libhidapi
GIT_REPOSITORY https://github.com/avrdudes/libhidapi.git
GIT_TAG d1307487973c857bc158e27ecc99644b2f5e68ea
)
FetchContent_Declare(libftdi
GIT_REPOSITORY https://github.com/avrdudes/libftdi.git
GIT_TAG f9fe6e96b97c3a08efd081632c1859cb83aa14e3
)
message(STATUS "Fetching external libraries, please wait...")
FetchContent_MakeAvailable(
libelf
libusb
libhidapi
libftdi
)
message(STATUS "Using external library 'libelf'")
set(LIB_LIBELF libelf)
set(HAVE_LIBELF 1)
set(HAVE_LIBELF_H 1)
message(STATUS "Using external library 'libusb'")
set(LIB_LIBUSB libusb)
set(HAVE_LIBUSB 1)
set(HAVE_LUSB0_USB_H 1)
message(STATUS "Using external library 'libhidapi'")
set(LIB_LIBHIDAPI libhidapi)
set(HAVE_LIBHIDAPI 1)
set(HAVE_HIDAPI_HIDAPI_H 1)
message(STATUS "Using external library 'libftdi'")
set(LIB_LIBFTDI libftdi)
set(HAVE_LIBFTDI 1)
set(HAVE_LIBFTDI_TYPE_232H 1)
endif()
add_subdirectory(src)
if(BUILD_DOC)
add_subdirectory(src/doc)
endif()
# =====================================
# Configuration
# =====================================
message(STATUS "Configuration summary:")
message(STATUS "----------------------")
if (DEBUG_CMAKE)
message(STATUS "CMAKE_HOST_SYSTEM: ${CMAKE_HOST_SYSTEM}")
message(STATUS "CMAKE_SYSTEM: ${CMAKE_SYSTEM}")
message(STATUS "CMAKE_FIND_ROOT_PATH: ${CMAKE_FIND_ROOT_PATH}")
message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
message(STATUS "CONFIG_DIR: ${CONFIG_DIR}")
message(STATUS "AVRDUDE_FULL_VERSION: ${AVRDUDE_FULL_VERSION}")
message(STATUS "USE_EXTERNAL_LIBS: ${USE_EXTERNAL_LIBS}")
message(STATUS "USE_LIBUSBWIN32: ${USE_LIBUSBWIN32}")
message(STATUS "HAVE_LIBELF: ${HAVE_LIBELF}")
message(STATUS "HAVE_LIBUSB: ${HAVE_LIBUSB}")
message(STATUS "HAVE_LIBUSB_1_0: ${HAVE_LIBUSB_1_0}")
message(STATUS "HAVE_LIBUSB_WIN32: ${HAVE_LIBUSB_WIN32}")
message(STATUS "HAVE_LIBHID: ${HAVE_LIBHID}")
message(STATUS "HAVE_LIBHIDAPI: ${HAVE_LIBHIDAPI}")
message(STATUS "HAVE_LIBFTDI: ${HAVE_LIBFTDI}")
message(STATUS "HAVE_LIBFTDI1: ${HAVE_LIBFTDI1}")
message(STATUS "HAVE_LIBREADLINE: ${HAVE_LIBREADLINE}")
message(STATUS "HAVE_LIBELF_H: ${HAVE_LIBELF_H}")
message(STATUS "HAVE_LIBELF_LIBELF_H: ${HAVE_LIBELF_LIBELF_H}")
message(STATUS "HAVE_USB_H: ${HAVE_USB_H}")
message(STATUS "HAVE_LUSB0_USB_H: ${HAVE_LUSB0_USB_H}")
message(STATUS "HAVE_LIBUSB_H: ${HAVE_LIBUSB_H}")
message(STATUS "HAVE_LIBUSB_1_0_LIBUSB_H: ${HAVE_LIBUSB_1_0_LIBUSB_H}")
message(STATUS "HAVE_HIDAPI_HIDAPI_H: ${HAVE_HIDAPI_HIDAPI_H}")
message(STATUS "LIBUSB_COMPAT_DIR: ${LIBUSB_COMPAT_DIR}")
message(STATUS "----------------------")
endif()
if(HAVE_LIBELF)
message(STATUS "DO HAVE libelf")
else()
message(STATUS "DON'T HAVE libelf")
endif()
if(HAVE_LIBUSB)
message(STATUS "DO HAVE libusb")
else()
message(STATUS "DON'T HAVE libusb")
endif()
if(HAVE_LIBUSB_1_0)
message(STATUS "DO HAVE libusb_1_0")
else()
message(STATUS "DON'T HAVE libusb_1_0")
endif()
if(HAVE_LIBHIDAPI)
message(STATUS "DO HAVE libhidapi")
else()
message(STATUS "DON'T HAVE libhidapi")
endif()
if(HAVE_LIBFTDI)
if(HAVE_LIBFTDI1)
message(STATUS "DO HAVE libftdi (but prefer to use libftdi1)")
else()
message(STATUS "DO HAVE libftdi")
endif()
else()
message(STATUS "DON'T HAVE libftdi")
endif()
if(HAVE_LIBFTDI1)
message(STATUS "DO HAVE libftdi1")
else()
message(STATUS "DON'T HAVE libftdi1")
endif()
if(HAVE_LIBREADLINE)
message(STATUS "DO HAVE libreadline")
else()
message(STATUS "DON'T HAVE libreadline")
endif()
if(BUILD_DOC)
message(STATUS "ENABLED doc")
else()
message(STATUS "DISABLED doc")
endif()
if(HAVE_PARPORT)
message(STATUS "ENABLED parport")
else()
message(STATUS "DISABLED parport")
endif()
if(HAVE_LINUXGPIO)
message(STATUS "ENABLED linuxgpio")
else()
message(STATUS "DISABLED linuxgpio")
endif()
if(HAVE_LINUXSPI)
message(STATUS "ENABLED linuxspi")
else()
message(STATUS "DISABLED linuxspi")
endif()
message(STATUS "----------------------")

76
CMakeSettings.json Normal file
View File

@ -0,0 +1,76 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"variables": [
{
"name": "USE_EXTERNAL_LIBS",
"value": "true",
"type": "BOOL"
}
]
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{
"name": "USE_EXTERNAL_LIBS",
"value": "true",
"type": "BOOL"
}
]
},
{
"name": "x86-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x86" ],
"variables": [
{
"name": "USE_EXTERNAL_LIBS",
"value": "true",
"type": "BOOL"
}
]
},
{
"name": "x86-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x86" ],
"variables": [
{
"name": "USE_EXTERNAL_LIBS",
"value": "true",
"type": "BOOL"
}
]
}
]
}

View File

@ -1,41 +0,0 @@
2016-02-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Released version 6.3.
2016-02-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
patch #8894: Spelling in 6.2 doc
* doc/avrdude.texi: Various spelling fixes.
2016-02-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
patch #8895: Spelling in 6.2 code
* avrftdi.c (avrftdi_open): Spell fix.
2016-02-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
patch #8896: Silence cppcheck warnings in 6.2 code
* linuxgpio.c: Use %ud to print GPIO values.
2016-02-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
patch #8735: ATtiny28 support in avrdude.conf
* avrdude.conf.in (ATtiny28): New device.
2016-02-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.conf.in (ATmega48PB, ATmega88PB, ATmega168PB): New
devices.
2016-02-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
patch #8435: Implementing mEDBG CMSIS-DAP protocol
* usb_libusb.c: Add endpoint IDs for Xplained Mini, correctly
transfer trailing ZLP when needed
* avrdude.conf.in (xplainedmini, xplainedmini_dw): New entries.
* jtag3.c (jtag3_edbg_send, jtag3_edbg_recv_frame): Implement
fragmentation needed for the 64-byte EP size of the Xplained Mini
* avrdude.1: Document the change
* doc/avrdude.texi: (Dito.)

View File

@ -1,598 +0,0 @@
2001-12-30 Brian S. Dean <bsd@bsdhome.com>
* main.c: Update version.
* avrdude.conf.sample: Clarify a comment.
* avrdude.conf.sample: fix address bits
* avrdude.1: Bring up to date.
2001-12-29 Brian S. Dean <bsd@bsdhome.com>
* avrdude.conf.sample: Add the AVR3 progammer.
* avr.c, avrdude.conf.sample, config_gram.y, main.c, pindefs.h:
Fix VCC assertion.
Make the BUFF pin a mask like VCC to allow multiple pins to be
asserted at the same time (STK200 has two buffer enable lines).
Add the STK200 programmer.
Fix EEPROM address line selection for several parts.
2001-12-15 Brian S. Dean <bsd@bsdhome.com>
* avrdude.conf.sample: fix spelling error
2001-11-24 Brian S. Dean <bsd@bsdhome.com>
* Makefile:
Change "WARNING" to "NOTE" when overwriting the avrprog.conf file.
* avrdude.1: Add my e-mail address.
* avrdude.conf.sample:
Add comments about instruction formats. Correct an instruction
specification (cut&paste error).
2001-11-21 Brian S. Dean <bsd@bsdhome.com>
* avr.c, config_gram.y, lexer.l, term.c:
In interactive mode, reset the address and length if we start dumping
a memory type different than the previous one.
* avr.c, avrdude.conf.sample, config_gram.y:
Allow instruction data to be specified more flexibly, which can be
used to make the instruction input more readable in the config file.
* main.c: Bump version number.
* Makefile, avr.c, avr.h, avrdude.conf.sample, config.c, config.h:
* config_gram.y, fileio.c, fileio.h, lexer.l, main.c, term.c:
This is a major re-write of the programming algorithms. The Atmel
serial programming instructions are not very orthoganal, i.e., the
"read fuse bits" instruction on an ATMega103 is an entirely different
opcode and data format from the _same_ instruction for an ATMega163!
Thus, it becomes impossible to have a single instruction encoding
(varying the data) across the chip lines.
This set of changes allows and requires instruction encodings to be
defined on a per-part basis within the configuration file. Hopefully
I've defined the encoding scheme in a general enough way so it is
useful in describing the instruction formats for yet-to-be invented
Atmel chips. I've tried hard to make it match very closely with the
specification in Atmel's data sheets for their parts. It's a little
more verbose than what I initially hoped for, but I've tried to keep
it as concise as I could, while still remaining reasonably flexible.
2001-11-19 Brian S. Dean <bsd@bsdhome.com>
* avr.c, avr.h, avrdude.conf.sample, main.c, ppi.c, term.c:
Add support for ATMega163.
Add support for reading/writing ATMega163 lock and fuse bits.
Unfortunately, in looking at the specs for other ATMega parts, they
use entirely different instruction formats for these commands. Thus,
these routines won't work for the ATMega103, for example.
Add support for sending raw command bytes via the interactive terminal
interface. This allows one to execute any programming instruction on
the target device, whether or not avrprog supports it explicitly or
not. Thus, one can use this feature to program fuse / lock bits, or
access any other feature of a current or future device that avrprog
does not know how to do.
Add in comments, an experimental instruction format in the
configuration file. If this works out, it would allow supporting new
parts and non-orthoganal instructions across existing parts without
making avrprog code changes.
2001-11-17 Brian S. Dean <bsd@bsdhome.com>
* avrdude.conf.sample: Add ATMEGA163 part.
2001-11-11 Brian S. Dean <bsd@bsdhome.com>
* main.c: output formatting
2001-11-05 Brian S. Dean <bsd@bsdhome.com>
* ppi.c: Get ppi.h from /usr/include, not /sys.
2001-10-31 Brian S. Dean <bsd@bsdhome.com>
* avr.c, avrdude.conf.sample, main.c: Correct version string.
Update read/write status more frequently.
Prefix ATMega parts with an 'm'.
2001-10-16 Brian S. Dean <bsd@bsdhome.com>
* avr.c: Change ording for memory display.
* config_gram.y: comment
* avr.c, avr.h, avrdude.conf.sample, config_gram.y, lexer.l, term.c:
Fix (again, hopefully) page addressing for the ATMega parts.
Rename the poorly chosen name "bank" to "page" for page addressing.
Atmel calls it "page" in their documentation.
* config_gram.y, main.c: Fix an (non)exit.
Silence a couple of compiler warnings.
* avr.c, avr.h, avrdude.conf.sample, config_gram.y, main.c:
Fix ATMega flash addressing. Add an ATMEGA16 part. Perform sanity
checking on the memory parameters for parts that do bank addressing.
2001-10-15 Brian S. Dean <bsd@bsdhome.com>
* config.c, config.h, lists.h: Add copyright.
* config_gram.y, lexer.l, lists.c: Add copyrights.
* Makefile: Attempt to install avrprog.conf.
* avrdude.conf.sample: Correct dt006 pinout.
* Makefile, lexer.l:
Try and detect an old-style config file and print an appropriate error
message and a suggestion for correcting it.
* Makefile, avr.c, avrdude.1, avrdude.conf.sample: Update the man page.
Miscellaneous minor cleanups.
2001-10-14 Brian S. Dean <bsd@bsdhome.com>
* Makefile, Makefile.inc, avr.c, avr.h, avrdude.conf.sample:
* config.c, config.h, config_gram.y, lexer.l, lists.c, lists.h:
* main.c, pindefs.h, term.c:
Use lex/yacc for parsing the config file. Re-work the config file
format using a more human-readable format.
Read part descriptions from the config file now instead of hard-coding
them.
Update usage().
Cleanup unused code.
* Makefile, avr.c, avr.h, fileio.c, term.c:
First cut at supporting the ATmega 103 which uses bank addressing and
has a 128K flash.
Due to the bank addressing required, interactive update of the flash
is not supported, though the eeprom can be updated interactively.
Both memories can be programmed via non-interactive mode.
Intel Hex Record type '04' is now generated as required for outputing
memory contents that go beyond 64K.
2001-10-13 Brian S. Dean <bsd@bsdhome.com>
* avr.c, avr.h, fileio.c, fileio.h, main.c, ppi.c, ppi.h, term.c:
* term.h:
Style fixes.
* avr.c, avr.h, fileio.c, fileio.h, main.c, term.c:
Commit changes in preparation for support the ATMega line.
2001-10-01 Brian S. Dean <bsd@bsdhome.com>
* Makefile: Don't override CFLAGS.
* avrdude.1: Correct default pin assignment.
* avr.c, fileio.c, main.c, ppi.c, term.c:
Remove debugging code - it served its purpose.
Update copyrights.
2001-09-21 Brian S. Dean <bsd@bsdhome.com>
* main.c:
Be sure to read the exit specs after the pin configuration has been
assigned, otherwise, we may apply the exit specs to the wrong pins.
* main.c: debugging
2001-09-20 Brian S. Dean <bsd@bsdhome.com>
* avrdude.1, avrdude.conf.sample, main.c:
Prefix pin config entries in the config file with a "c:". Later, I
might make part descriptions read in this way and we can use a
different letter for those (p). This will make the parsing easier to
distinguish between the entry types.
* main.c: Initialize pin configuration description.
2001-09-19 Brian S. Dean <bsd@bsdhome.com>
* AVRprog.pdf, Makefile, avr.c, avrdude.1, avrdude.conf.sample:
* avrdude.pdf, fileio.c, fileio.h, main.c, pindefs.h, term.c:
Make the pin definitions configurable based on entries in a config
file. This makes supporting other programmers much easier.
Rename AVRprog.pdf to avrprog.pdf.
2001-04-29 Brian S. Dean <bsd@bsdhome.com>
* avrprog-programmer.jpg: Remove this image file from the repository.
2001-04-26 Brian S. Dean <bsd@bsdhome.com>
* avrprog-schematic.jpg:
Remove this image, use AVRprog.pdf as the preferred schematic for the
programmer.
2001-04-25 Brian S. Dean <bsd@bsdhome.com>
* AVRprog.pdf, Makefile, avrdude.1:
Add a schematic provided by Joerg Wunch and also update the manual
page (also updated by Joerg) to reference the schematic.
2001-02-25 Brian S. Dean <bsd@bsdhome.com>
* Makefile, Makefile.inc: Automate dependency generation.
2001-02-08 Brian S. Dean <bsd@bsdhome.com>
* main.c: Turn off ready led when finished programming.
* main.c: update version
* avr.c, main.c: Correct a few comments.
* Makefile, avr.c, term.c: Makefile : update dependencies
avr.c : correct status led updates
term.c : update status leds on write, make the address and length
arguments for dump optional.
2001-01-26 Brian S. Dean <bsd@bsdhome.com>
* main.c: Version 1.1
* main.c:
Hmmm ... cvs co -D <timestamp> does not work. Change the revision
timestamp to a full date/time value.
* avr.c, fileio.c, main.c, ppi.c, term.c:
Add a -V option to display the version information about each
component module. This is intended for support purposes, so that I
can tell unambiguously what version a binary out in the field is.
Additionally, display a revision timestamp along with the version
number. This also is intended for aiding in support and is the Unix
time of the latest component module. Having this, should allow me to
do a "cvs co -D timestamp avrprog" and get exactly the source of the
version that is being reported.
* fileio.c:
Return the maximum address (+1) written as opposed to the actual
number of bytes written. The presence of an Intel Hex address
record can cause these two number to be different; but the callers
of this routine need the former.
* main.c:
Fix a place where we were exiting without applying the exit-specs.
Wrap a long line.
* avr.c, fileio.c: avr.c: Update a comment.
fileio.c: Properly handle all the Intel Hex record types that I can
find information about.
2001-01-25 Brian S. Dean <bsd@bsdhome.com>
* Usage, avr.h: Get rid of the Usage file.
2001-01-24 Brian S. Dean <bsd@bsdhome.com>
* Makefile, avr.c, avr.h, main.c, pindefs.h, ppi.c:
Move pin definitions to their own file.
First pass at providing feedback via the optionally connected leds. I
don't actually have any of these attached to my programmer, so I can
only guess as whether this is toggling them on and off correctly.
Also, enable and disable the optional 74367 buffer.
* avr.h, main.c, ppi.c, ppi.h, avr.c:
Rearrange the pinout for the programmer to be a little more logical.
Provide hooks to support a buffered programmer, pin 6 is now used to
enable a buffer that can be used to isolate the target system from the
parallel port pins. This is important when programming the target
in-system.
Totally change the way the pin definitions are defined. Actually
set/clear pins based on the way more intuitive pin number, instead of
PPI data register, bit number combination. A table of pin data is
used so that any hardware inversion done by the parallel port is
accounted for, what you set is actually what appears at the pin.
Retain the old method for handling Vcc, however, because the hold
method is much easier to use when setting / retrieving multiple pins
simultaneously.
2001-01-22 Brian S. Dean <bsd@bsdhome.com>
* Makefile: Don't gzip the man page.
* avrdude.1: .Nm macro fix. Submitted by Joerg.
* main.c: Cosmetic, don't output a preceding linefeed for usage().
* Makefile, avr.c, avr.h, fileio.c, term.c:
Makefile : use gzip -f for man page installation so that we don't get
prompted.
avr.c avr.h fileio.c term.c :
Change the avrpart data structure so that the typedef AVRMEM is
used as an index into an array for the sizes of the memory types
and also for pointers to buffers that represent the chip data for
that memory type. This removes a lot of conditional code of the
form:
switch (memtype) {
case AVR_FLASH :
...
}
Also, re-code avr_read_byte() and avr_write_byte() to properly
handle the flash memory type without having to tell them whether
they should program the high byte or the low byte - figure that
out from the address itself. For flash memory type, these
routines now take the actual byte address instead of the word
address. This _greatly_ simplifies many otherwise simple
operations, such a reading or writing a range of memory, by not
having to worry about whether the address starts on an odd byte
or an even byte.
2001-01-20 Brian S. Dean <bsd@bsdhome.com>
* avr.c, avr.h, fileio.c, fileio.h, main.c:
Return error codes instead of exiting, thus making sure that we exit
only via main() so that the exitspecs are properly applied.
When reading input data from a file, remember how many bytes were read
and write and verify only that many bytes.
Don't complain when an input file size is smaller than the memory size
we are programming. This is normal.
* fileio.c:
Correct checksum calculation; failure to account for the value of the
record type was causing non-zero record types to be calculated
incorrectly.
* Makefile, main.c: Makefile : install the man page
main.c : drop the giant usage text now that we have a man page.
* avrdude.1:
Add initial man page graciously contributed by Joerg Wunsch. Thanks
Joerg!
2001-01-19 Brian S. Dean <bsd@bsdhome.com>
* term.c:
Accept abbreviations for eeprom and flash for the dump and write
commands.
Fix small bug keeping 1 character command lines from being added to
the history.
* term.c:
Implement enough state in cmd_dump so that if it is called with no
arguments, it successively dumps the next chunk of data of the same
previously specified length.
* term.c, term.h, fileio.c, fileio.h, main.c, ppi.c, ppi.h:
* Makefile, avr.c, avr.h, avrprog.c:
The program was getting too large for a single file. Split it up into
more modular pieces.
Also, accept command abbreviations as long as they are not ambiguous.
* avrprog.c:
Add ability to specify the state of the power and reset pins on
program exit. Default to leaving the pins in the state they were when
we found them.
Contributed by: Joerg Wunsch
2001-01-18 Brian S. Dean <bsd@bsdhome.com>
* Makefile, avrprog.c:
Switch to using readline() for getting terminal input. I can't seem
to get the history capabilities working yet, but even so, it does
better handling of the prompt and strips newlines for us, so it's
still a win.
Add a few new commands for terminal mode: help, sig, part, erase.
Display rudimentory help using the help command.
Add some function prototypes.
* Usage, avrprog.c:
Change -c (interactive command mode) to the more intuitive -t
(terminal mode).
Make binary format the default for output.
Update the parts table with corrections for old values and add some
new values.
2001-01-15 Brian S. Dean <bsd@bsdhome.com>
* avrprog.c:
Automatically verify on-chip data with what we just programmed.
* avrprog.c, Makefile:
Prepare the Makefile for integration into the FreeBSD ports tree.
Fix a few "may be used uninitialized" bugs found by -Wall.
2001-01-14 Brian S. Dean <bsd@bsdhome.com>
* avrprog.c: Free a buffer.
* avrprog.c:
Use a smarter programming algorithm - read the existing data byte
first and only write the new one if it is different.
Add -n option which is a test mode in which the chip is not actually
updated. This option does not affect writes in interactive mode.
* avrprog.c: Add the "dump" and "write" interactive commands.
* avrprog.c:
Correctly produce and handle "end of record" for intel hex files.
2001-01-13 Brian S. Dean <bsd@bsdhome.com>
* avrprog.c:
Re-enable writing to the chip. I should probably should make this a
command-line selectable option so that I don't keep forgetting and
committing it with it disabled.
* avrprog.c:
Add a newline before exiting due to command line errors. Perform a
bit more option compatibility testing between -c, -i, and -o.
* avrprog.c: Add input file format auto-detection support.
* Usage, avrprog.c: Say what the defaults are.
* avrprog-programmer.jpg, Usage, avrprog-schematic.jpg: New files.
* avrprog.c: Correct usage text.
* avrprog.c:
Parameterize a few additional items per chip. Print out all per-chip
parameters on startup. Use the per-chip parameters in the code
instead of hard-coded values for the 2313.
* avrprog.c: Fix filename assignment error.
Clean up debugging code a little, utilize fileio() instead of making
direct calls to b2ihex().
* avrprog.c: A lot of general code cleanup.
Re-work command line options to be more intuitive.
Support Intel Hex input and output file formats. Provide hooks to
support Motorola S-Record as well.
Add a few more part-specific parameters to the avrpart structure.
Only write the flash or eeprom if the data to be written is not 0xff.
2000-12-31 Brian S. Dean <bsd@bsdhome.com>
* avrprog.c: Update a comment.
* avrprog.c:
Provide the ability to tie additionally tie pins 6-9 of the parallel
port to Vcc in order to supply more current.
Fix a typo on the size of the S1200's Flash.
Bring RESET low when programming is completed.
* avrprog.c:
Correct pin connection comments. Elaborate a bit on Vcc connection.
* avrprog.c:
Update after receiving some good feedback from Joerg Wunsch. We
should now be able to program AT90S1200's.
2000-12-30 Brian S. Dean <bsd@bsdhome.com>
* avrprog.c: Don't limit eeprom addresses.
2000-12-20 Brian S. Dean <bsd@bsdhome.com>
* Makefile, avrprog.c:
Add support for the 8515. Make the addition for other devices easier.
2000-08-27 Brian S. Dean <bsd@bsdhome.com>
* avrprog.c:
Clear all bits except AVR_RESET when finished reading or programming
the Atmel device.
2000-08-07 Brian S. Dean <bsd@bsdhome.com>
* avrprog.c: update announcement message
* avrprog.c: Update announcement message.
* avrprog.c: Return the correct return code from 'main()'.
* avrprog.c:
Add ppi_pulse() function and fix ppi_toggle() to actully toggle
instead of pulse.
Make all abnormal returns after the parallel port has been opened go
through a single exit point at the bottom of 'main()'.
2000-08-06 Brian S. Dean <bsd@bsdhome.com>
* Makefile, avrprog.c: Makefile: add --pedantic compiler option
avrprog.c:
Add lots of comments, move getop() variable declarations to
the top of the program.
Add a typedef name to the AVR memory type and use it for
function declarations.
Add a usleep() delay in the sense loop to avoid becoming a cpu
hog.
Print out a version string so that folks know what version of
the software they are running.
Be sure and close the parallel device and the i/o file when
terminating abnormally.
* avrprog.c: Print out version information when invoked.
* Makefile, avrprog.c: Makefile: Add an install target.
avrprog.c:
Add license.
Document the header a bit better.
Add capability to read out and display the device signature bytes.
Add capability to power the device from the parallel port.
Eliminate debug print facility.
Provide 'avr_cmd()' function.
When memory locations don't program, generate a newline so that the
information is not overwritten and lost.
Don't print out the message about needing to specify a file if the
user is not requesting an operation that requires the file.
2000-08-05 Brian S. Dean <bsd@bsdhome.com>
* avrprog.c: Pring usage when no arguments are supplied.
* Makefile, avrprog.c: Initial check-in
* Makefile, avrprog.c: New file.

View File

@ -1,237 +0,0 @@
2002-12-12 Brian S. Dean <bsd@bsdhome.com>
* main.c: minor cleanup
2002-12-07 Brian S. Dean <bsd@bsdhome.com>
* avrdude.1, main.c:
If the stk500 is being used, default to using the first serial port.
2002-12-03 Brian S. Dean <bsd@bsdhome.com>
* avrdude.1: Mention STK500 support.
2002-12-01 Brian S. Dean <bsd@bsdhome.com>
* stk500.c: Remove unused code.
* CHANGELOG, stk500.c:
Document changes since the previous version in the CHANGELOG.
Cleanup stk500.c a bit.
* stk500.c: Fix cut and paste braino.
* avr.c, avrdude.conf.sample, main.c, pgm.h, stk500.c:
The STK500 can perform paged read/write operations even on standard
"non-paged" parts. Take advantage of that and use the faster internal
routines of the STK500 for those parts as well.
* avr.c, avr.h, avrpart.h, main.c, pgm.c, pgm.h, stk500.c:
Optimize reading and writing for the STK500 programmer if the part
supports paged reads and writes. This greatly decreases the
program/verify time from about 4.5 minutes down to about 10 seconds in
a 12K program size test case.
Print out the hardware and firmware version for the STK500 if verbose
is enabled.
* avrdude.conf.sample, avrpart.h, config_gram.y, lexer.l, pgm.h:
* ppi.c, ppi.h, stk500.c, stk500.h, stk500_private.h:
Add basic support for STK500.
2002-11-30 Brian S. Dean <bsd@bsdhome.com>
* avrdude.conf.sample, config.c, config.h, config_gram.y, lexer.l:
* main.c, pgm.c, pgm.h, ppi.c, ppi.h, term.c, term.h, Makefile:
* avr.c, avr.h:
Seperate programmer operations out into a driver-like interface so
that programmers other than the direct parallel port connection can be
supported.
2002-11-23 Brian S. Dean <bsd@bsdhome.com>
* CHANGELOG, main.c, term.c:
term.c - when in interactive terminal mode and dumping memory using
the 'dump <memtype>' command without any address information,
and the end of memory is reached, wrap back around to zero on
the next invocation.
CHANGELOG - describe changes
main.c - update version number
* main.c:
When getting ready to initiate communications with the AVR device,
first pull /RESET low for a short period of time before enabling the
buffer chip. This sequence allows the AVR to be reset before the
buffer is enabled to avoid a short period of time where the AVR may be
driving the programming lines at the same time the programmer tries
to. Of course, if a buffer is being used, then the /RESET line from
the programmer needs to be directly connected to the AVR /RESET line
and not via the buffer chip.
2002-11-06 Brian S. Dean <bsd@bsdhome.com>
* CHANGELOG: Update changelog.
* avr.c, avr.h, main.c: Fix -Y option. Reported by Joerg Wunsch.
2002-11-01 Brian S. Dean <bsd@bsdhome.com>
* CHANGELOG, main.c: Version update and CHANGELOG entry.
* avr.c:
Be backward compatible with the 2-byte rewrite cycle counter which
appeared in version 2.1.0, but was changed to a 4 byte counter in
version 2.1.1. Reminded by Joerg Wunsch.
2002-10-29 Brian S. Dean <bsd@bsdhome.com>
* CHANGELOG, avrdude.1, main.c:
Add '-V' (no verify) flag requested by Joerg Wunsch. Update the man
page.
2002-10-13 Brian S. Dean <bsd@bsdhome.com>
* CHANGELOG, avrdude.1: Update man page and changelog.
* main.c: Update version number.
2002-10-12 Brian S. Dean <bsd@bsdhome.com>
* Makefile: Remove --pedantic and -g from the compiler options.
2002-10-11 Brian S. Dean <bsd@bsdhome.com>
* avr.c, term.c:
Use a four byte value instead of a two byte value for the programming
cycle count stored at the end of EEPROM. It seems as though Atmel was
greatly conservative in claiming a 1000 count reliability for the
FLASH. I current have a part that has been reprogrammed 173330 times,
and counting.
Fix a compiler warning.
* avrdude.conf.sample:
Fix ATMega128 instruction encoding for reading the low and high fuse
bits. Thanks to Joerg Wunsch for tripping over this.
2002-08-01 Brian S. Dean <bsd@bsdhome.com>
* avr.c, avrdude.1, main.c:
Move erase-rewrite cycle increment to within the chip erase routine so
that it is tracked no matter where the erase was initiated: command
line mode or interactive mode, without code duplicaiton.
* CHANGELOG: Recent updates.
* avr.c: Eliminate unused variables.
* avr.c, avr.h, avrdude.1, fileio.c, main.c:
Implement a way of tracking how many erase-rewrite cycles a part has
undergone. This utilizes the last two bytes of EEPROM to maintain a
counter that is incremented each time the part is erased.
2002-07-27 Brian S. Dean <bsd@bsdhome.com>
* avr.c, main.c:
Fix a typo in a comment. Display the size of memory being written.
Display the correct memory name in an error message (previously
hardcoded).
2002-06-22 Brian S. Dean <bsd@bsdhome.com>
* CHANGELOG, avrdude.conf.sample:
Add support for ATtiny15 - contributed by Asher Hoskins
<asher@crumbly.freeserve.co.uk>
2002-04-23 Brian S. Dean <bsd@bsdhome.com>
* CHANGELOG: Say what changed.
2002-04-07 Brian S. Dean <bsd@bsdhome.com>
* Makefile, avrdude.conf.sample:
Backup the config file to a timestamped name to keep from possibly
overwriting user-modified configs.
Add read/write instructions for all memory types for ATMEGA103,
ATMEGA128, ATMEGA16, and ATMEGA8.
2002-04-05 Brian S. Dean <bsd@bsdhome.com>
* avrdude.conf.sample:
Add support for ATMEGA128; untested; requested by Jeff Gardner
<gardner@journey.com>.
2002-02-15 Brian S. Dean <bsd@bsdhome.com>
* avrdude.conf.sample: Minor ordering.
* CHANGELOG, main.c: Update version numbers.
2002-02-14 Brian S. Dean <bsd@bsdhome.com>
* CHANGELOG: Summarize latest updates.
* avrdude.conf.sample, config_gram.y:
Make pwroff_after_write a yes/no field instead of a numeric.
* avrdude.conf.sample: Document the pwroff_after_write flag.
* avr.c: Enable the extra part verbosity when verbosity >= 3.
* avr.c, avr.h, avrdude.conf.sample, config_gram.y, lexer.l:
* main.c, term.c:
Fix error reporting by avr_write_byte().
Fix setting of status LEDs under various write-fail conditions.
Add a flag to indicate that a memory type requires the device to
possibly be powered off and back on after a write to it. This is due
to a hardware problem on some Atmel devices, see:
http://www.atmel.com/atmel/acrobat/doc1280.pdf
Add greater verbosity to the part-display code when verbose>1 to
display avrprog's encoding of the defined programming instructions.
This is primarily for debugging purposes.
Part updates:
* add the AT90S4414 part
* add fuse and lock bit access instructions for the AT90S1200,
AT90S4434, and AT90S8515.
* add the pwroff_after_write flag to the fuse bits for the AT90S2333
and AT90S4433 parts
2002-02-09 Brian S. Dean <bsd@bsdhome.com>
* avrdude.conf.sample:
Updates to the 2333 and 4433 parts, contributed by Joerg Wunsh.
2002-01-18 Brian S. Dean <bsd@bsdhome.com>
* CHANGELOG: Add changelog.
2002-01-12 Brian S. Dean <bsd@bsdhome.com>
* main.c: Add (c) to copyright.
* fileio.c, fileio.h, lexer.l, lists.c, lists.h, main.c:
* pindefs.h, ppi.c, ppi.h, term.c, term.h, avr.c, avr.h:
* config.c, config.h, config_gram.y:
Update version number. Update copyright.
* avrdude.1: Update copyright and add description of "default".
Submitted by: Joerg Wunsch <j@uriah.heep.sax.de>
* avr.c, term.c:
Fix programming of write-only memories (such as lock bits on the
2313).

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,364 +0,0 @@
2007-11-08 Joerg Wunsch <j@uriah.heep.sax.de>
* main.c: Partially revert the line buffered output change,
and turn stderr into unbuffered output while producing the
progress report.
2007-11-07 Joerg Wunsch <j@uriah.heep.sax.de>
* main.c: Add setup and teardown hooks to the programmer
definition. If present, call the setup hook immediately after
finding the respective programmer object, and schedule the
teardown hook to be called upon exit. This allows the
programmer implementation to dynamically allocate private
programmer data.
* pgm.c: (Ditto.)
* pgm.h: (Ditto.)
* avr910.c: Convert static programmer data into dynamically
allocated data.
* butterfly.c: (Ditto.)
* jtagmkI.c: (Ditto.)
* jtagmkII.c: (Ditto.)
* stk500v2.c: (Ditto.)
* usbasp.c: (Ditto.)
* usbtiny.c: (Ditto.)
2007-11-06 Joerg Wunsch <j@uriah.heep.sax.de>
* butterfly.c: Remove the no_show_func_info() calls, as Brian
promised some 4 years ago.
2007-11-06 Joerg Wunsch <j@uriah.heep.sax.de>
* main.c: Add the -x option to pass extended parameters to
the programmer backend.
* pgm.c: (Ditto.)
* pgm.h: (Ditto.)
* jtagmkII.c: Implement the extended parameter jtagchain=
to support JTAG daisy-chains.
* avrdude.1: Document all of the above.
* doc/avrdude.texi: (Ditto.)
2007-10-30 Joerg Wunsch <j@uriah.heep.sax.de>
* configure.ac (AC_INIT): Bump version for post-release.
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
* configure.ac (AC_INIT): Bump version, releasing avrdude-5.5.
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
Submitted by <bikenomad@gmail.com>:
patch #5007: Patch for line-buffering of stdout and stderr
* main.c: call setvbuf() for stdout and stderr.
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
Submitted by <graceindustries@gmail.com>:
patch #5953: Add AT90CAN64 and AT90CAN32 to avrdude.conf
* avrdude.conf.in: Add entry for AT90CAN64 and AT90CAN32.
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
Submitted by Wolfgang Moser:
patch #6121: ISP support for the C2N232I device (serial port
bitbanging)
* avrdude.conf.in: Add entry for c2n232i.
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
Submitted by <karl.yerkes@gmail.com>:
patch #6141: accept binary format immediate values
* fileio.c: Detect a 0b prefix, and call strtoul() differently
in that case.
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
bug #21076: -vvvv serial receive prints are empty in Win32 build
* ser_win32.c (ser_recv): Drop the essentially unused variable
"len", and use the variable "read" in order to track how many
bytes have just been read in.
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
bug #21145: atmega329p not recognized
* avrdude.conf.in: Add definitions for the ATmega329P/3290P.
Same as ATmega329/3290 except of the different signature.
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
bug #21152: Unable to program atmega324p with avrdude 5.4 and AVRISP
using default configuration file.
* avrdude.conf.in: Uncomment the (bogus) stk500_devcode lines for
the ATmega164P, ATmega324P, ATmega644, and ATmega644P definitions.
This only affects users of STK500v1 firmware.
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
Submitted by <ladyada@gmail.com>:
Patch #6233: Add support for USBtinyISP programmer
* usbtiny.c: New file.
* usbtiny.h: (Ditto.)
* Makefile.am: Include usbtiny into the build.
* avrdude.conf.in: (Ditto.)
* config_gram.y: (Ditto.)
* lexer.l: (Ditto.)
* avrdude.1: Document the usbtiny support.
* doc/avrdude.texi: (Ditto.)
2007-10-29 Joerg Wunsch <j@uriah.heep.sax.de>
* doc/avrdude.texi: Sort list of supported programmers into
alphabetical order, add all missing programmers.
2007-07-24 Thomas Fischl <tfischl@gmx.de>
* usbasp.c: Added long addresses to support devices with more
than 64kB flash. Closes bug #20558: Long address problem with
USBasp.
2007-06-27 Joerg Wunsch <j@uriah.heep.sax.de>
* Makefile.am (EXTRA_DIST): Add ChangeLog-2004-2006.
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
* configure.ac (AC_INIT): Bump version for post-release.
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
* configure.ac (AC_INIT): Bump version, releasing avrdude-5.4.
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
* avrdude.conf.in: Fix AVR910 devcodes. It seems that the AVR109
listing refers to "BOOT"-type code, while the standard codes are
different (usually one below).
2007-05-16 Joerg Wunsch <j@uriah.heep.sax.de>
* avr.c (avr_read, avr_write): only use the paged_load and
paged_write backend functions iff the memory area in question has
a page_size != 0.
This is supposed to fix bug #19234: avrdude-5.3.1 segfaults when
stk500v1 tries to program an ATtiny15
2007-05-15 Joerg Wunsch <j@uriah.heep.sax.de>
* avr910.c: Fall back to avr_{read,write}_byte_default(). Fixes
bug #18803: Fuse reading regression in avrdude 5.3.1 with avr910
programmer
2007-05-15 Colin O'Flynn <coflynn@newae.com>
* avrdude.conf.in: Rename the ATmega164 and ATmega324 into
ATmega164P and ATmega324P, resp. Add an entry for the ATmega644P.
Fixes bug #19769: ATmega164p not recognized
2007-05-15 Joerg Wunsch <j@uriah.heep.sax.de>
* ser_posix.c (ser_send): Don't select() on the output fd before
trying to write something to the serial line. That kind of
polling isn't very useful anyway, and it seems it breaks for the
Linux CP210x USB<->RS-232 bridge driver which is certainly a bug
in the driver, but we can just avoid that bug alltogether.
2007-05-15 Joerg Wunsch <j@uriah.heep.sax.de>
* avrdude.conf.in: Fix the STK500v2 ISP delay parameter for
ATmega640/1280/1281/2560/2561. Atmel has changed the XML
files after the initial release.
2007-05-01 Colin O'Flynn <coflynn@newae.com>
* safemode.c: -Oops - bug in verbose output. Fixed.
-Fixed handling of cases where programmer cannot read fuses (AVR910)
* main.c: -Also fixing handling of cases where programmer cannot
read fuses
This should close one or more bugs (18803, 19570)
2007-05-01 Colin O'Flynn <coflynn@newae.com>
* safemode.c: Added verbose output from safemode routines.
2007-03-25 Colin O'Flynn <coflynn@newae.com>
* stk500generic.c: Forgot to close the serial port before trying to
open it again, caused problems on Windows machines.
Closes bug #19411
2007-02-26 Joerg Wunsch <j@uriah.heep.sax.de>
* avrdude.conf.in: Add the AT90PWM2/3B devices.
2007-02-02 Thomas Fischl <tfischl@gmx.de>
* usbasp.c: Changed return value of function usbasp_initialize to stop
avrdude on communication errors between programmer and target.
Closes bug #18581: safemode destroys fuse bits
2007-02-01 Joerg Wunsch <j@uriah.heep.sax.de>
* config_gram.y: Remove duplicate definition of token K_WRITEPAGE
2007-01-30 Joerg Wunsch <j@uriah.heep.sax.de>
* butterfly.c: Implement ATmega256x support for butterfly/avr109.
2007-01-30 Joerg Wunsch <j@uriah.heep.sax.de>
* configure.ac: Fix subdir handling. Now finally, "make
distcheck" will include the documentation into the tarball even if
the configure had been run without the --enable-doc.
2007-01-30 Joerg Wunsch <j@uriah.heep.sax.de>
* safemode.c: Obtain progname from avrdude.h rather than trying to
roll our own (duplicate) copy of it.
* avr910.c: Constify char pointers.
* avrpart.c: (Ditto.)
* avrpart.h: (Ditto.)
* butterfly.c: (Ditto.)
* config.c: (Ditto.)
* config.h: (Ditto.)
* jtagmkI.c: (Ditto.)
* jtagmkII.c: (Ditto.)
* par.c: (Ditto.)
* pgm.c: (Ditto.)
* pgm.h: (Ditto.)
* serbb_posix.c: (Ditto.)
* serbb_win32.c: (Ditto.)
* stk500.c: (Ditto.)
* stk500v2.c: (Ditto.)
* usbasp.c: (Ditto.)
2007-01-29 Joerg Wunsch <j@uriah.heep.sax.de>
* avrpart.c: More backend/library abstraction and generalization:
turn the list_parts() and list_programmers() functions into
general list iteration functions that call a caller-supplied
callback for each element. Implement list_parts() and
list_programmers() as private functions in main.c based on that
approach.
* avrpart.h: (Ditto.)
* main.c: (Ditto.)
* pgm.c: (Ditto.)
* pgm.h: (Ditto.)
2007-01-25 Joerg Wunsch <j@uriah.heep.sax.de>
* Makefile.am: Rearrange everything so it is now built into a
libavrdude.a library, and link main.c against that library.
* configure.ac: Add AC_PROG_RANLIB as we are building a library
now.
2007-01-24 Joerg Wunsch <j@uriah.heep.sax.de>
Major code cleanup.
- Make all internal functions "static".
- Make sure each module's header and implementation file match.
- Remove all library-like functionality from main.c, so only
the actual frontend remains in main.c.
- Add C++ brackets to all header files.
* avr.c: (Ditto.)
* avr.h: (Ditto.)
* avr910.c: (Ditto.)
* avr910.h: (Ditto.)
* avrdude.h: (Ditto.)
* avrpart.c: (Ditto.)
* avrpart.h: (Ditto.)
* bitbang.h: (Ditto.)
* butterfly.h: (Ditto.)
* config.c: (Ditto.)
* config.h: (Ditto.)
* confwin.h: (Ditto.)
* crc16.c: (Ditto.)
* crc16.h: (Ditto.)
* fileio.c: (Ditto.)
* fileio.h: (Ditto.)
* jtagmkI.h: (Ditto.)
* jtagmkII.h: (Ditto.)
* lexer.l: (Ditto.)
* lists.h: (Ditto.)
* main.c: (Ditto.)
* par.h: (Ditto.)
* pgm.c: (Ditto.)
* pgm.h: (Ditto.)
* ppi.c: (Ditto.)
* ppi.h: (Ditto.)
* safemode.h: (Ditto.)
* serbb.h: (Ditto.)
* serial.h: (Ditto.)
* stk500.h: (Ditto.)
* stk500v2.c: (Ditto.)
* stk500v2.h: (Ditto.)
* term.c: (Ditto.)
* term.h: (Ditto.)
* usbasp.h: (Ditto.)
* update.c: New file.
* update.h: New file.
* Makefile.am: Include update.c and update.h.
2007-01-24 Joerg Wunsch <j@uriah.heep.sax.de>
Move all "extern" declarations into a centreal header file.
* Makefile.am: Add new avrdude.h.
* avrdude.h: New file.
* avr.c: Replace private extern decl's by #include "avrdude.h".
* avr910.c: (Ditto.)
* avrpart.c: (Ditto.)
* bitbang.c: (Ditto.)
* butterfly.c: (Ditto.)
* config.c: (Ditto.)
* config_gram.y: (Ditto.)
* fileio.c: (Ditto.)
* jtagmkI.c: (Ditto.)
* jtagmkII.c: (Ditto.)
* lexer.l: (Ditto.)
* main.c: (Ditto.)
* par.c: (Ditto.)
* pgm.c: (Ditto.)
* ppi.c: (Ditto.)
* ppiwin.c: (Ditto.)
* ser_avrdoper.c: (Ditto.)
* ser_posix.c: (Ditto.)
* ser_win32.c: (Ditto.)
* serbb_posix.c: (Ditto.)
* serbb_win32.c: (Ditto.)
* stk500.c: (Ditto.)
* stk500generic.c: (Ditto.)
* stk500v2.c: (Ditto.)
* term.c: (Ditto.)
* usb_libusb.c: (Ditto.)
* usbasp.c: (Ditto.)
2007-01-13 Joerg Wunsch <j@uriah.heep.sax.de>
* avrdude.conf.in (ATmega8): Bump the delay values for flash
and EEPROM, based on the current Atmel XML file.
2007-01-12 Joerg Wunsch <j@uriah.heep.sax.de>
* configure.ac: Improve the detection of the Win32 HID library,
and the presence of the header ddk/hidsdi.h. It now works
correctly under Cygwin and several flavours of MinGW.
* Makefile.am: Add new LIBHID pattern.
2007-01-11 Joerg Wunsch <j@uriah.heep.sax.de>
* butterfly.c (butterfly_initialize): when sending the 'T'
command (which is ignored by current AVR109 bootloaders),
send the first reply from the list of supported device
codes back rather than using avrdude.conf's idea about
an AVR910 device code. Apparently, this solves disagreements
between different versions of at least the ATmega8 AVR910
device code.
Closes bug #18727: Writing flash failed
2007-01-07 Joerg Wunsch <j@uriah.heep.sax.de>
Reported by Till Harbaum:
* avrdude.conf.in (ATtiny25/45/85): Change HVSP reset from
500 microseconds to 1 ms, matching the most recent Atmel XML
specs.

View File

@ -1,185 +0,0 @@
2008-11-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.h: Change the prototype for usleep() to be more Cygwin-
friendly.
* ppiwin.c: (Ditto.)
2008-11-06 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by limor <limor@ladyada.net>
* usbtiny.c (usbtiny_cmd): Replace sizeof() by a fixed constant
4 for the result array, because otherwise it would take the size
of a pointer which miserably fails on 64-bit machines.
2008-11-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
patch #6609: Using PCI parallel port cards on Windows
* ppiwin.c (ppi_open): If the port parameter passed from the
-p option is neither lpt1/2/3, try interpreting it directly as
a base address.
* avrdude.1: Document the change.
* doc/avrdude.texi: (Ditto.)
2008-11-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #22882: Erase Cycle Counter does not work for stk500v2
* stk500v2.c (stk500v2_chip_erase,stk500hv_chip_erase): Return
the expected 0 for success rather than a protocol-dependant
number.
2008-11-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #22883: Chip Erase performed even with no-write flag (-n)
* main.c: Do not erase the chip if both, -e and -n options have
been specified.
2008-11-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #24589: AT90USB64* have wrong signature
* avrdude.conf.in: Uncomment the correct, and delete the wrong
signature for AT90USB646/647. Alas, the datasheet has never been
corrected for years.
2008-10-31 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtagmkII.c: Fix a serious memory corruption that happened when
using the JTAG ICE mkII (or AVR Dragon) in ISP mode. The wrong
set of per-programmer private data had been allocated (stk500v2
vs. jtagmkII) which was too small to hold the actual data.
* jtagmkII.h: (Ditto.)
* stk500v2.c: (Ditto.)
2008-07-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtagmkII.c: Implement Xmega JTAG support.
* jtagmkII_private.h: Add EMULATOR_MODE_JTAG_XMEGA.
2008-07-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* main.c: Remember whether the device initialization worked, and
allow to continue with -F if it failed yet do not attempt to
perform anything on the device itself. That way, -tF could be
specified for programmers like the STK500/STK600 even without a
device connected, just in order to allow changing parameters on
the programmer itself.
* avrdude.1: Document that possible use of the -F option.
* doc/avrdude.texi: (Ditto.)
2008-07-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* stk500v2.c (stk600_xprog_paged_write): Fix a fatal miscalculation
of the number of bytes to be written which caused a malloc chunk
corruption.
2008-07-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
First implementation of ATxmega support. By now, only the
PDI mode of the STK600 is supported. Single-byte EEPROM
(and flash) updates do not work yet.
* avr.c: "boot" memory is a candidate memory region for paged
operations, besides "flash" and "eeprom".
* avrdude.conf.in: add ATxmega128A1 and ATxmega128A1revD
* avrpart.h: add the AVRPART_HAS_PDI flag (used to distinguish
ATxmega parts from classic AVRs), the nvm_base part field, and
the offset field for a memory region.
* config_gram.y: add "has_pdi", "nvm_base", and "offset"
* lexer.l: (Ditto.)
* main.c: disable auto_erase for ATxmega parts
* stk500v2.c: implement the XPROG functionality, and divert to
this for ATxmega parts
* avrdude.1: Document the changes.
* doc/avrdude.texi: (Ditto.)
2008-07-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Fix a bunch of warnings.
* avr910.c (avr910_paged_load): possible unitialized use of
rd_size
* jtagmkI.c (jtagmkI_initialize): pointer signedness mixup
* jtagmkII.c (jtagmkII_print_parms1): propagate const'ness
of parameter
* usbasp.c (usbasp_transmit): pointer signedness mixup
* ser_avrdoper.c (usbGetReport): remove useless pointer deref
2008-07-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Contributed by Ville Voipio:
patch #6501: New autotools support for avrdude
* Makefile.am: add @WINDOWS_DIRS@ to SUBDIR
* bootstrap: allow for autconf-2.61 and automake-1.10, too
* configure.ac: fix @WINDOWS_DIRS@ recursion, replace
AC_PROG_CC by AM_PROG_CC_C_O, for esoteric reasons
2008-06-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Contributed by Janos Sallai <janos.sallai@vanderbilt.edu>:
patch #6074: added support for crossbow's MIB510 programmer
* avrdude.conf.in: Add entry for mib510.
* stk500.c: Add special hooks to handle the MIB510 programmer.
It mostly talks STK500v1 protocol but has a special hello and
goodbye sequence, and uses a fixed block size of 256 bytes.
* doc/avrdude.texi: Document support for mib510.
2008-06-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Contributed by Klaus Leidinger <klaus@mikrocontroller-projekte.de>:
* main.c: Realign verbose messages.
* avrpart.c: (Ditto.)
* avr910.c: Print the device code selected in verbose mode.
* butterfly.c: (Ditto.)
2008-06-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Contributed by Klaus Leidinger <klaus@mikrocontroller-projekte.de>:
Add check for buffermode feature, and use it if present. Can be
turned off using -x no_blockmode.
* avr910.c: Implement buffermode test and usage.
* avrdude.1: Document -x no_blockmode.
* doc/avrdude.texi: (Ditto.)
2008-03-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* usb_libusb.c: #undef interface for Win32
2008-03-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avr910.c: Add support for the -x devcode option.
* avrdude.1: Document -x devcode for avr910.
* doc/avrdude.texi: (Ditto.)
2008-03-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Add initial support for the Atmel STK600, for
"classic" AVRs (AT90, ATtiny, ATmega) in both,
ISP and high-voltage programming modes.
* Makefile.am: Add -lm.
* avrdude.conf.in: Add stk600, stk600pp, and stk600hvsp.
* config_gram.y: Add support for the stk600* keywords.
* lexer.l: (Ditto.)
* pgm.h: Add the "chan" parameter to set_varef().
* stk500.c: (Ditto.)
* serial.h: Add USB endpoint support to struct filedescriptor.
* stk500v2.c: Implement the meat of the STK600 support.
* stk500v2.h: Add new prototypes for stk600*() programmers.
* stk500v2_private.h: Add new constants used in the STK600.
* term.c: Add AREF channel support.
* usb_libusb.c: Automatically determine the correct write
endpoint ID, the STK600 uses 0x83 while all other tools use
0x82. Propagate the EP to use through struct filedescriptor.
* usbdevs.h: Add the STK600 USB product ID.
* tools/get-stk600-cards.xsl: XSL transformation for
targetboards.xml to obtain the list of socket and routing
card IDs, to be used in stk500v2.c (for displaying the
names).
* tools/get-stk600-devices.xsl: XSL transformation for
targetboards.xml to obtain the table of socket/routing cards
and their respective AVR device support for doc/avrdude.texi.
* avrdude.1: Document all the STK600 stuff.
* doc/avrdude.texi: Ditto. Added a new chapter for
Programmer Specific Information.
2008-01-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* stk500v2.c (stk500v2_recv): Make length computation unsigned so
it cannot accidentally become negative.

View File

@ -1,411 +0,0 @@
2009-11-09 David Hoerl <dhoerl@mac.com>
* fileio.c: ihex2bin did not properly handle files > 64K bytes
* usb_libusb.c: re-enabled usb_reset for Macs (no reset causes lots of failures)
* avrdude.1: spacing issue for avr32 fixed.
2009-11-09 Michal Ludvig <mludvig@logix.net.nz>
* buspirate.c: Implemented reset= and speed= extended parameters.
* avrdude.1: Document the change.
2009-11-04 Michal Ludvig <mludvig@logix.net.nz>
* configure.ac, Makefile.am: Test if GCC accepts -Wno-pointer-sign
2009-11-04 Michal Ludvig <mludvig@logix.net.nz>
* buspirate.c: Implemented 'BinMode' support for
firmware 2.7 and higher.
* avrdude.1: Added info about BusPirate.
2009-11-03 Michal Ludvig <mludvig@logix.net.nz>
* arduino.c: Add on to bug #26703 / patch #6866 - clear DTR/RTS
when closing the port.
* Makefile.am: Silent warnings about signedness - they're useless
and annoying, especially for 'char' vars.
2009-10-22 David Hoerl <dhoerl@mac.com>
* usb_libusb.c: disabled usb_reset for Macs (same as FreeBSD)
2009-10-12 Michal Ludvig <mludvig@logix.net.nz>
* main.c: Re-added default to serial port for BusPirate.
2009-10-12 David Hoerl <dhoerl@mac.com>
* main.c: removed some avr32 code that was pushed into jtagmkII.c
* jtagmkII.c: consolodated the avr32 reset code and avr32_chipreset
* avrpart.h: modified AVRPART flags for avr32
* lexer.l: added is_avr32 flag - only way to get yacc code to set flag
* avrdude.conf.in: updated avr32 section to include "is_avr32" flag
2009-10-12 David Hoerl <dhoerl@mac.com>
* config_gram.y: Restored inadvertantly removed buspirate entry
* lexer.l: Restored inadvertantly removed buspirate entry
2009-10-12 Michal Ludvig <mludvig@logix.net.nz>
* buspirate.c: Replace GNU-only %as with %s in sscanf call.
* ser_win32.c(ser_set_dtr_rts): Fixed typo in parameter name.
* NEWS: Announce BusPirate.
2009-10-11 David Hoerl <dhoerl@mac.com>
Support for AVR32
* AUTHORS: added myself
* NEWS: announced AVR32 support
* main.c: AVR32 flag tests to avoid several code blocks
* fileio.c: mods to ihex read function to handle address offsets and
size of avr32
* jtagmkI.c: added cast to printf call to remove warning
* arduino.c: added header file to bring in prototype for usleep()
* config_gram.y: added defines for avr32, new jtag_mkii variant for avr32
* jtagmkII_private.h: new jtag_mkii message types defined (used by
avr32program)
* jtagmkII.h: extern jtagmkII_avr32_initpgm() addition
* jtagmkII.c: huge amount of code in support of avr32
* avrpart.h: additional flags to AVRPART for avr32
* usb_libusb.c: modified verbose test for USB read per-byte messages by
by one, so with verbose=3 you get just full messages, 4 gives you bytes
too
* lexer.l: additions for avr32
2009-10-10 Michal Ludvig <mludvig@logix.net.nz>
Support for Arduino auto-reset:
* serial.h, ser_avrdoper.c, ser_posix.c, ser_win32.c: Added
serial_device.set_dtr_rts implementations.
* arduino.c, stk500.c, stk500.h: Call serial_set_dtr_rts()
to reset Arduino board before program upload.
Inspired by patch #6866, resolves bug #26703
2009-10-08 Michal Ludvig <mludvig@logix.net.nz>
* buspirate.c: Optimised buspirate_cmd() - reading 1kB EEPROM now
takes only 14 sec instead of almost 2 mins with the original
implementation.
2009-10-08 Michal Ludvig <mludvig@logix.net.nz>
* buspirate.c, buspirate.h: Support for the BusPirate programmer
* config_gram.y, avrdude.conf.in, main.c, lexer.l, Makefile.am:
Glue for BusPirate.
2009-08-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* usb_libusb.c (usbdev_close): Repair the logic around the
conditional compilation of usb_reset() introduced in r798.
2009-07-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: We are post-5.8 now.
2009-07-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Prepare for releasing version 5.8
2009-07-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Roger Wolff:
bug #26527: bug in unicode conversion
* ser_avrdoper.c (convertUniToAscii): when encountering a UTF-16
character that cannot be converted to ASCII, increment the UTF-16
pointer anyway when proceeding.
2009-07-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtagmkI.c (jtagmkI_send): Replace %zd format by %u since not all
implementations do understand the C99 formatting options (sigh).
* jtagmkII.c (jtagmkII_send): (Ditto.)
* stk500v2.c (stk500v2_recv): (Ditto.)
2009-07-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #26002: HVPP of EEPROM with AVR Dragon and ATmega8 Fails
* avrdude.conf.in (ATmega8): add page size for EEPROM.
2009-07-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* stk500v2.c: Fix a serious memory corruption problem resulting
out of the chaining of both, the stk500v2 and the jtagmkII
programmers for some programming hardware (JTAG ICE mkII and AVR
Dragon running in ISP, HVSP or PP mode), where both programmers
have to maintain their private programmer data.
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Post-release (is pre-release...)
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Prepare for releasing version 5.7
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* main.c: Add my name to the copyright output when being verbose.
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Contributed by Shaun Jackman <sjackman@gmail.com>
bug #21798: Fix both XSLT scripts
* tools/get-dw-params.xsl (format-hex): Add the parameter count.
* tools/get-hv-params.xsl (format_cstack): Ditto.
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #21922: ATmega163 still not working in version 5.5
* avrdude.conf.in (atmega163): fill in stk500v2 parameters, correct
some flash programming parameters as well.
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #22206: avrdude: ser_setspeed(): tcsetattr() failed
* ser_posix.c (ser_setspeed): Don't pass TCSAFLUSH to tcsetattr() as
it apparently fails to work on Solaris. After reading the
documentation again, it seems TCSAFLUSH and TCSANOW are indeed
mutually exclusive.
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #22234: WINDOWS version: HOWTO: Specify Serial Ports Larger than COM9
* ser_win32.c (ser_open): prepend \\.\ to any COM port name, so it is
safe to be used for COM ports above 9.
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #26408: Crash in stk500v2_open()
* stk500generic.c: Implement setup and teardown hooks, calling in turn
the respective hooks of the stk500v2 implementation.
2009-07-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #26130: Avrdude doesn't display it's version.
* main.c (usage): add a version number display to the default usage
message.
2009-07-01 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #26412: avrdude segfaults when called with a programmer that does not
support it
* main.c: do not call pgm->perform_osccal() unless it is != 0.
2009-06-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Contributed by Zoltan Laday:
patch #6825: xmega problems with JTAGICEmkII
* jtagmkII.c: Many fixes for Xmega devices.
* jtagmkII_private.h: Add various new constants required for
Xmega devices.
* avrdude.conf.in: New devices: ATXMEGA64A1, ATXMEGA192A1,
ATXMEGA256A1, ATXMEGA64A3, ATXMEGA128A3, ATXMEGA192A3,
ATXMEGA256A3, ATXMEGA256A3B, ATXMEGA16A4, ATXMEGA32A4,
ATXMEGA64A4, ATXMEGA128A4
* avr.c (avr_read, avr_write): Add more names for (Xmega)
memory areas that require paged operation.
2009-06-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* stk500v2.c (stk600_xprog_write_byte): Handle writing fuse bytes.
2009-04-28 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Carl Hamilton:
* update.c (parse_op): correctly \0-terminate buf after filling
it, before it is potentially used as the source of a call to
strlen or strcpy.
2009-04-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* doc/avrdude.texi: Merge the -P 0xXXX option description from
avrdude.1.
2009-04-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: declare AM_PROG_CC_C_O to avoid the warning
"compiling `config_gram.c' with per-target flags
requires `AM_PROG_CC_C_O' in `configure.ac'"
2009-03-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #25971: "error writing to <stdout>" with multiple -U params.
* fileio.c: Do not close the input/output stream when working on an
stdio stream.
2009-02-28 Thomas Fischl <tfischl@gmx.de>
Based on patch #6484 commited by Jurgis Brigmanis:
* usbasp.c: added software control for ISP speed
* usbasp.h: (Ditto.)
2009-02-28 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avr910.c (avr910_read_byte_flash): Eliminate a static variable that
hasn't been in use for 5 years.
2009-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Post-release 5.6.
2009-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Prepare for releasing version 5.6.
2009-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Ed Okerson:
* jtagmkII.c (jtagmkII_read_byte): Fix signature reading of
Xmega.
2009-02-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Mikael Hermansson:
* avrdude.conf.in (ATxmega256A3): new device.
* stk500v2 (stk500v2_initialize): Enable the AVRISPmkII as a
PDI-capable device for ATxmega parts.
2009-02-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Lars Immisch:
patch #6750: Arduino support - new programmer-id
* arduino.c: New file, inherits stk500.c.
* arduino.h: New file.
* Makefile.am: Add arduino.c and arduino.h.
* config_gram.y: Add arduino keyword.
* lexer.l: (Ditto.)
* avrdude.conf.in: (Ditto.)
* avrdude.1: Document the new programmer type.
* doc/avrdude.texi: (Ditto.)
2009-02-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* stk500v2.c: Turn all non-const static data into instance data.
2009-02-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* Makefile.am: Move term.[ch] from the library into the CLI
application section, as it is not useful for anything else but
the CLI frontend.
2009-02-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.conf.in (ATmega1284P): new device.
2009-02-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
More fixes for Solaris, including fixes for the Sunpro compiler:
* avr.h: Remove stray semicolon.
* configure.ac: Add check for predefined types uint_t and ulong_t.
* confwin.c: Include "avrdude.h" on top to avoid empty translation
unit warning.
* ppwin.c: (Ditto.)
* ser_win32.c: (Ditto.)
* serbb_win32.c: (Ditto.)
* jtagmkII.c (jtagmkII_recv): remove unreachable "return".
* stk500.c (stk500_initialize): (Ditto.)
* par.c: Test for both, __sun__ and __sun to see whether we are
being compiled on Solaris.
* ppi.c: (Ditto.)
* stk500v2.c: Implement the DEBUG and DEBUGRECV macros in a way
that is compatible with the ISO C99 standard.
* usbtiny.c: Only typedef uint_t and ulong_t if they have not
been found already by the autoconf checks.
2009-02-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #22204: Solaris10/11 Undefiniertes Symbol gethostbyname socket
connect
* configure.ac: Add checks for gethostent() and socket().
While being here, remove some old cruft left from ancient days.
2009-02-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* lexer.l: Bump the %p size so AT&T lex will continue to work.
2009-02-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
(Partially) submitted by John Voltz:
bug #20004: AVRDUDE update (-U) operations do not close files
* fileio.c (fmt_autodetect, fileio): fclose() files.
2009-02-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* usbtiny.c: Replace all but one (very unlikely to trigger) exit(1)
by return -1.
2009-02-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Dick Streefland:
patch #6749: make reading from the USBtinyISP programmer more robust
* usbtiny.c: Add code to retry failed communication attempts.
2009-02-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Nick Hibma:
bug #22271: usb_reset in usb_libusb.c not necessary in FreeBSD 6.x
* usb_libusb.c (usbdev_close): Do not call usb_reset() on FreeBSD.
It is not necessary there.
2009-02-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Andrew O. Shadoura:
bug #25156: add direct SPI transfer mode
* bitbang.c: Implement direct SPI transfers.
* bitbang.h: (Ditto.)
* par.c: (Ditto.)
* pgm.c: (Ditto.)
* pgm.h: (Ditto.)
* term.c: Add the "spi" and "pgm" commands.
* avrdude.1: Document the changes.
* doc/avrdude.texi: (Ditto.)
2009-02-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Limor ("Lady Ada"):
bug #24749: add support for '328p
* avrdude.conf.in (ATmega328P): new device support.
2009-02-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by "Womo":
bug #25241: AT90USB162, AT90USB82 device support patch for avrdude-5.5
(also: bug #21745: AT90USBxx2 support)
* avrdude.conf.in (AT90USB162, AT90USB82): new device support.
2009-02-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Evangelos Arkalis:
patch #6069: Atmel AT89ISP Cable
* avrdude.conf.in (89isp): new programmer support.
2009-02-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Bob Paddock:
patch #6748: ATTiny88 Config
* avrdude.conf.in (ATtiny88): new device support.
2009-02-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Mark Litwack:
patch #6261: avrdude won't use dragon/debugwire to write a file
to eeprom
* jtagmkII.c (jtagmkII_paged_write): when in debugWire mode,
implement a paged write to EEPROM as a series of byte writes.
2009-02-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Janos Sallai:
patch #6542: paged_load fails on the MIB510 programming board
* stk500.c: Add a workaround for the different signon sequence on
MIB510 programmers.
2009-02-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.conf.in: Add the ATmega128RFA1.
* avrdude.1: document the addition of ATmega128RFA1.
* doc/avrdude.texi: (Ditto.)

View File

@ -1,354 +0,0 @@
2010-12-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.conf.in (ATmega128RFA1): Bump two timing values in order to
improve ISP programming stability, in particular with the STK600.
2010-12-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* stk500v2.c (stk500v2_command): Detect warning status codes.
2010-10-22 Nils Springob <nils@nicai-systems.de>
* serial.h: serial_open() calls will now return -1 on error (no call to exit())
* buspirate.c: (Dito.)
* jtagmkII.c: (Dito.)
* butterfly.c: (Dito.)
* jtagmkI.c: (Dito.)
* arduino.c: (Dito.)
* avr910.c: (Dito.)
* stk500.c: (Dito.)
* ser_avrdoper.c: (Dito.)
* stk500v2.c: (Dito.)
* ser_posix.c: (Dito.)
* usb_libusb.c: (Dito.)
2010-07-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #30566: MinGW + Ubuntu 9.04
* stk500v2.c (stk500v2_open): use same condition to refer to the AVR
Doper support as used in the definition in ser_avrdoper.c.
(Thanks to Christian Starkjohann for the analysis of the problem.)
2010-07-19 Michal Ludvig <mludvig@logix.net.nz>
* buspirate.c: Added compatibility with BusPirate "NewUI" firmware 5.x
(contributed by Kari Knuuttila)
2010-07-12 Nils Springob <nils@nicai-systems.de>
* avrdude.conf.in (atmega88p): New device.
2010-06-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #29913: 246 Byte Bug - AVRdude crashes
doc/avrdude.texi (Troubleshooting): Mention the libusb 0.1 API
wrapper issue that is present in some Linux versions.
2010-03-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #29263: Can't build avrdude on windows using latest cygwin 1.7.1
* doc/avrdude.texi: Remove the recommendation for building
Win32 binaries under Cygwin; mention MinGW as an alternative
environment.
2010-03-08 Michal Ludvig <mludvig@logix.net.nz>
* ser_posix.c(ser_set_dtr_rts): Fixed DTR on/off to make
Arduino auto-reset work. (bug #29108, patch #7100)
2010-03-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* buspirate.c: Replace printf() by fprintf(stderr)
* safemode.c: (Dito.)
* usbtiny.c: (Dito.)
2010-01-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Cleanup Cygwin builds.
* windows/Makefile.am (loaddrv_LDFLAGS): remove, the -mno-cygwin
flag is supposed to be set in CFLAGS by ./configure
* configure.ac: add a check for the presence of usleep(), add a
check whether the linker accepts -static
* avrdude.h: protect prototype for usleep by !defined(HAVE_USLEEP)
* ppwin.c (usleep): protect by !defined(HAVE_USLEEP)
* main.c: silence "array subscript of type char" compiler warnings
by casting all arguments to tolower()/toupper() and isspace()/
isdigit()/ispunct() to "int"
* butterfly.c: (Dito.)
* avr910.c: (Dito.)
2010-01-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Bump for post-5.10.
2010-01-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Released version 5.10.
2010-01-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #28677: Cygwin's GCC no longer supports -mno-cygwin option
* configure.ac: For Win32 environments, add a check whether the
compiler understands the -mno-cygwin option. If not, don't use
it but suggest using a different compiler.
2010-01-18 David Hoerl <dhoerl@mac.com>
bug #28660: Problem with loading intel hex rom files that exceed
0x10000 bytes
* fileio.c: Fix two byte shifts.
2010-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Michael biebl:
* configure.ac: Fix FreeBSD default serial port name.
* doc/avrdude.texi: (Dito.)
2010-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtagmkII.c: If entering JTAG mode fails with a bad JTAG ID
message, retry with external reset applied (in case the target
is in sleep mode or has asserted the JTD bit).
2010-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Aurelien Jarno:
* configure.ac: Fix build for GNU/kFreeBSD.
* ppi.c: (Dito.)
* par.c: (Dito.)
2010-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Bump version for post-5.8.
2010-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Bump version for release 5.8.
2010-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Soren Jorvang:
bug #28611: -i delay not being applied to all serial port
bit banging state transitions
* serbb_win32.c: Apply ispdelay everywhere.
* serbb_posix.c: (Dito.)
2010-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* stk500v2_private.h: Implement TPI mode for AVRISPmkII/STK600
* config_gram.y: (Dito.)
* avrpart.h: (Dito.)
* stk500v2.c: (Dito.)
* main.c: (Dito.)
* lexer.l: (Dito.)
* avrdude.conf.in: Add ATtiny4/5/9/10
* avrdude.1: Document TPI and new device support.
* doc/avrdude.texi: (Dito.)
2010-01-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by clint fisher:
patch #7038: Adding Atmega32U4 Device to avrdude.conf.in
* avrdude.conf.in (atmega32u4): New device.
* avrdude.1: Document the new device support.
* doc/avrdude.texi: (Dito.)
2010-01-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Thomas Pircher:
patch #6927: Documentation patches
* doc/avrdude.texi: Fix various typos, and remove the last
remnants of obsoleted options -i/-o/-m/-f.
* avrdude.1: Merge typo fixes from avrdude.texi where
applicable.
2010-01-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.1: Update documentation to match the reality (device
support, memory areas).
* doc/avrdude.texi: Update documentation to match the
reality (device support, programmer support, memory areas).
Merge buspirate-specific comments from avrdude.1.
* jtagmkII.c: Add some firmware feature checks.
2010-01-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtagmkII.c: Implement PDI mode support for the JTAG ICE mkII
and the AVR Dragon.
* jtagmkII.h: (Dito.)
* config_gram.y: (Dito.)
* jtagmkII_private.h: (Dito.)
* avrdude.conf.in: (Dito.)
* lexer.l: (Dito.)
2010-01-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* stk500v2.c: Update STK600 routing and socket card data from XML
file.
2010-01-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* stk500v2.c: Cleanup the open/close handling to avoid accessing
unallocated memory (in the atexit handler) in case of bailing out.
* main.c: (Ditto.)
2010-01-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtagmkII.c: Stylistic changes: move #defines out into
jtagmkII_private.h, drop all #if 0 blocks, fold overly long lines,
move the *_initpgm() functions to the end of the file; while being
here, remove all trailing whitespace.
* jtagmkII_private.h: move AVR32 #defines here.
2010-01-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* bootstrap: autoconf 2.62 works well.
2010-01-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Various fixes for Xmega devices.
* avrdude.conf.in: Correctly declare EEPROM page sizes for
all Xmega devices (0x20 instead of 0x100).
* avr.c: If a memory region has a page size declared, try
using the paged IO routines regardless of the target memory
name. Xmega EEPROM requires to be written in paged mode.
Correctly use a long (rather than unsigned long) variable to
evaluate the success status of the paged mode write attempt.
* stk500v2.c: Don't apply TIF space offsets twice (bug #27995:
AVRDUDE 5.8svn fails to program and read XMEGA); use
stk500v2_loadaddr() prior to paged mode (EEPROM and flash) writes,
otherwise programming of flash areas will fail; while being there,
check the return value of stk500v2_loadaddr() everywhere; use the
correct write/erase mode bits (same as AVR Studio does).
2010-01-12 Michal Ludvig <mludvig@logix.net.nz>
* buspirate.c: Initialise firmware version to v0.0
prior to parsing the buspirate banner.
2010-01-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Clean-up the Xmega erase functions.
* jtagmkII_private.h: Add CMND_XMEGA_ERASE as well as
the various XMEGA_ERASE_* definitions (from updated
appnote AVR067)
* jtagmkII.c (jtagmkII_chip_erase): Correctly implement Xmega chip
erase based on CMND_XMEGA_ERASE. After erasing an Xmega part, do
*not* reinitialize the world, as a subsequent programming
operation will fail (for unknown reasons). Actually, this was
really only required for ancient AVRs, but doesn't hurt on mega
and tiny devices.
* jtagmkII.c (jtagmkII_pre_write): Remove, this turned out
to be just a chip erase.
* jtagmkII.c (jtagmkII_program_disable): Don't try reading
"hfuse" for Xmega parts; they don't have it.
* main.c (main): Re-enable auto-erase. It's been done
before (as "jtagmkII_pre_write") in jtagmkII_paged_write()
anyway. Xmega boot and application flash areas should be
handled separately in the future, so auto_erase can only
affect the area just being programmed.
2010-01-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* main.c (main): disable safemode for Xmega parts.
2010-01-12 Michal Ludvig <mludvig@logix.net.nz>
* buspirate.c: If the BusPirate doesn't respond
to a standard a reset command assume it was in binmode
and attempt to exit to text mode first.
2010-01-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* bitbang.c: Fix Win32 build error: move freq up to the file
level.
* buspirate.c: Fix Win32 build warning: include <malloc.h> to
to get a declaration for alloca().
2010-01-08 Thomas Fischl <tfischl@gmx.de>
bug #28520: Programming with USBasp with low clock speed fails
* usbasp.c: Change blocksize depending on sck frequency to
avoid usb transmition timeouts.
2010-01-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #27505: serbb_posix does not cope with inverted pins
* serbb_posix (serbb_highpulsepin): apply PIN_MASK when
checking pin numbers.
* serbb_win32 (serbb_highpulsepin): (Dito.)
2010-01-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #28516: Linux/Dragon: Error message on exit
* stk500v2.c: Fix the "bad response to GO command:
RSP_ILLEGAL_EMULATOR_MODE" message. jtagmkII_close()
has been called with the wrong pgm->cookie. Wrap it
inside stk500v2_jtagmkII_close(), adjusting the cookie
data appropriately.
2010-01-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Doug:
patch #7010: Win32 enhanced bitbang_delay
* bitbang.c (bitbang_calibrate_delay, bitbang_delay): On Win32,
use the high-resolution performance counter rather than the
uneducated delay loop guess if it is available on the target
hardware.
2010-01-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Gerard:
patch #6828: Using arbitrary BAUD rates
* ser_posix.c (serial_baud_lookup): Allow non-standard baud
rates.
* ser_win32.c (serial_baud_lookup): (Dito.)
2010-01-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Eric Trein:
bug #27596: AT90s2333 is not correctly supported in avrdude.conf
* avrdude.conf.in (at90s2333): add various STK500v2 parameters.
2010-01-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Gyorgy Szekely:
bug #28458: Buffer line is incorrectly released for PP programmers
* par.c (par_close): use par_setmany() rather than par_setpin()
for PPI_AVR_BUFF.
2010-01-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Lukasz Goralczyk:
bug #27507: SIGSEGV when using avrdragon (avrdude 5.8)
* stk500v2.c (stk500v2_dragon_isp_initpgm): Use
stk500v2_jtagmkII_setup/stk500v2_jtagmkII_rather than their
jtagII counterparts, to get the private data properly
initialized.
2010-01-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* buspirate.c: Cosmetics: remove UTF-8 dashes, adjust for 8-column
hard tabs.
2010-01-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* buspirate.c: add $ Id $ line.
* buspirate.h: add $ Id $ line.
2010-01-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Fix a few warnings that came up recently (some of them only triggered
by recent GCC versions).
* config_gram.y (parse_cmdbits): "brkt possibly used uninitialized"
(GCC errs here)
* jtagmkII.c (jtagmkII_reset32): "status possibly used uninitialized"
(I think GCC errs, too)
* buspirate.c: "pointers differ in signedness" (mismatch between
string processing and the use of "unsigned char" throughought the
AVRDUDE API)
2010-01-01 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtagmkII.c (jtagmkII_smc_init32): replace sleep() by usleep() for
win32 compatibility.

View File

@ -1,489 +0,0 @@
2011-12-30 Rene Liebscher <R.Liebscher@gmx.de>
* avrdude.conf.in: Added is_at90s1200 option to part description
* doc/avrdude.texi: Added missing options to part definition
* config_gram.y: Fixed resetting of is_at90s1200 and is_avr32 flags
2011-12-30 Rene Liebscher <R.Liebscher@gmx.de>
patch #7693: Fix config file atmel URLs
* avrdude.conf.in: Updated URLs
* avrpart.h: Updated URLs
* doc/avrdude.texi: Updated URLs
2011-12-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* ser_posix.c (baud_lookup_table): Conditionalize the inclusion of
non-standard baud rates (only baud rates up to B38400 are
standardized by the Single UNIX Specification).
2011-12-29 Rene Liebscher <R.Liebscher@gmx.de>
bug #34302: Feature request : device configuration with parent classes
* config_gram.y: Added part parent rule and allow overwriting existing
data at several places
* avrdude.conf.in: Added description comment and m328/m328p as example
* avrpart.c: avr_dup_mem-functions now copy buf and tags memory block
only they are already allocated.
* lexer.l: Added parent as valid token
(not in original patch)
* avrpart.c: New function avr_dup_opcode. avr_dup_mem/avr_dup_part-
functions now duplicate the opcodes in their op-array to avoid memory leaks.
* doc/avrdude.texi: Added description of part parent feature
2011-12-29 Rene Liebscher <R.Liebscher@gmx.de>
patch #7687: Autogenerating programmers and parts lists for docs
(generating the parts lists, programmers lists follows later)
* doc/Makefile.am: Add rule how to create avrdude before generating parts list
2011-12-29 Rene Liebscher <R.Liebscher@gmx.de>
patch #7687: Autogenerating programmers and parts lists for docs
(generating the parts lists, programmers lists follows later)
* doc/avrdude.texi: Add include of generated table of parts
* doc/Makefile.am: Add generating of table of parts in parts.texi
* doc/parts_comments.txt: Adding file containing part commenz references
* avrdude.1: Remove table of parts and mention "-p ?" option
* avrpart.c: Use AVR_DESCLEN for strncasecmp at list sorting
2011-12-22 Rene Liebscher <R.Liebscher@gmx.de>
* configure.ac: Add writing of definition of confsubst to config.status,
so it can run alone, not only called by configure.
2011-12-17 Rene Liebscher <R.Liebscher@gmx.de>
patch #7680: Fixing timeout problem in ser_recv in ser_win32.c
* ser_win32.c: Return -1 at timeout in ser_recv().
2011-12-17 Rene Liebscher <R.Liebscher@gmx.de>
* config_gram.y: Fixed another memory leak, when define an operation
more than once
* avrdude.conf.in: Fixed double definition at ATmega6490
2011-12-17 Rene Liebscher <R.Liebscher@gmx.de>
* config_gram.y: Restructuring and compacting programmer definition
part of grammar (in preparation of patch #7688)
2011-12-17 Rene Liebscher <R.Liebscher@gmx.de>
* avrdude.conf.in: Update documentation of programmer definition
* doc/avrdude.texi: Update documentation of programmer definition
and add list of implemented programmer types
2011-12-17 Rene Liebscher <R.Liebscher@gmx.de>
patch #7667: Minor memory handling fixes
* config_gram.y: Added several free_token() calls.
2011-12-16 Rene Liebscher <R.Liebscher@gmx.de>
patch #7671: Sorting programmers and parts lists for console output
* avrdude.conf.in: change part desc of several parts to common pattern
AT(mega|tiny|xmega)[0-9]+[A-Z]* (Upper case AT, lower case in middle)
* list.[ch]: added sorting function lsort()
* pgm.[ch]: added function sort_programmers()
* avrpart.[ch]: added function sort_avrparts()
* main.c: use sort functions in list_programmers() and list_parts()
* main.c: list functions show config file info only at verbose mode
2011-10-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Replace "cvs" in version number by "svn".
2011-10-10 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #34518: loading intel hex files > 64k using record-type 4
(Extended Linear Address Record)
fileio.c: Replace the change from r928 (handling of 0x8000000
offset in AVR32 files) by a completely different logic that no
longer breaks hex files for other devices starting with an
offset; also apply a similar change to S-record files, as well
as when writing files.
fileio.c: (Ditto.)
2011-09-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrftdi.c: Remove stray printf()s by fprintf(stderr)
* usbtiny.c: (Ditto.)
2011-09-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* main.c: Restrict the cyclecounter readout to those cases where
it has been explicitly requested (by -y or -Y), rather than always
attempting to read the last EEPROM bytes.
2011-09-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* stk500v2.c (stk600_xprog_paged_load, stk600_xprog_paged_write):
Fix regression in the AVRISPmkII/STK600 TPI handling introduced
by the USBasp's TPI implementation which added a pagesize even for
the minor memory regions of TPI devices. Also fix wrong offset
introduced by the memory tagging patch.
2011-09-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avr.c (avr_read, avr_write): Don't bail out on TPI parts if
their programmer doesn't provide a (low-level) cmd_tpi method;
instead, fall back to the normal programmer methods which are
supposed to handle the situation.
This fixes a regression where the recent bitbang-TPI implementation
broke TPI handling of STK600/AVRISPmkII.
2011-09-14 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Mega-commit to bring in memory tagging.
Each memory image byte is now tagged as it's being read from a file.
Only bytes read from a file will be written or verified (modulo page
granularity requirements).
* avrpart.h: Add memory tags.
* avrpart.c: Allocate and initialize tag area.
* update.h: Drop unused parameter "verify" from do_op().
* pgm.h: Add parameter base_addr to the paged_load and paged_write
methods, respectively.
* avr.h: New parameter to avr_read: second AVRPART to verify against.
* fileio.c: Track all memory regions that have been read from an
input file by tagging them.
* update.c: Call avr_read() with the new parameter list.
* main.c: Call avr_initmem() to initialize the memory regions, rather
than trying to duplicate an unitialized part, and then let the
original part rot away.
* avr.c: Implement the heart of the new featureset. For paged memory
areas, when writing or verifying, call the paged_write and paged_load
methods, respectively, once per page instead of on the entire memory.
When writing, only write bytes or pages that have content read from a
file. Whe verifying, only read memory bytes or pages where the
verification data have been read from a file. Only verify those bytes
that have been read from a file.
* avrftdi.c: Implement the new API for paged_load and paged_write,
respectively.
* jtagmkII.c: (Ditto.)
* butterfly.c: (Ditto.)
* jtagmkI.c: (Ditto.)
* avr910.c: (Ditto.)
* stk500.c: (Ditto.)
* usbasp.c: (Ditto.)
* stk500v2.c: (Ditto.)
* usbtiny.c: (Ditto.)
2011-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* stk500v2.c (stk500v2_command): Treat warnings as errors rather than
success.
2011-08-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #34027: avrdude AT90S1200 Problem (part 3 - documentation)
* avrdude.1: Document the programmer type restrictions for AT90S1200
devices.
* doc/avrdude.texi: (Ditto.)
2011-08-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #34027: avrdude AT90S1200 Problem (part 2 - stk500v2 and relatives)
* stk500v2.c (stk500v2_initialize): For the AT90S1200, release
/RESET for a moment before reinitializing, as this is required by
its programming protocol.
2011-08-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: In AC_CHECK_LIB for libftdi, check for
ftdi_usb_get_strings() rathern than ftdi_init(), as this is a more
specific thing to search for in order to make sure getting a
recent enough libftdi.
2011-08-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #34027: avrdude AT90S1200 Problem (part 1 - bitbang
programmers)
* config_gram.y: Introduce new keyword "is_at90s1200".
* lexer.l: (Ditto.)
* avrdude.conf.in: Applew new keyword to the AT90S1200 device.
* avrpart.h: Introduce new flag AVRPART_IS_AT90S1200, reflecting
the is_at90s1200 configuration keyword.
* bitbang.c (bitbang_initialize): Replace existing test for
AT90S1200 by AVRPART_IS_AT90S1200
* avr.c (avr_write_byte_default): Avoid the pre-write reading for
the AT90S1200, as this appears to sometimes corrupt the high byte
by pre-programming the low byte just written into it.
2011-08-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Bump version for post-5.11.
2011-08-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Bump version for releasing AVRDUDE 5.11.
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.1: Update the list of supported AVR devices.
* doc/avrdude.texi: (Ditto).
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: add -lusb as "other libraries" when checking
for libftdi.
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Juergen Weigert:
patch #7056: adding support for mikrokopter bootloader to butterfly
* butterfly.c: Add some specific logic to handle the
mikrokopter.de butterfly bootloader.
* butterfly.h: Add one related function declaration.
* config_gram.y: Add butterfly_mk keyword.
* lexer.l: (Ditto.)
* avrdude.conf.in: Add entry for butterfly_mk.
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Stefan Tomanek:
patch #7542: add default_bitclock to configuration files
* config.c: Add the new keyword and its handling.
* config.h: (Ditto.)
* config_gram.y: (Ditto.)
* avrdude.conf.in: (Ditto.)
* main.c: (Ditto.)
* lexer.l: (Ditto.)
* avrdude.1: Document the change.
* doc/avrdude.texi: (Ditto.)
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Brett Hagman:
patch #7603: wiring - programmer type for Wiring boards
(based on STK500v2)
* wiring.c: New file.
* wiring.h: (Ditto.)
* Makefile.am: Add new files.
* stk500v2_private.h: Reorganize so some functions and struct
pdata are globally known.
* stk500v2.c: (Ditto.)
* stk500v2.h: (Ditto.)
* lexer.l: Add new programmer keywords.
* config_gram.y: (Ditto.)
* avrdude.conf.in: Add "wiring" programmer entry.
* avrdude.1: Document the new programmer.
* doc/avrdude.texi: (Ditto.)
* AUTHORS: Add Brett Hagman.
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by an anonymous contributor on the mailinglist:
* avrdude.conf (jtagkey): Add a definition for the Amontec
JTAGKey
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Juergen Weigert:
bug #22720: avrdude-5.5 ignores buff settings in avrdude.conf
(Note that the actual bug the subject is about has been fixed
long ago.)
* update.c (do_op): fix a diagnostic message
* pgm.h: add exit_datahigh field
* par.c: set and act upon the exit_datahigh field
* avrdude.1: document the new -E options
* doc/avrdude.texi: (Ditto.)
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #33811: Parallel make fails
* Makefile.am (BUILT_SOURCES): Add this macro.
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #33114: Segfault after setting the DWEN fuse with Dragon
* jtagII.c (jtagmkII_getsync): Instead of exit()ing from
deep within the tree when detecting the "need debugWIRE"
situation, properly pass this up as a return code.
* jtagII_private.h (JTAGII_GETSYNC_FAIL_GRACEFUL): New constant.
* stk500v2.c (stk500v2_jtagmkII_open): Don't tell anything
anymore when receiving a JTAGII_GETSYNC_FAIL_GRACEFUL from
jtagmkII_getsync(); silently give up (all necessary has been
said already).
2011-08-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Reported by Jason Hecker:
* usbasp.c (libusb_to_errno): Conditionalize some error codes
that apparently are lacking on MinGW.
2011-08-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Fix warnings.
* ser_avrdoper.c: add <stdlib.h> so exit() is declared.
* usbtiny.c (usbtiny_open): provide an initializer to a
"may be used uninitialized" variable (since GCC could not
fully detect the logic behind).
2011-08-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Add a check for FreeBSD's libusb-1.0
compatible library that is found in libusb.a/.so on
FreeBSD 8+.
2011-08-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Doug Springer, based on work by
Wolfgang Moser, Ville Voipio, Hannes Weisbach
patch #7486: Patch to add FT2232C/D, FT2232H, FT4232H,
usbvid, usbpid, usbdev for USB support - Based on #7062
* avrftdi.c: New file.
* avrftdi.h: (Ditto.)
* configure.ac: Add check for libftdi.
* config_gram.y: Add AVRFTDI and per-programmer USB string
keywords.
* lexer.l: (Ditto.)
* avrdude.conf.in: Add avrftdi and 2232HIO programmers.
* pgm.h: Add USB parameters.
* Makefile.am: Add avrftdi.c and avrftdi.h.
* AUTHORS: Mention the new authors.
* avrdude.1: Document the changes.
* doc/avrdude.texi: (Ditto.)
2011-08-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #29585: Fix license
* doc/avrdude.texi: Add FDL as an option to the licensing
statement, as the savannah administration would like it
that way.
2011-08-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Darell Tan:
patch #7244: TPI bitbang implementation
* bitbang.c: Add TPI bitbang stuff.
* bitbang.h: (Ditto.)
* avr.c: (Ditto.)
* avr.h: (Ditto.)
* pgm.c: (Ditto.)
* pgm.h: (Ditto.)
* serbb_posix.c: Wire bitbang_cmd_tpi into the struct pgm.
* serbb_win32.c: (Ditto.)
* par.c: (Ditto.)
* doc/avrdude.texi: Document the TPI bitbang support.
2011-08-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Grygoriy Fuchedzhy:
bug #31779: Add support for addressing usbtinyisp with -P option
* usbtiny.c (usbtiny_open): Add logic to distinguish multiple USBtinyISP
programmers by their bus:device tuple.
* doc/avrdude.texi: Document the new functionality.
* avrdude.1: (Ditto.)
2011-08-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Timon Van Overveldt:
bug #30268: Debugwire broken in avrdude-5.10
* jtagmkII.c (jtagmkII_initialize): only try setting up a JTAG chain when
the programmer is using JTAG.
2011-08-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #29636: AVRDude issues invalid CMD_CHECK_TARGET_CONNECTION
on the AVRISP-MKII
* stk500v2.c (stk500v2_program_enable): Rewrite the logic to
explain ISP activation failures.
* stk500v2_private.h: Fix the various STATUS_* constants;
AVR069 and AVR079 disagreed in their values, even though they
are apparently implementing the same logic behind.
2011-08-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #29650: Programming timeouts in ATmega128RFA1 are too slow
* avrdude.conf.in (ATmega128RFA1): Bump write delay values for flash and
EEPROM to 50 ms.
2011-08-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.conf.in (ATmega8515, ATmega8535, ATmega48, ATmega88, ATmega88P,
ATtiny88, ATmega168, ATmega168P, ATmega328P): Bump delay value for STK500v2
EEPROM write operation to 5, according to the respective XML files.
2011-08-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Darcy Houlahan:
bug #29694: error in avrdude.conf for attiny84 eeprom
* avrdude.conf.in (ATtiny84, ATtiny85): fix A7 bit in EEPROM write
command.
2011-08-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Durant Gilles:
* avrdude.conf.in (ATtiny4313): Fix flash addressing bits for manual ISP
algorithm.
2011-08-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Philip:
bug #31386: A "BUILD.svn" or similar "how to get started" doc would be helpful
* BUILD-FROM-SVN: New file.
2011-08-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Nic Jones:
bug #32539: [Documentation][Patch] Man page is misleading
re: Dragon & PDI
* doc/avrdude.texi: Update information about PDI connections
on AVR Dragon
2011-08-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* usbasp.c: Add <stdint.h> so this actually compiles
again.
2011-08-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Contributed by tixiv@gmx.net:
bug #33345: File auto detection as binary doesn't open
file in binary mode on Windows
* fileio.c: Move the decision about opening files in
binary mode until before the fopen() call.
2011-06-16 Thomas Fischl <tfischl@gmx.de>
* avrdude.conf.in: Fix part id of ATtiny9.
2011-05-28 Thomas Fischl <tfischl@gmx.de>
Based on patch #7440 commited by Slawomir Fraś:
* usbasp.c: added TPI support for USBasp
* usbasp.h: (Ditto.)
2011-05-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.conf.in: Add support for ATmega168P.
2011-05-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.conf.in: Fix abbreviated name for ATmega324PA.
2011-05-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Lech Perczak:
bug #30946: Added support for ATmega8/16/32U2
* avrdude.conf.in: Add ATmega8/16/32U2 entries.
2011-05-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by David A Lyons:
patch #7393: Adding ATtiny4313 Device to avrdude.conf.in
* avrdude.conf.in: Add ATtiny4313 data.
2011-05-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* usb_libusb.c: Bump timeout values to allow for slow clock
speeds.
* jtagmkII.c: (Ditto.)
2011-03-04 Eric B. Weddington <eric.weddington@atmel.com>
Thanks to Vitaly Chernookiy for the patch.
* avrdude.conf.in: Add support for atmega324pa.
* ChangeLog-2010: New file, rotate ChangeLog for new year.

View File

@ -1,729 +0,0 @@
2012-12-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* usbdefs.h (USBDEV_BULK_EP_WRITE_STK600)
(USBDEV_BULK_EP_READ_STK600): new define values
* stk500v2.c (stk600_open): use the STK600 EP values,
as they are different from AVRISPmkII
2012-12-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #37942: Latest SVN can't program in dragon_jtag mode
* jtagmkII.c (jtagmkII_initialize): For Xmega devices, and
firmware >= 7.x, don't trigger a RESET, in order to work around a
firmware bug that appears to be present in at least firmware 7.24
for the Dragon.
2012-12-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* config_gram.y: Implement the "ocdrev" keyword
* avrpart.c: (Dito)
* avrpart.h: (Dito)
* lexer.l: (Dito)
* avrdude.conf.in: Add "ocdrev" key/value pairs, based
on the AS6 XML file information.
* jtag3.c: Use the ocdrev in the parameter block.
2012-12-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtag3.c: Make jtag3_command() public
* jtag3.h: (Dito.)
* jtag3_private.h: Add two new commands
* stk500v2.c: Implement the "MonCon disable" hack that
allows temporarily falling back to ISP when trying to
talk to a part that has debugWIRE enabled
2012-12-03 Rene Liebscher <R.Liebscher@gmx.de>
* pickit2.c: reordered #includes for non-usb configuration
2012-12-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtag3.c: Enable interactive adjustment of the various
clock frequencies (JTAG Xmega, JTAG megaAVR, PDI Xmega)
through the set_sck_period() callback.
2012-12-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtag3.c: Remove unused code that was left over from
cloning the jtagmkII.c implementation
2012-12-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* pgm_type.c: Add "jtagice3_isp" programmer hook
* avrdude.conf.in: Add "jtag3isp" programmer
* jtag3.c: jtag3_setparm() is now public
* jtag3.h: (Dito)
* stk500v2_private.h: Command 0x1D is CMD_SPI_MULTI only
for STK500v2, AVRISPmkII, and JTAGICEmkII; for JTAGICE3,
it's CMD_SET_SCK now; also add CMD_GET_SCK
* avrpart.c (avr_get_output_index): New function
* avrpart.h: (Dito)
* stk500v2.c: Implement the pasthrough programmer glue logic
for JTAGICE3 in ISP mode
* stk500v2.h: (Dito)
* avrdude.1: Document the JTAGICE3 support.
2012-11-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtag3.c (jtag3_read_byte, jtag3_write_byte): Remove the
m->offset from addr, JTAGICE3 doesn't need it anymore (similar
to JTAGICEmkII with 7+ firmware)
* jtag3.c (jtag3_read_byte): Allow for full-page reads of
EEPROM also for Xmega and debugWIRE, allow for signature
read in debugWIRE
2012-11-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtag3_private.h: Add two more error detail codes I stumbled
across during development
* jtag3.c: (Dito.)
* usb_libusb.c: Reduce timeouts from 100 to 10 s, still long
enough, but not getting cold feet when something goes wrong.
2012-11-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtag3.c: Handle events returned by the ICE
* usbdevs.h: Add defines that mark an event in return
from usb_recv_frame().
* usb_libusb.c: (Dito.)
2012-11-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.conf.in: Remove "has_jtag" from Xmega A4 and D4
devices, as they only have PDI.
* jtag3.c (jtag3_page_erase): Actually implement this.
2012-11-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #37265: wrong page sizes for XMega64xx in avrdude.conf
* avrdude.conf.in: Fix page sizes for all Xmega devices,
by cross-checking against Atmel Studio's device XML files
2012-11-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtag3.c: Fill in the missing pieces for Xmega support (both,
PDI and JTAG).
* jtagmkII.c (jtagmkII_set_xmega_params): Use "fuse1" rather
than "fuse0" memory space to fill in the NVM offset from, as
there is no "fuse0" on some Xmega devices.
2012-11-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.conf.in (ATmega256RFR2, ATmega128RFR2, ATmega64RFR2):
New devices
2012-11-28 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
First support for Atmel JTAGICE3. Guessed from USB sniffer
traces made by Knut Schwichtenberg, and by similarity to
JTAGICEmkII.
Still quite incomplete, just megaAVR/JTAG is done by now.
* jtag3.c: New file.
* jtag3.h: (Dito.)
* jtag3_private.h: (Dito.)
* pgm_type.c: Add new programmers
* avrdude.conf.in: (Dito.)
* usbdevs.h: Add new parameters
* Makefile.am: Add new files
* usb_libusb.c: Handle separate event endpoint, and larger
(USB 2.0) packet sizes
2012-11-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtagmkII.c: Change all the USB details (endpoint numbers,
max transfer size etc.) to a per-programmer adjustable value.
* serial.h: (Dito.)
* stk500v2.c: (Dito.)
* usbdevs.h: (Dito.)
* usb_libusb.c: (Dito.)
2012-11-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* buspirate.c: Replace outdated FSF postal address by a reference to
the GPL info on their website.
* jtagmkII.c: (Dito.)
* avrftdi.c: (Dito.)
* wiring.c: (Dito.)
* linux_ppdev.h: (Dito.)
* serbb.h: (Dito.)
* usbtiny.h: (Dito.)
* confwin.c: (Dito.)
* buspirate.h: (Dito.)
* avrftdi.h: (Dito.)
* wiring.h: (Dito.)
* jtagmkII.h: (Dito.)
* pickit2.c: (Dito.)
* config.c: (Dito.)
* term.c: (Dito.)
* confwin.h: (Dito.)
* avrdude.1: (Dito.)
* windows/Makefile.am: (Dito.)
* config.h: (Dito.)
* pickit2.h: (Dito.)
* term.h: (Dito.)
* tools/get-hv-params.xsl: (Dito.)
* tools/get-stk600-cards.xsl: (Dito.)
* tools/get-stk600-devices.xsl: (Dito.)
* tools/get-dw-params.xsl: (Dito.)
* butterfly.c: (Dito.)
* configure.ac: (Dito.)
* doc/Makefile.am: (Dito.)
* pgm_type.c: (Dito.)
* butterfly.h: (Dito.)
* jtagmkI.c: (Dito.)
* ft245r.c: (Dito.)
* COPYING: (Dito.)
* pgm_type.h: (Dito.)
* jtagmkI.h: (Dito.)
* pindefs.h: (Dito.)
* config_gram.y: (Dito.)
* arduino.c: (Dito.)
* arduino.h: (Dito.)
* ser_win32.c: (Dito.)
* serbb_win32.c: (Dito.)
* avr910.c: (Dito.)
* stk500.c: (Dito.)
* freebsd_ppi.h: (Dito.)
* avr910.h: (Dito.)
* solaris_ecpp.h: (Dito.)
* stk500.h: (Dito.)
* jtagmkII_private.h: (Dito.)
* avrdude.h: (Dito.)
* bitbang.c: (Dito.)
* bitbang.h: (Dito.)
* avrpart.c: (Dito.)
* safemode.c: (Dito.)
* stk500generic.c: (Dito.)
* serial.h: (Dito.)
* avrpart.h: (Dito.)
* jtagmkI_private.h: (Dito.)
* ppi.c: (Dito.)
* avr.c: (Dito.)
* safemode.h: (Dito.)
* stk500generic.h: (Dito.)
* ser_avrdoper.c: (Dito.)
* avr.h: (Dito.)
* ppi.h: (Dito.)
* usbasp.c: (Dito.)
* lists.c: (Dito.)
* stk500v2.c: (Dito.)
* my_ddk_hidsdi.h: (Dito.)
* tpi.h: (Dito.)
* usbasp.h: (Dito.)
* lists.h: (Dito.)
* stk500v2.h: (Dito.)
* ppiwin.c: (Dito.)
* fileio.c: (Dito.)
* ser_posix.c: (Dito.)
* fileio.h: (Dito.)
* serbb_posix.c: (Dito.)
* usbdevs.h: (Dito.)
* par.c: (Dito.)
* update.c: (Dito.)
* pgm.c: (Dito.)
* main.c: (Dito.)
* par.h: (Dito.)
* update.h: (Dito.)
* lexer.l: (Dito.)
* Makefile.am: (Dito.)
* pgm.h: (Dito.)
* usb_libusb.c: (Dito.)
* usbtiny.c: (Dito.)
2012-11-13 Rene Liebscher <R.Liebscher@gmx.de>
bug #35186 inverting pins with "~" doesn't work for pin lists (i.e. vcc)
bug #37727 Add support for LM3S811 dev board as a programmer
* lexer.l,config_gram.y: accepting inverted pins at pin lists
syntax: ~num or ~(num,num,...)
* par.c: par_set_many_bits is now usable with inverted pins
* avrftdi.c: fixed wrong index in ftdi_pin_name
* avrdude.conf.in: added programmer lm3s811
2012-11-04 Rene Liebscher <R.Liebscher@gmx.de>
* lexer.l,config_gram.y,config.[hc]: changed reading of numbers to integers
except of default_bitclock which is the only real number.
No signs are allowed as negative values do not make sense for current
config values.
* buspirate.c: include own header file buspirate.h
* doc/.cvsignore: add programmers.texi to ignore list
2012-09-06 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* doc/Makefile.am: add EXTRA_DIST, replace $(srcdir) by
$(builddir) for generated files, so "make distcheck"
works again
2012-09-05 Rene Liebscher <R.Liebscher@gmx.de>
* doc/Makefile.am: add $(srcdir) to name of generated files, so BSD make
find the files ( GNU make sees no difference if the
file is called version.texi or ./version.texi )
2012-08-15 Rene Liebscher <R.Liebscher@gmx.de>
patch #7184 Support for PICKit2 programmer
* Makefile.am: add pickit2 files
* pickit2.[ch]: new programmer implementation
* pgm_type.c: add pickit to list
* avrdude.1: documentation for pickit2
* doc/avrdude.texi: documentation for pickit2
* avrdude.conf.in: add pickit2 programmer entry
2012-08-15 Rene Liebscher <R.Liebscher@gmx.de>
bug #30559 Ft232 bit-bang support, see comment #30
* ft245r.c: added semaphore workaround for MacOS X,
added pthread_testcancel in reader thread
* configure.ac: added check for TYPE_232H in libftdi (not in libftdi < 0.20)
* avrftdi.c: do not use TYPE_232H if not declared
2012-08-13 Hannes Weisbach <hannes_weisbach@gmx.net>
* avrftdi.c: fixes pin_limit for different FTDI devices (there was a mixup
between 2232C and 2232H)
2012-07-29 Hannes Weisbach <hannes_weisbach@gmx.net>
* avrftdi.c: bugfixes (synchronisation) and maintenance (paged programming,
nicer output, separation of parameter checking and actual code)
2012-07-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtagmkII.c (jtagmkII_memtype): return MTYPE_FLASH rather than
MTYPE_SPM for non-Xmega flash regions
2012-07-20 Hannes Weisbach <hannes_weisbach@gmx.net>
* avrpart.c, avrpart.h: adds avr_pin_name()
2012-07-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: check for libelf.h also in libelf/
* fileio.c: include <libelf/libelf.h> if configure found this
to be the case
2012-06-13 Rene Liebscher <R.Liebscher@gmx.de>
* configure.ac: Check for presence of <pthread.h>
* ft245r.c: Depend on HAVE_PTHREAD_H
* Makefile.am: Add -lpthread if needed.
2012-06-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* usbtiny.c (usbtiny_paged_load, usbtiny_paged_write):
fix breakage introduced by the recent page handling reorg;
it used to cause an infinite loop
2012-05-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Xmega page erase implementation for XPROG (AVRISPmkII, STK600)
* stk500v2.c (stk600_xprog_page_erase): New function.
2012-05-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Xmega page erase implementation for JTAGICEmkII
* jtagmkII.c: Handle flash pages sizes > 256 bytes, implement
page_erase() method
* avrdude.conf.in: Change flash pagesize for all Xmega devices
to 512 bytes
* avr.c: Implement auto_erase, using page_erase if available
* avr.h: Remove unused parameters from avr_read(), replace
unused parameter in avr_write)() by auto_erase
* stk500v2.c: Handle flash page sizes > 256 bytes
* update.c (do_op): Handle new updateflags parameter
* main.c: Implement auto_erase as page_erase if possible
* update.h (enum updateflags): New enum
* pgm.h (struct programmer_t): Add page_erase method
2012-04-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtagmkII.c (jtagmkII_paged_load, jtagmkII_paged_write): fix bug
in memory type calculation for Xmega "boot" memory region.
2012-04-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* update.c (parse_op): do not assume default memtype here
* main.c: after locating the part information, determine default
memtype for all update options that didn't have a memtype
specified; this is "application" for Xmega parts, and "flash" for
everything else.
2012-04-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* fileio.c: Rework the way ELF file sections are considered: while
scanning the program header table, the offsets from a program
header entry must never be used directly when checking the bounds
of the current AVR memory region. Instead, they must always be
checked based on the corresponding section's entry. That way,
Xmega devices now properly take into account whether the segment
fits into any of the application/apptable/boot memory region.
2012-04-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #30756: When setting SUT to 64ms on XMEGA, avrdude doesn't
read device signature
* main.c: When reading the signature yields 0x000000 or 0xffffff,
retry (up to twice) after some progressive delay.
2012-04-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.conf.in (ATxmega16D4, ATxmega32D4, ATxmega64D4,
ATxmega128D4): New devices. As Xmega D doesn't feature a fuse0
memory cell, move that one out from the generic .xmega part into
the individual Xmega A parts.
2012-04-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #29019: pagel/bs2 warning when uploading using stk500 to xmega
* stk500.c (stk500_initialize): Insert dummy values for PAGEL and
BS2 if they are not present in the config file, in order to be able
to proceed with the stk500_set_extended_parms() anyway.
2012-04-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* stk500v2_private.h (struct pdata): add boot_start
* stk500v2.c: For the "flash" pseudo-memory of Xmega devices,
distinguish addresses between "application" and "boot" area.
2012-04-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* fileio.c (elf2b): When checking the bounds of the current
program header segment, subtract `low' from ph[n].p_paddr in order
to correct the magic section offsets for the AVR's non-flash
memory regions.
2012-04-18 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* fileio.c (elf_get_scn): Rather than trying to just match whether
any given section maps straight to a program header segment, use a
more sophisticated decision that matches any section as long as it
fits into the segment. This is needed for situations where the
program header segment spans a larger area than the section data
provided. (This can e.g. happen in an ELF file that contains no
data at address 0, like a bootloader only.)
2012-04-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #28744: Can't load bootloader to xmega128a1 (part 2, fix for
firmware >= V7.x)
* jtagmkII.c: Add firmware-version dependent handling of Xmega parameters.
V7.x firmware expects the NVM offsets being specified through the Xmega
parameters command, but left out as part of the memory address itself.
* jtagmkII_private.h: Add CMND_SET_XMEGA_PARAMS, and struct xmega_device_desc.
* config_gram.y: Add mcu_base keyword.
* avrpart.h: (Dito.)
* lexer.l: (Dito.)
* avrdude.conf.in (.xmega): add mcu_base, and data memory segment.
2012-03-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #28744: Can't load bootloader to xmega128a1 (part 1, fix for
firmware < V7.x)
* jtagmkII.c: When going to write to the boot section of flash,
use MTYPE_BOOT_FLASH rather than MTYPE_FLASH
* jtagmkII_private.h: add MTYPE_BOOT_FLASH constant
2012-03-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtagmkII_private.h: Sort commands, response codes and events
into numerical order.
2012-03-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #30451: Accessing some Xmega memory sections gives not
supported error
* stk500v2.c: Handle all Xmega memory sections (except
"prodsig" which is not documented in AVR079)
* fileio.c: Treat the "boot", "application", and "apptable"
regions (which are actually subregions of "flash") all as
being flash, i.e. suppress trailing 0xFF bytes when reading
them
* avr.c: (Dito.)
2012-03-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtagmkII.c (jtagmkII_close): The GO command before signing off
turned out to be not required for normal megaAVR devices, and to
cause the exact opposite (i.e. the target stopping) on Xmega
devices being programmed to JTAG. However, programming Xmega
devcies through PDI *does* need the GO command.
2012-03-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Print a configuration summary at the end of the
configure run
2012-02-11 Rene Liebscher <R.Liebscher@gmx.de>
patch #7718: Merge global data of avrftdi in a private data structure
* avrftdi.[ch]: moved global data into private data structure, moved
private defines from header file into source file
2012-02-06 Rene Liebscher <R.Liebscher@gmx.de>
patch #7720 Bug in EEPROM write
* avrftdi.c: fixed wrong buffer address initialization in paged_write
* fileio.c: added #include <stdint.h>
2012-02-05 Rene Liebscher <R.Liebscher@gmx.de>
bug #30559 Ft232 bit-bang support
* ft245r.c: cancel reader thread before exiting program
2012-02-04 Rene Liebscher <R.Liebscher@gmx.de>
patch #7717 avrftdi_flash_write is broken
* avrftdi.c: fixed wrong buffer address initialization in paged_write
bug #35296 Extraneous newlines in output.
* main.c: fixed output of newlines at 100% progress
2012-02-03 Rene Liebscher <R.Liebscher@gmx.de>
patch #7715 FT4232H support
* avrdude.conf.in: added programmer 4232h
2012-02-03 Rene Liebscher <R.Liebscher@gmx.de>
patch #7687: Autogenerating programmers and parts lists for docs
(generating the programmers lists)
* doc/avrdude.texi: Add include of generated table of programmers
* doc/Makefile.am: Add generating of table of programmers in programmers.texi
2012-02-03 Rene Liebscher <R.Liebscher@gmx.de>
bug #34768 Proposition: Change the name of the AVR32 devices
* avrdude.conf.in: renamed ucr2 to uc3a0512
* avrpart.c: added cast to avoid compiler warning
2012-02-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* fileio.c (fileio_elf): Fix a copy'n-paste-o.
2012-02-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* par.c (par_desc): Move to end of file, outside the #if
HAVE_PARPORT
2012-02-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Implement ELF file reading (finally). Requires libelf(3) to be
present on the host system.
* configure.ac (HAVE_LIBELF): Add logic to detect presence of
libelf(3)
* Makefile.am (avrdude_LDADD): Add @LIBELF@
* fileio.h (FILEFMT): add FMT_ELF
* fileio.c: Implement ELF file reader.
* update.c (parse_op): add 'e' format specifier
* avrdude.1: Document the ELF file reading capability
* doc/avrdude.texi: (Dito.)
2012-02-01 Rene Liebscher <R.Liebscher@gmx.de>
bug #30559 Ft232 bit-bang support
* ft245r.[ch]: new programmer type implementation
* configure.ac: add pthread as link library
* avrdude.conf.in: added some new programmers
* Makefile.am: added new source files to compile
* pindefs.h: change PIN_MASK, PIN_INVERSE to highest bit of unsigned int
* pgm.[ch]: added generic function to print pin assignments (taken from par.c)
* par.c: moved pin assigment print function to pgm.c
2012-02-01 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* lexer.l: Sort keyword tokens into alphabetic order.
2012-01-31 Rene Liebscher <R.Liebscher@gmx.de>
* config_gram.y, lexer.l: removed unused ID/TKN_ID definitions
* config.[hc]: removed unused function id(), use value.type to select
values
2012-01-31 Rene Liebscher <R.Liebscher@gmx.de>
patch #7437 modifications to Bus Pirate module
patch #7686 Updating buspirate ascii mode to current firmware, use AUX
as clock generator, and setting of serial receive timeout
* buspirate.c: added paged_write, changed binary mode setup/detection,
added clock output on AUX pin
* avrdude.1: updated documentation
* doc/avrdude.texi: updated documentation
2012-01-31 Rene Liebscher <R.Liebscher@gmx.de>
Parser does not need to know all programmer types now, new programmers
will update only the table in pgm_type.c.
* config_gram.y, lexer.l: removed programmer type keywords,
use now locate_programmer_type() function
* pgm_type.[ch]: added new files for table of programmer types
* main.c: allow list of programmer types by -c ?type
* avrdude.conf.in: changed all type keywords to quoted strings
* doc/avrdude.texi: changed description of type definition, list
of valid types is now included from generated file
* doc/Makefile.am: generate list of programmer types for doc
* all programmers [hc]: add xxx_desc string for description of programmer
2012-01-30 Rene Liebscher <R.Liebscher@gmx.de>
* configure.ac: fixed detection of yylex_destroy availability
by checking the version number of flex; bump required autoconf
version to 2.60 (for AC_PROG_SED)
2012-01-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* lexer.l: Replace the old, now-defunct #define YY_NO_UNPUT by
the new %option nounput. This gets rid of a compiler warning.
2012-01-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Add a connection_type attribute to each programmer, rather than
trying to hard-code the default port name in main.c.
* pgm.h: Add conntype to struct pgm.
* lexer.l: Extend grammar for connection_type.
* config_gram.y: (Dito.)
* config.h: Add DEFAULT_USB, for symmetry with default_parallel
and default_serial.
* main.c: Replace old default portname hack by avrdude.conf-based
knowledge.
* usbtiny.c: Drop an old hack that's no longer necessary.
* avrdude.conf.in: Add connection_type to each programmer
definition.
2012-01-27 Rene Liebscher <R.Liebscher@gmx.de>
* avrdude.conf.in: used parent parts for some other parts, added
abstract .xmega part as parent for xmegas
* main.c: hide parts starting with '.' from parts list
2012-01-22 Rene Liebscher <R.Liebscher@gmx.de>
patch #7688: Implement parent programmers feature
* avrdude.conf.in: updated documentation comment and some programmers
have now parents
* config_gram.y: initpgm will now called at first use of programmer
in main. parser sets only the function pointer in the pgm structure.
Pin and pin lists definitions can now be empty to remove the parents
setting.
* doc/avrdude.texi: updated documentation
* main.c: added call to pgm->initpgm after locate_programmer
* pgm.[hc]: added field initpgm in structure, added function pgm_dup
2012-01-21 Rene Liebscher <R.Liebscher@gmx.de>
bug #21797: AT90PWM316: New part description
* avrdude.conf.in: added pwm316 with parent pwm3b but 16KB flash
2012-01-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Check for presence of lusb_usb.h as an alternative
to usb.h; libusb-win32 switched to this name in version 1.2.5.0.
* avrftdi.c: Decide whether to include <usb.h>, or <lusb0_usb.h>.
* ser_avrdoper.c: (Dito.)
* usbasp.c: (Dito.)
* usb_libusb.c: (Dito.)
* usbtiny.c: (Dito.)
2012-01-19 Rene Liebscher <R.Liebscher@gmx.de>
* avr.c: Unsigned variable was used for return code of paged_write/load
functions. So a negative return code led never to a fallback to byte
functions.
2012-01-17 Rene Liebscher <R.Liebscher@gmx.de>
bug #34302: Feature request : device configuration with parent classes
* config_gram.y: if memory section is overwritten old entry is removed
(not in original patch)
* config_gram.y: if programmer or part is defined twice, a warning is
output and the first instance is removed
General cleanup and free functions, so valgrind does not report any lost
blocks at program end.
* avrpart.[hc]: added avr_free_(opcode|mem|part) functions
* pgm.[hc]: added pgm_free function
* update.[hc]: added free_update functions
* config.[hc]: added cleanup_config function, use yylex_destroy to reset
the lexer after usage. (So it can be reused.)
* main.c: add cleanup_main function which is called by atexit() (This
frees all lists so that at program exit only really lost memory is
reported by valgrind.)
* usbasp.c: added libusb_free_device_list() and libusb_exit() calls to
avoid lost memory
* buspirate.c: moved memory allocation from initpgm to setup and added
free in teardown
* configure.ac: add definition of HAVE_YYLEX_DESTROY if $LEX is flex.
* Makefile.am: added . in front of SUBDIRS to build avrdude before trying
to use it for creating the part list for the docs.
2012-01-17 Rene Liebscher <R.Liebscher@gmx.de>
* usbasp.c: USB vid/pid/vendor/product from config file are used, for
id "usbasp" nibobee and old usbasp are tried as they were currently
implemented within usbasp
* avrdude.conf.in: added usb params to "usbasp", added new entry "nibobee"
with params which were hardcoded in usbasp.c, and added an entry
"usbasb-clone" which only checks vid/pid.
2012-01-10 Rene Liebscher <R.Liebscher@gmx.de>
bug #35261 avrftdi uses wrong interface in avrftdi_paged_(write|load)
* avrftdi.c: Fixed interface and implementation of avrftdi_paged_(write|load)
patch #7672 adding support for O-Link (FTDI based JTAG) as programmer
* avrdude.conf.in: added o-link entry
2012-01-10 Rene Liebscher <R.Liebscher@gmx.de>
patch #7699 Read additional config files
* main.c: Added reading of additional config files
* avrdude.1: updated man page
* doc/avrdude.texi: updated documentation
2012-01-10 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Bob Frazier:
bug #35208: avrdude 5.11 on freebsd 8.2-STABLE does not reset
Arduino Uno properly
* arduino.c (arduino_open): Bump the timeout between pulling
the DTR and RTS lines low and high.
2012-01-08 Rene Liebscher <R.Liebscher@gmx.de>
Fixed following findings reported by cppcheck
* avr910.c:625 (error) Possible null pointer dereference: cmd - otherwise it is redundant to check if cmd is null at line 624
* avr910.c:626 (error) Possible null pointer dereference: cmd - otherwise it is redundant to check if cmd is null at line 624
* avr910.c:168 (information) The scope of the variable 'devtype_1st' can be reduced
* avr910.c:169 (information) The scope of the variable 'dev_supported' can be reduced
* avrftdi.c:647 (error) Using sizeof for array given as function argument returns the size of pointer.
* stk500v2.c:3347 (error) Memory leak: b
* stk500v2.c:3452 (error) Memory leak: b
* usbasp.c:554 (error) Using sizeof for array given as function argument returns the size of pointer.
* usbasp.c:485 (information) The scope of the variable 'dly' can be reduced
2012-01-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Reported by Jason Kotzin:
* usbasp.c (usbasp_spi_paged_load, usbasp_spi_paged_write):
Fix buffer address calculation.
2012-01-03 Rene Liebscher <R.Liebscher@gmx.de>
patch #7629 add support for atmega48p
* avrdude.conf.in: Added m48p with parent m48 + different signature
* avrdude.conf.in: made part parents (m88p = m88 + different signature,
m168p = m168 + different signature)
2012-01-02 Rene Liebscher <R.Liebscher@gmx.de>
bug #21663 AT90PWM efuse incorrect
bug #30438 efuse bits written as 0 on at90pwmxx parts
* avrdude.conf.in: (pwm2, pwm2b, pwm3, pwm3b) <efuse.write>: Write
eight bits
* avrdude.conf.in: made part parents (pwm3 = pwm2, pwm3b = pwm2b,
pwm2b = pwm2 + different signature)
* ChangeLog-2011: New file, rotate ChangeLog for new year.

View File

@ -1,618 +0,0 @@
2013-12-15 Nils Springob <nils@nicai-systems.de>
* pgm.c/pgm.h: fixed syntax error in const pointer to const
2013-12-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: bump version to 6.1-svn-20131205
2013-12-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #40817: Elf file support (possibly) not working on 6.0.1 windows build
* fileio.c (fileio): open file in binary mode also for FMT_ELF
2013-12-04 Rene Liebscher <R.Liebscher@gmx.de>
Rework of bitbanging functions setpin, getpin, highpulsepin to make simplier use
of new pindefs data in pgm structure
* linuxgpio.c, bitbang.c, buspirate.c, par.c, pgm.h, term.c, serbb_*.c: changed
interface of setpin, getpin, highpulsepin to take pin function as parameter
(not the real number, which can be found by pgm->pinno[function])
2013-11-30 Rene Liebscher <R.Liebscher@gmx.de>
bug #40748 linuxgpio doesn't work on Raspberry PI rev. 2.
* linuxgpio.c: fixed check for unused pins to ignore the inverse flag
* pindefs.c: fixed fill_old_pinlist to not create an empty mask with inverse flag set
2013-10-18 Nils Springob <nils@nicai-systems.de>
* avrdude.conf.in (atmega1284): ATmega1284 variant added (same as ATmega1284p but with different signature)
2013-09-25 Hannes Weisbach <hannes_weisbach@gmx.net>
First part of patch #7720:
* avrdude.conf.in: Add UM232H and C232H programmers
2013-09-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Daniel Rozsnyo:
bug #40085: Typo fix in fuses report (for 6.1-svn-20130917)
* main.c: Fix a typo.
2013-09-19 Hannes Weisbach <hannes_weisbach@gmx.net>
task #12798: Please cleanup #ifdef notyet entries in avrftdi.c
* avrftdi.c: ditto.
avrftdi.c: Remove DRYRUN-option.
2013-09-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #40055: AVRDUDE segfaults when writing eeprom
* main.c: Always clear the UF_AUTO_ERASE flag if either a
non-Xmega device was found, or the programmer does not offer a
page_erase method.
2013-09-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac (AC_INIT): Bump version to post-6.0.
2013-09-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac (AC_INIT): Bump version to 6.0.
2013-09-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtag3.c (jtag3_initialize): Fix a buffer overflow by limiting
the flash page cache size to at most "readsize". For Xmegas with
a page size of 512 bytes, the maximum USB packet size was
overflowed, and subsequently, a memmove copied beyond the end of
the allocated buffer.
* jtag3.c (jtag3_read_byte): Add the correct offset also for the
various flash regions, so reading the apptable or boot regions
yields the correct data.
2013-09-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Joakim Lubeck:
bug #40040: Support for ATtiny20 and ATtiny40
* avrdude.conf.in: Restructure the reduced-core tiny devices
to use a common entry .reduced_core_tiny; add ATtiny20 and
ATtiny40
2013-09-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Joakim Lubeck:
bug #40033: Support for the XMegaE5 family
* avrdude.conf.in (ATxmega8E5, ATxmega16E5, ATxmega32E5): New
entries.
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* stk500v2.c (stk500v2_set_sck_period): Revamp this to match the
description/pseudo-code in appnote AVR068.
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Stephen Roe:
patch #7710: usb_libusb: Check VID/PID before opening device
* usb_libusb.c (usbdev_open): Swap the sequence of verifying the
VID:PID, and opening the device.
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
patch #8176: butterfly.c (AVR109 protocol implementation) clean-up and bug-fixing
* butterfly.c (butterfly_page_erase): Add dummy function to avoid
segfault when writing to EEPROM.
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #35474 Feature request: print fuse values in safemode output
* config_gram.y: New configuration token "default_safemode".
* lexer.l: (Dito.)
* avrdude.conf.in: (Dito.)
* config.h: Add variable default_safemode.
* config.c: (Dito.)
* main.c: Handle default_safemode, including -u option.
* avrdude.1: Document all this.
* doc/avrdude.texi: (Dito.)
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by HubertB:
patch #7657 Add ATmega406 support for avrdude using DRAGON + JTAG
* avrdude.conf.in (ATmega406): New entry.
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Marc de Hoop:
patch #7606 ATtiny43u support
* avrdude.conf.in (ATtiny43U): New entry.
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
patch #5708 avrdude should make 10 synchronization attempts instead of just one
* stk500.c (stk500_getsync): Loop 10 times trying to get in
sync with the programmer.
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Contributed by Ricardo Martins:
bug #36384 ATxmega32A4 usersig size
* avrdude.conf.in: Revamp all the ATxmega* entries. Add new
entries for ATxmega128A1U, ATxmega128A3U, ATxmega128A4U,
ATxmega128B1, ATxmega128B3, ATxmega128C3, ATxmega128D3,
ATxmega16A4U, ATxmega16C4, ATxmega192A3U, ATxmega192C3,
ATxmega192D3, ATxmega256A3BU, ATxmega256A3U, ATxmega256C3,
ATxmega256D3, ATxmega32A4U, ATxmega32C4, ATxmega384C3,
ATxmega384D3, ATxmega64A1U, ATxmega64A3U, ATxmega64A4U,
ATxmega64B1, ATxmega64B3, ATxmega64C3, ATxmega64D3
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #35456 The progress bar for STK500V2 programmer is "wrong".
* avr.c (avr_read, avr_write): Change the progress reporting for
paged read/write from per-address to per-considered-page. This
ought to give a realistic estimation about the time still to be
spent.
2013-09-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #34277: avrdude reads wrong byte order if using avr911 (aka butterfly)
* butterfly.c (butterfly_read_byte_flash): Swap bytes received.
2013-09-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #37768 Poll usbtiny 100 times at init time to handle low-clock devices
* doc/avrdude.texi: Add a FAQ entry about how to connect to a
target where the firmware has reduced the internal clock speed.
2013-09-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #28344 chip_erase_delay too short for ATmega324P, 644, 644P, and 1284P
* avrdude.conf: Bump the chip_erase_delay for all ATmega*4 devices
to 55 ms. While the datasheet still claims 9 ms, all the XML files
tell either 45 or 55 ms, depending on STK600 or not.
2013-09-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* fileio.c (fileio): Don't exit(1) if something goes wrong; return
-1 instead. Don't refer to obsolete option -f to specify the file
format.
2013-09-10 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Matthias Trute:
bug #36901 flashing Atmega32U4 EEPROM produces garbage on chip
* avrdude.conf.in (ATmega32U4): Fix EEPROM pagesize to 4, the
datasheet is wrong here.
2013-09-09 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: check for ar and ranlib in the target tool
namespace, rather than on the host.
2013-09-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Fix byte-wise EEPROM and flash writes on Xmega
* jtagmkII_private.h (MTYPE_EEPROM_XMEGA): New memory type.
* jtagmkII.c (jtagmkII_write_byte): For Xmega EEPROM, use
memory type MTYPE_EEPROM_XMEGA; for flash writes, always
write 2 bytes starting on an even address.
2013-09-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* term.c: Implement the "verbose" terminal mode command.
* avrdude.1: Document this.
* doc/avrdude.texi: (Dito.)
2013-09-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtag3.c (jtag3_write_byte): Do not attempt to start the paged
algorithm for EEPROM when being connected through debugWIRE.
2013-09-06 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Extend the single-byte algorithm to all devices, both flash and
EEPROM. (Flash cells must have been erased before though.)
* jtag3.c (jtag3_initialize): OCDEN no longer needs to be
considered; a session with "programming" purpose is sufficient
* jtag3.c (jtag3_write_byte): Use the paged algorithm for all
flash and EEPROM areas, not just Xmega.
2013-09-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Fix single-byte EEPROM updates on Xmega:
* jtag3_private.h (MTYPE_EEPROM_XMEGA): New define.
* jtag3.c (jtag3_write_byte): When updating flash or
EEPROM on Xmega devices, resort to jtag3_paged_write()
after filling and modifying the page cache.
* jtag3.c (jtag3_paged_write): use MTYPE_EEPROM_XMEGA
where appropriate.
* jtag3.c (jtag3_initialize): Open with debugging intent
for Xmega devices, so single-byte EEPROM updates will
work.
2013-09-04 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Matthias Neeracher:
bug #38732: Support for ATtiny1634
* avrdude.conf.in (ATtiny1634): New entry.
2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Brane Ždralo:
patch #7769: Write flash fails for AVR910 programmers
* avr910.c (avr910_paged_write): Fix flash addresses in
'A' command.
2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Fred (magister):
bug #38951: AVR109 use byte offset instead of word offset
patch #8045: AVR109 butterfly failing
* butterfly.c (butterfly_paged_load, butterfly_paged_write):
fix calculation of 'A' address when operating on flash memory.
It must be given in terms of 16-bit words rather than bytes.
2013-09-03 Rene Liebscher <R.Liebscher@gmx.de>
* avrftdi.c, avrftdi_private.h: added tx buffer size, and use
smaller block sizes as larger sometimes hang
2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.h: Remove the erase cycle counter (options -y / -Y).
* avr.c: (Dito.)
* main.c: (Dito.)
* avrdude.1: Undocument -y / -Y.
* doc/avrdude.texi: (Dito.)
2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #39691 Buffer overrun when reading EEPROM byte with JTAGICE3
* jtag3.c (jtag3_initialize): initialize the eeprom_pagesize
private attribute so the page cache will actually be usable
2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #38580 Current svn head, xmega and fuses, all fuses tied to fuse0
* jtag3.c (jtag3_read_byte, jtag3_write_byte): Correctly apply the
relevant part of mem->offset as the address to operate on.
2013-09-03 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* fileio.c: Fix "unused variable" warnings.
* avr.c: (Dito.)
* stk500v2.c: (Dito.)
* stk500.c: (Dito.)
* jtagmkII.c: (Dito.)
* term.c: (Dito.)
* ser_posix.c: (Dito.)
2013-09-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Travis Griggs:
bug #38307: Can't write usersig of an xmega256a3
* stk500v2.c (stk600_xprog_page_erase): allow erasing the usersig space.
2013-09-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Robert Niemi:
bug #35800: Compilation error on certain systems if parport is disabled
* linux_ppdev.h: Conditionalize inclusion of <linux/parport.h> and
<linux/ppdev.h> on HAVE_PARPORT
2013-09-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #39794: warnings when building avrdude 6.0rc1 under CentOS 6.4
* pickit.c (usb_open_device): Use %p rather than %X to print "handle"
which is a pointer
* jtag3.c (jtag3_initialize): Initialize "flashsize" to be sure it
proceeds with a valid value.
2013-09-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #39794: warnings when building avrdude 6.0rc1 under CentOS 6.4
* buspirate.c: Turn the "cmd" argument of the various methods into
a "const unsigned char *"; while doing this, declare all arrays being
passed as arguments to be pointers rather than arrays, as the latter
obfuscates the way arrays are being passed to a callee in C.
* avrftdi.c: (Dito.)
* pickit2.c: (Dito.)
* ft245r.c: (Dito.)
* avr910.c: (Dito.)
* stk500.c: (Dito.)
* bitbang.c: (Dito.)
* bitbang.h: (Dito.)
* avrftdi_tpi.c: (Dito.)
* avrftdi_tpi.h: (Dito.)
* usbasp.c: (Dito.)
* stk500v2.c: (Dito.)
* pgm.h: (Dito.)
* usbtiny.c: (Dito.)
2013-09-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #38023: avrdude doesn't return an error code when attempting
to upload an invalid Intel HEX file
* fileio.c (ihex2b): Turn the "No end of file record found" warning
into an error if no valid record was found at all.
2013-09-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Claus-Justus Heine:
bug #38713: Compilation of the documentation breaks with texinfo-5
* doc/avrdude.texi: Turn @itemx into @item, add @headitem to STK600
Routing/Socket card table
2013-09-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* usbasp.c: Add trace output for -vvv to non-TPI functions, too.
2013-09-01 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* usbasp.c (usbasp_tpi_paged_load): Calculate correct
buffer address.
* usbasp.c (usbasp_tpi_paged_write): Calculate correct
buffer address; don't issue a SECTION_ERASE command for
each page (a CHIP_ERASE has been done before anyway);
remove the code that attempted to handle partial page
writes, as all writes are now done with a full page.
2013-09-01 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* usbasp.c: Add more trace output, by now only for the TPI
functions.
2013-08-31 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* usbasp.c (usbasp_transmit): Add -vvvv trace output.
2013-08-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #39893: Verification failure with AVRISPmkII and Xmega
* stk500v2.c (stk600_xprog_page_erase): Fix argument that is
passed to stk600_xprog_memtype()
2013-07-11 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* fileio.c (elf2b): replace elf_getshstrndx() by
elf_getshdrstrndx() as the former one is deprecated
2013-06-19 Rene Liebscher <R.Liebscher@gmx.de>
use bitbanging on ftdi mpsse when wrong pins are used
* avrftdi.c, avrftdi_private.h: added additional pin check
and bitbanging fallback
* pindefs.[ch]: added a flag to enable/disable output
* ft245r.c: changes because of added flag above
2013-05-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by "Malte" and John McCorquodale:
patch #7876 JTAGICE mkII fails to connect to attiny if debugwire
is enabled AND target has a very slow clock
* jtagmkII.c (jtagmkII_getsync): When leaving debugWIRE mode
temporarily, immediately retry with ISP, rather than leaving.
* stk500v2 (stk500v2_program_enable): Implemented similar logic
for the JTAGICE3.
2013-05-16 Rene Liebscher <R.Liebscher@gmx.de>
* configure.ac: reactivate check for TYPE_232H, which does not
exist in libftdi < 0.20
* avrftdi*.*: changed include check for libftdi/libusb, deactivate
232H if not available
* ft245r.c: changed include check for libftdi/libusb
2013-05-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* main.c (main): Add option -l logfile.
* avrdude.1: Document -l option.
* doc/avrdude.texi: (Dito.)
2013-05-15 Rene Liebscher <R.Liebscher@gmx.de>
* configure.ac: if both found libftdi and libftdi1 use only libftdi1
* avrdude.conf.in: fixed buff pins of avrftdi programmers (low
active buffer need now inverted numbers)
* avrftdi*.*: accept also old libftdi (0.20 still works with it),
added powerup to initialize
* ft245r.c: accept libftdi1, code cleanup and make it more similar
to avrfdti (os they might be merged someday)
2013-05-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac (AC_INIT): Bump version to 6.0rc1.
2013-05-07 Hannes Weisbach <hannes_weisbach@gmx.net>
* avrftdi_private.h: Change size of pin_checklist to N_PINS (from N_PINS-1)
* avrftdi.c: Adapt code to new size of pin_checklist. Remove pins_check()
from set_pin().
Add pgm->power[up|down] functions as well as fill pgm->enable|disable with
proper content as suggested by Rene Liebscher.
2013-05-05 Rene Liebscher <R.Liebscher@gmx.de>
* pindefs.h: use unsigned int if stdint.h is not available and UINT_MAX is 0xffffffff
otherwise use unsinged long
* ft245r.c: added support for more pin functions led, vcc, buff
2013-05-06 Hannes Weisbach <hannes_weisbach@gmx.net>
* avrftdi_tpi.c: instead of private set_pin() function pointer use the one
declared in struct PROGRAMMER.
* avrftdi_private.h: remove set_pin function pointer. Add pin_checklist_t
member to check pgm->setpin calls during runtime.
* avrftdi.c: remove set_pin function pointer init, add pgm->setpin init.
Convert avrftdi to new 0-based pindefs infrastructure.
* avrdude.conf.in: Change all avrftdi-based programmers' pin definitions to
0-based.
2013-05-06 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* pindefs.h: Include "ac_cfg.h" before testing for HAVE_* macros.
2013-05-05 Rene Liebscher <R.Liebscher@gmx.de>
* main.c: revert to rev 1159 (doing pgm_display after pgm_open)
* avrpart.[ch]: moved avr_pin_name to pindefs.[ch]
* pgm.c: moved pins_to_str to pindefs.[ch], added initialization of
new pin definitions in pgm_new()
* pindefs.[ch]: added moved functions from other files, added a lot of
documentation, reformatted files using astyle to have consistent spacing,
added a new generic check function for pins
* ft245r.c: used new generic pin check function
2013-05-03 Rene Liebscher <R.Liebscher@gmx.de>
Create new pin definition data structures to support 0-based pin numbers,
and mixed inverse/non-inverse pin lists.
* avrftdi.c,buspirate.c,linuxgpio.c,par.c,serbb_*.c: added function call
to fill old pinno entries from new pin definitions.
* pindefs.[hc]: added data struct and helper functions for new pin definitions
* avrdude.conf.in: pins in entries using ftdi_syncbb are now 0-based
* config_gram.y: allow combinations of inverted and non-inverted pins in pin lists
* ft245r.c: reworked to work directly with the new pin definitions,
pins are now 0-based, inverse pins are supported, buff is supported
* pgm.[ch]: added new pin definitions field to programmer structure,
adapted pin display functions
2013-05-03 Hannes Weisbach <hannes_weisbach@gmx.net>
* avrftdi_private.h: Remove update forward declaration from avrftdi_print to
avrftdi_log.
* avrftdi_tpi.c: Do all I/O in terms of pgm->cmd_tpi()-calls instead of
avrftdi_tpi_[read,write]_byte().
Remove unnecessary set_pin call to set MOSI high, speeds up I/O.
Removes SKEY array, moves it to tpi.h.
Integrate new avr_tpi_[program_enable,chip_erase]() and functions into
avrftdi_tpi.
* avrftdi_tpi.h: Remove avrftdi_tpi_[program_enable,chip_erase] forward
declarations.
* avr.c: Adds avr_tpi_chip_erase() generic TPI chip erase function.
Adds avr_tpi_program_enable() - generic TPI external programming enable
function. Sets guard time, reads identification register, sends SKEY command
and key, checks NVMEN bit. The required guard time has to be passed as
parameter.
* tpi.h: Adds SKEY array including CMD_SKEY in "correct" order.
2013-05-02 Hannes Weisbach <hannes_weisbach@gmx.net>
* avrftdi_private.h: Add libusb-1.0 include to fix include order in windows.
* NEWS: Add notice avrftdi supporting TPI
* avr.c: Fix avr_tpi_poll_nvmbsy() - poll read data instead of return code
* avrftdi_private.h, avrftdi.c: move logging #defines to from avrftdi.c to
avrftdi_private.h, so that they are available for avrftdi_tpi, too.
2013-04-30 Hannes Weisbach <hannes_weisbach@gmx.net>
* tpi.h: Add definition for TPI Identification Code
* avrftdi_tpi.c: Add TPI-support for FTDI-based programmers
* avrftdi_private.h: Add common include file for FTDI-based programmers
2013-04-28 Hannes Weisbach <hannes_weisbach@gmx.net>
* avrftdic: Rework of textual output. Messages are divided by severity and
printed accordingly to the verbosity, as specified by the user. The provided
severity level are (ERROR, WARN, INFO, DEBUG, TRACE). Where "ERROR" messages
are always printed. Shortcut-macros including function, from which the
output was generated, and line number were also added.
Some log messages were updated and other code warnings removed.
2013-04-27 Hannes Weisbach <hannes_weisbach@gmx.net>
* configure.ac: Add libftdi1 library check, remove TYPE_232H DECL check
* Makefile.am: Add @LIBFTDI1@ to avrdude_LDADD
* avrftdi.c: Update from libftdi0 to libftdi1. Use libftdi1's function to
find a device by vid/pid/serial instead of doing it ourself and add/update
error messages. avrftdi_print is changed so that a message is printed when
the verbosity level is greater or equal the message level, to have always-on
messages.
Fix a bug where the RX fifo of the FTDI chip is full, resulting in STALL/NAK
of the ongoing OUT request and subsequently timeout, because an IN request
cannot be issued due to the synchronous part of libftdi. This should fix
#38831 and #38659.
2013-04-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac(AC_CONFIG_HEADERS): Replace the old AM_CONFIG_HEADER
by this; automake 1.13+ barfs.
2013-03-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.conf.in (ATmega2564RFR2, ATmega1284RFR2, ATmega644RFR2):
New devices
2013-01-30 Rene Liebscher <R.Liebscher@gmx.de>
patch #7724 Add TPI support for Bus Pirate using bitbang mode
* buspirate.[ch]: added support for BusPirate Bitbanging
* pgm_type.c: added entry for buspirate_bb
* avrdude.conf.in: added entry for buspirate_bb
2013-01-30 Rene Liebscher <R.Liebscher@gmx.de>
patch #7936 Patch to support BusPirate AVR Extended Commands mode
* buspirate.c: added support for BusPirate AVR Extended Commands mode
* avrdude.1: added doc for nopagedread parameter
* doc/avrdude.texi: added doc for nopagedread parameter
2013-01-30 Rene Liebscher <R.Liebscher@gmx.de>
patch #7723 Bus Pirate “raw-wire” mode which can run down to 5 kHz
* buspirate.c: added raw wire mode
* avrdude.1: added doc for rawfreq parameter
* doc/avrdude.texi: added doc for rawfreq parameter
2013-01-30 Rene Liebscher <R.Liebscher@gmx.de>
bug #37977 Support for Openmoko Debug Board
* avrdude.conf.in: added openmoko entry
2013-01-29 Rene Liebscher <R.Liebscher@gmx.de>
patch #7932 Read USBtiny VID and PID from avrdude.conf if provided.
* avrdude.conf.in: added usbpid, usbvid to usbtiny
* usbtiny.[ch]: use usbpid, usbpid if provided in config file
2013-01-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #38172: avrftdi: Incorrect information in avrdude.conf
* avrdude.conf.in (avrftdi): fix comments about ACBUS vs. ADBUS;
add a comment that the MPSSE signals are fixed by the FTDI
hardware and cannot be changed
2013-01-09 Rene Liebscher <R.Liebscher@gmx.de>
patch #7165 Add support for bitbanging GPIO lines using the Linux sysf GPIO interface
* doc/avrdude.texi,avrdude.1: added doc for linuxgpio
* avrdude.conf.in: added template for linuxgpio programmer
* config_gram.y: pin numbers restricted to [PIN_MIN, PIN_MAX]
* pindefs.h: added PIN_MIN, PIN_MAX, removed unused LED_ON/OFF
* configure.ac: configure option enable-linuxgpio, print of enabled options
* linuxgpio.[ch]: new source for linuxgpio programmer
* Makefile.am: added linuxgpio to sources list
* pgm_type.c: added linuxgpio to programmer types list
2013-01-08 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtagmkI.c (jtagmkI_prmsg): replace a putchar() by putc(...stderr)
* jtagmkII.c (jtagmkII_prmsg): (Dito.)
* jtag3.c (jtag3_prevent, jtag3_prmsg): (Dito.)
2013-01-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* usb_libusb.c (usbdev_open): Downgrade the max transfer size for
the main data endpoints when being forced so by the USB; this can
happen when attaching the JTAGICE3 to a USB 1.1 connection
* jtag3.c (jtag3_initialize): When detecting a downgraded max
transfer size on the JTAGICE3 (presumably, due to being connected
to USB 1.1 only), bail out as its firmware cannot properly handle
this (by now)
2013-01-02 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* ChangeLog: annual ChangeLog rotation time

View File

@ -1,697 +0,0 @@
2014-11-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* ser_win32.c (net_send): Properly declare argument 2 as being a
pointer to const data.
2014-11-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
patch #8380: adds 500k 1M 2M baud to ser_posix.c
* ser_posix.c: Add a hack to allow for arbitrary baud rates on
Linux
2014-11-25 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
patch #8437: [PATCH] Serial-over-ethernet for Win32
* configure.ac: Check for ws2_32 library
* ser_win32.c: Add hooks for forwarding serial data over
TCP connections
* avrdude.1: Drop previous restriction of -P net:
* doc/avrdude.conf: (Dito.)
2014-11-24 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #42908: no external reset at JTAGICE3
* jtag3.c (jtag3_initialize): Retry with external reset applied if
the first sign-on attempt fails.
2014-11-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* main.c: Allow the -B option argument to be suffixed with Hz,
kHz, or MHz, in order to specify a bitclock frequency rather than
period.
* avrdude.1: Document the -B option changes.
* doc/avrdude.texi: (Dito.)
2014-11-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #40870: config nitpick: ATtiny25/45/85 have 1 calibration byte not 2
* avrdude.conf.in (ATtiny25, ATtiny45, ATtiny85): Fix size of
"calibration" memory area
2014-11-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #43137: Writing and reading incorrect pages when using jtagicemkI
* jtagmkI.c (jtagmkI_paged_write, jtagmkI_paged_load): correctly
calculate the size of a partial (non-pagesize) buffer
2014-11-23 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #43078: AVRDUDE crashes after sucessfully reading/writing eeprom
* jtag3.c (jtag3_edbg_recv_frame): Return correct length as
reported in the response packet, rather than full 512 byte which
are always reported by the CMSIS-DAP layer. Miscalculations
based on the wrongly reported length caused heap corruption
elsewhere, so this is presumably also a fix for bug #43078.
2014-11-20 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #41561: AVRDUDE 6.0.1/USBasp doesn't write first bytes of
flash page
* usbasp.c (usbasp_spi_paged_write): Remove USBASP_BLOCKFLAG_LAST.
It is no longer needed, as we always write full pages now in paged
write mode.
2014-11-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #43626: Inconsistent timeouts in stk500v2
* stk500v2.c (stk500v2_recv): Add a reference to the bug report
but don't change anything, lest to break it somehow
2014-11-14 Rene Liebscher <R.Liebscher@gmx.de>
patch #8529 2 more ftdi_syncbb devices
* avrdude.conf.in: added 2 new programmers
2014-11-14 Rene Liebscher <R.Liebscher@gmx.de>
bug #40142 Floating point exception on Ubuntu 10.04
* avr.c: avoid division by zero in report_progress(), eg. when
writing an empty eeprom file were total becomes 0
2014-11-13 Rene Liebscher <R.Liebscher@gmx.de>
patch #8504 buspirate: Also support "cpufreq" extended parameter
in binary mode
* buspirate.c: applied patch + switch off at disable (even when
a reset follows) + some general whitespace/tab cleanup
2014-10-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #37441: lockbits in ATxmega + avrdude = problem
* fileio.c: replace strmcp(..., "lock") by strncmp(..., "lock", 4)
where applicable
* jtag3.c: (Dito.)
* jtagmkII.c: (Dito.)
2014-10-07 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #42267: jtag3isp fails to read lock and fuse bytes directly
after changing lock byte
* stk500v2.c (stk500isp_write_byte): As a workaround for broken
tool firmware, add 10 ms of delay before returning from any
single-byte write operation.
2014-10-06 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* stk500v2.c: Use stk500isp_read_byte/stk500isp_write_byte for
every byte-wide access (rather than JTAGICE3 only). This finally
obsoletes the use of the prehistoric SPI_MULTI command where
AVRDUDE used to assemble all the low-level ISP stuff by itself.
2014-10-06 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #22248: Read efuse error
* avrdude.conf.in (m168, m328, m48, m88, t1634, t26, t261, t461,
t861, t88): In efuse (or hfuse for t26) read operation, turn all
bits in byte 3 from "x" to "o" (output); this is a first step
towards fixing the symptoms mentioned in the bug, by unifying the
behaviour between different AVRs. Not touched are the historic
devices where the fuses are not documented to form a full byte
each (2333, 4433, 4434, 8535, m103, m161, m163).
2014-09-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #43268: usb_drain() call causes LUFA AVR-ISP MKII Code to Fail
* usb_libusb.c (usbdev_drain): Make this a dummy function only.
2014-08-19 Rene Liebscher <R.Liebscher@gmx.de>
patch #7694 Add support for the atmega32m1
* avrdude.conf.in: added ATmega32M1
2014-08-18 Rene Liebscher <R.Liebscher@gmx.de>
patch #8440 Print part id after signature
When printing the part signature also print the part id.
* avrpart.c (locate_part_by_signature): New function.
* libavrdude.h (locate_part_by_signature): New function.
* main.c (main): Use the new function to find the part and print its id.
2014-08-18 Rene Liebscher <R.Liebscher@gmx.de>
patch #8511 Fix reset on FT245R
* ft245r.c: applied patch
2014-08-18 Rene Liebscher <R.Liebscher@gmx.de>
bug #43002 usbasp debug output typo
* usbasp.c: fixed typos
2014-07-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #42662 clang warnings under FreeBSD 10.x
* avrftdi.h: Fix header guard macro name.
* pgm_type.c (programmers_types): Remove duplicate "const".
2014-07-16 Rene Liebscher <R.Liebscher@gmx.de>
bug #42662 clang warnings under FreeBSD 10.x
* avrftdi.c: remove warnings
* buspirate.c: (Dito.)
* dfu.c: (Dito.)
* fileio.c: (Dito.)
* libavrdude.h: (Dito.)
* pickit2.c: (Dito.)
* safemode.c: (Dito.)
* ser_avrdoper.c: (Dito.)
* ser_posix.c: (Dito.)
* ser_win32.c: (Dito.)
* stk500v2.c: (Dito.)
* usb_libusb.c: (Dito.)
* usbasp.c: (Dito.)
* config_gram.y: fix problem when using parent part with usbpid lists
(existing list was extended not overwritten)
2014-07-11 Axel Wachtler <axel@uracoli.de>
* avrftdi.c: rollback to vfprintf, fixed error from -r1305, (patch #8463)
2014-06-23 Rene Liebscher <R.Liebscher@gmx.de>
* linux_ppdev.h: added missing msg level for avrdude_message
in ppi_claim/ppi_release macros
* avrftdi.c: added break at end of default
2014-06-21 Rene Liebscher <R.Liebscher@gmx.de>
patch #8419 fix ftdi_syncbb hang with libftdi 1
* ft245r.c: set pthread cancel type to asynchronous, reorder ftdi_usb_close/deinit
2014-06-17 Rene Liebscher <R.Liebscher@gmx.de>
* avrftdi_private.h: added missing msg level for avrdude_message
in E/E_VOID macros
2014-06-17 Rene Liebscher <R.Liebscher@gmx.de>
Removing exit calls from config parser
* config.h: cleanup, left only internally needed definitions
* config.c: removed exit calls, use yyerror and yywarning
* config_gram.y: (Dito.)
* lexer.l: (Dito.)
* libavrdude.h: removed internal definitions of config parser
* main.c: removed yyerror, it is now in config.c
* jtagmkII.c: added missing free in error case
* pgm.c: replaced exits by returns
* pickit2.c: add missing return
2014-06-13 Axel Wachtler <axel@uracoli.de>
start removing global "verbose" variable, for avrdude library.
* arduino.c: added verbose level in avrdude_message()
* avr910.c: (Dito.)
* avr.c: (Dito.)
* avrdude.h: (Dito.)
* avrftdi.c: (Dito.)
* avrpart.c: (Dito.)
* bitbang.c: (Dito.)
* buspirate.c: (Dito.)
* butterfly.c: (Dito.)
* config.c: (Dito.)
* config_gram.y: (Dito.)
* dfu.c: (Dito.)
* fileio.c: (Dito.)
* flip1.c: (Dito.)
* flip2.c: (Dito.)
* ft245r.c: (Dito.)
* jtag3.c: (Dito.)
* jtagmkI.c: (Dito.)
* jtagmkII.c: (Dito.)
* lexer.l: (Dito.)
* libavrdude.h: (Dito.)
* linuxgpio.c: (Dito.)
* main.c: (Dito.)
* par.c: (Dito.)
* pgm.c: (Dito.)
* pickit2.c: (Dito.)
* pindefs.c: (Dito.)
* ppi.c: (Dito.)
* ppiwin.c: (Dito.)
* safemode.c: (Dito.)
* ser_avrdoper.c: (Dito.)
* serbb_posix.c: (Dito.)
* serbb_win32.c: (Dito.)
* ser_posix.c: (Dito.)
* ser_win32.c: (Dito.)
* stk500.c: (Dito.)
* stk500generic.c: (Dito.)
* stk500v2.c: (Dito.)
* term.c: (Dito.)
* update.c: (Dito.)
* usbasp.c: (Dito.)
* usb_libusb.c: (Dito.)
* usbtiny.c: (Dito.)
* wiring.c: (Dito.)
2014-06-11 Rene Liebscher <R.Liebscher@gmx.de>
bug #42516 spelling-error-in-binary
* stk500v2.c, avrftdi.c, usbasp.c: fixed spelling errors
2014-06-01 Rene Liebscher <R.Liebscher@gmx.de>
bug #42337 avrdude.conf updates for UM232H/CM232H
* avrdude.conf.in: fixed entries as proposed
2014-05-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #41854: avrdude 6.1 does not compile on systems without libUSB
Submitted by Didrik Madheden:
* flip1.c: Provide dummy functions for the #ifndef HAVE_LIBUSB case
* flip2.c: (Dito.)
2014-05-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* libavrdude.h: Join the former "public" header files (avr.h avrpart.h pindefs.h
serial.h fileio.h safemode.h update.h pgm_type.h config.h confwin.h lists.h) into
a single header that can be included by anyone wanting to link against the
library
* avr.h: Remove file.
* avrpart.h: (Dito.)
* pindefs.h: (Dito.)
* serial.h: (Dito.)
* fileio.h: (Dito.)
* safemode.h: (Dito.)
* update.h: (Dito.)
* pgm.h: (Dito.)
* pgm_type.h: (Dito.)
* config.h: (Dito.)
* confwin.h: (Dito.)
* lists.h: (Dito.)
* Makefile.am: Adapt for new include file constellation; install shared lib
* configure.ac: Bump version date
* arduino.c: #include <libavrdude.h> rather than a bunch of different headers
* avr910.c: (Dito.)
* avr910.h: (Dito.)
* avr.c: (Dito.)
* avrftdi.c: (Dito.)
* avrftdi_private.h: (Dito.)
* avrftdi_tpi.c: (Dito.)
* avrftdi_tpi.h: (Dito.)
* avr.h: (Dito.)
* avrpart.c: (Dito.)
* avrpart.h: (Dito.)
* bitbang.c: (Dito.)
* buspirate.c: (Dito.)
* butterfly.c: (Dito.)
* config.c: (Dito.)
* config_gram.y: (Dito.)
* config.h: (Dito.)
* confwin.c: (Dito.)
* confwin.h: (Dito.)
* dfu.c: (Dito.)
* fileio.c: (Dito.)
* fileio.h: (Dito.)
* flip1.c: (Dito.)
* flip1.h: (Dito.)
* flip2.c: (Dito.)
* flip2.h: (Dito.)
* ft245r.c: (Dito.)
* ft245r.h: (Dito.)
* jtag3.c: (Dito.)
* jtagmkI.c: (Dito.)
* jtagmkII.c: (Dito.)
* lexer.l: (Dito.)
* libavrdude.h: (Dito.)
* linuxgpio.c: (Dito.)
* lists.c: (Dito.)
* lists.h: (Dito.)
* main.c: (Dito.)
* par.c: (Dito.)
* pgm.c: (Dito.)
* pgm_type.c: (Dito.)
* pgm_type.h: (Dito.)
* pickit2.c: (Dito.)
* pickit2.h: (Dito.)
* pindefs.c: (Dito.)
* pindefs.h: (Dito.)
* ppi.c: (Dito.)
* ppiwin.c: (Dito.)
* safemode.c: (Dito.)
* safemode.h: (Dito.)
* ser_avrdoper.c: (Dito.)
* serbb_posix.c: (Dito.)
* serbb_win32.c: (Dito.)
* serial.h: (Dito.)
* ser_posix.c: (Dito.)
* ser_win32.c: (Dito.)
* stk500.c: (Dito.)
* stk500generic.c: (Dito.)
* stk500v2.c: (Dito.)
* stk500v2_private.h: (Dito.)
* term.c: (Dito.)
* term.h: (Dito.)
* update.c: (Dito.)
* update.h: (Dito.)
* usbasp.c: (Dito.)
* usbasp.h: (Dito.)
* usb_libusb.c: (Dito.)
* usbtiny.c: (Dito.)
* usbtiny.h: (Dito.)
* wiring.c: (Dito.)
2014-05-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* main.c: Cleanup unused include files.
2014-05-19 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* linux_ppdev.h: Caught two more instances of exit()
* configure.ac: Add AC_CONFIG_MACRO_DIR as suggested by libtoolize
* Makefile.am: add -I m4 to ACLOCAL_AMFLAGS as suggested by libtoolize
2014-05-16 Axel Wachtler <axel@uracoli.de>
* arduino.c: Replacing all occurences of fprintf(stderr,...) with avrdude_message(...)
in potential library functions.
* avr910.c: (Dito.)
* avr.c: (Dito.)
* avrdude.h: (Dito.)
* avrftdi.c: (Dito.)
* avrftdi_private.h: (Dito.)
* avrpart.c: (Dito.)
* bitbang.c: (Dito.)
* buspirate.c: (Dito.)
* butterfly.c: (Dito.)
* config.c: (Dito.)
* config_gram.y: (Dito.)
* dfu.c: (Dito.)
* fileio.c: (Dito.)
* flip1.c: (Dito.)
* flip2.c: (Dito.)
* ft245r.c: (Dito.)
* jtag3.c: (Dito.)
* jtagmkI.c: (Dito.)
* jtagmkII.c: (Dito.)
* lexer.l: (Dito.)
* linuxgpio.c: (Dito.)
* linux_ppdev.h: (Dito.)
* main.c: (Dito.)
* par.c: (Dito.)
* pgm.c: (Dito.)
* pickit2.c: (Dito.)
* pindefs.c: (Dito.)
* ppi.c: (Dito.)
* ppiwin.c: (Dito.)
* safemode.c: (Dito.)
* ser_avrdoper.c: (Dito.)
* serbb_posix.c: (Dito.)
* serbb_win32.c: (Dito.)
* ser_posix.c: (Dito.)
* ser_win32.c: (Dito.)
* stk500.c: (Dito.)
* stk500generic.c: (Dito.)
* stk500v2.c: (Dito.)
* term.c: (Dito.)
* update.c: (Dito.)
* usbasp.c: (Dito.)
* usb_libusb.c: (Dito.)
* usbtiny.c: (Dito.)
* wiring.c: (Dito.)
2014-05-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Bump version, add libtool hooks
* Makefile.am: First attempt to define building a shared library
(not to be installed by now)
2014-05-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* dfu.c (dfu_open, dfu_init): Fix signature of the dummy functions
(in the !HAVE_LIBUSB case) to match prototypes.
2014-05-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avr910.c: Replace all occurences of exit() in potential library
functions by appropriate return values
* avrftdi.c: (Dito.)
* bitbang.c: (Dito.)
* bitbang.h: (Dito.)
* buspirate.c: (Dito.)
* butterfly.c: (Dito.)
* config.c: (Dito.)
* flip2.c: (Dito.)
* ft245r.c: (Dito.)
* jtagmkI.c: (Dito.)
* jtagmkII.c: (Dito.)
* linuxgpio.c: (Dito.)
* main.c: (Dito.)
* par.c: (Dito.)
* pgm.c: (Dito.)
* pickit2.c: (Dito.)
* pindefs.c: (Dito.)
* pindefs.h: (Dito.)
* ser_avrdoper.c: (Dito.)
* ser_posix.c: (Dito.)
* ser_win32.c: (Dito.)
* serbb_posix.c: (Dito.)
* serbb_win32.c: (Dito.)
* stk500.c: (Dito.)
* stk500v2.c: (Dito.)
2014-05-07 Rene Liebscher <R.Liebscher@gmx.de>
bug #42310: New part description for AT90PWM216
* avrdude.conf.in: added pwm216 entry
2014-05-07 Rene Liebscher <R.Liebscher@gmx.de>
bug #42158: Linux GPIO - Source Typo
* pindefs.h: fixed typo
2014-04-14 Rene Liebscher <R.Liebscher@gmx.de>
bug #42056: double free or corruption triggered at exit
* pgm.c: copy usbpid list in pgm_dup
2014-04-05 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.1: Remove the note that users might edit the system-wide
config file. This file will be overwritten by the next
installation, so it's not a good idea to manually modify it.
Using the -C +file option is a much better way for user
modifications.
* doc/avrdude.texi: (Dito.)
* avrdude.conf.in: Add a warning to not modify the file manually.
2014-03-13 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac (AC_INIT): Bump version for post-6.1.
2014-03-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac (AC_INIT): Bump version to 6.1.
2014-03-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* pgm.c (pgm_free): Cleanup police: destroy the p->usbpid
list when freeing the programmer struct.
2014-03-12 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #40782: Verify errors for object size > 16 k on x32e5 due
to typo in avrdude.conf
* avrdude.conf.in (ATmega8E5, ATmega32E5): fix boot location
2014-02-28 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.conf.in (atmelice, atmelice_pdi, atmelice_dw, atmelice_isp):
New entries.
* avrdude.1: Document the Atmel-ICE addition.
* doc/avrdude.texi: (Dito.)
* usbdevs.c (USB_DEVICE_ATMEL_ICE): New entry.
2014-02-28 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* main.c: Bump copyright year.
2014-02-28 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtag3.c (jtag3_recv): avoid memmov'ing more data than available
2014-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.1: Documentation update for EDBG.
* doc/avrdude.texi: (Dito.)
2014-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtag3.c: For EDBG protocol, always use 512-byte block I/O. The
lower layers will split this according to the EP's maxsize. This
makes it work over USB 1.1 connections (albeit very slowly, due to
the interrupt transfers used).
2014-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* config_gram.y: Turn the usbpid parameter of the programmer into
a list of PIDs. Make the JTAGICE3 programmer handle a list of
PIDs, by trying each of them in sequence. Use a single, central
jtag3_open_common() function to handle the common code of all
jtag3_open_* functions. Centralize all USB VID/PID definitions in
usbdevs.h.
* flip1.c: (Dito.)
* ft245r.c: (Dito.)
* stk500v2.c: (Dito.)
* jtag3.c: (Dito.)
* jtag3.h: (Dito.)
* flip2.c: (Dito.)
* usbdevs.h: (Dito.)
* pgm.c: (Dito.)
* serial.h: (Dito.)
* pgm.h: (Dito.)
* usbtiny.c: (Dito.)
* usbasp.c: (Dito.)
* avrftdi.c: (Dito.)
* usbtiny.h: (Dito.)
* avrdude.conf.in: (Dito.)
* usbasp.h: (Dito.)
* usb_libusb.c: (Dito.)
2014-02-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* usb_libusb.c (usbdev_open): Replace all calls to exit(1) by
return -1
2014-02-26 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* jtag3_private.h: Add EDBG/CMSIS-DAP specific constants.
* jtag3.c: Add EDBG/CMSIS-DAP protocol implementation.
* serial.h: (Dito.)
* usbdevs.h: (Dito.)
* usb_libusb.c: (Dito.)
* configure.ac: (Dito.)
* avrdude.conf.in: Add JTAGICE3 and XplainedPro entries using
EDBG.
* configure.ac: Bump version date.
2014-02-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* usb_libusb.c (usbdev_recv_frame): Fix a bug where a new recv
request was issued even though all desired data had aldready
been received.
2014-02-21 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* serial.h: Change the second parameter of the ser_open method
from "baud" into a "union pinfo", so the USB parameters can be
passed without hacks.
* arduino.c: (Dito.)
* avr910.c: (Dito.)
* buspirate.c: (Dito.)
* butterfly.c: (Dito.)
* jtag3.c: (Dito.)
* jtagmkI.c: (Dito.)
* jtagmkII.c: (Dito.)
* ser_avrdoper.c: (Dito.)
* ser_posix.c: (Dito.)
* ser_win32.c: (Dito.)
* stk500.c: (Dito.)
* stk500v2.c: (Dito.)
* usb_libusb.c: (Dito.)
* wiring.c: (Dito.)
2014-01-30 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
[bug #41402] dfu.c missing include <stdint.h>
* dfu.c: include <stdint.h> where uint16_t is defined
2014-01-28 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.conf.in (ATmega256RFR2 et al.): Fix EEPROM size.
2014-01-27 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
[bug #41357] OS X: Avrdude messes with the usb stack?
* usb_libusb.c (usbdev_close): Only issue the usb_reset() for
Linux systems, as these are the only ones that seem to require
it under some circumstances.
2014-01-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac (libelf): check against elf_getshdrstrndx() rather
than just elf_begin() only, so it is clear we found a sufficiently
recent libelf to work with.
2014-01-22 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Contributed by Alan Horstmann:
bug #40897: AT Mega2560 not correctly programmed with stk500(v1) ISP (solution patch)
* stk500.c: Implement extended address byte handling.
* avrdude.conf.in (ATmega2560): enable stk500_devcode so
STK500v1 protocol actually starts at all.
2014-01-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* flip1.c: Implement the meat of FLIP version 1 protocol.
* avrdude.1: Document the new protocol.
* doc/avrdude.texi: (Dito.)
2014-01-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* flip2.c (flip2_page_erase): Remove unimplemented function.
* dfu.h: Correctly conditionalize <usb.h> vs. <lusb0_usb.h>;
add adjustable timeout (struct dfu_dev); add dfu_abort()
* dfu.c (dfu_abort): New function; implement adjustable timeout.
2014-01-17 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac (libhid): Turn from AC_TRY_RUN into
AC_TRY_COMPILE, so it also works for cross-compilation
setups.
2014-01-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* dfu.c (dfu_init): Move the descriptor checks up into the
FLIP protocol implementation.
* flip2.c (flip2_initialize): (Dito.)
* flip1.c (flip1_initialize): (Dito.)
2014-01-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* flip2.c: Rename from flip.c
* flip2.h: Rename from flip.h
* Makefile.am: Reflect the renaming.
* dfu.c: Update information how to get GPL.
* dfu.h: (Dito.)
2014-01-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* flip.c (flip2_initialize): Check user is running on an Xmega
device.
2014-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* flip.c: Added some verbose-level messages (-vv)
* dfu.c: Added some verbose-level messages (-vvvv)
2014-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Kirill Levchenko:
patch #7896: DFU FLIPv2 programming support
* pgm_type.c: Add the flip2 programmer type.
* config_gram.y: Allow for the usbid keyword in a device definition.
* avrdude.conf.in: Add usbpid values to those Xmega devices where
applicable.
* avrpart.h: Add usbpid device field.
* dfu.c: (New file.)
* dfu.h: (New file.)
* flip.c: (New file.)
* flip.h: (New file.)
* Makefile.am: Add new files.
* doc/avrdude.texi: Document the changes.
* avrdude.1: (Dito.)
2014-01-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* ChangeLog-2013: Annual changelog rotation.

View File

@ -1,54 +0,0 @@
2015-12-15 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* avrdude.1 (-C): Do not suggest users might change the
default config file. It will be overwritten by updates.
2015-12-09 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #46610: Floating point exception (core dumped) arch linux rpi2
bug #46483: version 6.2. ser_open(): can't set attributes for device
* ser_posix.c: Back out change from patch #8380
2015-11-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Bump for post-release 6.2.
2015-11-16 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* configure.ac: Released version 6.2.
2015-10-31 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Martino Facchin:
bug #45727: Wrong atmega8u2 flash parameters
* avrdude.conf.in (ATmega8U2): correct page and block size
2015-10-31 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Pasquale Cocchini:
bug #46020: Add TIAO TUMPA to the conf file.
* avrdude.conf.in (tumpa): New entry.
2015-10-31 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Submitted by Pasquale Cocchini:
bug #46021: Please add read in the memory lock section of ATtiny85
* avrdude.conf.in (ATtiny25/45/85): add read pattern for lock bits
2015-10-31 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* Makefile.am (libavrdude_a_SOURCES): reflect recent changes
(pgm.h is gone, config.h is new).
2015-04-09 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
bug #44717: avrdude creates empty flash dump
* update.c (do_op): When about to write an empty flash dump file,
warn about this to avoid surprises.
* avrdude.1: Document the truncation of trailing 0xFF bytes for
flash memory areas.
* doc/avrdude.texi: (Dito.)
2015-04-09 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
Annual ChangeLog rotation.

4
INSTALL Normal file
View File

@ -0,0 +1,4 @@
Installation Instructions
*************************
See README.md.

642
NEWS
View File

@ -2,9 +2,647 @@ $Id$
Approximate change log for AVRDUDE by version.
(For more detailed changes, see the ChangeLog file.)
(For detailed changes, see the version control system logs.)
----------------------------------------------------------------------
Changes since version 7.1:
* Major changes compared to the previous version:
* New devices supported: none
* New programmers supported:
* Issues fixed:
* Pull requests:
* Internals:
Changes in version 7.1:
* Major changes compared to the previous version:
- Provide a new programmer -c urclock for bootloader urprotocol
+ Urclock fully supports vector bootloaders at no extra code size
+ Uprotocol
https://github.com/stefanrueger/urboot/blob/main/urprotocol.md
allows programming much shorter bootloaders with more features:
* Exports a pgm_write_page(sram, progmem) function that the
application can call at FLASHEND-4+1 to use flash as storage
* Supports EEPROM reads/writes
* Protects itself from overwriting
* Vector bootloaders: can protect the reset vector
* Offers Chip Erase function (quicker than uploading 0xff's)
+ Urclock when compiled with libreadline supports bootloaders in
terminal mode (preventing them from WDT timeout)
+ The -c urclock programmer provides a metadata interface that
allows unused flash to be used as storage
+ avrdude -c urclock is backward compatible with avrdude -c arduino
- Add TPI support for Microchip tools #1205
- Add C-strings, C characters and double to terminal write
- Provide write flash in the terminal (using a cache)
- Provide page erase in the terminal as pgerase
- Add support for NetBSD and OpenBSD to build.sh
* New devices supported: none
* New programmers supported:
- urclock = Urclock programmer for bootloaders using urprotocol
- xplainedmini_tpi = Atmel AVR XplainedMini in TPI mode
- xplainedpro_pdi = Atmel AVR XplainedPro in PDI mode
- atmelice_tpi = Atmel-ICE (ARM/AVR) in TPI mode
- powerdebugger_tpi = Atmel PowerDebugger (ARM/AVR) in TPI mode
- pickit4 = MPLAB(R) PICkit 4 in JTAG mode
- pickit4_tpi = MPLAB(R) PICkit 4 in TPI mode
- snap = MPLAB(R) SNAP in JTAG mode
- snap_tpi = MPLAB(R) SNAP in TPI mode
- arduino_gemma = Arduino Gemma bootloader disguised as USBtiny
- adafruit_gemma = Adafruit Trinket Gemma bootloader disguised as USBtiny
- digilent-hs2 = Digilient JTAG HS2 (MPSSE)
- tigard = Tigard interface board
* Issues fixed:
- Fix micronucleus bootloader to check for unresponsive USB
devices #945
- Fix src/CMakeLists.txt to honor CMAKE_INSTALL_LIBDIR #972
- [bug #43898] atmega644p remains stopped after JTAG
transaction #366
- Wrong timings for ATmega328PB and other parts in avrdude.conf
#976
- FT232R based programmer ATmega2560 Flash Reading Problem #995
also #474
- Enable avrdude to send full input file incl trailing 0xff
#936
- Portname default for linuxspi programmer not recognized #926
- JTAG1 unable to write fuse and lock bits #443
- Unknown option '-s' on command line (legacy) #1032
- STK500/arduino/xbee programmers fail EEPROM r/w for some
parts #967 also #421
- Design issue: jtag2updi is hardcoded to fail for parts with
has_pdi = yes #1037
- Option parse error: after -U flash:w:program_to_upload.hex,
subsequent -V ignored #441
- Automatic verification is designed to fail for stdin #1044
- Display correct number of bytes when input file has holes
#1005
- Cmake installs avrdude.1 in the wrong place on Linux #1064
- avr910 -qq prompt too verbose #1081
- avrftdi.c: paged write can fail at addr 0 #1073
- Permission denied accessing /sys/class/gpio/gpioX/direction
would leave pin exported #472 also #372
- Raspberry Pi sysfs bug workaround for linuxgpio driver #386
- Fix CMake avrdude.conf dependency to avrdude.conf.in #1035
- CMake infrastructure does not handle documentation #947
- New feature: ability to reset FLIPv2 targets #733
- Fix Extended address not sent with avr109/butterfly #360
and #454
- Enable AVR JTAG ICE mkI program EEPROM in terminal mode
#1054
- Make flash writes work in terminal mode #1020
- Add support for XMEGA specific AVR109 protocol extensions
used by XBoot #200
- jtag2updi can not write EEPROM in terminal mode #1116
- Make UPDI programmers less verbose during initialization
#1084
- Quell mode isn't handled systematically #1114
- Mixing the progress bar with warning messages #1136
- Inconsistent terminal output re stdout and stderr #1130
- Supress the warning for Microchip SNAP #1135
- ATtiny85 communication problem with default bitclock #1133
- [Regression] Optiboot for "modern AVRs" no longer works #1120
- Cannot access EEPROM on some bootloader/part combos #970
- -U writes sometimes more bytes to flash/memory than input
file has #1050
- debugWire using dragon_dw and jtag2dw not working #1168
- && echo OK does not work after -c urclock #1192
- Serial drain timeout needs calibrating for -c urclock #1193
- avrdude -U file.elf misses second and following suitable
sections in elf segements #1204
- Avrdude on macOS has problems with libedit #1173
- urclock support for optiboot_x and optiboot_dx #1200
- Terminal does not continue read/dump correctly #1201
- JTAG3 programmer info not available in ISP mode #1212
- Extra avrdude> prompt with -qqt in terminal mode #1214
- PICkit4 and SNAP serial numbers not read by Avrdude #1038
- Optiboot EEPROM support cannot be detected by avrdude #1224
- megaAVR JTAG programming doesn't work for SNAP and PICkit4
#1052
- urclock/FTDI communication issues #1245
- stk500v2.c dumps core on open #1254
- linuxgpio cannot use pin 0 #1228
- Remove non-working butterfly page erase function
- linuxgpio and linuxspi: input files with unset bytes don't program
correctly #1263 #455
* Pull requests:
- Fix .Dd macro in manpage #949
- fix M1 homebrew path #950
- CMake Enhancements #962
- Reduce programmer desc string length in avrdude.conf
to < 80 characters #1000
- Dragon JTAG fix #979
- adding support for all Linux baud rates v.2 #993
- Replace internal knowledge in jtag3.c by a public API #996
- JTAG3 UPDI EEPROM fix #1013
- Treat x bits in .conf SPI commands as 0 #943
- Fix avrftdi support for ATmega2560 et al #998
- Fix avrdude.conf timings for ATmega328PB and other parts #1001
- Fix PICKit2 ATmega2560 flash paged flash read #1023
- Fix ft245r paged read for ATmega2560 et al #1018
- Add option -A that supresses trailing 0xff optimisation
and automatically do so for -c arduino #936
- Fix linuxspi default port #933
- Add support for high-voltage UPDI im jtag3.c #1015
- Fix terminal write edge cases; add one read mode; add quell
command #1025
- Fix usbtiny read for parts with more than 64 kB flash #1029
- CMakeLists.txt: fix build without C++ #1016
- Provide file format I: Intel HEX with comments that ignores
checksum errors #1030
- Enable writing fuse and lock bits for AVR-JTAGICE #1031
- Ignore -s flag as safemode is no longer supported #1033
- Developer options to describe parts and
extend avrdude.conf syntax #1040
- Deprecate original STK500 v1 protocol in favour of optiboot
and Arduino as ISP #1046
- Add jtagmkii_updi programmer option #1048
- Enable stdin verification, display correct number of bytes
written/verified, check -U memory names against spelling
errors and exit but skip -U memory updates with known
memories that the part lacks #1053
- Handle invalid -U file format specifiers for input #1042
- Implement a dry run for -U updates before opening the
programmer #1056
- Implement -c <wildcard>/dev_options for printing avrdude.conf
show comments with -p*/s or -c*/s; Reduce -p */r raw output;
specifying the full memory name now always works; stop
listing programmers where id starts with dot #1059
- Fix logfile short option in man-page; fix install dir for man
page #1063
- Use const for programmer functions where useful; add second
argument for programmer enable interface function
void (*enable)(PROGRAMMER *pgm, const AVRPART *p) #1078
- Make avr910 programmer initialize() less verbose #1083
- Fix flash paged write for avrftdi.c #1074
- Fix 4 parts wrt to their interfaces in avrdude.conf; rewrite
avrdude.conf.in file from avrdude -c* -p* output; reformat
conditional programmers in avrdude.conf.in using -c*; fix
reset=dedicated|io; entries #1086
- Add prog_modes, a bitwise or of prgramming modes, to part and
programmer definitions; add to part definition
+ mcuid, a unique id in 0..2039 for 8-bit AVR
+ n_interrupts, the number of interrupts
+ n_page_erase, if set, the # of pages erased for NVM erase
implement a simple calculator in config_gram.y for numeric
values; set part prog_modes, mcuid, n_interrupts and
n_page_erase in avrdude.conf.in; add external intelligence
about AVRs avrintel.[ch] to the project and warn during
parsing if mcuid is incompatible with it #1091
- Fix permission denied error in linuxgpio programmer #917
- Add a programmer arduino_gemma for the Arduino Gemma
bootloader and another one, adafruit_gemma, for the Adafruit
Trinket Gemma bootloader in avrdude.conf; #1093
- Add digilent-hs2 programmer in avrdude.conf #1094
- Fix dependency chain between avrdude.conf.in and
avrdude.conf #1095
- Build docs with CMake #1096
- New feature so user can print all compatible parts for a
programmer using -p\? -c programmer and vice versa #1099
- Add extended parameter disable_no_cs for linuxspi programmer
#1100
- Fix avr109 extended address #1101
- Add support for Flip 2 reset on exit #1102
- Support for Power Debugger analog readings in terminal mode
#1105
- Provide cached byte-wise read/write API #1106
- AVR109: support for prodsig read and usersig read/write #1108
- Add missing AVR variants the original JTAG ICE supports #1109
- Improve help message in terminal and provide new command
pgerase #1113
- Fix pointer truncation for Windows x64 #1119
- Fix jtag3_page_erase for targets with UPDI #1112
- Fix writing of last word on DWORD TPI parts #1115
- Use byte-wise read/write when page size is 1 in terminal
cache #1121
- Suppress Teensy USB communication error message on reboot #1122
- Fix UPDI erase when target is locked #1125
- Review and overhaul AVRDUDE's messaging system #1126
- Look for ~/.config/avrdude/avrdude.rc then ~/.avrduderc #1131
- Revamp terminal output (progress bar, callback and
stdout/stderr) #1132
- Detect PICkit4 and SNAP in PIC mode #1138
- Mention -B in the error message #1139
- Support optiboot, optiboot_dx and optiboot_x bootloaders for
-c arduino #1140
- Always use paged access for programmers that serve
bootloaders #1141
- Add libreadline-dev for Linux github action build #1146
- Implementation of SerialUPDI page erase operation #1151
- Fix Type 2 HV UPDI #1164
- Rewrite authors/copyrights #1182
- Add fallback for EM_AVR #1181
- Add a workaround for issue 1173 #1185
- Add xplainedpro_pdi programmer #1147
- Provide Urclock programmer #1171
- Fix JTAGICE mkII (not initializing after chip erase) #1172
- Ensure default_programmer from config files is used #1174
- Make terminal write's automatic number width less surprising
#1175
- Print HAVE_LIBREADLINE status when making the project #1184
- Pad pages with input file contents before avr_write() #1188
- Deprecate mosi/miso in favour of sdo/sdi #1189
- Provide bootloader-hash tool #1190
- Fix JTAGICE mkII parameters for parts with bootloaders #1191
- Fix shell exit value when chip erase is delayed #1194
- Support autobaud for urclock programmer #1198
- Fix userrow size and page_size for ATtiny3216/7 #1199
- Added TPI support for Microchip tools #1205
- Fix reading of .elf files #1206
- Use libedit only in interactive mode #1207
- Add urclock support for bootloaders in low flash #1208
- Terminal read improvements #1209
- Print meaningful error when a too slow ISP clock is detected #1216
- Check alternative USB PID for PICkit4/SNAP in PIC mode #1219
- Remove extraneous avrdude> prompt at end of terminal session #1220
- Read programmer serial number from libusb or hidusb #1223
- Hint at -xeepromrw option in EEPROM error messages #1226
- Add JTAG support for PICkit4 and Snap. #1233
- Mention developer options in documentation and Usage() #1234
- Print expected signature on signature mismatch #1237
- To work around Issue #1107 #1240
- Update build.sh for NetBSD #1241
- Add FT2232H support for Windows, Tigard programmer #1242
- Modify recv timeouts to accommodate urclock sync with ftdi
#1246
- CMake updates #1243
- Silence conf path detection debug output #1247
- Make WIN32 ser_recv() fail on time-out #1248
- Guard urclock_getsync() against initial spurious input #1251
- Change definition of NO_PIN to 1+PIN_MAX #1231
- Fix partial matches for locate_mem() and do_cmd() #1256
- Add abbreviated q command in terminal
- Move static usbsn into serdev struct and remove serno #1258
- Clean up avrdude.conf.in fixing a couple of bugs #1260
- Add readline library replacement for MSVC #1264
- Ensure full words are loaded for ISP programming #1265
- Silence page erase in cache code #1266
- Update to latest MSVC fork of hidapi to include bug fixes
#1269
* Internals:
- Implement -c <wildcard>/dev_opts and -p <wildcard>/dev_opts
for printing avrdude.conf programmer and part entries
- Added shorter alternative ISP commands for avrdude.conf
- Reformatted avrdude.conf to canonical form
- Reviewed API for prgrammer functions: use const for
programmer functions where useful; add second argument for
void (*enable)(PROGRAMMER *pgm, const AVRPART *p) #1078
- Reviewed messaging system making warnings and errors explicit
and treat them systematically
Changes in version 7.0:
* Major changes compared to the previous version:
- Completely revamped Windows support, including MSVC
- Started to add CMake (by now, parallel with autoconf/automake)
- New-architecture devices (AVR8X mega and tiny) can access all
fuses, and memory display shows meaningful alias names
- The "safemode" feature has been removed. The major class of
programmers it has been designed for (lowlevel bitbang
programmers on parallel or serial ports) virtually doesn't exist
anymore, and the fuse combination that was covered by it do not
match the fuses of modern AVR devices anyway.
- avrdude.conf is now being looked up in the location of the
executable file first, before considering the configured default
location; this eases a "portable use" where the entire suite is
not installed into its configured default location. (Basically
only relevant for unixoid systems; on Windows, this search order
has been used for many years already.)
* New devices supported:
- ATtiny828, ATtiny87, ATtiny167, ATtiny48, ATtiny102, ATtiny104
- LGT8F88P, LGT8F168P, LGT8F328P (fixed names of these parts)
- ATmeg164A, ATmega169A, ATmega169P, ATmega169PA, ATmega329A,
ATmega329PA, ATmega3290, ATmega3290A, ATmega3290PA, ATmega649A,
ATmega649P, ATmega6490A, ATmega6490P, ATmega165, ATmega165A,
ATmega165P, ATmega165PA, ATmega325A, ATmega325P, ATmega325PA,
ATmega645A, ATmega645P, ATmega3250A, ATmega3250P, ATmega3250PA,
ATmega6450A, ATmega6450P
- ATmega48A/48PA/88A/88PA/168A/168PA, ATmega164A/644A/644PA,
ATmega16A/32A/64A/128A, ATtiny13A, ATtiny24A/44A/84A,
ATtiny261A/461A/861A, ATtiny828R, ATtiny2313A, ATtiny1634R
- ATtiny3224, ATtiny3226 and ATtiny3227
- AVR16DD14/20/28/32, AVR32DD14/20/28/32 and AVR64DD14/20/28/32
- AVR8EA28/32, AVR16EA28/32/48, AVR32EA28/32/48 and AVR64EA28/32/64
- ATmega16U4
* New programmers supported:
- SerialUPDI (UPDI devices connected to serial port with few
passive parts)
- PicKit4 / SNAP (now also in ISP and PDI mode)
- Teensy bootloader (PR #802)
- Micronucleus bootloader (PR #786)
- ft232h (generic variant, PR #842)
- Kristech KT-LINK FT2232H interface with IO switching and voltage
buffers (PR #930)
* Issues fixed:
- Curiosity Nano and terminal mode #790 (only the actual bugs
reported)
- CMake doesn't correctly handle conditionals in avrdude.conf.in
#776
- CMake doesn't detect FreeBSD's libusb-1.0 (compatibility) #775
- CMake doesn't correctly handle conditionals in avrdude.conf.in
#776
- CMake: Recognize more than just bison #785
- [bug #26007] ATTiny167 not supported #150
- [bug #47375] ATtiny102/104 descriptions missing in configuration
file #409
- No error message when connecting to a not-connected AVRISP mkII
programmer #813
- [bug #53180] missing programmer or bad -P option argument
doesn't result in error message #471
- ATmega328P reported as lgt8fx328p #812
- [bug #48004] Dead link for linuxgpio in avrdude description #419
- Segmentation fault when writing ATtiny104 fuse #823
- USBasp returns ERANGE for unknown error #848
- Compiler warnings #856
- Can't get serialupdi to work #874
- Rework HID support for Windows #881
- List of signing keys? #884
- Pickit4 UPDI is writing at offset 0x4000 into flash instead of 0x0000. #892
- SerialUPDI programmer can't write to usersig/userrow in terminal mode #889
- Signature read command for ATmega165* was wrong (no-id)
- Cannot use non-standard baud rates for uploading on MacOS #771
- Wrong values in avrdude.conf #897
- AVR-Eclipse plugin broken by missing -u commandline option #890
- Timeout passed to hid_read_timeout() is too short for instances
where the EDBG AVRISP 'Enter Programming Mode' command fails #900
- Terminal write mode doesn't support string input (yet) #913
- Terminal mode: memory fill with strings may cause Avrdude to crash. #922
- Some parts have wrong or missing ISP commands #915
- Incorrect -b conversion for linuxspi programmer #927
- ATtiny43U calibration memory size #921
* Pull requests:
- GitHub Migration #765
- Update toplevel files. #767
- GitHub Migration part 2 #768
- Remove 'windows' folder with giveio.sys driver #769
- SerialUPDI implementation - release candidate 1 #772
- Fix typos #777
- Fix memory leaks #779
- As promised, documentation for SerialUPDI programmer #782
- Improve CMake project #783
- Fix avr_read() for page reads #784
- Serialupdi manpage #787
- Add PicKit4 and SNAP programmers #791
- Use yacc/byacc as an alternative to bison, closes #785 #793
- Derive program version string from last commit #794
- Find 'avrdude.conf' based on absolute path to executable #780
- buspirate: fix -Wtautological-constant-out-of-range-compare #796
- avrftdi: don't use the deprecated ftdi_usb_purge_buffers routine #792
- Ignore ctags index file #804
- term: fix memleakOnRealloc #806
- Add missing ATtiny targets to avrdude.conf #803
- Add support for Teensy bootloader #802
- Conffile clean up #801
- Fix typos all over the code #807
- Add MSVC builds and better WinUSB/FTDI support #798
- buspirate: fix invalidScanfArgType_int warning #808
- Ignore ac_cfg.h.in~ #810
- Notify open failure #814
- Print expected part #817
- pindefs: conform to the function declaration #818
- Add support for Micronucleus bootloader #786
- Remove ac_cfg.h from libavrdude.h #820
- CMake: enable dynamic-link library for libavrdude #826
- Fix for TPI fuse write (issue #823) #828
- Add missing ATmega__5 and ATmega__9 targets to avrdude.conf #809
- Add missing ATmega and ATtiny targets #832
- Added missing RTS/DTR management feature to serialupdi
programmer #811
- Add missing tinyAVR-2, AVR DD and AVR EA targets #836
- Add a new programmer ft232h #842
- Reduce verbosity when setting fuses and uploading programs #845
- jtagmkii: Reduce the number of sync attempts to 10 + print
number of attempts #844
- CMake: add initial support for installing lib and include files #829
- Add SPI support to USBtiny #816
- Add more memory sections to read from #815
- Add a build script for Unix-like systems #849
- Fix receive buffer implementation in ftdi_syncbb programmer #843
- CMake: split configuration in two files #852
- Set number of connection retry attempts for Arduino/STK500
programmer #854
- Fix libusb-1.0 error strings #850
- Assign proper type to msg[] in errstr() #857
- Fix Arduino retry attempts #855
- CMake: use CMAKE_CURRENT_BINARY_DIR to locate avrdude.conf #858
- Remove the "safemode" feature. #859
- Add support for reading from more memory sections #863
- Alias keyword #868
- Add fuse name aliases to avrdude.conf + tweak update.c #869
- Print JTAG3 clocks after configuration + string formatting #853
- Tweak programmer info formatting strings #872
- Remove libhid support in ser_avrdoper.c in favor of libhidapi #882
- Reduce jtag3 output verbosity #877
- Fix Curiosity Nano target voltage #878
- Smallest possible fix for PL2303HX #885
- Add missing USBtiny derived programmers #873
- Cleanup of POSIX serial init code #886
- Avrdude terminal write improvements #880
- Add userrow and usersig aliases #888
- For UPDI devices do not add offset when accessing flash. #895
- Support both userrow and usersig names #893
- Fix ugly terminal write bug #896
- Improve terminal read functionality #894
- Macos nonstandard baudrates #898
- Fix errors in Avrdude.conf #899
- Minor terminal write improvements #902
- Term docs #903
- Add progressbar for read and write command #912
- Add MacOS serial/parallel port note #908
- Add ATmega16U4 to avrdude.conf #910
- Mask out unused ATmega32U4 efuse bits #909
- Increased timeout passed to hid_read_timeout() #901
- Add terminal write string functionality #914
- Update documentation link to new URL #929
- Fix terminal write buffer overflow issue #924
- Fix linuxspi baud to clock period calculation #931
- Added KT-LINK FT2232H interface with IO switching and voltage buffers. #930
* Internals:
- Development moved to Github
- Addition of "alias" keyword to avrdude.conf.in syntax; used
for fuse name aliases right now
Version 6.4:
* Major changes compared to the previous version:
- libhidapi support (part of patch #8717)
- use libhidapi as (optional) transport for CMSIS-DAP compliant
debuggers (JTAGICE3 with firmware 3+, AtmelICE, EDBG, mEDBG)
- UPDI support added (AVR8X family)
- TPI support for USBtinyISP
- TPI support for ft245r
- TPI support for linuxgpio
- AVR Doper uses libhidapi rather than raw libusb (patch #9033)
- -P net:host:port can use IPv6 now (Posix systems only)
- New configure option: -disable-libusb_1_0
- extended UPDI device context (> 64 Ki flash)
- major overhaul of ft245r driver (patch #9327/#9328)
- some improvements in linuxspi driver
- Use -B <bitclock> rather than -b <baudrate> for linuxspi driver
- unused lock byte bits are not masked on read anymore
- parport support disabled by default; configure with
--enable-parport to explicitly enable it
* New devices supported:
- ATmega328PB
- AVR8X family, ATtiny1617, ATtiny817, ATtiny202, ATtiny204,
ATtiny402, ATtiny404, ATtiny406, ATtiny804, ATtiny806,
ATtiny807, ATtiny1604, ATtiny1606, ATtiny1607, ATtiny212,
ATtiny214, ATtiny412, ATTiny414, ATtiny416, ATtiny417,
ATtiny814, ATtiny816, ATtiny1614, ATtiny1616, ATtiny3214,
ATtiny3216, ATtiny3217, ATmega3208, ATmega3209, ATmega4808,
ATmega4809
- ATtiny841, ATtiny441
- ATmega64M1
- ATmega324A
- ATmega808, ATmega809, ATmega1608, ATmega1609, AVR DA, AVR DB
- LGT8FX88P, LGT8FX168P, LGT8FX328P
- ATmega324PB
- ATmega8A
* New programmers supported:
- ehajo-isp (commercial version of USBtiny)
- XplainedPro in UPDI mode
- XplainedMini in UPDI mode
- JTAGICE3 in UPDI mode
- Atmel Powerdebugger in all modes (JTAG, PDI, UPDI, debugWIRE, ISP)
- linuxspi (direct SPI bus e.g. on Raspberry Pi devices)
- PICkit4, Snap, PKoB
- iseavrprog
- XBeeBoot
* Bugfixes:
bug #47550: Linux GPIO broken
bug #47718: "lfuse reads as" not displayed in verbose mode - SOLUTION
bug #48084: Avoid compiled-in timestamp for reproducible release builds
bug #47376: ATtiny841 description missing in configuration file
bug #49455: support for tiny441
bug #57428: document when 'arduino' or 'wiring' should be used, and -D requirement of latter
bug #58095: error setting efuse on atmega328pb variant
bug #51409: Can't program EFUSE on ATmega32M1
bug #60753: Patch #1436 breaks multiple programmer/device combinations on MacOS BigSur
bug #59525: Bogus error message because Copy/Paste typo in stk500.c
bug #58078: [PATCH] buspirate: remove compound literals (fixes GCC>=9)
bug #57453: [PATCH] fix reference to nonexistant -m option by changing to -U
bug #59227: Add new part. How does one get a part added to the CONF file?
bug #55009: no efuses for m164a/pa
bug #55734: USBtiny programming of ATmega328p broken by Patch #9278
bug #58495: Add atmega324pb support to avrdude.conf.in
bug #60863: avrftdi programming error probably caused by multiple, consecutive empty pages
bug #50517: Reading fails if "immediate mode" for output file format is selected - fileio: invalid operation=1
bug #50630: Erase Cycle Counter options ( -y -Y n ) should be removed from usage Message
bug #48767: ser_drain() for TCP on Windows doesn't work
bug #46759: avrdude 6.1 -> 6.2 regression: lock byte verification error
bug #58440: linuxgpio PIN limit too low
bug #55462: wrong programmer id check in jtag3_getsync() and jtag3_close()
bug #58994: VPP PWM still enabled at the end of programming process
bug #57338: if safemode has to change fuses avrdude should exit with non-zero exit code
bug #60575: Permission denied on macOS Big Sur
* Patches:
patch #9482: Add support for UPDI and AVR8X
patch #9508: Add PowerDebugger and XPlained Mini in UPDI mode
patch #9507: Fix UPDI chip erase
patch #9506: Script to create device configuration stub from Atmel
ATDF files
patch #9423: Support ATtiny841 and ATtiny441
patch #9530: Update URL to Ladyada's USBtinyISP page.
patch #9317: Support atmega64m1 as part
patch #9222: Enable silent build
patch #8924: Enable TPI for usbtiny
patch #9033: avrdoper backend uses libhidapi instead of libusb
patch #8580: FT245r support to select device by serial number
patch #8910: ATxmega32c4 and ATxmega16c4 have wrong signatures
patch #8219: Fix boot_start for xmega devices on jtagmkII
patch #9185: Add extended_param to usbasp.c - erasing
patch #8311: Add IPv6 support to the -Pnet:host:port option
patch #9542: Correct "usersig" on avr8x devices
patch #8128: Added new option to configure.ac script
patch #8444: Proposal for modifications in -B and -U command options managment (partially)
patch #9735: spelling error fix: psuedo -> pseudo
patch #9893: [PATCH] Reader reads ftdi handle after main thread close it
patch #9819: Address several leaks in SVN rev 1429
patch #9820: Fix some out-of-bounds/uninitialized issues
patch #9818: correct typos in SVN rev 1429
patch #9732: usbtiny_paged_load overflows buffer e.g. when reading EEPROM
patch #9966: Add JTAGICE3 in UPDI mode
patch #9963: UsbAsp 3 MHz patch for UsbAsp-flash firmware
patch #9816: Implement new programmer type: linuxspi
patch #9811: ATmega328pb has efuse bit 3
patch #9744: Patch for ATMega324A support
patch #10000: Add support for extended UPDI device context
patch #9697: Add iseavrprog support
patch #10017: uspasp / tpi: Automatically clear configuration byte (fuse) before writing it
patch #8957: Allow reading prodsig memory from stk500v2 on xmega devices
patch #9110: Let reserved fuse bits to be read as *don't care*
patch #9253: Fix for giving terminal_mode commands more than 20 arguments
patch #9320: fix TPI RESET in bitbang.c
patch #9079: Fix ftdi_syncbb teardown (supersedes #9893, superseded by #9328)
patch #9122: Fixed MISO sampling in ftdi_syncbb
patch #9123: ftdi_syncbb: use FT245R_CYCLES in ft245r_set_bitclock()
patch #8719: Support Over-the-Air bootloading with XBeeBoot
patch #9757: Fix ATtiny817 Xplained Mini programmer
patch #9327: ft245r.c: add TPI support (patches 1-4)
patch #9328: ft245r.c: add TPI support (patches 5-7)
patch #10027: linuxspi: Add reset pulse, according to AVR programming algorithm
patch #10028: linuxspi: close() only when necessary
patch #10029: linuxspi: Report GPIO_GET_LINEHANDLE_IOCTL errors
patch #10030: linuxspi: Support inverted GPIO pin
patch #10031: linuxspi: Support GPIO uAPI v2
(no-id): Improve documentation of linuxspi driver, provide portname default
(no-id): Use -B <bitclock> rather than -b <baudrate> for linuxspi driver
patch #9304: [Bug #48767] Implemented WinSock variation of "ser_drain(...)" functionality
patch #8996: Remove lock byte read mask (bug#21954, bug#46759)
patch #8923: Enable TPI for linuxgpio
patch #10153: linuxspi: Support "-E reset" and "-E noreset"
* Internals:
- New avrdude.conf keyword "family_id", used to verify SIB attributes
on AVR8X architecture if device is locked.
Version 6.3:
* Major changes compared to the previous version:
@ -601,7 +1239,7 @@ Version 4.3.0:
* Added "Troubleshooting"-Appendix to the manual.
* Add ATmega8515 support.
Contributed by: Matthias Weißer <matthias@matwei.de>
Contributed by: Matthias Weißer <matthias@matwei.de>
* Add ATmega64 support.
Contributed by: Erik Christiansen <erik@dd.nec.com.au>

46
README
View File

@ -1,46 +0,0 @@
See the documentation file for the details.
The latest version of AVRDUDE is always available here:
http://savannah.nongnu.org/projects/avrdude
Important environment variables for ./configure:
================================================
CPPFLAGS: C preprocessor flags (*not* "C++")
This is the place to put additional (non-standard) -I options into.
For example, if your Windows system has LibUSB-Win32 installed into
\\WINDOWS\ProgramFiles\LibUSB-Win32, use
CPPFLAGS=-I/WINDOWS/ProgramFiles/LibUSB-Win32/include
to tell configure where to search for the header files. (The use of
forward slashes rather than backslashes can often simplify things.
Note that the Windows system services internally treat both the same.
It's only cmd.exe which requires backslashes as the directory
separator.)
LDFLAGS: Linker options
This is the place to make additional library locations known to the
linker. To continue the above example, use
LDFLAGS=-L/WINDOWS/ProgramFiles/LibUSB-Win32/lib/gcc
to make the linker search for "libusb.a" in that directory.
Linux users: make sure the header files are installed
=====================================================
While many Linux distributions install the libraries needed by AVRDUDE
(libusb, libelf) by default, they leave out the corresponding header
files. Consequently, the configure script won't find them, so these
libraries could not be used.
Usually, the packages with the header files (and static libraries) are
derived from the regular package name by appending "-devel". Thus,
make sure you have "libusb-devel" and "libelf-devel" installed before
running the configure script. (Same goes for libftdi.)

64
README-old.md Normal file
View File

@ -0,0 +1,64 @@
# AVRDUDE
[![Build Status](https://github.com/avrdudes/avrdude/actions/workflows/build.yml/badge.svg)](https://github.com/avrdudes/avrdude/actions/workflows/build.yml)
AVRDUDE - AVR Downloader Uploader - is a program for downloading and uploading
the on-chip memories of Microchips [AVR microcontrollers](https://en.wikipedia.org/wiki/AVR_microcontrollers).
It can program the Flash and EEPROM, and where supported by the programming
protocol, it can program fuse and lock bits.
AVRDUDE also supplies a direct instruction mode allowing one to issue any
programming instruction to the AVR chip regardless of whether AVRDUDE
implements that specific feature of a particular chip.
AVRDUDE was originally written in 2003 by Brian S. Dean. Since 2006, AVRDUDE has been maintained by Jörg Wunsch,
with the help of [various contributors](./AUTHORS).
The latest version of AVRDUDE is always available here:\
<https://github.com/avrdudes/avrdude>
## Documentation
Documentation for current and previous releases is [on Github Pages](https://avrdudes.github.io/avrdude/).
## Getting AVRDUDE for Windows
To get AVRDUDE for Windows, install the latest version from the [Releases](http://download.savannah.gnu.org/releases/avrdude/) page.
Alternatively, you may [build AVRDUDE](https://github.com/avrdudes/avrdude/wiki) yourself from source.
## Getting AVRDUDE for Linux
To install AVRDUDE for Linux, install the package `avrdude` by running the following commands:
```console
sudo apt-get install avrdude
```
Alternatively, you may [build AVRDUDE](https://github.com/avrdudes/avrdude/wiki) yourself from source.
## Getting AVRDUDE for MacOS
On MacOS, AVRDUDE can be installed through Mac Ports.
Alternatively, you may [build AVRDUDE](https://github.com/avrdudes/avrdude/wiki) yourself from source.
## Using AVRDUDE
AVRDUDE is a command-line application. Run the command `avrdude` without any arguments for a list of options.
A typical command to program your HEX file into your AVR microcontroller looks like this:
```console
avrdude -c <programmer> -p <part> -U flash:w:<file>:i
```
For instance, to program an **Arduino Uno** connected to the serial port **COM1** with a HEX file called `blink.hex`,
you would run the following command:
```console
avrdude -c arduino -P COM1 -b 115200 -p atmega328p -D -U flash:w:objs/blink.hex:i
```
There are many different programmers and options that may be required for the programming to succeed.
For more information, refer to the [AVRDUDE documentation](https://avrdudes.github.io/avrdude/).

224
README.md Normal file
View File

@ -0,0 +1,224 @@
# AVRDUDE for Windows
[![Build Status](https://github.com/mariusgreuel/avrdude/actions/workflows/build.yml/badge.svg?branch=windows)](https://github.com/mariusgreuel/avrdude/actions/workflows/build.yml)
This is a fork of AVRDUDE from <https://github.com/avrdudes/avrdude>.
The purpose of this fork is to add better support for Windows to bring it on par with the Linux version of AVRDUDE.
Noteable changes include:
- [Support Atmel AVR programmers out of the box](#support-atmel-avr-programmers-out-of-the-box)
- [Support Micronucleus bootloader](#support-micronucleus-bootloader)
- [Support Teensy HalfKay bootloader](#support-teensy-halfkay-bootloader)
- [Support COM port discovery via USB VID/PID](#support-com-port-discovery-via-usb-vidpid)
- [Support Arduino Leonardo bootloader auto-reset](#support-arduino-leonardo-bootloader-auto-reset)
- [Support WinUSB devices via custom libusb](#support-winusb-devices-via-custom-libusb)
- [Support FTDI devices via custom libftdi](#support-ftdi-devices-via-custom-libftdi)
- [Support HID devices via libhidapi](#support-hid-devices-via-libhidapi)
- [Support Visual Studio](#support-visual-studio)
- [Miscellaneous bug-fixes and patches](#miscellaneous-bug-fixes-and-patches)
The original AVRDUDE project homepage can be found here <https://github.com/avrdudes/avrdude>.
## Documentation
Documentation for current and previous releases is [on Github Pages](https://avrdudes.github.io/avrdude/).
## Download
To get the latest version of **AVRDUDE for Windows**, go to the [releases folder](https://github.com/mariusgreuel/avrdude/releases):
<https://github.com/mariusgreuel/avrdude/releases>
## Feature Details
### Support Atmel AVR programmers out of the box
This build contains support for Atmel AVR programmers, such as
- [Atmel-ICE](https://www.microchip.com/DevelopmentTools/ProductDetails/ATATMEL-ICE) (Part Number: ATATMEL-ICE)
- [Atmel AVRISP mkII](https://www.microchip.com/DevelopmentTools/ProductDetails/PartNO/ATAVRISP2) (Part Number: ATAVRISP2)
This build does not rely on **libusb** drivers. Instead the default Atmel drivers can be used, allowing you to use AVRDUDE and Atmel Studio 7 side-by-side, without switching drivers.
If you previously changed the driver of your programmer to libusb, you should use **Windows Device Manager** to uninstall the device, and then reinstall using the default Windows drivers.
### Support Micronucleus bootloader
This build adds support for the [Micronucleus bootloader](https://github.com/micronucleus/micronucleus), so you do no longer need a separate command-line utility when working with devices that use the Micronucleus bootloader.
The Micronucleus bootloader is typically used on small ATtiny boards, such as **Digispark** (ATtiny85), **Digispark Pro** (ATtiny167), and the respective clones.
By default, it uses the USB VID/PID **16D0:0753** (MCS Digistump).
Since this bootloader is optimized for size, it implements writing to flash memory only.
As it does not support reading, you need to use the **-V** option to prevent AVRDUDE from verifing the flash memory. To have AVRDUDE wait for the device to be connected, use the extended option '-x wait'.
#### Example: Flashing a Micronucleus bootloader device
```console
avrdude -c micronucleus -p t85 -x wait -V -U flash:w:main.hex:i
```
### Support Teensy HalfKay bootloader
This build adds support for the [Teensy HalfKay bootloader](https://www.pjrc.com/teensy/halfkay_protocol.html), so you do no longer need a the Teensy Loader tool when working with Teensy devices.
Since this bootloader is optimized for size, it implements writing to flash memory only.
As it does not support reading, you need to use the **-V** option to prevent AVRDUDE from verifing the flash memory. To have AVRDUDE wait for the device to be connected, use the extended option '-x wait'.
Supported devices are:
- Teensy 1.0 (AT90USB162)
- Teensy 2.0 (ATmega32U4)
- Teensy++ 1.0 (AT90USB646)
- Teensy++ 2.0 (AT90USB1286)
#### Example: Flashing a Teensy 2.0 device
```console
avrdude -c teensy -p m32u4 -x wait -V -U flash:w:main.hex:i
```
### Support COM port discovery via USB VID/PID
Most Arduino boards use a USB-based virtual COM port, which is connected to some sort of bootloader. Since COM port numbers (COM1, COM2, ...) are determined by Windows, you first need to use Windows device manager to figure out the COM port before you can use AVRDUDE to flash the board. Alternatively, you may use Windows device manager to assign a COM port of your choice to the USB device. Additionally, the COM port of your Arduino board may change over time, for instance if you plug the device in a different USB port.
To simplify the discovery of your Arduino board, I provided the possibility to specify the USB vendor and product ID instead of the COM port.
For instance, to connect to an Arduino Leonardo, use the following command:
```console
avrdude -c avr109 -P usb:2341:0036 -p m32u4
```
Since the USB vendor and device ID **2341:0036** is the identical for all Leonardo boards, the command above will work regardless of which COM port was actually assigned to your board.
Note that can cannot use this method if you have more than one device of the same type (i.e. that share the same USB VID/PID) plugged into your computer. Also, some devices ship various versions of firmwares using different VID/PID.
To figure out the USB VID and PID, you may use **Windows devices manager** (see the **Hardware IDs** of the **Details tab** of the USB device), or look it up in the official list of Arduino devices:
<https://github.com/arduino/ArduinoCore-avr/blob/master/boards.txt>
USB VID/PID pairs for some popular boards and the respective commands are:
- Arduino Uno Rev 3: **2A03:0043** -> `avrdude -c arduino -P usb:2A03:0043 -p m328p`
- Arduino Micro: **2341:0037** -> `avrdude -c avr109 -P usb:2341:0037 -p m32u4`
- Arduino Leonardo: **2341:0036** -> `avrdude -c avr109 -P usb:2341:0036 -p m32u4`
- Sparkfun Pro Micro (5V): **1B4F:9205** -> `avrdude -c avr109 -P usb:1B4F:9205 -p m32u4`
- Sparkfun Pro Micro (3.3V): **1B4F:9203** -> `avrdude -c avr109 -P usb:1B4F:9203 -p m32u4`
- Adafruit Circuit Playground: **239A:0011** -> `avrdude -c avr109 -P usb:239A:0011 -p m32u4`
### Support Arduino Leonardo bootloader auto-reset
Before any Arduino board may be flashed via the bootloader, you need to kick it into bootloader mode first. This can done manually by pressing the reset button, or automatically via an special auto-reset mechanism: For boards with a USB to serial converter chip (such as Arduino Uno or Nano), the tool needs to pull the DTR signal to low, which will briefly pull the RESET pin of the microcontroller to low. For boards with a direct USB connection (such as Arduino Leonardo or Micro), the sketch typically implements a serial port via a USB composite device with a virtual COM port. To perform the auto-reset, the sketch implements a hack that resets the device into bootloader mode when the COM port is opened with a baudrate of 1200bps. To make matters even more complicated, the bootloader COM port has a different USB VID:PID pair than the sketch COM port, which causes the COM port to change while performing the reset.
To simplify the process of auto-resetting the board, this version will auto-reset the device when AVRDUDE detects that the device is running in sketch mode. Note that the sketch is required to implement a USB composite device with a virtual COM port with a matching USB VID:PID, which is implemented in the Arduino core software.
### Support WinUSB devices via custom libusb
Since AVRDUDE originated from Unix, the USB support in AVRDUDE is built upon the Unix-based USB library [libusb](https://sourceforge.net/projects/libusb/). In order to support Windows, libusb has been ported to Windows [libusb-win32](https://sourceforge.net/projects/libusb-win32/).
The downside of using libusb-win32 is that it requires the user to manually install a kernel-mode driver (libusb0.sys or libusbk.sys) instead of the manufacturer supplied Windows driver. There are several hacks to accomplish this, such as the [Zadig driver installation utility](https://zadig.akeo.ie/), which installs a self-signed root certificate in the Windows driver store due to the lack of proper driver installation packages.
This build contains a custom library called **libwinusb**, which implements a sub-set of the libusb-win32 API. The libwinusb implementation supports both the **winusb.sys** driver, and the **libusb0.sys** driver as well. This patch has a number of advantages, such as
- Many USB devices that ship with WinUSB drivers, such as Atmel programmer, will run out of the box.
- Works with both WinUSB and libusb: You can use either Windows built-in WinUSB driver to access your USB devices, or keep using the libusb drivers if you have them installed already.
- No static dependency to libusb0.dll: You cannot run the original version AVRDUDE, unless you previously installed libusb. On systems where libusb is not installed, this build eliminates the error "The code execution cannot proceed because libusb0.dll was not found. Reinstalling the program may fix this problem".
#### Microsoft OS descriptors and firmware examples
Windows provides a mechanism to automatically load the built-in WinUSB driver without providing a driver installation package (INF file). The automatic WinUSB driver installation is triggered via a special [Microsoft OS descriptor](https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors) that must be present in the firmware of the USB device.
To demonstrate how this works, I added Microsoft OS descriptors to the following projects:
- **USBasp** - USB programmer for Atmel AVR controllers: <https://github.com/mariusgreuel/USBasp>
- **FabISP** a.k.a **USBtinyISP** - A fab-able in-system programmer: <https://github.com/mariusgreuel/FabISP>
- **Micronucleus** - ATtiny USB bootloader with a strong emphasis on bootloader compactness: <https://github.com/mariusgreuel/micronucleus>
### Support FTDI devices via custom libftdi
In order to support FTDI devices, AVRDUDE uses the Unix-based library [libftdi1](https://www.intra2net.com/en/developer/libftdi/). Similar to libusb, the libftdi1 library does not play nice on Windows: On Windows, FTDI devices load the manufacturer supplied driver via plug-and-play. The FTDI drivers implement an API via the FTDI D2XX DLLs. However, libftdi1 cannot use the D2XX interface, so it will not work with the plug-and-play drivers.
This build contains a patches library of **libftdi**. The patches load the D2XX DLLs to support FTDI devices, so FTDI devices will just work.
### Support HID devices via libhidapi
This build include the WIN32 version of libhidapi, and some patches, to allow HID devices to work out of the box.
### Support Visual Studio
This build adds support for **Microsoft Visual Studio**. Building AVRDUDE with Microsoft Visual C/C++ will give you the best user and debugging experience while working on Windows.
### Miscellaneous bug-fixes and patches
- This build fixes [bug #54159: Buffer overflow in usbtiny.c](http://savannah.nongnu.org/bugs/?54159), which causes AVRDUDE to crash when using the USBtiny programmer.
- Support new microcontroller: ATtiny167
## Releases
You can find the latest releases of **AVRDUDE for Windows** here:
<https://github.com/mariusgreuel/avrdude/releases>
## Users manual
You can find the original users manual (does not contain AVRDUDE for Windows extras) of AVRDUDE here:
<https://www.nongnu.org/avrdude/user-manual/avrdude.html>
## Build
The build instructions have been moved here:\
<https://github.com/avrdudes/avrdude/wiki>
### Building AVRDUDE for Windows using MSVC
#### Windows Prerequisites
In order to build AVRDUDE on Windows, you need:
- Flex and Bison installed, for instance via [Chocolatey](https://chocolatey.org/)
- Microsoft Visual Studio 2019 with **Desktop development with C++** and **CMake** enabled
#### Windows Build Instructions
To build AVRDUDE on Windows, do the following:
- `git clone --branch windows https://github.com/mariusgreuel/avrdude`
- Open the folder **avrdude** using the menu item **File->Open->Folder**
- Build the project using the menu item **Build->Build All**
### Linux udev rules
If you intent to use either the Micronucleus or Teensy bootloader, you should edit the udev rules so that you can run AVRDUDE without root.
For instance, if you are on Ubuntu and you installed the avrdude package, you would edit `/lib/udev/rules.d/60-avrdude.rules` and add the following rules:
```console
# Micronucleus Bootloader
SUBSYSTEM=="usb", ATTR{idVendor}=="16d0", ATTR{idProduct}=="0753", TAG+="uaccess"
# Teensy Bootloader
SUBSYSTEM=="usb", ATTR{idVendor}=="16c0", ATTR{idProduct}=="0478", TAG+="uaccess"
```
## Troubleshooting Tips & Tricks
### Atmel DFU Device driver broken
The current version of the Atmel DFU drivers that are distributed via the Windows Update are goofed up (@Atmel: It might have something to do with the fact that you commented out the CopyFiles sections!).
Symptoms are:
- You cannot use AVRDUDE to connect to an Atmel DFU device, and you get the error message "No matching USB device found".
- When installing the drivers via Windows Update, you get the error message "Windows encountered a problem installing the drivers for your device" and "A service installation section in this INF is invalid."
- In Windows Device Manager, the Atmel DFU device shows up as an unknown device.
You should use an older driver package that does not contain this bug.
### Outdated libusb0 driver
The most current version of libusb0.sys is 1.2.6.0, signed on 12/17/2012 by Travis Lee Robinson. If you are using an older version (check with Windows Device Manager), you may not be able to connect to your USB devices using the libusb0 driver.

1243
avr.c

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,63 +0,0 @@
/*
* avrdude - A Downloader/Uploader for AVR device programmers
* Copyright (C) 2007 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
* 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 avrdude_h
#define avrdude_h
extern char * progname; /* name of program, for messages */
extern char progbuf[]; /* spaces same length as progname */
extern int ovsigck; /* override signature check (-F) */
extern int verbose; /* verbosity level (-v, -vv, ...) */
extern int quell_progress; /* quiteness level (-q, -qq) */
int avrdude_message(const int msglvl, const char *format, ...);
#define MSG_INFO (0) /* no -v option, can be supressed with -qq */
#define MSG_NOTICE (1) /* displayed with -v */
#define MSG_NOTICE2 (2) /* displayed with -vv, used rarely */
#define MSG_DEBUG (3) /* displayed with -vvv */
#define MSG_TRACE (4) /* displayed with -vvvv, show trace commuication */
#define MSG_TRACE2 (5) /* displayed with -vvvvv */
#if defined(WIN32NATIVE)
#include "ac_cfg.h"
#include <windows.h>
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(HAVE_USLEEP)
int usleep(unsigned int us);
#endif
#if !defined(HAVE_GETTIMEOFDAY)
struct timezone;
int gettimeofday(struct timeval *tv, struct timezone *tz);
#endif /* HAVE_GETTIMEOFDAY */
#ifdef __cplusplus
}
#endif
#endif /* defined(WIN32NATIVE) */
#endif

View File

@ -1,86 +0,0 @@
#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
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)) \
{ \
avrdude_message(MSG_INFO, "%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)) \
{ \
avrdude_message(MSG_INFO, "%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 */

View File

@ -1,9 +0,0 @@
#pragma once
//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);

680
avrpart.c
View File

@ -1,680 +0,0 @@
/*
* avrdude - A Downloader/Uploader for AVR device programmers
* Copyright (C) 2000-2004 Brian S. Dean <bsd@bsdhome.com>
* Copyright (C) 2006 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$ */
#include <stdlib.h>
#include <string.h>
#include "avrdude.h"
#include "libavrdude.h"
/***
*** Elementary functions dealing with OPCODE structures
***/
OPCODE * avr_new_opcode(void)
{
OPCODE * m;
m = (OPCODE *)malloc(sizeof(*m));
if (m == NULL) {
avrdude_message(MSG_INFO, "avr_new_opcode(): out of memory\n");
exit(1);
}
memset(m, 0, sizeof(*m));
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) {
avrdude_message(MSG_INFO, "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()
*
* Set instruction bits in the specified command based on the opcode.
*/
int avr_set_bits(OPCODE * op, unsigned char * cmd)
{
int i, j, bit;
unsigned char mask;
for (i=0; i<32; i++) {
if (op->bit[i].type == AVR_CMDBIT_VALUE) {
j = 3 - i / 8;
bit = i % 8;
mask = 1 << bit;
if (op->bit[i].value)
cmd[j] = cmd[j] | mask;
else
cmd[j] = cmd[j] & ~mask;
}
}
return 0;
}
/*
* avr_set_addr()
*
* Set address bits in the specified command based on the opcode, and
* the address.
*/
int avr_set_addr(OPCODE * op, unsigned char * cmd, unsigned long addr)
{
int i, j, bit;
unsigned long value;
unsigned char mask;
for (i=0; i<32; i++) {
if (op->bit[i].type == AVR_CMDBIT_ADDRESS) {
j = 3 - i / 8;
bit = i % 8;
mask = 1 << bit;
value = addr >> op->bit[i].bitno & 0x01;
if (value)
cmd[j] = cmd[j] | mask;
else
cmd[j] = cmd[j] & ~mask;
}
}
return 0;
}
/*
* avr_set_input()
*
* Set input data bits in the specified command based on the opcode,
* and the data byte.
*/
int avr_set_input(OPCODE * op, unsigned char * cmd, unsigned char data)
{
int i, j, bit;
unsigned char value;
unsigned char mask;
for (i=0; i<32; i++) {
if (op->bit[i].type == AVR_CMDBIT_INPUT) {
j = 3 - i / 8;
bit = i % 8;
mask = 1 << bit;
value = data >> op->bit[i].bitno & 0x01;
if (value)
cmd[j] = cmd[j] | mask;
else
cmd[j] = cmd[j] & ~mask;
}
}
return 0;
}
/*
* avr_get_output()
*
* Retreive output data bits from the command results based on the
* opcode data.
*/
int avr_get_output(OPCODE * op, unsigned char * res, unsigned char * data)
{
int i, j, bit;
unsigned char value;
unsigned char mask;
for (i=0; i<32; i++) {
if (op->bit[i].type == AVR_CMDBIT_OUTPUT) {
j = 3 - i / 8;
bit = i % 8;
mask = 1 << bit;
value = ((res[j] & mask) >> bit) & 0x01;
value = value << op->bit[i].bitno;
if (value)
*data = *data | value;
else
*data = *data & ~value;
}
}
return 0;
}
/*
* 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) {
case AVR_OP_READ : return "READ"; break;
case AVR_OP_WRITE : return "WRITE"; break;
case AVR_OP_READ_LO : return "READ_LO"; break;
case AVR_OP_READ_HI : return "READ_HI"; break;
case AVR_OP_WRITE_LO : return "WRITE_LO"; break;
case AVR_OP_WRITE_HI : return "WRITE_HI"; break;
case AVR_OP_LOADPAGE_LO : return "LOADPAGE_LO"; break;
case AVR_OP_LOADPAGE_HI : return "LOADPAGE_HI"; break;
case AVR_OP_LOAD_EXT_ADDR : return "LOAD_EXT_ADDR"; break;
case AVR_OP_WRITEPAGE : return "WRITEPAGE"; break;
case AVR_OP_CHIP_ERASE : return "CHIP_ERASE"; break;
case AVR_OP_PGM_ENABLE : return "PGM_ENABLE"; break;
default : return "<unknown opcode>"; break;
}
}
static char * bittype(int type)
{
switch (type) {
case AVR_CMDBIT_IGNORE : return "IGNORE"; break;
case AVR_CMDBIT_VALUE : return "VALUE"; break;
case AVR_CMDBIT_ADDRESS : return "ADDRESS"; break;
case AVR_CMDBIT_INPUT : return "INPUT"; break;
case AVR_CMDBIT_OUTPUT : return "OUTPUT"; break;
default : return "<unknown bit type>"; break;
}
}
/***
*** Elementary functions dealing with AVRMEM structures
***/
AVRMEM * avr_new_memtype(void)
{
AVRMEM * m;
m = (AVRMEM *)malloc(sizeof(*m));
if (m == NULL) {
avrdude_message(MSG_INFO, "avr_new_memtype(): out of memory\n");
exit(1);
}
memset(m, 0, sizeof(*m));
return m;
}
/*
* Allocate and initialize memory buffers for each of the device's
* defined memory regions.
*/
int avr_initmem(AVRPART * p)
{
LNODEID ln;
AVRMEM * m;
for (ln=lfirst(p->mem); ln; ln=lnext(ln)) {
m = ldata(ln);
m->buf = (unsigned char *) malloc(m->size);
if (m->buf == NULL) {
avrdude_message(MSG_INFO, "%s: can't alloc buffer for %s size of %d bytes\n",
progname, m->desc, m->size);
return -1;
}
m->tags = (unsigned char *) malloc(m->size);
if (m->tags == NULL) {
avrdude_message(MSG_INFO, "%s: can't alloc buffer for %s size of %d bytes\n",
progname, m->desc, m->size);
return -1;
}
}
return 0;
}
AVRMEM * avr_dup_mem(AVRMEM * m)
{
AVRMEM * n;
int i;
n = avr_new_memtype();
*n = *m;
if (m->buf != NULL) {
n->buf = (unsigned char *)malloc(n->size);
if (n->buf == NULL) {
avrdude_message(MSG_INFO, "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) {
avrdude_message(MSG_INFO, "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]);
}
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)
{
AVRMEM * m, * match;
LNODEID ln;
int matches;
int l;
l = strlen(desc);
matches = 0;
match = NULL;
for (ln=lfirst(p->mem); ln; ln=lnext(ln)) {
m = ldata(ln);
if (strncmp(desc, m->desc, l) == 0) {
match = m;
matches++;
}
}
if (matches == 1)
return match;
return NULL;
}
void avr_mem_display(const char * prefix, FILE * f, AVRMEM * m, int type,
int verbose)
{
int i, j;
char * optr;
if (m == NULL) {
fprintf(f,
"%s Block Poll Page Polled\n"
"%sMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack\n"
"%s----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------\n",
prefix, prefix, prefix);
}
else {
if (verbose > 2) {
fprintf(f,
"%s Block Poll Page Polled\n"
"%sMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack\n"
"%s----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------\n",
prefix, prefix, prefix);
}
fprintf(f,
"%s%-11s %4d %5d %5d %4d %-6s %6d %4d %6d %5d %5d 0x%02x 0x%02x\n",
prefix, m->desc, m->mode, m->delay, m->blocksize, m->pollindex,
m->paged ? "yes" : "no",
m->size,
m->page_size,
m->num_pages,
m->min_write_delay,
m->max_write_delay,
m->readback[0],
m->readback[1]);
if (verbose > 4) {
avrdude_message(MSG_TRACE2, "%s Memory Ops:\n"
"%s Oeration Inst Bit Bit Type Bitno Value\n"
"%s ----------- -------- -------- ----- -----\n",
prefix, prefix, prefix);
for (i=0; i<AVR_OP_MAX; i++) {
if (m->op[i]) {
for (j=31; j>=0; j--) {
if (j==31)
optr = avr_op_str(i);
else
optr = " ";
fprintf(f,
"%s %-11s %8d %8s %5d %5d\n",
prefix, optr, j,
bittype(m->op[i]->bit[j].type),
m->op[i]->bit[j].bitno,
m->op[i]->bit[j].value);
}
}
}
}
}
}
/*
* Elementary functions dealing with AVRPART structures
*/
AVRPART * avr_new_part(void)
{
AVRPART * p;
p = (AVRPART *)malloc(sizeof(AVRPART));
if (p == NULL) {
avrdude_message(MSG_INFO, "new_part(): out of memory\n");
exit(1);
}
memset(p, 0, sizeof(*p));
p->id[0] = 0;
p->desc[0] = 0;
p->reset_disposition = RESET_DEDICATED;
p->retry_pulse = PIN_AVR_SCK;
p->flags = AVRPART_SERIALOK | AVRPART_PARALLELOK | AVRPART_ENABLEPAGEPROGRAMMING;
p->config_file[0] = 0;
p->lineno = 0;
memset(p->signature, 0xFF, 3);
p->ctl_stack_type = CTL_STACK_NONE;
p->ocdrev = -1;
p->mem = lcreat(NULL, 0);
return p;
}
AVRPART * avr_dup_part(AVRPART * d)
{
AVRPART * p;
LISTID save;
LNODEID ln;
int i;
p = avr_new_part();
save = p->mem;
*p = *d;
p->mem = save;
for (ln=lfirst(d->mem); ln; ln=lnext(ln)) {
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)
{
LNODEID ln1;
AVRPART * p = NULL;
int found;
found = 0;
for (ln1=lfirst(parts); ln1 && !found; ln1=lnext(ln1)) {
p = ldata(ln1);
if ((strcasecmp(partdesc, p->id) == 0) ||
(strcasecmp(partdesc, p->desc) == 0))
found = 1;
}
if (found)
return p;
return NULL;
}
AVRPART * locate_part_by_avr910_devcode(LISTID parts, int devcode)
{
LNODEID ln1;
AVRPART * p = NULL;
for (ln1=lfirst(parts); ln1; ln1=lnext(ln1)) {
p = ldata(ln1);
if (p->avr910_devcode == devcode)
return p;
}
return NULL;
}
AVRPART * locate_part_by_signature(LISTID parts, unsigned char * sig,
int sigsize)
{
LNODEID ln1;
AVRPART * p = NULL;
int i;
if (sigsize == 3) {
for (ln1=lfirst(parts); ln1; ln1=lnext(ln1)) {
p = ldata(ln1);
for (i=0; i<3; i++)
if (p->signature[i] != sig[i])
break;
if (i == 3)
return p;
}
}
return NULL;
}
/*
* Iterate over the list of avrparts given as "avrparts", and
* call the callback function cb for each entry found. cb is being
* passed the following arguments:
* . the name of the avrpart (for -p)
* . the descriptive text given in the config file
* . the name of the config file this avrpart has been defined in
* . the line number of the config file this avrpart has been defined at
* . the "cookie" passed into walk_avrparts() (opaque client data)
*/
void walk_avrparts(LISTID avrparts, walk_avrparts_cb cb, void *cookie)
{
LNODEID ln1;
AVRPART * p;
for (ln1 = lfirst(avrparts); ln1; ln1 = lnext(ln1)) {
p = ldata(ln1);
cb(p->id, p->desc, p->config_file, p->lineno, 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)
{
switch (r) {
case RESET_DEDICATED : return "dedicated";
case RESET_IO : return "possible i/o";
default : return "<invalid>";
}
}
void avr_display(FILE * f, AVRPART * p, const char * prefix, int verbose)
{
int i;
char * buf;
const char * px;
LNODEID ln;
AVRMEM * m;
fprintf(f,
"%sAVR Part : %s\n"
"%sChip Erase delay : %d us\n"
"%sPAGEL : P%02X\n"
"%sBS2 : P%02X\n"
"%sRESET disposition : %s\n"
"%sRETRY pulse : %s\n"
"%sserial program mode : %s\n"
"%sparallel program mode : %s\n"
"%sTimeout : %d\n"
"%sStabDelay : %d\n"
"%sCmdexeDelay : %d\n"
"%sSyncLoops : %d\n"
"%sByteDelay : %d\n"
"%sPollIndex : %d\n"
"%sPollValue : 0x%02x\n"
"%sMemory Detail :\n\n",
prefix, p->desc,
prefix, p->chip_erase_delay,
prefix, p->pagel,
prefix, p->bs2,
prefix, reset_disp_str(p->reset_disposition),
prefix, avr_pin_name(p->retry_pulse),
prefix, (p->flags & AVRPART_SERIALOK) ? "yes" : "no",
prefix, (p->flags & AVRPART_PARALLELOK) ?
((p->flags & AVRPART_PSEUDOPARALLEL) ? "psuedo" : "yes") : "no",
prefix, p->timeout,
prefix, p->stabdelay,
prefix, p->cmdexedelay,
prefix, p->synchloops,
prefix, p->bytedelay,
prefix, p->pollindex,
prefix, p->pollvalue,
prefix);
px = prefix;
i = strlen(prefix) + 5;
buf = (char *)malloc(i);
if (buf == NULL) {
/* ugh, this is not important enough to bail, just ignore it */
}
else {
strcpy(buf, prefix);
strcat(buf, " ");
px = buf;
}
if (verbose <= 2) {
avr_mem_display(px, f, NULL, 0, verbose);
}
for (ln=lfirst(p->mem); ln; ln=lnext(ln)) {
m = ldata(ln);
avr_mem_display(px, f, m, i, verbose);
}
if (buf)
free(buf);
}

92
build.sh Executable file
View File

@ -0,0 +1,92 @@
#!/bin/sh
#
# Build script for Unix-like systems, using the CMake subsystem
#
# This script covers some common cases. It does *not* install any
# prerequisites though.
#
# For documentation of AVRDUDE's build system, please refer to the
# Wiki:
#
# https://github.com/avrdudes/avrdude/wiki
# Determine OS type
#
# So far, this script tries to handle three different Unix-like
# systems:
#
# Linux
# FreeBSD
# Darwin (aka. MacOS)
#
# On Linux, if the machine is ARM-based, LINUXSPI and LINUXGPIO are
# enabled.
# On MacOS, an attempt is made to find out whether Mac ports or brew
# are in place, and are assumed to have install the prerequisites.
ostype=$(uname | tr '[A-Z]' '[a-z]')
build_type=RelWithDebInfo
# build_type=Release # no debug info
# See CMakeLists.txt for all options
#
# Use this to enable (historical) parallel-port based programmers:
#extra_enable="-D HAVE_PARPORT=1"
extra_enable=""
build_flags=""
case "${ostype}" in
linux)
# try to find out whether this is an Embedded Linux
# platform (e.g. Raspberry Pi)
machine=$(uname -m)
if expr "${machine}" : '^\(arm\|aarch\)' >/dev/null
then
extra_enable="${extra_enable} -D HAVE_LINUXGPIO=1 -D HAVE_LINUXSPI=1"
fi
;;
darwin)
# determine whether we are running using Mac Ports
# if not, assume Mac Brew
if [ -f /opt/local/bin/port ]
then
build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/opt/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/opt/local/lib"
else
# Apple M1 (may be new version of homebrew also)
if [ -d /opt/homebrew ]
then
build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/opt/homebrew/include -D CMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/Cellar"
else
build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/Cellar"
fi
fi
;;
netbsd)
build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/usr/pkg/include -D CMAKE_EXE_LINKER_FLAGS=-R/usr/pkg/lib -D CMAKE_INSTALL_PREFIX:PATH=/usr/pkg"
;;
*bsd)
build_flags="${build_flags} -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/lib"
;;
esac
cmake ${build_flags} ${extra_enable} -D CMAKE_BUILD_TYPE=${build_type} -B build_${ostype} ||\
{ echo "CMake failed."; exit 1; }
cmake --build build_${ostype} ||\
{ echo "Build failed."; exit 1; }
cat <<EOF
Build succeeded.
Run
sudo cmake --build build_${ostype} --target install
to install.
EOF

349
config.c
View File

@ -1,349 +0,0 @@
/*
* 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$ */
#include "ac_cfg.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "avrdude.h"
#include "libavrdude.h"
#include "config.h"
#include "config_gram.h"
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;
LISTID string_list;
LISTID number_list;
PROGRAMMER * current_prog;
AVRPART * current_part;
AVRMEM * current_mem;
LISTID part_list;
LISTID programmers;
int lineno;
const char * infile;
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)
{
string_list = lcreat(NULL, 0);
number_list = lcreat(NULL, 0);
current_prog = NULL;
current_part = NULL;
current_mem = NULL;
part_list = lcreat(NULL, 0);
programmers = lcreat(NULL, 0);
lineno = 1;
infile = NULL;
return 0;
}
int yywrap()
{
return 1;
}
int yyerror(char * errmsg, ...)
{
va_list args;
char message[512];
va_start(args, errmsg);
vsnprintf(message, sizeof(message), errmsg, args);
avrdude_message(MSG_INFO, "%s: error at %s:%d: %s\n", progname, infile, lineno, message);
va_end(args);
return 0;
}
int yywarning(char * errmsg, ...)
{
va_list args;
char message[512];
va_start(args, errmsg);
vsnprintf(message, sizeof(message), errmsg, args);
avrdude_message(MSG_INFO, "%s: warning at %s:%d: %s\n", progname, infile, lineno, message);
va_end(args);
return 0;
}
TOKEN * new_token(int primary)
{
TOKEN * tkn;
tkn = (TOKEN *)malloc(sizeof(TOKEN));
if (tkn == NULL) {
yyerror("new_token(): out of memory");
return NULL;
}
memset(tkn, 0, sizeof(TOKEN));
tkn->primary = primary;
return tkn;
}
void free_token(TOKEN * tkn)
{
if (tkn) {
switch (tkn->value.type) {
case V_STR:
if (tkn->value.string)
free(tkn->value.string);
tkn->value.string = NULL;
break;
}
free(tkn);
}
}
void free_tokens(int n, ...)
{
TOKEN * t;
va_list ap;
va_start(ap, n);
while (n--) {
t = va_arg(ap, TOKEN *);
free_token(t);
}
va_end(ap);
}
TOKEN * number(char * text)
{
struct token_t * tkn;
tkn = new_token(TKN_NUMBER);
if (tkn == NULL) {
return NULL; /* yyerror already called */
}
tkn->value.type = V_NUM;
tkn->value.number = atoi(text);
#if DEBUG
avrdude_message(MSG_INFO, "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
avrdude_message(MSG_INFO, "NUMBER(%g)\n", tkn->value.number_real);
#endif
return tkn;
}
TOKEN * hexnumber(char * text)
{
struct token_t * tkn;
char * e;
tkn = new_token(TKN_NUMBER);
if (tkn == NULL) {
return NULL; /* yyerror already called */
}
tkn->value.type = V_NUM;
tkn->value.number = strtoul(text, &e, 16);
if ((e == text) || (*e != 0)) {
yyerror("can't scan hex number \"%s\"", text);
return NULL;
}
#if DEBUG
avrdude_message(MSG_INFO, "HEXNUMBER(%g)\n", tkn->value.number);
#endif
return tkn;
}
TOKEN * string(char * text)
{
struct token_t * tkn;
int len;
tkn = new_token(TKN_STRING);
if (tkn == NULL) {
return NULL; /* yyerror already called */
}
len = strlen(text);
tkn->value.type = V_STR;
tkn->value.string = (char *) malloc(len+1);
if (tkn->value.string == NULL) {
yyerror("string(): out of memory");
return NULL;
}
strcpy(tkn->value.string, text);
#if DEBUG
avrdude_message(MSG_INFO, "STRING(%s)\n", tkn->value.string);
#endif
return tkn;
}
TOKEN * keyword(int primary)
{
struct token_t * tkn;
tkn = new_token(primary);
return tkn;
}
void print_token(TOKEN * tkn)
{
if (!tkn)
return;
avrdude_message(MSG_INFO, "token = %d = ", tkn->primary);
switch (tkn->value.type) {
case V_NUM:
avrdude_message(MSG_INFO, "NUMBER, value=%d", tkn->value.number);
break;
case V_NUM_REAL:
avrdude_message(MSG_INFO, "NUMBER, value=%g", tkn->value.number_real);
break;
case V_STR:
avrdude_message(MSG_INFO, "STRING, value=%s", tkn->value.string);
break;
default:
avrdude_message(MSG_INFO, "<other>");
break;
}
avrdude_message(MSG_INFO, "\n");
}
void pyytext(void)
{
#if DEBUG
avrdude_message(MSG_INFO, "TOKEN: \"%s\"\n", yytext);
#endif
}
char * dup_string(const char * str)
{
char * s;
s = strdup(str);
if (s == NULL) {
yyerror("dup_string(): out of memory");
return NULL;
}
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;
int r;
f = fopen(file, "r");
if (f == NULL) {
avrdude_message(MSG_INFO, "%s: can't open config file \"%s\": %s\n",
progname, file, strerror(errno));
return -1;
}
lineno = 1;
infile = file;
yyin = f;
r = yyparse();
#ifdef HAVE_YYLEX_DESTROY
/* reset lexer and free any allocated memory */
yylex_destroy();
#endif
fclose(f);
return r;
}

103
config.h
View File

@ -1,103 +0,0 @@
/*
* 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$ */
/* These are the internal definitions needed for config parsing */
#ifndef config_h
#define config_h
#include "libavrdude.h"
#define MAX_STR_CONST 1024
enum { V_NONE, V_NUM, V_NUM_REAL, V_STR };
typedef struct value_t {
int type;
/*union { TODO: use an anonymous union here ? */
int number;
double number_real;
char * string;
/*};*/
} VALUE;
typedef struct token_t {
int primary;
VALUE value;
} TOKEN;
typedef struct token_t *token_p;
extern FILE * yyin;
extern PROGRAMMER * current_prog;
extern AVRPART * current_part;
extern AVRMEM * current_mem;
extern int lineno;
extern const char * infile;
extern LISTID string_list;
extern LISTID number_list;
#if !defined(HAS_YYSTYPE)
#define YYSTYPE token_p
#endif
extern YYSTYPE yylval;
extern char string_buf[MAX_STR_CONST];
extern char *string_buf_ptr;
#ifdef __cplusplus
extern "C" {
#endif
int yyparse(void);
int yyerror(char * errmsg, ...);
int yywarning(char * errmsg, ...);
TOKEN * new_token(int primary);
void free_token(TOKEN * tkn);
void free_tokens(int n, ...);
TOKEN * number(char * text);
TOKEN * number_real(char * text);
TOKEN * hexnumber(char * text);
TOKEN * string(char * text);
TOKEN * keyword(int primary);
void print_token(TOKEN * tkn);
void pyytext(void);
char * dup_string(const char * str);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,26 +0,0 @@
- Man page needs updated for avr910 info.
- Website needs to link to docs:
http://savannah.nongnu.org/download/avrdude/doc/avrdude-html/
- Add "skip empty pages" optimization on avr910 paged write. The stk500 has
this optimization already.
- Fix "overfull \hbox" issues in building documentation.
- FIXME: term.c: terminal_get_input(): strip newlines in non-readline input
code.
- FIXME: avr910.c: avr910_cmd(): Insert version check here.
- FIXME: ser_posix.c: serial_close(): Should really restore the terminal to
original state here.
- FIXME: main.c, par.c: exitspecs don't work if RESET-pin is controlled over
PPICTRL.
- transfer ppi-speedtuning to the windows version (CAVEAT: This will make
programming too fast for chips with 500kHz clock)
- make SCK-period configurable for PPI-programmers

963
ft245r.c
View File

@ -1,963 +0,0 @@
/*
* 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 "libavrdude.h"
#include "bitbang.h"
#include "ft245r.h"
#include "usbdevs.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) {
avrdude_message(MSG_INFO, "%s: error: no pthread support. Please compile again with pthread installed."
#if defined(_WIN32)
" See http://sourceware.org/pthreads-win32/."
#endif
"\n",
progname);
return -1;
}
void ft245r_initpgm(PROGRAMMER * pgm) {
strcpy(pgm->type, "ftdi_syncbb");
pgm->open = ft245r_nopthread_open;
}
#elif defined(DO_NOT_BUILD_FT245R)
static int ft245r_noftdi_open (struct programmer_t *pgm, char * name) {
avrdude_message(MSG_INFO, "%s: error: no libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.\n",
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) {
avrdude_message(MSG_INFO, "buffer overflow. Cannot happen!\n");
}
buffer[head] = c;
head = nh;
sem_post (&buf_data);
}
static void *reader (void *arg) {
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL);
struct ftdi_context *handle = (struct ftdi_context *)(arg);
unsigned char buf[0x1000];
int br, i;
while (1) {
pthread_testcancel();
br = ftdi_read_data (handle, buf, sizeof(buf));
for (i=0; i<br; i++)
add_to_buf (buf[i]);
}
return NULL;
}
static 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) {
avrdude_message(MSG_INFO, "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 (FT245R_DEBUG) {
avrdude_message(MSG_NOTICE2, " ft245r: spi bitclk %d -> ft baudrate %d\n",
rate / 2, rate);
}
r = ftdi_set_baudrate(handle, rate);
if (r) {
avrdude_message(MSG_INFO, "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_sck(PROGRAMMER * pgm, int value) {
return set_pin(pgm, PIN_AVR_SCK, value);
}
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) {
avrdude_message(MSG_INFO, "%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 (FT245R_DEBUG) {
avrdude_message(MSG_NOTICE, "%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;
}
}
avrdude_message(MSG_INFO, "%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) {
/* Apply power between VCC and GND while RESET and SCK are set to “0”. In some systems,
* the programmer can not guarantee that SCK is held low during power-up. In this
* case, RESET must be given a positive pulse of at least two CPU clock cycles duration
* after SCK has been set to 0.
*/
set_sck(pgm, OFF);
ft245r_powerup(pgm);
set_reset(pgm, OFF);
usleep(5000); // 5ms
set_reset(pgm, ON);
usleep(5000); // 5ms
set_reset(pgm, OFF);
/* Wait for at least 20 ms and enable serial programming by sending the Programming
* Enable serial instruction to pin MOSI.
*/
usleep(20000); // 20ms
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) {
avrdude_message(MSG_INFO, "%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);
LNODEID usbpid = lfirst(pgm->usbpid);
int pid;
if (usbpid) {
pid = *(int *)(ldata(usbpid));
if (lnext(usbpid))
avrdude_message(MSG_INFO, "%s: Warning: using PID 0x%04x, ignoring remaining PIDs in list\n",
progname, pid);
} else {
pid = USB_DEVICE_FT245;
}
rv = ftdi_usb_open_desc_index(handle,
pgm->usbvid?pgm->usbvid:USB_VENDOR_FTDI,
pid,
pgm->usbproduct[0]?pgm->usbproduct:NULL,
pgm->usbsn[0]?pgm->usbsn:NULL,
devnum);
if (rv) {
avrdude_message(MSG_INFO, "can't open ftdi device %d. (%s)\n", devnum, ftdi_get_error_string(handle));
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) {
avrdude_message(MSG_INFO, "%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
ftdi_usb_close(handle);
ftdi_deinit (handle);
pthread_cancel(readerthread);
pthread_join(readerthread, NULL);
free(handle);
handle = NULL;
}
}
static void ft245r_display(PROGRAMMER * pgm, const char * p) {
avrdude_message(MSG_INFO, "%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) {
avrdude_message(MSG_INFO, "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
avrdude_message(MSG_INFO, "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";

2262
jtag3.c

File diff suppressed because it is too large Load Diff

60
jtag3.h
View File

@ -1,60 +0,0 @@
/*
* 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_open_common(PROGRAMMER * pgm, char * port);
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

262
lexer.l
View File

@ -1,262 +0,0 @@
/*
* avrdude - A Downloader/Uploader for AVR device programmers
* Copyright (C) 2000-2004 Brian S. Dean <bsd@bsdhome.com>
* Copyright (C) 2006 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$ */
%{
/* need this for the call to atof() below */
#include <math.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "avrdude.h"
#include "libavrdude.h"
#include "config.h"
#include "config_gram.h"
#ifndef YYERRCODE
#define YYERRCODE 256
#endif
%}
DIGIT [0-9]
HEXDIGIT [0-9a-fA-F]
SIGN [+-]
%x strng
%x incl
%x comment
%option nounput
/* Bump resources for classic lex. */
%e2000
%p10000
%n1000
%%
#{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); }
0x{HEXDIGIT}+ { yylval = hexnumber(yytext); return TKN_NUMBER; }
# { /* The following eats '#' style comments to end of line */
BEGIN(comment); }
<comment>[^\n] { /* eat comments */ }
<comment>\n { lineno++; BEGIN(INITIAL); }
"/*" { /* The following eats multiline C style comments */
int c;
int comment_start;
comment_start = lineno;
while (1) {
while (((c = input()) != '*') && (c != EOF)) {
/* eat up text of comment, but keep counting lines */
if (c == '\n')
lineno++;
}
if (c == '*') {
while ((c = input()) == '*')
;
if (c == '/')
break; /* found the end */
}
if (c == EOF) {
yyerror("EOF in comment (started on line %d)", comment_start);
return YYERRCODE;
}
}
}
<strng>\" { *string_buf_ptr = 0; string_buf_ptr = string_buf;
yylval = string(string_buf_ptr); BEGIN(INITIAL); return TKN_STRING; }
<strng>\\n *string_buf_ptr++ = '\n';
<strng>\\t *string_buf_ptr++ = '\t';
<strng>\\r *string_buf_ptr++ = '\r';
<strng>\\b *string_buf_ptr++ = '\b';
<strng>\\f *string_buf_ptr++ = '\f';
<strng>\\(.|\n) *(string_buf_ptr++) = yytext[1];
<strng>[^\\\n\"]+ { char *yptr = yytext; while (*yptr)
*(string_buf_ptr++) = *(yptr++); }
<strng>\n { yyerror("unterminated character constant");
return YYERRCODE; }
allowfullpagebitstream { yylval=NULL; return K_ALLOWFULLPAGEBITSTREAM; }
avr910_devcode { yylval=NULL; return K_AVR910_DEVCODE; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
write { yylval=new_token(K_WRITE); return K_WRITE; }
write_hi { yylval=new_token(K_WRITE_HI); return K_WRITE_HI; }
write_lo { yylval=new_token(K_WRITE_LO); return K_WRITE_LO; }
writepage { yylval=new_token(K_WRITEPAGE); return K_WRITEPAGE; }
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 */ }
c: { yyerror("possible old-style config file entry\n"
" Update your config file (see " CONFIG_DIR
"/avrdude.conf.sample for a sample)");
return YYERRCODE; }
. { return YYERRCODE; }
%%

View File

@ -1,943 +0,0 @@
/*
* avrdude - A Downloader/Uploader for AVR device programmers
* Copyright (C) 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
* 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 libavrdude_h
#define libavrdude_h
/* XXX should go away */
#include "ac_cfg.h"
#include <stdio.h>
#include <limits.h>
#include <stdbool.h>
/* lets try to select at least 32 bits */
#ifdef HAVE_STDINT_H
#include <stdint.h>
typedef uint32_t pinmask_t;
#else
#if UINT_MAX >= 0xFFFFFFFF
typedef unsigned int pinmask_t;
#else
typedef unsigned long pinmask_t;
#endif
#endif
/* formerly lists.h */
/*----------------------------------------------------------------------
General purpose linked list routines - header file declarations.
Author : Brian Dean
Date : 10 January, 1990
----------------------------------------------------------------------*/
typedef void * LISTID;
typedef void * LNODEID;
/*----------------------------------------------------------------------
several defines to access the LIST structure as as stack or a queue
--- use for program readability
----------------------------------------------------------------------*/
#define STACKID LISTID
#define SNODEID LNODEID
#define QUEUEID LISTID
#define QNODEID LNODEID
#define PUSH(s,d) lins_n(s,d,1) /* push 'd' onto the stack */
#define POP(s) lrmv_n(s,1) /* pop the stack */
#define LOOKSTACK(s) lget_n(s,1) /* look at the top of the stack,
but don't pop */
#define ENQUEUE(q,d) lins_n(q,d,1) /* put 'd' on the end of the queue */
#define DEQUEUE(q) lrmv(q) /* remove next item from the front of
the queue */
#define REQUEUE(q,d) ladd(q,d) /* re-insert (push) item back on the
front of the queue */
#define LOOKQUEUE(q) lget(q) /* return next item on the queue,
but don't dequeue */
#define QUEUELEN(q) lsize(q) /* length of the queue */
#define LISTADD(l,d) ladd(l,d) /* add to end of the list */
#define LISTRMV(l,d) lrmv_d(l,d) /* remove from end of the list */
#ifdef __cplusplus
extern "C" {
#endif
/* .................... Function Prototypes .................... */
LISTID lcreat ( void * liststruct, int poolsize );
void ldestroy ( LISTID lid );
void ldestroy_cb ( LISTID lid, void (*ucleanup)(void * data_ptr) );
LNODEID lfirst ( LISTID ); /* head of the list */
LNODEID llast ( LISTID ); /* tail of the list */
LNODEID lnext ( LNODEID ); /* next item in the list */
LNODEID lprev ( LNODEID ); /* previous item in the list */
void * ldata ( LNODEID ); /* data at the current position */
int lsize ( LISTID ); /* number of elements in the list */
int ladd ( LISTID lid, void * p );
int laddo ( LISTID lid, void *p,
int (*compare)(const void *p1,const void *p2),
LNODEID * firstdup );
int laddu ( LISTID lid, void * p,
int (*compare)(const void *p1,const void *p2));
int lins_n ( LISTID lid, void * d, unsigned int n );
int lins_ln ( LISTID lid, LNODEID lnid, void * data_ptr );
void * lget ( LISTID lid );
void * lget_n ( LISTID lid, unsigned int n );
LNODEID lget_ln ( LISTID lid, unsigned int n );
void * lrmv ( LISTID lid );
void * lrmv_n ( LISTID lid, unsigned int n );
void * lrmv_ln ( LISTID lid, LNODEID lnid );
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 );
#ifdef __cplusplus
}
#endif
/* formerly avrpart.h */
/*
* AVR serial programming instructions
*/
enum {
AVR_OP_READ,
AVR_OP_WRITE,
AVR_OP_READ_LO,
AVR_OP_READ_HI,
AVR_OP_WRITE_LO,
AVR_OP_WRITE_HI,
AVR_OP_LOADPAGE_LO,
AVR_OP_LOADPAGE_HI,
AVR_OP_LOAD_EXT_ADDR,
AVR_OP_WRITEPAGE,
AVR_OP_CHIP_ERASE,
AVR_OP_PGM_ENABLE,
AVR_OP_MAX
};
enum {
AVR_CMDBIT_IGNORE, /* bit is ignored on input and output */
AVR_CMDBIT_VALUE, /* bit is set to 0 or 1 for input or output */
AVR_CMDBIT_ADDRESS, /* this bit represents an input address bit */
AVR_CMDBIT_INPUT, /* this bit is an input bit */
AVR_CMDBIT_OUTPUT /* this bit is an output bit */
};
enum { /* these are assigned to reset_disposition of AVRPART */
RESET_DEDICATED, /* reset pin is dedicated */
RESET_IO /* reset pin might be configured as an I/O pin */
};
enum ctl_stack_t {
CTL_STACK_NONE, /* no control stack defined */
CTL_STACK_PP, /* parallel programming control stack */
CTL_STACK_HVSP /* high voltage serial programming control stack */
};
/*
* serial programming instruction bit specifications
*/
typedef struct cmdbit {
int type; /* AVR_CMDBIT_* */
int bitno; /* which input bit to use for this command bit */
int value; /* bit value if type == AVR_CMDBIT_VALUD */
} CMDBIT;
typedef struct opcode {
CMDBIT bit[32]; /* opcode bit specs */
} OPCODE;
#define AVRPART_SERIALOK 0x0001 /* part supports serial programming */
#define AVRPART_PARALLELOK 0x0002 /* part supports parallel programming */
#define AVRPART_PSEUDOPARALLEL 0x0004 /* part has pseudo parallel support */
#define AVRPART_HAS_JTAG 0x0008 /* part has a JTAG i/f */
#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 */
int stk500_devcode; /* stk500 device code */
int avr910_devcode; /* avr910 device code */
int chip_erase_delay; /* microseconds */
unsigned char pagel; /* for parallel programming */
unsigned char bs2; /* for parallel programming */
unsigned char signature[3]; /* expected value of signature bytes */
unsigned short usbpid; /* USB DFU product ID (0 = none) */
int reset_disposition; /* see RESET_ enums */
int retry_pulse; /* retry program enable by pulsing
this pin (PIN_AVR_*) */
unsigned flags; /* see AVRPART_ masks */
int timeout; /* stk500 v2 xml file parameter */
int stabdelay; /* stk500 v2 xml file parameter */
int cmdexedelay; /* stk500 v2 xml file parameter */
int synchloops; /* stk500 v2 xml file parameter */
int bytedelay; /* stk500 v2 xml file parameter */
int pollindex; /* stk500 v2 xml file parameter */
unsigned char pollvalue; /* stk500 v2 xml file parameter */
int predelay; /* stk500 v2 xml file parameter */
int postdelay; /* stk500 v2 xml file parameter */
int pollmethod; /* stk500 v2 xml file parameter */
enum ctl_stack_t ctl_stack_type; /* what to use the ctl stack for */
unsigned char controlstack[CTL_STACK_SIZE]; /* stk500v2 PP/HVSP ctl stack */
unsigned char flash_instr[FLASH_INSTR_SIZE]; /* flash instructions (debugWire, JTAG) */
unsigned char eeprom_instr[EEPROM_INSTR_SIZE]; /* EEPROM instructions (debugWire, JTAG) */
int hventerstabdelay; /* stk500 v2 hv mode parameter */
int progmodedelay; /* stk500 v2 hv mode parameter */
int latchcycles; /* stk500 v2 hv mode parameter */
int togglevtg; /* stk500 v2 hv mode parameter */
int poweroffdelay; /* stk500 v2 hv mode parameter */
int resetdelayms; /* stk500 v2 hv mode parameter */
int resetdelayus; /* stk500 v2 hv mode parameter */
int hvleavestabdelay; /* stk500 v2 hv mode parameter */
int resetdelay; /* stk500 v2 hv mode parameter */
int chiperasepulsewidth; /* stk500 v2 hv mode parameter */
int chiperasepolltimeout; /* stk500 v2 hv mode parameter */
int chiperasetime; /* stk500 v2 hv mode parameter */
int programfusepulsewidth; /* stk500 v2 hv mode parameter */
int programfusepolltimeout; /* stk500 v2 hv mode parameter */
int programlockpulsewidth; /* stk500 v2 hv mode parameter */
int programlockpolltimeout; /* stk500 v2 hv mode parameter */
int synchcycles; /* stk500 v2 hv mode parameter */
int hvspcmdexedelay; /* stk500 v2 xml file parameter */
unsigned char idr; /* JTAG ICE mkII XML file parameter */
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 */
LISTID mem; /* avr memory definitions */
char config_file[PATH_MAX]; /* config file where defined */
int lineno; /* config file line number */
} AVRPART;
#define AVR_MEMDESCLEN 64
typedef struct avrmem {
char desc[AVR_MEMDESCLEN]; /* memory description ("flash", "eeprom", etc) */
int paged; /* page addressed (e.g. ATmega flash) */
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/dyn/resources/prod_documents/doc1280.pdf */
unsigned char readback[2]; /* polled read-back values */
int mode; /* stk500 v2 xml file parameter */
int delay; /* stk500 v2 xml file parameter */
int blocksize; /* stk500 v2 xml file parameter */
int readsize; /* stk500 v2 xml file parameter */
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;
#ifdef __cplusplus
extern "C" {
#endif
/* 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);
/* 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);
AVRPART * locate_part_by_signature(LISTID parts, unsigned char * sig,
int sigsize);
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 avrparts, walk_avrparts_cb cb, void *cookie);
void sort_avrparts(LISTID avrparts);
#ifdef __cplusplus
}
#endif
/* formerly pindefs.h */
enum {
PPI_AVR_VCC = 1,
PPI_AVR_BUFF,
PIN_AVR_RESET,
PIN_AVR_SCK,
PIN_AVR_MOSI,
PIN_AVR_MISO,
PIN_LED_ERR,
PIN_LED_RDY,
PIN_LED_PGM,
PIN_LED_VFY,
N_PINS
};
#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_LINUXGPIO
/* 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.
*/
int 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);
/* formerly serial.h */
/* This is the API for the generic serial interface. The implementations are
actually provided by the target dependant files:
ser_posix.c : posix serial interface.
ser_win32.c : native win32 serial interface.
The target file will be selected at configure time. */
extern long serial_recv_timeout;
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 */
int use_interrupt_xfer; /* device uses interrupt transfers */
} usb;
};
union pinfo
{
long baud;
struct
{
unsigned short vid;
unsigned short pid;
unsigned short flags;
#define PINFO_FL_USEHID 0x0001
#define PINFO_FL_SILENT 0x0002 /* don't complain if not found */
} usbinfo;
};
struct serial_device
{
// open should return -1 on error, other values on success
int (*open)(char * port, union pinfo pinfo, union filedescriptor *fd);
int (*setspeed)(union filedescriptor *fd, long baud);
void (*close)(union filedescriptor *fd);
int (*send)(union filedescriptor *fd, const unsigned char * buf, size_t buflen);
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 */
};
extern struct serial_device *serdev;
extern struct serial_device serial_serdev;
extern struct serial_device usb_serdev;
extern struct serial_device usb_serdev_frame;
extern struct serial_device avrdoper_serdev;
#define serial_open (serdev->open)
#define serial_setspeed (serdev->setspeed)
#define serial_close (serdev->close)
#define serial_send (serdev->send)
#define serial_recv (serdev->recv)
#define serial_drain (serdev->drain)
#define serial_set_dtr_rts (serdev->set_dtr_rts)
/* formerly pgm.h */
#define ON 1
#define OFF 0
#define PGM_DESCLEN 80
#define PGM_PORTLEN PATH_MAX
#define PGM_TYPELEN 32
#define PGM_USBSTRINGLEN 256
typedef enum {
EXIT_VCC_UNSPEC,
EXIT_VCC_ENABLED,
EXIT_VCC_DISABLED
} exit_vcc_t;
typedef enum {
EXIT_RESET_UNSPEC,
EXIT_RESET_ENABLED,
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;
LISTID 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;
int page_size; /* page size if the programmer supports paged write/load */
int (*rdy_led) (struct programmer_t * pgm, int value);
int (*err_led) (struct programmer_t * pgm, int value);
int (*pgm_led) (struct programmer_t * pgm, int value);
int (*vfy_led) (struct programmer_t * pgm, int value);
int (*initialize) (struct programmer_t * pgm, AVRPART * p);
void (*display) (struct programmer_t * pgm, const char * p);
void (*enable) (struct programmer_t * pgm);
void (*disable) (struct programmer_t * pgm);
void (*powerup) (struct programmer_t * pgm);
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, 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,
unsigned int page_size, unsigned int baseaddr,
unsigned int n_bytes);
int (*paged_load) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m,
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);
int (*read_byte) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m,
unsigned long addr, unsigned char * value);
int (*read_sig_bytes) (struct programmer_t * pgm, AVRPART * p, AVRMEM * m);
void (*print_parms) (struct programmer_t * pgm);
int (*set_vtarget) (struct programmer_t * pgm, double v);
int (*set_varef) (struct programmer_t * pgm, unsigned int chan, double v);
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 pinfunc, int value);
int (*getpin) (struct programmer_t * pgm, int pinfunc);
int (*highpulsepin) (struct programmer_t * pgm, int pinfunc);
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;
#ifdef __cplusplus
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,
const char *cfgname, int cfglineno,
void *cookie);
void walk_programmers(LISTID programmers, walk_programmers_cb cb, void *cookie);
void sort_programmers(LISTID programmers);
#ifdef __cplusplus
}
#endif
/* formerly avr.h */
typedef void (*FP_UpdateProgress)(int percent, double etime, char *hdr);
extern struct avrpart parts[];
extern FP_UpdateProgress update_progress;
#ifdef __cplusplus
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, AVRPART * v);
int avr_write_page(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
unsigned long addr);
int avr_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * mem,
unsigned long addr, unsigned char data);
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 auto_erase);
int avr_signature(PROGRAMMER * pgm, AVRPART * p);
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_mem_hiaddr(AVRMEM * mem);
int avr_chip_erase(PROGRAMMER * pgm, AVRPART * p);
void report_progress (int completed, int total, char *hdr);
#ifdef __cplusplus
}
#endif
/* formerly fileio.h */
typedef enum {
FMT_AUTO,
FMT_SREC,
FMT_IHEX,
FMT_RBIN,
FMT_IMM,
FMT_HEX,
FMT_DEC,
FMT_OCT,
FMT_BIN,
FMT_ELF
} FILEFMT;
struct fioparms {
int op;
char * mode;
char * iodesc;
char * dir;
char * rw;
unsigned int fileoffset;
};
enum {
FIO_READ,
FIO_WRITE
};
#ifdef __cplusplus
extern "C" {
#endif
char * fmtstr(FILEFMT format);
int fileio(int op, char * filename, FILEFMT format,
struct avrpart * p, char * memtype, int size);
#ifdef __cplusplus
}
#endif
/* formerly safemode.h */
#ifdef __cplusplus
extern "C" {
#endif
/* Writes the specified fuse in fusename (can be "lfuse", "hfuse", or "efuse") and verifies it. Will try up to tries
amount of times before giving up */
int safemode_writefuse (unsigned char fuse, char * fusename, PROGRAMMER * pgm, AVRPART * p, int tries);
/* Reads the fuses three times, checking that all readings are the same. This will ensure that the before values aren't in error! */
int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse, unsigned char * efuse, unsigned char * fuse, PROGRAMMER * pgm, AVRPART * p);
/* This routine will store the current values pointed to by lfuse, hfuse, and efuse into an internal buffer in this routine
when save is set to 1. When save is 0 (or not 1 really) it will copy the values from the internal buffer into the locations
pointed to be lfuse, hfuse, and efuse. This allows you to change the fuse bits if needed from another routine (ie: have it so
if user requests fuse bits are changed, the requested value is now verified */
int safemode_memfuses (int save, unsigned char * lfuse, unsigned char * hfuse, unsigned char * efuse, unsigned char * fuse);
#ifdef __cplusplus
}
#endif
/* formerly update.h */
enum {
DEVICE_READ,
DEVICE_WRITE,
DEVICE_VERIFY
};
enum updateflags {
UF_NONE = 0,
UF_NOWRITE = 1,
UF_AUTO_ERASE = 2,
};
typedef struct update_t {
char * memtype;
int op;
char * filename;
int format;
} UPDATE;
#ifdef __cplusplus
extern "C" {
#endif
extern UPDATE * parse_op(char * s);
extern UPDATE * dup_update(UPDATE * upd);
extern UPDATE * new_update(int op, char * memtype, int filefmt,
char * filename);
extern void free_update(UPDATE * upd);
extern int do_op(PROGRAMMER * pgm, struct avrpart * p, UPDATE * upd,
enum updateflags flags);
#ifdef __cplusplus
}
#endif
/* formerly pgm_type.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
/* formerly config.h */
extern LISTID part_list;
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"
#ifdef __cplusplus
extern "C" {
#endif
int init_config(void);
void cleanup_config(void);
int read_config(const char * file);
#ifdef __cplusplus
}
#endif
/* formerly confwin.h */
#if defined(WIN32NATIVE)
#ifdef __cplusplus
extern "C" {
#endif
void win_sys_config_set(char sys_config[PATH_MAX]);
void win_usr_config_set(char usr_config[PATH_MAX]);
#ifdef __cplusplus
}
#endif
#endif /* WIN32NATIVE */
#endif /* libavrdude_h */

1412
main.c

File diff suppressed because it is too large Load Diff

View File

@ -1,48 +0,0 @@
/*
* avrdude - A Downloader/Uploader for AVR device programmers
* Copyright (C) 2006 Christian Starkjohann
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* $Id$ */
/*
The following is a replacement for hidsdi.h from the Windows DDK. It defines some
of the types and function prototypes of this header for our project. If you
have the Windows DDK version of this file or a version shipped with MinGW, use
that instead.
*/
#ifndef MY_DDK_HIDSDI_H
#define MY_DDK_HIDSDI_H
#include <pshpack4.h>
#include <ddk/hidusage.h>
#include <ddk/hidpi.h>
typedef struct{
ULONG Size;
USHORT VendorID;
USHORT ProductID;
USHORT VersionNumber;
}HIDD_ATTRIBUTES;
void __stdcall HidD_GetHidGuid(OUT LPGUID hidGuid);
BOOLEAN __stdcall HidD_GetAttributes(IN HANDLE device, OUT HIDD_ATTRIBUTES *attributes);
BOOLEAN __stdcall HidD_GetManufacturerString(IN HANDLE device, OUT void *buffer, IN ULONG bufferLen);
BOOLEAN __stdcall HidD_GetProductString(IN HANDLE device, OUT void *buffer, IN ULONG bufferLen);
BOOLEAN __stdcall HidD_GetSerialNumberString(IN HANDLE device, OUT void *buffer, IN ULONG bufferLen);
BOOLEAN __stdcall HidD_GetFeature(IN HANDLE device, OUT void *reportBuffer, IN ULONG bufferLen);
BOOLEAN __stdcall HidD_SetFeature(IN HANDLE device, IN void *reportBuffer, IN ULONG bufferLen);
BOOLEAN __stdcall HidD_GetNumInputBuffers(IN HANDLE device, OUT ULONG *numBuffers);
BOOLEAN __stdcall HidD_SetNumInputBuffers(IN HANDLE device, OUT ULONG numBuffers);
#include <poppack.h>
#endif /* MY_DDK_HIDSDI_H */

332
pgm.c
View File

@ -1,332 +0,0 @@
/*
* 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$ */
#include "ac_cfg.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "avrdude.h"
#include "libavrdude.h"
static int pgm_default_2 (struct programmer_t *, AVRPART *);
static int pgm_default_3 (struct programmer_t * pgm, AVRPART * p, AVRMEM * mem,
unsigned long addr, unsigned char * value);
static void pgm_default_4 (struct programmer_t *);
static int pgm_default_5 (struct programmer_t * pgm, AVRPART * p, AVRMEM * mem,
unsigned long addr, unsigned char data);
static void pgm_default_6 (struct programmer_t *, const char *);
static int pgm_default_open (struct programmer_t *pgm, char * name)
{
avrdude_message(MSG_INFO, "\n%s: Fatal error: Programmer does not support open()",
progname);
return -1;
}
static int pgm_default_led (struct programmer_t * pgm, int value)
{
/*
* If programmer has no LEDs, just do nothing.
*/
return 0;
}
static void pgm_default_powerup_powerdown (struct programmer_t * pgm)
{
/*
* If programmer does not support powerup/down, just do nothing.
*/
}
PROGRAMMER * pgm_new(void)
{
int i;
PROGRAMMER * pgm;
pgm = (PROGRAMMER *)malloc(sizeof(*pgm));
if (pgm == NULL) {
avrdude_message(MSG_INFO, "%s: out of memory allocating programmer structure\n",
progname);
return NULL;
}
memset(pgm, 0, sizeof(*pgm));
pgm->id = lcreat(NULL, 0);
pgm->usbpid = lcreat(NULL, 0);
pgm->desc[0] = 0;
pgm->type[0] = 0;
pgm->config_file[0] = 0;
pgm->lineno = 0;
pgm->baudrate = 0;
pgm->initpgm = NULL;
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
* whether they are assigned or not
*/
pgm->initialize = pgm_default_2;
pgm->display = pgm_default_6;
pgm->enable = pgm_default_4;
pgm->disable = pgm_default_4;
pgm->powerup = pgm_default_powerup_powerdown;
pgm->powerdown = pgm_default_powerup_powerdown;
pgm->program_enable = pgm_default_2;
pgm->chip_erase = pgm_default_2;
pgm->open = pgm_default_open;
pgm->close = pgm_default_4;
pgm->read_byte = pgm_default_3;
pgm->write_byte = pgm_default_5;
/*
* predefined functions - these functions have a valid default
* implementation. Hence, they don't need to be defined in
* the programmer.
*/
pgm->rdy_led = pgm_default_led;
pgm->err_led = pgm_default_led;
pgm->pgm_led = pgm_default_led;
pgm->vfy_led = pgm_default_led;
/*
* optional functions - these are checked to make sure they are
* 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;
pgm->read_sig_bytes = NULL;
pgm->set_vtarget = NULL;
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);
ldestroy_cb(p->usbpid, free);
p->id = NULL;
p->usbpid = 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;
LNODEID ln;
pgm = (PROGRAMMER *)malloc(sizeof(*pgm));
if (pgm == NULL) {
avrdude_message(MSG_INFO, "%s: out of memory allocating programmer structure\n",
progname);
return NULL;
}
memcpy(pgm, src, sizeof(*pgm));
pgm->id = lcreat(NULL, 0);
pgm->usbpid = lcreat(NULL, 0);
for (ln = lfirst(src->usbpid); ln; ln = lnext(ln)) {
int *ip = malloc(sizeof(int));
if (ip == NULL) {
avrdude_message(MSG_INFO, "%s: out of memory allocating programmer structure\n",
progname);
exit(1);
}
*ip = *(int *) ldata(ln);
ladd(pgm->usbpid, ip);
}
return pgm;
}
static void pgm_default(void)
{
avrdude_message(MSG_INFO, "%s: programmer operation not supported\n", progname);
}
static int pgm_default_2 (struct programmer_t * pgm, AVRPART * p)
{
pgm_default();
return -1;
}
static int pgm_default_3 (struct programmer_t * pgm, AVRPART * p, AVRMEM * mem,
unsigned long addr, unsigned char * value)
{
pgm_default();
return -1;
}
static void pgm_default_4 (struct programmer_t * pgm)
{
pgm_default();
}
static int pgm_default_5 (struct programmer_t * pgm, AVRPART * p, AVRMEM * mem,
unsigned long addr, unsigned char data)
{
pgm_default();
return -1;
}
static void pgm_default_6 (struct programmer_t * pgm, const char * p)
{
pgm_default();
}
void programmer_display(PROGRAMMER * pgm, const char * p)
{
avrdude_message(MSG_INFO, "%sProgrammer Type : %s\n", p, pgm->type);
avrdude_message(MSG_INFO, "%sDescription : %s\n", p, pgm->desc);
pgm->display(pgm, p);
}
void pgm_display_generic_mask(PROGRAMMER * pgm, const char * p, unsigned int show)
{
if(show & (1<<PPI_AVR_VCC))
avrdude_message(MSG_INFO, "%s VCC = %s\n", p, pins_to_str(&pgm->pin[PPI_AVR_VCC]));
if(show & (1<<PPI_AVR_BUFF))
avrdude_message(MSG_INFO, "%s BUFF = %s\n", p, pins_to_str(&pgm->pin[PPI_AVR_BUFF]));
if(show & (1<<PIN_AVR_RESET))
avrdude_message(MSG_INFO, "%s RESET = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_RESET]));
if(show & (1<<PIN_AVR_SCK))
avrdude_message(MSG_INFO, "%s SCK = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_SCK]));
if(show & (1<<PIN_AVR_MOSI))
avrdude_message(MSG_INFO, "%s MOSI = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_MOSI]));
if(show & (1<<PIN_AVR_MISO))
avrdude_message(MSG_INFO, "%s MISO = %s\n", p, pins_to_str(&pgm->pin[PIN_AVR_MISO]));
if(show & (1<<PIN_LED_ERR))
avrdude_message(MSG_INFO, "%s ERR LED = %s\n", p, pins_to_str(&pgm->pin[PIN_LED_ERR]));
if(show & (1<<PIN_LED_RDY))
avrdude_message(MSG_INFO, "%s RDY LED = %s\n", p, pins_to_str(&pgm->pin[PIN_LED_RDY]));
if(show & (1<<PIN_LED_PGM))
avrdude_message(MSG_INFO, "%s PGM LED = %s\n", p, pins_to_str(&pgm->pin[PIN_LED_PGM]));
if(show & (1<<PIN_LED_VFY))
avrdude_message(MSG_INFO, "%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;
PROGRAMMER * p = NULL;
const char * id;
int found;
found = 0;
for (ln1=lfirst(programmers); ln1 && !found; ln1=lnext(ln1)) {
p = ldata(ln1);
for (ln2=lfirst(p->id); ln2 && !found; ln2=lnext(ln2)) {
id = ldata(ln2);
if (strcasecmp(configid, 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_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);
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);
}

View File

@ -1,153 +0,0 @@
/*
* 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 "libavrdude.h"
#include "arduino.h"
#include "avr910.h"
#include "avrftdi.h"
#include "buspirate.h"
#include "butterfly.h"
#include "flip1.h"
#include "flip2.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 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},
{"flip1", flip1_initpgm, flip1_desc},
{"flip2", flip2_initpgm, flip2_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);
}
}

View File

@ -1,318 +0,0 @@
/*
* avrdude - A Downloader/Uploader for AVR device programmers
* avrdude is Copyright (C) 2000-2004 Brian S. Dean <bsd@bsdhome.com>
*
* This file: Copyright (C) 2005-2007 Colin O'Flynn <coflynn@newae.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "ac_cfg.h"
#include "avrdude.h"
#include "libavrdude.h"
/* This value from ac_cfg.h */
/*
* Writes the specified fuse in fusename (can be "lfuse", "hfuse", or
* "efuse") and verifies it. Will try up to tries amount of times
* before giving up
*/
int safemode_writefuse (unsigned char fuse, char * fusename, PROGRAMMER * pgm,
AVRPART * p, int tries)
{
AVRMEM * m;
unsigned char fuseread;
int returnvalue = -1;
m = avr_locate_mem(p, fusename);
if (m == NULL) {
return -1;
}
/* Keep trying to write then read back the fuse values */
while (tries > 0) {
if (avr_write_byte(pgm, p, m, 0, fuse) != 0)
{
continue;
}
if (pgm->read_byte(pgm, p, m, 0, &fuseread) != 0)
{
continue;
}
/* Report information to user if needed */
avrdude_message(MSG_NOTICE, "%s: safemode: Wrote %s to %x, read as %x. %d attempts left\n",
progname, fusename, fuse, fuseread, tries-1);
/* If fuse wrote OK, no need to keep going */
if (fuse == fuseread) {
tries = 0;
returnvalue = 0;
}
tries--;
}
return returnvalue;
}
/*
* Reads the fuses three times, checking that all readings are the
* same. This will ensure that the before values aren't in error!
*/
int safemode_readfuses (unsigned char * lfuse, unsigned char * hfuse,
unsigned char * efuse, unsigned char * fuse,
PROGRAMMER * pgm, AVRPART * p)
{
unsigned char value;
unsigned char fusegood = 0;
unsigned char allowfuseread = 1;
unsigned char safemode_lfuse;
unsigned char safemode_hfuse;
unsigned char safemode_efuse;
unsigned char safemode_fuse;
AVRMEM * m;
safemode_lfuse = *lfuse;
safemode_hfuse = *hfuse;
safemode_efuse = *efuse;
safemode_fuse = *fuse;
/* Read fuse three times */
fusegood = 2; /* If AVR device doesn't support this fuse, don't want
to generate a verify error */
m = avr_locate_mem(p, "fuse");
if (m != NULL) {
fusegood = 0; /* By default fuse is a failure */
if(pgm->read_byte(pgm, p, m, 0, &safemode_fuse) != 0)
{
allowfuseread = 0;
}
avrdude_message(MSG_DEBUG, "%s: safemode read 1, fuse value: %x\n",progname, safemode_fuse);
if(pgm->read_byte(pgm, p, m, 0, &value) != 0)
{
allowfuseread = 0;
}
avrdude_message(MSG_DEBUG, "%s: safemode read 2, fuse value: %x\n",progname, value);
if (value == safemode_fuse) {
if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
{
allowfuseread = 0;
}
avrdude_message(MSG_DEBUG, "%s: safemode read 3, fuse value: %x\n",progname, value);
if (value == safemode_fuse)
{
fusegood = 1; /* Fuse read OK three times */
}
}
}
//Programmer does not allow fuse reading.... no point trying anymore
if (allowfuseread == 0)
{
return -5;
}
if (fusegood == 0) {
avrdude_message(MSG_INFO, "%s: safemode: Verify error - unable to read fuse properly. "
"Programmer may not be reliable.\n", progname);
return -1;
}
else if (fusegood == 1) {
avrdude_message(MSG_NOTICE, "%s: safemode: fuse reads as %X\n", progname, safemode_fuse);
}
/* Read lfuse three times */
fusegood = 2; /* If AVR device doesn't support this fuse, don't want
to generate a verify error */
m = avr_locate_mem(p, "lfuse");
if (m != NULL) {
fusegood = 0; /* By default fuse is a failure */
if (pgm->read_byte(pgm, p, m, 0, &safemode_lfuse) != 0)
{
allowfuseread = 0;
}
avrdude_message(MSG_DEBUG, "%s: safemode read 1, lfuse value: %x\n",progname, safemode_lfuse);
if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
{
allowfuseread = 0;
}
avrdude_message(MSG_DEBUG, "%s: safemode read 2, lfuse value: %x\n",progname, value);
if (value == safemode_lfuse) {
if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
{
allowfuseread = 0;
}
avrdude_message(MSG_DEBUG, "%s: safemode read 3, lfuse value: %x\n",progname, value);
if (value == safemode_lfuse){
fusegood = 1; /* Fuse read OK three times */
}
}
}
//Programmer does not allow fuse reading.... no point trying anymore
if (allowfuseread == 0)
{
return -5;
}
if (fusegood == 0) {
avrdude_message(MSG_INFO, "%s: safemode: Verify error - unable to read lfuse properly. "
"Programmer may not be reliable.\n", progname);
return -1;
}
else if (fusegood == 1) {
avrdude_message(MSG_DEBUG, "%s: safemode: lfuse reads as %X\n", progname, safemode_lfuse);
}
/* Read hfuse three times */
fusegood = 2; /* If AVR device doesn't support this fuse, don't want
to generate a verify error */
m = avr_locate_mem(p, "hfuse");
if (m != NULL) {
fusegood = 0; /* By default fuse is a failure */
if (pgm->read_byte(pgm, p, m, 0, &safemode_hfuse) != 0)
{
allowfuseread = 0;
}
avrdude_message(MSG_DEBUG, "%s: safemode read 1, hfuse value: %x\n",progname, safemode_hfuse);
if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
{
allowfuseread = 0;
}
avrdude_message(MSG_DEBUG, "%s: safemode read 2, hfuse value: %x\n",progname, value);
if (value == safemode_hfuse) {
if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
{
allowfuseread = 0;
}
avrdude_message(MSG_DEBUG, "%s: safemode read 3, hfuse value: %x\n",progname, value);
if (value == safemode_hfuse){
fusegood = 1; /* Fuse read OK three times */
}
}
}
//Programmer does not allow fuse reading.... no point trying anymore
if (allowfuseread == 0)
{
return -5;
}
if (fusegood == 0) {
avrdude_message(MSG_INFO, "%s: safemode: Verify error - unable to read hfuse properly. "
"Programmer may not be reliable.\n", progname);
return -2;
}
else if (fusegood == 1){
avrdude_message(MSG_NOTICE, "%s: safemode: hfuse reads as %X\n", progname, safemode_hfuse);
}
/* Read efuse three times */
fusegood = 2; /* If AVR device doesn't support this fuse, don't want
to generate a verify error */
m = avr_locate_mem(p, "efuse");
if (m != NULL) {
fusegood = 0; /* By default fuse is a failure */
if (pgm->read_byte(pgm, p, m, 0, &safemode_efuse) != 0)
{
allowfuseread = 0;
}
avrdude_message(MSG_DEBUG, "%s: safemode read 1, efuse value: %x\n",progname, safemode_efuse);
if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
{
allowfuseread = 0;
}
avrdude_message(MSG_DEBUG, "%s: safemode read 2, efuse value: %x\n",progname, value);
if (value == safemode_efuse) {
if (pgm->read_byte(pgm, p, m, 0, &value) != 0)
{
allowfuseread = 0;
}
avrdude_message(MSG_DEBUG, "%s: safemode read 3, efuse value: %x\n",progname, value);
if (value == safemode_efuse){
fusegood = 1; /* Fuse read OK three times */
}
}
}
//Programmer does not allow fuse reading.... no point trying anymore
if (allowfuseread == 0)
{
return -5;
}
if (fusegood == 0) {
avrdude_message(MSG_INFO, "%s: safemode: Verify error - unable to read efuse properly. "
"Programmer may not be reliable.\n", progname);
return -3;
}
else if (fusegood == 1) {
avrdude_message(MSG_NOTICE, "%s: safemode: efuse reads as %X\n", progname, safemode_efuse);
}
*lfuse = safemode_lfuse;
*hfuse = safemode_hfuse;
*efuse = safemode_efuse;
*fuse = safemode_fuse;
return 0;
}
/*
* This routine will store the current values pointed to by lfuse,
* hfuse, and efuse into an internal buffer in this routine when save
* is set to 1. When save is 0 (or not 1 really) it will copy the
* values from the internal buffer into the locations pointed to be
* lfuse, hfuse, and efuse. This allows you to change the fuse bits if
* needed from another routine (ie: have it so if user requests fuse
* bits are changed, the requested value is now verified
*/
int safemode_memfuses (int save, unsigned char * lfuse, unsigned char * hfuse,
unsigned char * efuse, unsigned char * fuse)
{
static unsigned char safemode_lfuse = 0xff;
static unsigned char safemode_hfuse = 0xff;
static unsigned char safemode_efuse = 0xff;
static unsigned char safemode_fuse = 0xff;
switch (save) {
/* Save the fuses as safemode setting */
case 1:
safemode_lfuse = *lfuse;
safemode_hfuse = *hfuse;
safemode_efuse = *efuse;
safemode_fuse = *fuse;
break;
/* Read back the fuses */
default:
*lfuse = safemode_lfuse;
*hfuse = safemode_hfuse;
*efuse = safemode_efuse;
*fuse = safemode_fuse;
break;
}
return 0;
}

View File

@ -1,661 +0,0 @@
/*
* avrdude - A Downloader/Uploader for AVR device programmers
* Copyright (C) 2003-2004 Theodore A. Roth <troth@openavr.org>
* Copyright (C) 2006 Joerg Wunsch <j@uriah.heep.sax.de>
* Copyright (C) 2006 Christian Starkjohann
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* $Id$ */
/*
* Serial Interface emulation for USB programmer "AVR-Doper" in HID mode.
*/
#include "ac_cfg.h"
#if defined(HAVE_LIBUSB) || (defined(WIN32NATIVE) && defined(HAVE_LIBHID))
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "avrdude.h"
#include "libavrdude.h"
/* ------------------------------------------------------------------------ */
/* Numeric constants for 'reportType' parameters */
#define USB_HID_REPORT_TYPE_INPUT 1
#define USB_HID_REPORT_TYPE_OUTPUT 2
#define USB_HID_REPORT_TYPE_FEATURE 3
/* These are the error codes which can be returned by functions of this
* module.
*/
#define USB_ERROR_NONE 0
#define USB_ERROR_ACCESS 1
#define USB_ERROR_NOTFOUND 2
#define USB_ERROR_BUSY 16
#define USB_ERROR_IO 5
#define USB_VENDOR_ID 0x16c0
#define USB_PRODUCT_ID 0x05df
static int reportDataSizes[4] = {13, 29, 61, 125};
static unsigned char avrdoperRxBuffer[280]; /* buffer for receive data */
static int avrdoperRxLength = 0; /* amount of valid bytes in rx buffer */
static int avrdoperRxPosition = 0; /* amount of bytes already consumed in rx buffer */
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
#if defined(WIN32NATIVE) && defined(HAVE_LIBHID)
#include <windows.h>
#include <setupapi.h>
#if defined(HAVE_DDK_HIDSDI_H)
# include <ddk/hidsdi.h>
#else
# include "my_ddk_hidsdi.h"
#endif
#include <ddk/hidpi.h>
#ifdef USB_DEBUG
#define DEBUG_PRINT(arg) printf arg
#else
#define DEBUG_PRINT(arg)
#endif
/* ------------------------------------------------------------------------ */
static void convertUniToAscii(char *buffer)
{
unsigned short *uni = (void *)buffer;
char *ascii = buffer;
while(*uni != 0){
if(*uni >= 256){
*ascii++ = '?';
uni++;
}else{
*ascii++ = *uni++;
}
}
*ascii++ = 0;
}
static int usbOpenDevice(union filedescriptor *fdp, int vendor, char *vendorName,
int product, char *productName, int usesReportIDs)
{
GUID hidGuid; /* GUID for HID driver */
HDEVINFO deviceInfoList;
SP_DEVICE_INTERFACE_DATA deviceInfo;
SP_DEVICE_INTERFACE_DETAIL_DATA *deviceDetails = NULL;
DWORD size;
int i, openFlag = 0; /* may be FILE_FLAG_OVERLAPPED */
int errorCode = USB_ERROR_NOTFOUND;
HANDLE handle = INVALID_HANDLE_VALUE;
HIDD_ATTRIBUTES deviceAttributes;
HidD_GetHidGuid(&hidGuid);
deviceInfoList = SetupDiGetClassDevs(&hidGuid, NULL, NULL,
DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
deviceInfo.cbSize = sizeof(deviceInfo);
for(i=0;;i++){
if(handle != INVALID_HANDLE_VALUE){
CloseHandle(handle);
handle = INVALID_HANDLE_VALUE;
}
if(!SetupDiEnumDeviceInterfaces(deviceInfoList, 0, &hidGuid, i, &deviceInfo))
break; /* no more entries */
/* first do a dummy call just to determine the actual size required */
SetupDiGetDeviceInterfaceDetail(deviceInfoList, &deviceInfo, NULL, 0, &size, NULL);
if(deviceDetails != NULL)
free(deviceDetails);
deviceDetails = malloc(size);
deviceDetails->cbSize = sizeof(*deviceDetails);
/* this call is for real: */
SetupDiGetDeviceInterfaceDetail(deviceInfoList, &deviceInfo, deviceDetails,
size, &size, NULL);
DEBUG_PRINT(("checking HID path \"%s\"\n", deviceDetails->DevicePath));
/* attempt opening for R/W -- we don't care about devices which can't be accessed */
handle = CreateFile(deviceDetails->DevicePath, GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
openFlag, NULL);
if(handle == INVALID_HANDLE_VALUE){
DEBUG_PRINT(("opening failed: %d\n", (int)GetLastError()));
/* errorCode = USB_ERROR_ACCESS; opening will always fail for mouse -- ignore */
continue;
}
deviceAttributes.Size = sizeof(deviceAttributes);
HidD_GetAttributes(handle, &deviceAttributes);
DEBUG_PRINT(("device attributes: vid=%d pid=%d\n",
deviceAttributes.VendorID, deviceAttributes.ProductID));
if(deviceAttributes.VendorID != vendor || deviceAttributes.ProductID != product)
continue; /* ignore this device */
errorCode = USB_ERROR_NOTFOUND;
if(vendorName != NULL && productName != NULL){
char buffer[512];
if(!HidD_GetManufacturerString(handle, buffer, sizeof(buffer))){
DEBUG_PRINT(("error obtaining vendor name\n"));
errorCode = USB_ERROR_IO;
continue;
}
convertUniToAscii(buffer);
DEBUG_PRINT(("vendorName = \"%s\"\n", buffer));
if(strcmp(vendorName, buffer) != 0)
continue;
if(!HidD_GetProductString(handle, buffer, sizeof(buffer))){
DEBUG_PRINT(("error obtaining product name\n"));
errorCode = USB_ERROR_IO;
continue;
}
convertUniToAscii(buffer);
DEBUG_PRINT(("productName = \"%s\"\n", buffer));
if(strcmp(productName, buffer) != 0)
continue;
}
break; /* we have found the device we are looking for! */
}
SetupDiDestroyDeviceInfoList(deviceInfoList);
if(deviceDetails != NULL)
free(deviceDetails);
if(handle != INVALID_HANDLE_VALUE){
fdp->pfd = (void *)handle;
errorCode = 0;
}
return errorCode;
}
/* ------------------------------------------------------------------------ */
static void usbCloseDevice(union filedescriptor *fdp)
{
CloseHandle((HANDLE)fdp->pfd);
}
/* ------------------------------------------------------------------------ */
static int usbSetReport(union filedescriptor *fdp, int reportType, char *buffer, int len)
{
HANDLE handle = (HANDLE)fdp->pfd;
BOOLEAN rval = 0;
DWORD bytesWritten;
switch(reportType){
case USB_HID_REPORT_TYPE_INPUT:
break;
case USB_HID_REPORT_TYPE_OUTPUT:
rval = WriteFile(handle, buffer, len, &bytesWritten, NULL);
break;
case USB_HID_REPORT_TYPE_FEATURE:
rval = HidD_SetFeature(handle, buffer, len);
break;
}
return rval == 0 ? USB_ERROR_IO : 0;
}
/* ------------------------------------------------------------------------ */
static int usbGetReport(union filedescriptor *fdp, int reportType, int reportNumber,
char *buffer, int *len)
{
HANDLE handle = (HANDLE)fdp->pfd;
BOOLEAN rval = 0;
DWORD bytesRead;
switch(reportType){
case USB_HID_REPORT_TYPE_INPUT:
buffer[0] = reportNumber;
rval = ReadFile(handle, buffer, *len, &bytesRead, NULL);
if(rval)
*len = bytesRead;
break;
case USB_HID_REPORT_TYPE_OUTPUT:
break;
case USB_HID_REPORT_TYPE_FEATURE:
buffer[0] = reportNumber;
rval = HidD_GetFeature(handle, buffer, *len);
break;
}
return rval == 0 ? USB_ERROR_IO : 0;
}
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
#else /* !(WIN32NATIVE && HAVE_LIBHID) */
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
#if defined(HAVE_USB_H)
# include <usb.h>
#elif defined(HAVE_LUSB0_USB_H)
# include <lusb0_usb.h>
#else
# error "libusb needs either <usb.h> or <lusb0_usb.h>"
#endif
/* ------------------------------------------------------------------------- */
#define USBRQ_HID_GET_REPORT 0x01
#define USBRQ_HID_SET_REPORT 0x09
static int usesReportIDs;
/* ------------------------------------------------------------------------- */
static int usbGetStringAscii(usb_dev_handle *dev, int index, int langid, char *buf, int buflen)
{
char buffer[256];
int rval, i;
if((rval = usb_control_msg(dev, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR,
(USB_DT_STRING << 8) + index, langid, buffer,
sizeof(buffer), 1000)) < 0)
return rval;
if(buffer[1] != USB_DT_STRING)
return 0;
if((unsigned char)buffer[0] < rval)
rval = (unsigned char)buffer[0];
rval /= 2;
/* lossy conversion to ISO Latin1 */
for(i=1;i<rval;i++){
if(i > buflen) /* destination buffer overflow */
break;
buf[i-1] = buffer[2 * i];
if(buffer[2 * i + 1] != 0) /* outside of ISO Latin1 range */
buf[i-1] = '?';
}
buf[i-1] = 0;
return i-1;
}
static int usbOpenDevice(union filedescriptor *fdp, int vendor, char *vendorName,
int product, char *productName, int doReportIDs)
{
struct usb_bus *bus;
struct usb_device *dev;
usb_dev_handle *handle = NULL;
int errorCode = USB_ERROR_NOTFOUND;
static int didUsbInit = 0;
if(!didUsbInit){
usb_init();
didUsbInit = 1;
}
usb_find_busses();
usb_find_devices();
for(bus=usb_get_busses(); bus; bus=bus->next){
for(dev=bus->devices; dev; dev=dev->next){
if(dev->descriptor.idVendor == vendor && dev->descriptor.idProduct == product){
char string[256];
int len;
handle = usb_open(dev); /* we need to open the device in order to query strings */
if(!handle){
errorCode = USB_ERROR_ACCESS;
avrdude_message(MSG_INFO, "Warning: cannot open USB device: %s\n",
usb_strerror());
continue;
}
if(vendorName == NULL && productName == NULL){ /* name does not matter */
break;
}
/* now check whether the names match: */
len = usbGetStringAscii(handle, dev->descriptor.iManufacturer,
0x0409, string, sizeof(string));
if(len < 0){
errorCode = USB_ERROR_IO;
avrdude_message(MSG_INFO, "Warning: cannot query manufacturer for device: %s\n",
usb_strerror());
}else{
errorCode = USB_ERROR_NOTFOUND;
/* avrdude_message(MSG_INFO, "seen device from vendor ->%s<-\n", string); */
if(strcmp(string, vendorName) == 0){
len = usbGetStringAscii(handle, dev->descriptor.iProduct,
0x0409, string, sizeof(string));
if(len < 0){
errorCode = USB_ERROR_IO;
avrdude_message(MSG_INFO, "Warning: cannot query product for device: %s\n",
usb_strerror());
}else{
errorCode = USB_ERROR_NOTFOUND;
/* avrdude_message(MSG_INFO, "seen product ->%s<-\n", string); */
if(strcmp(string, productName) == 0)
break;
}
}
}
usb_close(handle);
handle = NULL;
}
}
if(handle)
break;
}
if(handle != NULL){
int rval, retries = 3;
if(usb_set_configuration(handle, 1)){
avrdude_message(MSG_INFO, "Warning: could not set configuration: %s\n",
usb_strerror());
}
/* now try to claim the interface and detach the kernel HID driver on
* linux and other operating systems which support the call.
*/
while((rval = usb_claim_interface(handle, 0)) != 0 && retries-- > 0){
#ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
if(usb_detach_kernel_driver_np(handle, 0) < 0){
avrdude_message(MSG_INFO, "Warning: could not detach kernel HID driver: %s\n",
usb_strerror());
}
#endif
}
if(rval != 0)
avrdude_message(MSG_INFO, "Warning: could not claim interface\n");
/* Continue anyway, even if we could not claim the interface. Control transfers
* should still work.
*/
errorCode = 0;
fdp->pfd = (void *)handle;
usesReportIDs = doReportIDs;
}
return errorCode;
}
/* ------------------------------------------------------------------------- */
static void usbCloseDevice(union filedescriptor *fdp)
{
usb_close((usb_dev_handle *)fdp->pfd);
}
/* ------------------------------------------------------------------------- */
static int usbSetReport(union filedescriptor *fdp, int reportType, char *buffer, int len)
{
int bytesSent;
if(!usesReportIDs){
buffer++; /* skip dummy report ID */
len--;
}
bytesSent = usb_control_msg((usb_dev_handle *)fdp->pfd, USB_TYPE_CLASS |
USB_RECIP_INTERFACE | USB_ENDPOINT_OUT, USBRQ_HID_SET_REPORT,
reportType << 8 | buffer[0], 0, buffer, len, 5000);
if(bytesSent != len){
if(bytesSent < 0)
avrdude_message(MSG_INFO, "Error sending message: %s\n", usb_strerror());
return USB_ERROR_IO;
}
return 0;
}
/* ------------------------------------------------------------------------- */
static int usbGetReport(union filedescriptor *fdp, int reportType, int reportNumber,
char *buffer, int *len)
{
int bytesReceived, maxLen = *len;
if(!usesReportIDs){
buffer++; /* make room for dummy report ID */
maxLen--;
}
bytesReceived = usb_control_msg((usb_dev_handle *)fdp->pfd, USB_TYPE_CLASS |
USB_RECIP_INTERFACE | USB_ENDPOINT_IN, USBRQ_HID_GET_REPORT,
reportType << 8 | reportNumber, 0, buffer, maxLen, 5000);
if(bytesReceived < 0){
avrdude_message(MSG_INFO, "Error sending message: %s\n", usb_strerror());
return USB_ERROR_IO;
}
*len = bytesReceived;
if(!usesReportIDs){
buffer[-1] = reportNumber; /* add dummy report ID */
len++;
}
return 0;
}
#endif /* WIN32NATIVE */
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------- */
static void dumpBlock(const char *prefix, const unsigned char *buf, int len)
{
int i;
if(len <= 8){ /* more compact format for short blocks */
avrdude_message(MSG_INFO, "%s: %d bytes: ", prefix, len);
for(i = 0; i < len; i++){
avrdude_message(MSG_INFO, "%02x ", buf[i]);
}
avrdude_message(MSG_INFO, " \"");
for(i = 0; i < len; i++){
if(buf[i] >= 0x20 && buf[i] < 0x7f){
fputc(buf[i], stderr);
}else{
fputc('.', stderr);
}
}
avrdude_message(MSG_INFO, "\"\n");
}else{
avrdude_message(MSG_INFO, "%s: %d bytes:\n", prefix, len);
while(len > 0){
for(i = 0; i < 16; i++){
if(i < len){
avrdude_message(MSG_INFO, "%02x ", buf[i]);
}else{
avrdude_message(MSG_INFO, " ");
}
if(i == 7)
fputc(' ', stderr);
}
avrdude_message(MSG_INFO, " \"");
for(i = 0; i < 16; i++){
if(i < len){
if(buf[i] >= 0x20 && buf[i] < 0x7f){
fputc(buf[i], stderr);
}else{
fputc('.', stderr);
}
}
}
avrdude_message(MSG_INFO, "\"\n");
buf += 16;
len -= 16;
}
}
}
static char *usbErrorText(int usbErrno)
{
static char buffer[32];
switch(usbErrno){
case USB_ERROR_NONE: return "Success.";
case USB_ERROR_ACCESS: return "Access denied.";
case USB_ERROR_NOTFOUND:return "Device not found.";
case USB_ERROR_BUSY: return "Device is busy.";
case USB_ERROR_IO: return "I/O Error.";
default:
sprintf(buffer, "Unknown error %d.", usbErrno);
return buffer;
}
}
/* ------------------------------------------------------------------------- */
static int avrdoper_open(char *port, union pinfo pinfo, union filedescriptor *fdp)
{
int rval;
char *vname = "obdev.at";
char *devname = "AVR-Doper";
rval = usbOpenDevice(fdp, USB_VENDOR_ID, vname, USB_PRODUCT_ID, devname, 1);
if(rval != 0){
avrdude_message(MSG_INFO, "%s: avrdoper_open(): %s\n", progname, usbErrorText(rval));
return -1;
}
return 0;
}
/* ------------------------------------------------------------------------- */
static void avrdoper_close(union filedescriptor *fdp)
{
usbCloseDevice(fdp);
}
/* ------------------------------------------------------------------------- */
static int chooseDataSize(int len)
{
int i;
for(i = 0; i < sizeof(reportDataSizes)/sizeof(reportDataSizes[0]); i++){
if(reportDataSizes[i] >= len)
return i;
}
return i - 1;
}
static int avrdoper_send(union filedescriptor *fdp, const unsigned char *buf, size_t buflen)
{
if(verbose > 3)
dumpBlock("Send", buf, buflen);
while(buflen > 0){
unsigned char buffer[256];
int rval, lenIndex = chooseDataSize(buflen);
int thisLen = buflen > reportDataSizes[lenIndex] ?
reportDataSizes[lenIndex] : buflen;
buffer[0] = lenIndex + 1; /* report ID */
buffer[1] = thisLen;
memcpy(buffer + 2, buf, thisLen);
avrdude_message(MSG_TRACE, "Sending %d bytes data chunk\n", thisLen);
rval = usbSetReport(fdp, USB_HID_REPORT_TYPE_FEATURE, (char *)buffer,
reportDataSizes[lenIndex] + 2);
if(rval != 0){
avrdude_message(MSG_INFO, "%s: avrdoper_send(): %s\n", progname, usbErrorText(rval));
return -1;
}
buflen -= thisLen;
buf += thisLen;
}
return 0;
}
/* ------------------------------------------------------------------------- */
static int avrdoperFillBuffer(union filedescriptor *fdp)
{
int bytesPending = reportDataSizes[1]; /* guess how much data is buffered in device */
avrdoperRxPosition = avrdoperRxLength = 0;
while(bytesPending > 0){
int len, usbErr, lenIndex = chooseDataSize(bytesPending);
unsigned char buffer[128];
len = sizeof(avrdoperRxBuffer) - avrdoperRxLength; /* bytes remaining */
if(reportDataSizes[lenIndex] + 2 > len) /* requested data would not fit into buffer */
break;
len = reportDataSizes[lenIndex] + 2;
usbErr = usbGetReport(fdp, USB_HID_REPORT_TYPE_FEATURE, lenIndex + 1,
(char *)buffer, &len);
if(usbErr != 0){
avrdude_message(MSG_INFO, "%s: avrdoperFillBuffer(): %s\n", progname, usbErrorText(usbErr));
return -1;
}
avrdude_message(MSG_TRACE, "Received %d bytes data chunk of total %d\n", len - 2, buffer[1]);
len -= 2; /* compensate for report ID and length byte */
bytesPending = buffer[1] - len; /* amount still buffered */
if(len > buffer[1]) /* cut away padding */
len = buffer[1];
if(avrdoperRxLength + len > sizeof(avrdoperRxBuffer)){
avrdude_message(MSG_INFO, "%s: avrdoperFillBuffer(): internal error: buffer overflow\n",
progname);
return -1;
}
memcpy(avrdoperRxBuffer + avrdoperRxLength, buffer + 2, len);
avrdoperRxLength += len;
}
return 0;
}
static int avrdoper_recv(union filedescriptor *fdp, unsigned char *buf, size_t buflen)
{
unsigned char *p = buf;
int remaining = buflen;
while(remaining > 0){
int len, available = avrdoperRxLength - avrdoperRxPosition;
if(available <= 0){ /* buffer is empty */
if (avrdoperFillBuffer(fdp) < 0)
return -1;
continue;
}
len = remaining < available ? remaining : available;
memcpy(p, avrdoperRxBuffer + avrdoperRxPosition, len);
p += len;
remaining -= len;
avrdoperRxPosition += len;
}
if(verbose > 3)
dumpBlock("Receive", buf, buflen);
return 0;
}
/* ------------------------------------------------------------------------- */
static int avrdoper_drain(union filedescriptor *fdp, int display)
{
do{
if (avrdoperFillBuffer(fdp) < 0)
return -1;
}while(avrdoperRxLength > 0);
return 0;
}
/* ------------------------------------------------------------------------- */
static int avrdoper_set_dtr_rts(union filedescriptor *fdp, int is_on)
{
avrdude_message(MSG_INFO, "%s: AVR-Doper doesn't support DTR/RTS setting\n", progname);
return -1;
}
/* ------------------------------------------------------------------------- */
struct serial_device avrdoper_serdev =
{
.open = avrdoper_open,
.close = avrdoper_close,
.send = avrdoper_send,
.recv = avrdoper_recv,
.drain = avrdoper_drain,
.set_dtr_rts = avrdoper_set_dtr_rts,
.flags = SERDEV_FL_NONE,
};
#endif /* defined(HAVE_LIBUSB) || (defined(WIN32NATIVE) && defined(HAVE_LIBHID)) */

View File

@ -1,497 +0,0 @@
/*
* avrdude - A Downloader/Uploader for AVR device programmers
* Copyright (C) 2003-2004 Theodore A. Roth <troth@openavr.org>
* Copyright (C) 2006 Joerg Wunsch <j@uriah.heep.sax.de>
*
* 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$ */
/*
* Posix serial interface for avrdude.
*/
#if !defined(WIN32NATIVE)
#include <ctype.h>
#include <stdio.h>
#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>
#include <netdb.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <termios.h>
#include <unistd.h>
#include "avrdude.h"
#include "libavrdude.h"
long serial_recv_timeout = 5000; /* ms */
struct baud_mapping {
long baud;
speed_t speed;
};
/* There are a lot more baud rates we could handle, but what's the point? */
static struct baud_mapping baud_lookup_table [] = {
{ 1200, B1200 },
{ 2400, B2400 },
{ 4800, B4800 },
{ 9600, B9600 },
{ 19200, B19200 },
{ 38400, B38400 },
#ifdef B57600
{ 57600, B57600 },
#endif
#ifdef B115200
{ 115200, B115200 },
#endif
#ifdef B230400
{ 230400, B230400 },
#endif
{ 0, 0 } /* Terminator. */
};
static struct termios original_termios;
static int saved_original_termios;
static speed_t serial_baud_lookup(long baud)
{
struct baud_mapping *map = baud_lookup_table;
while (map->baud) {
if (map->baud == baud)
return map->speed;
map++;
}
/*
* If a non-standard BAUD rate is used, issue
* a warning (if we are verbose) and return the raw rate
*/
avrdude_message(MSG_NOTICE, "%s: serial_baud_lookup(): Using non-standard baud rate: %ld",
progname, baud);
return baud;
}
static int ser_setspeed(union filedescriptor *fd, long baud)
{
int rc;
struct termios termios;
speed_t speed = serial_baud_lookup (baud);
if (!isatty(fd->ifd))
return -ENOTTY;
/*
* initialize terminal modes
*/
rc = tcgetattr(fd->ifd, &termios);
if (rc < 0) {
avrdude_message(MSG_INFO, "%s: ser_setspeed(): tcgetattr() failed",
progname);
return -errno;
}
/*
* copy termios for ser_close if we haven't already
*/
if (! saved_original_termios++) {
original_termios = termios;
}
termios.c_iflag = IGNBRK;
termios.c_oflag = 0;
termios.c_lflag = 0;
termios.c_cflag = (CS8 | CREAD | CLOCAL);
termios.c_cc[VMIN] = 1;
termios.c_cc[VTIME] = 0;
cfsetospeed(&termios, speed);
cfsetispeed(&termios, speed);
rc = tcsetattr(fd->ifd, TCSANOW, &termios);
if (rc < 0) {
avrdude_message(MSG_INFO, "%s: ser_setspeed(): tcsetattr() failed\n",
progname);
return -errno;
}
/*
* Everything is now set up for a local line without modem control
* or flow control, so clear O_NONBLOCK again.
*/
rc = fcntl(fd->ifd, F_GETFL, 0);
if (rc != -1)
fcntl(fd->ifd, F_SETFL, rc & ~O_NONBLOCK);
return 0;
}
/*
* Given a port description of the form <host>:<port>, open a TCP
* connection to the specified destination, which is assumed to be a
* terminal/console server with serial parameters configured
* appropriately (e. g. 115200-8-N-1 for a STK500.)
*/
static int
net_open(const char *port, union filedescriptor *fdp)
{
char *hstr, *pstr, *end;
unsigned int pnum;
int fd;
struct sockaddr_in sockaddr;
struct hostent *hp;
if ((hstr = strdup(port)) == NULL) {
avrdude_message(MSG_INFO, "%s: net_open(): Out of memory!\n",
progname);
return -1;
}
if (((pstr = strchr(hstr, ':')) == NULL) || (pstr == hstr)) {
avrdude_message(MSG_INFO, "%s: net_open(): Mangled host:port string \"%s\"\n",
progname, hstr);
free(hstr);
return -1;
}
/*
* Terminate the host section of the description.
*/
*pstr++ = '\0';
pnum = strtoul(pstr, &end, 10);
if ((*pstr == '\0') || (*end != '\0') || (pnum == 0) || (pnum > 65535)) {
avrdude_message(MSG_INFO, "%s: net_open(): Bad port number \"%s\"\n",
progname, pstr);
free(hstr);
return -1;
}
if ((hp = gethostbyname(hstr)) == NULL) {
avrdude_message(MSG_INFO, "%s: net_open(): unknown host \"%s\"\n",
progname, hstr);
free(hstr);
return -1;
}
free(hstr);
if ((fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
avrdude_message(MSG_INFO, "%s: net_open(): Cannot open socket: %s\n",
progname, strerror(errno));
return -1;
}
memset(&sockaddr, 0, sizeof(struct sockaddr_in));
sockaddr.sin_family = AF_INET;
sockaddr.sin_port = htons(pnum);
memcpy(&(sockaddr.sin_addr.s_addr), hp->h_addr, sizeof(struct in_addr));
if (connect(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr))) {
avrdude_message(MSG_INFO, "%s: net_open(): Connect failed: %s\n",
progname, strerror(errno));
return -1;
}
fdp->ifd = fd;
return 0;
}
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, union pinfo pinfo, union filedescriptor *fdp)
{
int rc;
int fd;
/*
* If the port is of the form "net:<host>:<port>", then
* handle it as a TCP connection to a terminal server.
*/
if (strncmp(port, "net:", strlen("net:")) == 0) {
return net_open(port + strlen("net:"), fdp);
}
/*
* open the serial port
*/
fd = open(port, O_RDWR | O_NOCTTY | O_NONBLOCK);
if (fd < 0) {
avrdude_message(MSG_INFO, "%s: ser_open(): can't open device \"%s\": %s\n",
progname, port, strerror(errno));
return -1;
}
fdp->ifd = fd;
/*
* set serial line attributes
*/
rc = ser_setspeed(fdp, pinfo.baud);
if (rc) {
avrdude_message(MSG_INFO, "%s: ser_open(): can't set attributes for device \"%s\": %s\n",
progname, port, strerror(-rc));
close(fd);
return -1;
}
return 0;
}
static void ser_close(union filedescriptor *fd)
{
/*
* restore original termios settings from ser_open
*/
if (saved_original_termios) {
int rc = tcsetattr(fd->ifd, TCSANOW | TCSADRAIN, &original_termios);
if (rc) {
avrdude_message(MSG_INFO, "%s: ser_close(): can't reset attributes for device: %s\n",
progname, strerror(errno));
}
saved_original_termios = 0;
}
close(fd->ifd);
}
static int ser_send(union filedescriptor *fd, const unsigned char * buf, size_t buflen)
{
int rc;
const unsigned char * p = buf;
size_t len = buflen;
if (!len)
return 0;
if (verbose > 3)
{
avrdude_message(MSG_TRACE, "%s: Send: ", progname);
while (buflen) {
unsigned char c = *buf;
if (isprint(c)) {
avrdude_message(MSG_TRACE, "%c ", c);
}
else {
avrdude_message(MSG_TRACE, ". ");
}
avrdude_message(MSG_TRACE, "[%02x] ", c);
buf++;
buflen--;
}
avrdude_message(MSG_TRACE, "\n");
}
while (len) {
rc = write(fd->ifd, p, (len > 1024) ? 1024 : len);
if (rc < 0) {
avrdude_message(MSG_INFO, "%s: ser_send(): write error: %s\n",
progname, strerror(errno));
return -1;
}
p += rc;
len -= rc;
}
return 0;
}
static int ser_recv(union filedescriptor *fd, unsigned char * buf, size_t buflen)
{
struct timeval timeout, to2;
fd_set rfds;
int nfds;
int rc;
unsigned char * p = buf;
size_t len = 0;
timeout.tv_sec = serial_recv_timeout / 1000L;
timeout.tv_usec = (serial_recv_timeout % 1000L) * 1000;
to2 = timeout;
while (len < buflen) {
reselect:
FD_ZERO(&rfds);
FD_SET(fd->ifd, &rfds);
nfds = select(fd->ifd + 1, &rfds, NULL, NULL, &to2);
if (nfds == 0) {
avrdude_message(MSG_NOTICE2, "%s: ser_recv(): programmer is not responding\n",
progname);
return -1;
}
else if (nfds == -1) {
if (errno == EINTR || errno == EAGAIN) {
avrdude_message(MSG_INFO, "%s: ser_recv(): programmer is not responding,reselecting\n",
progname);
goto reselect;
}
else {
avrdude_message(MSG_INFO, "%s: ser_recv(): select(): %s\n",
progname, strerror(errno));
return -1;
}
}
rc = read(fd->ifd, p, (buflen - len > 1024) ? 1024 : buflen - len);
if (rc < 0) {
avrdude_message(MSG_INFO, "%s: ser_recv(): read error: %s\n",
progname, strerror(errno));
return -1;
}
p += rc;
len += rc;
}
p = buf;
if (verbose > 3)
{
avrdude_message(MSG_TRACE, "%s: Recv: ", progname);
while (len) {
unsigned char c = *p;
if (isprint(c)) {
avrdude_message(MSG_TRACE, "%c ", c);
}
else {
avrdude_message(MSG_TRACE, ". ");
}
avrdude_message(MSG_TRACE, "[%02x] ", c);
p++;
len--;
}
avrdude_message(MSG_TRACE, "\n");
}
return 0;
}
static int ser_drain(union filedescriptor *fd, int display)
{
struct timeval timeout;
fd_set rfds;
int nfds;
int rc;
unsigned char buf;
timeout.tv_sec = 0;
timeout.tv_usec = 250000;
if (display) {
avrdude_message(MSG_INFO, "drain>");
}
while (1) {
FD_ZERO(&rfds);
FD_SET(fd->ifd, &rfds);
reselect:
nfds = select(fd->ifd + 1, &rfds, NULL, NULL, &timeout);
if (nfds == 0) {
if (display) {
avrdude_message(MSG_INFO, "<drain\n");
}
break;
}
else if (nfds == -1) {
if (errno == EINTR) {
goto reselect;
}
else {
avrdude_message(MSG_INFO, "%s: ser_drain(): select(): %s\n",
progname, strerror(errno));
return -1;
}
}
rc = read(fd->ifd, &buf, 1);
if (rc < 0) {
avrdude_message(MSG_INFO, "%s: ser_drain(): read error: %s\n",
progname, strerror(errno));
return -1;
}
if (display) {
avrdude_message(MSG_INFO, "%02x ", buf);
}
}
return 0;
}
struct serial_device serial_serdev =
{
.open = ser_open,
.setspeed = ser_setspeed,
.close = ser_close,
.send = ser_send,
.recv = ser_recv,
.drain = ser_drain,
.set_dtr_rts = ser_set_dtr_rts,
.flags = SERDEV_FL_CANSETSPEED,
};
struct serial_device *serdev = &serial_serdev;
#endif /* WIN32NATIVE */

307
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,307 @@
#
# CMakeLists.txt - CMake project for AVRDUDE
# Copyright (C) 2021 Marius Greuel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# =====================================
# Set up flex target
# =====================================
FLEX_TARGET(Parser "lexer.l" "${PROJECT_BINARY_DIR}/lexer.c")
if (FLEX_VERSION VERSION_GREATER_EQUAL 2.5.9)
set(HAVE_YYLEX_DESTROY 1)
endif()
# =====================================
# Set up yacc/bison target
# =====================================
if(BISON_FOUND)
BISON_TARGET(Parser config_gram.y "${PROJECT_BINARY_DIR}/config_gram.c" DEFINES_FILE "${PROJECT_BINARY_DIR}/config_gram.h")
else()
set(YACC_TARGET_outputs "${PROJECT_BINARY_DIR}/config_gram.c")
add_custom_command(OUTPUT ${YACC_TARGET_outputs}
COMMAND ${YACC_EXECUTABLE} -d -o ${YACC_TARGET_outputs} config_gram.y
VERBATIM
COMMENT "[YACC][Parser] Building parser with yacc"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
set(BISON_Parser_OUTPUTS ${YACC_TARGET_outputs})
endif()
# =====================================
# Setup target specific options
# =====================================
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
add_compile_definitions(CONFIG_DIR=\"${CONFIG_DIR}\")
if(WIN32)
set(EXTRA_WINDOWS_RESOURCES "${PROJECT_BINARY_DIR}/src/windows.rc")
set(EXTRA_WINDOWS_LIBRARIES setupapi ws2_32)
endif()
if(MSVC)
enable_language(CXX)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS=1)
add_compile_definitions(_CRT_NONSTDC_NO_WARNINGS=1)
add_compile_definitions(_WINSOCK_DEPRECATED_NO_WARNINGS=1)
add_compile_options(/W3)
add_compile_options(/wd4018) # warning C4018: signed/unsigned mismatch
add_compile_options(/wd4244) # warning C4244: conversion from '...' to '...', possible loss of data
add_compile_options(/wd4267) # warning C4267: conversion from '...' to '...', possible loss of data
set(EXTRA_WINDOWS_SOURCES ${EXTRA_WINDOWS_SOURCES}
"msvc/getopt.c"
"msvc/gettimeofday.c"
"msvc/usleep.cpp"
"msvc/readline.cpp"
"msvc/usb_com_helper.cpp"
)
set(EXTRA_WINDOWS_INCLUDES ${EXTRA_WINDOWS_INCLUDES}
"msvc"
)
else()
set(LIB_MATH m)
add_compile_options(-Wall) # -Wextra
endif()
# =====================================
# Setup default port names
# =====================================
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(DEFAULT_PAR_PORT "/dev/parport0")
set(DEFAULT_SER_PORT "/dev/ttyS0")
elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set(DEFAULT_PAR_PORT "/dev/ppi0")
set(DEFAULT_SER_PORT "/dev/cuad0")
elseif (CMAKE_SYSTEM_NAME STREQUAL "Solaris")
set(DEFAULT_PAR_PORT "/dev/printers/0")
set(DEFAULT_SER_PORT "/dev/term/a")
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(DEFAULT_PAR_PORT "lpt1")
set(DEFAULT_SER_PORT "com1")
else()
set(DEFAULT_PAR_PORT "unknown")
set(DEFAULT_SER_PORT "unknown")
endif()
# =====================================
# Configure files
# =====================================
configure_file(cmake_config.h.in ac_cfg.h)
configure_file(avrdude.spec.in avrdude.spec)
if(WIN32)
configure_file(windows.rc.in windows.rc)
endif()
add_custom_command(
OUTPUT avrdude.conf
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/avrdude.conf.in" avrdude.conf.in
COMMAND ${CMAKE_COMMAND}
-D HAVE_PARPORT=${HAVE_PARPORT}
-D HAVE_LINUXSPI=${HAVE_LINUXSPI}
-D HAVE_LINUXGPIO=${HAVE_LINUXGPIO}
-D DEFAULT_PAR_PORT=${DEFAULT_PAR_PORT}
-D DEFAULT_SER_PORT=${DEFAULT_SER_PORT}
-P "${CMAKE_CURRENT_SOURCE_DIR}/configure.cmake"
DEPENDS avrdude.conf.in
VERBATIM
)
add_custom_target(conf ALL DEPENDS avrdude.conf)
# =====================================
# Project
# =====================================
add_library(libavrdude
ac_cfg.h
arduino.h
arduino.c
avr.c
avr910.c
avr910.h
avrcache.c
avrdude.h
avrftdi.c
avrftdi.h
avrftdi_private.h
avrftdi_tpi.c
avrftdi_tpi.h
avrpart.c
bitbang.c
bitbang.h
buspirate.c
buspirate.h
butterfly.c
butterfly.h
config.c
config.h
confwin.c
crc16.c
crc16.h
dfu.c
dfu.h
fileio.c
flip1.c
flip1.h
flip2.c
flip2.h
freebsd_ppi.h
ft245r.c
ft245r.h
jtagmkI.c
jtagmkI.h
jtagmkI_private.h
jtagmkII.c
jtagmkII.h
jtagmkII_private.h
jtag3.c
jtag3.h
jtag3_private.h
libavrdude.h
linuxgpio.c
linuxgpio.h
linuxspi.c
linuxspi.h
linux_ppdev.h
lists.c
micronucleus.c
micronucleus.h
par.c
par.h
pgm.c
pgm_type.c
pickit2.c
pickit2.h
pindefs.c
ppi.c
ppi.h
ppiwin.c
serbb.h
serbb_posix.c
serbb_win32.c
ser_avrdoper.c
ser_posix.c
ser_win32.c
serialupdi.c
serialupdi.h
solaris_ecpp.h
stk500.c
stk500.h
stk500_private.h
stk500v2.c
stk500v2.h
stk500v2_private.h
stk500generic.c
stk500generic.h
teensy.c
teensy.h
tpi.h
updi_constants.h
updi_link.c
updi_link.h
updi_nvm.c
updi_nvm.h
updi_readwrite.c
updi_readwrite.h
updi_state.c
updi_state.h
urclock.c
urclock.h
urclock_hash.h
urclock_private.h
usbasp.c
usbasp.h
usbdevs.h
usb_hidapi.c
usb_libusb.c
usbtiny.h
usbtiny.c
update.c
wiring.h
wiring.c
xbee.h
xbee.c
${FLEX_Parser_OUTPUTS}
${BISON_Parser_OUTPUTS}
"${EXTRA_WINDOWS_SOURCES}"
)
set_target_properties(libavrdude PROPERTIES
PREFIX ""
PUBLIC_HEADER "libavrdude.h"
VERSION 1.0.0
SOVERSION 1
)
target_include_directories(libavrdude
PUBLIC
"${PROJECT_SOURCE_DIR}"
"${PROJECT_BINARY_DIR}"
"${LIBUSB_COMPAT_DIR}"
"${EXTRA_WINDOWS_INCLUDES}"
)
target_link_libraries(libavrdude
PUBLIC
${LIB_MATH}
${LIB_LIBELF}
${LIB_LIBUSB}
${LIB_LIBUSB_1_0}
${LIB_LIBHID}
${LIB_LIBHIDAPI}
${LIB_LIBFTDI}
${LIB_LIBFTDI1}
${LIB_LIBREADLINE}
${EXTRA_WINDOWS_LIBRARIES}
)
add_executable(avrdude
main.c
term.c
term.h
avrintel.c
avrintel.h
developer_opts.c
developer_opts.h
developer_opts_private.h
whereami.c
whereami.h
"${EXTRA_WINDOWS_RESOURCES}"
)
target_link_libraries(avrdude PUBLIC libavrdude)
# =====================================
# Install
# =====================================
install(TARGETS avrdude DESTINATION bin)
install(TARGETS libavrdude
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION include COMPONENT dev
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/avrdude.conf" TYPE SYSCONF)
install(FILES "avrdude.1"
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1"
)

View File

@ -1,3 +1,4 @@
#
# avrdude - A Downloader/Uploader for AVR device programmers
# Copyright (C) 2003, 2004 Theodore A. Roth <troth@openavr.org>
@ -16,23 +17,20 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# In order to get verbose build messages rather than a summary line
# only, either use
#
# ./configure --disable-silent-rules
#
# or run make like
#
# make V=1
#
# $Id$
#
EXTRA_DIST = \
ChangeLog \
ChangeLog-2001 \
ChangeLog-2002 \
ChangeLog-2003 \
ChangeLog-2004-2006 \
ChangeLog-2007 \
ChangeLog-2008 \
ChangeLog-2009 \
ChangeLog-2010 \
ChangeLog-2011 \
ChangeLog-2012 \
ChangeLog-2013 \
avrdude.1 \
avrdude.spec \
bootstrap
@ -44,14 +42,13 @@ CLEANFILES = \
BUILT_SOURCES = $(CLEANFILES)
#SUBDIRS = doc @WINDOWS_DIRS@
#DIST_SUBDIRS = doc windows
#SUBDIRS = doc
#DIST_SUBDIRS = doc
# . lets build this directory before the following in SUBDIRS
SUBDIRS = .
# doc comes here, and we want to use the built avrdude to generate the parts list
SUBDIRS += @SUBDIRS_AC@
SUBDIRS += @WINDOWS_DIRS@
DIST_SUBDIRS = @DIST_SUBDIRS_AC@
AM_YFLAGS = -d
@ -66,7 +63,7 @@ avrdude_CFLAGS = @ENABLE_WARNINGS@
libavrdude_a_CFLAGS = @ENABLE_WARNINGS@
libavrdude_la_CFLAGS = $(libavrdude_a_CFLAGS)
avrdude_LDADD = $(top_builddir)/$(noinst_LIBRARIES) @LIBUSB_1_0@ @LIBUSB@ @LIBFTDI1@ @LIBFTDI@ @LIBHID@ @LIBELF@ @LIBPTHREAD@ -lm
avrdude_LDADD = $(top_builddir)/$(noinst_LIBRARIES) @LIBUSB_1_0@ @LIBHIDAPI@ @LIBUSB@ @LIBFTDI1@ @LIBFTDI@ @LIBHID@ @LIBELF@ @LIBPTHREAD@ -lm
bin_PROGRAMS = avrdude
@ -96,6 +93,7 @@ libavrdude_a_SOURCES = \
avr.c \
avr910.c \
avr910.h \
avrcache.c \
avrdude.h \
avrftdi.c \
avrftdi.h \
@ -136,9 +134,12 @@ libavrdude_a_SOURCES = \
libavrdude.h \
linuxgpio.c \
linuxgpio.h \
linuxspi.c \
linuxspi.h \
linux_ppdev.h \
lists.c \
my_ddk_hidsdi.h \
micronucleus.c \
micronucleus.h \
par.c \
par.h \
pgm.c \
@ -149,7 +150,6 @@ libavrdude_a_SOURCES = \
ppi.c \
ppi.h \
ppiwin.c \
safemode.c \
serbb.h \
serbb_posix.c \
serbb_win32.c \
@ -165,16 +165,36 @@ libavrdude_a_SOURCES = \
stk500v2_private.h \
stk500generic.c \
stk500generic.h \
teensy.c \
teensy.h \
tpi.h \
usbasp.c \
usbasp.h \
serialupdi.c \
serialupdi.h \
updi_constants.h \
updi_link.c \
updi_link.h \
updi_state.c \
updi_state.h \
updi_readwrite.c \
updi_readwrite.h \
updi_nvm.c \
updi_nvm.h \
urclock.c \
urclock.h \
urclock_hash.h \
urclock_private.h \
usbdevs.h \
usb_hidapi.c \
usb_libusb.c \
usbtiny.h \
usbtiny.c \
update.c \
wiring.h \
wiring.c
wiring.c \
xbee.h \
xbee.c
libavrdude_la_SOURCES = $(libavrdude_a_SOURCES)
libavrdude_la_LDFLAGS = -version-info 1:0
@ -182,6 +202,13 @@ include_HEADERS = libavrdude.h
avrdude_SOURCES = \
main.c \
whereami.c \
whereami.h \
avrintel.c \
avrintel.h \
developer_opts.c \
developer_opts.h \
developer_opts_private.h \
term.c \
term.h

View File

@ -38,14 +38,13 @@
#include "arduino.h"
/* read signature bytes - arduino version */
static int arduino_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
{
static int arduino_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m) {
unsigned char buf[32];
/* Signature byte reads are always 3 bytes. */
if (m->size < 3) {
avrdude_message(MSG_INFO, "%s: memsize too small for sig byte read", progname);
pmsg_error("memsize too small for sig byte read");
return -1;
}
@ -57,19 +56,16 @@ static int arduino_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
if (serial_recv(&pgm->fd, buf, 5) < 0)
return -1;
if (buf[0] == Resp_STK_NOSYNC) {
avrdude_message(MSG_INFO, "%s: stk500_cmd(): programmer is out of sync\n",
progname);
pmsg_error("programmer is out of sync\n");
return -1;
} else if (buf[0] != Resp_STK_INSYNC) {
avrdude_message(MSG_INFO, "\n%s: arduino_read_sig_bytes(): (a) protocol error, "
"expect=0x%02x, resp=0x%02x\n",
progname, Resp_STK_INSYNC, buf[0]);
return -2;
msg_error("\n");
pmsg_error("protocol expects sync byte 0x%02x but got 0x%02x\n", Resp_STK_INSYNC, buf[0]);
return -2;
}
if (buf[4] != Resp_STK_OK) {
avrdude_message(MSG_INFO, "\n%s: arduino_read_sig_bytes(): (a) protocol error, "
"expect=0x%02x, resp=0x%02x\n",
progname, Resp_STK_OK, buf[4]);
msg_error("\n");
pmsg_error("protocol expects OK byte 0x%02x but got 0x%02x\n", Resp_STK_OK, buf[4]);
return -3;
}
@ -80,11 +76,11 @@ static int arduino_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
return 3;
}
static int arduino_open(PROGRAMMER * pgm, char * port)
{
static int arduino_open(PROGRAMMER *pgm, const char *port) {
union pinfo pinfo;
strcpy(pgm->port, port);
pinfo.baud = pgm->baudrate? pgm->baudrate: 115200;
pinfo.serialinfo.baud = pgm->baudrate? pgm->baudrate: 115200;
pinfo.serialinfo.cflags = SERIAL_8N1;
if (serial_open(port, pinfo, &pgm->fd)==-1) {
return -1;
}
@ -117,8 +113,7 @@ static void arduino_close(PROGRAMMER * pgm)
const char arduino_desc[] = "Arduino programmer";
void arduino_initpgm(PROGRAMMER * pgm)
{
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
@ -129,4 +124,6 @@ void arduino_initpgm(PROGRAMMER * pgm)
pgm->read_sig_bytes = arduino_read_sig_bytes;
pgm->open = arduino_open;
pgm->close = arduino_close;
disable_trailing_ff_removal(); /* so that arduino bootloader can ignore chip erase */
}

View File

@ -22,7 +22,7 @@
#define arduino_h__
extern const char arduino_desc[];
void arduino_initpgm (PROGRAMMER * pgm);
void arduino_initpgm(PROGRAMMER *pgm);
#endif

1433
src/avr.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -57,8 +57,7 @@ struct pdata
static void avr910_setup(PROGRAMMER * pgm)
{
if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
avrdude_message(MSG_INFO, "%s: avr910_setup(): Out of memory allocating private data\n",
progname);
pmsg_error("out of memory allocating private data\n");
exit(1);
}
memset(pgm->cookie, 0, sizeof(struct pdata));
@ -71,40 +70,34 @@ static void avr910_teardown(PROGRAMMER * pgm)
}
static int avr910_send(PROGRAMMER * pgm, char * buf, size_t len)
{
static int avr910_send(const PROGRAMMER *pgm, char *buf, size_t len) {
return serial_send(&pgm->fd, (unsigned char *)buf, len);
}
static int avr910_recv(PROGRAMMER * pgm, char * buf, size_t len)
{
static int avr910_recv(const PROGRAMMER *pgm, char *buf, size_t len) {
int rv;
rv = serial_recv(&pgm->fd, (unsigned char *)buf, len);
if (rv < 0) {
avrdude_message(MSG_INFO, "%s: avr910_recv(): programmer is not responding\n",
progname);
pmsg_error("programmer is not responding\n");
return 1;
}
return 0;
}
static int avr910_drain(PROGRAMMER * pgm, int display)
{
static int avr910_drain(const PROGRAMMER *pgm, int display) {
return serial_drain(&pgm->fd, display);
}
static int avr910_vfy_cmd_sent(PROGRAMMER * pgm, char * errmsg)
{
static int avr910_vfy_cmd_sent(const PROGRAMMER *pgm, char *errmsg) {
char c;
avr910_recv(pgm, &c, 1);
if (c != '\r') {
avrdude_message(MSG_INFO, "%s: error: programmer did not respond to command: %s\n",
progname, errmsg);
pmsg_error("programmer did not respond to command: %s\n", errmsg);
return 1;
}
return 0;
@ -114,8 +107,7 @@ static int avr910_vfy_cmd_sent(PROGRAMMER * pgm, char * errmsg)
/*
* issue the 'chip erase' command to the AVR device
*/
static int avr910_chip_erase(PROGRAMMER * pgm, AVRPART * p)
{
static int avr910_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) {
avr910_send(pgm, "e", 1);
if (avr910_vfy_cmd_sent(pgm, "chip erase") < 0)
return -1;
@ -129,15 +121,13 @@ static int avr910_chip_erase(PROGRAMMER * pgm, AVRPART * p)
}
static int avr910_enter_prog_mode(PROGRAMMER * pgm)
{
static int avr910_enter_prog_mode(const PROGRAMMER *pgm) {
avr910_send(pgm, "P", 1);
return avr910_vfy_cmd_sent(pgm, "enter prog mode");
}
static int avr910_leave_prog_mode(PROGRAMMER * pgm)
{
static int avr910_leave_prog_mode(const PROGRAMMER *pgm) {
avr910_send(pgm, "L", 1);
return avr910_vfy_cmd_sent(pgm, "leave prog mode");
}
@ -146,8 +136,7 @@ static int avr910_leave_prog_mode(PROGRAMMER * pgm)
/*
* issue the 'program enable' command to the AVR device
*/
static int avr910_program_enable(PROGRAMMER * pgm, AVRPART * p)
{
static int avr910_program_enable(const PROGRAMMER *pgm, const AVRPART *p) {
return -1;
}
@ -155,8 +144,7 @@ static int avr910_program_enable(PROGRAMMER * pgm, AVRPART * p)
/*
* initialize the AVR device and prepare it to accept commands
*/
static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p)
{
static int avr910_initialize(const PROGRAMMER *pgm, const AVRPART *p) {
char id[8];
char sw[2];
char hw[2];
@ -185,16 +173,16 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p)
avr910_send(pgm, "p", 1);
avr910_recv(pgm, &type, 1);
avrdude_message(MSG_INFO, "Found programmer: Id = \"%s\"; type = %c\n", id, type);
avrdude_message(MSG_INFO, " Software Version = %c.%c; ", sw[0], sw[1]);
avrdude_message(MSG_INFO, "Hardware Version = %c.%c\n", hw[0], hw[1]);
msg_notice("Programmer id = %s; type = %c\n", id, type);
msg_notice("Software version = %c.%c; ", sw[0], sw[1]);
msg_notice("Hardware version = %c.%c\n", hw[0], hw[1]);
/* See if programmer supports autoincrement of address. */
avr910_send(pgm, "a", 1);
avr910_recv(pgm, &PDATA(pgm)->has_auto_incr_addr, 1);
if (PDATA(pgm)->has_auto_incr_addr == 'Y')
avrdude_message(MSG_INFO, "Programmer supports auto addr increment.\n");
msg_notice("programmer supports auto addr increment\n");
/* Check support for buffered memory access, ignore if not available */
@ -206,8 +194,8 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p)
PDATA(pgm)->buffersize = (unsigned int)(unsigned char)c<<8;
avr910_recv(pgm, &c, 1);
PDATA(pgm)->buffersize += (unsigned int)(unsigned char)c;
avrdude_message(MSG_INFO, "Programmer supports buffered memory access with "
"buffersize = %u bytes.\n",
msg_notice("programmer supports buffered memory access with "
"buffersize = %u bytes\n",
PDATA(pgm)->buffersize);
PDATA(pgm)->use_blockmode = 1;
} else {
@ -224,7 +212,7 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p)
/* Get list of devices that the programmer supports. */
avr910_send(pgm, "t", 1);
avrdude_message(MSG_INFO, "\nProgrammer supports the following devices:\n");
msg_notice2("\nProgrammer supports the following devices:\n");
devtype_1st = 0;
while (1) {
avr910_recv(pgm, &c, 1);
@ -234,20 +222,22 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p)
break;
part = locate_part_by_avr910_devcode(part_list, c);
avrdude_message(MSG_INFO, " Device code: 0x%02x = %s\n", c, part ? part->desc : "(unknown)");
msg_notice2(" Device code: 0x%02x = %s\n", c & 0xff, part? part->desc: "(unknown)");
/* FIXME: Need to lookup devcode and report the device. */
if (p->avr910_devcode == c)
dev_supported = 1;
};
avrdude_message(MSG_INFO, "\n");
msg_notice2("\n");
if (!dev_supported) {
avrdude_message(MSG_INFO, "%s: %s: selected device is not supported by programmer: %s\n",
progname, ovsigck? "warning": "error", p->id);
if (!ovsigck)
if(ovsigck)
pmsg_warning("selected device is not supported by programmer %s\n", p->id);
else {
pmsg_error("selected device is not supported by programmer %s\n", p->id);
return -1;
}
}
/* If the user forced the selection, use the first device
type that is supported by the programmer. */
@ -264,8 +254,7 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p)
avr910_send(pgm, buf, 2);
avr910_vfy_cmd_sent(pgm, "select device");
avrdude_message(MSG_NOTICE, "%s: avr910_devcode selected: 0x%02x\n",
progname, (unsigned)buf[1]);
pmsg_notice("avr910_devcode selected: 0x%02x\n", (unsigned) buf[1]);
avr910_enter_prog_mode(pgm);
@ -273,16 +262,14 @@ static int avr910_initialize(PROGRAMMER * pgm, AVRPART * p)
}
static void avr910_disable(PROGRAMMER * pgm)
{
static void avr910_disable(const PROGRAMMER *pgm) {
/* Do nothing. */
return;
}
static void avr910_enable(PROGRAMMER * pgm)
{
static void avr910_enable(PROGRAMMER *pgm, const AVRPART *p) {
/* Do nothing. */
return;
@ -293,7 +280,7 @@ 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, const unsigned char *cmd,
static int avr910_cmd(const PROGRAMMER *pgm, const unsigned char *cmd,
unsigned char *res)
{
char buf[5];
@ -318,8 +305,7 @@ static int avr910_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
}
static int avr910_parseextparms(PROGRAMMER * pgm, LISTID extparms)
{
static int avr910_parseextparms(const PROGRAMMER *pgm, const LISTID extparms) {
LNODEID ln;
const char *extended_param;
int rv = 0;
@ -331,27 +317,23 @@ static int avr910_parseextparms(PROGRAMMER * pgm, LISTID extparms)
int devcode;
if (sscanf(extended_param, "devcode=%i", &devcode) != 1 ||
devcode <= 0 || devcode > 255) {
avrdude_message(MSG_INFO, "%s: avr910_parseextparms(): invalid devcode '%s'\n",
progname, extended_param);
pmsg_error("invalid devcode '%s'\n", extended_param);
rv = -1;
continue;
}
avrdude_message(MSG_NOTICE2, "%s: avr910_parseextparms(): devcode overwritten as 0x%02x\n",
progname, devcode);
pmsg_notice2("avr910_parseextparms(): devcode overwritten as 0x%02x\n", devcode);
PDATA(pgm)->devcode = devcode;
continue;
}
if (strncmp(extended_param, "no_blockmode", strlen("no_blockmode")) == 0) {
avrdude_message(MSG_NOTICE2, "%s: avr910_parseextparms(-x): no testing for Blockmode\n",
progname);
pmsg_notice2("avr910_parseextparms(-x): no testing for Blockmode\n");
PDATA(pgm)->test_blockmode = 0;
continue;
}
avrdude_message(MSG_INFO, "%s: avr910_parseextparms(): invalid extended parameter '%s'\n",
progname, extended_param);
pmsg_error("invalid extended parameter '%s'\n", extended_param);
rv = -1;
}
@ -359,8 +341,7 @@ static int avr910_parseextparms(PROGRAMMER * pgm, LISTID extparms)
}
static int avr910_open(PROGRAMMER * pgm, char * port)
{
static int avr910_open(PROGRAMMER *pgm, const char *port) {
union pinfo pinfo;
/*
* If baudrate was not specified use 19.200 Baud
@ -370,7 +351,8 @@ static int avr910_open(PROGRAMMER * pgm, char * port)
}
strcpy(pgm->port, port);
pinfo.baud = pgm->baudrate;
pinfo.serialinfo.baud = pgm->baudrate;
pinfo.serialinfo.cflags = SERIAL_8N1;
if (serial_open(port, pinfo, &pgm->fd)==-1) {
return -1;
}
@ -392,14 +374,12 @@ static void avr910_close(PROGRAMMER * pgm)
}
static void avr910_display(PROGRAMMER * pgm, const char * p)
{
static void avr910_display(const PROGRAMMER *pgm, const char *p) {
return;
}
static void avr910_set_addr(PROGRAMMER * pgm, unsigned long addr)
{
static void avr910_set_addr(const PROGRAMMER *pgm, unsigned long addr) {
char cmd[3];
cmd[0] = 'A';
@ -411,7 +391,7 @@ static void avr910_set_addr(PROGRAMMER * pgm, unsigned long addr)
}
static int avr910_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int avr910_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned long addr, unsigned char value)
{
char cmd[2];
@ -444,7 +424,7 @@ static int avr910_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
}
static int avr910_read_byte_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int avr910_read_byte_flash(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned long addr, unsigned char * value)
{
char buf[2];
@ -467,7 +447,7 @@ static int avr910_read_byte_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
}
static int avr910_read_byte_eeprom(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int avr910_read_byte_eeprom(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned long addr, unsigned char * value)
{
avr910_set_addr(pgm, addr);
@ -478,7 +458,7 @@ static int avr910_read_byte_eeprom(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
}
static int avr910_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int avr910_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned long addr, unsigned char * value)
{
if (strcmp(m->desc, "flash") == 0) {
@ -493,7 +473,7 @@ static int avr910_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
}
static int avr910_paged_write_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int avr910_paged_write_flash(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned int page_size,
unsigned int addr, unsigned int n_bytes)
{
@ -552,8 +532,8 @@ static int avr910_paged_write_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
}
static int avr910_paged_write_eeprom(PROGRAMMER * pgm, AVRPART * p,
AVRMEM * m,
static int avr910_paged_write_eeprom(const PROGRAMMER *pgm, const AVRPART *p,
const AVRMEM * m,
unsigned int page_size,
unsigned int addr, unsigned int n_bytes)
{
@ -581,7 +561,7 @@ static int avr910_paged_write_eeprom(PROGRAMMER * pgm, AVRPART * p,
}
static int avr910_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int avr910_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned int page_size,
unsigned int addr, unsigned int n_bytes)
{
@ -641,7 +621,7 @@ static int avr910_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
}
static int avr910_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int avr910_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned int page_size,
unsigned int addr, unsigned int n_bytes)
{
@ -718,12 +698,11 @@ static int avr910_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
/* Signature byte reads are always 3 bytes. */
static int avr910_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
{
static int avr910_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m) {
unsigned char tmp;
if (m->size < 3) {
avrdude_message(MSG_INFO, "%s: memsize too small for sig byte read", progname);
pmsg_error("memsize too small for sig byte read");
return -1;
}
@ -739,8 +718,7 @@ static int avr910_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
const char avr910_desc[] = "Serial programmers using protocol described in application note AVR910";
void avr910_initpgm(PROGRAMMER * pgm)
{
void avr910_initpgm(PROGRAMMER *pgm) {
strcpy(pgm->type, "avr910");
/*

View File

@ -26,7 +26,7 @@ extern "C" {
#endif
extern const char avr910_desc[];
void avr910_initpgm (PROGRAMMER * pgm);
void avr910_initpgm(PROGRAMMER *pgm);
#ifdef __cplusplus
}

774
src/avrcache.c Normal file
View File

@ -0,0 +1,774 @@
/*
* avrdude - A Downloader/Uploader for AVR device programmers
* Copyright (C) 2022 Stefan Rueger <stefan.rueger@urclocks.c>
*
* 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$ */
#include "ac_cfg.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include "avrdude.h"
#include "libavrdude.h"
#include "avrintel.h"
/*
* Provides an API for cached bytewise access
*
* int avr_read_byte_cached(const PROGRAMMER *pgm, const AVRPART *p, const
* AVRMEM *mem, unsigned long addr, unsigned char *value);
*
* int avr_write_byte_cached(const PROGRAMMER *pgm, const AVRPART *p, const
* AVRMEM *mem, unsigned long addr, unsigned char data);
*
* int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p);
*
* int avr_chip_erase_cached(const PROGRAMMER *pgm, const AVRPART *p);
*
* int avr_page_erase_cached(const PROGRAMMER *pgm, const AVRPART *p, const
* AVRMEM *mem, unsigned int baseaddr);
*
* int avr_reset_cache(const PROGRAMMER *pgm, const AVRPART *p);
*
* avr_read_byte_cached() and avr_write_byte_cached() use a cache if paged
* routines are available and if the device memory is EEPROM or flash,
* otherwise they fall back to pgm->read_byte() and pgm->write_byte(),
* respectively. Bytewise cached read always gets its data from the cache,
* possibly after reading a page from the device memory. Bytewise cached
* write with an address in memory range only ever modifies the cache. Any
* modifications are written to the device after calling avr_flush_cache() or
* when attempting to read or write from a location outside the address range
* of the device memory.
*
* avr_flush_cache() synchronises pending writes to EEPROM and flash with the
* device. With some programmer and part combinations, flash (and sometimes
* EEPROM, too) looks like a NOR memory, ie, one can only write 0 bits, not 1
* bits. When this is detected, either page erase is deployed (eg, with parts
* that have PDI/UPDI interfaces), or if that is not available, both EEPROM
* and flash caches are fully read in, a pgm->chip_erase() command is issued
* and both EEPROM and flash are written back to the device. Hence, it can
* take minutes to ensure that a single previously cleared bit is set and,
* therefore, this routine should be called sparingly.
*
* avr_chip_erase_cached() erases the chip and discards pending writes() to
* flash or EEPROM. It presets the flash cache to all 0xff alleviating the
* need to read from the device flash. However, if the programmer serves
* bootloaders (pgm->prog_modes & PM_SPM) then the flash cache is reset
* instead, necessitating flash memory be fetched from the device on first
* read; the reason for this is that bootloaders emulate chip erase and they
* won't overwrite themselves (some bootloaders, eg, optiboot ignore chip
* erase commands) making it truly unknowable what the flash contents on
* device is after a chip erase.
*
* For EEPROM avr_chip_erase_cached() concludes that it has been deleted if a
* previously cached EEPROM page that contained cleared bits now no longer
* has these clear bits on the device. Only with this evidence is the EEPROM
* cache preset to all 0xff otherwise the cache discards all pending writes
* to EEPROM and is left unchanged otherwise.
*
* The avr_page_erase_cached() function erases a page and synchronises it
* with the cache.
*
* Finally, avr_reset_cache() resets the cache without synchronising pending
* writes() to the device.
*
* This file also holds the following utility functions
*
* // Does the programmer/memory combo have paged memory access?
* int avr_has_paged_access(const PROGRAMMER *pgm, const AVRMEM *mem);
*
* // Read the page containing addr from the device into buf
* int avr_read_page_default(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, int addr, unsigned char *buf);
*
* // Write the data page to the device into the page containing addr
* int avr_write_page_default(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, int addr, unsigned char *data);
*
* // Could memory region s1 be the result of a NOR-memory copy of s3 onto s2?
* int avr_is_and(const unsigned char *s1, const unsigned char *s2, const unsigned char *s3, size_t n);
*
*/
/*
* Paged access?
* - Programmer must have paged routines
* - Memory has positive page size, which is a power of two
* - Memory has positive size, which is a multiple of the page size
* - Memory is flash type or eeprom type
*
* Note that in this definition the page size can be 1
*/
int avr_has_paged_access(const PROGRAMMER *pgm, const AVRMEM *mem) {
return pgm->paged_load && pgm->paged_write &&
mem->page_size > 0 && (mem->page_size & (mem->page_size-1)) == 0 &&
mem->size > 0 && mem->size % mem->page_size == 0 &&
(avr_mem_is_flash_type(mem) || avr_mem_is_eeprom_type(mem));
}
#define fallback_read_byte (pgm->read_byte != avr_read_byte_cached? pgm->read_byte: avr_read_byte_default)
#define fallback_write_byte (pgm->write_byte != avr_write_byte_cached? pgm->write_byte: avr_write_byte_default)
/*
* Read the page containing addr from the device into buf
* - Caller to ensure buf has mem->page_size bytes
* - Part memory buffer mem is unaffected by this (though temporarily changed)
* - Uses read_byte() if memory page size is one, otherwise paged_load()
* - Fall back to bytewise read if paged_load() returned an error
* - On failure returns a negative value, on success a non-negative value, which is either
* + The number of bytes read by pgm->paged_load() if that succeeded
* + LIBAVRDUDE_SUCCESS (0) if the fallback of bytewise read succeeded
*/
int avr_read_page_default(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, int addr, unsigned char *buf) {
if(!avr_has_paged_access(pgm, mem) || addr < 0 || addr >= mem->size)
return LIBAVRDUDE_GENERAL_FAILURE;
int rc, pgsize = mem->page_size, base = addr & ~(pgsize-1);
unsigned char *pagecopy = cfg_malloc("avr_read_page_default()", pgsize);
if(pgsize == 1)
return fallback_read_byte(pgm, p, mem, addr, buf);
memcpy(pagecopy, mem->buf + base, pgsize);
if((rc = pgm->paged_load(pgm, p, mem, pgsize, base, pgsize)) >= 0)
memcpy(buf, mem->buf + base, pgsize);
memcpy(mem->buf + base, pagecopy, pgsize);
if(rc < 0 && pgm->read_byte != avr_read_byte_cached) {
rc = LIBAVRDUDE_SUCCESS;
for(int i=0; i<pgsize; i++) {
if(pgm->read_byte(pgm, p, mem, base+i, pagecopy+i) < 0) {
rc = LIBAVRDUDE_GENERAL_FAILURE;
break;
}
}
if(rc == LIBAVRDUDE_SUCCESS)
memcpy(buf, pagecopy, pgsize);
}
free(pagecopy);
return rc;
}
/*
* Write the data page to the device into the page containing addr
* - Caller to provide all mem->page_size bytes incl padding if any
* - Part memory buffer mem is unaffected by this (though temporarily changed)
* - Uses write_byte() if memory page size is one, otherwise paged_write()
*/
int avr_write_page_default(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, int addr, unsigned char *data) {
if(!avr_has_paged_access(pgm, mem) || addr < 0 || addr >= mem->size)
return LIBAVRDUDE_GENERAL_FAILURE;
int rc, pgsize = mem->page_size, base = addr & ~(pgsize-1);
unsigned char *pagecopy = cfg_malloc("avr_write_page_default()", pgsize);
if(pgsize == 1)
return fallback_write_byte(pgm, p, mem, addr, *data);
memcpy(pagecopy, mem->buf + base, pgsize);
memcpy(mem->buf + base, data, pgsize);
rc = pgm->paged_write(pgm, p, mem, pgsize, base, pgsize);
memcpy(mem->buf + base, pagecopy, pgsize);
free(pagecopy);
return rc;
}
// Could memory region s1 be the result of a NOR-memory copy of s3 onto s2?
int avr_is_and(const unsigned char *s1, const unsigned char *s2, const unsigned char *s3, size_t n) {
while(n--)
if(*s1++ != (*s2++ & *s3++))
return 0;
return 1;
}
static int cacheAddress(int addr, const AVR_Cache *cp, const AVRMEM *mem) {
int cacheaddr = addr + (int) (mem->offset - cp->offset);
if(cacheaddr < 0 || cacheaddr >= cp->size) { // Should never happen (unless offsets wrong in avrdude.conf)
pmsg_error("%s cache address 0x%04x out of range [0, 0x%04x]\n", mem->desc, cacheaddr, cp->size-1);
return LIBAVRDUDE_GENERAL_FAILURE;
}
if(mem->page_size != cp->page_size) { // Should never happen (unless incompatible page sizes in avrdude.conf)
pmsg_error("%s page size %d incompatible with cache page size %d\n", mem->desc, mem->page_size, cp->page_size);
return LIBAVRDUDE_GENERAL_FAILURE;
}
return cacheaddr;
}
static int loadCachePage(AVR_Cache *cp, const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, int addr, int cacheaddr, int nlOnErr) {
int pgno = cacheaddr/cp->page_size;
if(!cp->iscached[pgno]) {
// Read cached section from device
int cachebase = cacheaddr & ~(cp->page_size-1);
if(avr_read_page_default(pgm, p, mem, addr & ~(cp->page_size-1), cp->cont + cachebase) < 0) {
report_progress(1, -1, NULL);
if(nlOnErr && quell_progress)
msg_info("\n");
pmsg_error("unable to read %s page at addr 0x%04x\n", mem->desc, addr);
return LIBAVRDUDE_GENERAL_FAILURE;
}
// Copy last read device page, so we can later check for changes
memcpy(cp->copy + cachebase, cp->cont + cachebase, cp->page_size);
cp->iscached[pgno] = 1;
}
return LIBAVRDUDE_SUCCESS;
}
static int initCache(AVR_Cache *cp, const PROGRAMMER *pgm, const AVRPART *p) {
AVRMEM *basemem = avr_locate_mem(p, cp == pgm->cp_flash? "flash": "eeprom");
if(!basemem || !avr_has_paged_access(pgm, basemem))
return LIBAVRDUDE_GENERAL_FAILURE;
cp->size = basemem->size;
cp->page_size = basemem->page_size;
cp->offset = basemem->offset;
cp->cont = cfg_malloc("initCache()", cp->size);
cp->copy = cfg_malloc("initCache()", cp->size);
cp->iscached = cfg_malloc("initCache()", cp->size/cp->page_size);
if((pgm->prog_modes & PM_SPM) && avr_mem_is_flash_type(basemem)) { // Could be vector bootloader
// Caching the vector page gives control to the progammer that then can patch the reset vector
if(loadCachePage(cp, pgm, p, basemem, 0, 0, 0) < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
}
return LIBAVRDUDE_SUCCESS;
}
static int writeCachePage(AVR_Cache *cp, const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, int base, int nlOnErr) {
// Write modified page cont to device; if unsuccessful try bytewise access
if(avr_write_page_default(pgm, p, mem, base, cp->cont + base) < 0) {
if(pgm->read_byte != avr_read_byte_cached && pgm->write_byte != avr_write_byte_cached) {
for(int i=0; i < cp->page_size; i++)
if(cp->cont[base+i] != cp->copy[base+i])
if(pgm->write_byte(pgm, p, mem, base+i, cp->cont[base+i]) < 0 ||
pgm->read_byte(pgm, p, mem, base+i, cp->copy+base+i) < 0) {
report_progress(1, -1, NULL);
if(nlOnErr && quell_progress)
msg_info("\n");
pmsg_error("%s access error at addr 0x%04x\n", mem->desc, base+i);
return LIBAVRDUDE_GENERAL_FAILURE;
}
return LIBAVRDUDE_SUCCESS; // Bytewise writes & reads successful
}
report_progress(1, -1, NULL);
if(nlOnErr && quell_progress)
msg_info("\n");
pmsg_error("write %s page error at addr 0x%04x\n", mem->desc, base);
return LIBAVRDUDE_GENERAL_FAILURE;
}
// Read page back from device and update copy to what is on device
if(avr_read_page_default(pgm, p, mem, base, cp->copy + base) < 0) {
report_progress(1, -1, NULL);
if(nlOnErr && quell_progress)
msg_info("\n");
pmsg_error("unable to read %s page at addr 0x%04x\n", mem->desc, base);
return LIBAVRDUDE_GENERAL_FAILURE;
}
return LIBAVRDUDE_SUCCESS;
}
// Does the memory region only haxe 0xff?
static int _is_all_0xff(const void *p, size_t n) {
const unsigned char *q = (const unsigned char *) p;
return n <= 0 || (*q == 0xff && memcmp(q, q+1, n-1) == 0);
}
// A coarse guess where any bootloader might start (prob underestimates the start)
static int guessBootStart(const PROGRAMMER *pgm, const AVRPART *p) {
int bootstart = 0;
const AVR_Cache *cp = pgm->cp_flash;
if(p->prog_modes & PM_UPDI) // Modern AVRs put the bootloader at 0
return 0;
if(p->n_boot_sections > 0 && p->boot_section_size > 0)
bootstart = cp->size - (p->boot_section_size<<(p->n_boot_sections-1));
if(bootstart <= cp->size/2 || bootstart >= cp->size)
bootstart = cp->size > 32768? cp->size - 16384: cp->size*3/4;
return bootstart & ~(cp->page_size-1);
}
// Page erase but without error messages if it does not work
static int silent_page_erase(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int a) {
int bakverb = verbose;
verbose = -123;
int ret = pgm->page_erase? pgm->page_erase(pgm, p, m, a): -1;
verbose = bakverb;
return ret;
}
typedef struct {
AVRMEM *mem;
AVR_Cache *cp;
int isflash, zopaddr, pgerase;
} CacheDesc_t;
// Write both EEPROM and flash caches to device and free them
int avr_flush_cache(const PROGRAMMER *pgm, const AVRPART *p) {
CacheDesc_t mems[2] = {
{ avr_locate_mem(p, "flash"), pgm->cp_flash, 1, -1, 0 },
{ avr_locate_mem(p, "eeprom"), pgm->cp_eeprom, 0, -1, 0 },
};
int chpages = 0;
bool chiperase = 0;
// Count page changes and find a page that needs a clear bit set
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem || !cp->cont)
continue;
for(int pgno = 0, n = 0; n < cp->size; pgno++, n += cp->page_size) {
if(cp->iscached[pgno])
if(memcmp(cp->copy + n, cp->cont + n, cp->page_size)) {
chpages++;
if(mems[i].zopaddr == -1 && !avr_is_and(cp->cont + n, cp->copy + n, cp->cont + n, cp->page_size))
mems[i].zopaddr = n;
}
}
}
if(!chpages)
return LIBAVRDUDE_SUCCESS;
pmsg_info("synching cache to device ... ");
fflush(stderr);
// Check whether page erase needed and working and whether chip erase needed
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem)
continue;
if(!cp->cont) // Ensure cache is initialised from now on
if(initCache(cp, pgm, p) < 0) {
if(quell_progress)
msg_info("\n");
pmsg_error("unable to initialise the cache\n");
return LIBAVRDUDE_GENERAL_FAILURE;
}
if(chiperase || mems[i].zopaddr < 0)
continue;
int n=mems[i].zopaddr;
if(writeCachePage(cp, pgm, p, mem, n, 1) < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
// Same? OK, can set cleared bit to one, "normal" memory
if(!memcmp(cp->copy + n, cp->cont + n, cp->page_size)) {
chpages--;
continue;
}
// Probably NOR memory, check out page erase
if(silent_page_erase(pgm, p, mem, n) >= 0) {
if(writeCachePage(cp, pgm, p, mem, n, 1) < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
// Worked OK? Can use page erase on this memory
if(!memcmp(cp->copy + n, cp->cont + n, cp->page_size)) {
mems[i].pgerase = 1;
chpages--;
continue;
}
}
chiperase = 1;
}
if(!chpages) {
msg_info("done\n");
return LIBAVRDUDE_SUCCESS;
}
if(chiperase) {
if(quell_progress) {
msg_info("reading/chip erase/writing cycle needed ... ");
fflush(stderr);
}
int nrd = 0;
// Count read operations needed
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem)
continue;
for(int pgno = 0, n = 0; n < cp->size; pgno++, n += cp->page_size)
if(!cp->iscached[pgno])
nrd++;
}
report_progress(0, 1, "Reading");
if(nrd) {
// Read full flash and EEPROM
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem)
continue;
for(int ird = 0, pgno = 0, n = 0; n < cp->size; pgno++, n += cp->page_size) {
if(!cp->iscached[pgno]) {
report_progress(ird++, nrd, NULL);
if(loadCachePage(cp, pgm, p, mem, n, n, 1) < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
}
}
}
}
report_progress(1, 0, NULL);
report_progress(0, 1, "Erasing");
if(avr_chip_erase(pgm, p) < 0) {
report_progress(1, -1, NULL);
if(quell_progress)
msg_info("\n");
pmsg_error("chip erase failed\n");
return LIBAVRDUDE_GENERAL_FAILURE;
}
// Update cache copies after chip erase so that writing back is efficient
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem)
continue;
if(mems[i].isflash) { // flash
memset(cp->copy, 0xff, cp->size); // record device memory as erased
if(pgm->prog_modes & PM_SPM) { // Bootloaders will not overwrite themselves
// Read back generously estimated bootloader section to avoid verification errors
int bootstart = guessBootStart(pgm, p);
int nbo = (cp->size - bootstart)/cp->page_size;
for(int ibo = 0, n = bootstart; n < cp->size; n += cp->page_size) {
report_progress(1+ibo++, nbo+2, NULL);
if(avr_read_page_default(pgm, p, mem, n, cp->copy + n) < 0) {
report_progress(1, -1, NULL);
if(quell_progress)
msg_info("\n");
pmsg_error("flash read failed at addr 0x%04x\n", n);
return LIBAVRDUDE_GENERAL_FAILURE;
}
}
}
} else { // EEPROM
// Don't know whether chip erase has zapped EEPROM
for(int n = 0; n < cp->size; n += cp->page_size) {
if(!_is_all_0xff(cp->copy + n, cp->page_size)) { // First page that had EEPROM data
if(avr_read_page_default(pgm, p, mem, n, cp->copy + n) < 0) {
report_progress(1, -1, NULL);
if(quell_progress)
msg_info("\n");
pmsg_error("EEPROM read failed at addr 0x%04x\n", n);
return LIBAVRDUDE_GENERAL_FAILURE;
}
// EEPROM zapped by chip erase? Set all copy to 0xff
if(_is_all_0xff(cp->copy + n, cp->page_size))
memset(cp->copy, 0xff, cp->size);
break;
}
}
}
}
report_progress(1, 0, NULL);
}
int nwr = 0;
// Count number of writes
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem)
continue;
for(int pgno = 0, n = 0; n < cp->size; pgno++, n += cp->page_size)
if(cp->iscached[pgno] && memcmp(cp->copy + n, cp->cont + n, cp->page_size))
nwr++;
}
report_progress(0, 1, "Writing");
if(nwr) {
// Write all modified pages to the device
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem || !cp->cont)
continue;
for(int iwr = 0, pgno = 0, n = 0; n < cp->size; pgno++, n += cp->page_size) {
if(cp->iscached[pgno] && memcmp(cp->copy + n, cp->cont + n, cp->page_size)) {
if(!chiperase && mems[i].pgerase)
pgm->page_erase(pgm, p, mem, n);
if(writeCachePage(cp, pgm, p, mem, n, 1) < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
if(memcmp(cp->copy + n, cp->cont + n, cp->page_size)) {
report_progress(1, -1, NULL);
if(quell_progress)
msg_info("\n");
pmsg_error("verification mismatch at %s page addr 0x%04x\n", mem->desc, n);
return LIBAVRDUDE_GENERAL_FAILURE;
}
report_progress(iwr++, nwr, NULL);
}
}
}
}
report_progress(1, 0, NULL);
msg_info(quell_progress? "done\n": "\n");
return LIBAVRDUDE_SUCCESS;
}
/*
* Read byte via a read/write cache
* - Used if paged routines available and if memory is EEPROM or flash
* - Otherwise fall back to pgm->read_byte()
* - Out of memory addr: synchronise cache and, if successful, pretend reading a zero
* - Cache is automagically created and initialised if needed
*/
int avr_read_byte_cached(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem,
unsigned long addr, unsigned char *value) {
// Use pgm->read_byte() if not EEPROM/flash or no paged access
if(!avr_has_paged_access(pgm, mem))
return fallback_read_byte(pgm, p, mem, addr, value);
// If address is out of range synchronise cache and, if successful, pretend reading a zero
if(addr >= (unsigned long) mem->size) {
if(avr_flush_cache(pgm, p) < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
*value = 0;
return LIBAVRDUDE_SUCCESS;
}
AVR_Cache *cp = avr_mem_is_eeprom_type(mem)? pgm->cp_eeprom: pgm->cp_flash;
if(!cp->cont) // Init cache if needed
if(initCache(cp, pgm, p) < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
int cacheaddr = cacheAddress((int) addr, cp, mem);
if(cacheaddr < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
// Ensure cache page is there
if(loadCachePage(cp, pgm, p, mem, addr, cacheaddr, 0) < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
*value = cp->cont[cacheaddr];
return LIBAVRDUDE_SUCCESS;
}
/*
* Write byte via a read/write cache
* - Used if paged routines available and if memory is EEPROM or flash
* - Otherwise fall back to pgm->write_byte()
* - Out of memory addr: synchronise cache with device and return whether successful
* - If programmer indicates a readonly spot, return LIBAVRDUDE_SOFTFAIL
* - Cache is automagically created and initialised if needed
*/
int avr_write_byte_cached(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem,
unsigned long addr, unsigned char data) {
if(pgm->readonly && pgm->readonly(pgm, p, mem, addr))
return LIBAVRDUDE_SOFTFAIL;
// Use pgm->write_byte() if not EEPROM/flash or no paged access
if(!avr_has_paged_access(pgm, mem))
return fallback_write_byte(pgm, p, mem, addr, data);
// If address is out of range synchronise caches with device and return whether successful
if(addr >= (unsigned long) mem->size)
return avr_flush_cache(pgm, p);
AVR_Cache *cp = avr_mem_is_eeprom_type(mem)? pgm->cp_eeprom: pgm->cp_flash;
if(!cp->cont) // Init cache if needed
if(initCache(cp, pgm, p) < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
int cacheaddr = cacheAddress((int) addr, cp, mem);
if(cacheaddr < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
// Ensure cache page is there
if(loadCachePage(cp, pgm, p, mem, addr, cacheaddr, 0) < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
cp->cont[cacheaddr] = data;
return LIBAVRDUDE_SUCCESS;
}
// Erase the chip and set the cache accordingly
int avr_chip_erase_cached(const PROGRAMMER *pgm, const AVRPART *p) {
CacheDesc_t mems[2] = {
{ avr_locate_mem(p, "flash"), pgm->cp_flash, 1, -1, 0 },
{ avr_locate_mem(p, "eeprom"), pgm->cp_eeprom, 0, -1, 0 },
};
int rc;
if((rc = pgm->chip_erase(pgm, p)) < 0)
return rc;
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVRMEM *mem = mems[i].mem;
AVR_Cache *cp = mems[i].cp;
if(!mem || !avr_has_paged_access(pgm, mem))
continue;
if(!cp->cont) // Init cache if needed
if(initCache(cp, pgm, p) < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
if(mems[i].isflash) { // flash
if(pgm->prog_modes & PM_SPM) { // reset cache to unknown
memset(cp->iscached, 0, cp->size/cp->page_size);
} else { // preset all pages as erased
memset(cp->copy, 0xff, cp->size);
memset(cp->cont, 0xff, cp->size);
memset(cp->iscached, 1, cp->size/cp->page_size);
}
} else { // EEPROM: test whether cached pages were zapped
bool erasedee = 0;
for(int pgno = 0, n = 0; n < cp->size; pgno++, n += cp->page_size) {
if(cp->iscached[pgno]) {
if(!_is_all_0xff(cp->copy + n, cp->page_size)) { // Page has EEPROM data?
if(avr_read_page_default(pgm, p, mem, n, cp->copy + n) < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
erasedee = _is_all_0xff(cp->copy + n, cp->page_size);
break;
}
}
}
if(erasedee) { // EEPROM was erased, set cache correspondingly
memset(cp->copy, 0xff, cp->size);
memset(cp->cont, 0xff, cp->size);
memset(cp->iscached, 1, cp->size/cp->page_size);
} else { // discard previous writes, but leave cache
for(int pgno = 0, n = 0; n < cp->size; pgno++, n += cp->page_size)
if(cp->iscached[pgno])
memcpy(cp->cont + n, cp->copy + n, cp->page_size);
}
}
}
return LIBAVRDUDE_SUCCESS;
}
// Erase a page and synchronise it with the cache
int avr_page_erase_cached(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem,
unsigned int uaddr) {
int addr = uaddr;
if(!avr_has_paged_access(pgm, mem) || addr < 0 || addr >= mem->size)
return LIBAVRDUDE_GENERAL_FAILURE;
if(mem->page_size == 1) {
if(fallback_write_byte(pgm, p, mem, uaddr, 0xff) < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
} else {
if(silent_page_erase(pgm, p, mem, uaddr) < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
}
AVR_Cache *cp = avr_mem_is_eeprom_type(mem)? pgm->cp_eeprom: pgm->cp_flash;
if(!cp->cont) // Init cache if needed
if(initCache(cp, pgm, p) < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
int cacheaddr = cacheAddress(addr, cp, mem);
if(cacheaddr < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
// Invalidate this cache page and read back, ie, we don't trust the page_erase() routine
cp->iscached[cacheaddr/cp->page_size] = 0;
// Reload cache page
if(loadCachePage(cp, pgm, p, mem, (int) addr, cacheaddr, 0) < 0)
return LIBAVRDUDE_GENERAL_FAILURE;
if(!_is_all_0xff(cp->cont + (cacheaddr & ~(cp->page_size-1)), cp->page_size))
return LIBAVRDUDE_GENERAL_FAILURE;
return LIBAVRDUDE_SUCCESS;
}
// Free cache(s) discarding any pending writes
int avr_reset_cache(const PROGRAMMER *pgm, const AVRPART *p_unused) {
AVR_Cache *mems[2] = { pgm->cp_flash, pgm->cp_eeprom, };
for(size_t i = 0; i < sizeof mems/sizeof*mems; i++) {
AVR_Cache *cp = mems[i];
if(cp->cont)
free(cp->cont);
if(cp->copy)
free(cp->copy);
if(cp->iscached)
free(cp->iscached);
memset(cp, 0, sizeof*cp);
}
return LIBAVRDUDE_SUCCESS;
}

File diff suppressed because it is too large Load Diff

16520
src/avrdude.conf.in Normal file

File diff suppressed because it is too large Load Diff

97
src/avrdude.h Normal file
View File

@ -0,0 +1,97 @@
/*
* avrdude - A Downloader/Uploader for AVR device programmers
* Copyright (C) 2007 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
* 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 avrdude_h
#define avrdude_h
#include <stdio.h>
#define SYSTEM_CONF_FILE "avrdude.conf"
#if defined(WIN32)
#define USER_CONF_FILE "avrdude.rc"
#else
#define USER_CONF_FILE ".avrduderc"
#define XDG_USER_CONF_FILE "avrdude/avrdude.rc"
#endif
extern char *progname; // Name of program, for messages
extern char progbuf[]; // Spaces same length as progname
extern int ovsigck; // Override signature check (-F)
extern int verbose; // Verbosity level (-v, -vv, ...)
extern int quell_progress; // Quell progress report -q, reduce effective verbosity level (-qq, -qqq)
extern const char *partdesc; // Part id
int avrdude_message(int msglvl, const char *format, ...);
int avrdude_message2(FILE *fp, int lno, const char *file, const char *func, int msgmode, int msglvl, const char *format, ...);
#define MSG_EXT_ERROR (-3) // OS-type error, no -v option, can be suppressed with -qqqqq
#define MSG_ERROR (-2) // Avrdude error, no -v option, can be suppressed with -qqqq
#define MSG_WARNING (-1) // Warning, no -v option, can be suppressed with -qqq
#define MSG_INFO 0 // Commentary, no -v option, can be suppressed with -qq
#define MSG_NOTICE 1 // Displayed with -v
#define MSG_NOTICE2 2 // Displayed with -vv
#define MSG_DEBUG 3 // Displayed with -vvv
#define MSG_TRACE 4 // Displayed with -vvvv, show trace communication
#define MSG_TRACE2 5 // Displayed with -vvvvv
#define MSG2_PROGNAME 1 // Start by printing progname
#define MSG2_FUNCTION 2 // Print calling function (1st arg) after progname if >= notice
#define MSG2_FILELINE 4 // Print source file and line number after function if >= debug
#define MSG2_TYPE 8 // Print message type after function or progname
#define MSG2_INDENT1 16 // Start by printing indentation of progname+1 blanks
#define MSG2_INDENT2 32 // Start by printing indentation of progname+2 blanks
#define MSG2_FLUSH 64 // Flush before and after printing
// Shortcuts
#define msg_ext_error(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, 0, MSG_EXT_ERROR, __VA_ARGS__)
#define msg_error(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, 0, MSG_ERROR, __VA_ARGS__)
#define msg_warning(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, 0, MSG_WARNING, __VA_ARGS__)
#define msg_info(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, 0, MSG_INFO, __VA_ARGS__)
#define msg_notice(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, 0, MSG_NOTICE, __VA_ARGS__)
#define msg_notice2(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, 0, MSG_NOTICE2, __VA_ARGS__)
#define msg_debug(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, 0, MSG_DEBUG, __VA_ARGS__)
#define msg_trace(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, 0, MSG_TRACE, __VA_ARGS__)
#define msg_trace2(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, 0, MSG_TRACE2, __VA_ARGS__)
#define pmsg_ext_error(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_PROGNAME|MSG2_FUNCTION|MSG2_FILELINE|MSG2_TYPE|MSG2_FLUSH, MSG_EXT_ERROR, __VA_ARGS__)
#define pmsg_error(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_PROGNAME|MSG2_FUNCTION|MSG2_FILELINE|MSG2_TYPE|MSG2_FLUSH, MSG_ERROR, __VA_ARGS__)
#define pmsg_warning(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_PROGNAME|MSG2_FUNCTION|MSG2_FILELINE|MSG2_TYPE|MSG2_FLUSH, MSG_WARNING, __VA_ARGS__)
#define pmsg_info(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_PROGNAME|MSG2_FLUSH, MSG_INFO, __VA_ARGS__)
#define pmsg_notice(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_PROGNAME|MSG2_FLUSH, MSG_NOTICE, __VA_ARGS__)
#define pmsg_notice2(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_PROGNAME|MSG2_FLUSH, MSG_NOTICE2, __VA_ARGS__)
#define pmsg_debug(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_PROGNAME|MSG2_FLUSH, MSG_DEBUG, __VA_ARGS__)
#define pmsg_trace(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_PROGNAME|MSG2_FLUSH, MSG_TRACE, __VA_ARGS__)
#define pmsg_trace2(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_PROGNAME|MSG2_FLUSH, MSG_TRACE2, __VA_ARGS__)
#define imsg_ext_error(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_INDENT1|MSG2_FLUSH, MSG_EXT_ERROR, __VA_ARGS__)
#define imsg_error(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_INDENT1|MSG2_FLUSH, MSG_ERROR, __VA_ARGS__)
#define imsg_warning(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_INDENT1|MSG2_FLUSH, MSG_WARNING, __VA_ARGS__)
#define imsg_info(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_INDENT2|MSG2_FLUSH, MSG_INFO, __VA_ARGS__)
#define imsg_notice(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_INDENT2|MSG2_FLUSH, MSG_NOTICE, __VA_ARGS__)
#define imsg_notice2(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_INDENT2|MSG2_FLUSH, MSG_NOTICE2, __VA_ARGS__)
#define imsg_debug(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_INDENT2|MSG2_FLUSH, MSG_DEBUG, __VA_ARGS__)
#define imsg_trace(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_INDENT2|MSG2_FLUSH, MSG_TRACE, __VA_ARGS__)
#define imsg_trace2(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, MSG2_INDENT2|MSG2_FLUSH, MSG_TRACE2, __VA_ARGS__)
#define term_out(...) avrdude_message2(stdout, __LINE__, __FILE__, __func__, MSG2_FLUSH, MSG_INFO, __VA_ARGS__)
#define fmsg_out(fp, ...) avrdude_message2(fp, __LINE__, __FILE__, __func__, MSG2_FLUSH, MSG_INFO, __VA_ARGS__)
#endif

View File

@ -50,28 +50,24 @@
#ifdef DO_NOT_BUILD_AVRFTDI
static int avrftdi_noftdi_open (struct programmer_t *pgm, char * name)
{
avrdude_message(MSG_INFO, "%s: Error: no libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.\n",
progname);
static int avrftdi_noftdi_open(PROGRAMMER *pgm, const char *name) {
pmsg_error("no libftdi or libusb support; install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again\n");
return -1;
}
void avrftdi_initpgm(PROGRAMMER * pgm)
{
void avrftdi_initpgm(PROGRAMMER *pgm) {
strcpy(pgm->type, "avrftdi");
pgm->open = avrftdi_noftdi_open;
}
#else
enum { FTDI_SCK = 0, FTDI_MOSI, FTDI_MISO, FTDI_RESET };
enum { FTDI_SCK = 0, FTDI_SDO, FTDI_SDI, FTDI_RESET };
static int write_flush(avrftdi_t *);
/*
* returns a human-readable name for a pin number. the name should match with
* returns a human-readable name for a pin number. The name should match with
* the pin names used in FTDI datasheets.
*/
static char*
@ -125,7 +121,7 @@ ftdi_pin_name(avrftdi_t* pdata, struct pindef_t pin)
}
/*
* output function, to save if(vebose>level)-constructs. also prefixes output
* output function, to save if(vebose>level)-constructs. Also prefixes output
* with "avrftdi function-name(line-number):" to identify were messages came
* from.
* This function is the backend of the log_*-macros, but it can be used
@ -142,14 +138,14 @@ void avrftdi_log(int level, const char * func, int line,
if(!skip_prefix)
{
switch(level) {
case ERR: avrdude_message(MSG_INFO, "E "); break;
case WARN: avrdude_message(MSG_INFO, "W "); break;
case INFO: avrdude_message(MSG_INFO, "I "); break;
case DEBUG: avrdude_message(MSG_INFO, "D "); break;
case TRACE: avrdude_message(MSG_INFO, "T "); break;
default: avrdude_message(MSG_INFO, " "); break;
case ERR: msg_error("E "); break;
case WARN: msg_error("W "); break;
case INFO: msg_error("I "); break;
case DEBUG: msg_error("D "); break;
case TRACE: msg_error("T "); break;
default: msg_error(" "); break;
}
avrdude_message(MSG_INFO, "%s(%d): ", func, line);
msg_error("%s(%d): ", func, line);
}
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
@ -163,25 +159,25 @@ void avrftdi_log(int level, const char * func, int line,
}
/*
* helper function to print a binary buffer *buf of size len. begin and end of
* the dump are enclosed in the string contained in *desc. offset denotes the
* number of bytes which are printed on the first line (may be 0). after that
* helper function to print a binary buffer *buf of size len. Begin and end of
* the dump are enclosed in the string contained in *desc. Offset denotes the
* number of bytes which are printed on the first line (may be 0). After that
* width bytes are printed on each line
*/
static void buf_dump(const unsigned char *buf, int len, char *desc,
int offset, int width)
{
int i;
avrdude_message(MSG_INFO, "%s begin:\n", desc);
msg_info("%s begin:\n", desc);
for (i = 0; i < offset; i++)
avrdude_message(MSG_INFO, "%02x ", buf[i]);
avrdude_message(MSG_INFO, "\n");
msg_info("%02x ", buf[i]);
msg_info("\n");
for (i++; i <= len; i++) {
avrdude_message(MSG_INFO, "%02x ", buf[i-1]);
msg_info("%02x ", buf[i-1]);
if((i-offset) != 0 && (i-offset)%width == 0)
avrdude_message(MSG_INFO, "\n");
msg_info("\n");
}
avrdude_message(MSG_INFO, "%s end\n", desc);
msg_info("%s end\n", desc);
}
/*
@ -220,15 +216,17 @@ static int set_frequency(avrftdi_t* ftdi, uint32_t freq)
}
/*
* This function sets or clears any pin, except SCK, MISO and MOSI. Depending
* This function sets or clears any pin, except SCK, SDI and SDO. Depending
* on the pin configuration, a non-zero value sets the pin in the 'active'
* state (high active, low active) and a zero value sets the pin in the
* inactive state.
* Because we configured the pin direction mask earlier, nothing bad can happen
* here.
*/
static int set_pin(PROGRAMMER * pgm, int pinfunc, int value)
{
static int set_pin(const PROGRAMMER *pgm, int pinfunc, int value) {
if(pinfunc < 0 || pinfunc >= N_PINS)
return -1;
avrftdi_t* pdata = to_pdata(pgm);
struct pindef_t pin = pgm->pin[pinfunc];
@ -250,54 +248,50 @@ static int set_pin(PROGRAMMER * pgm, int pinfunc, int value)
/*
* Mandatory callbacks which boil down to GPIO.
*/
static int set_led_pgm(struct programmer_t * pgm, int value)
{
static int set_led_pgm(const PROGRAMMER *pgm, int value) {
return set_pin(pgm, PIN_LED_PGM, value);
}
static int set_led_rdy(struct programmer_t * pgm, int value)
{
static int set_led_rdy(const PROGRAMMER *pgm, int value) {
return set_pin(pgm, PIN_LED_RDY, value);
}
static int set_led_err(struct programmer_t * pgm, int value)
{
static int set_led_err(const PROGRAMMER *pgm, int value) {
return set_pin(pgm, PIN_LED_ERR, value);
}
static int set_led_vfy(struct programmer_t * pgm, int value)
{
static int set_led_vfy(const PROGRAMMER *pgm, int value) {
return set_pin(pgm, PIN_LED_VFY, value);
}
static void avrftdi_enable(PROGRAMMER * pgm)
{
static void avrftdi_enable(PROGRAMMER *pgm, const AVRPART *p) {
set_pin(pgm, PPI_AVR_BUFF, ON);
// Switch to TPI initialisation in avrftdi_tpi.c
if(p->prog_modes & PM_TPI)
avrftdi_tpi_initpgm(pgm);
}
static void avrftdi_disable(PROGRAMMER * pgm)
{
static void avrftdi_disable(const PROGRAMMER *pgm) {
set_pin(pgm, PPI_AVR_BUFF, OFF);
}
static void avrftdi_powerup(PROGRAMMER * pgm)
{
static void avrftdi_powerup(const PROGRAMMER *pgm) {
set_pin(pgm, PPI_AVR_VCC, ON);
}
static void avrftdi_powerdown(PROGRAMMER * pgm)
{
static void avrftdi_powerdown(const PROGRAMMER *pgm) {
set_pin(pgm, PPI_AVR_VCC, OFF);
}
static inline int set_data(PROGRAMMER * pgm, unsigned char *buf, unsigned char data, bool read_data) {
static inline int set_data(const PROGRAMMER *pgm, unsigned char *buf, unsigned char data, bool read_data) {
int j;
int buf_pos = 0;
unsigned char bit = 0x80;
avrftdi_t* pdata = to_pdata(pgm);
for (j=0; j<8; j++) {
pdata->pin_value = SET_BITS_0(pdata->pin_value,pgm,PIN_AVR_MOSI,data & bit);
pdata->pin_value = SET_BITS_0(pdata->pin_value,pgm,PIN_AVR_SDO,data & bit);
pdata->pin_value = SET_BITS_0(pdata->pin_value,pgm,PIN_AVR_SCK,0);
buf[buf_pos++] = SET_BITS_LOW;
buf[buf_pos++] = (pdata->pin_value) & 0xff;
@ -324,7 +318,7 @@ static inline int set_data(PROGRAMMER * pgm, unsigned char *buf, unsigned char d
return buf_pos;
}
static inline unsigned char extract_data(PROGRAMMER * pgm, unsigned char *buf, int offset) {
static inline unsigned char extract_data(const PROGRAMMER *pgm, unsigned char *buf, int offset) {
int j;
unsigned char bit = 0x80;
unsigned char r = 0;
@ -332,7 +326,7 @@ static inline unsigned char extract_data(PROGRAMMER * pgm, unsigned char *buf, i
buf += offset * 16; // 2 bytes per bit, 8 bits
for (j=0; j<8; j++) {
uint16_t in = buf[0] | (buf[1] << 8);
if (GET_BITS_0(in,pgm,PIN_AVR_MISO)) {
if (GET_BITS_0(in,pgm,PIN_AVR_SDI)) {
r |= bit;
}
buf += 2; // 2 bytes per input
@ -342,7 +336,7 @@ static inline unsigned char extract_data(PROGRAMMER * pgm, unsigned char *buf, i
}
static int avrftdi_transmit_bb(PROGRAMMER * pgm, unsigned char mode, const unsigned char *buf,
static int avrftdi_transmit_bb(const PROGRAMMER *pgm, unsigned char mode, const unsigned char *buf,
unsigned char *data, int buf_size)
{
size_t remaining = buf_size;
@ -351,10 +345,13 @@ static int avrftdi_transmit_bb(PROGRAMMER * pgm, unsigned char mode, const unsig
size_t blocksize = pdata->rx_buffer_size/2; // we are reading 2 bytes per data byte
// determine a maximum size of data block
size_t max_size = MIN(pdata->ftdic->max_packet_size,pdata->tx_buffer_size);
size_t max_size = MIN(pdata->ftdic->max_packet_size, (unsigned int) pdata->tx_buffer_size);
// select block size so that resulting commands does not exceed max_size if possible
blocksize = MAX(1,(max_size-7)/((8*2*6)+(8*1*2)));
//avrdude_message(MSG_INFO, "blocksize %d \n",blocksize);
// msg_info("blocksize %d \n", blocksize);
unsigned char* send_buffer = alloca((8 * 2 * 6) * blocksize + (8 * 1 * 2) * blocksize + 7);
unsigned char* recv_buffer = alloca(2 * 16 * blocksize);
while(remaining)
{
@ -364,11 +361,9 @@ static int avrftdi_transmit_bb(PROGRAMMER * pgm, unsigned char mode, const unsig
// (8*2) outputs per data byte, 6 transmit bytes per output (SET_BITS_LOW/HIGH),
// (8*1) inputs per data byte, 2 transmit bytes per input (GET_BITS_LOW/HIGH),
// 1x SEND_IMMEDIATE
unsigned char send_buffer[(8*2*6)*transfer_size+(8*1*2)*transfer_size+7];
int len = 0;
int i;
for(i = 0 ; i< transfer_size; i++) {
for(size_t i = 0 ; i < transfer_size; i++) {
len += set_data(pgm, send_buffer + len, buf[written+i], (mode & MPSSE_DO_READ) != 0);
}
@ -384,16 +379,15 @@ static int avrftdi_transmit_bb(PROGRAMMER * pgm, unsigned char mode, const unsig
E(ftdi_write_data(pdata->ftdic, send_buffer, len) != len, pdata->ftdic);
if (mode & MPSSE_DO_READ) {
unsigned char recv_buffer[2*16*transfer_size];
int n;
int k = 0;
size_t k = 0;
do {
n = ftdi_read_data(pdata->ftdic, &recv_buffer[k], 2*16*transfer_size - k);
E(n < 0, pdata->ftdic);
k += n;
} while (k < transfer_size);
for(i = 0 ; i< transfer_size; i++) {
for(size_t i = 0 ; i< transfer_size; i++) {
data[written + i] = extract_data(pgm, recv_buffer, i);
}
}
@ -436,7 +430,7 @@ static int avrftdi_transmit_mpsse(avrftdi_t* pdata, unsigned char mode, const un
{
size_t transfer_size = (remaining > blocksize) ? blocksize : remaining;
E(ftdi_write_data(pdata->ftdic, (unsigned char*)&buf[written], transfer_size) != transfer_size, pdata->ftdic);
E((size_t) ftdi_write_data(pdata->ftdic, (unsigned char*)&buf[written], transfer_size) != transfer_size, pdata->ftdic);
#if 0
if(remaining < blocksize)
E(ftdi_write_data(pdata->ftdic, &si, sizeof(si)) != sizeof(si), pdata->ftdic);
@ -444,7 +438,7 @@ static int avrftdi_transmit_mpsse(avrftdi_t* pdata, unsigned char mode, const un
if (mode & MPSSE_DO_READ) {
int n;
int k = 0;
size_t k = 0;
do {
n = ftdi_read_data(pdata->ftdic, &data[written + k], transfer_size - k);
E(n < 0, pdata->ftdic);
@ -460,7 +454,7 @@ static int avrftdi_transmit_mpsse(avrftdi_t* pdata, unsigned char mode, const un
return written;
}
static inline int avrftdi_transmit(PROGRAMMER * pgm, unsigned char mode, const unsigned char *buf,
static inline int avrftdi_transmit(const PROGRAMMER *pgm, unsigned char mode, const unsigned char *buf,
unsigned char *data, int buf_size)
{
avrftdi_t* pdata = to_pdata(pgm);
@ -519,8 +513,7 @@ static int write_flush(avrftdi_t* pdata)
}
static int avrftdi_check_pins_bb(PROGRAMMER * pgm, bool output)
{
static int avrftdi_check_pins_bb(const PROGRAMMER *pgm, bool output) {
int pin;
/* pin checklist. */
@ -531,7 +524,7 @@ static int avrftdi_check_pins_bb(PROGRAMMER * pgm, bool output)
/* value for 8/12/16 bit wide interface */
int valid_mask = ((1 << pdata->pin_limit) - 1);
log_debug("Using valid mask bibanging: 0x%08x\n", valid_mask);
log_debug("Using valid mask bitbanging: 0x%08x\n", valid_mask);
static struct pindef_t valid_pins;
valid_pins.mask[0] = valid_mask;
valid_pins.inverse[0] = valid_mask ;
@ -547,8 +540,7 @@ static int avrftdi_check_pins_bb(PROGRAMMER * pgm, bool output)
return pins_check(pgm, pin_checklist, N_PINS, output);
}
static int avrftdi_check_pins_mpsse(PROGRAMMER * pgm, bool output)
{
static int avrftdi_check_pins_mpsse(const PROGRAMMER *pgm, bool output) {
int pin;
/* pin checklist. */
@ -556,16 +548,16 @@ static int avrftdi_check_pins_mpsse(PROGRAMMER * pgm, bool output)
avrftdi_t* pdata = to_pdata(pgm);
/* SCK/MOSI/MISO are fixed and not invertable?*/
/* TODO: inverted SCK/MISO/MOSI */
static const struct pindef_t valid_pins_SCK = {{0x01},{0x00}} ;
static const struct pindef_t valid_pins_MOSI = {{0x02},{0x00}} ;
static const struct pindef_t valid_pins_MISO = {{0x04},{0x00}} ;
/* SCK/SDO/SDI are fixed and not invertible? */
/* TODO: inverted SCK/SDI/SDO */
static const struct pindef_t valid_pins_SCK = {{0x01},{0x00}};
static const struct pindef_t valid_pins_SDO = {{0x02},{0x00}};
static const struct pindef_t valid_pins_SDI = {{0x04},{0x00}};
/* value for 8/12/16 bit wide interface for other pins */
int valid_mask = ((1 << pdata->pin_limit) - 1);
/* mask out SCK/MISO/MOSI */
valid_mask &= ~((1 << FTDI_SCK) | (1 << FTDI_MOSI) | (1 << FTDI_MISO));
/* mask out SCK/SDI/SDO */
valid_mask &= ~((1 << FTDI_SCK) | (1 << FTDI_SDO) | (1 << FTDI_SDI));
log_debug("Using valid mask mpsse: 0x%08x\n", valid_mask);
static struct pindef_t valid_pins_others;
@ -582,18 +574,17 @@ static int avrftdi_check_pins_mpsse(PROGRAMMER * pgm, bool output)
/* now set mpsse specific pins */
pin_checklist[PIN_AVR_SCK].mandatory = 1;
pin_checklist[PIN_AVR_SCK].valid_pins = &valid_pins_SCK;
pin_checklist[PIN_AVR_MOSI].mandatory = 1;
pin_checklist[PIN_AVR_MOSI].valid_pins = &valid_pins_MOSI;
pin_checklist[PIN_AVR_MISO].mandatory = 1;
pin_checklist[PIN_AVR_MISO].valid_pins = &valid_pins_MISO;
pin_checklist[PIN_AVR_SDO].mandatory = 1;
pin_checklist[PIN_AVR_SDO].valid_pins = &valid_pins_SDO;
pin_checklist[PIN_AVR_SDI].mandatory = 1;
pin_checklist[PIN_AVR_SDI].valid_pins = &valid_pins_SDI;
pin_checklist[PIN_AVR_RESET].mandatory = 1;
/* assumes all checklists above have same number of entries */
return pins_check(pgm, pin_checklist, N_PINS, output);
}
static int avrftdi_pin_setup(PROGRAMMER * pgm)
{
static int avrftdi_pin_setup(const PROGRAMMER *pgm) {
int pin;
/*************
@ -611,30 +602,31 @@ static int avrftdi_pin_setup(PROGRAMMER * pgm)
avrftdi_check_pins_bb(pgm, true);
log_err("Pin configuration for FTDI MPSSE must be:\n");
log_err("%s: 0, %s: 1, %s: 2 (is: %s, %s, %s)\n", avr_pin_name(PIN_AVR_SCK),
avr_pin_name(PIN_AVR_MOSI), avr_pin_name(PIN_AVR_MISO),
pins_to_str(&pgm->pin[PIN_AVR_SCK]),
pins_to_str(&pgm->pin[PIN_AVR_MOSI]),
pins_to_str(&pgm->pin[PIN_AVR_MISO]));
avr_pin_name(PIN_AVR_SDO), avr_pin_name(PIN_AVR_SDI),
pins_to_str(&pgm->pin[PIN_AVR_SCK]),
pins_to_str(&pgm->pin[PIN_AVR_SDO]),
pins_to_str(&pgm->pin[PIN_AVR_SDI]));
log_err("If other pin configuration is used, fallback to slower bitbanging mode is used.\n");
return -1;
}
pdata->use_bitbanging = !pin_check_mpsse;
if (pdata->use_bitbanging) log_info("Because of pin configuration fallback to bitbanging mode.\n");
if (pdata->use_bitbanging)
log_info("Because of pin configuration fallback to bitbanging mode.\n");
/*
* TODO: No need to fail for a wrongly configured led or something.
* Maybe we should only fail for SCK; MISO, MOSI, RST (and probably
* Maybe we should only fail for SCK; SDI, SDO, RST (and probably
* VCC and BUFF).
*/
/* everything is an output, except MISO */
/* everything is an output, except SDI */
for(pin = 0; pin < N_PINS; ++pin) {
pdata->pin_direction |= pgm->pin[pin].mask[0];
pdata->pin_value = SET_BITS_0(pdata->pin_value, pgm, pin, OFF);
}
pdata->pin_direction &= ~pgm->pin[PIN_AVR_MISO].mask[0];
pdata->pin_direction &= ~pgm->pin[PIN_AVR_SDI].mask[0];
for(pin = PIN_LED_ERR; pin < N_PINS; ++pin) {
pdata->led_mask |= pgm->pin[pin].mask[0];
@ -647,10 +639,9 @@ static int avrftdi_pin_setup(PROGRAMMER * pgm)
return 0;
}
static int avrftdi_open(PROGRAMMER * pgm, char *port)
{
static int avrftdi_open(PROGRAMMER *pgm, const char *port) {
int vid, pid, interface, index, err;
char * serial, *desc;
const char *serial, *desc;
avrftdi_t* pdata = to_pdata(pgm);
@ -670,8 +661,7 @@ static int avrftdi_open(PROGRAMMER * pgm, char *port)
if (usbpid) {
pid = *(int *)(ldata(usbpid));
if (lnext(usbpid))
avrdude_message(MSG_INFO, "%s: Warning: using PID 0x%04x, ignoring remaining PIDs in list\n",
progname, pid);
pmsg_warning("using PID 0x%04x, ignoring remaining PIDs in list\n", pid);
} else
pid = USB_DEVICE_FT2232;
@ -705,7 +695,7 @@ static int avrftdi_open(PROGRAMMER * pgm, char *port)
if(err) {
log_err("Error %d occurred: %s\n", err, ftdi_get_error_string(pdata->ftdic));
//stupid hack, because avrdude calls pgm->close() even when pgm->open() fails
//and usb_dev is intialized to the last usb device from probing
//and usb_dev is initialized to the last usb device from probing
pdata->ftdic->usb_dev = NULL;
return err;
} else {
@ -720,7 +710,11 @@ static int avrftdi_open(PROGRAMMER * pgm, char *port)
/* set SPI mode */
E(ftdi_set_bitmode(pdata->ftdic, 0, BITMODE_RESET) < 0, pdata->ftdic);
E(ftdi_set_bitmode(pdata->ftdic, pdata->pin_direction & 0xff, BITMODE_MPSSE) < 0, pdata->ftdic);
#ifdef HAVE_FTDI_TCIOFLUSH
E(ftdi_tcioflush(pdata->ftdic), pdata->ftdic);
#else
E(ftdi_usb_purge_buffers(pdata->ftdic), pdata->ftdic);
#endif
write_flush(pdata);
@ -757,7 +751,11 @@ static int avrftdi_open(PROGRAMMER * pgm, char *port)
pdata->tx_buffer_size = 1024;
break;
#else
#ifdef _MSC_VER
#pragma message("No support for 232H, use a newer libftdi, version >= 0.20")
#else
#warning No support for 232H, use a newer libftdi, version >= 0.20
#endif
#endif
case TYPE_4232H:
pdata->pin_limit = 8;
@ -808,11 +806,10 @@ static void avrftdi_close(PROGRAMMER * pgm)
return;
}
static int avrftdi_initialize(PROGRAMMER * pgm, AVRPART * p)
{
static int avrftdi_initialize(const PROGRAMMER *pgm, const AVRPART *p) {
avrftdi_powerup(pgm);
if(p->flags & AVRPART_HAS_TPI)
if(p->prog_modes & PM_TPI)
{
/* see avrftdi_tpi.c */
avrftdi_tpi_initialize(pgm, p);
@ -831,28 +828,25 @@ static int avrftdi_initialize(PROGRAMMER * pgm, AVRPART * p)
/*setting rst back to 0 */
set_pin(pgm, PIN_AVR_RESET, OFF);
/*wait at least 20ms bevor issuing spi commands to avr */
/*wait at least 20ms before issuing spi commands to avr */
usleep(20 * 1000);
}
return pgm->program_enable(pgm, p);
}
static void avrftdi_display(PROGRAMMER * pgm, const char *p)
{
// print the full pin definitiions as in ft245r ?
static void avrftdi_display(const PROGRAMMER *pgm, const char *p) {
// print the full pin definitions as in ft245r ?
return;
}
static int avrftdi_cmd(PROGRAMMER * pgm, const unsigned char *cmd, unsigned char *res)
{
static int avrftdi_cmd(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned char *res) {
return avrftdi_transmit(pgm, MPSSE_DO_READ | MPSSE_DO_WRITE, cmd, res, 4);
}
static int avrftdi_program_enable(PROGRAMMER * pgm, AVRPART * p)
{
static int avrftdi_program_enable(const PROGRAMMER *pgm, const AVRPART *p) {
int i;
unsigned char buf[4];
@ -883,8 +877,7 @@ static int avrftdi_program_enable(PROGRAMMER * pgm, AVRPART * p)
}
static int avrftdi_chip_erase(PROGRAMMER * pgm, AVRPART * p)
{
static int avrftdi_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) {
unsigned char cmd[4];
unsigned char res[4];
@ -906,10 +899,20 @@ static int avrftdi_chip_erase(PROGRAMMER * pgm, AVRPART * p)
/* Load extended address byte command */
static int
avrftdi_lext(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, unsigned int address)
{
avrftdi_lext(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int address) {
/* nothing to do if load extended address command unavailable */
if(m->op[AVR_OP_LOAD_EXT_ADDR] == NULL)
return 0;
avrftdi_t *pdata = to_pdata(pgm);
unsigned char buf[] = { 0x00, 0x00, 0x00, 0x00 };
/* only send load extended address command if high byte changed */
if(pdata->lext_byte == (uint8_t) (address>>16))
return 0;
pdata->lext_byte = (uint8_t) (address>>16);
avr_set_bits(m->op[AVR_OP_LOAD_EXT_ADDR], buf);
avr_set_addr(m->op[AVR_OP_LOAD_EXT_ADDR], buf, address);
@ -923,7 +926,7 @@ avrftdi_lext(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m, unsigned int address)
return 0;
}
static int avrftdi_eeprom_write(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m,
static int avrftdi_eeprom_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned int page_size, unsigned int addr, unsigned int len)
{
unsigned char cmd[] = { 0x00, 0x00, 0x00, 0x00 };
@ -945,14 +948,16 @@ static int avrftdi_eeprom_write(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m,
return len;
}
static int avrftdi_eeprom_read(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m,
static int avrftdi_eeprom_read(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned int page_size, unsigned int addr, unsigned int len)
{
unsigned char cmd[4];
unsigned char buffer[len], *bufptr = buffer;
unsigned int add;
unsigned char* buffer = alloca(len);
unsigned char* bufptr = buffer;
memset(buffer, 0, len);
memset(buffer, 0, sizeof(buffer));
for (add = addr; add < addr + len; add++)
{
memset(cmd, 0, sizeof(cmd));
@ -969,20 +974,19 @@ static int avrftdi_eeprom_read(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m,
return len;
}
static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int avrftdi_flash_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned int page_size, unsigned int addr, unsigned int len)
{
int use_lext_address = m->op[AVR_OP_LOAD_EXT_ADDR] != NULL;
unsigned int word;
unsigned int poll_index;
unsigned int buf_size;
unsigned char poll_byte;
unsigned char *buffer = &m->buf[addr];
unsigned char buf[4*len+4], *bufptr = buf;
unsigned int buf_size = 4 * len + 4;
unsigned char* buf = alloca(buf_size);
unsigned char* bufptr = buf;
memset(buf, 0, sizeof(buf));
memset(buf, 0, buf_size);
/* pre-check opcodes */
if (m->op[AVR_OP_LOADPAGE_LO] == NULL) {
@ -994,29 +998,19 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
return -1;
}
if(page_size != m->page_size) {
if(page_size != (unsigned int) m->page_size) {
log_warn("Parameter page_size is %d, ", page_size);
log_warn("but m->page_size is %d. Using the latter.\n", m->page_size);
}
page_size = m->page_size;
/* if we do cross a 64k word boundary (or write the
* first page), we need to issue a 'load extended
* address byte' command, which is defined as 0x4d
* 0x00 <address byte> 0x00. As far as i know, this
* is only available on 256k parts. 64k word is 128k
* bytes.
* write the command only once.
*/
if(use_lext_address && (((addr/2) & 0xffff0000))) {
if (0 > avrftdi_lext(pgm, p, m, addr/2))
return -1;
}
/* on large-flash devices > 128k issue extended address command when needed */
if(avrftdi_lext(pgm, p, m, addr/2) < 0)
return -1;
/* prepare the command stream for the whole page */
/* addr is in bytes, but we program in words. addr/2 should be something
* like addr >> WORD_SHIFT, though */
/* addr is in bytes, but we program in words. */
for(word = addr/2; word < (len + addr)/2; word++)
{
log_debug("-< bytes = %d of %d\n", word * 2, len + addr);
@ -1045,25 +1039,25 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
bufptr += 4;
}
buf_size = bufptr - buf;
if(verbose > TRACE)
buf_dump(buf, buf_size, "command buffer", 0, 16*2);
log_info("Transmitting buffer of size: %d\n", buf_size);
if (0 > avrftdi_transmit(pgm, MPSSE_DO_WRITE, buf, buf, buf_size))
return -1;
bufptr = buf;
/* find a poll byte. we cannot poll a value of 0xff, so look
/* find a poll byte. We cannot poll a value of 0xff, so look
* for a value != 0xff
*/
for(poll_index = addr+len-1; poll_index > addr-1; poll_index--)
for(poll_index = addr+len-1; poll_index+1 > addr; poll_index--)
if(m->buf[poll_index] != 0xff)
break;
if((poll_index < addr + len) && m->buf[poll_index] != 0xff)
{
if(poll_index+1 > addr) {
buf_size = bufptr - buf;
if(verbose > TRACE)
buf_dump(buf, buf_size, "command buffer", 0, 16*2);
log_info("Transmitting buffer of size: %d\n", buf_size);
if (0 > avrftdi_transmit(pgm, MPSSE_DO_WRITE, buf, buf, buf_size))
return -1;
bufptr = buf;
log_info("Using m->buf[%d] = 0x%02x as polling value ", poll_index,
m->buf[poll_index]);
/* poll page write ready */
@ -1077,9 +1071,7 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
}
else
{
log_warn("No suitable byte (!=0xff) for polling found.\n");
log_warn("Trying to sleep instead, but programming errors may occur.\n");
log_warn("Be sure to verify programmed memory (no -V option)\n");
log_warn("Skipping empty page (containing only 0xff bytes)\n");
/* TODO sync write */
/* sleep */
usleep((m->max_write_delay));
@ -1091,21 +1083,18 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
/*
*Reading from flash
*/
static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int avrftdi_flash_read(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned int page_size, unsigned int addr, unsigned int len)
{
OPCODE * readop;
int byte, word;
int use_lext_address = m->op[AVR_OP_LOAD_EXT_ADDR] != NULL;
unsigned int address = addr/2;
unsigned char o_buf[4*len+4];
unsigned char i_buf[4*len+4];
unsigned int index;
unsigned int buf_size = 4 * len + 4;
unsigned char* o_buf = alloca(buf_size);
unsigned char* i_buf = alloca(buf_size);
memset(o_buf, 0, sizeof(o_buf));
memset(i_buf, 0, sizeof(i_buf));
memset(o_buf, 0, buf_size);
memset(i_buf, 0, buf_size);
/* pre-check opcodes */
if (m->op[AVR_OP_READ_LO] == NULL) {
@ -1117,13 +1106,11 @@ static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
return -1;
}
if(use_lext_address && ((address & 0xffff0000))) {
if (0 > avrftdi_lext(pgm, p, m, address))
return -1;
}
if(avrftdi_lext(pgm, p, m, addr/2) < 0)
return -1;
/* word addressing! */
for(word = addr/2, index = 0; word < (addr + len)/2; word++)
for(unsigned int word = addr/2, index = 0; word < (addr + len)/2; word++)
{
/* one byte is transferred via a 4-byte opcode.
* TODO: reduce magic numbers
@ -1154,7 +1141,7 @@ static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
memset(&m->buf[addr], 0, page_size);
/* every (read) op is 4 bytes in size and yields one byte of memory data */
for(byte = 0; byte < page_size; byte++) {
for(unsigned int byte = 0; byte < page_size; byte++) {
if(byte & 1)
readop = m->op[AVR_OP_READ_HI];
else
@ -1172,7 +1159,7 @@ static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
return len;
}
static int avrftdi_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int avrftdi_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned int page_size, unsigned int addr, unsigned int n_bytes)
{
if (strcmp(m->desc, "flash") == 0)
@ -1183,7 +1170,7 @@ static int avrftdi_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
return -2;
}
static int avrftdi_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int avrftdi_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned int page_size, unsigned int addr, unsigned int n_bytes)
{
if (strcmp(m->desc, "flash") == 0)
@ -1199,7 +1186,11 @@ avrftdi_setup(PROGRAMMER * pgm)
{
avrftdi_t* pdata;
pgm->cookie = malloc(sizeof(avrftdi_t));
if(!(pgm->cookie = calloc(sizeof(avrftdi_t), 1))) {
log_err("Error allocating memory.\n");
exit(1);
}
pdata = to_pdata(pgm);
pdata->ftdic = ftdi_new();
@ -1213,6 +1204,7 @@ avrftdi_setup(PROGRAMMER * pgm)
pdata->pin_value = 0;
pdata->pin_direction = 0;
pdata->led_mask = 0;
pdata->lext_byte = 0xff;
}
static void
@ -1227,9 +1219,7 @@ avrftdi_teardown(PROGRAMMER * pgm)
}
}
void avrftdi_initpgm(PROGRAMMER * pgm)
{
void avrftdi_initpgm(PROGRAMMER *pgm) {
strcpy(pgm->type, "avrftdi");
/*

View File

@ -29,7 +29,7 @@ extern "C" {
extern const char avrftdi_desc[];
void avrftdi_initpgm (PROGRAMMER * pgm);
void avrftdi_initpgm(PROGRAMMER *pgm);
#ifdef __cplusplus
}

92
src/avrftdi_private.h Normal file
View File

@ -0,0 +1,92 @@
#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)
#include <ftdi.h>
#else
#ifdef _MSC_VER
#pragma message("No libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.")
#else
#warning No libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.
#endif
#define DO_NOT_BUILD_AVRFTDI
#endif
#ifndef DO_NOT_BUILD_AVRFTDI
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)) \
{ \
msg_error("%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)) \
{ \
msg_error("%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;
/* bits 16-23 of extended 24-bit word flash address for parts with flash > 128k */
uint8_t lext_byte;
} avrftdi_t;
void avrftdi_log(int level, const char * func, int line, const char * fmt, ...);
#endif /* DO_NOT_BUILD_AVRFDTI */

View File

@ -15,8 +15,8 @@
#ifndef DO_NOT_BUILD_AVRFTDI
static void avrftdi_tpi_disable(PROGRAMMER *);
static int avrftdi_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p);
static void avrftdi_tpi_disable(const PROGRAMMER *);
static int avrftdi_tpi_program_enable(const PROGRAMMER *pgm, const AVRPART *p);
#ifdef notyet
static void
@ -63,27 +63,16 @@ avrftdi_debug_frame(uint16_t frame)
#endif /* notyet */
int
avrftdi_tpi_initialize(PROGRAMMER * pgm, AVRPART * p)
{
avrftdi_tpi_initialize(const PROGRAMMER *pgm, const 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);
pgm->setpin(pgm, PIN_AVR_SDO, ON);
usleep(20 * 1000);
pgm->setpin(pgm, PIN_AVR_RESET, ON);
@ -101,13 +90,44 @@ avrftdi_tpi_initialize(PROGRAMMER * pgm, AVRPART * p)
return ret;
}
void avrftdi_tpi_initpgm(PROGRAMMER *pgm) {
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;
}
#define TPI_PARITY_MASK 0x2000
static inline int count1s(unsigned int x)
{
#if defined(__GNUC__)
return __builtin_popcount(x);
#else
int count = 0;
while (x)
{
count += x & 1;
x >>= 1;
}
return count;
#endif
}
static uint16_t
tpi_byte2frame(uint8_t byte)
{
uint16_t frame = 0xc00f;
int parity = __builtin_popcount(byte) & 1;
int parity = count1s(byte) & 1;
frame |= ((byte << 5) & 0x1fe0);
@ -123,7 +143,7 @@ tpi_frame2byte(uint16_t frame, uint8_t * byte)
/* drop idle and start bit(s) */
*byte = (frame >> 5) & 0xff;
int parity = __builtin_popcount(*byte) & 1;
int parity = count1s(*byte) & 1;
int parity_rcvd = (frame & TPI_PARITY_MASK) ? 1 : 0;
return parity != parity_rcvd;
@ -131,8 +151,7 @@ tpi_frame2byte(uint16_t frame, uint8_t * byte)
#ifdef notyet
static int
avrftdi_tpi_break(PROGRAMMER * pgm)
{
avrftdi_tpi_break(const 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);
@ -141,8 +160,7 @@ avrftdi_tpi_break(PROGRAMMER * pgm)
#endif /* notyet */
static int
avrftdi_tpi_write_byte(PROGRAMMER * pgm, unsigned char byte)
{
avrftdi_tpi_write_byte(const PROGRAMMER *pgm, unsigned char byte) {
uint16_t frame;
struct ftdi_context* ftdic = to_pdata(pgm)->ftdic;
@ -168,8 +186,7 @@ avrftdi_tpi_write_byte(PROGRAMMER * pgm, unsigned char byte)
#define TPI_IDLE_BITS 2
static int
avrftdi_tpi_read_byte(PROGRAMMER * pgm, unsigned char * byte)
{
avrftdi_tpi_read_byte(const PROGRAMMER *pgm, unsigned char *byte) {
uint16_t frame;
/* use 2 guard bits, 2 default idle bits + 12 frame bits = 16 bits total */
@ -213,13 +230,12 @@ avrftdi_tpi_read_byte(PROGRAMMER * pgm, unsigned char * byte)
}
static int
avrftdi_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p)
{
avrftdi_tpi_program_enable(const PROGRAMMER *pgm, const 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,
avrftdi_cmd_tpi(const PROGRAMMER *pgm, const unsigned char *cmd, int cmd_len,
unsigned char *res, int res_len)
{
int i, err = 0;
@ -242,8 +258,7 @@ avrftdi_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd, int cmd_len,
}
static void
avrftdi_tpi_disable(PROGRAMMER * pgm)
{
avrftdi_tpi_disable(const PROGRAMMER *pgm) {
unsigned char cmd[] = {TPI_OP_SSTCS(TPIPCR), 0};
pgm->cmd_tpi(pgm, cmd, sizeof(cmd), NULL, 0);

10
src/avrftdi_tpi.h Normal file
View File

@ -0,0 +1,10 @@
#pragma once
//int avrftdi_tpi_write_byte(PROGRAMMER *pgm, unsigned char byte);
//int avrftdi_tpi_read_byte(PROGRAMMER *pgm, unsigned char * byte);
int avrftdi_cmd_tpi(const PROGRAMMER *pgm, const unsigned char *cmd, int cmd_len,
unsigned char *res, int res_len);
int avrftdi_tpi_initialize(const PROGRAMMER *pgm, const AVRPART *p);
void avrftdi_tpi_initpgm(PROGRAMMER *pgm);

5458
src/avrintel.c Normal file

File diff suppressed because it is too large Load Diff

1477
src/avrintel.h Normal file

File diff suppressed because it is too large Load Diff

1015
src/avrpart.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/*
* avrdude - A Downloader/Uploader for AVR device programmers
* Copyright (C) 2000, 2001, 2002, 2003 Brian S. Dean <bsd@bsdhome.com>
* Copyright (C) 2005 Michael Holzt <kju-avr@fqdn.org>
* Copyright (C) 2005 Juliane Holzt <avrdude@juliane.holzt.de>
* Copyright (C) 2011 Darell Tan <darell.tan@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* $Id$ */
/* $Id$ */
#include "ac_cfg.h"
@ -28,9 +28,12 @@
#include <unistd.h>
#include <errno.h>
#if !defined(WIN32NATIVE)
# include <signal.h>
# include <sys/time.h>
#if defined(WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
#include <signal.h>
#include <sys/time.h>
#endif
#include "avrdude.h"
@ -43,7 +46,7 @@
static int delay_decrement;
#if defined(WIN32NATIVE)
#if defined(WIN32)
static int has_perfcount;
static LARGE_INTEGER freq;
#else
@ -57,14 +60,14 @@ static void alarmhandler(int signo)
done = 1;
signal(SIGALRM, saved_alarmhandler);
}
#endif /* WIN32NATIVE */
#endif /* WIN32 */
/*
* Calibrate the microsecond delay loop below.
*/
static void bitbang_calibrate_delay(void)
{
#if defined(WIN32NATIVE)
#if defined(WIN32)
/*
* If the hardware supports a high-resolution performance counter,
* we ultimately prefer that one, as it gives quite accurate delays
@ -73,8 +76,7 @@ static void bitbang_calibrate_delay(void)
if (QueryPerformanceFrequency(&freq))
{
has_perfcount = 1;
avrdude_message(MSG_NOTICE2, "%s: Using performance counter for bitbang delays\n",
progname);
pmsg_notice2("using performance counter for bitbang delays\n");
}
else
{
@ -87,16 +89,14 @@ static void bitbang_calibrate_delay(void)
* auto-calibration figures seen on various Unix systems on
* comparable hardware.
*/
avrdude_message(MSG_NOTICE2, "%s: Using guessed per-microsecond delay count for bitbang delays\n",
progname);
pmsg_notice2("using guessed per-microsecond delay count for bitbang delays\n");
delay_decrement = 100;
}
#else /* !WIN32NATIVE */
#else /* !WIN32 */
struct itimerval itv;
volatile int i;
avrdude_message(MSG_NOTICE2, "%s: Calibrating delay loop...",
progname);
pmsg_notice2("calibrating delay loop ...");
i = 0;
done = 0;
saved_alarmhandler = signal(SIGALRM, alarmhandler);
@ -122,9 +122,9 @@ static void bitbang_calibrate_delay(void)
* Calculate back from 100 ms to 1 us.
*/
delay_decrement = -i / 100000;
avrdude_message(MSG_NOTICE2, " calibrated to %d cycles per us\n",
msg_notice2(" calibrated to %d cycles per us\n",
delay_decrement);
#endif /* WIN32NATIVE */
#endif /* WIN32 */
}
/*
@ -134,7 +134,7 @@ static void bitbang_calibrate_delay(void)
*/
void bitbang_delay(unsigned int us)
{
#if defined(WIN32NATIVE)
#if defined(WIN32)
LARGE_INTEGER countNow, countEnd;
if (has_perfcount)
@ -147,21 +147,20 @@ void bitbang_delay(unsigned int us)
}
else /* no performance counters -- run normal uncalibrated delay */
{
#endif /* WIN32NATIVE */
#endif /* WIN32 */
volatile unsigned int del = us * delay_decrement;
while (del > 0)
del--;
#if defined(WIN32NATIVE)
#if defined(WIN32)
}
#endif /* WIN32NATIVE */
#endif /* WIN32 */
}
/*
* transmit and receive a byte of data to/from the AVR device
*/
static unsigned char bitbang_txrx(PROGRAMMER * pgm, unsigned char byte)
{
static unsigned char bitbang_txrx(const PROGRAMMER *pgm, unsigned char byte) {
int i;
unsigned char r, b, rbyte;
@ -173,9 +172,9 @@ static unsigned char bitbang_txrx(PROGRAMMER * pgm, unsigned char byte)
* one pgm->setpin()-call resp. par clrpin()-call, then
* - SCK is high for 2T
* - SCK is low for 2T
* - MOSI setuptime is 1T
* - MOSI holdtime is 3T
* - SCK low to MISO read is 2T to 3T
* - SDO setuptime is 1T
* - SDO holdtime is 3T
* - SCK low to SDI read is 2T to 3T
* So we are within programming specs (expect for AT90S1200),
* if and only if T>t_CLCL (t_CLCL=clock period of target system).
*
@ -187,7 +186,7 @@ static unsigned char bitbang_txrx(PROGRAMMER * pgm, unsigned char byte)
b = (byte >> i) & 0x01;
/* set the data input line as desired */
pgm->setpin(pgm, PIN_AVR_MOSI, b);
pgm->setpin(pgm, PIN_AVR_SDO, b);
pgm->setpin(pgm, PIN_AVR_SCK, 1);
@ -195,7 +194,7 @@ static unsigned char bitbang_txrx(PROGRAMMER * pgm, unsigned char byte)
* read the result bit (it is either valid from a previous falling
* edge or it is ignored in the current context)
*/
r = pgm->getpin(pgm, PIN_AVR_MISO);
r = pgm->getpin(pgm, PIN_AVR_SDI);
pgm->setpin(pgm, PIN_AVR_SCK, 0);
@ -205,25 +204,23 @@ static unsigned char bitbang_txrx(PROGRAMMER * pgm, unsigned char byte)
return rbyte;
}
static int bitbang_tpi_clk(PROGRAMMER * pgm)
{
static int bitbang_tpi_clk(const PROGRAMMER *pgm) {
unsigned char r = 0;
pgm->setpin(pgm, PIN_AVR_SCK, 1);
r = pgm->getpin(pgm, PIN_AVR_MISO);
r = pgm->getpin(pgm, PIN_AVR_SDI);
pgm->setpin(pgm, PIN_AVR_SCK, 0);
return r;
}
void bitbang_tpi_tx(PROGRAMMER * pgm, unsigned char byte)
{
void bitbang_tpi_tx(const PROGRAMMER *pgm, unsigned char byte) {
int i;
unsigned char b, parity;
/* start bit */
pgm->setpin(pgm, PIN_AVR_MOSI, 0);
pgm->setpin(pgm, PIN_AVR_SDO, 0);
bitbang_tpi_clk(pgm);
parity = 0;
@ -232,27 +229,26 @@ void bitbang_tpi_tx(PROGRAMMER * pgm, unsigned char byte)
parity ^= b;
/* set the data input line as desired */
pgm->setpin(pgm, PIN_AVR_MOSI, b);
pgm->setpin(pgm, PIN_AVR_SDO, b);
bitbang_tpi_clk(pgm);
}
/* parity bit */
pgm->setpin(pgm, PIN_AVR_MOSI, parity);
pgm->setpin(pgm, PIN_AVR_SDO, parity);
bitbang_tpi_clk(pgm);
/* 2 stop bits */
pgm->setpin(pgm, PIN_AVR_MOSI, 1);
pgm->setpin(pgm, PIN_AVR_SDO, 1);
bitbang_tpi_clk(pgm);
bitbang_tpi_clk(pgm);
}
int bitbang_tpi_rx(PROGRAMMER * pgm)
{
int bitbang_tpi_rx(const PROGRAMMER *pgm) {
int i;
unsigned char b, rbyte, parity;
/* make sure pin is on for "pullup" */
pgm->setpin(pgm, PIN_AVR_MOSI, 1);
pgm->setpin(pgm, PIN_AVR_SDO, 1);
/* wait for start bit (up to 10 bits) */
b = 1;
@ -262,7 +258,7 @@ int bitbang_tpi_rx(PROGRAMMER * pgm)
break;
}
if (b != 0) {
avrdude_message(MSG_INFO, "bitbang_tpi_rx: start bit not received correctly\n");
pmsg_error("start bit not received correctly\n");
return -1;
}
@ -277,7 +273,7 @@ int bitbang_tpi_rx(PROGRAMMER * pgm)
/* parity bit */
if (bitbang_tpi_clk(pgm) != parity) {
avrdude_message(MSG_INFO, "bitbang_tpi_rx: parity bit is wrong\n");
pmsg_error("parity bit is wrong\n");
return -1;
}
@ -286,33 +282,29 @@ int bitbang_tpi_rx(PROGRAMMER * pgm)
b &= bitbang_tpi_clk(pgm);
b &= bitbang_tpi_clk(pgm);
if (b != 1) {
avrdude_message(MSG_INFO, "bitbang_tpi_rx: stop bits not received correctly\n");
pmsg_error("stop bits not received correctly\n");
return -1;
}
return rbyte;
}
int bitbang_rdy_led(PROGRAMMER * pgm, int value)
{
int bitbang_rdy_led(const PROGRAMMER *pgm, int value) {
pgm->setpin(pgm, PIN_LED_RDY, !value);
return 0;
}
int bitbang_err_led(PROGRAMMER * pgm, int value)
{
int bitbang_err_led(const PROGRAMMER *pgm, int value) {
pgm->setpin(pgm, PIN_LED_ERR, !value);
return 0;
}
int bitbang_pgm_led(PROGRAMMER * pgm, int value)
{
int bitbang_pgm_led(const PROGRAMMER *pgm, int value) {
pgm->setpin(pgm, PIN_LED_PGM, !value);
return 0;
}
int bitbang_vfy_led(PROGRAMMER * pgm, int value)
{
int bitbang_vfy_led(const PROGRAMMER *pgm, int value) {
pgm->setpin(pgm, PIN_LED_VFY, !value);
return 0;
}
@ -322,7 +314,7 @@ 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, const unsigned char *cmd,
int bitbang_cmd(const PROGRAMMER *pgm, const unsigned char *cmd,
unsigned char *res)
{
int i;
@ -333,21 +325,21 @@ int bitbang_cmd(PROGRAMMER * pgm, const unsigned char *cmd,
if(verbose >= 2)
{
avrdude_message(MSG_NOTICE2, "bitbang_cmd(): [ ");
msg_notice2("bitbang_cmd(): [ ");
for(i = 0; i < 4; i++)
avrdude_message(MSG_NOTICE2, "%02X ", cmd[i]);
avrdude_message(MSG_NOTICE2, "] [ ");
msg_notice2("%02X ", cmd[i]);
msg_notice2("] [ ");
for(i = 0; i < 4; i++)
{
avrdude_message(MSG_NOTICE2, "%02X ", res[i]);
msg_notice2("%02X ", res[i]);
}
avrdude_message(MSG_NOTICE2, "]\n");
msg_notice2("]\n");
}
return 0;
}
int bitbang_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd,
int bitbang_cmd_tpi(const PROGRAMMER *pgm, const unsigned char *cmd,
int cmd_len, unsigned char *res, int res_len)
{
int i, r;
@ -368,15 +360,15 @@ int bitbang_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd,
if(verbose >= 2)
{
avrdude_message(MSG_NOTICE2, "bitbang_cmd_tpi(): [ ");
msg_notice2("bitbang_cmd_tpi(): [ ");
for(i = 0; i < cmd_len; i++)
avrdude_message(MSG_NOTICE2, "%02X ", cmd[i]);
avrdude_message(MSG_NOTICE2, "] [ ");
msg_notice2("%02X ", cmd[i]);
msg_notice2("] [ ");
for(i = 0; i < res_len; i++)
{
avrdude_message(MSG_NOTICE2, "%02X ", res[i]);
msg_notice2("%02X ", res[i]);
}
avrdude_message(MSG_NOTICE2, "]\n");
msg_notice2("]\n");
}
pgm->pgm_led(pgm, OFF);
@ -389,7 +381,7 @@ int bitbang_cmd_tpi(PROGRAMMER * pgm, const unsigned char *cmd,
* 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,
int bitbang_spi(const PROGRAMMER *pgm, const unsigned char *cmd,
unsigned char *res, int count)
{
int i;
@ -404,15 +396,15 @@ int bitbang_spi(PROGRAMMER * pgm, const unsigned char *cmd,
if(verbose >= 2)
{
avrdude_message(MSG_NOTICE2, "bitbang_cmd(): [ ");
msg_notice2("bitbang_cmd(): [ ");
for(i = 0; i < count; i++)
avrdude_message(MSG_NOTICE2, "%02X ", cmd[i]);
avrdude_message(MSG_NOTICE2, "] [ ");
msg_notice2("%02X ", cmd[i]);
msg_notice2("] [ ");
for(i = 0; i < count; i++)
{
avrdude_message(MSG_NOTICE2, "%02X ", res[i]);
msg_notice2("%02X ", res[i]);
}
avrdude_message(MSG_NOTICE2, "]\n");
msg_notice2("]\n");
}
return 0;
@ -422,13 +414,12 @@ int bitbang_spi(PROGRAMMER * pgm, const unsigned char *cmd,
/*
* issue the 'chip erase' command to the AVR device
*/
int bitbang_chip_erase(PROGRAMMER * pgm, AVRPART * p)
{
int bitbang_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) {
unsigned char cmd[4];
unsigned char res[4];
AVRMEM *mem;
if (p->flags & AVRPART_HAS_TPI) {
if (p->prog_modes & PM_TPI) {
pgm->pgm_led(pgm, ON);
while (avr_tpi_poll_nvmbsy(pgm));
@ -440,8 +431,7 @@ int bitbang_chip_erase(PROGRAMMER * pgm, AVRPART * p)
/* Set Pointer Register */
mem = avr_locate_mem(p, "flash");
if (mem == NULL) {
avrdude_message(MSG_INFO, "No flash memory to erase for part %s\n",
p->desc);
pmsg_error("no flash memory to erase for part %s\n", p->desc);
return -1;
}
bitbang_tpi_tx(pgm, TPI_CMD_SSTPR | 0);
@ -461,8 +451,7 @@ int bitbang_chip_erase(PROGRAMMER * pgm, AVRPART * p)
}
if (p->op[AVR_OP_CHIP_ERASE] == NULL) {
avrdude_message(MSG_INFO, "chip erase instruction not defined for part \"%s\"\n",
p->desc);
pmsg_error("chip erase instruction not defined for part %s\n", p->desc);
return -1;
}
@ -483,13 +472,12 @@ int bitbang_chip_erase(PROGRAMMER * pgm, AVRPART * p)
/*
* issue the 'program enable' command to the AVR device
*/
int bitbang_program_enable(PROGRAMMER * pgm, AVRPART * p)
{
int bitbang_program_enable(const PROGRAMMER *pgm, const AVRPART *p) {
unsigned char cmd[4];
unsigned char res[4];
int i;
if (p->flags & AVRPART_HAS_TPI) {
if (p->prog_modes & PM_TPI) {
/* enable NVM programming */
bitbang_tpi_tx(pgm, TPI_CMD_SKEY);
for (i = sizeof(tpi_skey) - 1; i >= 0; i--)
@ -502,8 +490,7 @@ int bitbang_program_enable(PROGRAMMER * pgm, AVRPART * p)
}
if (p->op[AVR_OP_PGM_ENABLE] == NULL) {
avrdude_message(MSG_INFO, "program enable instruction not defined for part \"%s\"\n",
p->desc);
pmsg_error("program enable instruction not defined for part %s\n", p->desc);
return -1;
}
@ -520,8 +507,7 @@ int bitbang_program_enable(PROGRAMMER * pgm, AVRPART * p)
/*
* initialize the AVR device and prepare it to accept commands
*/
int bitbang_initialize(PROGRAMMER * pgm, AVRPART * p)
{
int bitbang_initialize(const PROGRAMMER *pgm, const AVRPART *p) {
int rc;
int tries;
int i;
@ -531,42 +517,44 @@ int bitbang_initialize(PROGRAMMER * pgm, AVRPART * p)
pgm->powerup(pgm);
usleep(20000);
/* TPIDATA is a single line, so MISO & MOSI should be connected */
if (p->flags & AVRPART_HAS_TPI) {
/* TPIDATA is a single line, so SDI & SDO should be connected */
if (p->prog_modes & PM_TPI) {
/* make sure cmd_tpi() is defined */
if (pgm->cmd_tpi == NULL) {
avrdude_message(MSG_INFO, "%s: Error: %s programmer does not support TPI\n",
progname, pgm->type);
pmsg_error("%s programmer does not support TPI\n", pgm->type);
return -1;
}
/* bring RESET high first */
pgm->setpin(pgm, PIN_AVR_RESET, 1);
usleep(1000);
usleep(128000); /* wait t_TOUT (32-128ms) */
avrdude_message(MSG_NOTICE2, "doing MOSI-MISO link check\n");
/* RESET must be LOW in case the existing code is driving the TPI pins: */
pgm->setpin(pgm, PIN_AVR_RESET, 0);
pgm->setpin(pgm, PIN_AVR_MOSI, 0);
if (pgm->getpin(pgm, PIN_AVR_MISO) != 0) {
avrdude_message(MSG_INFO, "MOSI->MISO 0 failed\n");
msg_notice2("doing SDO-SDI link check\n");
pgm->setpin(pgm, PIN_AVR_SDO, 0);
if (pgm->getpin(pgm, PIN_AVR_SDI) != 0) {
pmsg_error("SDO->SDI 0 failed\n");
return -1;
}
pgm->setpin(pgm, PIN_AVR_MOSI, 1);
if (pgm->getpin(pgm, PIN_AVR_MISO) != 1) {
avrdude_message(MSG_INFO, "MOSI->MISO 1 failed\n");
pgm->setpin(pgm, PIN_AVR_SDO, 1);
if (pgm->getpin(pgm, PIN_AVR_SDI) != 1) {
pmsg_error("SDO->SDI 1 failed\n");
return -1;
}
avrdude_message(MSG_NOTICE2, "MOSI-MISO link present\n");
msg_notice2("SDO-SDI link present\n");
}
pgm->setpin(pgm, PIN_AVR_SCK, 0);
pgm->setpin(pgm, PIN_AVR_RESET, 0);
usleep(20000);
if (p->flags & AVRPART_HAS_TPI) {
if (p->prog_modes & PM_TPI) {
/* keep TPIDATA high for 16 clock cycles */
pgm->setpin(pgm, PIN_AVR_MOSI, 1);
pgm->setpin(pgm, PIN_AVR_SDO, 1);
for (i = 0; i < 16; i++)
pgm->highpulsepin(pgm, PIN_AVR_SCK);
@ -578,7 +566,7 @@ int bitbang_initialize(PROGRAMMER * pgm, AVRPART * p)
bitbang_tpi_tx(pgm, TPI_CMD_SLDCS | TPI_REG_TPIIR);
rc = bitbang_tpi_rx(pgm);
if (rc != 0x80) {
avrdude_message(MSG_INFO, "TPIIR not correct\n");
pmsg_error("TPIIR not correct\n");
return -1;
}
} else {
@ -612,7 +600,7 @@ int bitbang_initialize(PROGRAMMER * pgm, AVRPART * p)
* can't sync with the device, maybe it's not attached?
*/
if (rc) {
avrdude_message(MSG_INFO, "%s: AVR device not responding\n", progname);
pmsg_error("AVR device not responding\n");
return -1;
}
}
@ -620,11 +608,14 @@ int bitbang_initialize(PROGRAMMER * pgm, AVRPART * p)
return 0;
}
static int verify_pin_assigned(PROGRAMMER * pgm, int pin, char * desc)
{
if (pgm->pinno[pin] == 0) {
avrdude_message(MSG_INFO, "%s: error: no pin has been assigned for %s\n",
progname, desc);
static int verify_pin_assigned(const PROGRAMMER *pgm, int pinfunc, char *desc) {
if(pinfunc < 0 || pinfunc >= N_PINS) {
pmsg_error("invalid pin function number %d\n", pinfunc);
return -1;
}
if ((pgm->pinno[pinfunc] & PIN_MASK) > PIN_MAX) {
pmsg_error("no pin has been assigned for %s\n", desc);
return -1;
}
return 0;
@ -634,21 +625,19 @@ static int verify_pin_assigned(PROGRAMMER * pgm, int pin, char * desc)
/*
* Verify all prerequisites for a bit-bang programmer are present.
*/
int bitbang_check_prerequisites(PROGRAMMER *pgm)
{
int bitbang_check_prerequisites(const PROGRAMMER *pgm) {
if (verify_pin_assigned(pgm, PIN_AVR_RESET, "AVR RESET") < 0)
return -1;
if (verify_pin_assigned(pgm, PIN_AVR_SCK, "AVR SCK") < 0)
return -1;
if (verify_pin_assigned(pgm, PIN_AVR_MISO, "AVR MISO") < 0)
if (verify_pin_assigned(pgm, PIN_AVR_SDI, "AVR SDI") < 0)
return -1;
if (verify_pin_assigned(pgm, PIN_AVR_MOSI, "AVR MOSI") < 0)
if (verify_pin_assigned(pgm, PIN_AVR_SDO, "AVR SDO") < 0)
return -1;
if (pgm->cmd == NULL) {
avrdude_message(MSG_INFO, "%s: error: no cmd() method defined for bitbang programmer\n",
progname);
pmsg_error("no cmd() method defined for bitbang programmer\n");
return -1;
}
return 0;

View File

@ -1,7 +1,7 @@
/*
* avrdude - A Downloader/Uploader for AVR device programmers
* Copyright (C) 2000, 2001, 2002, 2003 Brian S. Dean <bsd@bsdhome.com>
* Copyright (C) 2005 Michael Holzt <kju-avr@fqdn.org>
* Copyright (C) 2005 Juliane Holzt <avrdude@juliane.holzt.de>
* Copyright (C) 2011 Darell Tan <darell.tan@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@ -31,25 +31,25 @@ int bitbang_getpin(int fd, int pin);
int bitbang_highpulsepin(int fd, int pin);
void bitbang_delay(unsigned int us);
int bitbang_check_prerequisites(PROGRAMMER *pgm);
int bitbang_check_prerequisites(const PROGRAMMER *pgm);
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, const unsigned char *cmd,
int bitbang_rdy_led (const PROGRAMMER *pgm, int value);
int bitbang_err_led (const PROGRAMMER *pgm, int value);
int bitbang_pgm_led (const PROGRAMMER *pgm, int value);
int bitbang_vfy_led (const PROGRAMMER *pgm, int value);
int bitbang_cmd (const PROGRAMMER *pgm, const unsigned char *cmd,
unsigned char *res);
int bitbang_cmd_tpi (PROGRAMMER * pgm, const unsigned char *cmd,
int bitbang_cmd_tpi (const PROGRAMMER *pgm, const unsigned char *cmd,
int cmd_len, unsigned char *res, int res_len);
int bitbang_spi (PROGRAMMER * pgm, const unsigned char *cmd,
int bitbang_spi (const 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);
void bitbang_powerdown (PROGRAMMER * pgm);
int bitbang_initialize (PROGRAMMER * pgm, AVRPART * p);
void bitbang_disable (PROGRAMMER * pgm);
void bitbang_enable (PROGRAMMER * pgm);
int bitbang_chip_erase (const PROGRAMMER *pgm, const AVRPART *p);
int bitbang_program_enable (const PROGRAMMER *pgm, const AVRPART *p);
void bitbang_powerup (const PROGRAMMER *pgm);
void bitbang_powerdown (const PROGRAMMER *pgm);
int bitbang_initialize (const PROGRAMMER *pgm, const AVRPART *p);
void bitbang_disable (const PROGRAMMER *pgm);
void bitbang_enable (PROGRAMMER *pgm, const AVRPART *p);
#ifdef __cplusplus
}

View File

@ -13,7 +13,11 @@ set -x
rm -rf autom4te.cache
libtoolize
# MacOS calls it "glibtoolize", everyone else "libtoolize"
# probe for that
LIBTOOLIZE=libtoolize
glibtoolize --version > /dev/null 2>&1 && LIBTOOLIZE=glibtoolize
${LIBTOOLIZE}
${ACLOCAL}
${AUTOHEADER}

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@
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);
void buspirate_initpgm(PROGRAMMER *pgm);
void buspirate_bb_initpgm(PROGRAMMER *pgm);
#endif

View File

@ -63,8 +63,7 @@ struct pdata
static void butterfly_setup(PROGRAMMER * pgm)
{
if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
avrdude_message(MSG_INFO, "%s: butterfly_setup(): Out of memory allocating private data\n",
progname);
pmsg_error("out of memory allocating private data\n");
exit(1);
}
memset(pgm->cookie, 0, sizeof(struct pdata));
@ -75,72 +74,62 @@ static void butterfly_teardown(PROGRAMMER * pgm)
free(pgm->cookie);
}
static int butterfly_send(PROGRAMMER * pgm, char * buf, size_t len)
{
static int butterfly_send(const PROGRAMMER *pgm, char *buf, size_t len) {
return serial_send(&pgm->fd, (unsigned char *)buf, len);
}
static int butterfly_recv(PROGRAMMER * pgm, char * buf, size_t len)
{
static int butterfly_recv(const PROGRAMMER *pgm, char *buf, size_t len) {
int rv;
rv = serial_recv(&pgm->fd, (unsigned char *)buf, len);
if (rv < 0) {
avrdude_message(MSG_INFO, "%s: butterfly_recv(): programmer is not responding\n",
progname);
pmsg_error("programmer is not responding\n");
return -1;
}
return 0;
}
static int butterfly_drain(PROGRAMMER * pgm, int display)
{
static int butterfly_drain(const PROGRAMMER *pgm, int display) {
return serial_drain(&pgm->fd, display);
}
static int butterfly_vfy_cmd_sent(PROGRAMMER * pgm, char * errmsg)
{
static int butterfly_vfy_cmd_sent(const PROGRAMMER *pgm, char *errmsg) {
char c;
butterfly_recv(pgm, &c, 1);
if (c != '\r') {
avrdude_message(MSG_INFO, "%s: error: programmer did not respond to command: %s\n",
progname, errmsg);
pmsg_error("programmer did not respond to command: %s\n", errmsg);
return -1;
}
return 0;
}
static int butterfly_rdy_led(PROGRAMMER * pgm, int value)
{
static int butterfly_rdy_led(const PROGRAMMER *pgm, int value) {
/* Do nothing. */
return 0;
}
static int butterfly_err_led(PROGRAMMER * pgm, int value)
{
static int butterfly_err_led(const PROGRAMMER *pgm, int value) {
/* Do nothing. */
return 0;
}
static int butterfly_pgm_led(PROGRAMMER * pgm, int value)
{
static int butterfly_pgm_led(const PROGRAMMER *pgm, int value) {
/* Do nothing. */
return 0;
}
static int butterfly_vfy_led(PROGRAMMER * pgm, int value)
{
static int butterfly_vfy_led(const PROGRAMMER *pgm, int value) {
/* Do nothing. */
return 0;
@ -150,8 +139,7 @@ static int butterfly_vfy_led(PROGRAMMER * pgm, int value)
/*
* issue the 'chip erase' command to the butterfly board
*/
static int butterfly_chip_erase(PROGRAMMER * pgm, AVRPART * p)
{
static int butterfly_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) {
butterfly_send(pgm, "e", 1);
if (butterfly_vfy_cmd_sent(pgm, "chip erase") < 0)
return -1;
@ -160,15 +148,13 @@ static int butterfly_chip_erase(PROGRAMMER * pgm, AVRPART * p)
}
static void butterfly_enter_prog_mode(PROGRAMMER * pgm)
{
static void butterfly_enter_prog_mode(const PROGRAMMER *pgm) {
butterfly_send(pgm, "P", 1);
butterfly_vfy_cmd_sent(pgm, "enter prog mode");
}
static void butterfly_leave_prog_mode(PROGRAMMER * pgm)
{
static void butterfly_leave_prog_mode(const PROGRAMMER *pgm) {
butterfly_send(pgm, "L", 1);
butterfly_vfy_cmd_sent(pgm, "leave prog mode");
}
@ -177,8 +163,7 @@ static void butterfly_leave_prog_mode(PROGRAMMER * pgm)
/*
* issue the 'program enable' command to the AVR device
*/
static int butterfly_program_enable(PROGRAMMER * pgm, AVRPART * p)
{
static int butterfly_program_enable(const PROGRAMMER *pgm, const AVRPART *p) {
return -1;
}
@ -186,8 +171,7 @@ static int butterfly_program_enable(PROGRAMMER * pgm, AVRPART * p)
/*
* apply power to the AVR processor
*/
static void butterfly_powerup(PROGRAMMER * pgm)
{
static void butterfly_powerup(const PROGRAMMER *pgm) {
/* Do nothing. */
return;
@ -197,8 +181,7 @@ static void butterfly_powerup(PROGRAMMER * pgm)
/*
* remove power from the AVR processor
*/
static void butterfly_powerdown(PROGRAMMER * pgm)
{
static void butterfly_powerdown(const PROGRAMMER *pgm) {
/* Do nothing. */
return;
@ -209,8 +192,7 @@ static void butterfly_powerdown(PROGRAMMER * pgm)
/*
* initialize the AVR device and prepare it to accept commands
*/
static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
{
static int butterfly_initialize(const PROGRAMMER *pgm, const AVRPART *p) {
char id[8];
char sw[2];
char hw[2];
@ -222,13 +204,13 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
* Send some ESC to activate butterfly bootloader. This is not needed
* for plain avr109 bootloaders but does not harm there either.
*/
avrdude_message(MSG_INFO, "Connecting to programmer: ");
msg_notice("connecting to programmer: ");
if (pgm->flag & IS_BUTTERFLY_MK)
{
char mk_reset_cmd[6] = {"#aR@S\r"};
unsigned char mk_timeout = 0;
putc('.', stderr);
msg_notice(".");
butterfly_send(pgm, mk_reset_cmd, sizeof(mk_reset_cmd));
usleep(20000);
@ -240,13 +222,15 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
c = 0xaa;
usleep(80000);
butterfly_send(pgm, &c, 1);
if (mk_timeout % 10 == 0) putc('.', stderr);
if (mk_timeout % 10 == 0)
msg_notice(".");
} while (mk_timeout++ < 10);
butterfly_recv(pgm, &c, 1);
if ( c != 'M' && c != '?')
{
avrdude_message(MSG_INFO, "\nConnection FAILED.");
msg_error("\n");
pmsg_error("connection failed");
return -1;
}
else
@ -257,13 +241,13 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
else
{
do {
putc('.', stderr);
msg_notice(".");
butterfly_send(pgm, "\033", 1);
butterfly_drain(pgm, 0);
butterfly_send(pgm, "S", 1);
butterfly_recv(pgm, &c, 1);
if (c != '?') {
putc('\n', stderr);
msg_notice("\n");
/*
* Got a useful response, continue getting the programmer
* identifier. Programmer returns exactly 7 chars _without_
@ -293,12 +277,12 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
butterfly_send(pgm, "p", 1);
butterfly_recv(pgm, &type, 1);
avrdude_message(MSG_INFO, "Found programmer: Id = \"%s\"; type = %c\n", id, type);
avrdude_message(MSG_INFO, " Software Version = %c.%c; ", sw[0], sw[1]);
msg_notice("Programmer id = %s; type = %c\n", id, type);
msg_notice("Software version = %c.%c; ", sw[0], sw[1]);
if (hw[0]=='?') {
avrdude_message(MSG_INFO, "No Hardware Version given.\n");
msg_notice("no hardware version given\n");
} else {
avrdude_message(MSG_INFO, "Hardware Version = %c.%c\n", hw[0], hw[1]);
msg_notice("Hardware version = %c.%c\n", hw[0], hw[1]);
};
/* See if programmer supports autoincrement of address. */
@ -306,28 +290,28 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
butterfly_send(pgm, "a", 1);
butterfly_recv(pgm, &PDATA(pgm)->has_auto_incr_addr, 1);
if (PDATA(pgm)->has_auto_incr_addr == 'Y')
avrdude_message(MSG_INFO, "Programmer supports auto addr increment.\n");
msg_notice("programmer supports auto addr increment\n");
/* Check support for buffered memory access, abort if not available */
butterfly_send(pgm, "b", 1);
butterfly_recv(pgm, &c, 1);
if (c != 'Y') {
avrdude_message(MSG_INFO, "%s: error: buffered memory access not supported. Maybe it isn't\n"\
"a butterfly/AVR109 but a AVR910 device?\n", progname);
pmsg_notice("buffered memory access not supported; maybe it isn't\n"\
"a butterfly/AVR109 but a AVR910 device?\n");
return -1;
};
butterfly_recv(pgm, &c, 1);
PDATA(pgm)->buffersize = (unsigned int)(unsigned char)c<<8;
butterfly_recv(pgm, &c, 1);
PDATA(pgm)->buffersize += (unsigned int)(unsigned char)c;
avrdude_message(MSG_INFO, "Programmer supports buffered memory access with buffersize=%i bytes.\n",
msg_notice("programmer supports buffered memory access with buffersize=%i bytes\n",
PDATA(pgm)->buffersize);
/* Get list of devices that the programmer supports. */
butterfly_send(pgm, "t", 1);
avrdude_message(MSG_INFO, "\nProgrammer supports the following devices:\n");
msg_notice2("\nProgrammer supports the following devices:\n");
devtype_1st = 0;
while (1) {
butterfly_recv(pgm, &c, 1);
@ -336,9 +320,9 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
if (c == 0)
break;
avrdude_message(MSG_INFO, " Device code: 0x%02x\n", (unsigned int)(unsigned char)c);
msg_notice2(" Device code: 0x%02x\n", (unsigned int) (unsigned char) c);
};
avrdude_message(MSG_INFO, "\n");
msg_notice2("\n");
/* Tell the programmer which part we selected.
According to the AVR109 code, this is ignored by the bootloader. As
@ -355,9 +339,7 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
if (butterfly_vfy_cmd_sent(pgm, "select device") < 0)
return -1;
if (verbose)
avrdude_message(MSG_INFO, "%s: devcode selected: 0x%02x\n",
progname, (unsigned)buf[1]);
pmsg_notice("devcode selected: 0x%02x\n", (unsigned) buf[1]);
butterfly_enter_prog_mode(pgm);
butterfly_drain(pgm, 0);
@ -367,22 +349,19 @@ static int butterfly_initialize(PROGRAMMER * pgm, AVRPART * p)
static void butterfly_disable(PROGRAMMER * pgm)
{
static void butterfly_disable(const PROGRAMMER *pgm) {
butterfly_leave_prog_mode(pgm);
return;
}
static void butterfly_enable(PROGRAMMER * pgm)
{
static void butterfly_enable(PROGRAMMER *pgm, const AVRPART *p) {
return;
}
static int butterfly_open(PROGRAMMER * pgm, char * port)
{
static int butterfly_open(PROGRAMMER *pgm, const char *port) {
union pinfo pinfo;
strcpy(pgm->port, port);
/*
@ -391,7 +370,8 @@ static int butterfly_open(PROGRAMMER * pgm, char * port)
if(pgm->baudrate == 0) {
pgm->baudrate = 19200;
}
pinfo.baud = pgm->baudrate;
pinfo.serialinfo.baud = pgm->baudrate;
pinfo.serialinfo.cflags = SERIAL_8N1;
if (serial_open(port, pinfo, &pgm->fd)==-1) {
return -1;
}
@ -416,27 +396,36 @@ static void butterfly_close(PROGRAMMER * pgm)
}
static void butterfly_display(PROGRAMMER * pgm, const char * p)
{
static void butterfly_display(const PROGRAMMER *pgm, const char *p) {
return;
}
static void butterfly_set_addr(PROGRAMMER * pgm, unsigned long addr)
{
char cmd[3];
static void butterfly_set_addr(const PROGRAMMER *pgm, unsigned long addr) {
if( addr < 0x10000 ) {
char cmd[3];
cmd[0] = 'A';
cmd[1] = (addr >> 8) & 0xff;
cmd[2] = addr & 0xff;
cmd[0] = 'A';
cmd[1] = (addr >> 8) & 0xff;
cmd[2] = addr & 0xff;
butterfly_send(pgm, cmd, sizeof(cmd));
butterfly_vfy_cmd_sent(pgm, "set addr");
butterfly_send(pgm, cmd, sizeof(cmd));
butterfly_vfy_cmd_sent(pgm, "set addr");
} else {
char cmd[4];
cmd[0] = 'H';
cmd[1] = (addr >> 16) & 0xff;
cmd[2] = (addr >> 8) & 0xff;
cmd[3] = addr & 0xff;
butterfly_send(pgm, cmd, sizeof(cmd));
butterfly_vfy_cmd_sent(pgm, "set extaddr");
}
}
static void butterfly_set_extaddr(PROGRAMMER * pgm, unsigned long addr)
{
static void butterfly_set_extaddr(const PROGRAMMER *pgm, unsigned long addr) {
char cmd[4];
cmd[0] = 'H';
@ -450,7 +439,7 @@ static void butterfly_set_extaddr(PROGRAMMER * pgm, unsigned long addr)
static int butterfly_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int butterfly_write_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned long addr, unsigned char value)
{
char cmd[6];
@ -494,7 +483,7 @@ static int butterfly_write_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
}
static int butterfly_read_byte_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int butterfly_read_byte_flash(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned long addr, unsigned char * value)
{
static int cached = 0;
@ -514,9 +503,13 @@ static int butterfly_read_byte_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
} else {
butterfly_set_addr(pgm, addr >> 1);
}
butterfly_send(pgm, "g\000\002F", 4);
// Defaults to flash read ('F')
char msg[4] = {'g', 0x00, 0x02, 'F'};
if (strcmp(m->desc, "prodsig") == 0)
msg[3] = 'P';
else if (strcmp(m->desc, "usersig") == 0)
msg[3] = 'U';
butterfly_send(pgm, msg, 4);
/* Read back the program mem word (MSB first) */
butterfly_recv(pgm, buf, sizeof(buf));
@ -535,7 +528,7 @@ static int butterfly_read_byte_flash(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
}
static int butterfly_read_byte_eeprom(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int butterfly_read_byte_eeprom(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned long addr, unsigned char * value)
{
butterfly_set_addr(pgm, addr);
@ -544,23 +537,14 @@ 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 */
avrdude_message(MSG_INFO, "%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,
static int butterfly_read_byte(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned long addr, unsigned char * value)
{
char cmd;
if (strcmp(m->desc, "flash") == 0) {
if (strcmp(m->desc, "flash") == 0 ||
strcmp(m->desc, "prodsig") == 0 ||
strcmp(m->desc, "usersig") == 0) {
return butterfly_read_byte_flash(pgm, p, m, addr, value);
}
@ -591,7 +575,7 @@ static int butterfly_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int butterfly_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int butterfly_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned int page_size,
unsigned int addr, unsigned int n_bytes)
{
@ -601,7 +585,9 @@ static int butterfly_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
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"))
if (strcmp(m->desc, "flash") &&
strcmp(m->desc, "eeprom") &&
strcmp(m->desc, "usersig"))
return -2;
if (m->desc[0] == 'e')
@ -646,7 +632,7 @@ static int butterfly_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int butterfly_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
static int butterfly_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m,
unsigned int page_size,
unsigned int addr, unsigned int n_bytes)
{
@ -655,8 +641,10 @@ static int butterfly_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
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"))
/* check parameter syntax: only "flash", "eeprom" or "usersig" is allowed */
if (strcmp(m->desc, "flash") &&
strcmp(m->desc, "eeprom") &&
strcmp(m->desc, "usersig"))
return -2;
if (m->desc[0] == 'e')
@ -692,12 +680,11 @@ static int butterfly_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
/* Signature byte reads are always 3 bytes. */
static int butterfly_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
{
static int butterfly_read_sig_bytes(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m) {
unsigned char tmp;
if (m->size < 3) {
avrdude_message(MSG_INFO, "%s: memsize too small for sig byte read", progname);
pmsg_error("memsize too small for sig byte read");
return -1;
}
@ -713,8 +700,7 @@ static int butterfly_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
const char butterfly_desc[] = "Atmel Butterfly evaluation board; Atmel AppNotes AVR109, AVR911";
void butterfly_initpgm(PROGRAMMER * pgm)
{
void butterfly_initpgm(PROGRAMMER *pgm) {
strcpy(pgm->type, "butterfly");
/*
@ -741,7 +727,6 @@ 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;
@ -754,8 +739,7 @@ void butterfly_initpgm(PROGRAMMER * pgm)
const char butterfly_mk_desc[] = "Mikrokopter.de Butterfly";
void butterfly_mk_initpgm(PROGRAMMER * pgm)
{
void butterfly_mk_initpgm(PROGRAMMER *pgm) {
butterfly_initpgm(pgm);
strcpy(pgm->type, "butterfly_mk");
pgm->flag = IS_BUTTERFLY_MK;

View File

@ -27,8 +27,8 @@ extern "C" {
extern const char butterfly_desc[];
extern const char butterfly_mk_desc[];
void butterfly_initpgm (PROGRAMMER * pgm);
void butterfly_mk_initpgm (PROGRAMMER * pgm);
void butterfly_initpgm(PROGRAMMER *pgm);
void butterfly_mk_initpgm(PROGRAMMER *pgm);
#ifdef __cplusplus
}

101
src/cmake_config.h.in Normal file
View File

@ -0,0 +1,101 @@
/*
* avrdude - A Downloader/Uploader for AVR device programmers
* Copyright (C) 2021 Marius Greuel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef _MSC_VER
#include "msvc/msvc_compat.h"
#endif
#define VERSION "@AVRDUDE_FULL_VERSION@"
/* Options */
/* Linux sysfs GPIO support enabled */
#cmakedefine HAVE_LINUXGPIO 1
/* Linux SPI support enabled */
#cmakedefine HAVE_LINUXSPI 1
/* Parallel port access enabled */
#cmakedefine HAVE_PARPORT 1
/* ----- Functions ----- */
/* Define if lex/flex has yylex_destroy */
#cmakedefine HAVE_YYLEX_DESTROY 1
/* Define if ftdi1 has 'ftdi_tcioflush' function. */
#cmakedefine HAVE_FTDI_TCIOFLUSH 1
/* ----- Libraries and Headers ----- */
/* Define to 1 if the system has the type `uint_t'. */
#cmakedefine HAVE_UINT_T 1
/* Define to 1 if the system has the type `ulong_t'. */
#cmakedefine HAVE_ULONG_T 1
/* Define if ELF support is enabled via libelf */
#cmakedefine HAVE_LIBELF 1
/* Define to 1 if you have the <libelf.h> header file. */
#cmakedefine HAVE_LIBELF_H 1
/* Define to 1 if you have the <libelf/libelf.h> header file. */
#cmakedefine HAVE_LIBELF_LIBELF_H 1
/* Define if USB support is enabled via libusb */
#cmakedefine HAVE_LIBUSB 1
/* Define if USB support is enabled via a libusb-1.0 compatible libusb */
#cmakedefine HAVE_LIBUSB_1_0 1
/* Define if USB support is enabled via a libusb-win32 compatible libusb */
#cmakedefine HAVE_LIBUSB_WIN32 1
/* Define to 1 if you have the <usb.h> header file. */
#cmakedefine HAVE_USB_H 1
/* Define to 1 if you have the <lusb0_usb.h> header file. */
#cmakedefine HAVE_LUSB0_USB_H 1
/* Define to 1 if you have the <libusb.h> header file. */
#cmakedefine HAVE_LIBUSB_H 1
/* Define to 1 if you have the <libusb-1.0/libusb.h> header file. */
#cmakedefine HAVE_LIBUSB_1_0_LIBUSB_H 1
/* Define if HID support is enabled via the Win32 DDK */
#cmakedefine HAVE_LIBHID 1
/* Define if HID support is enabled via libhidapi */
#cmakedefine HAVE_LIBHIDAPI 1
/* Define to 1 if you have the <hidapi/hidapi.h> header file. */
#cmakedefine HAVE_HIDAPI_HIDAPI_H 1
/* Define if FTDI support is enabled via libftdi */
#cmakedefine HAVE_LIBFTDI 1
/* Define if FTDI support is enabled via libftdi1 */
#cmakedefine HAVE_LIBFTDI1 1
/* Define if libftdi supports FT232H, libftdi version >= 0.20 */
#cmakedefine HAVE_LIBFTDI_TYPE_232H 1
/* Define to 1 if you have the `readline' library (-lreadline). */
#cmakedefine HAVE_LIBREADLINE 1

898
src/config.c Normal file
View File

@ -0,0 +1,898 @@
/*
* 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$ */
#include "ac_cfg.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stddef.h>
#include <string.h>
#include <ctype.h>
#include "avrdude.h"
#include "libavrdude.h"
#include "config.h"
#include "avrintel.h"
#include "config_gram.h"
const char *default_programmer;
const char *default_parallel;
const char *default_serial;
const char *default_spi;
double default_bitclock;
LISTID string_list;
LISTID number_list;
PROGRAMMER * current_prog;
AVRPART * current_part;
AVRMEM * current_mem;
int current_strct;
LISTID part_list;
LISTID programmers;
bool is_alias;
int cfg_lineno;
char * cfg_infile;
extern char * yytext;
#define pgm_comp_desc(x, type) { #x, COMP_PROGRAMMER, offsetof(PROGRAMMER, x), sizeof(((PROGRAMMER *) NULL)->x), type }
#define part_comp_desc(x, type) { #x, COMP_AVRPART, offsetof(AVRPART, x), sizeof(((AVRPART *) NULL)->x), type }
#define mem_comp_desc(x, type) { #x, COMP_AVRMEM, offsetof(AVRMEM, x), sizeof(((AVRMEM *) NULL)->x), type }
// Component description for config_gram.y, will be sorted appropriately on first use
Component_t avr_comp[] = {
// PROGRAMMER
pgm_comp_desc(prog_modes, COMP_INT),
// AVRPART
part_comp_desc(prog_modes, COMP_INT),
part_comp_desc(mcuid, COMP_INT),
part_comp_desc(n_interrupts, COMP_INT),
part_comp_desc(n_page_erase, COMP_INT),
part_comp_desc(n_boot_sections, COMP_INT),
part_comp_desc(boot_section_size, COMP_INT),
part_comp_desc(autobaud_sync, COMP_CHAR),
part_comp_desc(idr, COMP_CHAR),
part_comp_desc(rampz, COMP_CHAR),
part_comp_desc(spmcr, COMP_CHAR),
part_comp_desc(eecr, COMP_CHAR),
part_comp_desc(eind, COMP_CHAR),
// AVRMEM
mem_comp_desc(n_word_writes, COMP_INT),
};
#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)
{
string_list = lcreat(NULL, 0);
number_list = lcreat(NULL, 0);
current_prog = NULL;
current_part = NULL;
current_mem = NULL;
part_list = lcreat(NULL, 0);
programmers = lcreat(NULL, 0);
is_alias = false;
cfg_lineno = 1;
cfg_infile = NULL;
return 0;
}
void *cfg_malloc(const char *funcname, size_t n) {
void *ret = malloc(n);
if(!ret) {
pmsg_error("out of memory in %s (needed %lu bytes)\n", funcname, (unsigned long) n);
exit(1);
}
memset(ret, 0, n);
return ret;
}
void *cfg_realloc(const char *funcname, void *p, size_t n) {
void *ret;
if(!(ret = p? realloc(p, n): calloc(1, n))) {
pmsg_error("out of memory in %s (needed %lu bytes)\n", funcname, (unsigned long) n);
exit(1);
}
return ret;
}
char *cfg_strdup(const char *funcname, const char *s) {
char *ret = strdup(s);
if(!ret) {
pmsg_error("out of memory in %s\n", funcname);
exit(1);
}
return ret;
}
int yywrap()
{
return 1;
}
int yyerror(char * errmsg, ...)
{
va_list args;
char message[512];
va_start(args, errmsg);
vsnprintf(message, sizeof(message), errmsg, args);
pmsg_error("%s [%s:%d]\n", message, cfg_infile, cfg_lineno);
va_end(args);
return 0;
}
int yywarning(char * errmsg, ...)
{
va_list args;
char message[512];
va_start(args, errmsg);
vsnprintf(message, sizeof(message), errmsg, args);
pmsg_warning("%s [%s:%d]\n", message, cfg_infile, cfg_lineno);
va_end(args);
return 0;
}
TOKEN * new_token(int primary) {
TOKEN * tkn = (TOKEN *) cfg_malloc("new_token()", sizeof(TOKEN));
tkn->primary = primary;
return tkn;
}
void free_token(TOKEN * tkn)
{
if (tkn) {
switch (tkn->value.type) {
case V_STR:
if (tkn->value.string)
free(tkn->value.string);
tkn->value.string = NULL;
break;
}
free(tkn);
}
}
void free_tokens(int n, ...)
{
TOKEN * t;
va_list ap;
va_start(ap, n);
while (n--) {
t = va_arg(ap, TOKEN *);
free_token(t);
}
va_end(ap);
}
TOKEN *new_number(const char *text) {
struct token_t *tkn = new_token(TKN_NUMBER);
tkn->value.type = V_NUM;
tkn->value.number = atoi(text);
#if DEBUG
msg_info("NUMBER(%d)\n", tkn->value.number);
#endif
return tkn;
}
TOKEN *new_number_real(const char *text) {
struct token_t * tkn = new_token(TKN_NUMBER);
tkn->value.type = V_NUM_REAL;
tkn->value.number_real = atof(text);
#if DEBUG
msg_info("NUMBER(%g)\n", tkn->value.number_real);
#endif
return tkn;
}
TOKEN *new_hexnumber(const char *text) {
struct token_t *tkn = new_token(TKN_NUMBER);
char * e;
tkn->value.type = V_NUM;
tkn->value.number = strtoul(text, &e, 16);
if ((e == text) || (*e != 0)) {
yyerror("cannot scan hex number %s", text);
free_token(tkn);
return NULL;
}
#if DEBUG
msg_info("HEXNUMBER(%d)\n", tkn->value.number);
#endif
return tkn;
}
TOKEN *new_constant(const char *con) {
struct token_t *tkn = new_token(TKN_NUMBER);
int assigned = 1;
tkn->value.type = V_NUM;
tkn->value.number =
!strcmp("PM_SPM", con)? PM_SPM:
!strcmp("PM_TPI", con)? PM_TPI:
!strcmp("PM_ISP", con)? PM_ISP:
!strcmp("PM_PDI", con)? PM_PDI:
!strcmp("PM_UPDI", con)? PM_UPDI:
!strcmp("PM_HVSP", con)? PM_HVSP:
!strcmp("PM_HVPP", con)? PM_HVPP:
!strcmp("PM_debugWIRE", con)? PM_debugWIRE:
!strcmp("PM_JTAG", con)? PM_JTAG:
!strcmp("PM_JTAGmkI", con)? PM_JTAGmkI:
!strcmp("PM_XMEGAJTAG", con)? PM_XMEGAJTAG:
!strcmp("PM_AVR32JTAG", con)? PM_AVR32JTAG:
!strcmp("PM_aWire", con)? PM_aWire:
(assigned = 0);
if(!assigned) {
yyerror("can't identify constant %s", con);
free_token(tkn);
return NULL;
}
#if DEBUG
msg_info("CONSTANT(%s=%d)\n", con, tkn->value.number);
#endif
return tkn;
}
TOKEN *new_string(const char *text) {
struct token_t *tkn = new_token(TKN_STRING);
tkn->value.type = V_STR;
tkn->value.string = cfg_strdup("new_string()", text);
#if DEBUG
msg_info("STRING(%s)\n", tkn->value.string);
#endif
return tkn;
}
TOKEN *new_keyword(int primary) {
return new_token(primary);
}
void print_token(TOKEN * tkn)
{
if (!tkn)
return;
msg_info("token = %d = ", tkn->primary);
switch (tkn->value.type) {
case V_NUM:
msg_info("NUMBER, value=%d", tkn->value.number);
break;
case V_NUM_REAL:
msg_info("NUMBER, value=%g", tkn->value.number_real);
break;
case V_STR:
msg_info("STRING, value=%s", tkn->value.string);
break;
default:
msg_info("<other>");
break;
}
msg_info("\n");
}
void pyytext(void)
{
#if DEBUG
msg_info("TOKEN: %s\n", yytext);
#endif
}
#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;
int r;
if(!(cfg_infile = realpath(file, NULL))) {
pmsg_ext_error("cannot determine realpath() of config file %s: %s\n", file, strerror(errno));
return -1;
}
f = fopen(cfg_infile, "r");
if (f == NULL) {
pmsg_ext_error("cannot open config file %s: %s\n", cfg_infile, strerror(errno));
free(cfg_infile);
cfg_infile = NULL;
return -1;
}
cfg_lineno = 1;
yyin = f;
r = yyparse();
#ifdef HAVE_YYLEX_DESTROY
/* reset lexer and free any allocated memory */
yylex_destroy();
#endif
fclose(f);
if(cfg_infile) {
free(cfg_infile);
cfg_infile = NULL;
}
return r;
}
// Adapted version of a neat empirical hash function from comp.lang.c by Daniel Bernstein
unsigned strhash(const char *str) {
unsigned c, hash = 5381, n = 0;
while((c = (unsigned char) *str++) && n++ < 20)
hash = 33*hash ^ c;
return hash;
}
static char **hstrings[1<<12];
// Return a copy of the argument as hashed string
const char *cache_string(const char *p) {
int h, k;
char **hs;
if(!p)
p = "(NULL)";
h = strhash(p) % (sizeof hstrings/sizeof*hstrings);
if(!(hs=hstrings[h]))
hs = hstrings[h] = (char **) cfg_realloc("cache_string()", NULL, (16+1)*sizeof**hstrings);
for(k=0; hs[k]; k++)
if(*p == *hs[k] && !strcmp(p, hs[k]))
return hs[k];
if(k && k%16 == 0)
hstrings[h] = (char **) cfg_realloc("cache_string()", hstrings[h], (k+16+1)*sizeof**hstrings);
hstrings[h][k+1]=NULL;
return hstrings[h][k] = cfg_strdup("cache_string()", p);
}
static LISTID cfg_comms; // A chain of comment lines
static LISTID cfg_prologue; // Comment lines at start of avrdude.conf
static char *lkw; // Last seen keyword
static int lkw_lineno; // Line number of that
static LISTID cfg_strctcomms; // Passed on to config_gram.y
static LISTID cfg_pushedcomms; // Temporarily pushed main comments
static int cfg_pushed; // ... for memory sections
COMMENT *locate_comment(const LISTID comments, const char *where, int rhs) {
if(comments)
for(LNODEID ln=lfirst(comments); ln; ln=lnext(ln)) {
COMMENT *n = ldata(ln);
if(n && rhs == n->rhs && n->kw && strcmp(where, n->kw) == 0)
return n;
}
return NULL;
}
static void addcomment(int rhs) {
if(lkw) {
COMMENT *node = cfg_malloc("addcomment()", sizeof(*node));
node->rhs = rhs;
node->kw = cfg_strdup("addcomment()", lkw);
node->comms = cfg_comms;
cfg_comms = NULL;
if(!cfg_strctcomms)
cfg_strctcomms = lcreat(NULL, 0);
ladd(cfg_strctcomms, node);
}
}
// Capture prologue during parsing (triggered by lexer.l)
void cfg_capture_prologue(void) {
cfg_prologue = cfg_comms;
cfg_comms = NULL;
}
LISTID cfg_get_prologue(void) {
return cfg_prologue;
}
// Captures comments during parsing
void capture_comment_str(const char *com, int lineno) {
if(!cfg_comms)
cfg_comms = lcreat(NULL, 0);
ladd(cfg_comms, cfg_strdup("capture_comment_str()", com));
// Last keyword lineno is the same as this comment's
if(lkw && lkw_lineno == lineno)
addcomment(1); // Register comms to show right of lkw = ...;
}
// Capture assignments (keywords left of =) and associate comments to them
void capture_lvalue_kw(const char *kw, int lineno) {
if(!strcmp(kw, "memory")) { // Push part comments and start memory comments
if(!cfg_pushed) { // config_gram.y pops the part comments
cfg_pushed = 1;
cfg_pushedcomms = cfg_strctcomms;
cfg_strctcomms = NULL;
}
}
if(!strcmp(kw, "programmer") || !strcmp(kw, "part") || !strcmp(kw, "memory"))
kw = "*"; // Show comment before programmer/part/memory
if(lkw)
free(lkw);
lkw = cfg_strdup("capture_lvalue_kw()", kw);
lkw_lineno = lineno;
if(cfg_comms) // Accrued list of # one-line comments
addcomment(0); // Register comment to appear before lkw assignment
}
// config_gram.y calls this once for each programmer/part/memory structure
LISTID cfg_move_comments(void) {
capture_lvalue_kw(";", -1);
LISTID ret = cfg_strctcomms;
cfg_strctcomms = NULL;
return ret;
}
// config_gram.y calls this after ingressing the memory structure
void cfg_pop_comms(void) {
if(cfg_pushed) {
cfg_pushed = 0;
cfg_strctcomms = cfg_pushedcomms;
}
}
// Convert the next n hex digits of s to a hex number
static unsigned int tohex(const unsigned char *s, unsigned int n) {
int ret, c;
ret = 0;
while(n--) {
ret *= 16;
c = *s++;
ret += c >= '0' && c <= '9'? c - '0': c >= 'a' && c <= 'f'? c - 'a' + 10: c - 'A' + 10;
}
return ret;
}
/*
* Create a utf-8 character sequence from a single unicode character.
* Permissive for some invalid unicode sequences but not for those with
* high bit set). Returns numbers of characters written (0-6).
*/
static int wc_to_utf8str(unsigned int wc, unsigned char *str) {
if(!(wc & ~0x7fu)) {
*str = (char) wc;
return 1;
}
if(!(wc & ~0x7ffu)) {
*str++ = (char) ((wc >> 6) | 0xc0);
*str++ = (char) ((wc & 0x3f) | 0x80);
return 2;
}
if(!(wc & ~0xffffu)) {
*str++ = (char) ((wc >> 12) | 0xe0);
*str++ = (char) (((wc >> 6) & 0x3f) | 0x80);
*str++ = (char) ((wc & 0x3f) | 0x80);
return 3;
}
if(!(wc & ~0x1fffffu)) {
*str++ = (char) ((wc >> 18) | 0xf0);
*str++ = (char) (((wc >> 12) & 0x3f) | 0x80);
*str++ = (char) (((wc >> 6) & 0x3f) | 0x80);
*str++ = (char) ((wc & 0x3f) | 0x80);
return 4;
}
if(!(wc & ~0x3ffffffu)) {
*str++ = (char) ((wc >> 24) | 0xf8);
*str++ = (char) (((wc >> 18) & 0x3f) | 0x80);
*str++ = (char) (((wc >> 12) & 0x3f) | 0x80);
*str++ = (char) (((wc >> 6) & 0x3f) | 0x80);
*str++ = (char) ((wc & 0x3f) | 0x80);
return 5;
}
if(!(wc & ~0x7fffffffu)) {
*str++ = (char) ((wc >> 30) | 0xfc);
*str++ = (char) (((wc >> 24) & 0x3f) | 0x80);
*str++ = (char) (((wc >> 18) & 0x3f) | 0x80);
*str++ = (char) (((wc >> 12) & 0x3f) | 0x80);
*str++ = (char) (((wc >> 6) & 0x3f) | 0x80);
*str++ = (char) ((wc & 0x3f) | 0x80);
return 6;
}
return 0;
}
// Unescape C-style strings, destination d must hold enough space (and can be source s)
unsigned char *cfg_unescapeu(unsigned char *d, const unsigned char *s) {
unsigned char *ret = d;
int n, k;
while(*s) {
switch (*s) {
case '\\':
switch (*++s) {
case '\n': // String continuation over new line
#if '\n' != '\r'
case '\r':
#endif
--d;
break;
case 'n':
*d = '\n';
break;
case 't':
*d = '\t';
break;
case 'a':
*d = '\a';
break;
case 'b':
*d = '\b';
break;
case 'e': // Non-standard ESC
*d = 27;
break;
case 'f':
*d = '\f';
break;
case 'r':
*d = '\r';
break;
case 'v':
*d = '\v';
break;
case '?':
*d = '?';
break;
case '`':
*d = '`';
break;
case '"':
*d = '"';
break;
case '\'':
*d = '\'';
break;
case '\\':
*d = '\\';
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7': // 1-3 octal digits
n = *s - '0';
for(k = 0; k < 2 && s[1] >= '0' && s[1] <= '7'; k++) // Max 2 more octal characters
n *= 8, n += s[1] - '0', s++;
*d = n;
break;
case 'x': // Unlimited hex digits
for(k = 0; isxdigit(s[k + 1]); k++)
continue;
if(k > 0) {
*d = tohex(s + 1, k);
s += k;
} else { // No hex digits after \x? copy \x
*d++ = '\\';
*d = 'x';
}
break;
case 'u': // Exactly 4 hex digits and valid unicode
if(isxdigit(s[1]) && isxdigit(s[2]) && isxdigit(s[3]) && isxdigit(s[4]) &&
(n = wc_to_utf8str(tohex(s+1, 4), d))) {
d += n - 1;
s += 4;
} else { // Invalid \u sequence? copy \u
*d++ = '\\';
*d = 'u';
}
break;
case 'U': // Exactly 6 hex digits and valid unicode
if(isxdigit(s[1]) && isxdigit(s[2]) && isxdigit(s[3]) && isxdigit(s[4]) && isxdigit(s[5]) && isxdigit(s[6]) &&
(n = wc_to_utf8str(tohex(s+1, 6), d))) {
d += n - 1;
s += 6;
} else { // Invalid \U sequence? copy \U
*d++ = '\\';
*d = 'U';
}
break;
default: // Keep the escape sequence (C would warn and remove \)
*d++ = '\\';
*d = *s;
}
break;
default: // Not an escape sequence: just copy the character
*d = *s;
}
d++;
s++;
}
*d = *s; // Terminate
return ret;
}
// Unescape C-style strings, destination d must hold enough space (and can be source s)
char *cfg_unescape(char *d, const char *s) {
return (char *) cfg_unescapeu((unsigned char *) d, (const unsigned char *) s);
}
// Return an escaped string that looks like a C-style input string incl quotes, memory is malloc'd
char *cfg_escape(const char *s) {
char buf[50*1024], *d = buf;
*d++ = '"';
for(; *s && d-buf < (long) sizeof buf-7; s++) {
switch(*s) {
case '\n':
*d++ = '\\'; *d++ = 'n';
break;
case '\t':
*d++ = '\\'; *d++ = 't';
break;
case '\a':
*d++ = '\\'; *d++ = 'a';
break;
case '\b':
*d++ = '\\'; *d++ = 'b';
break;
case '\f':
*d++ = '\\'; *d++ = 'f';
break;
#if '\r' != '\n'
case '\r':
*d++ = '\\'; *d++ = 'r';
break;
#endif
case '\v':
*d++ = '\\'; *d++ = 'v';
break;
case '\"':
*d++ = '\\'; *d++ = '\"';
break;
default:
if(*s == 0x7f || (*s >= 0 && *s < 32)) {
sprintf(d, "\\%03o", *s);
d += strlen(d);
} else
*d++ = *s;
}
}
*d++ = '"';
*d = 0;
return cfg_strdup("cfg_escape()", buf);
}
static int cmp_comp(const void *v1, const void *v2) {
const Component_t *c1 = v1, *c2 = v2;
int ret = strcmp(c1->name, c2->name);
return ret? ret: c1->strct - c2->strct;
}
Component_t *cfg_comp_search(const char *name, int strct) {
static int init;
Component_t key;
if(!init++)
qsort(avr_comp, sizeof avr_comp/sizeof*avr_comp, sizeof(Component_t), cmp_comp);
key.name = name;
key.strct = strct;
return bsearch(&key, avr_comp, sizeof avr_comp/sizeof*avr_comp, sizeof(Component_t), cmp_comp);
}
const char *cfg_strct_name(int strct) {
switch(strct) {
case COMP_CONFIG_MAIN: return "avrdude.conf main";
case COMP_AVRPART: return "AVRPART";
case COMP_AVRMEM: return "AVRMEM";
case COMP_PROGRAMMER: return "PROGRAMMER";
}
return "unknown struct";
}
const char *cfg_v_type(int type) {
switch(type) {
case V_NONE: return "void";
case V_NUM: return "number";
case V_NUM_REAL: return "real";
case V_STR: return "string";
case V_COMPONENT: return "component";
}
return "unknown v type";
}
const char *cfg_comp_type(int type) {
switch(type) {
case COMP_INT: return "number";
case COMP_SHORT: return "short";
case COMP_CHAR: return "char";
case COMP_STRING: return "string";
case COMP_CHAR_ARRAY: return "byte array";
case COMP_INT_LISTID: return "number list";
case COMP_STRING_LISTID: return "string list";
case COMP_OPCODE: return "opcode";
case COMP_PIN: return "pin";
case COMP_PIN_LIST: return "pin list";
}
return "unknown comp type";
}
// Used by config_gram.y to assign a component in one of the relevant structures with a value
void cfg_assign(char *sp, int strct, Component_t *cp, VALUE *v) {
const char *str;
int num;
switch(cp->type) {
case COMP_CHAR:
case COMP_SHORT:
case COMP_INT:
if(v->type != V_NUM) {
yywarning("%s in %s expects a %s but is assigned a %s",
cp->name, cfg_strct_name(strct), cfg_comp_type(cp->type), cfg_v_type(v->type));
return;
}
// TODO: consider endianess (code currently assumes little endian)
num = v->number;
memcpy(sp+cp->offset, &num, cp->size);
break;
case COMP_STRING:
if(v->type != V_STR) {
yywarning("%s in %s expects a string but is assigned a %s",
cp->name, cfg_strct_name(strct), cfg_v_type(v->type));
return;
}
str = cache_string(v->string);
memcpy(sp+cp->offset, &str, cp->size);
break;
// TODO: implement COMP_CHAR_ARRAY, COMP_INT_LISTID, COMP_STRING_LISTID, ...
default:
yywarning("%s in %s expects a %s but that is not implemented",
cp->name, cfg_strct_name(strct), cfg_comp_type(cp->type));
}
}
// Automatically assign an mcuid if known from avrintel.c table
void cfg_update_mcuid(AVRPART *part) {
// Don't assign an mcuid for template parts that has a space in desc
if(!part->desc || *part->desc == 0 || strchr(part->desc, ' '))
return;
// Don't assign an mcuid for template parts where id starts with "."
if(!part->id || !*part->id || *part->id == '.')
return;
// Don't assign an mcuid for 32-bit AVR parts
if(part->prog_modes & PM_aWire)
return;
// Find an entry that shares the same name, overwrite mcuid with known, existing mcuid
for(size_t i=0; i < sizeof uP_table/sizeof *uP_table; i++) {
if(strcasecmp(part->desc, uP_table[i].name) == 0) {
if(part->mcuid != (int) uP_table[i].mcuid) {
if(part->mcuid >= 0 && verbose >= MSG_DEBUG)
yywarning("overwriting mcuid of part %s to be %d", part->desc, uP_table[i].mcuid);
part->mcuid = uP_table[i].mcuid;
}
return;
}
}
// None have the same name: an entry with part->mcuid might be an error
for(size_t i=0; i < sizeof uP_table/sizeof *uP_table; i++)
if(part->mcuid == (int) uP_table[i].mcuid) {
// Complain unless it can be considered a variant, eg, ATmega32L and ATmega32
AVRMEM *flash = avr_locate_mem(part, "flash");
if(flash) {
size_t l1 = strlen(part->desc), l2 = strlen(uP_table[i].name);
if(strncasecmp(part->desc, uP_table[i].name, l1 < l2? l1: l2) ||
flash->size != uP_table[i].flashsize ||
flash->page_size != uP_table[i].pagesize ||
part->n_interrupts != (int8_t) uP_table[i].ninterrupts)
yywarning("mcuid %d is reserved for %s, use a free number >= %d",
part->mcuid, uP_table[i].name, sizeof uP_table/sizeof *uP_table);
}
return;
}
// Range check
if(part->mcuid < 0 || part->mcuid >= UB_N_MCU)
yywarning("mcuid %d for %s is out of range [0..%d], use a free number >= %d",
part->mcuid, part->desc, UB_N_MCU-1, sizeof uP_table/sizeof *uP_table);
}

170
src/config.h Normal file
View File

@ -0,0 +1,170 @@
/*
* 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$ */
/* These are the internal definitions needed for config parsing */
#ifndef config_h
#define config_h
#include "libavrdude.h"
#if defined(WIN32) || defined(_MSC_VER) || defined(__MINGW32__)
#define realpath(N,R) _fullpath((R), (N), PATH_MAX)
#endif
typedef struct {
char *kw; // Keyword near the comments
LISTID comms; // Chained list of comments
int rhs; // Comments to print rhs of keyword line
} COMMENT;
enum { // Which structures a component can occur in
COMP_CONFIG_MAIN,
COMP_PROGRAMMER,
COMP_AVRPART,
COMP_AVRMEM,
};
enum { // Component types in structure
COMP_INT,
COMP_SHORT,
COMP_CHAR,
COMP_STRING,
COMP_CHAR_ARRAY, // This and below are not yet implemented
COMP_INT_LISTID,
COMP_STRING_LISTID,
COMP_OPCODE,
COMP_PIN, // Pins may never be implemented
COMP_PIN_LIST
};
typedef struct { // Description of a component in a structure
const char *name; // Component name
int strct; // Structure, eg, COMP_AVRPART
int offset, size, type; // Location, size and type within structure
} Component_t;
enum { // Value types for VALUE struct
V_NONE,
V_NUM,
V_NUM_REAL,
V_STR,
V_COMPONENT,
};
typedef struct value_t {
int type;
union {
int number;
double number_real;
char * string;
Component_t *comp;
};
} VALUE;
typedef struct token_t {
int primary;
VALUE value;
} TOKEN;
typedef struct token_t *token_p;
extern FILE * yyin;
extern PROGRAMMER * current_prog;
extern AVRPART * current_part;
extern AVRMEM * current_mem;
extern int current_strct;
extern int cfg_lineno;
extern char * cfg_infile;
extern LISTID string_list;
extern LISTID number_list;
extern bool is_alias; // current entry is alias
#if !defined(HAS_YYSTYPE)
#define YYSTYPE token_p
#endif
extern YYSTYPE yylval;
#ifdef __cplusplus
extern "C" {
#endif
int yyparse(void);
int yyerror(char *errmsg, ...);
int yywarning(char *errmsg, ...);
TOKEN *new_token(int primary);
void free_token(TOKEN *tkn);
void free_tokens(int n, ...);
TOKEN *new_number(const char *text);
TOKEN *new_number_real(const char *text);
TOKEN *new_hexnumber(const char *text);
TOKEN *new_constant(const char *text);
TOKEN *new_string(const char *text);
TOKEN *new_keyword(int primary);
void print_token(TOKEN *tkn);
void pyytext(void);
COMMENT *locate_comment(const LISTID comments, const char *where, int rhs);
void cfg_capture_prologue(void);
LISTID cfg_get_prologue(void);
void capture_comment_str(const char *com, int lineno);
void capture_lvalue_kw(const char *kw, int lineno);
LISTID cfg_move_comments(void);
void cfg_pop_comms(void);
Component_t *cfg_comp_search(const char *name, int strct);
const char *cfg_v_type(int type);
const char *cfg_strct_name(int strct);
void cfg_assign(char *sp, int strct, Component_t *cp, VALUE *v);
void cfg_update_mcuid(AVRPART *part);
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -23,19 +23,21 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.60)
AC_INIT(avrdude, 6.3, avrdude-dev@nongnu.org)
AC_INIT(avrdude, 7.1-20230108, avrdude-dev@nongnu.org)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_CONFIG_SRCDIR([main.c])
AM_INIT_AUTOMAKE
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_HEADERS(ac_cfg.h)
AC_CONFIG_MACRO_DIR([m4])
LT_INIT()
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
@ -113,10 +115,22 @@ if test x$have_libusb = xyes; then
fi
AC_SUBST(LIBUSB, $LIBUSB)
AC_ARG_ENABLE(
[libusb_1_0],
AC_HELP_STRING(
[--disable-libusb_1_0],
[Allow to build with libusb instead of libusb_1_0 if both are present]),
[case "${enableval}" in
yes) enabled_libusb_1_0=yes ;;
no) enabled_libusb_1_0=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for enable-libusb_1_0 option) ;;
esac],
[enabled_libusb_1_0=yes])
AH_TEMPLATE([HAVE_LIBUSB_1_0],
[Define if USB support is enabled via libusb 1.0])
AC_CHECK_LIB([usb-1.0], [libusb_init], [have_libusb_1_0=yes])
if test x$have_libusb_1_0 = xyes; then
if test x$have_libusb_1_0 = xyes && test x$enabled_libusb_1_0 = xyes; then
case $target in
*-*-darwin*)
LIBUSB_1_0="-lusb-1.0 -framework CoreFoundation -framework IOKit"
@ -132,7 +146,7 @@ fi
AH_TEMPLATE([HAVE_LIBUSB_1_0],
[Define if USB support is enabled via a libusb-1.0 compatible libusb])
AC_CHECK_LIB([usb], [libusb_init], [have_libusb_1_0=yes])
if test x$have_libusb_1_0 = xyes; then
if test x$have_libusb_1_0 = xyes && test x$enabled_libusb_1_0 = xyes; then
case $target in
*-*-freebsd*)
# FreeBSD 8+ has a native libusb-1.0 API compatible
@ -150,18 +164,39 @@ if test x$have_libusb_1_0 = xyes; then
AC_CHECK_HEADERS([libusb.h])
fi
AC_SUBST(LIBUSB_1_0, $LIBUSB_1_0)
AH_TEMPLATE([HAVE_LIBHIDAPI],
[Define if HID support is enabled via libhidapi])
AC_SEARCH_LIBS([hid_init], [hidapi hidapi-libusb hidapi-hidraw], [have_libhidapi=yes])
if test x$have_libhidapi = xyes; then
case $target in
*-*-darwin*)
LIBHIDAPI="-lhidapi -iframework CoreFoundation -framework IOKit"
;;
*)
LIBHIDAPI="$ac_cv_lib_hid_init"
;;
esac
AC_DEFINE([HAVE_LIBHIDAPI])
AC_CHECK_HEADERS([hidapi/hidapi.h])
fi
AC_SUBST(LIBHIDAPI, $LIBHIDAPI)
AH_TEMPLATE([HAVE_LIBFTDI1],
[Define if FTDI support is enabled via libftdi1])
AH_TEMPLATE([HAVE_LIBFTDI],
[Define if FTDI support is enabled via libftdi])
AH_TEMPLATE([HAVE_LIBFTDI_TYPE_232H],
[Define if libftdi supports FT232H, libftdi version >= 0.20])
AC_CHECK_LIB([ftdi1], [ftdi_new], [have_libftdi1=yes], [], [-lusb-1.0])
AC_CHECK_LIB([ftdi1], [ftdi_new], [have_libftdi1=yes], [], [$LIBUSB_1_0])
AC_CHECK_LIB([ftdi], [ftdi_usb_get_strings], [have_libftdi=yes], [], [-lusb])
if test x$have_libftdi1 = xyes; then
LIBFTDI1="-lftdi1"
AC_DEFINE([HAVE_LIBFTDI1])
AC_SUBST(LIBFTDI1, $LIBFTDI1)
LIBS="${LIBS} ${LIBFTDI1}"
AC_CHECK_FUNCS(ftdi_tcioflush)
else
if test x$have_libftdi = xyes; then
LIBFTDI="-lftdi -lusb"
@ -191,23 +226,17 @@ AC_CHECK_HEADERS([ddk/hidsdi.h],,,[#include <windows.h>
AC_C_CONST
AC_HEADER_TIME
# WinSock2
AC_CHECK_LIB([ws2_32], [puts])
AC_CHECK_HEADERS([netinet/in.h])
# Checks for library functions.
AC_CHECK_FUNCS([memset select strcasecmp strdup strerror strncasecmp strtol strtoul gettimeofday usleep])
AC_CHECK_FUNCS([memset select strcasecmp strdup strerror strncasecmp strtol strtoul gettimeofday usleep getaddrinfo])
AC_MSG_CHECKING([for a Win32 HID libray])
AC_MSG_CHECKING([for a Win32 HID library])
SAVED_LIBS="${LIBS}"
case $target in
*-*-mingw32* | *-*-cygwin* | *-*-windows*)
LIBHID="-lhid -lsetupapi"
if test $ac_cv_header_ddk_hidsdi_h = yes
then
HIDINCLUDE="#include <ddk/hidsdi.h>"
else
HIDINCLUDE="#include \"my_ddk_hidsdi.h\""
fi
HIDINCLUDE="#include <hidsdi.h>"
;;
*)
LIBHID=""
@ -287,7 +316,7 @@ AC_ARG_ENABLE(
no) enabled_parport=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for enable-parport option) ;;
esac],
[enabled_parport=yes])
[enabled_parport=no])
AC_ARG_ENABLE(
[linuxgpio],
@ -301,7 +330,19 @@ AC_ARG_ENABLE(
esac],
[enabled_linuxgpio=no])
DIST_SUBDIRS_AC='doc windows'
AC_ARG_ENABLE(
[linuxspi],
AC_HELP_STRING(
[--enable-linuxspi],
[Enable the Linux SPIDEV interface programmer type]),
[case "${enableval}" in
yes) enabled_linuxspi=yes ;;
no) enabled_linuxspi=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for enable-linuxspi option) ;;
esac],
[enabled_linuxspi=no])
DIST_SUBDIRS_AC='doc'
if test "$enabled_doc" = "yes"; then
SUBDIRS_AC='doc'
@ -378,7 +419,15 @@ else
fi
# If we are compiling with gcc, enable all warning and make warnings errors.
if test "$enabled_linuxspi" = "yes"; then
AC_DEFINE(HAVE_LINUXSPI, 1, [Linux SPI support enabled])
confsubst="$confsubst -e /^@HAVE_LINUXSPI_/d"
else
confsubst="$confsubst -e /^@HAVE_LINUXSPI_BEGIN@/,/^@HAVE_LINUXSPI_END@/d"
fi
# If we are compiling with gcc, enable all warnings and make warnings errors.
if test "$GCC" = yes; then
ENABLE_WARNINGS="-Wall"
@ -450,22 +499,19 @@ case $target in
LDFLAGS="${LDFLAGS} -static"
fi
WINDOWS_DIRS="windows"
CFLAGS="${CFLAGS} -DWIN32NATIVE"
;;
esac
AC_SUBST(WINDOWS_DIRS,$WINDOWS_DIRS)
AC_CONFIG_FILES([
doc/Makefile
windows/Makefile
avrdude.spec
Makefile
])
# The procedure to create avrdude.conf involves two steps. First,
# normal autoconf substitution will be applied, resulting in
# avrdude.conf.tmp. Finally, a sed command will be applied to filter
# avrdude.conf.tmp. Finally, a sed command will be applied to filter
# out unwanted parts (currently the parallel port programmer types)
# based on previous configuration results, thereby producing the final
# avrdude.conf file.
@ -494,7 +540,11 @@ else
fi
if test x$have_libusb_1_0 = xyes; then
echo "DO HAVE libusb_1_0"
if test x$enabled_libusb_1_0 = xyes; then
echo "DO HAVE libusb_1_0"
else
echo "DISABLED libusb_1_0"
fi
else
echo "DON'T HAVE libusb_1_0"
fi
@ -521,6 +571,18 @@ else
echo "DON'T HAVE libhid"
fi
if test x$have_libhidapi = xyes; then
echo "DO HAVE libhidapi"
else
echo "DON'T HAVE libhidapi"
fi
if test x$have_readline = xyes; then
echo "DO HAVE libreadline"
else
echo "DON'T HAVE libreadline"
fi
if test x$have_pthread = xyes; then
echo "DO HAVE pthread"
else
@ -545,3 +607,9 @@ else
echo "DISABLED linuxgpio"
fi
if test x$enabled_linuxspi = xyes; then
echo "ENABLED linuxspi"
else
echo "DISABLED linuxspi"
fi

35
src/configure.cmake Normal file
View File

@ -0,0 +1,35 @@
#
# configure.cmake - autoconf like multi-line configure
# Copyright (C) 2022 Marius Greuel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Do a multi-line replace based on @<OPTION>_BEGIN@ and @<OPTION>_END@ tags.
macro(configure_option option)
if(${${option}})
string(REGEX REPLACE "(.*)@${option}_BEGIN@(.*)@${option}_END@(.*)" "\\1\\2\\3" CONTENTS "${CONTENTS}")
else()
string(REGEX REPLACE "(.*)@${option}_BEGIN@(.*)@${option}_END@(.*)" "\\1\\3" CONTENTS "${CONTENTS}")
endif()
endmacro()
# Perform autoconf like multi-line configure
file(READ avrdude.conf.in CONTENTS)
configure_option(HAVE_PARPORT)
configure_option(HAVE_LINUXSPI)
configure_option(HAVE_LINUXGPIO)
file(WRITE avrdude.conf.in "${CONTENTS}")
configure_file(avrdude.conf.in avrdude.conf)

View File

@ -17,38 +17,33 @@
*/
#include "ac_cfg.h"
#include "avrdude.h"
#include "libavrdude.h"
#if defined(WIN32NATIVE)
#if defined(WIN32)
#include <limits.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
static char *filename;
void win_sys_config_set(char sys_config[PATH_MAX])
{
sys_config[0] = 0;
/* Use Windows API call to search for the Windows default system config file.*/
SearchPath(NULL, "avrdude.conf", NULL, PATH_MAX, sys_config, &filename);
SearchPath(NULL, SYSTEM_CONF_FILE, NULL, PATH_MAX, sys_config, &filename);
return;
}
void win_usr_config_set(char usr_config[PATH_MAX])
{
usr_config[0] = 0;
/* Use Windows API call to search for the Windows default user config file. */
SearchPath(NULL, "avrdude.rc", NULL, PATH_MAX, usr_config, &filename);
SearchPath(NULL, USER_CONF_FILE, NULL, PATH_MAX, usr_config, &filename);
return;
}
#endif

1432
src/developer_opts.c Normal file

File diff suppressed because it is too large Load Diff

26
src/developer_opts.h Normal file
View File

@ -0,0 +1,26 @@
/*
* avrdude - A Downloader/Uploader for AVR device programmers
* Copyright (C) 2022, Stefan Rueger <stefan.rueger@urclocks.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/>.
*/
#ifndef developer_opts_h
#define developer_opts_h
void dev_output_pgm_part(int dev_opt_c, const char *programmer, int dev_opt_p, const char *partdesc);
void dev_output_part_defs(char *partdesc);
void dev_output_pgm_defs(char *programmer);
#endif

View File

@ -0,0 +1,140 @@
/*
* avrdude - A Downloader/Uploader for AVR device programmers
* Copyright (C) 2022, Stefan Rueger <stefan.rueger@urclocks.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/>.
*/
#ifndef developer_opts_private_h
#define developer_opts_private_h
#define DEV_SPI_EN_CE_SIG 1
#define DEV_SPI_PROGMEM 2
#define DEV_SPI_PROGMEM_PAGED 4
#define DEV_SPI_LOAD_EXT_ADDR 8
#define DEV_SPI_EEPROM 16
#define DEV_SPI_EEPROM_PAGED 32
#define DEV_SPI_LOCK 64
#define DEV_SPI_CALIBRATION 128
#define DEV_SPI_LFUSE 256
#define DEV_SPI_HFUSE 512
#define DEV_SPI_EFUSE 1024
static int dev_message(int msglvl, const char *fmt, ...);
#ifndef DEV_INFO
#define DEV_INFO MSG_INFO
#endif
#ifndef DEV_NOTICE
#define DEV_NOTICE MSG_NOTICE
#endif
#ifndef DEV_NOTICE
#define DEV_NOTICE2 MSG_NOTICE2
#endif
#define dev_info(...) dev_message(DEV_INFO, __VA_ARGS__)
#define dev_notice(...) dev_message(DEV_NOTICE, __VA_ARGS__)
#define dev_notice2(...) dev_message(DEV_NOTICE2, __VA_ARGS__)
#define _pgmout(fmt, component) \
dev_part_strct_entry(tsv, ".prog", id, NULL, #component, dev_sprintf(fmt, pgm->component), pgm->comments)
#define _pgmout_fmt(name, fmt, what) \
dev_part_strct_entry(tsv, ".prog", id, NULL, name, dev_sprintf(fmt, what), pgm->comments)
#define _if_pgmout(cmp, fmt, component) do { \
if(!base || cmp(base->component, pgm->component)) \
dev_part_strct_entry(tsv, ".prog", id, NULL, #component, dev_sprintf(fmt, pgm->component), pgm->comments); \
} while(0)
// Result must be a malloc'd string
#define _if_pgmout_str(cmp, result, component) do { \
if(!base || cmp(base->component, pgm->component)) \
dev_part_strct_entry(tsv, ".prog", id, NULL, #component, result, pgm->comments); \
} while(0)
#define _partout(fmt, component) \
dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component), p->comments)
#define _if_partout(cmp, fmt, component) do { \
if(!base || cmp(base->component, p->component)) \
dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component), p->comments); \
} while(0)
#define _if_n_partout(cmp, n, fmt, component) do { \
if(!base || cmp(base->component, p->component, n)) \
dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, dev_sprintf(fmt, p->component), p->comments); \
} while(0)
// Result must be a malloc'd string
#define _partout_str(result, component) \
dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result, p->comments)
// Result must be a malloc'd string
#define _if_partout_str(cmp, result, component) do { \
if(!base || cmp(base->component, p->component)) \
dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result, p->comments); \
} while(0)
// Result must be a malloc'd string
#define _if_n_partout_str(cmp, n, result, component) do { \
if(!base || cmp(base->component, p->component, n)) \
dev_part_strct_entry(tsv, ".pt", p->desc, NULL, #component, result, p->comments); \
} while(0)
#define _memout(fmt, component) \
dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, dev_sprintf(fmt, m->component), m->comments)
#define _if_memout(cmp, fmt, component) do { \
if(!bm || cmp(bm->component, m->component)) \
dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, dev_sprintf(fmt, m->component), m->comments); \
} while(0)
// Result must be a malloc'd string
#define _memout_str(result, component) \
dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, result, m->comments)
// Result must be a malloc'd string
#define _if_n_memout_str(cmp, n, result, component) do { \
if(!bm || cmp(bm->component, m->component, n)) \
dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, result, m->comments); \
} while(0)
#define _memout_yn(component) \
dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, cfg_strdup("_memout_yn()", m->component? "yes": "no"), m->comments)
#define _if_memout_yn(component) do { \
if(!bm || bm->component != m->component) \
dev_part_strct_entry(tsv, ".ptmm", p->desc, m->desc, #component, cfg_strdup("_if_memout_yn()", m->component? "yes": "no"), m->comments); \
} while(0)
#define _flagout(mask, name) \
_partout_str(cfg_strdup("_flagout()", p->flags & (mask)? "yes": "no"), name)
#define _if_flagout(mask, name) do { \
if(!base || (base->flags & (mask)) != (p->flags & (mask))) \
_partout_str(cfg_strdup("_if_flagout()", p->flags & (mask)? "yes": "no"), name); \
} while(0)
// Result must be a malloc'd string
#define _cmderr(result, component) \
dev_part_strct_entry(tsv, ".cmderr", p->desc, m->desc, #component, result, NULL)
#endif

View File

@ -38,9 +38,8 @@
#ifndef HAVE_LIBUSB
struct dfu_dev *dfu_open(char *port_name) {
avrdude_message(MSG_INFO, "%s: Error: No USB support in this compile of avrdude\n",
progname);
struct dfu_dev *dfu_open(const char *port_name) {
pmsg_error("no USB support compiled for avrdude\n");
return NULL;
}
@ -99,8 +98,7 @@ static char * get_usb_string(usb_dev_handle * dev_handle, int index);
/* EXPORTED FUNCTION DEFINITIONS
*/
struct dfu_dev * dfu_open(char *port_spec)
{
struct dfu_dev *dfu_open(const char *port_spec) {
struct dfu_dev *dfu;
char *bus_name = NULL;
char *dev_name = NULL;
@ -112,16 +110,14 @@ struct dfu_dev * dfu_open(char *port_spec)
*/
if (strncmp(port_spec, "usb", 3) != 0) {
avrdude_message(MSG_INFO, "%s: Error: "
"Invalid port specification \"%s\" for USB device\n",
progname, port_spec);
pmsg_error("invalid port specification %s for USB device\n", port_spec);
return NULL;
}
if(':' == port_spec[3]) {
bus_name = strdup(port_spec + 3 + 1);
if (bus_name == NULL) {
avrdude_message(MSG_INFO, "%s: Out of memory in strdup\n", progname);
pmsg_error("out of memory in strdup\n");
return NULL;
}
@ -138,7 +134,7 @@ struct dfu_dev * dfu_open(char *port_spec)
if (dfu == NULL)
{
avrdude_message(MSG_INFO, "%s: out of memory\n", progname);
pmsg_error("out of memory\n");
free(bus_name);
return NULL;
}
@ -172,9 +168,7 @@ int dfu_init(struct dfu_dev *dfu, unsigned short vid, unsigned short pid)
*/
if (pid == 0 && dfu->dev_name == NULL) {
avrdude_message(MSG_INFO, "%s: Error: No DFU support for part; "
"specify PID in config or USB address (via -P) to override.\n",
progname);
pmsg_error("no DFU support for part; specify PID in config or USB address (via -P) to override\n");
return -1;
}
@ -209,20 +203,18 @@ int dfu_init(struct dfu_dev *dfu, unsigned short vid, unsigned short pid)
* why the match failed, and if we came across another DFU-capable part.
*/
avrdude_message(MSG_INFO, "%s: Error: No matching USB device found\n", progname);
pmsg_error("no matching USB device found\n");
return -1;
}
if(verbose)
avrdude_message(MSG_INFO, "%s: Found VID=0x%04x PID=0x%04x at %s:%s\n",
progname, found->descriptor.idVendor, found->descriptor.idProduct,
found->bus->dirname, found->filename);
pmsg_notice("found VID=0x%04x PID=0x%04x at %s:%s\n",
found->descriptor.idVendor, found->descriptor.idProduct,
found->bus->dirname, found->filename);
dfu->dev_handle = usb_open(found);
if (dfu->dev_handle == NULL) {
avrdude_message(MSG_INFO, "%s: Error: USB device at %s:%s: %s\n",
progname, found->bus->dirname, found->filename, usb_strerror());
pmsg_error("USB device at %s:%s: %s\n", found->bus->dirname, found->filename, usb_strerror());
return -1;
}
@ -272,37 +264,32 @@ int dfu_getstatus(struct dfu_dev *dfu, struct dfu_status *status)
{
int result;
avrdude_message(MSG_TRACE, "%s: dfu_getstatus(): issuing control IN message\n",
progname);
pmsg_trace("dfu_getstatus(): issuing control IN message\n");
result = usb_control_msg(dfu->dev_handle,
0x80 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_GETSTATUS, 0, 0,
(char*) status, sizeof(struct dfu_status), dfu->timeout);
if (result < 0) {
avrdude_message(MSG_INFO, "%s: Error: Failed to get DFU status: %s\n",
progname, usb_strerror());
pmsg_error("unable to get DFU status: %s\n", usb_strerror());
return -1;
}
if (result < sizeof(struct dfu_status)) {
avrdude_message(MSG_INFO, "%s: Error: Failed to get DFU status: %s\n",
progname, "short read");
pmsg_error("unable to get DFU status: %s\n", "short read");
return -1;
}
if (result > sizeof(struct dfu_status)) {
avrdude_message(MSG_INFO, "%s: Error: Oversize read (should not happen); "
"exiting\n", progname);
pmsg_error("oversize read (should not happen); exiting\n");
exit(1);
}
avrdude_message(MSG_TRACE, "%s: dfu_getstatus(): bStatus 0x%02x, bwPollTimeout %d, bState 0x%02x, iString %d\n",
progname,
status->bStatus,
status->bwPollTimeout[0] | (status->bwPollTimeout[1] << 8) | (status->bwPollTimeout[2] << 16),
status->bState,
status->iString);
pmsg_trace("dfu_getstatus(): bStatus 0x%02x, bwPollTimeout %d, bState 0x%02x, iString %d\n",
status->bStatus,
status->bwPollTimeout[0] | (status->bwPollTimeout[1] << 8) | (status->bwPollTimeout[2] << 16),
status->bState,
status->iString);
return 0;
}
@ -311,16 +298,14 @@ int dfu_clrstatus(struct dfu_dev *dfu)
{
int result;
avrdude_message(MSG_TRACE, "%s: dfu_clrstatus(): issuing control OUT message\n",
progname);
pmsg_trace("dfu_clrstatus(): issuing control OUT message\n");
result = usb_control_msg(dfu->dev_handle,
USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_CLRSTATUS, 0, 0,
NULL, 0, dfu->timeout);
if (result < 0) {
avrdude_message(MSG_INFO, "%s: Error: Failed to clear DFU status: %s\n",
progname, usb_strerror());
pmsg_error("unable to clear DFU status: %s\n", usb_strerror());
return -1;
}
@ -331,16 +316,14 @@ int dfu_abort(struct dfu_dev *dfu)
{
int result;
avrdude_message(MSG_TRACE, "%s: dfu_abort(): issuing control OUT message\n",
progname);
pmsg_trace("dfu_abort(): issuing control OUT message\n");
result = usb_control_msg(dfu->dev_handle,
USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_ABORT, 0, 0,
NULL, 0, dfu->timeout);
if (result < 0) {
avrdude_message(MSG_INFO, "%s: Error: Failed to reset DFU state: %s\n",
progname, usb_strerror());
pmsg_error("unable to reset DFU state: %s\n", usb_strerror());
return -1;
}
@ -352,29 +335,26 @@ int dfu_dnload(struct dfu_dev *dfu, void *ptr, int size)
{
int result;
avrdude_message(MSG_TRACE, "%s: dfu_dnload(): issuing control OUT message, wIndex = %d, ptr = %p, size = %d\n",
progname, wIndex, ptr, size);
pmsg_trace("dfu_dnload(): issuing control OUT message, wIndex = %d, ptr = %p, size = %d\n",
wIndex, ptr, size);
result = usb_control_msg(dfu->dev_handle,
USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_DNLOAD, wIndex++, 0,
ptr, size, dfu->timeout);
if (result < 0) {
avrdude_message(MSG_INFO, "%s: Error: DFU_DNLOAD failed: %s\n",
progname, usb_strerror());
pmsg_error("DFU_DNLOAD failed: %s\n", usb_strerror());
return -1;
}
if (result < size) {
avrdude_message(MSG_INFO, "%s: Error: DFU_DNLOAD failed: %s\n",
progname, "short write");
pmsg_error("DFU_DNLOAD failed: short write\n");
return -1;
}
if (result > size) {
avrdude_message(MSG_INFO, "%s: Error: Oversize write (should not happen); " \
"exiting\n", progname);
exit(1);
pmsg_error("DFU_DNLOAD failed: oversize write (should not happen)\n");
return -1;
}
return 0;
@ -384,28 +364,25 @@ int dfu_upload(struct dfu_dev *dfu, void *ptr, int size)
{
int result;
avrdude_message(MSG_TRACE, "%s: dfu_upload(): issuing control IN message, wIndex = %d, ptr = %p, size = %d\n",
progname, wIndex, ptr, size);
pmsg_trace("dfu_upload(): issuing control IN message, wIndex = %d, ptr = %p, size = %d\n",
wIndex, ptr, size);
result = usb_control_msg(dfu->dev_handle,
0x80 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, DFU_UPLOAD, wIndex++, 0,
ptr, size, dfu->timeout);
if (result < 0) {
avrdude_message(MSG_INFO, "%s: Error: DFU_UPLOAD failed: %s\n",
progname, usb_strerror());
pmsg_error("DFU_UPLOAD failed: %s\n", usb_strerror());
return -1;
}
if (result < size) {
avrdude_message(MSG_INFO, "%s: Error: DFU_UPLOAD failed: %s\n",
progname, "short read");
pmsg_error("DFU_UPLOAD failed: %s\n", "short read");
return -1;
}
if (result > size) {
avrdude_message(MSG_INFO, "%s: Error: Oversize read (should not happen); "
"exiting\n", progname);
pmsg_error("oversize read (should not happen); exiting\n");
exit(1);
}
@ -415,26 +392,26 @@ int dfu_upload(struct dfu_dev *dfu, void *ptr, int size)
void dfu_show_info(struct dfu_dev *dfu)
{
if (dfu->manf_str != NULL)
avrdude_message(MSG_INFO, " USB Vendor : %s (0x%04hX)\n",
msg_info(" USB Vendor : %s (0x%04hX)\n",
dfu->manf_str, (unsigned short) dfu->dev_desc.idVendor);
else
avrdude_message(MSG_INFO, " USB Vendor : 0x%04hX\n",
msg_info(" USB Vendor : 0x%04hX\n",
(unsigned short) dfu->dev_desc.idVendor);
if (dfu->prod_str != NULL)
avrdude_message(MSG_INFO, " USB Product : %s (0x%04hX)\n",
msg_info(" USB Product : %s (0x%04hX)\n",
dfu->prod_str, (unsigned short) dfu->dev_desc.idProduct);
else
avrdude_message(MSG_INFO, " USB Product : 0x%04hX\n",
msg_info(" USB Product : 0x%04hX\n",
(unsigned short) dfu->dev_desc.idProduct);
avrdude_message(MSG_INFO, " USB Release : %hu.%hu.%hu\n",
msg_info(" USB Release : %hu.%hu.%hu\n",
((unsigned short) dfu->dev_desc.bcdDevice >> 8) & 0xFF,
((unsigned short) dfu->dev_desc.bcdDevice >> 4) & 0xF,
((unsigned short) dfu->dev_desc.bcdDevice >> 0) & 0xF);
if (dfu->serno_str != NULL)
avrdude_message(MSG_INFO, " USB Serial No : %s\n", dfu->serno_str);
msg_info(" USB Serial No : %s\n", dfu->serno_str);
}
/* INTERNAL FUNCTION DEFINITIONS
@ -451,15 +428,14 @@ char * get_usb_string(usb_dev_handle * dev_handle, int index) {
result = usb_get_string_simple(dev_handle, index, buffer, sizeof(buffer)-1);
if (result < 0) {
avrdude_message(MSG_INFO, "%s: Warning: Failed to read USB device string %d: %s\n",
progname, index, usb_strerror());
pmsg_error("unable to read USB device string %d: %s\n", index, usb_strerror());
return NULL;
}
str = malloc(result+1);
if (str == NULL) {
avrdude_message(MSG_INFO, "%s: Out of memory allocating a string\n", progname);
pmsg_error("out of memory allocating a string\n");
return 0;
}

View File

@ -61,7 +61,7 @@ struct dfu_dev
#else
struct dfu_dev {
// empty
int dummy;
};
#endif
@ -114,7 +114,7 @@ struct dfu_status {
// FUNCTIONS
extern struct dfu_dev * dfu_open(char *port_spec);
extern struct dfu_dev *dfu_open(const char *port_spec);
extern int dfu_init(struct dfu_dev *dfu,
unsigned short vid, unsigned short pid);
extern void dfu_close(struct dfu_dev *dfu);

View File

@ -1,4 +1,5 @@
.cvsignore
avrdude.t2d/
avrdude.t2p/
Makefile
Makefile.in
avrdude-html

179
src/doc/CMakeLists.txt Normal file
View File

@ -0,0 +1,179 @@
#
# CMakeLists.txt - CMake project for AVRDUDE documentation
# Copyright (C) 2022 Marius Greuel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
set(AVRDUDE_CONF "${PROJECT_BINARY_DIR}/src/avrdude.conf")
set(TEXINFOS "${CMAKE_CURRENT_SOURCE_DIR}/avrdude.texi")
set(GENERATED_TEXINFOS
programmers.texi
programmer_types.texi
parts.texi
version.texi
)
string(TIMESTAMP TODAY "%d %B %Y")
set(DOCS_VERSION ${PROJECT_VERSION})
set(DOCS_UPDATED ${TODAY})
find_program(MAKEINFO_EXECUTABLE NAMES makeinfo)
find_program(TEXI2HTML_EXECUTABLE NAMES texi2html)
# =====================================
# Custom rules for auto-generated texi
# =====================================
add_custom_target(avrdude_binaries DEPENDS avrdude conf)
add_custom_command(
OUTPUT programmers.txt
DEPENDS avrdude_binaries
COMMAND $<TARGET_FILE:avrdude> -C ${AVRDUDE_CONF} -c ? 2>&1 | more > programmers.txt
VERBATIM
)
add_custom_command(
OUTPUT programmer_types.txt
DEPENDS avrdude_binaries
COMMAND $<TARGET_FILE:avrdude> -C ${AVRDUDE_CONF} -c ?type 2>&1 | more > programmer_types.txt
VERBATIM
)
add_custom_command(
OUTPUT parts.txt
DEPENDS avrdude_binaries
COMMAND $<TARGET_FILE:avrdude> -C ${AVRDUDE_CONF} -p ? 2>&1 | more > parts.txt
VERBATIM
)
add_custom_command(
OUTPUT programmers.texi
DEPENDS programmers.txt
COMMAND ${CMAKE_COMMAND}
-D TXT_FILE=programmers.txt
-D TEXI_FILE=programmers.texi
-P "${CMAKE_CURRENT_SOURCE_DIR}/programmers.cmake"
VERBATIM
)
add_custom_command(
OUTPUT programmer_types.texi
DEPENDS programmer_types.txt
COMMAND ${CMAKE_COMMAND}
-D TXT_FILE=programmer_types.txt
-D TEXI_FILE=programmer_types.texi
-P "${CMAKE_CURRENT_SOURCE_DIR}/programmer_types.cmake"
VERBATIM
)
add_custom_command(
OUTPUT parts.texi
DEPENDS parts.txt
COMMAND ${CMAKE_COMMAND}
-D TXT_FILE=parts.txt
-D TEXI_FILE=parts.texi
-D COMMENTS_FILE=${CMAKE_CURRENT_SOURCE_DIR}/parts_comments.txt
-P "${CMAKE_CURRENT_SOURCE_DIR}/parts.cmake"
VERBATIM
)
add_custom_command(
OUTPUT version.texi
COMMAND ${CMAKE_COMMAND} -E echo "@set EDITION ${DOCS_VERSION}" > version.texi
COMMAND ${CMAKE_COMMAND} -E echo "@set VERSION ${DOCS_VERSION}" >> version.texi
COMMAND ${CMAKE_COMMAND} -E echo "@set UPDATED ${DOCS_UPDATED}" >> version.texi
VERBATIM
)
# =====================================
# Custom rules for output files
# =====================================
add_custom_command(
OUTPUT avrdude.info
COMMAND ${MAKEINFO_EXECUTABLE} -o avrdude.info ${TEXINFOS}
DEPENDS ${TEXINFOS} ${GENERATED_TEXINFOS}
VERBATIM
)
add_custom_command(
OUTPUT avrdude.dvi
COMMAND ${MAKEINFO_EXECUTABLE}
--dvi
--Xopt=--quiet
--Xopt=--build-dir=dvi
-o avrdude.dvi
${TEXINFOS}
DEPENDS ${TEXINFOS} ${GENERATED_TEXINFOS}
VERBATIM
)
add_custom_command(
OUTPUT avrdude.pdf
COMMAND ${MAKEINFO_EXECUTABLE}
--pdf
--Xopt=--quiet
--Xopt=--build-dir=pdf
-o avrdude.pdf
${TEXINFOS}
DEPENDS ${TEXINFOS} ${GENERATED_TEXINFOS}
VERBATIM
)
add_custom_command(
OUTPUT avrdude.ps
COMMAND ${MAKEINFO_EXECUTABLE}
--ps
--Xopt=--quiet
--Xopt=--build-dir=ps
-o avrdude.ps
${TEXINFOS}
DEPENDS ${TEXINFOS} ${GENERATED_TEXINFOS}
VERBATIM
)
add_custom_command(
OUTPUT avrdude-html/avrdude.html
COMMAND ${TEXI2HTML_EXECUTABLE}
--split=node
--css-include=avrdude.css
--output=avrdude-html
-I ${CMAKE_CURRENT_BINARY_DIR}
${TEXINFOS}
DEPENDS ${TEXINFOS} ${GENERATED_TEXINFOS} avrdude.css
VERBATIM
)
# =====================================
# Custom targets for output files
# =====================================
add_custom_target(info ALL DEPENDS avrdude.info)
add_custom_target(dvi ALL DEPENDS avrdude.dvi)
add_custom_target(pdf ALL DEPENDS avrdude.pdf)
add_custom_target(ps ALL DEPENDS avrdude.ps)
add_custom_target(html ALL DEPENDS avrdude-html/avrdude.html)
# =====================================
# Install
# =====================================
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/avrdude.info" DESTINATION ${CMAKE_INSTALL_INFODIR})
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/avrdude.dvi" DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/avrdude.pdf" DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/avrdude.ps" DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/avrdude-html" DESTINATION ${CMAKE_INSTALL_DOCDIR})

View File

@ -40,7 +40,7 @@ all-local: info html ps pdf
html: avrdude-html/avrdude.html
avrdude-html/avrdude.html: $(srcdir)/$(info_TEXINFOS) $(GENERATED_TEXINFOS)
texi2html -split_node $(srcdir)/$(info_TEXINFOS)
texi2html --split=node --css-include=$(srcdir)/avrdude.css $(srcdir)/$(info_TEXINFOS)
if [ -e ./avrdude.html -o -e ./avrdude_1.html ]; then \
mkdir -p avrdude-html ; \
mv -f *.html avrdude-html ; \

20
src/doc/avrdude.css Normal file
View File

@ -0,0 +1,20 @@
body { background-color: #ffd; }
h1 { text-shadow: .05em .05em #ccc; }
table {
border: 3px solid #ccf;
background-color: white;
}
div.smallexample {
background-color: #dfd;
border: 3px solid #cfc;
}
div.example {
background-color: #dfd;
border: 3px solid #cfc;
}
samp {
color: blue;
}
code {
color: green;
}

File diff suppressed because it is too large Load Diff

37
src/doc/parts.cmake Normal file
View File

@ -0,0 +1,37 @@
#
# programmers.cmake - create parts.texi from parts.txt
# Copyright (C) 2022 Marius Greuel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
file(STRINGS ${COMMENTS_FILE} COMMENTS_CONTENTS)
file(STRINGS ${TXT_FILE} TXT_CONTENTS REGEX "=")
set(TEXI_CONTENTS "")
foreach(TXT_LINE IN LISTS TXT_CONTENTS)
string(REGEX REPLACE "^[ \t]*([^ \t]+)[ \t]*=[ \t]*(.*)$" "@item @code{\\1} @tab \\2" TEXI_LINE "${TXT_LINE}")
foreach(COMMENTS_LINE IN LISTS COMMENTS_CONTENTS)
string(REGEX MATCH "^([^ \t]*)(.*)$" DUMMY "${COMMENTS_LINE}")
set(PART_REGEX "${CMAKE_MATCH_1}")
set(COMMENT "${CMAKE_MATCH_2}")
string(REGEX REPLACE "(${PART_REGEX})" "\\1${COMMENT}" TEXI_LINE "${TEXI_LINE}")
endforeach()
set(TEXI_CONTENTS "${TEXI_CONTENTS}${TEXI_LINE}\n")
endforeach()
file(WRITE ${TEXI_FILE} "${TEXI_CONTENTS}")

View File

@ -0,0 +1,28 @@
#
# programmer_types.cmake - create programmer_types.texi from programmer_types.txt
# Copyright (C) 2022 Marius Greuel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
file(STRINGS ${TXT_FILE} TXT_CONTENTS REGEX "=")
SET(TEXI_CONTENTS "")
foreach(TXT_LINE IN LISTS TXT_CONTENTS)
string(REGEX REPLACE "^[ \t]*([^ \t]+)[ \t]*=[ \t]*(.*)$" "@item @code{\\1} @tab \\2" TEXI_LINE "${TXT_LINE}")
string(REGEX REPLACE "<?(http[s]?://[^ \t,>]+)>?" "@url{\\1}" TEXI_LINE "${TEXI_LINE}")
set(TEXI_CONTENTS "${TEXI_CONTENTS}${TEXI_LINE}\n")
endforeach()
file(WRITE ${TEXI_FILE} "${TEXI_CONTENTS}")

28
src/doc/programmers.cmake Normal file
View File

@ -0,0 +1,28 @@
#
# programmers.cmake - create programmers.texi from programmers.txt
# Copyright (C) 2022 Marius Greuel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
file(STRINGS ${TXT_FILE} TXT_CONTENTS REGEX "=")
SET(TEXI_CONTENTS "")
foreach(TXT_LINE IN LISTS TXT_CONTENTS)
string(REGEX REPLACE "^[ \t]*([^ \t]+)[ \t]*=[ \t]*(.*)$" "@item @code{\\1} @tab \\2" TEXI_LINE "${TXT_LINE}")
string(REGEX REPLACE "[ \t>]*,?[ \t>]*<?(http[s]?://[^ \t>]+)>?" ",@*\n@url{\\1}" TEXI_LINE "${TEXI_LINE}")
set(TEXI_CONTENTS "${TEXI_CONTENTS}${TEXI_LINE}\n")
endforeach()
file(WRITE ${TEXI_FILE} "${TEXI_CONTENTS}")

Some files were not shown because too many files have changed in this diff Show More