unexpected M0+ bit write assemble code
here's the register definition:
typedef union { // __I to avoid read-modify-write on write-to-clear register
struct {
__IO uint8_t FC0O:1; /*!< bit: 0 Frame Counter 0 Overflow */
__IO uint8_t FC1O:1; /*!< bit: 1 Frame Counter 1 Overflow */
__IO uint8_t FC2O:1; /*!< bit: 2 Frame Counter 2 Overflow */
__IO uint8_t VLCDRT:1; /*!< bit: 3 VLCD Ready Toggle */
__IO uint8_t VLCDST:1; /*!< bit: 4 VLCD Status Toggle */
__IO uint8_t PRST:1; /*!< bit: 5 Pump Run Status Toggle */
__IO uint8_t :2; /*!< bit: 6.. 7 Reserved */
} bit; /*!< Structure used for bit access */
uint8_t reg; /*!< Type used for register access */
} SLCD_INTFLAG_Type;
And here's the disassemble code generated by compiler
void slcd_clear_
SLCD-
156a: 4b09 ldr r3, [pc, #36] ; (1590 <slcd_clear_
156c: 7bd9 ldrb r1, [r3, #15]
156e: 2201 movs r2, #1
1570: 430a orrs r2, r1
1572: 73da strb r2, [r3, #15]
1574: e00a b.n 158c <slcd_clear_
}
What I want is just writing 1 to INTFLAG register, while compiler gives me read modify write. This behavior will clear all interrupt flag, not the one I want to clear.
My understanding is if a var is allocated in main RAM, read modify write is the expected behavior. But if var is declared as IO type, compiler should just write data and no need to read the data back?
Can you help me out there, thanks.
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- bruce.li
- Solved:
- Last query:
- Last reply: