OVP Forums - A community of assistance, help, questions, and answers.
  FAQFAQ    SearchSearch      RegisterRegister  ProfileProfile    Log in to check your private messagesLog in to check your private messages    Log inLog in
simpleCpuMemoryUart and arm AArch32 processor

 
Post new topic   Reply to topic    Open Virtual Platforms Forum Index -> Ask a Question
View previous topic :: View next topic  
Author Message
AlKappa



Joined: 05 May 2017
Posts: 16

PostPosted: Wed Nov 14, 2018 3:15 am    Post subject: simpleCpuMemoryUart and arm AArch32 processor Reply with quote

Hello,

i am trying to trace instructions of a bare metal program for the Cortex-A53 (in 32-bit mode). I took the simpleCpuMemory and changed the processor to an arm AArch32.
I had promising results in the first place, but apparently the UART communication does not work correctly. While sending, the program stucks in a loop because sent words to the UART aren't picked up. So it keeps sending the same words over and over, as you can see in the trace.

Code:

0x00000000000080dc(uart_send): e92d4070 stmdb sp!,{r4,r5,r6,lr}
0x00000000000080e0(uart_send+4): e3054054 movw r4,#20564
0x00000000000080e4(uart_send+8): e3434f21 movt r4,#16161
0x00000000000080e8(uart_send+c): e1a05000 mov r5,r0
0x00000000000080ec(uart_send+10): e1a00004 mov r0,r4
0x00000000000080f0(uart_send+14): ebffffdd bl 806c
0x000000000000806c(GET32): e5900000 ldr r0,[r0]
0x0000000000008070(GET32+4): e12fff1e bx lr
0x00000000000080f4(uart_send+18): e3100020 tst r0,#32
0x00000000000080f8(uart_send+1c): 0afffffb beq 80ec
0x00000000000080ec(uart_send+10): e1a00004 mov r0,r4
0x00000000000080f0(uart_send+14): ebffffdd bl 806c
0x000000000000806c(GET32): e5900000 ldr r0,[r0]
0x0000000000008070(GET32+4): e12fff1e bx lr
0x00000000000080f4(uart_send+18): e3100020 tst r0,#32
0x00000000000080f8(uart_send+1c): 0afffffb beq 80ec
0x00000000000080ec(uart_send+10): e1a00004 mov r0,r4
0x00000000000080f0(uart_send+14): ebffffdd bl 806c
...


My question is: how can i connect the UART correctly to an AArch32 processor variant in a (hopefully) minimal setup? Or where should I start reading about connecting a UART?

regards.[/code]
Back to top
View user's profile Send private message
DuncGrah
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 1656
Location: United Kingdom

PostPosted: Fri Nov 16, 2018 12:21 am    Post subject: Reply with quote

Please start by reading about programming the ARM processor. I suspect that it is not accessing the UART registers as you expect.

You can turn on diagnostics on the UART and in the simulator to see the accesses. You can also turn on register change change tracing to see the values being read back from the UART.

To turn on register tracing add --traceregisters

To turn on diagnostics, first find the correct parameter to override by adding --showoverrides. this will give you a list of parameters, find the one on the UART and set to 0x1f (see peripheral modelling guide for information on what this means). The override to add will be something line
--override simpleCpuMemory/periph0/diagnosticlevel=0x1f
Back to top
View user's profile Send private message Visit poster's website
AlKappa



Joined: 05 May 2017
Posts: 16

PostPosted: Mon Nov 19, 2018 3:22 am    Post subject: Reply with quote

Thank you very much, that helped in localizing the error.

Surely, the UART is correctly mapped, as it should throw another error.
I found, that it is not writing to the uart and reading always returns zero:

Code:

Info (PP_WRR) PSE simpleCpuMemoryUart/uart0: write register 'ab_dr' = 0x00000001
Info (PL011_TX) simpleCpuMemoryUart/uart0: Tx ^A
Info (PPM_SER) sockWrite: 1 bytes
Info (PL011_UPDATE) simpleCpuMemoryUart/uart0: Int 0->0 (level 0x20 enabled 0x00)

[...]

Info (PL011_UPDATE) simpleCpuMemoryUart/uart1: Int 0->0 (level 0x00 enabled 0x00)
Info (PP_RDR) PSE simpleCpuMemoryUart/uart1: read register 'ab_dr' = 0x00000000


The register "ab_dr" was not changed and should return 0x1.
Apparently the "(PL011_UPDATE)" Info tells me there is no value change, is there anything i can do to fix this issue?

regards.
Back to top
View user's profile Send private message
DuncGrah
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 1656
Location: United Kingdom

PostPosted: Mon Nov 19, 2018 3:38 am    Post subject: Reply with quote

On the UART the dr register is the data register. When you write to it you send a character into the UART transmit, when you perform a read this is from the UART receive, this is not the same register.
You can see from the logging that the character is written to the serial socket.
Code:
Info (PPM_SER) sockWrite: 1 bytes

and no interrupt is generated because none are enabled.
Code:
Info (PL011_UPDATE) simpleCpuMemoryUart/uart0: Int 0->0 (level 0x20 enabled 0x00)



Do you have the console enabled, if so you will see printable characters come to the screen.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Open Virtual Platforms Forum Index -> Ask a Question All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Information regarding OVP © 2008-2022 Imperas Software