git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@611 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
23626829b9
commit
b7eba42be8
|
@ -54,9 +54,7 @@ void sys_wait_for_interrupt(void) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Halts the system. This function is invoked by the operating system when an
|
||||
* unrecoverable error is detected (as example because a programming error in
|
||||
* the application code that triggers an assertion while in debug mode).
|
||||
* Halts the system.
|
||||
*/
|
||||
__attribute__((weak))
|
||||
void sys_halt(void) {
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -32,8 +32,9 @@
|
|||
#define chSysPuts(msg) sys_puts(msg)
|
||||
|
||||
/**
|
||||
* Abonormal system termination handler. Invoked by the ChibiOS/RT when an
|
||||
* abnormal unrecoverable condition is met.
|
||||
* Halts the system. This function is invoked by the operating system when an
|
||||
* unrecoverable error is detected (as example because a programming error in
|
||||
* the application code that triggers an assertion while in debug mode).
|
||||
*/
|
||||
#define chSysHalt() sys_halt()
|
||||
|
||||
|
|
Loading…
Reference in New Issue