使用J-LinkV8
IAR版本6.6
调试串口波特率:115200
实验现象:
编译并下载调试程序,根据串口提示信息进行测试,swap前我们读取0x0000和0x80000地址的数据,swap后再次读取0x0000和0x80000的数据,发现swap后相同,也就是说swap操作把0x0000-0x7ffff的数据块覆盖了0x80000-0xfffff的数据块。
串口输出信息:
External Pin Reset
K70-256pin Silicon rev 1.0
Flash parameter version 0.0.8.0
Flash version ID 1.0.18.0
/********************************************************/
/* Flash Block Swap Demo */
/********************************************************/
Program Flash Half 1 (Blocks 2/3) located at address 0x0000
Executing from Program Flash Half 1 (Blocks 2/3)
Initializing Flash Driver: Success!
Checking Swap System Status: Success!
Swap Mode: Ready
help Help help <cmd>
set Set Config set <option value>
show Show Config show <option>
r FTFL read long words r <addr>
swap FTFL pflash swap firmware update demo swap
FTFL>r 0x0
00000000: 2000FFF8
FTFL>r 0x80000
00080000: FFFFFFFF
FTFL>swap
/********************************************************/
/* Swap Demo - Update Firmware and Swap */
/********************************************************/
Swap Mode: Ready
Swap Mode: Update
Simulating Firmware Update: Erasing
Erase First Block of Upper Half: Success!
Verify First Block of Upper Half: Success!
Erase Second Block of Upper Half: Success!
Verify Second Block of Upper Half: Success!
Swap Mode: Update Erased
Simulating Firmware Update: Programming
Copying contents of the lower half to the upper half
avoiding swap indicator location
Copying : Success!
Checking contents: Success!
Swap Mode: Complete
Swap Success!
Performing Software Reset
in 1 seconds...
Software Reset
K70-256pin Silicon rev 1.0
Flash parameter version 0.0.8.0
Flash version ID 1.0.18.0
/********************************************************/
/* Flash Block Swap Demo */
/********************************************************/
Program Flash Half 0 (Blocks 0/1) located at address 0x0000
Executing from Program Flash Half 0 (Blocks 0/1)
Initializing Flash Driver: Success!
Checking Swap System Status: Success!
Swap Mode: Ready
help Help help <cmd>
set Set Config set <option value>
show Show Config show <option>
r FTFL read long words r <addr>
swap FTFL pflash swap firmware update demo swap
FTFL>r 0x0000
00000000: 2000FFF8
FTFL>r 0x80000
00080000: 2000FFF8
FTFL>
K70FN1M0VMJ12的Flash地址
源码:
018片上1MFlash_Block_Swap演示_IAR.part01.rar
(900 KB)
018片上1MFlash_Block_Swap演示_IAR.part02.rar
(900 KB)
018片上1MFlash_Block_Swap演示_IAR.part03.rar
(250.81 KB)
|