The following sample batch file structure shows how code can be generated from a user application UML model and deployed into the IDE. This sample is based on IBM Rational Rhapsody as modeling tool and Keil uVision as IDE.
- Code: Select all
rem ==== STEP 1 ====
rem Generate/build model using RhapsodyCL
@echo on
cd "<Rhapsody path>"
RhapsodyCL.exe -verbose -dev_ed -lang=C -cmd=open "<model dir>\<model name>.rpy" -cmd=generate -cmd=syncmake
@if ERRORLEVEL 1 (
echo Errorlevel of RhapsodyCL: %errorlevel%
echo List of error codes from Rhapsody help:
echo 100: failed to open the project file
echo 101: license not found
echo 102: code generation failed
echo 103: failed to load the project
echo 104: failed to create/write CG folder
echo 105: errors were found in check model
echo 106: unresolved elements in scope
echo 107: comp. or configuration name error
echo 108: build failed
exit /b %errorlevel%
)
@echo off
rem ==== STEP 2 ====
rem Use the WSTDeployer without need for the RhapsodyAPI to deploy files to the compiler toolchain
cd /d "<Willert RXF path>\Tools\WSTDeployer"
java -classpath bin;WSTDeployer.jar;log4j-1.2.14.jar;jdom.jar;"<Rhapsody path>\Share\JavaAPI\rhapsody.jar" -Djava.library.path="<Rhapsody path>\Share\JavaAPI" wst.WSTDeployer debug version "setSourceDir(<path to generated sources>)" "setDestProj(<path to IDE project file>)" version deploy
@if ERRORLEVEL 1 (
echo Errorlevel of Deployer Java call: %errorlevel%
exit /b %errorlevel%
)
rem ==== STEP 3 ====
rem Build IDE project from command line
"<Keil path>\UV4\Uv4.exe" -r "<path to IDE project file>"
... -o "<build result path>\BuildLog.txt"
@if ERRORLEVEL 1 (
echo Errorlevel of compiler toolchain build: %errorlevel%
exit /b %errorlevel%
)
@type "<build result path>\BuildLog.txt"
@if ERRORLEVEL 1 (
echo Could not find compiler toolchain build log file.
exit /b %errorlevel%
)
@if not exist "<build result path>\<hex or elf file>" (
echo Could not find expected build output file
exit /b 1
)
Please Note: Please note this is just a sample configuration and the automated build process may vary massively for different combinations of tools.