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

Specifying the directory for object files

Which directive should I use (in the command line) to change the output path for the object files.

I want to move the objects files to a different directory (folder) so that my project directory contains only source files.

  • I don't think there's a command-line option to just specify the folder - you'd have to include it in an OBJECT directive?

    But you can check for yourself in the list of available options here: http://www.keil.com/support/man/docs/c51/c51_cm_dirlist.htm

    Typically, you'd set this up via your makefile, or the uVision project (if you had one).

  • Andy, wrong link

    the link is to "control directives available in the Cx51 Compiler."

    what the OP needs is linker directives

    http://www.keil.com/support/man/docs/bl51/bl51_ln_cmdprompt.htm

    to the OP:

    what I do is to copy everything to a 'build directory' and let the toold work there

    Erik

    @ECHO OFF
    call wipesl
    cd ..\ARbld\bslv
    
    @ECHO OFF
    if "%MUSDEB%"=="0" goto setmdb
    goto setno
    
    :setmdb
    @ECHO ON
    rem ********** DEBUG INFO IN FILE **********
    @ECHO OFF
    copy ..\..\com\cond\dbgflcd.h debflgc.h >..\trash\trashbin
    goto setdn
    
    :setno
    copy ..\..\com\cond\dbgflcn.h debflgc.h >..\trash\trashbin
    :setdn
    
    copy  C:\asdr\DCfmtbs.c                         *.*                     >..\trash\trashbin
    copy  C:\asdr\DCutil.c                      *.*                 >..\trash\trashbin
    copy  C:\asdr\DCpcav.h                          *.*                     >..\trash\trashbin
    copy  C:\asdr\DCfmtbm.a51                       *.*                     >..\trash\trashbin
    copy  C:\asdr\DCfsc.a51                         *.*                     >..\trash\trashbin
    copy  C:\asdr\DCfsn.a51                         *.*                     >..\trash\trashbin
    copy  C:\asdr\DCbsc.a51                         *.*                     >..\trash\trashbin
    copy  C:\asdr\DCbsn.a51                         *.*                     >..\trash\trashbin
    copy  C:\asdr\DCmacro.inc                       *.*                     >..\trash\trashbin
    copy  C:\aglobal\keil.h                         *.*                     >..\trash\trashbin
    copy  C:\aglobal\cyf120.h                       *.*                     >..\trash\trashbin
    copy  C:\aglobal\c51s.lib                       *.*                     >..\trash\trashbin
    copy ..\..\cms\*.h                                      *.*                     >..\trash\trashbin
    copy  ..\..\ARsou\sslv\*.a51            *.*             >..\trash\trashbin
    copy  ..\..\ARsou\sslv\*.c              *.*             >..\trash\trashbin
    copy  ..\..\ARsou\sslv\*.h                      *.*             >..\trash\trashbin
    copy  ..\..\ARsou\sslv\*.inc            *.*             >..\trash\trashbin
    copy  ..\..\ARsou\sslv\SLVident.h DCident.h             >..\trash\trashbin
    copy  ..\..\ARsou\sslv\SLVports.h DCports.h             >..\trash\trashbin
    copy  ..\..\ARsou\sslv\S2626.h    DCfmt.h               >..\trash\trashbin
    copy  ..\..\ARsou\sslv\SSF022.a51 SLVdrv.a51    >..\trash\trashbin
    del      S1616.h        >..\trash\trashbin
    del      S2626.h        >..\trash\trashbin
    del      SSF022.a51     >..\trash\trashbin
    del      SSF011.a51     >..\trash\trashbin
    rem changing typ to stl should ARbld slv485
    rem if a 26 pin non-color comes up OOPS
    
    if not exist  cmplst.txt goto nocmdl
    del cmplst.txt
    :nocmdl
    call batasm SLVstart
    call batcmp SLVisr
    call batcmp SLViic
    call batcmp SLVmain
    call batasm SLVxdata
    call batasm SXzdata
    call batcmp SLVutil
    call batasm SLVarout
    call batcmp SLV485
    call batcmp SLV1wire
    
    rem call batcmp SLVUmain
    rem call batcmp SLVUflsh
    rem call batasm SLVUasm
    
    
    
    call batasm SLVdrv
    call batcmp DCutil
    call batcmp DCfmtbs
    call batasm DCfmtbm
    call batasm DCfsn
    call batasm DCfsc
    call batasm DCbsn
    
    
    call batcmp SXfmtfmt
    call batcmp SXtools
    call batcmp SXsignid
    if not exist cmplst.txt goto naser
    echo on
    rem /////////////////////////////////
    rem ///////// COMPILE ERRORS ////////
    rem /////////////////////////////////
    type cmplst.txt | more
    rem saved in file cmplst.txt
    pause
    @ECHO OFF
    :naser
    
    if not exist as.lib goto usliex
    del as.lib
    :usliex
    c:\tools\keil\c51\bin\lib51 c as.lib                                    >..\trash\trashbin
    c:\tools\keil\c51\bin\lib51 a SLVutil.obj       to as.lib       >..\trash\trashbin
    c:\tools\keil\c51\bin\lib51 a SLVarout.obj  to as.lib   >..\trash\trashbin
    c:\tools\keil\c51\bin\lib51 a SLV485.obj    to as.lib   >..\trash\trashbin
    c:\tools\keil\c51\bin\lib51 a SLV1wire.obj  to as.lib   >..\trash\trashbin
    c:\tools\keil\c51\bin\lib51 a SLVdrv.obj        to as.lib       >..\trash\trashbin
    rem c:\tools\keil\c51\bin\lib51 a SXfsn.obj     to as.lib       >..\trash\trashbin
    rem c:\tools\keil\c51\bin\lib51 a SXfsc.obj     to as.lib       >..\trash\trashbin
    rem c:\tools\keil\c51\bin\lib51 a SZbsn.obj     to as.lib       >..\trash\trashbin
    rem c:\tools\keil\c51\bin\lib51 a SZbsc.obj     to as.lib       >..\trash\trashbin
    rem c:\tools\keil\c51\bin\lib51 a SXfmtbm.obj   to as.lib       >..\trash\trashbin
    c:\tools\keil\c51\bin\lib51 a SXfmtfmt.obj  to as.lib   >..\trash\trashbin
    c:\tools\keil\c51\bin\lib51 a SXtools.obj   to as.lib   >..\trash\trashbin
    c:\tools\keil\c51\bin\lib51 a DCutil.obj    to as.lib   >..\trash\trashbin
    c:\tools\keil\c51\bin\lib51 a SXsignid.obj  to as.lib   >..\trash\trashbin
    c:\tools\keil\c51\bin\lib51 a DCfmtbs.obj       to as.lib       >..\trash\trashbin
    c:\tools\keil\c51\bin\lib51 a DCfsn.obj     to as.lib   >..\trash\trashbin
    c:\tools\keil\c51\bin\lib51 a DCfsc.obj     to as.lib   >..\trash\trashbin
    c:\tools\keil\c51\bin\lib51 a DCbsn.obj     to as.lib   >..\trash\trashbin
    c:\tools\keil\c51\bin\lib51 a DCbsc.obj     to as.lib   >..\trash\trashbin
    c:\tools\keil\c51\bin\lib51 a DCfmtbm.obj   to as.lib   >..\trash\trashbin
    
    
    REM c:\tools\keil\c51\bin\lib51 a SXfsn.obj     to as.lib       >..\trash\trashbin
    REM c:\tools\keil\c51\bin\lib51 a SXfsc.obj     to as.lib       >..\trash\trashbin
    REM c:\tools\keil\c51\bin\lib51 a SZbsn.obj     to as.lib       >..\trash\trashbin
    REM c:\tools\keil\c51\bin\lib51 a SZbsc.obj     to as.lib       >..\trash\trashbin
    REM c:\tools\keil\c51\bin\lib51 a SXfmtbm.obj   to as.lib       >..\trash\trashbin
    
    
    rem c:\tools\keil\c51\bin\bl51 SLVstart.obj, SLVisr.obj, SLViic.obj, SLVmain.obj, SLVxdata.obj, SLVUmain.obj, SLVUflsh.obj, SXzdata.obj, as.lib TO asl.omf RS(256) IX CO ( ?PR?_SLVUmain?SLVUMAIN (0xE000), ?PR?CUP*)  >protl.log
        c:\tools\keil\c51\bin\bl51 SLVstart.obj, SLVisr.obj, SLViic.obj, SLVmain.obj, SLVxdata.obj, SXzdata.obj, as.lib TO asl.omf RS(256) IX  >protl.log
    
    IF errorlevel=2 GOTO tell
    goto show
    :tell
    echo on
    rem ////////////////////////////////////////
    rem //////////// linker ERRORS /////////////
    rem ////////////////////////////////////////
    rem errors and warnings are in protl.log
    rem link map is in as.m51
    pause
    :show
    echo on
    type protl.log | more
    pause
    @ECHO OFF
    
    del *.lst
    del *.obj
    del *.lib
    rem del *.txt
    del *.log
    
    if "%MUSDEB%"=="0" goto getout
    
    :hexc1
    c:\tools\keil\c51\bin\oh51 asl.omf HEXFILE (..\..\hex\022S%1.hex)
    echo on
    fc ..\..\hex\022S%1.hex ..\mtc\022S%1.hex
    pause
    type x.log
    
    :getout
    cd ..\..\mk
    

  • He asked about object files in the plural - so, surely, that must mean the object files created by the compiler?

    Anyhow, if I misunderstood, he now has both interpretations...

  • It seems like one can't specify the folder for the object files generated by the compiler from the command line.

    I guess I will have to accept the fact that there is object files between my source files.

    I wish I could use the Keil IDE but then I won't be able to use my debugger :(

    Thanks

  • I wish I could use the Keil IDE
    I do not. Once I came to appreciate the total flexibility of running .bat for Keil together with CodeWright (an editor, not a "necesseray part of an IDE that does some editing") and whatever ICE I have for the chip in question there was no "wish to use the Keil IDE" left.

    Erik

  • "It seems like one can't specify the folder for the object files generated by the compiler from the command line."

    You can specify it - just not independently of the object file name.

    It wouldn't be hard to do that in either a makefile or a .bat file...

    "I guess I will have to accept the fact that there is object files between my source files."

    Or you could just add a step immediately after your compiles to move them...

    "I wish I could use the Keil IDE but then I won't be able to use my debugger"

    How does the IDE prevent using your debugger??
    Sure, it wouldn't be "integrated" - but I can't see any reason why you couldn't use uVision to do the builds (and editing, if you like), and a separate debugger for your debugging.

    You could probably even arrange for your debugger to be launched via the uVision 'Tools' menu...