dlbeer / mspdebug

Debugging tool for MSP430 MCUs
GNU General Public License v2.0
184 stars 80 forks source link

<reg[3] for special meaning.> <I new a project using IAR, and debug it with the IAR simulator. I modified the instruction byte code, and get strange assembles that are not documented. I draw a conclusion in my opinion, for the following instructions: [0 0 0 0 src 1 1 0 0 dst — MOVA Rsrc,Rdst], [0 0 0 0 src 1 1 0 1 dst — CMPA Rsrc,Rdst], [0 0 0 0 src 1 1 1 0 dst — ADDA Rsrc,Rdst], [0 0 0 0 src 1 1 1 1 dst — SUBA Rsrc,Rdst], when src is reg[3], it has special meanings. According to the oper, the Rsrc is MOVA: 0. CMPA: 0. ADDA: 2. SUBA: 2.> #105

Open zhaoleicpp opened 3 years ago

zhaoleicpp commented 3 years ago

reg[3] for special meaning. not documented. But I tested. It works fine.

dlbeer commented 3 years ago

On Sat, Jun 05, 2021 at 09:18:11AM -0700, Zhao Lei wrote:

You can view, comment on, or merge this pull request online at:

https://github.com/dlbeer/mspdebug/pull/105

-- Commit Summary --

  • reg[3] for special meaning.

-- File Changes --

M drivers/sim.c (13)

-- Patch Links --

https://github.com/dlbeer/mspdebug/pull/105.patch https://github.com/dlbeer/mspdebug/pull/105.diff

Hi Zhao,

I think I see what you're doing here, and I would be happy to merge it, but could you provide a little more explanation in the commit message for future reference?

Cheers, Daniel

-- Daniel Beer @.***> http://dlbeer.co.nz/ PGP: BA6E 0B26 1F89 246C E3F3 C910 1E58 C43A 160A 553B

dlbeer commented 3 years ago

Hi Zhao,

Sorry, I didn't get a notification when you'd changed the message, so I didn't notice that you'd done it!

The explanation is good, but if you could format the message in the standard style:

<short message>

<longer description ...>

Then it'll still be readable in the commit log. If you post a comment here when it's ready I'll merge it.

I've had a look through your other issues too -- it looks like you're making use of the simulator and know what you're doing. If you have any fixes for the issues you've found I'll be happy to accept those too.

Thanks, Daniel

zhaoleicpp commented 3 years ago

Hi Zhao,

Sorry, I didn't get a notification when you'd changed the message, so I didn't notice that you'd done it!

The explanation is good, but if you could format the message in the standard style:

<short message>

<longer description ...>

Then it'll still be readable in the commit log. If you post a comment here when it's ready I'll merge it.

I've had a look through your other issues too -- it looks like you're making use of the simulator and know what you're doing. If you have any fixes for the issues you've found I'll be happy to accept those too.

Thanks, Daniel

I just modify the code temporarily, I fill provide the issues later. The simulator does not give right result yet. I will fix the last bug witch is hard to find although. The bug location need automation, or I will be sleepy when I search them manually.

zhaoleicpp commented 3 years ago

Iar_controller_to_debug_msp430_simulator.zip

To debug a simulator, I think automation is important. Here is Visual C++ code to control Iar. Comparing Iar simulator and dlbeer mspdebug simulator step by step, every asm instruction, I find the bug easily. Comparing registers and memory every instruction may be slow. Unfortunate I believe the Iar simulator also has bugs. I have no hardware and planning buy an MSP430F5529 develop board and a usb-debug-interface to continue debug work. Hope the code may be helpful to you.

Best regards!

dlbeer commented 3 years ago

Ok, thank you for your work on this. If you let me know when you think you have something ready, I'll merge. Let me know if you need any information from me in the meantime.