This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

using batch file to build project

Trying to use the uVision generated batch file to build the project. The batch file is generated fine, but running it produces an error for every call to armcc:

C:\ARM\LPC23xx_24xxSampleSoftware.r5\Keil\NewTest1>"C:\Keil\ARM\BIN31\ArmCC" --Via ".\obj\irq.__i"
Fatal error: C3904U: Could not open via file '.\obj\irq.__i'.

There are no files in my project with '.__i' or '.__ia' extensions.

  • Hey,

    Could you shortly describe how you use the batch file?

    Kasper

  • By checking the 'batch file' box on the project options Output tab, and 'reuild all files', a .BAT file is created by uVision which should allow rebuilding of the project without opening uVision.

    I simply run the batch file from a windows console, but the commands in the batch file expect certain files with '.__ia' and '.__i' extensions which are not present in the project.

    The generated batch file has a strange syntax, so I have tried guessing at what the command line should look like based on the project option dialogs for C++ and Linker and creating my own custom batch file. I have had better success building the project with my own custom batch file, than the uVision generated one. I'd still like to know what's wrong.

  • They are, presumably, intermediate files that are - or should be - generated by earlier steps in the build?

    "The generated batch file has a strange syntax"

    How can that be?
    Surely, there is only one form of syntax for MS "Batch" files?!

    "I'd still like to know what's wrong."

    Maybe this is a feature that's been inherited from the original Keil tools (before ARM took over), and doesn't actually work with the ARM tools...?

  • If you have uVision, you can pick any project and generate the batch file yourself and see what I am talking about. The syntax in the batch file is not what one would expect if you were to invoke the compiler from the command line. For the NXP timer project example the generated batch file looks like this:

    SET RVCT31INC=C:\Keil\ARM\RV31\INC
    SET RVCT31LIB=C:\Keil\ARM\RV31\LIB
    SET CPU_TYPE=LPC2478
    SET CPU_VENDOR=NXP (founded by Philips)
    SET UV2_TARGET=Target 1
    SET CPU_CLOCK=0x00000000
    "C:\Keil\ARM\BIN31\ArmCC" --Via ".\obj\irq.__i"
    "C:\Keil\ARM\BIN31\ArmCC" --Via ".\obj\target.__i"
    "C:\Keil\ARM\BIN31\ArmCC" --Via ".\obj\timer.__i"
    "C:\Keil\ARM\BIN31\ArmCC" --Via ".\obj\test3.__i"
    "C:\Keil\ARM\BIN31\ArmAsm" --Via ".\obj\swi_handler._ia"
    "C:\Keil\ARM\BIN31\ArmAsm" --Via ".\obj\lpc2400._ia"
    "C:\Keil\ARM\BIN31\ArmLink" --Via ".\Obj\test3.lnp"

    This --Via syntax seems to be some kind of shorthand, but it fails since the files with those extensions do not exist.

    A successful command line form for compiling a file can be created by examining the options tabs and looking at the .dep file. It looks more like what I expect:
    C:/Keil/ARM/BIN31/armcc ..\Common\src\irq.c -c --device DARMP -g -O0 --apcs=interwork -I..\Common\inc -I "C:\Keil\ARM\INC\Philips" -D__DEBUG_RAM -o ".\Obj\irq.o" --omf_browse ".\Obj\irq.crf" --depend ".\Obj\irq.d"

  • "This --Via syntax seems to be some kind of shorthand"

    No secrets - it's documented here: http://www.keil.com/support/man/docs/armlink/armlink_babcffgh.htm

  • You mean it is incorrectly documented there, since it either no longer applies to this version of the tools or the 'generate batch file' feature is broken.

  • See my earlier comment - I suspect that the batchfile feature has never worked with the ARM Compiler at all!

    It looks like the "real" (GUI) build generates a "Via" file for each input file in the project, and then uses that to do the actual translation - but the "Batch" feature has omitted the step that generates the required "Via" files!

    D'oh!!

    Instead of the bach file, have you looked at http://www.keil.com/support/man/docs/uv3/uv3_commandline.htm

  • Considering previous speculations:

    "They are, presumably, intermediate files that are - or should be - generated by earlier steps in the build?"

    and:

    "It looks like the 'real' (GUI) build generates a 'Via' file for each input file in the project, and then uses that to do the actual translation"

    I tried the following experiment:

    1. Open the uVision Project, and also open an Explorer window on your Objects folder - ensure both are visible simultaneously;

    2. Start a build from the GUI;

    3. Refresh the Explorer window while the build is running - you will see that files with those funny extensions are, indeed, created briefly while the build is in progress...

  • I did look at that, thanks, but it isn't really what I am after.

    I have a large legacy project being ported to Keil, and even though the IDE is great for dev&debug, it is desirable to also be able to build the project via make files or batch files using the raw tools. This is better for production&ongoing support, easier to document - just simple, easy to read text files with all the info in one place - no need to navigate dialogs to figure it out.

    The other thing is with make files you have detailed control over the build&link order which can be important. It isn't clear in what order uVision builds my large project and if it will give me the same level of control. I suspect it does, I just have not dug into it.

    For instance is my project always built in the same order in which my file groups appear in the workspace window (top to bottom)? Is the .dep file generated and then used during the build, or is it strictly a record of what happened?

    thanks

  • "easier to document - just simple, easy to read text files with all the info in one place - no need to navigate dialogs to figure it out."

    Yes, I thoroughly agree: that is the fundamental flaw with GUI IDEs!

    The only way to fully document a project to a Client is to take screenshots of evey single dialogue!

    Hopeless!

    " is my project always built in the same order in which my file groups appear in the workspace window (top to bottom)?"

    Yes, that is true - though I'm not sure where (or even whether) that is clearly documented.

    Note that the full command-line used to compile each source file is recorded in the compiler listing file.
    The compiler listing file has a '.txt' extension.

    Note that uVision has a bug in that it puts the compiler listing files into the Objects folder!

  • 3. Refresh the Explorer window while the build is running - you will see that files with those funny extensions are, indeed, created briefly while the build is in progress...

    I see the intermediate files... As you say, the batch file build must not be calling the 'via file generator' module. No matter, I am pretty close to having real make files now. There are many differences in the output when I compare the uVision built .axf and the .axf built from my custom makefile. I have tried to match what was recorded in the .dep file, but it could be the link order is different so the binary image does not compare even though it is the same size.

  • Hello,

    I did a quick test for the batch file in an old project.

    Everything seems to work correctly.

    I did not anything speacial...

    Next issue are just to program and start debugger automaticly.

    Kasper