We found a problem recently ：malloc Several groups of values come out （UINT32） It's always changing , There is always room to change him .
hardware platform ：zynq 7045. software platform ucos II operating system .
This kind of problem is very difficult to locate , It is possible that the array is out of bounds , It's possible that the wild pointer and so on .
But good luck , I found the artifact ：DS5.
1.DS5 Use of
Hardware connection is needless to say , Software start .
1.1 Establishment project .
Test code into ds5 Under the table of contents workspace
choice Existing Projects into Workspace, choice next,
I've added it , So it can't be added again , Select after adding finish that will do .
1.2 debug information .
Right click DS-5 Debugger choice new.
connection Under the table of contents Select the corresponding platform . I am zynq Then choose bare metal （ There are linux）.
file Select the compiled one elf Format file ：
Debugger choice connect only
os awareness Select the corresponding bare metal operating system
Then choose debug that will do .
1.3 start debug
Corresponding separately run, stop it Single step debugging and other information .
0x60b284 Address for stampede ： increase watch point
watch point monitor 0x60b284 == 3 When , Seize the scene . And then through the mw（ Change memory instruction ）, Change the address value to 3, You can catch it mw Thread . The picture is as follows ：
here cpu stop, Then change it again watch ponit monitor 0x60b284 Not for 3 Grasp the scene when conditions permit .
Finally found out PC The pointer points to 0x10ADB8. hold elf Format file for disassembly arm-linux-gcc-objdump - D xxxx.elf >
open xxx.txt, lookup 0x10ADB8 Function of address or nearby address ：
You can see that it happens to be in this function , There was an error in pushing the stack ：
To confirm , You can view it ds-5 Medium cpu Of r0-r4 register ：
Exactly the same , Confirmed the existence of the error . Have to say DS-5 It's a magic weapon ：
You can see that the memory map is wrong ,irq The stack in mode is set to malloc Area .