Hello, guys,
I am developing the flash progrmming module for MX29VL160B, and I meet a big problem.
I wanted to use the ‘algorithm’ and ‘working_area’ to perform my erase_check function, then I modified the cfi_erase_check function.
I write my erase_check_code like this:
u32 erase_check_code =
{
0xe2511001, /*loop: sub r1, r1, #1 */
0x0a000002, /* beq done */
0x10d020b2, /* ldrneh r2, [r0], #2*/
0xe1520003, /* cmp r2, r3 */
0x0afffffa, /* beq loop */
0xeafffffe /*done: b done */
};
r0, the address to be read
r1, the memory unit of my flash, is equal to 0x100000
r2, the temp variable to store the content of flash unit
r3, is equal to 0xFFFF
The arm chip is AT91RM9200. I use the internal SRAM for working area, and configure the starting address is 0x200000.
But the program executed abnormal.And the log file showed that:
Debug: arm7_9_common.c:919 arm7_9_debug_entry(): target entered debug from ARM state
Debug: arm7_9_common.c:938 arm7_9_debug_entry(): in debug_entry(), cpsr = 0x600000d3
Debug: arm7_9_common.c:954 arm7_9_debug_entry(): target entered debug state in Supervisor mode
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r0: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r1: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r2: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r3: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r4: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r5: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r6: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r7: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r8: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r9: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r10: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r11: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r12: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r13: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r14: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r15: 0xffffffe8
Debug: arm7_9_common.c:989 arm7_9_debug_entry(): entered debug state at PC 0xffffffe8
Debug: arm920t.c:437 arm920t_post_debug_entry(): cp15_control_reg: 00000078
The PC is 0xffffffe8 after executing the alglrithm code, but my entry point is 0x200000.Obviously, it’s wrong.
I think my erase_check_code may be not correct.Then I use some simple instructions to replace the erase_check_code.The new instructions is:
u32 erase_check_code =
{
0xe2802002, /*add r2, r0, #2 */
0xe2511001, /*subs r1, r1, #1 */
0xe2511001, /*subs r1, r1, #1 */
0xeafffffe /*done: b done */
};
The new codes have no logic fault.But the error is the same:
Debug: arm7_9_common.c:919 arm7_9_debug_entry(): target entered debug from ARM state
Debug: arm7_9_common.c:938 arm7_9_debug_entry(): in debug_entry(), cpsr = 0x200000d3
Debug: arm7_9_common.c:954 arm7_9_debug_entry(): target entered debug state in Supervisor mode
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r0: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r1: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r2: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r3: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r4: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r5: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r6: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r7: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r8: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r9: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r10: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r11: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r12: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r13: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r14: 0x00000000
Debug: arm7_9_common.c:983 arm7_9_debug_entry(): r15: 0xffffffe8
Debug: arm7_9_common.c:989 arm7_9_debug_entry(): entered debug state at PC 0xffffffe8
Debug: arm920t.c:437 arm920t_post_debug_entry(): cp15_control_reg: 00000078
I don’t know why.It is strange.
Help me!Thanks.
Regards