通常大家用KEIL5 编译stm32程序,keil4编译C51程序,两个软件不能同时支持stm32和C51程序的编译,造成许多不便。从网上搜索到网友提供的方法并操作,发现只要将keil5设置下就可以实现同时支持stm32和C51编译的功能,操作方法如下:
首先你要安装好keil5 for arm并**后,然后把安装目录下TOOLS.INI 文件里面添加红字内容
[UV2]
CDB0=UV4\STC.CDB("STC")
ORGANIZATION="Microsoft"
NAME="Microsoft", "1"
EMAIL="1"
ARMSEL=1
USERTE=1
BOOK0="UV4\RELEASE_NOTES.HTM" ("uVision Release Notes",GEN)
RTEPATH="D:\KEIL05\PACK"
DEVICE_BOOKS=
SocketPort=1969854680
[ARM]
PATH="D:\KEIL05\ARM\"
VERSION=5.00
PATH1="C:\Program Files\GNU Tools ARM Embedded\4.7 2012q4\"
TOOLPREFIX=arm-none-eabi-
CPUDLL0=SARM.DLL(TDRV0,TDRV5,TDRV6,TDRV9)
# Drivers for ARM7/9 devices
CPUDLL1=SARMCM3.DLL(TDRV1,TDRV2,TDRV3,TDRV4,TDRV5,TDRV7,TDRV8,TDRV10,TDRV11,TDRV12,TDRV13,TDRV14,TDRV15)
# Drivers for Cortex-M devices
CPUDLL2=SARMCR4.DLL(TDRV7)
# Drivers for Cortex-R4 devices
BOOK0="HLP\RELEASE_NOTES.HTM" ("Release Notes",GEN)
BOOK1="HLP\ARMTOOLS.chm" ("Complete User's Guide Selection",C)
TDRV0=BIN\UL2ARM.DLL("ULINK2/ME ARM Debugger")
TDRV1=BIN\UL2CM3.DLL("ULINK2/ME Cortex Debugger")
TDRV2=BIN\AGDIRDI.DLL("RDI Interface Driver")
TDRV3=BIN\ABLSTCM.dll("Altera Blaster Cortex Debugger")
TDRV4=BIN\lmidk-agdi.dll("Stellaris ICDI")
TDRV5=Signum\SigUV3Arm.dll("Signum Systems JTAGjet")
TDRV6=Segger\JLTAgdi.dll("JTAG / J-TRACE ARM")
TDRV7=Segger\JL2CM3.dll("JTAG / J-TRACE Cortex")
TDRV8=BIN\ULP2CM3.DLL("ULINK Pro Cortex Debugger")
TDRV9=BIN\ULP2ARM.DLL("ULINK Pro ARM Debugger")
TDRV10=NULink\Nu_Link.dll("NULink Debugger")
TDRV11=SiLabs\SLAB_CM_Keil.dll("SiLabs UDA Debugger")
TDRV12=STLink\ST-LINKIII-KEIL_SWO.dll ("ST-Link Debugger")
TDRV13=BIN\CMSIS_AGDI.dll("CMSIS-DAP Debugger")
TDRV14=BIN\DbgFM.DLL("Fast Models Debugger")
TDRV15=PEMicro\Pemicro_ArmCortexInterface.dll("PEMicro
Debugger")
LIC0=TIV74-FXUYI-GI05Q-NP6N4-0EQBH-JEH8Y
[ARMADS]
PATH="D:\KEIL05\ARM\"
PATH1=".\ARMCC\bin\"
CPUDLL0=SARM.DLL(TDRV0,TDRV5,TDRV6,TDRV9)
# Drivers for ARM7/9 devices
CPUDLL1=SARMCM3.DLL(TDRV1,TDRV2,TDRV3,TDRV4,TDRV5,TDRV7,TDRV8,TDRV10,TDRV11,TDRV12,TDRV13,TDRV14,TDRV15)
# Drivers for Cortex-M devices
CPUDLL2=SARMCR4.DLL(TDRV7)
# Drivers for Cortex-R4 devices
BOOK0="HLP\RELEASE_NOTES.HTM" ("Release Notes",GEN)
BOOK1="HLP\ARMTOOLS.chm" ("Complete User's Guide Selection",C)
TDRV0=BIN\UL2ARM.DLL("ULINK2/ME ARM Debugger")
TDRV1=BIN\UL2CM3.DLL("ULINK2/ME Cortex Debugger")
TDRV2=BIN\AGDIRDI.DLL("RDI Interface Driver")
TDRV3=BIN\ABLSTCM.dll("Altera Blaster Cortex Debugger")
TDRV4=BIN\lmidk-agdi.dll("Stellaris ICDI")
TDRV5=Signum\SigUV3Arm.dll("Signum Systems JTAGjet")
TDRV6=Segger\JLTAgdi.dll("JTAG / J-TRACE ARM")
TDRV7=Segger\JL2CM3.dll("JTAG / J-Trace Cortex")
TDRV8=BIN\ULP2CM3.DLL("ULINK Pro Cortex Debugger")
TDRV9=BIN\ULP2ARM.DLL("ULINK Pro ARM Debugger")
TDRV10=NULink\Nu_Link.dll("NULink Debugger")
TDRV11=SiLabs\SLAB_CM_Keil.dll("SiLabs UDA Debugger")
TDRV12=STLink\ST-LINKIII-KEIL_SWO.dll ("ST-Link Debugger")
TDRV13=BIN\CMSIS_AGDI.dll("CMSIS-DAP Debugger")
TDRV14=BIN\DbgFM.DLL("Fast Models Debugger")
TDRV15=PEMicro\Pemicro_ArmCortexInterface.dll("PEMicro
Debugger")
RTOS0=Dummy.DLL("Dummy")
RTOS1=VARTXARM.DLL ("RTX Kernel")
[C51]
PATH="D:\KEIL05\C51\"\" \"
SN=K1DZP-5IUSH-A01UE
VERSION=V9.01
BOOK0="HLP\RELEASE_NOTES.HTM"
("Release Notes",GEN)
BOOK1="HLP\GS51.PDF" ("uVision2
Getting Started",GEN)
BOOK2="HLP\C51.PDF" ("C51 User's
Guide",GEN)
BOOK3="HLP\C51LIB.CHM" ("C51
Library Functions",C)
BOOK4="HLP\A51.PDF" ("Assembler/Utilities",GEN)
BOOK5="HLP\TR51.CHM" ("RTX51
Tiny User's Guide",GEN)
BOOK6="HLP\DBG51.CHM" ("uVision2
Debug Commands",GEN)
BOOK7="HLP\ISD51.CHM" ("ISD51
In System Debugger",GEN)
BOOK8="HLP\FlashMon51.CHM" ("Flash
Monitor",GEN)
BOOK9="MON390\MON390.HTM" ("MON390:
Dallas Contiguous Mode Monitor",GEN)
TDRV0=BIN\MON51.DLL ("Keil Monitor-51
Driver")
TDRV1=BIN\ISD51.DLL ("Keil ISD51
In-System Debugger")
TDRV2=BIN\MON390.DLL ("MON390:
Dallas Contiguous Mode")
TDRV3=BIN\LPC2EMP.DLL ("LPC900
EPM Emulator/Programmer")
TDRV4=BIN\UL2UPSD.DLL ("ST-uPSD
ULINK Driver")
RTOS1=RTXTINY.DLL ("RTX-51 Tiny")
RTOS2=RTX51.DLL ("RTX-51 Full")
LIC0=76PCX-HP74U-IRIXW-QEPXN-32TWY-CALVY
[C251]
BOOK0="HLP\RELEASE_NOTES.HTM"
("Release Notes",GEN)
BOOK1="HLP\GS51.PDF" ("uVision2
Getting Started",GEN)
BOOK2="HLP\C251.PDF" ("C251 User's
Guide",GEN)
BOOK3="HLP\C251LIB.CHM" ("C251
Library Functions",C)
BOOK4="HLP\A51.PDF" ("Assembler/Utilities",GEN)
BOOK5="HLP\DBG251.CHM" ("uVision2
Debug Commands",GEN)
TDRV0=BIN\MON251.DLL ("Keil Monitor-251
Driver")
VERSION=V3.5
添加完成后保存即可,然后将Keil C51安装目录下的C51文件夹复制到KEIL5 for arm的安装目录下即可,最后在STC--ISP烧录软件里找到 STC的C51库文件将其保存到keil 5 for arm 的安装目录下的Uv4文件夹里就完成了。
看下打开keil5 器件选择窗口的显示
重要一步,如果完成以上步骤,编译程序后出错如下
这说明你C51编译的执行文件位置没有改过来,需要在如下窗口,选择的位置就是上面步骤中拷贝到keil5 forarm 中C51文件的位置,选择如下图
好了完成ok,编译下出现如下
ok,完成!这样就不用在打开是stm32 和C51程序时切换软件打开了!