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

batch building with CCS...

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



Joined: 31 Oct 2007
Posts: 4

View user's profile Send private message AIM Address

batch building with CCS...
PostPosted: Wed Oct 31, 2007 10:02 pm     Reply with quote

Hello,
I would like to create a batch file where I pass in different parameters #param=value to build different hex files. This will allow me to automate numerous builds.


The problem is, when I call ccsc.exe numerous times from the batch file (using different parameters each time), only the 1st hex file gets built but not the rest.

How does one build multiple output files with ccsc? The solution is obvious using gcc, g++, cl, but not with ccsc.

Thanks!
wetodd
Guest







PostPosted: Thu Nov 01, 2007 3:50 pm     Reply with quote

I am doing the exact same thing. With ccsc.exe, the .hex file is named the same as the .c file. So you are creating multiple hex files, but each subsequent file overwrites the previous one. I created a separate program to write the original file to a new file with a different name. My project needs unique IDs for each unit, so my program asks the user for the starting ID and number of files to generate. Then in a for loop, the program creates the specified number of files, and adds the compile command to a batch file.
jmoliere



Joined: 31 Oct 2007
Posts: 4

View user's profile Send private message AIM Address

PostPosted: Thu Nov 01, 2007 8:32 pm     Reply with quote

wetodd,
I'm pretty sure I'm not creating the same file over and over because the time stamp on the 'last updated time' of the file doesn't change. Also, when I apply the commands one at a time on the command line, the proper hex files are created. Executing these commands in a batch file do not work.

Good day!
jmoliere
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Fri Nov 02, 2007 6:20 am     Reply with quote

Could you post the batch file.

Issues with doing this:-
1. The compiler will only re-compile if a source file has changed.
This can be overridden in the GUI compiler by clicking BuildAll but I don't know how you do this with the command line interface. Help is no help here.

2. You need to specify a different output file for each build.
I again could not find out how to do this with the command line -? help info.

Have fun.
jmoliere



Joined: 31 Oct 2007
Posts: 4

View user's profile Send private message AIM Address

PostPosted: Fri Nov 02, 2007 4:53 pm     Reply with quote

Here is a build script that I've tried to get things to work. I used the Ch interpreter ( the C interpreter ) to make things easier for me.... which it's not.

Basically I try to recursively call this same script over and over until all the files are built.

I named the file below test.ch and to run the program, type:
test.ch 0 <enter>

-----------------------------------------

int main(int argc, char *argv[])
{

int i=0;
char data[100];
//rm TestPICC.o
int num=0;
if (argc == 2)
{
num = atoi(argv[1]);
sprintf(&data[0], "start /MAX ccsc #TUBE_NUMBER=%d +CC +EXPORT -D +EA +Y9 +P +stdout +DF +O8OUT TestPICC.c", num);
printf("executing command: %s\r\n", data);
system(data);
num++;
if (num < 3)
{
//let the previous process finish and then start this process.
sleep(30);

sprintf(data, "start /MAX test.ch %d\r\n", num);
printf("sending: %s\n", data);
system(data);
data[0] = 0;
}
}
printf("ending with num: %d\n", num);
}
-------------------------------------------------------------------





The code below is TestPICC.c and I ripped a bunch of the
code out to make things easier to read.
-----------------------------------------------
#EXPORT( HEX, FILE=TUBE_NUMBER.hex)

#include "TestPICC.h"

#fuses HS,NOWDT,NOPUT,NOBROWNOUT,LVP,NOWRT,NOPROTECT
#use delay(clock=20000000)
#use FAST_IO(D)
#use FAST_IO(C)
#use FAST_IO(B)
#use FAST_IO(A)
#use FAST_IO(E)

#define WR PIN_B2
#define RD PIN_B1
#define SND PIN_E1
#define TXE PIN_E2
#define RXF PIN_B4

#byte PORTD = 0x08


void main()
{
long tubeNumber = TUBE_NUMBER;
printf("got number %d\n", tubeNumber);
}

--------------------------------------------------
jmoliere



Joined: 31 Oct 2007
Posts: 4

View user's profile Send private message AIM Address

PostPosted: Fri Nov 02, 2007 5:26 pm     Reply with quote

Wayne_ wrote:
Could you post the batch file.

Issues with doing this:-
1. The compiler will only re-compile if a source file has changed.
This can be overridden in the GUI compiler by clicking BuildAll but I don't know how you do this with the command line interface. Help is no help here.

2. You need to specify a different output file for each build.
I again could not find out how to do this with the command line -? help info.

Have fun.



I also tried....
filename: test.ch
-----------------------------------------------
int main(int argc, char *argv[])
{
for (;i<4;i++)
{
sprintf(&data[0], "start /MIN ccsc #TUBE_NUMBER=%d +CC +EXPORT -D +EA +Y9 +PE +stdout +DF +O8OUT TestPICC.c", i);
printf("start %s\r\n", data);

//make the command line call
system(data);
//sleep(5);
//rm TestPICC.o TestPICC.cod TestPICC.cof TestPICC.esym TestPICC.lst TestPICC.osym TestPICC.sta TestPICC.sym TestPICC.tre
data[0]=0;
}
}
---------------------------------------------------------

...but of course, anything as simple and dumb as the code above would never work!
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Mon Nov 05, 2007 2:35 am     Reply with quote

First of all these are not batch files but c programs.
I have not come accross the Ch interpreter!

Your problem MAY be that each system call starts a new thread.
This would mean that the system call to run the compiler returns straight away and the compiler runs in the background. You then call your program again to do the next build. Again this returns imediately so you current thread can terminate.

The second one is correct BUT if the compiler uses the same filenames for each build (which it will do) then your compile threads will have a problem!

Try removing the "start /MAX" from the "ccsc" command line string.
You program will then wait until each build has completed before moving on to the next.

This may help things.
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