Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register difference between emulator and silicone #28

Open
urish opened this issue May 16, 2021 · 0 comments
Open

Register difference between emulator and silicone #28

urish opened this issue May 16, 2021 · 0 comments

Comments

@urish
Copy link
Contributor

urish commented May 16, 2021

Reproduction instructions

To reproduce, load the following hex file into the emulator and silicone, and set a GDB breakpoint at the beginning of main (e.g. break main):

test-printf.zip

Run both in the emulator and on the silicone rp2040. Then print the register values, and you'll see r12 has a different value between the emulator and the silicone.

I'm not sure if this is actually a bug or just a symptom of a missing peripheral / peripheral implementation difference (e.g. timer), so we need to investigate.

Reproduction logs

Running on silicone:

(gdb) monitor reset init
target halted due to debug-request, current mode: Thread 
xPSR: 0xf1000000 pc: 0x000000ee msp: 0x20041f00
target halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x000000ee msp: 0x20041f00
(gdb) break main
Breakpoint 1 at 0x10000342: file /home/uri/p/test-printf/test-printf.ino, line 2.
(gdb) c
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x00000178 msp: 0x20041f00

Thread 1 hit Breakpoint 1, main () at /home/uri/p/test-printf/test-printf.ino:2
2         printf("12 is %d\n", 12);
(gdb) info registers
r0             0x0                 0
r1             0x10001cd9          268442841
r2             0x20002858          536881240
r3             0x1                 1
r4             0x0                 0
r5             0x0                 0
r6             0x0                 0
r7             0x0                 0
r8             0x0                 0
r9             0x0                 0
r10            0x0                 0
r11            0x0                 0
r12            0x5                 5
sp             0x2000ceb0          0x2000ceb0 <_main_stack+32744>
lr             0x100040a7          268452007
pc             0x10000342          0x10000342 <main()+2>
xPSR           0x61000000          1627389952
msp            0x2003ffb8          0x2003ffb8
psp            0x2000ceb0          0x2000ceb0 <_main_stack+32744>
primask        0x0                 0
basepri        0x0                 0
faultmask      0x0                 0
control        0x2                 2

Running in the emulator:

0x10000000 in ?? ()
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from test-printf.ino.elf...
(gdb) break main
Breakpoint 1 at 0x10000342: file /home/uri/p/test-printf/test-printf.ino, line 2.
(gdb) c
Continuing.

Breakpoint 1, main () at /home/uri/p/test-printf/test-printf.ino:2
2         printf("12 is %d\n", 12);
(gdb) info registers
r0             0x0                 0
r1             0x10001cd9          268442841
r2             0x20002858          536881240
r3             0x1                 1
r4             0x0                 0
r5             0x0                 0
r6             0x0                 0
r7             0x0                 0
r8             0x0                 0
r9             0x0                 0
r10            0x0                 0
r11            0x0                 0
r12            0xa                 10
sp             0x2000ceb0          0x2000ceb0 <_main_stack+32744>
lr             0x100040a7          268452007
pc             0x10000342          0x10000342 <main()+2>
xPSR           0x61000000          1627389952
msp            0x2003ffb8          0x2003ffb8
psp            0x2000ceb0          0x2000ceb0 <_main_stack+32744>
primask        0x0                 0
basepri        0x0                 0
faultmask      0x0                 0
control        0x2                 2
(gdb)

difference:

Silicone - r12 0x5 5
Emulator - r12 0xa 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant