Skip to content

Conversation

@cmattatall
Copy link

On -O2 and -O3, instruction re-ordering of non-volatile accesses to peripheral clock div registers sometimes get interleaved depending on inlining

// inside SOC_rcmSetPeripheralClock

 *ptrClkSrcReg = SOC_rcmInsert16 (*ptrClkSrcReg, 11U, 0U, clkSrcVal); // expression 1
  while(CSL_REG32_RD(ptrClkSrcReg) != clkSrcVal) // expression 2
  {;}
      
  // This PR prevents re-ordering of expressions 1 and 2

@cmattatall cmattatall changed the title [rcm] add volatile to fix instruction re-ordering bug on -O2 [rcm] fix instruction re-ordering bug on -O2 Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant