13.12.2012 Views

emWin - SEGGER Microcontroller

emWin - SEGGER Microcontroller

emWin - SEGGER Microcontroller

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

38 CHAPTER Getting Started<br />

Adapting Prep.bat<br />

Prep.bat is called at the beginning of Makelib.bat. As described above its job is to<br />

set the environment variables for the used tools and the environment variable PATH,<br />

so that the batch files can call the tools without specifying an absolute path. Assuming<br />

the compiler is installed in the folder C:\MTOOL the file Prep.bat could look as follows:<br />

@ECHO OFF<br />

SET TOOLPATH=C:\MTOOL<br />

REM ******************************************************************<br />

REM Set the variable PATH to be able to call the tools<br />

SET PATH=%TOOLPATH%\BIN;%TOOLPATH%\LIB308;%PATH%<br />

REM ******************************************************************<br />

REM Set the tool internal used variables<br />

SET BIN308=%TOOLPATH%\BIN<br />

SET INC308=%TOOLPATH%\INC308<br />

SET LIB308=%TOOLPATH%\LIB308<br />

SET TMP308=%TOOLPATH%\TMP<br />

Adapting CC.bat<br />

The job of CC.bat is to compile the passed source file and adding the file name of the<br />

object file to a link list. When starting MakeLib.bat it creates the following subdirectories<br />

relative to its position:<br />

Directory Contents<br />

Lib This folder should contain the library file after the build process.<br />

Temp\Output<br />

Temp\Source<br />

The object file should be created (or moved) to Temp\Output. This makes sure all the<br />

output will be deleted after the build process. Also the link list should be located in<br />

the output folder. The following shows an example for the Mitsubishi compiler:<br />

@ECHO OFF<br />

GOTO START<br />

REM ******************************************************************<br />

REM Explanation of the used compiler options:<br />

-silent : Suppresses the copyright message display at startup<br />

-M82 : Generates object code for M32C/80 Series (Remove this switch<br />

for M16C80 targets)<br />

-c : Creates a relocatable file (extension .r30) and ends processing<br />

-I : Specifies the directory containing the file(s) specified in #include<br />

-dir : Specifies the destination directory<br />

-OS : Maximum optimization of speed followed by ROM size<br />

-fFRAM : Changes the default attribute of RAM data to far<br />

-fETI : Performs operation after extending char-type data to the int type<br />

(Extended according to ANSI standards)<br />

:START<br />

REM ******************************************************************<br />

REM Compile the passed source file with the Mitsubishi NC308 compiler<br />

NC308 -silent -M82 -c -IInc -dir Temp\Output -OS -fFRAM -fETI Temp\Source\%1.c<br />

REM ******************************************************************<br />

REM Pause if any problem occurs<br />

IF ERRORLEVEL 1 PAUSE<br />

REM ******************************************************************<br />

REM Add the file name of the object file to the link list<br />

ECHO Temp\Output\%1.R30>>Temp\Output\Lib.dat<br />

Adapting Lib.bat<br />

Should contain all the compiler output and the link list file. Will be deleted after<br />

the build process.<br />

MakeLib.bat uses this folder to copy all source and header files used for the<br />

build process. Will be deleted after the build process.<br />

After all source files have been compiled Lib.bat will be called from MakeLib.bat.<br />

The job is to create a library file using the link list created by CC.bat. The destination<br />

folder of the library file should be the Lib folder created by MakeLib.bat. The following<br />

shows an example for the Mitsubishi librarian:<br />

UM03001 User & Reference Guide for <strong>emWin</strong> V5.18 © 1997 - 2012 <strong>SEGGER</strong> <strong>Microcontroller</strong> GmbH & Co. KG

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!