diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-02-27 19:50:35 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-02-27 19:50:35 +0000 |
commit | 34abeda54d7093df62fc2808601c7d7e0bb2ab1c (patch) | |
tree | 84593559b23d580c9330f7c2ca516069a166c789 /nuttx/configs/pic32-starterkit/tools | |
parent | a500a9ab6d73b61328c3e42e4b1e103ad0656e07 (diff) | |
download | px4-nuttx-34abeda54d7093df62fc2808601c7d7e0bb2ab1c.tar.gz px4-nuttx-34abeda54d7093df62fc2808601c7d7e0bb2ab1c.tar.bz2 px4-nuttx-34abeda54d7093df62fc2808601c7d7e0bb2ab1c.zip |
Add support for the Atollic Pro toolchain; Change extension .ihx to .hex to be better compatible with most of the rest of the world
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4431 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/pic32-starterkit/tools')
-rw-r--r-- | nuttx/configs/pic32-starterkit/tools/Makefile | 4 | ||||
-rw-r--r-- | nuttx/configs/pic32-starterkit/tools/mkpichex.c | 24 |
2 files changed, 22 insertions, 6 deletions
diff --git a/nuttx/configs/pic32-starterkit/tools/Makefile b/nuttx/configs/pic32-starterkit/tools/Makefile index b01fbba19..71ec90476 100644 --- a/nuttx/configs/pic32-starterkit/tools/Makefile +++ b/nuttx/configs/pic32-starterkit/tools/Makefile @@ -1,7 +1,7 @@ ############################################################################ # configs/pic32-starterkit/tools/Makefile # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# 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 @@ -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/pic32-starterkit/tools/mkpichex.c b/nuttx/configs/pic32-starterkit/tools/mkpichex.c index 0922e6768..90d5efc54 100644 --- a/nuttx/configs/pic32-starterkit/tools/mkpichex.c +++ b/nuttx/configs/pic32-starterkit/tools/mkpichex.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/pic32-starterkit/tools/mkpichex.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * 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 @@ -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; } |