avrdudes / avrdude

AVRDUDE is a utility to program AVR microcontrollers
GNU General Public License v2.0
647 stars 123 forks source link

Microchip MPLAB ICE 4, MPLAB ICD 5 and PICKit 5 support #1368

Open mcuee opened 1 year ago

mcuee commented 1 year ago

1) MPLAB ICE 4 has been released for quite a while. https://www.microchip.com/en-us/development-tool/DV244140

I am not so sure if there are people who have it and want to play with avrdude. It is rather expensive though at US$2068.85) (much more expensive than Atmel-ICE at US$203.65 and PICKit 4 at US$88.54, and the new PICKit 5 at US$94.99).

2) Microchip has released PICKit 5 as an upgrade to PICKit 4. At US$94.99 it seems to be a decent tool to work with Microchip MCUs including AVRs. Therefore it will be good to see future support of PICKit 5 in avrdude https://www.microchip.com/en-us/development-tool/PG164150

3) Along with PICKit 5 (US$94.99), Microchip has released MPLAB ICD 5 at US$399.99. It will be good to add support for MPLAB ICD 5 in the future. https://www.microchip.com/en-us/development-tool/DV164055

MCUdude commented 1 year ago

@xedbg are the ICE 4 similar to the PICkit5 in which it uses byte-code scripts to program/debug AVRs instead of using a dedicated "mode" like the PICkit4 and the SNAP?

If the ICE 4 does it similarly to the PK4/SNAP, it should be trivial to add ICE 4 support even though I obviously don't have an ICE 4 to test with.

mcuee commented 1 year ago

@MCUdude

I think same question can be asked for MPLAB ICD5 which is of much lower cost than MPLAB ICE 4 (but a bit more expensive than Atmel-ICE).

xedbg commented 1 year ago

Yes - all of these tools are equivalent in the way they work with PIC/AVR/MIPS/PIC32C/SAM

mcuee commented 1 year ago

Yes - all of these tools are equivalent in the way they work with PIC/AVR/MIPS/PIC32C/SAM

So basically PICKit 5, MPLAB ICD 5 and MPLAB ICE 4 work the same as you mentioned in the PICKit 5 issue, right? There is no AVR mode.

The PICkit5 to my knowledge supports only the native "PIC" mode, and has implemented AVR (and ARM) support in that mode using a system of byte-code scripts which are drawn from XML within the tool-pack. This means that it is only supported in MPLAB (and not Studio, or any other CMSIS-DAP-enabled third-party IDE) and even if the protocol were to be published, would unfortunately require a non-trivial amount of work to get it into avrdude.

xedbg commented 1 year ago

Yes - all of these tools are equivalent in the way they work with PIC/AVR/MIPS/PIC32C/SAM

So basically PICKit 5, MPLAB ICD 5 and MPLAB ICE 4 work the same as you mentioned in the PICKit 5 issue, right? There is no AVR mode.

Correct.

The PICkit5 to my knowledge supports only the native "PIC" mode, and has implemented AVR (and ARM) support in that mode using a system of byte-code scripts which are drawn from XML within the tool-pack. This means that it is only supported in MPLAB (and not Studio, or any other CMSIS-DAP-enabled third-party IDE) and even if the protocol were to be published, would unfortunately require a non-trivial amount of work to get it into avrdude.

MCUdude commented 1 year ago

OK, so if someone added support for PICkit5 in the future, it would be trivial to add the ICE 4 and ICD 5 as well? This will absolutely be something Microchip would benefit from, so I hope they put some time and effort into this sometime in the future.

If yes, maybe @mcuee can combine #1367 and #1369 into a single issue; perhaps close this one (#1368) and #1369, and edit #1367?

stefanrueger commented 1 year ago

combine https://github.com/avrdudes/avrdude/issues/1367 and https://github.com/avrdudes/avrdude/issues/1369 into a single issue

I agree; it would be great to see the issues list shrink before we release v 7.2 :smile:

mcuee commented 1 year ago

Done. Closed #1367 and #1369 and merged into this one.

mcuee commented 8 months ago

It is interesting that Microchip is calling the new tools Gen 4 and Gen 5.

MPLABX IDE 6.15 release notes: https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/SupportingCollateral/mplabx-ide-release-notes-v6.15.zip

Hardware Tools - Gen 4 Release Notes for MPLAB Snap Release Notes for MPLAB PICkit 4 Release Notes for MPLAB ICD 4 Release Notes for MPLAB ICE 4

Hardware Tools - Gen 5 Release Notes for MPLAB PICkit 5 Release Notes for MPLAB ICD 5

I guess the previous devices are categorized as Gen 1/2/3, roughly like the following (for the AVR side).

AVR Side Gen 1 -- AVRISP, STK500v1, JTAGICE 1 Gen 2 -- AVRISP mkII, STK500v2, JTAGICE mkII, AVR Dragon Gen 3 - JTAGICE 3, Atmel-ICE, Power Debugger, EDBG, mEDBG, nEBDG

PIC side Gen 1 -- MPLAB ICD 1, PICkit 1, ICE 2000 Gen 2 -- MPLAB ICD 2, PICKIt 2, Gen 3 -- PICKit 3, MPLAB ICD 3, MPLAB Real ICE

SAM side (Atmel ARM) Gen 3 -- SAM-ICE

xedbg commented 8 months ago

Not quite right, but close. AVR generations refer primarily to the codebase architecture and not the hardware directly and uses the 'n'G notation as you see in the pack changelogs. So: 3G: JTAGICE3, Atmel-ICE, PowerDebugger, EDBG 4G: mEDBG 5G: nEDBG, AVR image in PICkit4 and Snap

mcuee commented 8 months ago

Not quite right, but close. AVR generations refer primarily to the codebase architecture and not the hardware directly and uses the 'n'G notation as you see in the pack changelogs. So: 3G: JTAGICE3, Atmel-ICE, PowerDebugger, EDBG 4G: mEDBG 5G: nEDBG, AVR image in PICkit4 and Snap

Thanks for the correction. Still your classification does not match MPLABX IDE 6.15 release notes for HW tools Generation classification.

MPLABX IDE 6.15 release notes: https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/SupportingCollateral/mplabx-ide-release-notes-v6.15.zip

Hardware Tools - Gen 4 Release Notes for MPLAB Snap Release Notes for MPLAB PICkit 4 Release Notes for MPLAB ICD 4 Release Notes for MPLAB ICE 4

Hardware Tools - Gen 5 Release Notes for MPLAB PICkit 5 Release Notes for MPLAB ICD 5

xedbg commented 8 months ago

My classification accounts for legacy Atmel debuggers. (There is no relationship between "GEN5" and "5G")

mcuee commented 8 months ago

My classification accounts for legacy Atmel debuggers. (There is no relationship between "GEN5" and "5G")

I see. Thanks for the clarification.

MX682X commented 3 months ago

I hope it's ok to revive this old issue. I had some vacation so I decided to try to brind UPDI Debugging to the Arduino IDE (because of the backbone of DxCore/megaTinyCore) I didn't manage to have the debugging Bugfree, but Programming seems to work like a charm. I hope this python file will be of use for you guys to figure out how to port it to avrdude. I'm not sure if the "scripts" are the same for all chips, I admit I only checked it with the AVR32DD28 I had on hand. However the {USER_DIR} \ .mchp_packs\Microchip \ [Debugger] \ [version] \ firmware \ scripts.xml that comes with the install of MPLAB has them all, so it should be possible to build a data extractor (I ran out of time before I could start with that) https://github.com/MX682X/PK5-UPDI-GDB-Server/blob/main/pk_debugger_iface.py The functions you'll probably need are "prepare_target_flash" - loads new Data to a buffer "finalize_download" - will erase the chip, load new program, and verify it "attach_target" & "detach_target"- establishes/stops Debugger operation