diff options
Diffstat (limited to 'nuttx/configs/pcblogic-pic32mx/tools')
-rw-r--r-- | nuttx/configs/pcblogic-pic32mx/tools/Makefile | 6 | ||||
-rw-r--r-- | nuttx/configs/pcblogic-pic32mx/tools/mkpichex.c | 26 |
2 files changed, 24 insertions, 8 deletions
diff --git a/nuttx/configs/pcblogic-pic32mx/tools/Makefile b/nuttx/configs/pcblogic-pic32mx/tools/Makefile index 60d3b14ad..018fcaa8c 100644 --- a/nuttx/configs/pcblogic-pic32mx/tools/Makefile +++ b/nuttx/configs/pcblogic-pic32mx/tools/Makefile @@ -1,8 +1,8 @@ ############################################################################ # configs/pcblogic-pic32mx/tools/Makefile # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt <spudmonkey@racsa.co.cr> +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -41,7 +41,7 @@ default: mkpichex CFLAGS = -O2 -Wall -I. -# mkpichex - Convert nuttx.ihx to nuttx.hex +# mkpichex - Convert virtual addresses in nuttx.hex to physical addresses mkconfig: mkpichex.c mkpichex.c @gcc $(CFLAGS) -o mkpichex mkpichex.c diff --git a/nuttx/configs/pcblogic-pic32mx/tools/mkpichex.c b/nuttx/configs/pcblogic-pic32mx/tools/mkpichex.c index 2d5251d02..c15a27564 100644 --- a/nuttx/configs/pcblogic-pic32mx/tools/mkpichex.c +++ b/nuttx/configs/pcblogic-pic32mx/tools/mkpichex.c @@ -1,8 +1,8 @@ /**************************************************************************** * configs/pcblogic-pic32mx/tools/mkpichex.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -125,7 +125,7 @@ static inline char *getfilepath(const char *path, const char *name, const char * static void show_usage(const char *progname) { - fprintf(stderr, "USAGE: %s <abs path to nuttx.ihx>\n", progname); + fprintf(stderr, "USAGE: %s <abs path to nuttx.hex>\n", progname); exit(1); } @@ -246,14 +246,14 @@ int main(int argc, char **argv, char **envp) show_usage(argv[0]); } - srcfile = getfilepath(argv[1], "nuttx", "ihx"); + srcfile = getfilepath(argv[1], "nuttx", "hex"); if (!srcfile) { fprintf(stderr, "getfilepath failed\n"); exit(2); } - destfile = getfilepath(argv[1], "nuttx", "hex"); + destfile = getfilepath(argv[1], "nuttx", "tmp"); if (!destfile) { fprintf(stderr, "getfilepath failed\n"); @@ -295,5 +295,21 @@ int main(int argc, char **argv, char **envp) fclose(src); fclose(dest); + + /* Remove the original nuttx.hex file */ + + if (remove(srcfile) != OK) + { + fprintf(stderr, "Failed to remove the old '%s'\n", srcfile); + + } + + /* Rename the new nuttx.tmp file to nuttx.hex */ + + if (rename(destfile, srcfile) != OK) + { + fprintf(stderr, "Failed to rename '%s' to '%s'\n", destfile, srcfile); + } + return 0; } |