pic32-wifire: add support for flashing with pic32prog#9259
pic32-wifire: add support for flashing with pic32prog#9259benpicco merged 5 commits intoRIOT-OS:masterfrom
Conversation
boards/pic32-wifire/Makefile.include
Outdated
| # * Connect the chipKIT-Wi-Fire to USB | ||
| # * Connect the PICkit3 to ICSP holes | ||
| # * https://docs.creatordev.io/wifire/guides/wifire-programming/ | ||
| # * The Arrow `▶` pin goes into the pin number 1 (with a square shape around it) |
There was a problem hiding this comment.
Wasn't there a discussion already about unicode characters? I don't remember the outcome
There was a problem hiding this comment.
I wanted to be fancy on this one :D I can replace by |> and even say "triangle" because it is more a triangle than an arrow.
| # * Run PICkit3 | ||
| # * Tools/Download PICkit Operating System | ||
| # * Select C://Program Files/Microchip/PICkit3/PK3OSV020005.hex | ||
| # |
There was a problem hiding this comment.
Maybe add a reference to your tutorial somewhere in here instead?
There was a problem hiding this comment.
I did not put a reference here as the documentation was not merged. But I could wait for the documentation and update this.
|
@cladmi Cheers for this ! I've tested this on Wifire and PIC32-Clicker with the USB-UART click fitted. It works fine for me ( I did need a u-dev rule as well ) I've not tested spinning up a VM to program the PICkit into script mode as it already was for me (+ I have a window laptop).
This is only true for the rev1.0 hardware, later revisions came with 2 headers one for PICkit and 1 for mProg, also on the rev1 hardware there are 0 Ohm resistors on the back you can swap to permanently set the header pinout to PICkit. So I would add pic32-clicker at the same time, then its an ACK from me. Note I have been working on improving interrupt support for PIC32 when this gets submitted+merged there will be working UART RX. |
|
@neiljay Thank you for testing
So I should also put the udev rule in For pic32-clicker, we also need to put a uart to usb cable for the terminal which we did not tested yet. So it is easier to split for me, or at least, don't make this one wait for the test.
Cool :) |
|
I rebased and added the udev rule. I also checked, the documentation link correctly points to the github documentation page. |
|
This still needs a ACK. I have a configured board on my desk if needed for re-testing. |
|
@cladmi Can we add pic32-clicker as well, this worked for me. I will ACK then. |
|
@neiljay sure. Can you do a PR on my branch or even directly push here with |
|
I rebased it as it has merge conflicts. |
|
Tried in OS X with the following result: gcc -g -o pic32prog pic32prog.o target.o executive.o serial.o adapter-pickit2.o adapter-hidboot.o adapter-an1388.o adapter-bitbang.o adapter-stk500v2.o adapter-uhb.o adapter-an1388-uart.o configure.o family-mx1.o family-mx3.o family-mz.o hidapi/mac/.libs/libhidapi.a adapter-mpsse.o -framework IOKit -framework CoreFoundation /opt/local/lib/libusb-1.0.a -lobjc
clang: error: no such file or directory: '/opt/local/lib/libusb-1.0.a'
make: *** [makefile:47: pic32prog] Error 1Apparently, libusb-1.0.a is not found, which is provided on the pic32prog repo, but I guess not for OS X. The lib however exists in OS X, at least on my setup: /usr/local/Cellar/libusb/1.0.21/lib/libusb-1.0.a
/usr/local/Cellar/libusb/1.0.22/lib/libusb-1.0.a
/usr/local/lib/libusb-1.0.aBut for some reason is not found. I tried this using docker: BUILD_IN_DOCKER=1 make BOARD=pic32-wifire -C examples/default/ flash termwhich might also have something to do. |
|
I checked the original repo and I wasn't able to compile it either. However, there's a binary version that might be used instead of building the whole thing. I'll add this in a follow up PR. |
|
Rebased now that #11699 was merged. |
|
nice. I will try to get it running tomorrow! |
|
@MrKevinWeiss as you said you have a clicker, note this currently only adds the |
|
Ya I tried to hack it in to the clicker but wasn't successful (I also didn't spend that much time). |
kaspar030
left a comment
There was a problem hiding this comment.
Works fine here, apart from the pic32 compilation process trying to link a static libusb-1.0 library on arch. That's an upstream problem, though.
Minors:
- update pic32prog PKG_VERSION
- maybe change PIC32PROG binary selection logic to work like with edbg, dfu. While compiling this list I realize that we're not consistent throughout the code base, so maybe postpone or ignore.
dist/tools/pic32prog/Makefile
Outdated
| @@ -0,0 +1,19 @@ | |||
| PKG_NAME = pic32prog | |||
| PKG_URL = https://github.com/sergev/pic32prog | |||
| PKG_VERSION = f5d27d6c9506bc0d1f2053002e2aadad1ac424cd | |||
There was a problem hiding this comment.
I tried current upstream, also works. current master commit is "b9f8db3b352804392b02b42475fc42874ac8bf04"
There was a problem hiding this comment.
Indeed, the new version looks like it handles new boards and compilation issues.
makefiles/tools/pic32prog.inc.mk
Outdated
| RESET_FLAGS ?= | ||
|
|
||
| # Compile pic32prog if using the one provided in RIOT | ||
| FLASHDEPS += $(if $(findstring $(PIC32PROG),$(FLASHER)),$(PIC32PROG)) |
There was a problem hiding this comment.
Please change the FLASHDEPS logic to something like:
RIOT_PIC32PROG = $(RIOTTOOLS)/pic32prog/pic32prog
PIC32PROG ?= $(RIOT_PIC32PROG)
ifeq ($(PIC32PROG), $(RIOT_PIC32PROG))
FLASHDEPS += pic32prog
endif
As is it doesn't work when overriding with "PIC32PROG=pic32prog make ...". This is how we usually do it with other tools (edbg, ...), not by overriding FLASHER directly.
There was a problem hiding this comment.
No need for the immediate evaluation, but indeed for the RIOT_PIC32PROG.
There was a problem hiding this comment.
(damn too fast).
But as FLASHDEPS will be evaluated when declaring flash, it cannot be defined after anyway so, does not hurt.
|
@cladmi ping |
|
I updated. However, my pickit does not detect my board anymore… Even with the previous commit from I will try re-updating the flasher tomorrow… |
|
Was a pebkac, the jtag was not properly connected. It flashes correctly and as expected has no input: It correctly only compiles on first use and after uses the compiled tool. |
|
I finally got around to testing this. Unfortunately since #12227, master is broken, but reverting the commit on top of this branch makes it work again. Flashing with pic32prog works fine anways. For me, automatic pic32prog compilation still fails for missing libusb or similar, I have to override using "PIC32PROG=pic32prog". Please rebase & squash! |
666251e to
62415de
Compare
pic32prog is a program for flashing pic32 boards from command line on Linux. It works with: * Microchip PICkit2 * Microchip PICkit3 with script firmware. * Other ones: https://github.com/sergev/pic32prog/wiki
Define a RIOT_PIC32PROG to allow setting 'PIC32PROG' globally from environment. https://github.com/sergev/pic32prog For PICkit3 it requires having it with scripting mode firware. Source ------ RIOT-OS#6092 (comment)
For PICkit3 it requires having a scripting firmware installed.
Copy the udev rule from dist/tools/pic32prog/doc.md
62415de to
be4569e
Compare
|
Squashed, then rebased. If |
Contribution description
Add
flashsupport for pic32-wifire usingpic32prog.Also enable
termand a dummyresetas not supported.However, connecting to the
uartalready does a reset.It was tested with a
PICkit3whose firmware was updated to scripting mode as described here #6092 (comment)A documentation will follow in another PR on the update procedure I used
-> #9260
I am compiling pic32prog from source as it is done for the other tools even if some binaries are available in https://github.com/sergev/pic32prog. I thought it was easier and safer.
pic32-clicker
Regarding pic32-clicker, it requires a specific way for plugging the flasher (crossing cables) so it would come in a separate PR, also the uart is not available on the USB port directly, so would be another job.
Testing
Having a PICkit3 flashed with the scripting firmware, connect everything.
Despite not having a proper
resettest can run asmake termreboots the node.Interactive tests do not work as received bytes (uart led is indeed linking) are not given to the shell.
Issues/PRs references
#6092 (comment)
Depends on #9260 for the documentation to be accessible.