elRey
|
|
« on: March 14, 2016, 12:47:41 PM »
|
|
|
Let me first ask when scanning DTC I might see P1103 008 vs P1103 035. How do I follow the disassembly to determine how the 008 is set vs the 035? And logic to set DTCs in general: I can find WHERE (in which func) P1103 is set: mov r12, #45h calls 84h, SetDTCME75_846b3e But I don't understand WHY it's set solely based on the disassembled code. I get that the setDTC func uses the r12 and [r0+2]: And that r12 is set right before calling the setDTC func, but the [r0xxx] statements confuse me. They're different before each setDTC func call: And I get how to follow the decision tree to get to where [r0xxx] are set, but I can't match when/where/which [r0xxxx] is set to which [r0xxxx] is used for each setDTC func call. And what are the bfldh r2, #DTCFieldA_H0|DTCFieldB_H1|DTCFieldC_H2|DTCFieldD_H3, #DTCFieldD_H3 bfldl r4, #DTCBit_L1, #DTCBit_L1
calls doing exactly? Where #45h Error Class is used, what do I look for to find what is being passed into the setDTC func as [r0+2] ? snippet from first img: mov r4, [r0+2] mov [-r0], r4 mov r12, #45h calls 84h, SetDTCME75_846b3e
Thanks in advance. I know I'm asking for a lot. Rey
|
|
« Last Edit: March 14, 2016, 12:49:59 PM by elRey »
|
Logged
|
|
|
|
elRey
|
|
« Reply #1 on: March 14, 2016, 04:05:54 PM »
|
|
|
I just realized I've forgotten r0 and [r0] are not the same thing. I'll try looking it over again with that in mind.
|
|
|
Logged
|
|
|
|
phila_dot
|
|
« Reply #2 on: March 14, 2016, 04:15:07 PM »
|
|
|
Follow the stack and look at the bitfield masks in hex
|
|
|
Logged
|
|
|
|
phila_dot
|
|
« Reply #3 on: March 14, 2016, 07:57:34 PM »
|
|
|
Also %DFPM breaks down the DTC bits
|
|
|
Logged
|
|
|
|
elRey
|
|
« Reply #4 on: March 15, 2016, 06:42:34 AM »
|
|
|
Thank you phila_dot. Reading that section now. As for following the stack, easier said than done for those of us not having a background computer science
|
|
|
Logged
|
|
|
|
nyet
|
|
« Reply #5 on: March 15, 2016, 11:52:01 AM »
|
|
|
Thank you phila_dot. Reading that section now. As for following the stack, easier said than done for those of us not having a background computer science FWIW it isn't easy for anyone.
|
|
|
Logged
|
|
|
|
phila_dot
|
|
« Reply #6 on: March 16, 2016, 08:08:44 AM »
|
|
|
Ask any specific questions that you have, it's alot to try and do a whole writeup on your OP.
It's a top down stack.
[-r0] pushes onto the bottom (adds underneath) [r0] accesses the current (bottom) [r0+n] accesses n from the bottom [r0+] pops off the bottom
|
|
|
Logged
|
|
|
|
elRey
|
|
« Reply #7 on: March 16, 2016, 12:29:18 PM »
|
|
|
That is great info in and of itself! Thanks.
What's the difference between r0 and [r0]?
Or are all your examples indirect references using stack and same could be done as direct access to stack values without square brackets?
|
|
« Last Edit: March 16, 2016, 12:31:45 PM by elRey »
|
Logged
|
|
|
|
phila_dot
|
|
« Reply #8 on: March 16, 2016, 01:43:05 PM »
|
|
|
It's a stack pointer, so [r0] is accessing the data stored and r0 is the stack pointer (memory address) itself. As seen at the end of the function, this is resetting the stack pointer.
|
|
|
Logged
|
|
|
|
elRey
|
|
« Reply #9 on: March 16, 2016, 03:20:46 PM »
|
|
|
[-r0] pushes onto the bottom (adds underneath) [r0] accesses the current (bottom) [r0+n] accesses n from the bottom [r0+] pops off the bottom
Ok, in your previous example if a added a line between [r0 + n] And [r0+] as such: [-r0] pushes onto the bottom (adds underneath) [r0] accesses the current (bottom) <- is it bottom because of previous line? [r0+n] accesses n from the bottom [r0] accesses the current (n from bottom?)[r0+] pops off the bottom When does the pointer change? Any time there's - or + or func r0, xxx ?
|
|
|
Logged
|
|
|
|
phila_dot
|
|
« Reply #10 on: March 16, 2016, 05:26:46 PM »
|
|
|
mov r4, #1h mov [-r0], r4
Stack 1 ----------------
mov r4, #2h mov [-r0], r4
Stack 1 2 ------------------
mov r4, #3h mov [-r0], r4
Stack 1 2 3 -----------------
mov r4, [r0]
Stack 1 2 3
r4 == 3 -----------------
mov r4, #4h mov [r0], r4
Stack 1 2 4 -------------------
mov r4, [r0+4]
Stack 1 2 4
r4 == 1 ------------------
mov r4, #5h mov [r0+4], r4
Stack 5 2 4 -------------------
mov r4, [r0+2]
Stack 5 2 4
r4 == 2 -----------------
mov r4, [r0+]
Stack 5 2
r4 == 4 ----------------
add r0, #2h
stack 5
Edit: Corrected
|
|
« Last Edit: March 17, 2016, 10:17:02 AM by phila_dot »
|
Logged
|
|
|
|
elRey
|
|
« Reply #11 on: March 16, 2016, 07:13:40 PM »
|
|
|
mov r4, #1h mov [-r0], r4
Stack 1 ----------------
mov r4, #2h mov [-r0], r4
Stack 1 2 ------------------
mov r4, #3h mov [-r0], r4
Stack 1 2 3 -----------------
mov r4, [r0]
Stack 1 2 3
r4 == 3 -----------------
mov r4, #4h mov [r0], r4
Stack 1 2 4 -------------------
mov r4, [r0+2]
Stack 1 2 4
r4 == 1 ------------------
mov r4, #5h mov [r0+2], r4
Stack 5 2 4 -------------------
mov r4, [r0+1]
Stack 5 2 4
r4 == 2 -----------------
mov r4, [r0+]
Stack 5 2
r4 == 4 ----------------
add r0, #1h
stack 5
Golden. Thank you so much for taking the time to do that!!!!
|
|
|
Logged
|
|
|
|
DT
Full Member
Karma: +20/-1
Offline
Posts: 184
|
|
« Reply #12 on: March 17, 2016, 03:17:59 AM »
|
|
|
i think phila_dot forgot about word and byte in his writeup
|
|
« Last Edit: March 17, 2016, 03:33:33 AM by DT »
|
Logged
|
|
|
|
phila_dot
|
|
« Reply #13 on: March 17, 2016, 05:55:47 AM »
|
|
|
Good catch, posting quickly from my phone and trying to use simple examples.
I used all words and then byte offsets.
I will correct them when I get a minute.
|
|
« Last Edit: March 17, 2016, 06:15:13 AM by phila_dot »
|
Logged
|
|
|
|
dream3R
|
|
« Reply #14 on: May 02, 2016, 06:52:05 PM »
|
|
|
I just realized I've forgotten r0 and [r0] are not the same thing. I'll try looking it over again with that in mind.
pointers
|
|
|
Logged
|
|
|
|
|