From 6ac84411eebaeeb460f8748a8a21840b490a3a91 Mon Sep 17 00:00:00 2001 From: Justin Mitchell Date: Tue, 1 Oct 2013 14:59:16 +0100 Subject: [PATCH] Fixes to make sure it builds for both chips --- mybootload.X/cpuselect.inc | 49 ++++++++ mybootload.X/nbproject/Makefile-12F1840.mk | 132 +++++++++++++++++++++ mybootload.X/nbproject/Makefile-genesis.properties | 2 +- mybootload.X/nbproject/Makefile-impl.mk | 2 +- mybootload.X/nbproject/Makefile-local-12F1840.mk | 36 ++++++ mybootload.X/nbproject/Package-12F1840.bash | 73 ++++++++++++ mybootload.X/nbproject/private/configurations.xml | 2 +- mybootload.X/nbproject/private/private.xml | 4 + 8 files changed, 297 insertions(+), 3 deletions(-) create mode 100644 mybootload.X/cpuselect.inc create mode 100644 mybootload.X/nbproject/Makefile-12F1840.mk create mode 100644 mybootload.X/nbproject/Makefile-local-12F1840.mk create mode 100644 mybootload.X/nbproject/Package-12F1840.bash diff --git a/mybootload.X/cpuselect.inc b/mybootload.X/cpuselect.inc new file mode 100644 index 0000000..de74cd1 --- /dev/null +++ b/mybootload.X/cpuselect.inc @@ -0,0 +1,49 @@ +#ifdef __16F1455 + +#include "p16f1455.inc" + +; CONFIG1 + __config _CONFIG1, 0xFCC +;; __CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_SWDTEN & _PWRTE_ON & _MCLRE_ON & _CP_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF +; CONFIG2 + __config _CONFIG2, 0x16CF +; __CONFIG _CONFIG2, _WRT_OFF & _CPUDIV_NOCLKDIV & _USBLSCLK_48MHz & _PLLMULT_3x & _PLLEN_DISABLED & _STVREN_ON & _BORV_LO & _LPBOR_ON & _LVP_OFF + + +#define max_flash 0x2000 +#define row_size 32 +#define SERIAL_PORT PORTC +#undefine SERIAL_ANSEL +#define SERIAL_RXPIN RC5 +#define OSC_4MHZ b'00110100' + +#endif +#ifdef __12F1840 + +#include "p12f1840.inc" +#define max_flash 0x1000 +#define row_size 32 +; CONFIG1 + __config _CONFIG1, 0xFFEC +; __CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_SWDTEN & _PWRTE_OFF & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_ON & _FCMEN_ON +; CONFIG2 + __config _CONFIG2, 0xDEFF +; __CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_ON & _BORV_LO & _LVP_OFF + +#define SERIAL_PORT PORTA +#define SERIAL_ANSEL ANSELA +#define SERIAL_RXPIN RA1 +#define OSC_4MHZ b'01101000' + + +#endif + +#ifndef PMADRL +; register names are different +#define PMADRL EEADRL +#define PMADRH EEADRH +#define PMDATH EEDATH +#define PMDATL EEDATL +#define PMCON1 EECON1 +#define PMCON2 EECON2 +#endif \ No newline at end of file diff --git a/mybootload.X/nbproject/Makefile-12F1840.mk b/mybootload.X/nbproject/Makefile-12F1840.mk new file mode 100644 index 0000000..37fc834 --- /dev/null +++ b/mybootload.X/nbproject/Makefile-12F1840.mk @@ -0,0 +1,132 @@ +# +# Generated Makefile - do not edit! +# +# Edit the Makefile in the project folder instead (../Makefile). Each target +# has a -pre and a -post target defined where you can add customized code. +# +# This makefile implements configuration specific macros and targets. + + +# Include project Makefile +ifeq "${IGNORE_LOCAL}" "TRUE" +# do not include local makefile. User is passing all local related variables already +else +include Makefile +# Include makefile containing local settings +ifeq "$(wildcard nbproject/Makefile-local-12F1840.mk)" "nbproject/Makefile-local-12F1840.mk" +include nbproject/Makefile-local-12F1840.mk +endif +endif + +# Environment +MKDIR=mkdir -p +RM=rm -f +MV=mv +CP=cp + +# Macros +CND_CONF=12F1840 +ifeq ($(TYPE_IMAGE), DEBUG_RUN) +IMAGE_TYPE=debug +OUTPUT_SUFFIX=cof +DEBUGGABLE_SUFFIX=cof +FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/mybootload.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} +else +IMAGE_TYPE=production +OUTPUT_SUFFIX=hex +DEBUGGABLE_SUFFIX=cof +FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/mybootload.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} +endif + +# Object Directory +OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} + +# Distribution Directory +DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} + +# Source Files Quoted if spaced +SOURCEFILES_QUOTED_IF_SPACED=main.asm + +# Object Files Quoted if spaced +OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/main.o +POSSIBLE_DEPFILES=${OBJECTDIR}/main.o.d + +# Object Files +OBJECTFILES=${OBJECTDIR}/main.o + +# Source Files +SOURCEFILES=main.asm + + +CFLAGS= +ASFLAGS= +LDLIBSOPTIONS= + +############# Tool locations ########################################## +# If you copy a project from one host to another, the path where the # +# compiler is installed may be different. # +# If you open this project with MPLAB X in the new host, this # +# makefile will be regenerated and the paths will be corrected. # +####################################################################### +# fixDeps replaces a bunch of sed/cat/printf statements that slow down the build +FIXDEPS=fixDeps + +.build-conf: ${BUILD_SUBPROJECTS} + ${MAKE} -f nbproject/Makefile-12F1840.mk dist/${CND_CONF}/${IMAGE_TYPE}/mybootload.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} + +MP_PROCESSOR_OPTION=12f1840 +MP_LINKER_DEBUG_OPTION= -u_DEBUGDATASTART=0x165 -u_DEBUGDATALEN=0xa +# ------------------------------------------------------------------------------------ +# Rules for buildStep: assemble +ifeq ($(TYPE_IMAGE), DEBUG_RUN) +${OBJECTDIR}/main.o: main.asm nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} ${OBJECTDIR} + @${RM} ${OBJECTDIR}/main.o.d + @${RM} ${OBJECTDIR}/main.o + @${FIXDEPS} dummy.d -e "${OBJECTDIR}/main.err" $(SILENT) -c ${MP_AS} $(MP_EXTRA_AS_PRE) -d__DEBUG -d__MPLAB_DEBUGGER_ICD3=1 -q -p$(MP_PROCESSOR_OPTION) -u -l\\\"${OBJECTDIR}/main.lst\\\" -e\\\"${OBJECTDIR}/main.err\\\" $(ASM_OPTIONS) -o\\\"${OBJECTDIR}/main.o\\\" \\\"main.asm\\\" + @${DEP_GEN} -d "${OBJECTDIR}/main.o" + @${FIXDEPS} "${OBJECTDIR}/main.o.d" $(SILENT) -rsi ${MP_AS_DIR} -c18 + +else +${OBJECTDIR}/main.o: main.asm nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} ${OBJECTDIR} + @${RM} ${OBJECTDIR}/main.o.d + @${RM} ${OBJECTDIR}/main.o + @${FIXDEPS} dummy.d -e "${OBJECTDIR}/main.err" $(SILENT) -c ${MP_AS} $(MP_EXTRA_AS_PRE) -q -p$(MP_PROCESSOR_OPTION) -u -l\\\"${OBJECTDIR}/main.lst\\\" -e\\\"${OBJECTDIR}/main.err\\\" $(ASM_OPTIONS) -o\\\"${OBJECTDIR}/main.o\\\" \\\"main.asm\\\" + @${DEP_GEN} -d "${OBJECTDIR}/main.o" + @${FIXDEPS} "${OBJECTDIR}/main.o.d" $(SILENT) -rsi ${MP_AS_DIR} -c18 + +endif + +# ------------------------------------------------------------------------------------ +# Rules for buildStep: link +ifeq ($(TYPE_IMAGE), DEBUG_RUN) +dist/${CND_CONF}/${IMAGE_TYPE}/mybootload.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} + ${MP_LD} $(MP_EXTRA_LD_PRE) -p$(MP_PROCESSOR_OPTION) -w -x -u_DEBUG -z__ICD2RAM=1 -m"${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.map" -z__MPLAB_BUILD=1 -z__MPLAB_DEBUG=1 -z__MPLAB_DEBUGGER_ICD3=1 $(MP_LINKER_DEBUG_OPTION) -odist/${CND_CONF}/${IMAGE_TYPE}/mybootload.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} +else +dist/${CND_CONF}/${IMAGE_TYPE}/mybootload.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk + @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} + ${MP_LD} $(MP_EXTRA_LD_PRE) -p$(MP_PROCESSOR_OPTION) -w -m"${DISTDIR}/${PROJECTNAME}.${IMAGE_TYPE}.map" -z__MPLAB_BUILD=1 -odist/${CND_CONF}/${IMAGE_TYPE}/mybootload.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} +endif + + +# Subprojects +.build-subprojects: + + +# Subprojects +.clean-subprojects: + +# Clean Targets +.clean-conf: ${CLEAN_SUBPROJECTS} + ${RM} -r build/12F1840 + ${RM} -r dist/12F1840 + +# Enable dependency checking +.dep.inc: .depcheck-impl + +DEPFILES=$(shell "${PATH_TO_IDE_BIN}"mplabwildcard ${POSSIBLE_DEPFILES}) +ifneq (${DEPFILES},) +include ${DEPFILES} +endif diff --git a/mybootload.X/nbproject/Makefile-genesis.properties b/mybootload.X/nbproject/Makefile-genesis.properties index 465fbda..f6aebdf 100644 --- a/mybootload.X/nbproject/Makefile-genesis.properties +++ b/mybootload.X/nbproject/Makefile-genesis.properties @@ -1,5 +1,5 @@ # -#Tue Oct 01 12:20:41 BST 2013 +#Tue Oct 01 14:57:03 BST 2013 default.languagetoolchain.version=5.52 conf.ids=default,12F1840 default.languagetoolchain.dir=/opt/microchip/mplabx/mpasmx diff --git a/mybootload.X/nbproject/Makefile-impl.mk b/mybootload.X/nbproject/Makefile-impl.mk index d0f4dd0..f81d45a 100644 --- a/mybootload.X/nbproject/Makefile-impl.mk +++ b/mybootload.X/nbproject/Makefile-impl.mk @@ -27,7 +27,7 @@ CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} PROJECTNAME=mybootload.X # Active Configuration -DEFAULTCONF=12F1840 +DEFAULTCONF=default CONF=${DEFAULTCONF} # All Configurations diff --git a/mybootload.X/nbproject/Makefile-local-12F1840.mk b/mybootload.X/nbproject/Makefile-local-12F1840.mk new file mode 100644 index 0000000..ee6b645 --- /dev/null +++ b/mybootload.X/nbproject/Makefile-local-12F1840.mk @@ -0,0 +1,36 @@ +# +# Generated Makefile - do not edit! +# +# +# This file contains information about the location of compilers and other tools. +# If you commmit this file into your revision control server, you will be able to +# to checkout the project and build it from the command line with make. However, +# if more than one person works on the same project, then this file might show +# conflicts since different users are bound to have compilers in different places. +# In that case you might choose to not commit this file and let MPLAB X recreate this file +# for each user. The disadvantage of not commiting this file is that you must run MPLAB X at +# least once so the file gets created and the project can be built. Finally, you can also +# avoid using this file at all if you are only building from the command line with make. +# You can invoke make with the values of the macros: +# $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... +# +PATH_TO_IDE_BIN=/opt/microchip/mplabx/mplab_ide/mplab_ide/modules/../../bin/ +# Adding MPLAB X bin directory to path. +PATH:=/opt/microchip/mplabx/mplab_ide/mplab_ide/modules/../../bin/:$(PATH) +# Path to java used to run MPLAB X when this makefile was created +MP_JAVA_PATH="/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64/jre/bin/" +OS_CURRENT="$(shell uname -s)" +# MP_CC is not defined +# MP_CPPC is not defined +# MP_BC is not defined +MP_AS="/opt/microchip/mplabx/mpasmx/mpasmx" +MP_LD="/opt/microchip/mplabx/mpasmx/mplink" +MP_AR="/opt/microchip/mplabx/mpasmx/mplib" +DEP_GEN=${MP_JAVA_PATH}java -jar "/opt/microchip/mplabx/mplab_ide/mplab_ide/modules/../../bin/extractobjectdependencies.jar" +# MP_CC_DIR is not defined +# MP_CPPC_DIR is not defined +# MP_BC_DIR is not defined +MP_AS_DIR="/opt/microchip/mplabx/mpasmx" +MP_LD_DIR="/opt/microchip/mplabx/mpasmx" +MP_AR_DIR="/opt/microchip/mplabx/mpasmx" +# MP_BC_DIR is not defined diff --git a/mybootload.X/nbproject/Package-12F1840.bash b/mybootload.X/nbproject/Package-12F1840.bash new file mode 100644 index 0000000..23d03f2 --- /dev/null +++ b/mybootload.X/nbproject/Package-12F1840.bash @@ -0,0 +1,73 @@ +#!/bin/bash -x + +# +# Generated - do not edit! +# + +# Macros +TOP=`pwd` +CND_CONF=12F1840 +CND_DISTDIR=dist +TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging +TMPDIRNAME=tmp-packaging +OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/mybootload.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} +OUTPUT_BASENAME=mybootload.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} +PACKAGE_TOP_DIR=mybootload.x/ + +# Functions +function checkReturnCode +{ + rc=$? + if [ $rc != 0 ] + then + exit $rc + fi +} +function makeDirectory +# $1 directory path +# $2 permission (optional) +{ + mkdir -p "$1" + checkReturnCode + if [ "$2" != "" ] + then + chmod $2 "$1" + checkReturnCode + fi +} +function copyFileToTmpDir +# $1 from-file path +# $2 to-file path +# $3 permission +{ + cp "$1" "$2" + checkReturnCode + if [ "$3" != "" ] + then + chmod $3 "$2" + checkReturnCode + fi +} + +# Setup +cd "${TOP}" +mkdir -p ${CND_DISTDIR}/${CND_CONF}/package +rm -rf ${TMPDIR} +mkdir -p ${TMPDIR} + +# Copy files and create directories and links +cd "${TOP}" +makeDirectory ${TMPDIR}/mybootload.x/bin +copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 + + +# Generate tar file +cd "${TOP}" +rm -f ${CND_DISTDIR}/${CND_CONF}/package/mybootload.x.tar +cd ${TMPDIR} +tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/mybootload.x.tar * +checkReturnCode + +# Cleanup +cd "${TOP}" +rm -rf ${TMPDIR} diff --git a/mybootload.X/nbproject/private/configurations.xml b/mybootload.X/nbproject/private/configurations.xml index 0e594aa..7e6c519 100644 --- a/mybootload.X/nbproject/private/configurations.xml +++ b/mybootload.X/nbproject/private/configurations.xml @@ -1,7 +1,7 @@ Makefile - 1 + 0 diff --git a/mybootload.X/nbproject/private/private.xml b/mybootload.X/nbproject/private/private.xml index e396670..b72939d 100644 --- a/mybootload.X/nbproject/private/private.xml +++ b/mybootload.X/nbproject/private/private.xml @@ -1,3 +1,7 @@ + + file:/home/justin/MPLABXProjects/bootloader/mybootload.X/main.asm + file:/home/justin/MPLABXProjects/bootloader/mybootload.X/cpuselect.inc + -- 1.8.3.1