Add support for the chipKIT Max32 and Uno32.

This commit is contained in:
Christopher Peplin 2012-04-02 10:50:00 -04:00
parent 82c7954211
commit 61d37eab82
5 changed files with 132 additions and 8 deletions

View file

@ -2,9 +2,35 @@
This is a very simple Makefile which knows how to build Arduino sketches. This is a very simple Makefile which knows how to build Arduino sketches.
Until March 2012, this was simply posted on my website where you can Until March 2012, this was simply posted on my website where you can still find
still find [what [what documentation][docs] exists.
documentation](http://mjo.tc/atelier/2009/02/arduino-cli.html
"Documentation") exists.
If you're using Debian or Ubuntu, you can find this in the arduino-core package. If you're using Debian or Ubuntu, you can find this in the arduino-core package.
This Makefile current requires either Arduino 1.0 or MPIDE 0023.
## chipKIT Support
In addition to regular Arduino boards, this Makefile supports the Digilent
chipKIT Uno32 and Max32, both Arduino-compatible microcontrollers. To use this
Makefile with one of those, include `chipKIT.mk` instead of `Arduino.mk` at the
bottom of your Makefile.
include /path/to/chipKIT.mk
You can adjust the same variables [as described for the Arduino][docs], but the
`ARDUINO_DIR` variable must point to an MPIDE installation (which includes the
chipKIT toolchain) instead of the Arduino IDE.
Some details on the addition of chipKIT support can be found in another
[blog post](http://christopherpeplin.com/2011/12/chipkit-arduino-makefile/).
[docs]: http://mjo.tc/atelier/2009/02/arduino-cli.html
## Contributors
* Martin Oldfield (initial version)
* Chris Peplin (chipKIT)
* rei_vilo / Olivier
* Edward Comer

View file

@ -186,11 +186,23 @@ endif
ifneq (ARDUINO_DIR,) ifneq (ARDUINO_DIR,)
ifndef AVR_TOOLS_PATH ifndef AVR_TOOLS_PATH
AVR_TOOLS_PATH = $(ARDUINO_DIR)/hardware/tools/avr/bin AVR_TOOLS_PATH = $(ARDUINO_DIR)/hardware/tools
endif endif
ifndef ARDUINO_ETC_PATH ifndef AVRDUDE_TOOLS_PATH
ARDUINO_ETC_PATH = $(ARDUINO_DIR)/hardware/tools/avr/etc ifeq ($(OSTYPE),Linux)
AVRDUDE_TOOLS_PATH = $(AVR_TOOLS_PATH)
else
AVRDUDE_TOOLS_PATH = $(AVR_TOOLS_PATH)/avr/bin
endif
endif
ifndef AVRDUDE_ETC_PATH
ifeq ($(OSTYPE),Linux)
AVRDUDE_ETC_PATH = $(AVRDUDE_TOOLS_PATH)
else
AVRDUDE_ETC_PATH = $(AVR_TOOLS_PATH)/avr/etc
endif
endif endif
ifndef AVRDUDE_CONF ifndef AVRDUDE_CONF
@ -476,7 +488,7 @@ $(OBJDIR)/%.sym: $(OBJDIR)/%.elf
# Avrdude # Avrdude
# #
ifndef AVRDUDE ifndef AVRDUDE
AVRDUDE = $(AVR_TOOLS_PATH)/avrdude AVRDUDE = $(AVRDUDE_TOOLS_PATH)/avrdude
endif endif
AVRDUDE_COM_OPTS = -q -V -p $(MCU) AVRDUDE_COM_OPTS = -q -V -p $(MCU)

60
arduino-mk/chipKIT.mk Normal file
View file

@ -0,0 +1,60 @@
#
# chipKIT extensions for Arduino Makefile
# System part (i.e. project independent)
#
# Copyright (C) 2011 Christopher Peplin <chris.peplin@rhubarbtech.com>,
# based on work that is Copyright Martin Oldfield
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
#
OSTYPE := $(shell uname)
AVR_TOOLS_PATH = $(ARDUINO_DIR)/hardware/pic32/compiler/pic32-tools/bin
ifneq ($(OSTYPE),Linux)
AVRDUDE_TOOLS_PATH = $(ARDUINO_DIR)/hardware/tools/avr/bin
else
AVRDUDE_TOOLS_PATH = $(ARDUINO_DIR)/hardware/tools
endif
ifneq ($(OSTYPE),Linux)
AVRDUDE_ETC_PATH = $(ARDUINO_DIR)/hardware/tools/avr/etc
else
AVRDUDE_ETC_PATH = $(AVRDUDE_TOOLS_PATH)
endif
ifndef BOARD
BOARD = $(shell $(PARSE_BOARD) $(BOARD_TAG) board)
endif
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/pic32/cores/pic32
ARDUINO_LIB_PATH = $(ARDUINO_DIR)/hardware/pic32/libraries
BOARDS_TXT = $(ARDUINO_DIR)/hardware/pic32/boards.txt
ARDUINO_VAR_PATH = $(ARDUINO_DIR)/hardware/pic32/variants
ARDUINO_VERSION = 23
CC_NAME = pic32-gcc
CXX_NAME = pic32-g++
AR_NAME = pic32-ar
OBJDUMP_NAME = pic32-objdump
OBJCOPY_NAME = pic32-objcopy
LDSCRIPT = $(shell $(PARSE_BOARD) $(BOARD_TAG) ldscript)
LDSCRIPT_FILE = $(ARDUINO_CORE_PATH)/$(LDSCRIPT)
MCU_FLAG_NAME=mprocessor
EXTRA_LDFLAGS = -T$(ARDUINO_CORE_PATH)/$(LDSCRIPT)
EXTRA_CXXFLAGS = -mno-smart-io -D$(BOARD)
CHIPKIT_MK_PATH := $(dir $(lastword $(MAKEFILE_LIST)))
include $(CHIPKIT_MK_PATH)/Arduino.mk
# MPIDE still comes with the compilers on Linux, unlike Arduino
CC = $(AVR_TOOLS_PATH)/$(CC_NAME)
CXX = $(AVR_TOOLS_PATH)/$(CXX_NAME)
OBJCOPY = $(AVR_TOOLS_PATH)/$(OBJCOPY_NAME)

View file

@ -0,0 +1,19 @@
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second
}

View file

@ -0,0 +1,7 @@
BOARD_TAG = uno_pic32
ARDUINO_PORT = /dev/cu.usb*
ARDUINO_LIBS =
include ../../arduino-mk/chipKIT.mk