We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
I want to execute thumb instructions on foundation model. Please suggest how this can be done. If I run the thumb instructions as it is, the trace shows them as undefined instructions. The test case I have used is as follows:
.section .text
.global _start
_start:
.syntax unified
.THUMB
adc R7, R12, #0xad
The trace file generated shows that the instructions are not recognized:
---snip---
0 clk IT (0) 80000000 01fff04f O EL3h_s : DCI 0x01fff04f ; ? Undefined
0 clk E 80000000 00000084 CoreEvent_CURRENT_SPx_SYNC
0 clk R cpsr 000003cd
0 clk R ESR_EL3 02000000
0 clk R SPSR_EL3 000003cd
0 clk R ELR_EL3 0000000080000000
1 clk IT (1) 00000200 e7ff0010 O EL3h_s : DCI 0xe7ff0010 ; ? Undefined
1 clk E 00000200:0000000200 00000084 CoreEvent_CURRENT_SPx_SYNC
1 clk R cpsr 000003cd
1 clk R ESR_EL3 02000000
1 clk R SPSR_EL3 000003cd
1 clk R ELR_EL3 0000000000000200
2 clk IT (2) 00000200 e7ff0010 O EL3h_s : DCI 0xe7ff0010 ; ? Undefined
I also tried changing mode by ERET instruction:
adc X23, X25, X5 //Is in A64 mode
MOV x0,#0x131
MSR SCR_EL3,x0
MOV x1,#0x3c5 //Change to exception level EL1
adr X0, 22
MSR ELR_EL3,x0 //After ERET the control should go to last MOV
MSR SPSR_EL3, X1
MRS X1, SPSR_EL3
ERET //Should cause mode change to A32
However, the ERET instruction is still not able to change mode:
7 clk IT (7) 8000001c d53e4001 O EL3h_s : MRS x1,SPSR_EL3
7 clk R X1 00000000000003C5
8 clk IT (8) 80000020 d69f03e0 O EL3h_s : ERET
8 clk R cpsr 001003cd
8 clk E 80000024:0080000024 00000084 CoreEvent_CURRENT_SPx_SYNC
8 clk R cpsr 000003cd
8 clk R ESR_EL3 3a000000
8 clk R SPSR_EL3 001003cd
8 clk R ELR_EL3 0000000080000024
9 clk IT (9) 00000200 e7ff0010 O EL3h_s : DCI 0xe7ff0010 ; ? Undefined
What is the correct way to execute thumb instructions on the Foundation model?
Thanks,
Deepti
Hi Deepti,
There's a reference here on Infocenter that may help you with regards to changing from A32 to T32: http://infocenter.arm.com/help/topic/com.arm.doc.dui0801a/Caccidah.html
See this as well for the BLX instruction required to do this: http://infocenter.arm.com/help/topic/com.arm.doc.dui0802a/Cihfddaf.html
Also, changing into AArch32 state from AArch64 state can only be done at exception boundaries.
The reference for this is here: ARM Compiler armasm User Guide: Changing between AArch64 and AArch32 states
Hope this helps,
Joe
Hi Joe,
Thanks for your reply. So, I understand that if I want to run cortexM3 instructions on the foundation model, I will not be able to run it, as foundation model appears to get booted in a64 mode, and from within the application, it is not useful to change mode to a32 using ERET instruction. So, I will need a boot wrapper for A32. Is there any a32 image available that can be run on the foundation model?