Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion boards/pic32-wifire/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,17 @@ export CPU_MODEL=p32mz2048efg100
export APPDEPS += $(RIOTCPU)/$(CPU)/$(CPU_MODEL)/$(CPU_MODEL).S
export USE_UHI_SYSCALLS = 1

FLASHFILE ?= $(HEXFILE)
PORT_LINUX ?= /dev/ttyUSB0
BAUD ?= 9600
include $(RIOTMAKE)/tools/serial.inc.mk

# pic32prog
#
# For PICkit3:
#
# * Connect the chipKIT-Wi-Fire to USB
# * Connect the PICkit3 to ICSP holes
# * https://docs.creatordev.io/wifire/guides/wifire-programming/
# * The triangle `▶` goes into the port number 1 (a hole with a square around it)
# opposite side of the JP1 ICSP text.
include $(RIOTMAKE)/tools/pic32prog.inc.mk
2 changes: 2 additions & 0 deletions dist/tools/pic32prog/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pic32prog
bin/
19 changes: 19 additions & 0 deletions dist/tools/pic32prog/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
PKG_NAME = pic32prog
PKG_URL = https://github.com/sergev/pic32prog
PKG_VERSION = b9f8db3b352804392b02b42475fc42874ac8bf04
PKG_LICENSE = GPL-2
PKG_BUILDDIR = bin

# Building it requires some dependencies, on ubuntu:
#
# sudo apt-get install libusb-dev libusb-1.0-0-dev libudev-dev

all: git-download
@echo "[INFO] compiling pic32prog from source now"
@env -i PATH=$(PATH) TERM=$(TERM) make -C $(PKG_BUILDDIR)
@mv $(PKG_BUILDDIR)/pic32prog pic32prog

distclean::
@rm -f pic32prog

include $(RIOTBASE)/pkg/pkg.mk
46 changes: 46 additions & 0 deletions makefiles/tools/pic32prog.inc.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# pic32prog flasher
# =================
#
# https://github.com/sergev/pic32prog
#
# Allow flashing pic32 boards using:
# * Microchip PICkit2
# * Microchip PICkit3 with script firmware
#
#
# PICkit-3
# --------
#
# This requires changing the firmware to 'scripting mode'
# Should be done from a Windows computer/virtual machine as described here
#

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a reference to your tutorial somewhere in here instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not put a reference here as the documentation was not merged. But I could wait for the documentation and update this.

# https://github.com/RIOT-OS/RIOT/blob/master/dist/tools/pic32prog/doc.md
#
#
# Udev rule
# ---------
#
# Add yourself to the `plugdev` group, add the following `udev` rule to
# `/etc/udev/rules.d/26-microchip.rules` and reboot.
#
# ```
# # Adapted from http://en.microstickplus.com/mplabx-on-linux
# ATTR{idVendor}=="04d8", MODE="664", GROUP="plugdev"
# ```

RIOT_PIC32PROG = $(RIOTTOOLS)/pic32prog/pic32prog
PIC32PROG ?= $(RIOT_PIC32PROG)

FLASHFILE ?= $(HEXFILE)

FLASHER ?= $(PIC32PROG)
FFLAGS ?= $(FLASHFILE)

# No reset command, but the board resets on terminal open
RESET ?=
RESET_FLAGS ?=

# Compile pic32prog if using the one provided in RIOT
ifeq ($(PIC32PROG),$(RIOT_PIC32PROG))
FLASHDEPS += $(RIOT_PIC32PROG)
endif
5 changes: 5 additions & 0 deletions makefiles/tools/targets.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ $(RIOTTOOLS)/bossa/bossac:
@make -C $(RIOTTOOLS)/bossa
@echo "[INFO] bossac binary successfully build!"

$(RIOTTOOLS)/pic32prog/pic32prog: $(RIOTTOOLS)/pic32prog/Makefile
@echo "[INFO] $(@F) binary not found - building it from source now"
make -C $(@D)
@echo "[INFO] $(@F) binary successfully build!"

$(RIOTTOOLS)/edbg/edbg: $(RIOTTOOLS)/edbg/Makefile
@echo "[INFO] edbg binary not found - building it from source now"
CC= CFLAGS= make -C $(RIOTTOOLS)/edbg
Expand Down