Fast Embedded Software Development with 4 small batch files for file transfer, remote compile, receive of compiler messages by network. no installation efforts, using a portable open source command line tool for Windows and Linux.
|
Embedded Software Development usually means:
- source editing is done under Windows,
as many specialized tools for
development exist only there.
- compile for many different platforms, or toolchains (arm8, arm9, i686 ...).
- compile for many different target devices.
- compile on a Linux build server, as all toolchains and libraries
are configured only there, with complex build scripts
developed over years.
|
Overview: Embedded Development
|
Sync sources, Compile, Send binaries - Step by Step
No matter what version control system you use, there must be a repository folder
on your local disk containing many checked-out projects, like:
C:\repos\m3player
C:\repos\m5player
C:\repos\cleaner1
C:\repos\cleaner2
...
Furthermore, there must be an identical repository folder on the build server,
in your user's home folder. so normally you upload changed source files,
then compile manually on the build server.
Example project: compile and run "m5player" instantly
You changed the source code, and now you want to:
- compile project m5player
- compile it for arm8 architecture
- then run it on a target with IP .188
In the Windows command line, go into C:\repos, then type:
xmake.bat m5 arm8 188
The xmake batch will:
- expand short parameters like "m5" to "m5player"
- upload changed source files from m5player to the build server.
this requires:
- xmakeserv.sh running on the build server, in your repos folder.
- sfk for Windows binary on your Windows PC.
- sfk for Linux (i686) binary on the Linux build server.
- upload a small batch file xmakerem.sh
to the build server,
which contains commands
to call the build system.
xmakerem.sh is located primarily on your Windows PC
so you can edit it easily anytime.
- run xmakerem.sh on the build server.
Any text outputs from the compile, especially error messages, are sent back to your PC.
You can display them:
If xmakerem.sh sucessfully creates a binary,
- this is then sent to target 192.168.1.188 as a file like binary.new,
which requires
- xmaketarg.sh running on your target
- sfk for Linux/ARM binary on the target
- capability of your firmware running on .188
to rename binary.new
to it's own binary name and then to restart itself.
The firmware on .188 may send trace outputs via network to some trace tool
written by your company.
Ideally this trace tool contains an option to forward text
as plain UDP to any other port,
so you can read the firmware traces also
directly in Depeche View by
Network Text.
Appendix: SFK/XMake batch files
xmake.bat: called manually on the command line, or by a script from DView Pro
@echo off
set PRODUCT=%1
set TOOLCHAIN=%2
set TARGET=%3
set CLEAN=%4
IF NOT "%TOOLCHAIN%"=="" GOTO haveparms
echo "usage : xmake product architecture targetip [clean]"
echo "example: xmake m3 bbb 192.168.1.100"
echo " xmake m5 a13 192.168.1.200 clean"
GOTO end
:haveparms
set LOCAL_WORKDRIVE=c:
set LOCAL_WORKDIR=c:\work
set BUILD_SERVER=192.168.1.101:2201
set TRANSFER_PW=mycmdpw123
set LOG_TARGET=192.168.1.100
set TARGET_NET=192.168.1
set SFK_LOGTO=term,net:%LOG_TARGET%
set FTPOPT=-nohead -quiet -noprog
set TONETLOG=sfk filt "-! files of*sent" -lshigh cyan "<*" +tonetlog
set SFK_FTP_PW=%TRANSFER_PW%
IF "%PRODUCT%"=="m3" (set PRODUCT=m3player)
IF "%PRODUCT%"=="m5" (set PRODUCT=m5player)
sfk -quiet strlen "%TARGET%"
IF %ERRORLEVEL% LEQ 3 (set TARGET=%TARGET_NET%.%TARGET%)
sfk echo "[green]=== xmake: %PRODUCT% %TOOLCHAIN% for %TARGET% [def]" +tolog
IF "%CLEAN%"=="clean" ( SET CLEAN="1" ) ELSE ( SET CLEAN="0" )
%LOCAL_WORKDRIVE%
cd %LOCAL_WORKDIR%
sfk -quiet=2 remcr xmakerem.sh
sfk select xmakerem.sh +sft %FTPOPT% %BUILD_SERVER% cput -yes | %TONETLOG%
sfk select -dir %PRODUCT% -file !.bak !.tmp +sft %FTPOPT%
%BUILD_SERVER% cput -yes | %TONETLOG%
del xmakerem.log
sfk sft %FTPOPT% %BUILD_SERVER% run "bash xmakerem.sh %PRODUCT% %TOOLCHAIN%
%TARGET% %CLEAN% %LOG_TARGET% >xmakerem.log 2>&1" -yes | %TONETLOG%
sfk sft %FTPOPT% %BUILD_SERVER% get xmakerem.log
type xmakerem.log
sfk echo "[green]=== xmake done. ===[def]" +tolog
:end
All batch files for direct reading:
All batch files in one .zip package:
xmakebatch.zip
sfk command line tool sources and binaries for all platforms:
sfk.zip
DView Pro example script to call xmake.bat by a click or hotkey:
netlog clear
netlog follow
first.echo "compile remote"
first.runback "xmake.bat" $1 $2 $3 $shift
first.sleep 300
first.activate
|