Commit Graph

2785 Commits

Author SHA1 Message Date
Stefan Rueger
2f6bd01a7d Fix uninitialised variable warning 2023-05-24 13:51:26 +01:00
Stefan Rueger
784eda6ff3 Provide terminal config command to set fuses and lock bits
Example:

$ avrdude -c dryrun -p AVR32DA32 -t
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9533 (probably avr32da32)

avrdude> c
config period=t_off # 0
config window=t_off # 0
config sleep=bod_disabled # 0
config active=bod_disabled # 0
config sampfreq=sf_128hz # 0
config lvl=bod_1v9 # 0
config clksel=oschf # 0
config eesave=eex_erased # 0
config rstpincfg=gpio # 0
config crcsel=crc16 # 0
config crcsrc=nocrc # 0b11 = 3
config sut=sut_0ms # 0
config codesize=0 # 0
config bootsize=0 # 0
config key=nolock # 0x5cc5c55c

avrdude> c active= -vv
config active=bod_disabled # 0 (brownout detection disabled)

avrdude> c sleep=3
avrdude warning: (config) assigning a reserved value (0x03) to sleep, check data sheet

avrdude> c -v sleep=
config sleep=0b11 # reserved = 3

avrdude> c sleep=bod_cont

avrdude> c -?
Syntax: config {<opts> | <property>[=<value>]}
Function: Show or change configuration properties of the part
Options:
    -f show value of fuse and lock bit memories as well
    -a output an initialisation script with all possible assignments
    -v increase verbosity, show explanations alongside output
    -h show this help message

Config alone shows all property names and current settings of the part's
hardware configuration in terms of symbolic mnemonics or values. Use

avrdude> config <property>

to show that of <property>. Wildcards or initial strings are permitted (but
not both), in which case all settings of matching properties are displayed.

avrdude> config <property>=

shows all possible values that <property> can take on with the currently
set one being the only that is not commented out. Assignments

avrdude> config <property>=<value>

modify the corresponding fuse or lock bits immediately but will normally only
take effect the next time the part is reset (see the data sheet). Value can
be a valid integer or one of the symbolic mnemonics, if known. Wildcards or
initial strings are permitted for the mnemonic, but an assignment only
happens if both the property and the name can be uniquely resolved.

It is quite possible, as is with direct writing to the underlying fuse and
lock bits, to brick a part, i.e., make it unresponsive to further programming
with the chosen programmer: here be dragons.
2023-05-22 23:18:26 +01:00
Stefan Rueger
db9884361c Update avrintel.[ch] 2023-05-22 21:16:34 +01:00
Stefan Rueger
5ca48353c7 Add str_match() to str_util.c 2023-05-22 00:11:37 +01:00
Stefan Rueger
42d14cc195 Move itoa() implementation to str_util.c 2023-05-21 14:56:00 +01:00
Stefan Rueger
180b730d71 Make dryrun work regardless of programming modes 2023-05-21 11:49:30 +01:00
Stefan Rueger
ded200cae9 Add string upper/lowercase conversions to str_util.c 2023-05-20 21:35:58 +01:00
Stefan Rueger
0f6037a0fa Update avrintel.[ch] with configuration information
... whilst moving functions that locate a part in uP_table[] from
urclock.c to avrintel.c
2023-05-20 21:33:17 +01:00
Stefan Rueger
781595fe68 Fix some initial values of fuses/lock bits 2023-05-20 21:29:31 +01:00
Stefan Rueger
07bda5e913 Update NEWS 2023-05-20 21:16:12 +01:00
Stefan Rueger
9e9eb56cfd Merge pull request #1360 from stefanrueger/atxmega-A4U
Add fuse0 to ATxmega128A4U/64A4U/32A4U/16A4U
2023-05-20 20:45:22 +01:00
Stefan Rueger
dffeb4cf21 Merge pull request #1358 from stefanrueger/strutil
Extend <data> notion to files in terminal write
2023-05-20 20:44:07 +01:00
Stefan Rueger
d160b17f4c Mention XMEGA B also have fuse0 2023-05-20 12:53:01 +01:00
Stefan Rueger
34421a1da7 Add fuse0 to ATxmega128A4U/64A4U/32A4U/16A4U
See page 29 of Atmel's 8077I–AVR–11/2012 XMEGA A MANUAL
https://ww1.microchip.com/downloads/en/DeviceDoc/doc8077.pdf
2023-05-20 01:17:28 +01:00
Stefan Rueger
234aebd1dd Document reading from file with format :b, :o, :d and :h 2023-05-19 20:27:15 +01:00
Stefan Rueger
3815079c91 Auto detect :b, :o, :d and :h file formats 2023-05-19 20:18:53 +01:00
Stefan Rueger
1e07529b9b Document 0b binary integers and files for terminal write command 2023-05-19 17:51:23 +01:00
Stefan Rueger
e3ceb5e891 Update documentation of memory types for modern AVR parts 2023-05-19 16:12:27 +01:00
Stefan Rueger
5a8c051a22 Move file format conversions into one place 2023-05-19 15:28:56 +01:00
Stefan Rueger
8683476417 Enable :b :o :d and :h mode to be read from file
In fact not only lists of 0b-binary, octal, decimal and 0x-hex bytes can
be read, but also combinations of them, float numners and strings (just
like in terminal write). The immediate mode :m now can also read
terminal-type data (just be careful with preseving the quotes in the
shell through a double layer of quoting).

avrdude -U "eeprom:w:42.0,0b101010,42,0x2a,052,'*':m"
2023-05-18 18:06:12 +01:00
Stefan Rueger
d9e20708c1 Fix error in -U parsing 2023-05-18 00:22:05 +01:00
Stefan Rueger
fdedba8485 Simplify -U parsing so that more filenames with colons pass 2023-05-17 23:36:06 +01:00
Stefan Rueger
f119c0c29d Silence overzealous compiler warnings 2023-05-17 23:35:29 +01:00
Stefan Rueger
c4f48c94fe Spell out function of varef terminal command 2023-05-17 01:26:35 +01:00
Stefan Rueger
6111dc12d8 Note the file format instead of repeated pathname in terminal write errors 2023-05-17 01:16:47 +01:00
Stefan Rueger
62023e2a3b Review and update terminal help messages 2023-05-16 21:43:45 +01:00
Stefan Rueger
5cf5924f6c Update and shorten terminal help messages 2023-05-15 18:24:50 +01:00
Stefan Rueger
464d18729e Allow successive terminal commands in one line separated by ;
This makes it easier to pass multi-line commands from a single bash line:

$ echo "d ee 0 16; d ee -16 -1" | avrdude -qqt
avrdude> d ee 0 16; d ee -16 -1
0000  48 65 6c 6c 6f 2c 20 77  6f 72 6c 64 21 00 ff ff  |Hello, world!...|
03f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
2023-05-15 17:52:18 +01:00
Stefan Rueger
e7fb2e2b34 Allow inline # comments for terminal commands 2023-05-15 17:09:10 +01:00
Stefan Rueger
a1bbbe904c Simplify tokenize() 2023-05-15 17:05:08 +01:00
Stefan Rueger
a40b9db5a4 Rewrite nexttok() to allow escaped spaces in non-string arguments
Useful for file names

```
$ echo "Hello, world!" >'Q:\Projects\Eurovision Song Contest\light show.eep'
$ avrdude -qqt
avrdude> erase eeprom 0 16
avrdude> # Escape spaces in filenames with a backslash:
avrdude> write eeprom Q:\Projects\Eurovision\ Song\ Contest\light\ show.eep:r
avrdude> dump eeprom 0 16
0000  48 65 6c 6c 6f 2c 20 77  6f 72 6c 64 21 0a ff ff  |Hello, world! ..|
```
2023-05-15 16:49:08 +01:00
Stefan Rueger
88d4d712df Extend <data> notion in terminal write to files
$ echo "The quick brown fox jumps over the lazy dog" >fox

$ avrdude -qqt
avrdude> w
Usage: write <memory> <addr> <data>[,] {<data>[,]}
       write <memory> <addr> <len> <data>[,] {<data>[,]} ...
       write <memory> <datum> # only for 1-byte memories
       write <memory> <file>  # only for memories with more than 1 byte

Ellipsis ... writes <len> bytes padded by repeating the last <data> item.

Both the <addr> and <len> can be negative numbers; a negative <addr> starts
an interval from that many bytes below the memory size; a negative <len> ends
the interval at that many bytes below the memory size.

<data> can be binary, octal, decimal or hexadecimal integers, floating point
numbers or C-style strings and characters. If nothing matches, <data> will be
interpreted as a file name containing data. In absence of a :<f> format
suffix, the terminal will try to auto-detect the file format.
[...]

avrdude> write eeprom 0 80 0xff ...

avrdude> write eeprom fox
avrdude error: (write) data fox: cannot determine format for file fox, specify explicitly

avrdude> write eeprom fox:r

avrdude> read eeprom 0 80
0000  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
0010  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
0020  68 65 20 6c 61 7a 79 20  64 6f 67 0a ff ff ff ff  |he lazy dog ....|
0030  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

avrdude> write eeprom 0b10000 fox:r

avrdude> read eeprom 0 80
0000  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
0010  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
0020  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
0030  68 65 20 6c 61 7a 79 20  64 6f 67 0a ff ff ff ff  |he lazy dog ....|
0040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

avrdude> write eeprom 0 80 0xff ...

avrdude> write eeprom 0 "Hello, world" 1 2 3 fox:r

avrdude> read eeprom 0 80
0000  48 65 6c 6c 6f 2c 20 77  6f 72 6c 64 00 01 02 03  |Hello, world....|
0010  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
0020  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
0030  68 65 20 6c 61 7a 79 20  64 6f 67 0a ff ff ff ff  |he lazy dog ....|
0040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

avrdude> write eeprom 0 77 "Hello, world" 1 2 3 fox:r ...

avrdude> read eeprom 0 80
0000  48 65 6c 6c 6f 2c 20 77  6f 72 6c 64 00 01 02 03  |Hello, world....|
0010  54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  |The quick brown |
0020  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74  |fox jumps over t|
0030  68 65 20 6c 61 7a 79 20  64 6f 67 0a 54 68 65 20  |he lazy dog The |
0040  71 75 69 63 6b 20 62 72  6f 77 6e 20 66 ff ff ff  |quick brown f...|
2023-05-14 20:12:32 +01:00
Stefan Rueger
4b62480e85 Use str_int() for main option parsing 2023-05-14 13:46:01 +01:00
Stefan Rueger
21521c23c6 Use str_int() for reset pin in linuxspi port string 2023-05-14 13:33:18 +01:00
Stefan Rueger
1edc42cf3e Use str_int() for general urclock option parsing 2023-05-14 13:24:45 +01:00
Stefan Rueger
1520422639 Use str_int() for urclockID parsing 2023-05-14 13:19:28 +01:00
Stefan Rueger
cf963702d4 Fix big endian treatment 2023-05-14 12:58:11 +01:00
Stefan Rueger
4eee8ab7be Add default_bitclock to avrdude -c*/s -p*/s output 2023-05-14 02:55:09 +01:00
Stefan Rueger
a7ae555f71 Use str_int() for avrdude.conf integers 2023-05-14 02:54:50 +01:00
Stefan Rueger
9628a820c8 Use str_int() for <data> in -U <mem>:w:<data>:m immediate updates 2023-05-14 01:11:41 +01:00
Stefan Rueger
5603bef0d7 Use str_int() for avrdude.conf address bit number aN 2023-05-14 00:54:21 +01:00
Stefan Rueger
9dc08857a8 Change error message for missing data on terminal write 2023-05-14 00:37:12 +01:00
Stefan Rueger
96fea11257 Use str_int() in terminal read 2023-05-13 23:29:33 +01:00
Stefan Rueger
7589246a40 Use str_int() in terminal write 2023-05-13 23:28:34 +01:00
Stefan Rueger
1091f1d421 Use str_int() in terminal send 2023-05-13 23:27:28 +01:00
Stefan Rueger
efbc69aaf8 Use str_int() in terminal pgerase 2023-05-13 23:25:55 +01:00
Stefan Rueger
fb42518f6b Use str_int() in terminal varef 2023-05-13 23:24:25 +01:00
Stefan Rueger
6accc3baae Use str_int in terminal verbose 2023-05-13 23:22:24 +01:00
Stefan Rueger
5acf5c6aaf Use str_int() in terminal quell 2023-05-13 23:21:11 +01:00
Stefan Rueger
63f818f53f Hide Easter egg 2023-05-13 23:16:21 +01:00