Skip to content

Commit f16a085

Browse files
authored
Merge branch 'avrdudes:main' into python_binding_improvement
2 parents 806b792 + b440362 commit f16a085

File tree

8 files changed

+127
-17
lines changed

8 files changed

+127
-17
lines changed

.github/workflows/build.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ jobs:
218218
build/src/avrdude
219219
build/src/avrdude.conf
220220
221-
macos-x86_64:
221+
macos-arm64:
222222
runs-on: macos-latest
223223
steps:
224224
- uses: actions/checkout@v3
@@ -265,20 +265,20 @@ jobs:
265265
if: always()
266266
uses: actions/upload-artifact@v4
267267
with:
268-
name: build-macos-x86_64
268+
name: build-macos-arm64
269269
path: |
270270
build/
271271
!**/*.d
272272
!**/*.o
273273
- name: Archive executables
274274
uses: actions/upload-artifact@v4
275275
with:
276-
name: avrdude-macos-x86_64
276+
name: avrdude-macos-arm64
277277
path: |
278278
build/src/avrdude
279279
build/src/avrdude.conf
280280
281-
macos-x86_64-autotools:
281+
macos-arm64-autotools:
282282
runs-on: macos-latest
283283
steps:
284284
- uses: actions/checkout@v3
@@ -391,6 +391,21 @@ jobs:
391391
build/src/avrdude.exe
392392
build/src/avrdude.pdb
393393
build/src/avrdude.conf
394+
- name: Move executables
395+
if: matrix.arch == 'x64'
396+
run: |
397+
mv build/src/${{env.BUILD_TYPE}}/_swig_avrdude.pyd build/src
398+
- name: Archive Python related files for x64
399+
if: matrix.arch == 'x64'
400+
uses: actions/upload-artifact@v4
401+
with:
402+
name: avrdude-msvc-python_x64
403+
path: |
404+
build/src/avrdude.conf
405+
build/src/_swig_avrdude.pyd
406+
build/src/swig_avrdude.py
407+
build/src/windows.rc
408+
build/src/avrdude-gui.bat
394409
395410
mingw:
396411
runs-on: windows-latest
@@ -411,7 +426,6 @@ jobs:
411426
update: true
412427
install: >-
413428
base-devel
414-
swig
415429
mingw-w64-${{matrix.env}}-gcc
416430
mingw-w64-${{matrix.env}}-cmake
417431
mingw-w64-${{matrix.env}}-python
@@ -431,6 +445,7 @@ jobs:
431445
-G"MSYS Makefiles"
432446
-D DEBUG_CMAKE=1
433447
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
448+
-D SWIG_EXECUTABLE=SWIG_EXECUTABLE-NOTFOUND
434449
-B build
435450
- name: Build
436451
run: cmake --build build

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
- { arch: arm64 }
5757
steps:
5858
- name: Download artifact
59-
uses: actions/download-artifact@v2
59+
uses: actions/download-artifact@v4
6060
with:
6161
name: avrdude-msvc-${{matrix.arch}}
6262

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# cmake --build build
2222

2323
cmake_minimum_required(VERSION 3.14)
24-
project(avrdude VERSION 8.0 LANGUAGES C)
24+
project(avrdude VERSION 8.1 LANGUAGES C)
2525

2626
set(CMAKE_C_STANDARD 11)
2727
set(CMAKE_C_STANDARD_REQUIRED True)

NEWS

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,28 @@ Approximate change log for AVRDUDE by version.
33
(For detailed changes, see the version control system logs.)
44

55
----------------------------------------------------------------------
6-
Changes since version 8.0:
6+
Changes since version 8.1:
7+
8+
* Major changes compared to the previous version:
9+
10+
* New devices supported:
11+
12+
* New programmers supported:
13+
14+
* New serial adapters supported:
15+
16+
* Issues fixed:
17+
18+
- GitHub deploy action fails #2038
19+
20+
* Pull requests:
21+
22+
- Use download-artifact@v4 instead of v2 #2040
23+
- Deduplicate programmer list in docs #2042
24+
25+
* Internals:
26+
27+
Changes in version 8.1:
728

829
* Major changes compared to the previous version:
930

@@ -69,6 +90,7 @@ Changes since version 8.0:
6990
- SNAP in "MPLAB mode" has an incorrect USB VID #1999
7091
- disasm -g can result in code that avr-gcc fails #1997
7192
- -U urboot:..._show wrongly auto-erases the chip #1996
93+
- MPLAB programmers can't write to Xmega boot memory #2028
7294

7395
* Pull requests:
7496

@@ -127,6 +149,10 @@ Changes since version 8.0:
127149
- Update from device packs #2023
128150
- Enable macOS Python binding build #2025
129151
- Add pkg-config as a Linux build dependency #2026
152+
- Upload avrdude-gui artifacts for Windows x86_64 MSVC #2031
153+
- Rename macOS CI build to arm64 #2033
154+
- Fix PDI Bootmem write #2034
155+
- Disable MSys2 Windows Python Binding in CI #2036
130156

131157
* Internals:
132158

avrdude.pdf

247 Bytes
Binary file not shown.

src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,8 @@ add_library(libavrdude
324324
set_target_properties(libavrdude PROPERTIES
325325
PREFIX ""
326326
PUBLIC_HEADER "libavrdude.h;libavrdude-avrintel.h"
327-
VERSION 3.0.0
328-
SOVERSION 3
327+
VERSION 4.0.0
328+
SOVERSION 4
329329
)
330330

331331
target_include_directories(libavrdude

src/doc/programmers.sed

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ s/serial port: reset=!dtr sck=rts sdo=txd sdi=cts/Serial port programmer/
4242
s/Emulates bootloader programming without the part/Emulating a bootloader (dryboot)/
4343
s/Emulates programming without a programmer/Emulating a HW programmer (dryrun)/
4444
s/AVR ISP programmer from eHaJo.de/AVR ISP programmer/
45-
s/FLIP bootloader using USB DFU .*/FLIP bootloader/
45+
s/FLIP bootloader using USB DFU/FLIP bootloader DFU/
4646
s/FT2232H\/D.based generic programmer/FT2232H\/D programmer/
4747
s/FT2232H.based generic JTAG programmer/FT2232H JTAG programmer/
4848
s/FT232H.based generic programmer/FT232H programmer/
@@ -55,7 +55,7 @@ s/AVR ISP programmer from iascaled.com/AVR ISP programmer/
5555
s/Amontec JTAGKey\/JTAGKey-Tiny\/JTAGKey2/Amontec JTAGKey/
5656
s/KT-LINK FT2232H: IO switching, voltage buffers/KT-LINK FT2232H/
5757
s/Use Linux SPI device in \/dev\/spidev\*/Linux \/dev\/spidev\* programmer/
58-
s/Luminary Micro LM3S811 Eval Board.*/Luminary Micro LM3S811/
58+
s/Luminary Micro LM3S811 Eval Board (Rev. A)/Luminary Micro LM3S811/
5959
s/Crossbow MIB510 programming board/Crossbow MIB510/
6060
s/Jason Kyle's pAVR Serial Programmer/Jason Kyle's pAVR/
6161
s/ponyprog serial: reset=!txd sck=rts sdo=dtr sdi=cts/Serial port programmer/
@@ -67,6 +67,8 @@ s/uncompatino with all pairs of pins shorted/Uncompatino programmer/
6767
s/Urboot bootloaders using urprotocol/Urboot bootloader\n@cindex Urclock programmer\n@cindex Urprotocol/
6868
s/Any usbasp clone with correct VID\/PID/Usbasp clones/
6969
s/Wiring bootloader using STK500 v2 protocol/Wiring bootloader/
70-
s/XBeeBoot Over-The-Air bootloader.*/XBeeBoot OTA bootloader/
71-
s/@cindex Atmel \(.*\)/&\n@cindex \u\1/
72-
s/@cindex MPLAB(R) \(.*\)/&\n@cindex \u\1/
70+
s/XBeeBoot Over-The-Air bootloader (STK500 v1)/XBeeBoot OTA bootloader/
71+
y/_\n/\n_/
72+
s/@cindex Atmel \([^_]*\)/&_@cindex \u\1/
73+
s/@cindex MPLAB(R) \([^_]*\)/&_@cindex \u\1/
74+
y/_\n/\n_/

src/pickit5.c

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ static int pickit5_tpi_write(const PROGRAMMER *pgm, const AVRPART *p,
170170
static int pickit5_jtag_write_fuse(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned char value);
171171
static int pickit5_jtag_read_fuse(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem, unsigned char *value);
172172

173+
// PDI-Specific
174+
static int pickit5_pdi_flash_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *mem,
175+
unsigned long addr, int len, unsigned char *value);
176+
173177
// Extra functions
174178
static int pickit5_get_fw_info(const PROGRAMMER *pgm);
175179
static int pickit5_set_vtarget(const PROGRAMMER *pgm, double v);
@@ -825,7 +829,7 @@ static void pickit5_enable(PROGRAMMER *pgm, const AVRPART *p) {
825829
mem->readsize = mem->size < 512? mem->size : 512;
826830
}
827831
}
828-
if(both_xmegajtag(pgm, p) || both_pdi(pgm, p)) {
832+
if(both_xmegajtag(pgm, p)) { // True Page size is needed for a PDI fix, so don't increase them
829833
if((mem = avr_locate_flash(p))) {
830834
mem->page_size = mem->size < 1024? mem->size : 1024;
831835
mem->readsize = mem->size < 1024? mem->size : 1024;
@@ -1252,6 +1256,67 @@ static int pickit5_updi_read_byte(const PROGRAMMER *pgm, const AVRPART *p,
12521256
*/
12531257
}
12541258

1259+
/* a little workaround function to write application and boot from one function */
1260+
static int pickit5_pdi_flash_write(const PROGRAMMER *pgm, const AVRPART *p,
1261+
const AVRMEM *mem, unsigned long addr, int len, unsigned char *value) {
1262+
pmsg_debug("%s\n", __func__);
1263+
unsigned short page_size = mem->page_size;
1264+
if (len % page_size != 0) { // sanity
1265+
pmsg_error("length %i is not a multiple of page size %i, aborting.\n", len, page_size);
1266+
return -1;
1267+
}
1268+
1269+
unsigned char flash_cmd[] = {
1270+
0x91, 0x00, // Load script paramter to r00
1271+
0x91, 0x01, // Load script paramter to r01
1272+
0x90, 0x04, 0xCA, 0x01, 0x00, 0x01, // Set r04 to value 0x10001CA (NVM CMD)
1273+
0x90, 0x05, 0xC4, 0x01, 0x00, 0x01, // Set r05 to value 0x10001C4 (NVM Data)
1274+
0x90, 0x06, 0xCF, 0x01, 0x00, 0x01, // Set r06 to value 0x10001CF (NVM Status)
1275+
0x9B, 0x07, 0x23, // Set r07 to value 0x23 (NVM Load Page Buffer)
1276+
0x9B, 0x08, 0x2F, // Set r08 to value 0x2F (NVM Erase and write flash page)
1277+
0x9B, 0x09, 0xFF, // Set r09 to value 0xFF (Dummy Flash write value)
1278+
0x9C, 0x0A, page_size, (page_size >> 8), // Load word (page size) to r09
1279+
1280+
0x1E, 0x03, 0x04, // load byte from NVM Command register (r04)
1281+
0x6C, 0x0B, // Move temp_reg to r11
1282+
0x1E, 0x03, 0x05, // Load byte from NVM Data register (r05)
1283+
0x6C, 0x0C, // Move temp_reg to r12
1284+
1285+
0x60, 0x03, 0x01, // copy r01 to r03
1286+
0x93, 0x03, page_size, (page_size >> 8), // Integer divide r03 by page size
1287+
0xAD, 0x03, // while (r03 --) {
1288+
1289+
0x1E, 0x06, 0x04, 0x07, // Load "load page command" to NVM Cmd Reg
1290+
0x1E, 0x09, 0x00, // Set pointer for indirect addressing to r00
1291+
0x1E, 0x10, 0x0A, // Set repeat counter to number in r09
1292+
0x1E, 0x0A, 0x0A, // read from data stream and send it to the device
1293+
1294+
0x1E, 0x06, 0x04, 0x08, // Load "Erase and write flash page" command into NVM Cmd buffer
1295+
0x1E, 0x06, 0x00, 0x09, // Triger NVM Cmd by writing to the first address (r0, 0xFF)
1296+
0xA2, // Do {
1297+
0x1E, 0x03, 0x06, // Check status reg (r06)
1298+
0xA5, 0x80, 0x00, 0x00, 0x00, // } while ((status reg & 0x80 != 0x00))
1299+
0x00, 0x00, 0x00, 0x00, 0x64, 0x00, // for at most 100 times
1300+
0xAE, // } (End of Loop)
1301+
1302+
0x1E, 0x06, 0x05, 0x0C, // Store byte in r12 to SRAM Address in r05
1303+
0x1E, 0x06, 0x04, 0x0B, // Store byte in r11 to SRAM Address in r04
1304+
0x92, 0x00, page_size, (page_size >> 8), 0x00, 0x00, // Increment r00 by page size
1305+
0x5A, // Set Error Status
1306+
};
1307+
1308+
addr += mem->offset;
1309+
1310+
unsigned char param[8];
1311+
pickit5_uint32_to_array(&param[0], addr);
1312+
pickit5_uint32_to_array(&param[4], len);
1313+
1314+
int rc = pickit5_download_data(pgm, flash_cmd, sizeof(flash_cmd), param, sizeof(param), value, len);
1315+
if(rc < 0)
1316+
rc = LIBAVRDUDE_EXIT;
1317+
return rc;
1318+
}
1319+
12551320
// Return numbers of byte written
12561321
static int pickit5_write_array(const PROGRAMMER *pgm, const AVRPART *p,
12571322
const AVRMEM *mem, unsigned long addr, int len, unsigned char *value) {
@@ -1270,7 +1335,9 @@ static int pickit5_write_array(const PROGRAMMER *pgm, const AVRPART *p,
12701335
if(is_debugwire(pgm) && !mem_is_in_flash(mem)) // For flash programming, stay in ISP mode
12711336
pickit5_isp_switch_to_dw(pgm, p);
12721337
if(is_tpi(pgm))
1273-
pickit5_tpi_write(pgm, p, mem, addr, len, value);
1338+
return pickit5_tpi_write(pgm, p, mem, addr, len, value);
1339+
if(is_pdi(pgm) && mem_is_in_flash(mem))
1340+
return pickit5_pdi_flash_write(pgm, p, mem, addr, len, value);
12741341

12751342
const unsigned char *write_bytes = NULL;
12761343
unsigned int write_bytes_len = 0;

0 commit comments

Comments
 (0)