Hi experts Ash Wilding Mark Nicholson,
I have a Juno r1 board and I'm using it as the instruction of this page's "Building from source" section.
Now I want to update some secure related registers (e.g., SCR_EL3) for my board. These update operations require EL3 privilege.
In this case, I think I need to write the code in secure monitor layer. I hope I can update the register value while booting time so I think I should add code in the BL2 or BL31 according to the Linaro slides page8.
My workspace contains the folder arm-tf which looks like the part I should work with.
However, after running script build-arm-tf.sh, I do get the bl2.bin and bl31.bin while I don't know how to push these files into my board and use them for trusted booting.
So my questions are:
1. To update the register with EL3 privilege, should I add code in trusted firmware layer?
2. Can I update the trusted firmware by myself for Juno r1? If I can, how?
If I misunderstand any part, please let me know.
Thank you in advance.
Shengye
Hi,
>1. To update the register with EL3 privilege, should I add code in trusted firmware layer?
Yes. Probably in AP_BL1 or AP_BL31, but exactly where in TF depends what you are trying to do.
>2. Can I update the trusted firmware by myself for Juno r1? If I can, how?
I assume you mean - how do you "apply" the rebuilt binaries to the board? If so. This is covered in the instructions
https://community.arm.com/dev-platforms/b/documents/posts/using-linaros-deliverables-on-juno 5.2 Built from source section.
Basically you copy the binaries to the MMC card and these are written to flash on boot.
HTH
MarkN.
Hi Mark,
Thank you for the reply. Your post did help me rebuild the firmware bin file.
However, now I met a new problem.
Currently I'm trying to write several system control registers with EL3 privilege such as SCR_EL3.
I put my code in the trusted firmware boot loader (BL31).
Here is my code that I put in the bl31_main of arm-trusted-firmware-source-code:
bl31_main
asm("MRS %x[result], SCR_EL3" : [result] "=r" (scr) ); asm("MSR SCR_EL3, %x[value]" : : [value] "r" (scr) );
I can read the value of the register correctly and I checked the register CurrentEL which says I did have the EL3 privilege.
However, every time after I write new value to SCR_EL3, its value doesn't change.
I also tried several other registers (some registers only requires EL1 privilege while I can't write anyone successfully with the instruction MSR).
Now I cannot come up with what might cause this problem. Do you have any idea or suggestion for my problem?
Thank you in advanced.
Simon
AT BL3-1 I don't see any immediate reason why you can't modify these registers because of privilege.
Do you have a debugger (e.g. DS-5/DSTREAM) so you can step through this one instruction and a time and check the status of these system register updates?
GUESSES, but...
- Are you using the right access size for the register (check the ARM ARM)?
- Could the update be successful, but changes are overwritten again elsewhere in the firmware? You could try putting some instrumentation/printfs in the code to see if you can learn more.