Automate creation of makefile from command-line? (CW10.1, HCS08)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automate creation of makefile from command-line? (CW10.1, HCS08)

Jump to solution
2,130 Views
tomlogic
Contributor III

I'm trying to create some automation for a series of projects on the HCS08.

 

I'd like to pull the projects from our git repository, have CW10.1 create makefiles for the Debug and Release builds, and then trigger a "make all" for each build.  I'll log the compiler errors (by copying EDOUT) and portions of the MAP file to a separate file for later review.

 

I have everything working except for the "create makefile" step.  What tool can I use to generate the necessary files (makefile, makefile.local, objects.mk, sources.mk, etc.) in the build directories listed in the .cproject file for the project?  Is that even possible from the command line?

 

I spent an hour reading through the help and looking at the IDE Preferences and Project Properties, but I didn't see anything that clearly indicated how Eclipse creates the build directory.

 

If I can get that last piece working, I'll post the .cmd file to this thread.

Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
1,150 Views
CrasyCat
Specialist III

Hello

 

Take a look at the chapter "Debugger" section "Automated Builds" in Freescale Eclipse Extensions Guide.pdf.

 

There is a utility program called ECD that can be helpful.

 

CrasyCat

View solution in original post

0 Kudos
Reply
5 Replies
1,151 Views
CrasyCat
Specialist III

Hello

 

Take a look at the chapter "Debugger" section "Automated Builds" in Freescale Eclipse Extensions Guide.pdf.

 

There is a utility program called ECD that can be helpful.

 

CrasyCat

0 Kudos
Reply
1,150 Views
tomlogic
Contributor III

By the way, documentation listed the following command-line sample:

 

ecd -build -data my_workspace_path -project my_project_path

 But the program itself listed this:

Eclipse Command Line Driver.Usage: -command optionsavailable commands:        -help        -generateMakefiles [-verbose] [-project path [-config name | -allConfigs]]        -build [-verbose] [-cleanAll] [-project path [-config name | -allConfigs] -cleanBuild]

 

0 Kudos
Reply
1,150 Views
tomlogic
Contributor III

Wow, that's extremely helpful.  +1 for CrasyCat!

 

I found the documentation here:

http://www.freescale.com/infocenter/Codewarrior/index.jsp?topic=/com.freescale.doc.fsl_eclipse_ext_g...

 

I've compiled with both ecd.exe and gnu/bin/make.exe.

 

But now I've run into another challenge.  I thought the EDOUT file in the target directory would contain all of the compilation errors, but I see now that it just has errors for the last compilation unit.

 

I was looking at setting the environment variable ERRORFILE so each C file got its own error file, but I wasn't able to get that working.

 

Any other tips for compiler automation?

0 Kudos
Reply
1,150 Views
CrasyCat
Specialist III

Hello

 

Did you try adding following option to your HC08 compiler command line:

 

-ENVERRORFILE=%f.err

 

This should writes all errors into a file with the same name as the source file, but with the

*.err extension, into the same directory as the source file.

 

See description of environment variable ERRORFILE in MCU_HCS08_Compiler.pdf for more details.

 

CrasyCat

0 Kudos
Reply
1,150 Views
tomlogic
Contributor III

CrasyCat,

 

I found that just saving the output of "make all" to a file and grepping that was an easier solution.  No need to go looking for a bunch of .err files to process.  Here's my final script.  In addition to showing compiler infos/warnings/errors for each project, it dumps the sizes from the MAP file.

 

Save it as a .BAT or .CMD file and run from anywhere.  I'm open to ideas on ways to improve it.  A next step for more automated testing will be to build some projects and then run them on the target, logging serial output, and comparing it to "known good" output to make sure the test has passed.

 

-Tom

 

@echo off:: Next line is necessary for using !TIME! inside FOR loopsetlocal EnableDelayedExpansion:: Automated compilation of all projects in workspace.:: Written by Tom.Collins@digi.com - June, 2011:: Configure these variables for your system.  Run the batch file:: and it will log information from building all targets to %LOG%.set WORKSPACE="C:\Projects\workspace"set LOG=C:\cw_test.logset CWDIR="C:\Program Files\Freescale\CW MCU v10.1":: list targets to build, can be a space-separated list::set TARGETS=Debug Releaseset TARGETS=Debug:: Actual command script follows...set ECD=%CWDIR%\eclipse\ecd.exeset MAKE=%CWDIR%\gnu\bin\make.exe:: check for proper configurationset ERROR=0if not exist %WORKSPACE%\.metadata ( echo Edit the WORKSPACE variable to point to your workspace. set ERROR=1)if not exist %CWDIR%\MCU ( echo Edit the CWDIR variable to point to your CodeWarrior installation. set ERROR=1)if not exist %ECD% ( echo Copy ecd.exe file from the ^<CWInstallDir^>\eclipse\plugins\ echo com.freescale.core.ide.commandLineDriver_2.0.0.FSL_{build_number}  echo folder to the ^<CWInstallDir^>\eclipse\ folder.  set ERROR=1)if %ERROR%==1 goto endecho Test run %DATE% %TIME% > %LOG%pushd %WORKSPACE%for /d %%D in (*) do ( if exist "%%D\.cproject" (  :: this is a CodeWarrior project dir; generate its makefiles  echo Generating makefiles for Project %%D  %ECD% -generateMakefiles -project %WORKSPACE%\%%D -allConfigs  for %%T in (%TARGETS%) do (   if exist "%%D\%%T\makefile" (    :: we have a makefile for the given target (%%T) so build it    echo. >> %LOG%    echo ---- %%D\%%T !TIME! >> %LOG%    del %WORKSPACE%\%%D\%%T\%%D.map    echo Building Target %%T of Project %%D    pushd %WORKSPACE%\%%D\%%T    %MAKE% clean    %MAKE% all > compile.log    grep -Ei ":(information|error|warning):" compile.log >> %LOG%    if exist %%D.map (     grep "dec: " %%D.map >> %LOG%    )    popd   )  ) ))popdecho Build test complete, view results in %LOG%:end:: notes...  This also works for building but is slower:: %ECD% -build -project %WORKSPACE%\%%D -config %%T -cleanBuild > compile.log

 

0 Kudos
Reply