2025-05-23 3:50 AM
Hi,
1.As it is mentioned in CM4 user guide and also explained in tutorial, 0th bit of PC is directly loaded to T bit.And CM4 supports only thumb state ISA.To execute/decode instructions in Thumb state 0th bit of PC should be 1 which means PC should always hold address with odd numbers (i.e ODD Locations).
2.But in the attached screenshot,
Top left corner - core register window,
top right side has disassembly window,
Bottom Left-expressions window
3.Actual queries are:
3.1 why PC is holding even address(PC:0x8000654 ). And in disassembly window, address of location from where instruction needs to be executed is also even and it is matching with value in PC which is correct(Current location :0x8000654).
3.2 Once control jumps into generate_interrupt() function[Defined at location 0x80005dc] LR should hold the return address of the function,i.e, location of the next line in main.c function =>printf line(line num in main.c file :148 and disassembly window:0x8000658). So after jumping into function LR should hold 0x8000658,But as shown in snapshot, it holds 0x8000659.
3.3 After bx lr instruction associated with genreate_interrupt() function value in LR should be copied back to PC right but here value as differed by 0x01 why?
2025-05-23 5:51 AM
The LR holds the ODD value as it indicates the type of code it's going to execute upon return.
In the Handlers it can contain magic values like 0xFFFFFFF9 or 0xFFFFFFFD as that is a call gate that unstacks context. Either MSP or PSP
2025-05-23 8:24 AM
> why PC is holding even address
Because the T bit goes into the processor state bits.
2025-05-23 8:28 AM
Could anyone please answer bit bit like section bus ection.I know I ahve asked many questions it that