基于Source Insight的CodeWarrior和S32 Design Studio的编译下载脚本

环境:

Source Insight 3.5
CodeWarrior 10.6.4
S32 Design Studio for Power Architecture Version 2017.R1

基于Source Insight的CodeWarrior和S32 Design Studio的编译下载脚本_第1张图片
基于Source Insight的CodeWarrior和S32 Design Studio的编译下载脚本_第2张图片
build.bat
基于CodeWarrior

@echo off
@title build script
setlocal EnableDelayedExpansion

;SET BUILD_TOOLS="D:\Freescale\CW MCU v10.6.4\eclipse\ecd.exe"
;SET WORKSPACE=XXXXXX 替换为对应的源码工程路径

;cd /d %~dp0\..\
;rem Gets the folder name of the current file
;SET lj=%cd%
;SET lj=%lj:\= %
;for %%a in (%lj%) do set wjj=%%a

;SET PROJECT=%WORKSPACE%\%wjj%

SET BUILD_TOOLS="D:\Freescale\CW MCU v10.6.4\eclipse\ecd.exe"
SET PROJECT=%~dp0\..\
SET WORKSPACE=%~dp0\..\..\

if %1% == ALL (
	SET TARGET=XXX	;XXX替换为对应的目标工程
	%BUILD_TOOLS% build -data %WORKSPACE% -project %PROJECT% -config !TARGET!
	
	IF !ERRORLEVEL! NEQ 0 (
		echo BUILD ERROR:!TARGET!
		pause
		exit
	)
	echo.
	echo BUILD SUCCESS:ALL!
	exit
)

for %%a in (%*) do (
	SET TARGET=%%a
	rem %BUILD_TOOLS% build -data %WORKSPACE% -project %PROJECT% -config %TARGET%
	%BUILD_TOOLS% build -data %WORKSPACE% -project %PROJECT% -config !TARGET!
	
	IF !ERRORLEVEL! NEQ 0 (
		echo BUILD ERROR:!TARGET!
		pause
		exit
	)
)

echo.
echo BUILD SUCCESS:ALL!

rem clean build
rem %BUILD_TOOLS% build -data %WORKSPACE% -project %PROJECT% -config %TARGET% -cleanBuild

rem SET PATH_make="D:\NXP\S32DS_Power_v2017.R1\utils\msys32\usr\bin"

rem SET PATH_make="D:\Freescale\CW MCU v10.6.4\gnu\bin"
rem SET PATH=%PATH_make%;%PATH%
rem cd xxxx	;xxxx	替换为对应的目标工程路径
rem mingw32-make j8 -all

基于S32 Design Studio

@echo off

SET PATH_make="D:\NXP\S32DS_Power_v2017.R1\utils\msys32\usr\bin"
SET PATH_1="D:\NXP\S32DS_Power_v2017.R1\Cross_Tools\powerpc-eabivle-4_9\bin"

SET PATH_build="E:\workspaceS32DS.Power.2017.R1\freertos_mpc5746c\Debug_FLASH"

SET PATH=%PATH_make%;%PATH_1%;%PATH%

cd %PATH_build%

make -j4 all

pause

download.txt:

target remote localhost:7224 
load XXXXXX;对应的目标文件E:/CODE/XXX/XXX.elf

download.bat:

@echo off
@title download script

SET PATH1=D:\NXP\S32DS_Power_v2017.R1\eclipse\plugins\com.pemicro.debug.gdbjtag.ppc_1.7.2.201709281658\win32\pegdbserver_power_console
SET PATH2=D:\NXP\S32DS_Power_v2017.R1\Cross_Tools\powerpc-eabivle-4_9\bin\powerpc-eabivle-gdb.exe

SET TARGET=%1%
SET PATH3=%cd%
cd ..
set dir_make=%cd%
echo dir_make=%dir_make%
set disk=%dir_make:~0,1%
set dir_make=%dir_make:\=/%
set dir_new=%dir_make:~3%
echo dir_new=%dir_make%
set dir_new=%disk%:/%dir_new%
echo dir_new=%dir_make%

echo target remote localhost:7224 > %PATH3%/download.txt
echo load %dir_new%/%TARGET%/%TARGET%.elf >> %PATH3%/download.txt

start cmd /k "%PATH1% -device=XXXXXX -startserver -singlesession -serverport=7224 -gdbmiport=6224 -interface=USBMULTILINK -speed=5000"	;XXXXXX替换为相应的芯片型号

start cmd /k "%PATH2% --command=%PATH3%/download.txt"

在Source Insight 3.5中,绑定了相应的快捷键:Build(Ctrl + B) Download(Ctrl + D),在编辑器里修改好代码之后,可以直接编译和下载,非常方便,有兴趣的可以试试!

你可能感兴趣的:(BAT脚本)