Commit Graph

27 Commits

Author SHA1 Message Date
Marius Greuel 8b147b4bcd Merge main branch 2023-01-09 19:27:38 +01:00
Stefan Rueger e4f10a33ab
Clarify comment 2022-12-13 23:59:58 +00: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 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
Stefan Rueger ea2d7eec95
Fix fopen() file mode in fileio_fmt_autodetect() 2022-11-29 19:46:48 +00: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 87df3216cb
Make fileio() and do_op() arguments const where possible 2022-10-29 10:48:47 +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 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 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 ed36c7e1f6
Merge branch 'main' into fix_1041 2022-08-04 18:03:49 +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
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
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
Stefan Rueger f47ec634f8 On verify always verify full input file 2022-04-28 17:53:10 +01: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
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
Yegor Yefremov f29b2a283a Fix typos all over the code 2022-01-07 11:31:16 +01:00
Marius Greuel 5633a6d88a Move source files to 'src' folder 2021-12-17 09:17:42 +01:00