本帖最后由 power568 于 2019-1-24 12:29 编辑 8 q/ x0 ~$ W! H4 C0 Q
) Y/ P3 F) G, ~* g 最近将一个IAR下的M4的程序移植到M7上,移植之前M4的程序因为没有硬件没有验证过,当修改为所有的参数,编译都正确后仿真时,在下载过程中报了好多的警告——地址数据校验错误,错误如下:- Thu Jan 24, 2019 07:33:44: Verify error at address 0x000080D1, target byte: 0x40, byte in file: 0x30
+ M& L$ `; @% S - Thu Jan 24, 2019 07:33:44: Warning: 7 L# w7 z- C! D3 g5 G
- Thu Jan 24, 2019 07:33:44: Verify error at address 0x000080D2, target byte: 0x00, byte in file: 0xDF % K: [5 y& m( B: @( z3 n/ X
- Thu Jan 24, 2019 07:33:44: Warning: % C; O0 P3 W. w; w+ M' z0 d
- Thu Jan 24, 2019 07:33:44: Verify error at address 0x000080D3, target byte: 0x80, byte in file: 0xF8 " O V$ R2 v9 F6 H+ t' @) j
- Thu Jan 24, 2019 07:33:44: Warning: Too many verify errors, only the first 200 are displayed
4 [8 ^+ s- B9 H6 s& U( m7 ] - Thu Jan 24, 2019 07:34:13: Warning: There were warnings during download, see Log Window , ^- _ a& \4 K: z) s' I, L. m# w
- Thu Jan 24, 2019 07:34:13: Loaded debugee: D:\Test\pri\iar\STM32746G-EVAL2\Exe\OS3.out 7 J- y+ P6 [% Y
- Thu Jan 24, 2019 07:34:13: Hardware reset with strategy 0 was performed 7 {; A m+ k0 q% N) E9 n% i& s
- Thu Jan 24, 2019 07:34:13: Target reset 8 R0 r% L( [ b7 ]
- Thu Jan 24, 2019 07:34:14: Failed to enable illegal breakpoint definition '{D:\Test\pri\app_main.c}.211.5' i% C- ?9 V$ a
- Thu Jan 24, 2019 07:34:14: Failed to enable illegal breakpoint definition '{D:\Test\pri\app_main.c}.180.5'
$ z l4 B3 ?' Q* ^/ O7 ^ - Thu Jan 24, 2019 07:34:14: Failed to enable illegal breakpoint definition '{D:\Test\pri\IAR\os_cpu_a.asm}.188.1' 3 D4 z( _7 f+ T( l1 ^5 K1 O; X" P
- Thu Jan 24, 2019 07:34:14: One or more breakpoints could not be set and have been disabled. 8 b3 Q g6 F& q+ I
- Thu Jan 24, 2019 07:34:43: There were 2 warnings during the initialization of the debugging session. ! L6 `) V: G: p+ \9 _
- Thu Jan 24, 2019 07:36:00: HardFault exception. ! h5 x1 s5 A: |! R
- Thu Jan 24, 2019 07:36:00: The processor has escalated a configurable-priority exception to HardFault. 5 v% \: s) A: m. Y+ ?
- Thu Jan 24, 2019 07:36:00: A bus fault has occurred on an instruction prefetch.
2 ^* Q8 w, t0 \- a - Thu Jan 24, 2019 07:36:00:
. w: ?4 ?7 f7 Y2 V; }& U - Thu Jan 24, 2019 07:36:00: Exception occured at: 0x0 ; j$ U7 d4 V& [: ^, K
- Thu Jan 24, 2019 07:36:00: + f: m* [" P; d/ o. h, v+ O
- Thu Jan 24, 2019 07:36:00: See the call stack for more information.
复制代码 然后IAR就报错:
# p. d4 {* B( t) ]6 ^! R
! J! u( d+ _9 u o5 N: D 一开始还以为没问题,点击OK继续执行,结果是程序直接跑飞了:
3 k4 a* p8 s$ Y& x6 i- Z2 P
$ L! e( O: y3 m3 m' n6 m
卡在了某个位置。然后问度娘,大概的意思是工程的配置不对,但是试了几个方法都没有凑效。于是自己使用STM32CubeMx新建了一个可以运行的工程,然后比较工程配置,最终发现是因为options->linker->config下的linker configuration file没设置flash的icf文件导致的,见下图:
% B% P9 T9 Z: q7 A. }/ C+ u3 h9 @
# f, Z( V+ ^7 ?$ `# J 选择正确的flash的icf后程序运行正常。9 A; \9 ?1 o1 v8 C4 o: `# y8 ^& k# X
7 @' }7 f# H/ t |
顺便想问一下,你见M4工程的时候上选择这个地方了吗?你是怎么移植的?是不是在原来的工程是直接修改而得。而不是将工程中的核心文件放到新建的IAR工程里面?
将M4工程里的相关文件更换为M7的即可,当然会遇到不少的问题,哈哈哈...