本帖最后由 power568 于 2019-1-24 12:29 编辑
6 _' ^) r, s8 R% `
( g" u/ w6 @: X$ O% V 最近将一个IAR下的M4的程序移植到M7上,移植之前M4的程序因为没有硬件没有验证过,当修改为所有的参数,编译都正确后仿真时,在下载过程中报了好多的警告——地址数据校验错误,错误如下:- Thu Jan 24, 2019 07:33:44: Verify error at address 0x000080D1, target byte: 0x40, byte in file: 0x30 ; {$ Z- A( O- c% q( V) O
- Thu Jan 24, 2019 07:33:44: Warning:
" n! T+ b" w5 d1 E& G' f. \ - Thu Jan 24, 2019 07:33:44: Verify error at address 0x000080D2, target byte: 0x00, byte in file: 0xDF
' \, d8 i/ N1 B4 u - Thu Jan 24, 2019 07:33:44: Warning:
4 {: V! C; D, W0 e: z - Thu Jan 24, 2019 07:33:44: Verify error at address 0x000080D3, target byte: 0x80, byte in file: 0xF8
/ s7 g7 b5 s: _0 Y/ c. J- b - Thu Jan 24, 2019 07:33:44: Warning: Too many verify errors, only the first 200 are displayed
5 [; q( I# c, ~( G5 ?8 w! S - Thu Jan 24, 2019 07:34:13: Warning: There were warnings during download, see Log Window * V0 i2 Q5 C h+ c. r
- Thu Jan 24, 2019 07:34:13: Loaded debugee: D:\Test\pri\iar\STM32746G-EVAL2\Exe\OS3.out % c# q' \+ S/ M: d# G. `
- Thu Jan 24, 2019 07:34:13: Hardware reset with strategy 0 was performed
* y0 v2 U- n1 t# S1 N* R - Thu Jan 24, 2019 07:34:13: Target reset
. |! }1 P2 }* \9 ^ I4 r - Thu Jan 24, 2019 07:34:14: Failed to enable illegal breakpoint definition '{D:\Test\pri\app_main.c}.211.5'
- S) y7 Y1 {, m: G- d* h4 C3 d - Thu Jan 24, 2019 07:34:14: Failed to enable illegal breakpoint definition '{D:\Test\pri\app_main.c}.180.5'
. [5 n6 Z7 @1 f/ Q, O, o. i - Thu Jan 24, 2019 07:34:14: Failed to enable illegal breakpoint definition '{D:\Test\pri\IAR\os_cpu_a.asm}.188.1'
. {" S* p0 a9 `. o% L - Thu Jan 24, 2019 07:34:14: One or more breakpoints could not be set and have been disabled. , X2 R* e" c. i" h0 t
- Thu Jan 24, 2019 07:34:43: There were 2 warnings during the initialization of the debugging session.
7 D! l3 }, n# _4 [ - Thu Jan 24, 2019 07:36:00: HardFault exception.
) [# E9 `$ e F2 y- q8 y- U - Thu Jan 24, 2019 07:36:00: The processor has escalated a configurable-priority exception to HardFault. " \7 D% a% ?) ?& r* l! b
- Thu Jan 24, 2019 07:36:00: A bus fault has occurred on an instruction prefetch. # |' K j: [! M
- Thu Jan 24, 2019 07:36:00:
, f! L1 H G' r } - Thu Jan 24, 2019 07:36:00: Exception occured at: 0x0 4 r1 R7 [# Z6 X
- Thu Jan 24, 2019 07:36:00: - @* h5 y) e0 L4 z9 @2 H9 B. ]
- Thu Jan 24, 2019 07:36:00: See the call stack for more information.
复制代码 然后IAR就报错:; e6 C! W) s$ U
5 U& `' z0 E" A
一开始还以为没问题,点击OK继续执行,结果是程序直接跑飞了:
+ S& S, {% Y5 x! B5 x/ r! Q
* Y1 ]9 C, `6 ^5 ]# `8 F$ I
卡在了某个位置。然后问度娘,大概的意思是工程的配置不对,但是试了几个方法都没有凑效。于是自己使用STM32CubeMx新建了一个可以运行的工程,然后比较工程配置,最终发现是因为options->linker->config下的linker configuration file没设置flash的icf文件导致的,见下图:
. L! K% Q4 A9 o, \/ q$ Y
, Z. m% `& K* v1 v5 N" e5 T
选择正确的flash的icf后程序运行正常。
( x" _) z5 |7 u4 E0 S' h* P* l9 X7 F+ G6 i
|
顺便想问一下,你见M4工程的时候上选择这个地方了吗?你是怎么移植的?是不是在原来的工程是直接修改而得。而不是将工程中的核心文件放到新建的IAR工程里面?
将M4工程里的相关文件更换为M7的即可,当然会遇到不少的问题,哈哈哈...