From 0d8807364406bd92d55a2f0419a78da26370bf51 Mon Sep 17 00:00:00 2001 From: Ouss4 Date: Fri, 6 Mar 2020 22:39:44 +0000 Subject: [PATCH] toos/pic32: Some cosmetic changes. - Rename the folder to PIC32. - Rename the Makefile to Makefile.host - Run nxstyle on the C file. - Change licenses to ALv2. --- boards/mips/pic32mx/mirtoo/README.txt | 10 ++-- .../pic32mx/pic32mx-starterkit/README.txt | 10 ++-- boards/mips/pic32mx/pic32mx7mmb/README.txt | 10 ++-- boards/mips/pic32mx/sure-pic32mx/README.txt | 10 ++-- boards/mips/pic32mx/ubw32/README.txt | 10 ++-- .../pic32mz/flipnclick-pic32mz/README.txt | 8 +-- .../pic32mz/pic32mz-starterkit/README.txt | 10 ++-- tools/{pic32mx => pic32}/.gitignore | 0 tools/pic32/Makefile.host | 36 +++++++++++++ tools/{pic32mx => pic32}/mkpichex.c | 51 +++++++------------ tools/pic32mx/Makefile | 51 ------------------- 11 files changed, 89 insertions(+), 117 deletions(-) rename tools/{pic32mx => pic32}/.gitignore (100%) create mode 100644 tools/pic32/Makefile.host rename tools/{pic32mx => pic32}/mkpichex.c (82%) delete mode 100644 tools/pic32mx/Makefile diff --git a/boards/mips/pic32mx/mirtoo/README.txt b/boards/mips/pic32mx/mirtoo/README.txt index ef364a5390..7ff0bc7c3d 100644 --- a/boards/mips/pic32mx/mirtoo/README.txt +++ b/boards/mips/pic32mx/mirtoo/README.txt @@ -469,15 +469,15 @@ Loading NuttX with ICD3 file to contain physical addresses. But the nuttx.hex file generated from the top-level make will have address in the KSEG0 and KSEG1 regions. - tools/pic32mx/mkpichex: + tools/pic32/mkpichex: ---------------------- - There is a simple tool in the NuttX tools/pic32mx directory that can be + There is a simple tool in the NuttX tools/pic32 directory that can be used to solve both issues with the nuttx.hex file. But, first, you must build the tool: - cd tools/pic32mx - make + cd tools/pic32 + make -f Makefile.host Now you will have an executable file call mkpichex (or mkpichex.exe on Cygwin). This program will take the nutt.hex file as an input, it will @@ -486,7 +486,7 @@ Loading NuttX with ICD3 To use this file, you need to do the following things: - export PATH=??? # Add the NuttX tools/pic32mx 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 diff --git a/boards/mips/pic32mx/pic32mx-starterkit/README.txt b/boards/mips/pic32mx/pic32mx-starterkit/README.txt index 5a223b7ded..ba292f291e 100644 --- a/boards/mips/pic32mx/pic32mx-starterkit/README.txt +++ b/boards/mips/pic32mx/pic32mx-starterkit/README.txt @@ -546,15 +546,15 @@ Creating Compatible NuttX HEX files file to contain physical addresses. But the nuttx.hex file generated from the top-level make will have address in the KSEG0 and KSEG1 regions. - tools/pic32mx/mkpichex: + tools/pic32/mkpichex: ---------------------- - There is a simple tool in the NuttX tools/pic32mx directory that can be + There is a simple tool in the NuttX tools/pic32 directory that can be used to solve both issues with the nuttx.hex file. But, first, you must build the tool: - cd tools/pic32mx - make + cd tools/pic32 + make -f Makefile.host Now you will have an executable file call mkpichex (or mkpichex.exe on Cygwin). This program will take the nutt.hex file as an input, it will @@ -563,7 +563,7 @@ Creating Compatible NuttX HEX files To use this file, you need to do the following things: - export PATH=??? # Add the NuttX tools/pic32mx 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 diff --git a/boards/mips/pic32mx/pic32mx7mmb/README.txt b/boards/mips/pic32mx/pic32mx7mmb/README.txt index faec7363b8..84be58c27d 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/README.txt +++ b/boards/mips/pic32mx/pic32mx7mmb/README.txt @@ -285,15 +285,15 @@ Creating Compatible NuttX HEX files file to contain physical addresses. But the nuttx.hex file generated from the top-level make will have address in the KSEG0 and KSEG1 regions. - tools/pic32mx/mkpichex: + tools/pic32/mkpichex: ---------------------- - There is a simple tool in the NuttX tools/pic32mx directory that can be + There is a simple tool in the NuttX tools/pic32 directory that can be used to solve both issues with the nuttx.hex file. But, first, you must build the tool: - cd tools/pic32mx - make + cd tools/pic32 + make -f Makefile.host Now you will have an executable file call mkpichex (or mkpichex.exe on Cygwin). This program will take the nutt.hex file as an input, it will @@ -302,7 +302,7 @@ Creating Compatible NuttX HEX files To use this file, you need to do the following things: - export PATH=??? # Add the NuttX tools/pic32mx 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 diff --git a/boards/mips/pic32mx/sure-pic32mx/README.txt b/boards/mips/pic32mx/sure-pic32mx/README.txt index fe5c9c810a..e0a8fbacdf 100644 --- a/boards/mips/pic32mx/sure-pic32mx/README.txt +++ b/boards/mips/pic32mx/sure-pic32mx/README.txt @@ -367,15 +367,15 @@ Loading NuttX with PICkit2 file to contain physical addresses. But the nuttx.hex file generated from the top-level make will have address in the KSEG0 and KSEG1 regions. - tools/pic32mx/mkpichex: + tools/pic32/mkpichex: ---------------------- - There is a simple tool in the NuttX tools/pic32mx directory that can be + There is a simple tool in the NuttX tools/pic32 directory that can be used to solve both issues with the nuttx.hex file. But, first, you must build the tool: - cd tools/pic32mx - make + cd tools/pic32 + make -f Makefile.host Now you will have an executable file call mkpichex (or mkpichex.exe on Cygwin). This program will take the nutt.hex file as an input, it will @@ -384,7 +384,7 @@ Loading NuttX with PICkit2 To use this file, you need to do the following things: - # Add the NuttX tools/pic32mx directory to your + # 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 diff --git a/boards/mips/pic32mx/ubw32/README.txt b/boards/mips/pic32mx/ubw32/README.txt index 8af6caefb1..8db11658df 100644 --- a/boards/mips/pic32mx/ubw32/README.txt +++ b/boards/mips/pic32mx/ubw32/README.txt @@ -306,15 +306,15 @@ Loading NuttX with PICkit2 file to contain physical addresses. But the nuttx.hex file generated from the top-level make will have address in the KSEG0 and KSEG1 regions. - tools/pic32mx/mkpichex: + tools/pic32/mkpichex: ---------------------- - There is a simple tool in the NuttX tools/pic32mx directory that can be + There is a simple tool in the NuttX tools/pic32 directory that can be used to solve both issues with the nuttx.hex file. But, first, you must build the tool: - cd tools/pic32mx - make + cd tools/pic32 + make -f Makefile.host Now you will have an executable file call mkpichex (or mkpichex.exe on Cygwin). This program will take the nutt.hex file as an input, it will @@ -323,7 +323,7 @@ Loading NuttX with PICkit2 To use this file, you need to do the following things: - # Add the NuttX tools/pic32mx directory to your + # 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 diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/README.txt b/boards/mips/pic32mz/flipnclick-pic32mz/README.txt index fb895940b2..09a891b260 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/README.txt +++ b/boards/mips/pic32mz/flipnclick-pic32mz/README.txt @@ -156,15 +156,15 @@ Creating Compatible NuttX HEX files file to contain physical addresses. But the nuttx.hex file generated from the top-level make will have address in the KSEG0 and KSEG1 regions. - tools/pic32mx/mkpichex: + tools/pic32/mkpichex: ---------------------- - There is a simple tool in the NuttX tools/pic32mx directory that can be + There is a simple tool in the NuttX tools/pic32 directory that can be used to solve both issues with the nuttx.hex file. But, first, you must build the tool: - cd tools/pic32mx - make + cd tools/pic32 + make -f Makefile.host Now you will have an executable file call mkpichex (or mkpichex.exe on diff --git a/boards/mips/pic32mz/pic32mz-starterkit/README.txt b/boards/mips/pic32mz/pic32mz-starterkit/README.txt index 932ea42e17..c262b85534 100644 --- a/boards/mips/pic32mz/pic32mz-starterkit/README.txt +++ b/boards/mips/pic32mz/pic32mz-starterkit/README.txt @@ -104,15 +104,15 @@ Creating Compatible NuttX HEX files file to contain physical addresses. But the nuttx.hex file generated from the top-level make will have address in the KSEG0 and KSEG1 regions. - tools/pic32mx/mkpichex: + tools/pic32/mkpichex: ---------------------- - There is a simple tool in the NuttX tools/pic32mx directory that can be + There is a simple tool in the NuttX tools/pic32 directory that can be used to solve both issues with the nuttx.hex file. But, first, you must build the tool: - cd tools/pic32mx - make + cd tools/pic32 + make -f Makefile.host Now you will have an executable file call mkpichex (or mkpichex.exe on Cygwin). This program will take the nutt.hex file as an input, it will @@ -121,7 +121,7 @@ Creating Compatible NuttX HEX files To use this file, you need to do the following things: - export PATH=??? # Add the NuttX tools/pic32mx 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 diff --git a/tools/pic32mx/.gitignore b/tools/pic32/.gitignore similarity index 100% rename from tools/pic32mx/.gitignore rename to tools/pic32/.gitignore diff --git a/tools/pic32/Makefile.host b/tools/pic32/Makefile.host new file mode 100644 index 0000000000..5780f8c1ca --- /dev/null +++ b/tools/pic32/Makefile.host @@ -0,0 +1,36 @@ +############################################################################ +# tools/pic32/Makefile.host +# +# 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. +# +############################################################################ + +all: mkpichex +default: mkpichex +.PHONY: clean + +# Add CFLAGS=-g on the make command line to build debug versions + +CFLAGS = -O2 -Wall -I. + +# mkpichex - Convert virtual addresses in nuttx.hex to physical addresses + +mkconfig: mkpichex.c mkpichex.c + @gcc $(CFLAGS) -o mkpichex mkpichex.c + +clean: + @rm -f *.o *.a *.dSYM *~ .*.swp + @rm -f mkpichex mkpichex.exe diff --git a/tools/pic32mx/mkpichex.c b/tools/pic32/mkpichex.c similarity index 82% rename from tools/pic32mx/mkpichex.c rename to tools/pic32/mkpichex.c index 1562031bc8..84e2365da0 100644 --- a/tools/pic32mx/mkpichex.c +++ b/tools/pic32/mkpichex.c @@ -1,35 +1,20 @@ /**************************************************************************** - * tools/pic32mx//mkpichex.c + * tools/pic32/mkpichex.c * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * 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 * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: + * http://www.apache.org/licenses/LICENSE-2.0 * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * 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. * ****************************************************************************/ @@ -110,13 +95,14 @@ struct hex_s * Private Data ****************************************************************************/ -static char line[MAX_LINE+1]; +static char line[MAX_LINE + 1]; /**************************************************************************** * Private Functions ****************************************************************************/ -static inline char *getfilepath(const char *path, const char *name, const char *extension) +static inline char *getfilepath(const char *path, const char *name, + const char *extension) { snprintf(line, MAX_LINE, "%s/%s.%s", path, name, extension); line[MAX_LINE] = '\0'; @@ -184,6 +170,7 @@ static unsigned char checksum(chksum_ndx) { chksum += (int)get8(&line[ndx]); } + return (unsigned char)((-chksum) & 0xff); } #endif @@ -225,7 +212,8 @@ static void adjust_extlin(struct hex_s *hexline) /* Then create the new output record */ - snprintf(line, MAX_LINE-PAYLOAD_OFFSET, ":02000004%04X%02X\n", segment, chksum); + snprintf(line, MAX_LINE-PAYLOAD_OFFSET, ":02000004%04X%02X\n", + segment, chksum); } /**************************************************************************** @@ -307,7 +295,6 @@ int main(int argc, char **argv, char **envp) if (remove(srcfile) != 0) { fprintf(stderr, "Failed to remove the old '%s'\n", srcfile); - } /* Rename the new nuttx.tmp file to nuttx.hex */ diff --git a/tools/pic32mx/Makefile b/tools/pic32mx/Makefile deleted file mode 100644 index 1d6a2962c4..0000000000 --- a/tools/pic32mx/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -############################################################################ -# tools/pic32mx//Makefile -# -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# 3. Neither the name NuttX nor the names of its contributors may be -# used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################ - -all: mkpichex -default: mkpichex -.PHONY: clean - -# Add CFLAGS=-g on the make command line to build debug versions - -CFLAGS = -O2 -Wall -I. - -# mkpichex - Convert virtual addresses in nuttx.hex to physical addresses - -mkconfig: mkpichex.c mkpichex.c - @gcc $(CFLAGS) -o mkpichex mkpichex.c - -clean: - @rm -f *.o *.a *.dSYM *~ .*.swp - @rm -f mkpichex mkpichex.exe