CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Command line compiler and hex files to their own folder

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
2xhp



Joined: 14 Jan 2019
Posts: 39

View user's profile Send private message

Command line compiler and hex files to their own folder
PostPosted: Tue Apr 20, 2021 11:27 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Apr 20, 2021 11:33 pm     Reply with quote

From what this post says:

http://www.ccsinfo.com/forum/viewtopic.php?t=53421

... it doesn't sound like this is possible. Interested to hear if maybe someone knows some way to do it though.
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Wed Apr 21, 2021 12:34 am     Reply with quote

You can do it with a batch file.
samikool



Joined: 01 Apr 2021
Posts: 15

View user's profile Send private message

PostPosted: Mon Apr 26, 2021 8:06 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Apr 26, 2021 11:21 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Apr 26, 2021 11:23 am     Reply with quote

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: 19538

View user's profile Send private message

PostPosted: Mon Apr 26, 2021 11:23 pm     Reply with quote

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. Very Happy
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group