Hi smart guys out there,
I am using µVision with TIs eval-kit LM3S9B92. I use µVisions C-Compiler.
I learned that it is not possible to read the CPU-Registers with C and I have to use asembler for that.
I have no idea of asembler and actually I don't work with it in future and I hope I never have to again :-) ...but right now I need to know the status of the carrybit.
So all I am asking is for a piece of code that gets me the status of bit 29 in the register 17 :) and how to implement that in my project.
I hope this doesn't sound sassy ;-) - at least it isn't meant that way.
Thank you so much.
A little clue:
int32u __asm processor_in_user_mode(void) { STMDB R13!, {R1} MRS R0, CPSR AND R0, R0, #0x1F // the lowest 5 bits of CPSR respresent the processor mode MOV R1, #0x10 // user mode = 0x10 CMP R0, R1 BEQ not_interrupt_context LDMIA R13!, {R1} // restore the file name and the line number. MOV R0, #0x0 // indicate called while not in user mode BX LR not_interrupt_context // restore original values of R1 LDMIA R13!, {R1} MOV R0, #0x1 // indicate called while in user mode BX LR }
Assuming you are working with an ARM7 core, you are interested in CRSR. What is that according to the user manual...?
For the sake of completeness -
STMDB R13!, {R1}
and
LDMDB R13!, {R1}
above can be discarded.
View all questions in Keil forum