git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6104 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
6071e93a92
commit
0ef4a97438
|
@ -357,7 +357,7 @@
|
||||||
* @note The default is @p FALSE.
|
* @note The default is @p FALSE.
|
||||||
*/
|
*/
|
||||||
#if !defined(CH_DBG_STATISTICS) || defined(__DOXYGEN__)
|
#if !defined(CH_DBG_STATISTICS) || defined(__DOXYGEN__)
|
||||||
#define CH_DBG_STATISTICS TRUE
|
#define CH_DBG_STATISTICS FALSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -368,7 +368,7 @@
|
||||||
* @note The default is @p FALSE.
|
* @note The default is @p FALSE.
|
||||||
*/
|
*/
|
||||||
#if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__)
|
#if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__)
|
||||||
#define CH_DBG_SYSTEM_STATE_CHECK TRUE
|
#define CH_DBG_SYSTEM_STATE_CHECK FALSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -101,9 +101,9 @@ int main(void) {
|
||||||
* Activates the serial driver 1 using the driver default configuration.
|
* Activates the serial driver 1 using the driver default configuration.
|
||||||
* PA9(TX) and PA10(RX) are routed to USART1.
|
* PA9(TX) and PA10(RX) are routed to USART1.
|
||||||
*/
|
*/
|
||||||
// sdStart(&SD1, NULL);
|
sdStart(&SD1, NULL);
|
||||||
// palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(7));
|
palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(7));
|
||||||
// palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(7));
|
palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(7));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Creates the example thread.
|
* Creates the example thread.
|
||||||
|
@ -117,8 +117,8 @@ int main(void) {
|
||||||
* pressed the test procedure is launched.
|
* pressed the test procedure is launched.
|
||||||
*/
|
*/
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
// if (palReadPad(GPIOA, GPIOA_BUTTON))
|
if (palReadPad(GPIOA, GPIOA_BUTTON))
|
||||||
// TestThread(&SD1);
|
TestThread(&SD1);
|
||||||
chThdSleepMilliseconds(500);
|
chThdSleepMilliseconds(500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,9 +69,9 @@ void SVC_Handler(void) {
|
||||||
ctxp++;
|
ctxp++;
|
||||||
|
|
||||||
#if CORTEX_USE_FPU
|
#if CORTEX_USE_FPU
|
||||||
/* Restoring the special register SCB_FPCCR.*/
|
/* Restoring the special register FPCCR.*/
|
||||||
SCB_FPCCR = (uint32_t)ctxp->fpccr;
|
FPU->FPCCR = (uint32_t)ctxp->fpccr;
|
||||||
SCB_FPCAR = SCB_FPCAR + sizeof (struct extctx);
|
FPU->FPCAR = FPU->FPCAR + sizeof (struct extctx);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Writing back the modified PSP value.*/
|
/* Writing back the modified PSP value.*/
|
||||||
|
@ -99,9 +99,9 @@ void PendSV_Handler(void) {
|
||||||
ctxp++;
|
ctxp++;
|
||||||
|
|
||||||
#if CORTEX_USE_FPU
|
#if CORTEX_USE_FPU
|
||||||
/* Restoring the special register SCB_FPCCR.*/
|
/* Restoring the special register FPCCR.*/
|
||||||
SCB_FPCCR = (uint32_t)ctxp->fpccr;
|
FPU->FPCCR = (uint32_t)ctxp->fpccr;
|
||||||
SCB_FPCAR = SCB_FPCAR + sizeof (struct extctx);
|
FPU->FPCAR = FPU->FPCAR + sizeof (struct extctx);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Writing back the modified PSP value.*/
|
/* Writing back the modified PSP value.*/
|
||||||
|
@ -156,11 +156,11 @@ void _port_irq_epilogue(void) {
|
||||||
|
|
||||||
/* Saving the special register SCB_FPCCR into the reserved offset of
|
/* Saving the special register SCB_FPCCR into the reserved offset of
|
||||||
the Cortex-M4 exception frame.*/
|
the Cortex-M4 exception frame.*/
|
||||||
(ctxp + 1)->fpccr = (regarm_t)(fpccr = SCB_FPCCR);
|
(ctxp + 1)->fpccr = (regarm_t)(fpccr = FPU->FPCCR);
|
||||||
|
|
||||||
/* Now the FPCCR is modified in order to not restore the FPU status
|
/* Now the FPCCR is modified in order to not restore the FPU status
|
||||||
from the artificial return context.*/
|
from the artificial return context.*/
|
||||||
SCB_FPCCR = fpccr | FPCCR_LSPACT;
|
FPU->FPCCR = fpccr | FPU_FPCCR_LSPACT_Msk;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -200,17 +200,16 @@
|
||||||
CORTEX_PRIO_MASK(CORTEX_MAX_KERNEL_PRIORITY)
|
CORTEX_PRIO_MASK(CORTEX_MAX_KERNEL_PRIORITY)
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define CORTEX_MAX_KERNEL_PRIORITY 1
|
#define CORTEX_MAX_KERNEL_PRIORITY 0
|
||||||
#define CORTEX_BASEPRI_KERNEL 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief PendSV priority level.
|
* @brief PendSV priority level.
|
||||||
* @note This priority is enforced to be equal to @p CORTEX_BASEPRI_KERNEL,
|
* @note This priority is enforced to be equal to
|
||||||
* this handler always have the highest priority that cannot preempt
|
* @p CORTEX_MAX_KERNEL_PRIORITY, this handler always have the
|
||||||
* the kernel.
|
* highest priority that cannot preempt the kernel.
|
||||||
*/
|
*/
|
||||||
#define CORTEX_PRIORITY_PENDSV CORTEX_BASEPRI_KERNEL
|
#define CORTEX_PRIORITY_PENDSV CORTEX_MAX_KERNEL_PRIORITY
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Module data structures and types. */
|
/* Module data structures and types. */
|
||||||
|
@ -468,7 +467,7 @@ static inline syssts_t port_get_irq_status(void) {
|
||||||
static inline bool port_irq_enabled(syssts_t sts) {
|
static inline bool port_irq_enabled(syssts_t sts) {
|
||||||
|
|
||||||
#if !CORTEX_SIMPLIFIED_PRIORITY
|
#if !CORTEX_SIMPLIFIED_PRIORITY
|
||||||
return sts >= CORTEX_BASEPRI_KERNEL;
|
return sts == CORTEX_BASEPRI_DISABLED;
|
||||||
#else /* CORTEX_SIMPLIFIED_PRIORITY */
|
#else /* CORTEX_SIMPLIFIED_PRIORITY */
|
||||||
return (sts & 1) == 0;
|
return (sts & 1) == 0;
|
||||||
#endif /* CORTEX_SIMPLIFIED_PRIORITY */
|
#endif /* CORTEX_SIMPLIFIED_PRIORITY */
|
||||||
|
|
|
@ -47,7 +47,11 @@
|
||||||
|
|
||||||
.syntax unified
|
.syntax unified
|
||||||
.cpu cortex-m4
|
.cpu cortex-m4
|
||||||
|
#if CORTEX_USE_FPU
|
||||||
|
.fpu fpv4-sp-d16
|
||||||
|
#else
|
||||||
.fpu softvfp
|
.fpu softvfp
|
||||||
|
#endif
|
||||||
|
|
||||||
.thumb
|
.thumb
|
||||||
.text
|
.text
|
||||||
|
@ -86,8 +90,12 @@ _port_thread_start:
|
||||||
#if CH_DBG_STATISTICS
|
#if CH_DBG_STATISTICS
|
||||||
bl _stats_stop_measure_crit_thd
|
bl _stats_stop_measure_crit_thd
|
||||||
#endif
|
#endif
|
||||||
|
#if !CORTEX_SIMPLIFIED_PRIORITY
|
||||||
movs r3, #0
|
movs r3, #0
|
||||||
msr BASEPRI, r3
|
msr BASEPRI, r3
|
||||||
|
#else /* CORTEX_SIMPLIFIED_PRIORITY */
|
||||||
|
cpsie i
|
||||||
|
#endif /* CORTEX_SIMPLIFIED_PRIORITY */
|
||||||
mov r0, r5
|
mov r0, r5
|
||||||
blx r4
|
blx r4
|
||||||
bl chThdExit
|
bl chThdExit
|
||||||
|
@ -116,9 +124,9 @@ _port_switch_from_isr:
|
||||||
.globl _port_exit_from_isr
|
.globl _port_exit_from_isr
|
||||||
_port_exit_from_isr:
|
_port_exit_from_isr:
|
||||||
#if CORTEX_SIMPLIFIED_PRIORITY
|
#if CORTEX_SIMPLIFIED_PRIORITY
|
||||||
mov r3, #SCB_ICSR :AND: 0xFFFF
|
movw r3, #:lower16:SCB_ICSR
|
||||||
movt r3, #SCB_ICSR :SHR: 16
|
movt r3, #:upper16:SCB_ICSR
|
||||||
mov r2, #ICSR_PENDSVSET
|
mov r2, ICSR_PENDSVSET
|
||||||
str r2, [r3, #0]
|
str r2, [r3, #0]
|
||||||
cpsie i
|
cpsie i
|
||||||
#else /* !CORTEX_SIMPLIFIED_PRIORITY */
|
#else /* !CORTEX_SIMPLIFIED_PRIORITY */
|
||||||
|
|
|
@ -258,7 +258,7 @@ void _default_exit(void) {
|
||||||
#if !defined(__DOXYGEN__)
|
#if !defined(__DOXYGEN__)
|
||||||
__attribute__((naked))
|
__attribute__((naked))
|
||||||
#endif
|
#endif
|
||||||
void ResetHandler(void) {
|
void Reset_Handler(void) {
|
||||||
uint32_t psp, reg;
|
uint32_t psp, reg;
|
||||||
|
|
||||||
/* Process Stack initialization, it is allocated starting from the
|
/* Process Stack initialization, it is allocated starting from the
|
||||||
|
|
|
@ -35,7 +35,7 @@ __ram_start__ = ORIGIN(ram);
|
||||||
__ram_size__ = LENGTH(ram);
|
__ram_size__ = LENGTH(ram);
|
||||||
__ram_end__ = __ram_start__ + __ram_size__;
|
__ram_end__ = __ram_start__ + __ram_size__;
|
||||||
|
|
||||||
ENTRY(ResetHandler)
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,7 +34,7 @@ __ram_start__ = ORIGIN(ram);
|
||||||
__ram_size__ = LENGTH(ram);
|
__ram_size__ = LENGTH(ram);
|
||||||
__ram_end__ = __ram_start__ + __ram_size__;
|
__ram_end__ = __ram_start__ + __ram_size__;
|
||||||
|
|
||||||
ENTRY(ResetHandler)
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue