UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
13,178 Views
Registered: ‎11-22-2010

How do I run a managed software build from the command line or in a batch file?

 have a need to be able to perform a complete build of the software for a MicroBlaze project from within a batch file.

The system.xml file for the design is available as an input, and is in a known location. The source code and the project files for both the platform and application are populated from our source code control archive.

 

I figured out how to run libgen, and it builds the platform libraries needed based on the system.xml file.

What I'm having problems with is figuring out how to run the managed make portion to create the build configuration directory and all the makefiles it takes to produce the elf file. Once that's done I can run 'make -q main-build' and get the elf file at the end just fine.

 

After digging around here and in the eclipse forums, the closest thing I found was to run eclipse in 'headless' mode using some variation of the following command:


C:\Xilinx\11.1\EDK\eclipse\bin\nt\eclipse -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data %WS_ROOT_DIR% -import %PROJ_ROOT_DIR%/ -cleanBuild %PROJNAME%

 

Unfortunantly, the version of eclipse provided with the SDK (I'm using version 11.4 of the Xilinx tools, BTW) does not appear to include the headless build application.

 

Does anyone know how to do this?

Do I need to convert into an unmanaged C project and just archive the makefiles?

 

0 Kudos
15 Replies
13,140 Views
Registered: ‎11-22-2010

Re: How do I run a managed software build from the command line or in a batch file?

Anyone got anything at all?

I really can't believe I'm the only one to run into this problem.

0 Kudos
13,092 Views
Registered: ‎11-22-2010

Re: How do I run a managed software build from the command line or in a batch file?

Have updated to version 12.3 of the Xilinx tools, and still have no answer.

 

Additionally, the external builder provided with 12.3 does not function correctly on a windows platform, and running an external make using the provided cygwin tools is no longer possible due to targets in the generated makefiles containing a "C:", which make rejects with the following error message:

 

Running make in C:\Work\SWIR_Test\SWIR_SSC\Release:
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i686-pc-cygwin
Reading makefiles...
Reading makefile `makefile'...
Reading makefile `../makefile.init' (search path) (don't care) (no ~ expansion)...
Reading makefile `sources.mk' (search path) (don't care) (no ~ expansion)...
Reading makefile `subdir.mk' (search path) (don't care) (no ~ expansion)...
Reading makefile `src/subdir.mk' (search path) (don't care) (no ~ expansion)...
Reading makefile `FreeRTOS/Source/subdir.mk' (search path) (don't care) (no ~ expansion)...
FreeRTOS/Source/subdir.mk:26: *** target pattern contains no `%'.  Stop.
An error occurred: build failed!

 

FreeRTOS is a linked folder, which can only be defined with an absolute path, or with a workspace variable that resolves to an absolute path.

 

Why does the provided makefile generator output makefiles that cannot be processed without user intervention to fix things up?

 


0 Kudos
Xilinx Employee
Xilinx Employee
13,082 Views
Registered: ‎01-18-2008

Re: How do I run a managed software build from the command line or in a batch file?

Once you use a linked folder, the Makefiles will start having the "C:" style paths that don't work with cygwin make. Your only recourse is to use relative or fully /cygdrive/c style paths instead of using linked folders.

 

For this reason, we have moved away from Cygwin in 13.1 and gone to MingW. The MingW make should support such configurations.

 

After you move to /cygdrive/c style paths, you shouldn't have any trouble building from the command line.

0 Kudos
13,077 Views
Registered: ‎11-22-2010

Re: How do I run a managed software build from the command line or in a batch file?

Thanks for the information, vsiva.

 

I'd actually prefer to use all relative paths, as that is how to guarantee that the build is location independent when someone else needs to work on the project - or in my case need to run an automated build process.

 

The only problem with relative path specifications is that I can't seem to find a way to specify a relative path for a linked folder: all the dialogs that allow specification of the linked resource appear to require an absolute path, which always ends up with the "C:\" windows-style path convention - including using path variables, which should have been able to do this IMHO.

 

If there were a way to regenerate the makefiles from the command line (i.e. do an eclipse 'headless' build) based on local build information like either the workspace or project location, this would be OK - but without that I then need to archive the makefiles - but need to do so without the absolute path expansion that the workbench performs when it creates them..

 

So although I believe that changing from DOS to POSIX style paths would work for an individual build that can rely on absolute paths, it's really not a good solution to my problem.

 

 

0 Kudos
Visitor lnelson
Visitor
13,073 Views
Registered: ‎02-02-2008

Re: How do I run a managed software build from the command line or in a batch file?

What works for me is to write my own makefiles.  I let XPS build the Xilinx libraries the way that it wants to and I have my own makefiles for building my application against those libraries.  That way I don't have to fight the GUI tools to do what I want.

0 Kudos
Xilinx Employee
Xilinx Employee
13,071 Views
Registered: ‎01-18-2008

Re: How do I run a managed software build from the command line or in a batch file?

Personally, I'd write my own Makefiles, but there are many people who want these Makefiles to be generated.

 

When the Makefiles are generated, ideally you would not store them in version control as they are a generated artifact, and you'd typically only store sources in version control.

 

In your case, the main problem is the use of linked folders. Figure out how you can structure your projects so that you can do without using linked folders. If you use them, it will always lead to conflicts with cygwin make. As we've learnt, Eclipse and Cygwin don't play well together - Eclipse insists on following the OS's standards, while Cygwin insists on being faithful to Unix. That is why we've moved to MingW, but that is only in 13.1.

 

In the meantime, I'd structure your projects like this:

 

- hw

- bsp

- app

- FreeRTOS

 

Put all of them in 1 folder, and then whenever you need to reference your RTOS from the app, use relative paths. See attached document for more details on how to do source control with SDK.

 

The Eclipse headless command generates Makefiles, so you shouldn't have to save them. Ofcourse if you write your own Makefiles, then you get the best scenario of never having to rely on Eclipse - you only rely on it for all its source cross referencing and graphical debuggers..

13,045 Views
Registered: ‎11-22-2010

Re: How do I run a managed software build from the command line or in a batch file?

Thank you again for your input, especially the document - on which I have a question, since it appears it has a potential answer to one of my original questions.

 

On page 15 of the document, there is an example on how to build an application from the command line, which is the issue I originally set out to resolve.

 

Unfortunantly, the screen capture used in the PDF file has truncated the command line, so there's no way to determine specifically what the correct argument to "-application" should be. Could you either post that information here, or a link to where the information could be found, please?

 

Concerning using an exernal makefile system, this could (obviously) be used, but is undesireable because not all developers are created equal: I've seen subtle and hard to diagnose bugs occur due to unintentionally malformed makefile changes due to one person who didn't understand makefiles check in a 'simple' change. If the tools are able to consistently and correctly create the makefiles needed, it's a definite plus.

 

0 Kudos
Xilinx Employee
Xilinx Employee
13,022 Views
Registered: ‎01-18-2008

Re: How do I run a managed software build from the command line or in a batch file?

Sorry about that. Here it is:

 

 

--------------
XILINX_EDK = <edk install folder>
XILINX = <ise install folder, same as edk for standalone SDK install>
ECLIPSE = $(XILINX_EDK)/eclipse/lin/eclipse/eclipse
VM = $(XILINX)/java6/lin/jre/bin
 
BSP = /path/to/bsp
APP = /path/to/app
WSPACE = /path/to/workspace
 
import:
        $(ECLIPSE) -vm $(VM) -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild \
                -import $(BSP) \
                -import $(APP) \
                -data $(WSPACE) \
                -vmargs -Dorg.eclipse.cdt.core.console=org.eclipse.cdt.core.systemConsole
compile:
        $(ECLIPSE) -vm $(VM) -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild \
                -build bsp \
                -data $(WSPACE) \
                -vmargs -Dorg.eclipse.cdt.core.console=org.eclipse.cdt.core.systemConsole
        $(ECLIPSE) -vm $(VM) -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild \
                -build hello \
                -data $(WSPACE) \
                -vmargs -Dorg.eclipse.cdt.core.console=org.eclipse.cdt.core.systemConsole
-------------

 

13,014 Views
Registered: ‎11-22-2010

Re: How do I run a managed software build from the command line or in a batch file?

Thanks again, I haven't had time to work with this today, I'll give it a try on Monday and let you know if I have any additional questions.

0 Kudos
Highlighted
5,574 Views
Registered: ‎06-03-2011

Re: How do I run a managed software build from the command line or in a batch file?

I was working on a similar problem today and the commands posted in this thread worked great for me.  Thanks!!!

0 Kudos
5,566 Views
Registered: ‎06-03-2011

Re: How do I run a managed software build from the command line or in a batch file?

I do have one problem with the make script.  If there is an error in the build, a GUI pops up indicating that "Java was started but returned exit code=1".  This hangs indefinitely until the user clicks on OK.  So, the solution above it not completely headless.

 

Anybody know how to get rid of this GUI and yet still get the fact that the build failed?

 

Thanks,

--tim

 

0 Kudos
5,564 Views
Registered: ‎06-03-2011

Re: How do I run a managed software build from the command line or in a batch file?

After some digging I discovered that the following command line option will suppress the dialog from popping up:

 

--launcher.suppressErrors

 

 

0 Kudos
Newbie ajose
Newbie
5,206 Views
Registered: ‎06-10-2013

Re: How do I run a managed software build from the command line or in a batch file?

I came across this message thread during the search for the commands to build the Xilinx SDK project outside SDK. Basically I need to create a windows batch file script to build the software from a command line. I'm using Xilinx 13.2 with Eclipse CDT 7.0.2

 

@williamhhowell: Were you able to build the software from the command line? Any updates, I'd highly appreciate!

 

@vsiva: Based on the 'Xilinx SDK Command Line Flows' document and your inputs, I've made the windows batch script below to do build.

==================================================

set XILINX_EDK=C:\Xilinx\13.2\ISE_DS\EDK

set XILINX=C:\Xilinx\13.2\ISE_DS\ISE

set ECLIPSE=%XILINX_EDK%\eclipse\nt64\eclipse\eclipse.exe

set VM=%XILINX%\java6\nt64\jre\bin

 

set WORKSPACE=E:\Workspaces\TESTSPACE

set PROJ_DIR=E:\Workspaces\TESTSPACE

set BSP_DIR=E:\Workspaces\TESTSPACE\BSP

 

%ECLIPSE% -vm %VM% -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -importAll %PROJ_DIR% -data %WORKSPACE% -vmargs -Dorg.eclipse.cdt.core.console=org.eclipse.cdt.core.systemConsole

 

%ECLIPSE% -vm %VM% -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -build %BSP_DIR% -data %WORKSPACE% -vmargs -Dorg.eclipse.cdt.core.console=org.eclipse.cdt.core.systemConsole

 

%ECLIPSE% -vm %VM% -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -build all -data %WORKSPACE% -vmargs -Dorg.eclipse.cdt.core.console=org.eclipse.cdt.core.systemConsole ==================================================

 

I could see the Debug and Release directories with the makefiles. But I couldn't create the build output executable .elf file. It seems it doesn't even create any object files.

 

Attached is the log file generated after executing the script.

 

My Project workspace is organized as:

E:\Workspaces\TESTSPACE

E:\Workspaces\TESTSPACE\BSP

E:\Workspaces\TESTSPACE\src\APP

E:\Workspaces\TESTSPACE\src\HW

 

I couldn't get the BSP created inside the src folder; so it's outside the 'src' folder inside the workspace.

APP is a simple application project with a single source file just returning 0 in the main(). There's no reason for an application build error and it compiles fine with the SDK GUI.

 

I have all the files as mentioned in the 'Using SDK with Revision Control Software' document in each of these projects.

 

How do I create the .elf executable from the build? Can you provide some inputs to building the software on windows? Thanks for any help!

0 Kudos
Newbie francisft
Newbie
5,157 Views
Registered: ‎07-17-2013

Re: How do I run a managed software build from the command line or in a batch file?

@ajose: I face the exact same problem than you are. Did you manage to find a way to build .elf executables?

0 Kudos
Scholar sampatd
Scholar
5,148 Views
Registered: ‎09-05-2011

Re: How do I run a managed software build from the command line or in a batch file?

Hi, 

 

You may want to check the following answer record:

 

http://www.xilinx.com/support/answers/45514.htm

 

Regards,

0 Kudos