aboutsummaryrefslogtreecommitdiffstats
path: root/ports/ARMCM3
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-01-10 15:36:16 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-01-10 15:36:16 +0000
commitb7eba42be8e04a6a9cbade60d5ae0190fd34efae (patch)
tree24b26e38f31568bb4fea7a9f5d1a8fcecf1d3d0b /ports/ARMCM3
parent23626829b9463237559b0283bbb5327331b9e280 (diff)
downloadChibiOS-b7eba42be8e04a6a9cbade60d5ae0190fd34efae.tar.gz
ChibiOS-b7eba42be8e04a6a9cbade60d5ae0190fd34efae.tar.bz2
ChibiOS-b7eba42be8e04a6a9cbade60d5ae0190fd34efae.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@611 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'ports/ARMCM3')
-rw-r--r--ports/ARMCM3/chcore.c15
-rw-r--r--ports/ARMCM3/chcore.h7
-rw-r--r--ports/ARMCM3/crt0.s4
3 files changed, 18 insertions, 8 deletions
diff --git a/ports/ARMCM3/chcore.c b/ports/ARMCM3/chcore.c
index 6b4811904..a6871d701 100644
--- a/ports/ARMCM3/chcore.c
+++ b/ports/ARMCM3/chcore.c
@@ -36,25 +36,28 @@ __attribute__((weak))
void sys_puts(char *msg) {
}
+/**
+ * Halts the system.
+ * @note The function is declared as a weak symbol, it is possible to redefine
+ * it in your application code.
+ */
+__attribute__((weak))
void sys_halt(void) {
- asm volatile ("cpsid i");
+ sys_disable_all();
while (TRUE) {
}
}
/**
* Start a thread by invoking its work function.
- * If the work function returns @p chThdExit() is automatically invoked. A call
- * to @p chSysHalt() is added as failure check in the "impossible" case
- * @p chThdExit() returns.
+ * If the work function returns @p chThdExit() is automatically invoked.
*/
__attribute__((naked, weak))
void threadstart(void) {
asm volatile ("blx r1 \n\t" \
- "bl chThdExit \n\t" \
- "bl chSysHalt ");
+ "bl chThdExit");
}
/**
diff --git a/ports/ARMCM3/chcore.h b/ports/ARMCM3/chcore.h
index c213b9ffd..a0f0c4f4e 100644
--- a/ports/ARMCM3/chcore.h
+++ b/ports/ARMCM3/chcore.h
@@ -186,6 +186,13 @@ typedef struct {
*/
#define sys_enable_from_isr() sys_enable()
+/**
+ * Disables all the interrupt sources, even those having a priority higher
+ * to the kernel.
+ * In the Cortex-M3 it raises the priority mask to level 0.
+ */
+#define sys_disable_all() asm volatile ("cpsid i")
+
#if ENABLE_WFI_IDLE != 0
/**
* This port function is implemented as inlined code for performance reasons.
diff --git a/ports/ARMCM3/crt0.s b/ports/ARMCM3/crt0.s
index b59f0993b..06bbb49c6 100644
--- a/ports/ARMCM3/crt0.s
+++ b/ports/ARMCM3/crt0.s
@@ -95,7 +95,7 @@ bloop:
movs r0, #0
mov r1, r0
bl main
- bl chSysHalt
+ bl sys_halt
/*
* Default early initialization code. It is declared weak in order to be
@@ -108,7 +108,7 @@ bloop:
.weak hwinit0
hwinit0:
bx lr
-
+
/*
* Default late initialization code. It is declared weak in order to be
* replaced by the real initialization code.