One of the common tasks is switching back and forth between the different modules that make up a SecureCore Tiano™ project. These modules are listed in the Project.def file in the project's directory. For example, you might see:
Module Build, 000, BUILD // location of the MAKEFILE.
...other modules...
Module Pentium, 000, CPU // use Pentium CPU module.
Module Cantiga, 000, NB // use Cantiga Chipset module.
Module ICH9, 000, SB // use ICH9 South Bridge module.
Now you want to switch back and forth between the project directory and one of these modules. Here's a simple batch file that let's you type: module Pentium or module CPU and it will take you there. It does require you to set the PROJECTROOT and PROJECTTIP environment variables first (see su.bat from this blog before). And it requires that you have built the project before.
Tim
@if not "%1" == "" goto projecttip
@echo.
@echo Usage:
@echo module module-name
@echo.
@echo Options:
@echo module-name Name of the SecureCore Tiano(TM) module.
@echo.
@echo Description:
@echo This script changes the directory to the component specified in the
@echo 'project.def' file. Must be run after 'su.bat' For example, if
@echo 'project.def' says:
@echo.
@echo Module Pentium, 000, CPU
@echo.
@echo You would type: Module Pentium OR Module CPU
@echo.
@echo.
@goto exit
:projecttip
@IF NOT "%PROJECTTIP%"=="" GOTO STEP1
@echo PROJECTIP is not set.
goto exit
:STEP1
@IF EXIST "%PROJECTTIP%\temp\project.env" GOTO STEP2
@echo Project %PROJECTTIP% not built.
goto exit
:STEP2
@FOR /F "tokens=1,3" %%G IN (%PROJECTTIP%\temp\project.env) DO @IF /I "%%G"=="SCT_MODULE_%1" CD %PROJECTROOT%\%%H && @EXIT /B 0
@FOR /F "tokens=1,3" %%G IN (%PROJECTTIP%\temp\project.env) DO @IF /I "%%G"=="SCT_PATH_%1" CD %PROJECTROOT%\%%H && @EXIT /B 0
:exit