stm32 link 下载bin文件

来源:互联网 发布:网络技术学校 编辑:程序博客网 时间:2024/06/05 07:13

1 命令行下载bin固件, 下面一起航一号的固件qh_1.bin为例子进行的

h
speed 4000
exec device = STM32F103ZE
loadbin F:/qh_1.bin 0x8000000
r
g

首先h暂停开发板运行, 设置速度为4000KHz, 设置芯片类型为 STM32F103ZE, 这一步必不可少, 否则下面的工作将是徒劳.

加载固件(这一步并没有真正加载固件), 复位r这一步显示固件加载的过程, 运行g.


2 Eclipse 使用JLink快速下载bin文件或者hex文件

定义一个文本文件, 加入叫jlink_flash.txt, 内容为

#文件开始

#然后关闭JLink进程
h
speed 4000
exec device = STM32F103ZE
loadbin Debug/qh_1.hex 0x08000000
r
Go
qc #退出jlink命令进程

#文件结束

可以用, 不知怎么搞的, 速度奇慢, 没有jlink command的命令行里一个一个输入命令来的快.

命令用简写的, 但speed不能用s简写, 因为s代表别的意思(Single step the target chip)


3 Jlink命令行参数说明

SEGGER J-Link Commander V4.04a ('?' for help)
Compiled Apr 22 2009 09:58:08
DLL version V4.04a, compiled Apr 22 2009 09:57:51
Firmware: J-Link ARM V8 compiled May 27 2009 17:31:22
Hardware: V8.00
S/N : 805306163 
Feature(s) : RDI,FlashDL,FlashBP,JFlash,GDBFull 
VTarget = 2.853V
Info: TotalIRLen = 9, IRPrint = 0x0011
Info: Found Cortex-M3 r1p1, Little endian.
Info: TPIU fitted.
Info: ETM fitted.
Info: FPUnit: 6 code (BP) slots and 2 literal slots
Found 2 JTAG devices, Total IRLen = 9:
Id of device #0: 0x3BA00477
Id of device #1: 0x06414041
Cortex-M3 identified.
JTAG speed: 5 kHz

Script file read successfully.
Processing script file...


Available commands are:
----------------------
f Firmware info
h halt
g go
Sleep Waits the given time (in milliseconds). Syntax: Sleep <delay>
s Single step the target chip
st Show hardware status
hwinfo Show hardware info
mem Read memory. Syntax: mem <Addr>, <NumBytes> (hex)
w1 Write 8-bit items. Syntax: w1 <Addr>, <Data> (hex)
w2 Write 16-bit items. Syntax: w2 <Addr>, <Data> (hex)
w4 Write 32-bit items. Syntax: w4 <Addr>, <Data> (hex)
wm Write test words. Syntax: wm <NumWords>
is Identify length of scan chain select register
ms Measure length of scan chain. Syntax: ms <Scan chain>
mr Measure RTCK React time. Syntax: mr
q Quit
qc Close JLink connection and quit
r Reset target (RESET)
rx Reset target (RESET). Syntax: rx <DelayAfterReset>
RSetType Set the current reset type. Syntax: RSetType <type>
Regs Display contents of registers
SetBP Set breakpoint. Syntax: SetBP <addr> [A/T] [S/H]
SetWP Set Watchpoint. Syntax: <Addr> [R/W] [<Data> [<D-Mask>] [A-Mask]]
ClrBP Clear breakpoint. Syntax: ClrBP <BP_Handle>
ClrWP Clear watchpoint. Syntax: ClrWP <WP_Handle>
VCatch Write vector catch. Syntax: VCatch <Value>
loadbin Load binary file into target memory.
Syntax: loadbin <filename>, <addr>
SetPC Set the PC to specified value. Syntax: SetPC <Addr>
le Change to little endian mode
be Change to big endian mode
log Enables log to file. Syntax: log <filename>
---- CP15 ------------
rce Read CP15. Syntax: rce <Op1>, <CRn>, <CRm>, <Op2>
wce Write CP15. Syntax: wce <Op1>, <CRn>, <CRm>, <Op2>, <Data>
---- ICE -------------
Ice Show state of the embedded ice macrocell (ICE breaker)
ri Read Ice reg. Syntax: ri <RegIndex>(hex)
wi Write Ice reg. Syntax: wi <RegIndex>, <Data>(hex)
---- ETM -------------
etm Show ETM status
re Read ETM reg. Syntax: re <RegIndex>
we Write ETM reg. Syntax: we <RegIndex>, <Data>(hex)
es Start trace
---- ETB -------------
etb Show ETB status
rb Read ETB register. Syntax: rb <RegIndex>
wb Write ETB register. Syntax: wb <RegIndex>, <Data>(hex)
---- TRACE -----------
TAddBranch TRACE - Add branch instruction to trace buffer. Paras:<Addr>,<BAddr>
TAddInst TRACE - Add (non-branch) instruction to trace buffer. Syntax: <Addr>
TClear TRACE - Clear buffer
TSetSize TRACE - Set Size of trace buffer
TSetFormat TRACE - SetFormat
TSR TRACE - Show Regions (and analyze trace buffer)
TStart TRACE - Start
TStop TRACE - Stop
---- SWO -------------
SWOSpeed SWO - Show supported speeds
SWOStart SWO - Start
SWOStop SWO - Stop
SWOStat SWO - Display SWO status
SWORead SWO - Read and display SWO data
SWOShow SWO - Read and analyze SWO data
SWOFlush SWO - Flush data
---- File I/O --------
fwrite Write file to emulator
fread Read file from emulator
fshow Read and display file from emulator
fdelete Delete file on emulator
fsize Display size of file on emulator
---- Test ------------
thg Run go/halt 1000 times
ts Run step 1000 times
testwspeed Test download speed. Syntax: testwspeed [<Addr> [<Size>]]
testrspeed Test upload speed. Syntax: testrspeed [<Addr> [<Size>]]
testcspeed Test CPU speed. Syntax: testcspeed [<RAMAddr>]
---- JTAG ------------
Config Set number of IR/DR bits before ARM device.
Syntax: Config <IRpre>, <DRpre>
speed Set JTAG speed. Syntax: speed <freq>|auto|adaptive, e.g. speed 2000, speed a
i Read JTAG Id (Host CPU)
wjc Write JTAG command (IR). Syntax: wjc <Data>(hex)
wjd Write JTAG data (DR). Syntax: wjd <Data32>(hex), <NumBits>(dec)
RTAP Reset TAP Controller using state machine (111110)
wjraw Write Raw JTAG data. Syntax: wjraw <NumBits(dec)>, <tms>, <tdi>
rt Reset TAP Controller (nTRST)
---- JTAG-Hardware ---
c00 Create clock with TDI = TMS = 0
c Clock
0 Clear TDI
1 Set TDI
t0 Clear TMS
t1 Set TMS
trst0 Clear TRST
trst1 Set TRST
r0 Clear RESET
r1 Set RESET
---- Connection ------
usb Connect to J-Link via USB. Syntax: usb <port>, where port is 0..3
ip Connect to J-Link ARM Pro or J-Link TCP/IP Server via TCP/IP.
Syntax: ip <ip_addr>
---- Configuration ---
si Select target interface. Syntax: si <Interface>,
where 0=JTAG and 1=SWD.
power Switch power supply for target. Syntax: power <State> [perm],
where State is either On or Off. Example: power on perm
wconf Write configuration byte. Syntax: wconf <offset>, <data>
rconf Read configuration bytes. Syntax: rconf
usbaddr Assign usb address to the connected J-Link: Syntax: usbaddr = <addr>
ipaddr Show/Assign IP address and subnetmask of/to the connected J-Link.
gwaddr Show/Assign network gateway address of/to the connected J-Link.
dnsaddr Show/Assign network DNS server address of/to the connected J-Link.
conf Show configuration of the connected J-Link.
ecp Enable the J-Link control panel.
ipdiscover Discover available devices in network
----------------------
NOTE: Specifying a filename in command line
will start J-Link Commander in script mode.



Script processing completed.

原创粉丝点击