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

All Code Rebuilt when using Command Line

Can anybody help me with this?

I am building from the command line using a batch file. Every time the batch file is run, all C files are rebuilt even if there were no changes. Building from the uVision2 IDE works as you would expect with incremental builds.

I have search this site and found two memos about this. One concerns the TZ setting in the Autoexec.bat - I don't have that. The other memo states a "A=0x0" in the Defines section can cause this as well. I removed all defines and still have the problem.

Any ideas?

Thanks
Barry

  • What exactly is in "the batch file?"

  • This is UV_Make.bat that starts the process:

    @echo off
    call set_build_paths.bat
    echo.
    echo Deleting the old build results file.
    del "UV Build.txt"
    echo.
    call mk_englsh.bat
    echo.
    echo Building the project using Keil uVision2
    %UV_DIR%\UV2 -b"%BUILD_DIR%\5100 uVision.UV2" -t"Target 1" -o"%BUILD_DIR%\UV Build.txt"
    rem End of UV_Make.bat

    This is set_build_paths.bat which gets called from the the first batch file:

    @echo off
    echo Setting the paths.
    set BUILD_DIR=d:\source\predat~1\5100\build
    set UV_DIR=c:\tools\keil\uv2

    echo %BUILD_DIR%
    echo %UV_DIR%
    rem End of set_build_paths.bat

    This is mk_english.bat which gets called from the the first batch file:

    @echo off
    echo Building String Resources using ResComp.exe...
    if not exist ..\ObjFlash\* mkdir..\ObjFlash
    ..\Resource\ResComp.exe -P:..\Resource\Predator.prj -O:..\Source\DDATable -H:..\Source\DDAText.h ..\Source\english.c

    if errorlevel 0 goto end
    echo Resource Build Error
    pause

    :end
    rem End of mk_english.bat

    I'm not sure if it is an issue but I am using Windows NT 4.0.

    Thanks and I hope this helps.
    Barry

  • I have found what is causing this problem although I don't fully understand it. The call to "mk_englsh.bat" is creating two updated header files (dda_test.h and ddatable.h) as a byproduct of what it does which apparently causes uVision to believe that all of the files are out of date. The dependencies in my source files don't seem to bear this out but I will have to check further.

    Thanks for your help.
    Barry

  • Time to learn how to use make (E.g. Gnu make, Borland make, MS nmake).

    - Mark

  • If you just type the uVision command line by hand (no bat files), does it work as expected?

    Have you tried turning the echo back on & checking that all the Environment Variables are expanding correctly?

    What is the ResComp.exe utility supposed to be doing?
    Looks like it could be auto-generating some files - which could cause uVision to see the Project as "out of date"?

    BTW: it's easier to read if you use the &ltpre&gt and &lt/pre&gt tags around code (including Batch files!); eg,

    @echo off
    echo Building String Resources using ResComp.exe...
    if not exist ..\ObjFlash\* mkdir..\ObjFlash
    ..\Resource\ResComp.exe -P:..\Resource\Predator.prj -O:..\Source\DDATable -H:..\Source\DDAText.h ..\Source\english.c

    See the "Tips for posting messages" link,
    http://www.keil.com/forum/tips.asp


  • Thanks for the tip about sending the code snippets Andrew. Yes the problem does seem to be the ResComp's generation of the two .h files. Can you tell me how uVision determines if a file needs to be rebuilt? Do you know what two times are being compared and how I can view them? I assume one is the "modified" date of the source file but I can't find the other date stored in any file created by uVision or in the .obj file.

  • It is because I am using NMAKE that I had to take this approach. Nobody could tell me how to simulate the V3 AMAKE actions using a batch file and V4 of the build tools. So now I am using uVision to replace NMAKE and gain uVision's automatic register optimization feature.

  • When the C51 compiler "compiles" a C file, the path of the original C file is embedded in the .OBJ file that is generated. That way, UV2, can quickly determine if a file needs to be recomilped (by comparing the time stamp of the .OBJ file with that of the .C file).

    Additionally, the paths of all include files (and their include files) are embedded in the .OBJ file.

    When UV2 checks, if ANY of the original SOURCE files (the original .C file and any include files) are "newer" than the .OBJ file, the .C file is recompiled.

    This is totally automatic and may compile MORE than necessary (but certainly not less).

    Jon

  • "uVision's automatic register optimization feature."

    I think that's a feature of the compiler & Linker; uVision just provides an "easy" interface to access those features.
    So it should be possible to do it from the command line - you can take the options generated by uVision as your starting point.