Skip to content

Commit

Permalink
Merge pull request RIOT-OS#5256 from DipSwitch/pr/fix_cortex_initiali…
Browse files Browse the repository at this point in the history
…zation

cpu/cortex-m: Enable STKALIGN to make the Cortex-M keep the stack 8 byte aligned
  • Loading branch information
haukepetersen committed Apr 8, 2016
2 parents e2cb553 + b6140f1 commit acf9bf7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cpu/cortexm_common/cortexm_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,12 @@ void cortexm_init(void)

/* enable wake up on events for __WFE CPU sleep */
SCB->SCR |= SCB_SCR_SEVONPEND_Msk;

/* for Cortex-M3 r1p0 and up the STKALIGN option was added, but not automatically
* enabled until revision r2p0. For 64bit function arguments to work properly this
* needs to be enabled.
*/
#ifdef SCB_CCR_STKALIGN_Msk
SCB->CCR |= SCB_CCR_STKALIGN_Msk;
#endif
}

0 comments on commit acf9bf7

Please sign in to comment.