Target is S32K148,Compiler is Green Hills
I've written the following C function:
;ldr r1, =0x40020000
movs r0, #128 ; 0x80
strb r0, [r1, #0]
ldrb r0, [r1, #0]
lsls r0, r0, #24
I looked at the list file for this and I notice there is a "ret" instruction at the end.AS you see I had to comment "bx lr"
otherwise It generates an exception(I believe a hard fault) why do I need to comment that out?
is not true that PC(Return address) is pushed on the stack and pops back into PC?
if so why LR registered is used in the first place.
Has it to do something with the Thumb bit?
and why when I use it here it generates a hard fault exception?
when the "ret" is executed and PC is restored , isn't the thumb bit set?