View previous topic :: View next topic |
Author |
Message |
2xhp
Joined: 14 Jan 2019 Posts: 39
|
Command line compiler and hex files to their own folder |
Posted: Tue Apr 20, 2021 11:27 pm |
|
|
Hi,
I looked through the manual and couldn't see an obvious option (I probably just missed it if there is one). I'd like to create a subfolder to my code and have the command line compiler on compile put the output files in a separate folder. Is this possible?
For example:
Top level folder:
program.c
Outputs folder:
program.hex
program.lst
program.err
Thanks in advance. |
|
|
2xhp
Joined: 14 Jan 2019 Posts: 39
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Wed Apr 21, 2021 12:34 am |
|
|
You can do it with a batch file. |
|
|
samikool
Joined: 01 Apr 2021 Posts: 15
|
|
Posted: Mon Apr 26, 2021 8:06 am |
|
|
When calling the ccsc command, you can give an out="outputPath" argument. From what I understand it doesn't always work, but it has worked for me in the past. It is in the manual under arguments. |
|
|
2xhp
Joined: 14 Jan 2019 Posts: 39
|
|
Posted: Mon Apr 26, 2021 11:21 am |
|
|
Ttelmah wrote: | You can do it with a batch file. |
That's what I ended up doing - thanks for the suggestion. This allows me to move the various output file types to their own folders which is useful. For anyone interested in a way to do it, here's how I did it (on a Windows machine):
1) Create a file. I called it "move_output_files.bat" and put it in its own folder within my project called "Batch".
2) Copy the following into that batch file:
robocopy %1 %1\Hex *.hex /MOV
robocopy %1 %1\List *.lst /MOV
robocopy %1 %1\Errors *.err /MOV
3) I use Notepad++ for code editing and NPPExec for calling up the compiler. I just added a line to run the batch file and pass in the path. Here's what those lines look like in NPPExec:
C:\Program Files (x86)\PCD_V5_103\Ccsc.exe "$(FULL_CURRENT_PATH)" +FD +P -T -A -M -J -D -L I="C:\Program Files (x86)\PCD_V5_103\Devices" I+="C:\Program Files (x86)\PCD_V5_103\Drivers"
cmd /c "$(CURRENT_DIRECTORY)\Batch\move_output_files.bat $(CURRENT_DIRECTORY)" |
|
|
2xhp
Joined: 14 Jan 2019 Posts: 39
|
|
Posted: Mon Apr 26, 2021 11:23 am |
|
|
samikool wrote: | When calling the ccsc command, you can give an out="outputPath" argument. From what I understand it doesn't always work, but it has worked for me in the past. It is in the manual under arguments. |
Thank you. That's what I was originally looking for. However, with the batch file method I just posted some details on, I can move the different output file types to their own folders - something I've always wanted to do but never took the time to figure out how to. This keeps the root folder of my project really clean. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Mon Apr 26, 2021 11:23 pm |
|
|
Well done. Using the batch file gives you much more capability. It's one
of these things that is so commonly forgotten about now with all these
'automatic' tools, but can do so much (with a little thought). to organise
operations as you want. |
|
|
|