From 9daa8441e39c3b20417f05ddde525c5d82fd5b4f Mon Sep 17 00:00:00 2001 From: Ouss4 Date: Sat, 7 Mar 2020 13:45:09 +0000 Subject: [PATCH] tools/pic32: Add the Config.mk file to execute the post build script. Update Make.defs and README.txt files in boards directory accordingly. --- boards/mips/pic32mx/mirtoo/README.txt | 2 + boards/mips/pic32mx/mirtoo/scripts/Make.defs | 1 + .../pic32mx/pic32mx-starterkit/README.txt | 2 + .../pic32mx-starterkit/scripts/Make.defs | 1 + boards/mips/pic32mx/pic32mx7mmb/README.txt | 2 + .../pic32mx/pic32mx7mmb/scripts/Make.defs | 1 + boards/mips/pic32mx/sure-pic32mx/README.txt | 14 ++++--- .../pic32mx/sure-pic32mx/scripts/Make.defs | 1 + boards/mips/pic32mx/ubw32/README.txt | 4 +- boards/mips/pic32mx/ubw32/scripts/Make.defs | 1 + .../pic32mz/flipnclick-pic32mz/README.txt | 4 +- .../flipnclick-pic32mz/scripts/Make.defs | 1 + .../pic32mz/pic32mz-starterkit/README.txt | 4 +- .../pic32mz-starterkit/scripts/Make.defs | 1 + tools/pic32/Config.mk | 40 +++++++++++++++++++ 15 files changed, 70 insertions(+), 9 deletions(-) create mode 100644 tools/pic32/Config.mk diff --git a/boards/mips/pic32mx/mirtoo/README.txt b/boards/mips/pic32mx/mirtoo/README.txt index 7ff0bc7c3d5..0ad7482c1aa 100644 --- a/boards/mips/pic32mx/mirtoo/README.txt +++ b/boards/mips/pic32mx/mirtoo/README.txt @@ -493,6 +493,8 @@ Loading NuttX with ICD3 # to the top-level build directory. It is the only # required input to mkpichex. + This procedure is automatically performed at the end of a build. + LED Usage ========= diff --git a/boards/mips/pic32mx/mirtoo/scripts/Make.defs b/boards/mips/pic32mx/mirtoo/scripts/Make.defs index ed7dc3ea666..020c8635755 100644 --- a/boards/mips/pic32mx/mirtoo/scripts/Make.defs +++ b/boards/mips/pic32mx/mirtoo/scripts/Make.defs @@ -35,6 +35,7 @@ include ${TOPDIR}/.config include ${TOPDIR}/tools/Config.mk +include ${TOPDIR}/tools/pic32/Config.mk include ${TOPDIR}/arch/mips/src/mips32/Toolchain.defs ifeq ($(WINTOOL),y) diff --git a/boards/mips/pic32mx/pic32mx-starterkit/README.txt b/boards/mips/pic32mx/pic32mx-starterkit/README.txt index ba292f291e2..dca63b524a5 100644 --- a/boards/mips/pic32mx/pic32mx-starterkit/README.txt +++ b/boards/mips/pic32mx/pic32mx-starterkit/README.txt @@ -570,6 +570,8 @@ Creating Compatible NuttX HEX files # to the top-level build directory. It is the only # required input to mkpichex. + This procedure is automatically performed at the end of a build. + Serial Console: MEB =================== diff --git a/boards/mips/pic32mx/pic32mx-starterkit/scripts/Make.defs b/boards/mips/pic32mx/pic32mx-starterkit/scripts/Make.defs index 880bc92ac47..19dee730904 100644 --- a/boards/mips/pic32mx/pic32mx-starterkit/scripts/Make.defs +++ b/boards/mips/pic32mx/pic32mx-starterkit/scripts/Make.defs @@ -35,6 +35,7 @@ include ${TOPDIR}/.config include ${TOPDIR}/tools/Config.mk +include ${TOPDIR}/tools/pic32/Config.mk include ${TOPDIR}/arch/mips/src/mips32/Toolchain.defs ifeq ($(CONFIG_MIPS32_TOOLCHAIN_GNU_ELF),y) diff --git a/boards/mips/pic32mx/pic32mx7mmb/README.txt b/boards/mips/pic32mx/pic32mx7mmb/README.txt index 84be58c27dc..76f325c1c41 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/README.txt +++ b/boards/mips/pic32mx/pic32mx7mmb/README.txt @@ -309,6 +309,8 @@ Creating Compatible NuttX HEX files # to the top-level build directory. It is the only # required input to mkpichex. + This procedure is automatically performed at the end of a build. + Serial Console ============== diff --git a/boards/mips/pic32mx/pic32mx7mmb/scripts/Make.defs b/boards/mips/pic32mx/pic32mx7mmb/scripts/Make.defs index 34a5881eac1..22428063202 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/scripts/Make.defs +++ b/boards/mips/pic32mx/pic32mx7mmb/scripts/Make.defs @@ -35,6 +35,7 @@ include ${TOPDIR}/.config include ${TOPDIR}/tools/Config.mk +include ${TOPDIR}/tools/pic32/Config.mk include ${TOPDIR}/arch/mips/src/mips32/Toolchain.defs ifeq ($(CONFIG_MIPS32_TOOLCHAIN_GNU_ELF),y) diff --git a/boards/mips/pic32mx/sure-pic32mx/README.txt b/boards/mips/pic32mx/sure-pic32mx/README.txt index e0a8fbacdfe..93b86b166d6 100644 --- a/boards/mips/pic32mx/sure-pic32mx/README.txt +++ b/boards/mips/pic32mx/sure-pic32mx/README.txt @@ -384,12 +384,14 @@ Loading NuttX with PICkit2 To use this file, you need to do the following things: - # Add the NuttX tools/pic32 directory to your - # PATH variable - make # Build nuttx and nuttx.hex - mkpichex $PWD # Convert addresses in nuttx.hex. $PWD is the path - # to the top-level build directory. It is the only - # required input to mkpichex. + export PATH = ??? # Add the NuttX tools/pic32 directory to your + # PATH variable + make # Build nuttx and nuttx.hex + mkpichex $PWD # Convert addresses in nuttx.hex. $PWD is the path + # to the top-level build directory. It is the only + # required input to mkpichex. + + This procedure is automatically performed at the end of a build. LCD1602 ======= diff --git a/boards/mips/pic32mx/sure-pic32mx/scripts/Make.defs b/boards/mips/pic32mx/sure-pic32mx/scripts/Make.defs index 1a2f8d17dcc..0edd988b57b 100644 --- a/boards/mips/pic32mx/sure-pic32mx/scripts/Make.defs +++ b/boards/mips/pic32mx/sure-pic32mx/scripts/Make.defs @@ -35,6 +35,7 @@ include ${TOPDIR}/.config include ${TOPDIR}/tools/Config.mk +include ${TOPDIR}/tools/pic32/Config.mk include ${TOPDIR}/arch/mips/src/mips32/Toolchain.defs ifeq ($(CONFIG_MIPS32_TOOLCHAIN_GNU_ELF),y) diff --git a/boards/mips/pic32mx/ubw32/README.txt b/boards/mips/pic32mx/ubw32/README.txt index 8db11658df4..cbcceda52a2 100644 --- a/boards/mips/pic32mx/ubw32/README.txt +++ b/boards/mips/pic32mx/ubw32/README.txt @@ -323,13 +323,15 @@ Loading NuttX with PICkit2 To use this file, you need to do the following things: - # Add the NuttX tools/pic32 directory to your + export PATH =??? # Add the NuttX tools/pic32 directory to your # PATH variable make # Build nuttx and nuttx.hex mkpichex $PWD # Convert addresses in nuttx.hex. $PWD is the path # to the top-level build directory. It is the only # required input to mkpichex. + This procedure is automatically performed at the end of a build. + LEDs ==== diff --git a/boards/mips/pic32mx/ubw32/scripts/Make.defs b/boards/mips/pic32mx/ubw32/scripts/Make.defs index 217c89cd80b..1d68191f3b5 100644 --- a/boards/mips/pic32mx/ubw32/scripts/Make.defs +++ b/boards/mips/pic32mx/ubw32/scripts/Make.defs @@ -35,6 +35,7 @@ include ${TOPDIR}/.config include ${TOPDIR}/tools/Config.mk +include ${TOPDIR}/tools/pic32/Config.mk include ${TOPDIR}/arch/mips/src/mips32/Toolchain.defs ifeq ($(CONFIG_MIPS32_TOOLCHAIN_GNU_ELF),y) diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/README.txt b/boards/mips/pic32mz/flipnclick-pic32mz/README.txt index 09a891b2609..1739fe350ed 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/README.txt +++ b/boards/mips/pic32mz/flipnclick-pic32mz/README.txt @@ -167,7 +167,7 @@ Creating Compatible NuttX HEX files make -f Makefile.host Now you will have an executable - file call mkpichex (or mkpichex.exe on + file called mkpichex (or mkpichex.exe on Cygwin). This program will take the nutt.hex file as an input, it will convert all of the KSEG0 and KSEG1 addresses to physical address, and it will write the modified file, replacing the original nuttx.hex. @@ -181,6 +181,8 @@ Creating Compatible NuttX HEX files # to the top-level build directory. It is the only # required input to mkpichex. + This procedure is automatically performed at the end of a build. + Tool Issues =========== diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/scripts/Make.defs b/boards/mips/pic32mz/flipnclick-pic32mz/scripts/Make.defs index dbbcf1732bb..173cc8ad439 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/scripts/Make.defs +++ b/boards/mips/pic32mz/flipnclick-pic32mz/scripts/Make.defs @@ -35,6 +35,7 @@ include ${TOPDIR}/.config include ${TOPDIR}/tools/Config.mk +include ${TOPDIR}/tools/pic32/Config.mk include ${TOPDIR}/arch/mips/src/mips32/Toolchain.defs ifeq ($(CONFIG_MIPS32_TOOLCHAIN_GNU_ELF),y) diff --git a/boards/mips/pic32mz/pic32mz-starterkit/README.txt b/boards/mips/pic32mz/pic32mz-starterkit/README.txt index c262b85534f..e6ec908bca4 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/README.txt +++ b/boards/mips/pic32mz/pic32mz-starterkit/README.txt @@ -114,7 +114,7 @@ Creating Compatible NuttX HEX files cd tools/pic32 make -f Makefile.host - Now you will have an executable file call mkpichex (or mkpichex.exe on + Now you will have an executable file called mkpichex (or mkpichex.exe on Cygwin). This program will take the nutt.hex file as an input, it will convert all of the KSEG0 and KSEG1 addresses to physical address, and it will write the modified file, replacing the original nuttx.hex. @@ -128,6 +128,8 @@ Creating Compatible NuttX HEX files # to the top-level build directory. It is the only # required input to mkpichex. + This procedure is automatically performed at the end of a build. + Tool Issues =========== diff --git a/boards/mips/pic32mz/pic32mz-starterkit/scripts/Make.defs b/boards/mips/pic32mz/pic32mz-starterkit/scripts/Make.defs index 50c3ceb316c..6ebdc1d841f 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/scripts/Make.defs +++ b/boards/mips/pic32mz/pic32mz-starterkit/scripts/Make.defs @@ -35,6 +35,7 @@ include ${TOPDIR}/.config include ${TOPDIR}/tools/Config.mk +include ${TOPDIR}/tools/pic32/Config.mk include ${TOPDIR}/arch/mips/src/mips32/Toolchain.defs ifeq ($(CONFIG_MIPS32_TOOLCHAIN_GNU_ELF),y) diff --git a/tools/pic32/Config.mk b/tools/pic32/Config.mk new file mode 100644 index 00000000000..2f1786c333f --- /dev/null +++ b/tools/pic32/Config.mk @@ -0,0 +1,40 @@ +############################################################################ +# tools/pic32/Config.mk +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +# These are the macros that will be used in the NuttX make system to compile +# and assembly source files and to insert the resulting object files into an +# archive. These replace the default definitions at tools/Config.mk + +# POSTBUILD -- Perform post build operations + +define POSTBUILD + $(Q)echo "Converting the hex file"; + + $(Q) if [ ! -f "tools/pic32/mkpichex" ] ; then \ + echo "mkpichex tool doesn't exist"; \ + echo "Please run the following command to build the tool"; \ + echo "make -C tools$(DELIM)pic32 -f Makefile.host"; \ + echo "then run make again."; \ + else \ + tools$(DELIM)pic32$(DELIM)mkpichex$(HOSTEXEEXT) $(PWD); \ + ([ $$? -eq 0 ] && echo "Done."); \ + fi + +endef