Skip to content
Browse files

Merge branch 'rpi'

Former-commit-id: e98921d
  • Loading branch information...
2 parents 948f9cf + ca60b06 commit 6055f5bb2af108a99564df59fcf568ff16e2a3c5 @majenkotech majenkotech committed Jun 25, 2013
View
6 app/src/processing/app/Base.java
@@ -196,6 +196,7 @@ static protected boolean isCommandLine() {
static protected void initPlatform() {
+ logger.debug("Platform and arch: " + osName());
try {
Class<?> platformClass = Class.forName("processing.app.Platform");
if (Base.isMacOS()) {
@@ -1469,6 +1470,11 @@ static public int getPlatformIndex(String what) {
// of conflicts that could happen with older versions of core.jar, where
// the MACOSX constant would instead read as the LINUX constant.
+ static public String osName() {
+ String sysname = getPlatformName();
+ String arch = System.getProperty("os.arch");;
+ return sysname + "_" + arch;
+ }
/**
* returns true if Processing is running on a Mac OS X machine.
View
25 app/src/processing/app/debug/AvrdudeUploader.java
@@ -92,18 +92,21 @@ public boolean uploadUsingPreferences(String buildPath, String className, boolea
List parts = new ArrayList();
String command = null;
- if (Base.isLinux()) {
- command = bootloader.get("command_linux");
- }
- if (Base.isWindows()) {
- command = bootloader.get("command_windows");
+
+
+ // Let's find the right command to use - starting from the most specific
+ // (os and arch), then just the os, and finally the generic command.
+
+ command = bootloader.get("command_" + Base.osName());
+ if (command == null) {
+ command = bootloader.get("command_" + Base.getPlatformName());
}
- if (Base.isMacOS()) {
- command = bootloader.get("command_macosx");
+ if (command == null) {
+ command = bootloader.get("command");
}
- // If not got an OS specific entry, fall back to the generic one.
if (command == null) {
- command = bootloader.get("command");
+ logger.debug("ERROR: No command found for bootloader!");
+ return false;
}
logger.debug("================ UPLOAD =================");
@@ -120,7 +123,9 @@ public boolean uploadUsingPreferences(String buildPath, String className, boolea
String executable = spl.get(0);
executable = executable.replace("\"", "");
if (Base.isWindows()) {
- executable = executable + ".exe";
+ if (executable.indexOf(".exe") == -1) {
+ executable = executable + ".exe";
+ }
}
String variant = boardPreferences.get("build.variant");
View
151 build/build.xml
@@ -24,6 +24,9 @@
<condition property="platform" value="linux64">
<os family="unix" arch="amd64" />
</condition>
+<condition property="platform" value="raspberrypi">
+ <os family="unix" arch="arm" />
+</condition>
<!-- set time propert -->
<tstamp>
@@ -368,6 +371,10 @@
<delete dir="linux/work" />
</target>
+ <target name="raspberrypi-clean" depends="subprojects-clean" description="Clean raspberry pi linux version">
+ <delete dir="raspberrypi/work" />
+ </target>
+
<target name="linux-checkos" unless="linux">
<echo>
=======================================================
@@ -415,6 +422,51 @@
</target>
+ <target name="raspberrypi-build" depends="revision-check, linux-checkos, subprojects-build" description="Build linux ARM version">
+ <mkdir dir="raspberrypi/work" />
+
+ <copy todir="raspberrypi/work">
+ <fileset dir="shared" includes="lib/**" />
+ <fileset file="shared/revisions.txt" />
+ </copy>
+
+ <copy todir="raspberrypi/work">
+ <fileset dir="raspberrypi/dist" includes="lib/**" />
+ </copy>
+
+ <copy todir="raspberrypi/work/lib" flatten="true">
+ <fileset refid="runtime.jars" />
+ </copy>
+
+ <antcall target="assemble">
+ <param name="target.path" value="raspberrypi/work" />
+ </antcall>
+
+ <get src="http://chipkit.s3.amazonaws.com/compilers/pic32-tools-chipKIT-cxx-master-arm-linux-image.zip"
+ dest="raspberrypi/dist"
+ verbose="false"
+ usetimestamp="true"/>
+
+ <get src="http://chipkit.s3.amazonaws.com/raspberrypi/tools.tar"
+ dest="raspberrypi/dist"
+ verbose="false"
+ usetimestamp="true"/>
+
+ <untar dest="raspberrypi/work/hardware/tools/" src="raspberrypi/dist/tools.tar" overwrite="false" />
+ <chmod perm="755" file="raspberrypi/work/hardware/tools/avrdude" />
+
+ <!-- For now we'll just leach the generic linux startup script. If we want
+ to tweak a specific Pi version we can change this to one stored in the
+ raspberrypi/dist folder instead. -->
+ <copy todir="raspberrypi/work" file="linux/dist/mpide" />
+ <chmod perm="755" file="raspberrypi/work/mpide" />
+ <unzip dest="raspberrypi/work/hardware/pic32" src="raspberrypi/dist/pic32-tools-chipKIT-cxx-master-arm-linux-image.zip" overwrite="false"/>
+ <chmod perm="+x">
+ <fileset dir="raspberrypi/work/hardware/pic32/compiler" includes="**/*" />
+ </chmod>
+
+ </target>
+
<target name="linux32-build" depends="linux-build" description="Build linux (32-bit) version">
<!-- Unzip AVR tools -->
<exec executable="tar" dir="linux/work/hardware">
@@ -451,6 +503,42 @@
<exec executable="./linux/work/mpide" spawn="false"/>
</target>
+ <target name="raspberrypi-dist" depends="raspberrypi-build"
+ description="Build .tar.gz of raspberry pi linux version">
+
+ <input message="Enter version number:"
+ addproperty="version"
+ defaultvalue="${revision}" />
+
+ <property name="extension" value="tgz"/>
+ <propertyfile file="upload.properties">
+ <entry key="extension" value="${extension}"/>
+ </propertyfile>
+
+ <tar compression="gzip" longfile="gnu" destfile="raspberrypi/mpide-${version}.tgz">
+ <tarfileset dir="raspberrypi/work"
+ prefix="mpide-${version}"
+ excludes="mpide,
+ hardware/tools/avrdude,
+ java/**,
+ hardware/pic32/compiler/pic32-tools/**"
+ />
+ <tarfileset dir="raspberrypi/work/hardware/pic32/compiler/pic32-tools/" dirmode="755" prefix="mpide-${version}/hardware/pic32/compiler/pic32-tools" />
+ <tarfileset file="raspberrypi/work/hardware/pic32/compiler/pic32-tools/**" filemode="755" prefix="mpide-${version}/hardware/pic32/compiler/pic32-tools" />
+
+ <tarfileset file="raspberrypi/work/mpide" filemode="755" prefix="mpide-${version}" />
+ <tarfileset file="raspberrypi/work/hardware/tools/avrdude" filemode="755" prefix="mpide-${version}/hardware/tools" />
+ </tar>
+
+ <echo>
+ =======================================================
+ mpide for Raspberry Pi was built. Grab the archive from
+
+ build/raspberrypi/mpide-${version}.tgz
+ =======================================================
+ </echo>
+ </target>
+
<target name="linux-dist" depends="build"
description="Build .tar.gz of linux version">
<property name="extension" value="tgz"/>
@@ -494,6 +582,67 @@
</echo>
</target>
+ <target name="get-version">
+ <input message="Enter version number:"
+ addproperty="version"
+ defaultvalue="${revision}-${platform}" />
+ </target>
+
+ <target name="raspberrypi-deb" depends="revision-check, get-version, raspberrypi-build"
+ description="Build .deb of raspberrypi version">
+
+ <property name="extension" value="deb"/>
+
+ <propertyfile file="upload.properties">
+ <entry key="extension" value="${extension}"/>
+ </propertyfile>
+
+ <mkdir dir="raspberrypi/mpide-${version}" />
+ <!-- These are currently generic linux files - .desktop, PNG icons, etc.
+ Nothing Pi specific here, so there's no point in duplicating them
+ in the Pi dist tree. -->
+ <copy todir="raspberrypi/mpide-${version}/usr">
+ <fileset dir="linux/dist/usr" />
+ </copy>
+
+ <copy todir="raspberrypi/mpide-${version}/usr/share/mpide">
+ <fileset dir="raspberrypi/work" />
+ </copy>
+ <chmod perm="755">
+ <fileset dir="raspberrypi/mpide-${version}/usr/share/mpide" includes="mpide" />
+ <fileset dir="raspberrypi/mpide-${version}/usr/share/mpide/tools" includes="**/*" />
+ <fileset dir="raspberrypi/mpide-${version}/usr/share/mpide/hardware/tools" includes="**/*" />
+ <fileset dir="raspberrypi/mpide-${version}/usr/share/mpide/hardware/pic32/compiler" includes="**/*" />
+ <!--fileset dir="raspberrypi/mpide-${version}/usr/share/mpide/hardware/pic32/tools" includes="**/*" /-->
+ </chmod>
+ <symlink link="raspberrypi/mpide-${version}/usr/bin/mpide" resource="/usr/share/mpide/mpide" overwrite="true" />
+
+ <mkdir dir="raspberrypi/mpide-${version}/DEBIAN" />
+ <echo file="raspberrypi/mpide-${version}/DEBIAN/control">
+Package: mpide
+Version: ${version}
+Maintainer: matt@majenko.co.uk
+Architecture: armhf
+Section: Programming
+Depends: avr-libc, avrdude, binutils-avr, extra-xdg-menus, gcc-avr, libftdi1, libjna-java, librxtx-java
+Description: chipKIT MPIDE Development environment
+
+</echo>
+ <exec executable="dpkg-deb" dir="raspberrypi">
+ <arg value="-b"/>
+ <arg value="mpide-${version}"/>
+ </exec>
+ <delete dir="raspberrypi/mpide-${version}" />
+
+ <echo>
+ =======================================================
+ mpide for Raspberry Pi was built. Grab the package from
+
+ build/raspberrypi/mpide-${version}.deb
+ =======================================================
+ </echo>
+</target>
+
<target name="linux-deb" depends="build"
description="Build .deb of linux version">
<property name="extension" value="deb"/>
@@ -722,7 +871,7 @@ Description: chipKIT MPIDE Development environment
<!-- - - - - - - - -->
<target name="clean" description="Perform a spring cleaning"
- depends="linux-clean, windows-clean, macosx-clean, subprojects-clean">
+ depends="linux-clean, windows-clean, macosx-clean, raspberrypi-clean, subprojects-clean">
</target>
View
0 build/raspberrypi/dist/lib/.gitplaceholder
No changes.

0 comments on commit 6055f5b

Please sign in to comment.
Something went wrong with that request. Please try again.