You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2015/10/30 19:49:37 UTC

[2/2] incubator-mynewt-larva git commit: Trap on divide-by-zero.

Trap on divide-by-zero.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/209290bf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/209290bf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/209290bf

Branch: refs/heads/master
Commit: 209290bfa508fbc020c7264b9cc90bc53ecbce0e
Parents: cabe413
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Fri Oct 30 11:49:09 2015 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Oct 30 11:49:09 2015 -0700

----------------------------------------------------------------------
 libs/os/src/arch/cortex_m4/os_arch_arm.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/209290bf/libs/os/src/arch/cortex_m4/os_arch_arm.c
----------------------------------------------------------------------
diff --git a/libs/os/src/arch/cortex_m4/os_arch_arm.c b/libs/os/src/arch/cortex_m4/os_arch_arm.c
index 13a8ca4..3cc7ca1 100755
--- a/libs/os/src/arch/cortex_m4/os_arch_arm.c
+++ b/libs/os/src/arch/cortex_m4/os_arch_arm.c
@@ -158,6 +158,10 @@ os_arch_task_stack_init(struct os_task *t, os_stack_t *stack_top, int size)
 void
 os_arch_init(void)
 {
+    /*
+     * Trap on divide-by-zero.
+     */
+    SCB->CCR |= SCB_CCR_DIV_0_TRP_Msk;
     os_init_idle_task();
 }
 
@@ -227,9 +231,9 @@ os_arch_os_init(void)
 
 /**
  * os systick init
- *  
+ *
  * Initializes systick for the MCU
- * 
+ *
  * @param os_tick_usecs The number of microseconds in an os time tick
  */
 static void
@@ -286,7 +290,7 @@ os_arch_os_start(void)
 
     err = OS_ERR_IN_ISR;
     if (__get_IPSR() == 0) {
-        /* 
+        /*
          * The following switch statement is really just a sanity check to
          * insure that the os initialization routine was called prior to the
          * os start routine.