相信这是最完美的在VS2013下编辑 编译 下载 STM32程序

2019-12-19 18:11发布

本帖最后由 solojimes 于 2013-12-19 16:46 编辑

如题
辛苦钻研了一个下午
待会儿上视频 优酷链接


http://v.youku.com/v_show/id_XNjQ5ODE4NDk2.html

如果我的心中还有什么颜 {MOD},那定是如暮霭般的温暖。
TSTT.rar (1.08 MB, 下载次数: 246) 2013-12-18 14:47 上传 点击文件名下载附件
清晰视频


例程 VS2103 KEIL安装在C盘  F7 bulid CTRL+ D  下载
RTT_Demo_stm32f10x.rar (8.4 MB, 下载次数: 181) 2013-12-19 16:45 上传 点击文件名下载附件

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
74条回答
surken
2019-12-26 00:06
一个不太完善的C51批处理
::----------------------------------------------------------------------------
@echo off
@rem Keil C51 Makefile Template written by Gavin.

::----------------------------------------------------------------------------
@rem Set the environment settings
set PATH=C:KeilC51BIN;%PATH%
set C51INC=C:KeilC51INC
set C51LIB=C:KeilC51LIB

@rem Set the source directory
set SRCDIR=Source

@rem Set the Output directory
set OBJDIR=Debug

@rem Set the Target file name
set TARGET=MCS51_Sample.hex

@rem Compiler & Linker Options
set CFLAGS=OPTIMIZE (9,SPEED) REGFILE (%OBJDIR%\%TARGET:.ORC=%) BROWSE ^
DEFINE (MASTER="1",_DEBUG) DEBUG OBJECTEXTEND

set AFLAGS=NOMOD51 SET (SMALL) DEBUG EP

set LDFLAGS=TO %OBJDIR%\%TARGET:.hex=% REGFILE (%OBJDIR%\%TARGET:.ORC=%) ^
RAMSIZE(256) DISABLEWARNING (15) CODE( 0X0800-0X3FFF ) XDATA( 0x0100-0x0800,0XE000-0XE1FF )
::----------------------------------------------------------------------------
@rem Find all .lib files
set LOBJ=
SetLocal EnableDelayedExpansion
for /r "%SRCDIR%" %%i in (*.lib) do (
set LOBJ=!LOBJ!%%i,
@echo off
)

@rem Build all .a51 files
set AOBJ=
SetLocal EnableDelayedExpansion
for /r "%SRCDIR%" %%i in (*.a51,*.asm) do (
set AOBJ=!AOBJ!%%i,
%rem compile the project files
echo compiling %%i...
A51 %%i "%AFLAGS%" > %OBJDIR%TMP.log
if errorlevel 2 goto :FAILED
if errorlevel 3 goto :FAILED
)

@rem Build all .c files
set COBJ=
SetLocal EnableDelayedExpansion
for /r "%SRCDIR%" %%i in (*.c) do (
set COBJ=!COBJ!%%i,
%rem compile the project files
echo compiling %%i...
C51 %%i "%CFLAGS%" > %OBJDIR%TMP.log
if errorlevel 2 goto :FAILED
if errorlevel 3 goto :FAILED
)

%rem Link all .obj files
echo Linking...
BL51 %COBJ:.c=.obj%%AOBJ:.a51=.obj%%LOBJ:.lib=.lib%%C51LIB%C51S.lib "%LDFLAGS%" > %OBJDIR%TMP.log

if errorlevel 2 goto :FAILED
if errorlevel 3 goto :FAILED

%rem Create hex file
OH51 %OBJDIR%\%TARGET:.hex=% HEXFILE(%OBJDIR%\%TARGET%) >nul
goto :SUCCESS

::----------------------------------------------------------------------------
:FAILED
echo Compile Errors!Can't Creat Hex File!>> %OBJDIR%TMP.log
call :LOGFILE
exit 1

:SUCCESS
%rem Delete all temp files
del %OBJDIR%\%TARGET:.hex=%
for /r "%SRCDIR%" %%i in (*.obj) do del %%i
for /r "%SRCDIR%" %%i in (*.lst) do del %%i
for /r "%OBJDIR%" %%i in (*.m51) do del %%i

echo Compile Success!Creat Hex File:%OBJDIR%\%TARGET% >> %OBJDIR%TMP.log
call :LOGFILE
exit 0

::----------------------------------------------------------------------------
:LOGFILE
cd. > %OBJDIR%Build.log
for /f "skip=3 delims=" %%i in (%OBJDIR%TMP.log) do (
echo %%i >> %OBJDIR%Build.log)

for /f "delims=" %%i in (%OBJDIR%Build.log) do (
echo.%%i
)
del %OBJDIR%TMP.log
del %OBJDIR%Build.log

如果能将Build.log文件中的错误信息修改为VS能识别的格式就可以实现错误行定位了,可惜我批处理是一知半解。

一周热门 更多>