I have a need to initialize the ARM registers of my ARM7TDMI development board to a specific values using inline assembly. For example currently I do something like the following :
#pragma ARM
void init(char * reg) {
__asm {
MOV R0,#0x0
MOV R1,#0x1
MOV R2,#0x2
MOV R3,#0x3
...
}
The idea is to closely control the contents of each of the registers here. I am using KEIL UVision 5 and it warns me that this may not be a smart thing to do . And looking at the debugger there is no guarantee that the initialization will happen as per my request. For example the value 0x2 maybe stored in register r12 instead of r2 as i requested in my inline assembly ..
a.c(102): warning: #1267-D: Implicit physical register R0 should be defined as a variable
Reading up on Keil documentation http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka11441.html it suggests using variable names. Something like this
{
int val2;
__asm
{
MOV val2,0xFFFF0000
MOV val,val,LSL #16
}
Well this is not good enough for me as I want precise control over my register contents. How is it possible to do ? Any ideas ?
Thanks