Space optimization for Cortex-M3 port.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@844 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
b4357c2bf7
commit
196ea50917
|
@ -42,6 +42,18 @@ void port_halt(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !CH_OPTIMIZE_SPEED
|
||||||
|
void _port_lock(void) {
|
||||||
|
register uint32_t tmp asm ("r3") = BASEPRI_KERNEL;
|
||||||
|
asm volatile ("msr BASEPRI, %0" : : "r" (tmp));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _port_unlock(void) {
|
||||||
|
register uint32_t tmp asm ("r3") = BASEPRI_USER;
|
||||||
|
asm volatile ("msr BASEPRI, %0" : : "r" (tmp));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* System Timer vector.
|
* System Timer vector.
|
||||||
* This interrupt is used as system tick.
|
* This interrupt is used as system tick.
|
||||||
|
|
|
@ -221,18 +221,30 @@ struct context {
|
||||||
/**
|
/**
|
||||||
* Raises the base priority to kernel level.
|
* Raises the base priority to kernel level.
|
||||||
*/
|
*/
|
||||||
|
#if CH_OPTIMIZE_SPEED
|
||||||
#define port_lock() { \
|
#define port_lock() { \
|
||||||
register uint32_t tmp asm ("r3") = BASEPRI_KERNEL; \
|
register uint32_t tmp asm ("r3") = BASEPRI_KERNEL; \
|
||||||
asm volatile ("msr BASEPRI, %0" : : "r" (tmp)); \
|
asm volatile ("msr BASEPRI, %0" : : "r" (tmp)); \
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#define port_lock() { \
|
||||||
|
asm volatile ("bl _port_lock" : : : "r3", "lr"); \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lowers the base priority to user level.
|
* Lowers the base priority to user level.
|
||||||
*/
|
*/
|
||||||
|
#if CH_OPTIMIZE_SPEED
|
||||||
#define port_unlock() { \
|
#define port_unlock() { \
|
||||||
register uint32_t tmp asm ("r3") = BASEPRI_USER; \
|
register uint32_t tmp asm ("r3") = BASEPRI_USER; \
|
||||||
asm volatile ("msr BASEPRI, %0" : : "r" (tmp)); \
|
asm volatile ("msr BASEPRI, %0" : : "r" (tmp)); \
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#define port_unlock() { \
|
||||||
|
asm volatile ("bl _port_unlock" : : : "r3", "lr"); \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as @p port_lock() in this port.
|
* Same as @p port_lock() in this port.
|
||||||
|
@ -303,6 +315,10 @@ struct context {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void port_halt(void);
|
void port_halt(void);
|
||||||
|
#if !CH_OPTIMIZE_SPEED
|
||||||
|
void _port_lock(void);
|
||||||
|
void _port_unlock(void);
|
||||||
|
#endif
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -87,8 +87,10 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
|
||||||
the macro chSysGetTime() in chTimeNow(), the old names are still recognized
|
the macro chSysGetTime() in chTimeNow(), the old names are still recognized
|
||||||
but marked as deprecated (fixes the bug 2678953 but goes a bit further by
|
but marked as deprecated (fixes the bug 2678953 but goes a bit further by
|
||||||
introducing a new API category "Time").
|
introducing a new API category "Time").
|
||||||
- OPT: Small optimization to the Cortex-M3 port code, improved thread
|
- OPT: Small optimization to the Cortex-M3 thread startup code, improved thread
|
||||||
related performance scores and smaller code.
|
related performance scores and smaller code.
|
||||||
|
- OPT: Alternative implementations for port_lock() and port_unlock() when
|
||||||
|
CH_OPTIMIZE_SPEED is FALSE, huge space savings.
|
||||||
- OPT: Improved ready list and priority ordered lists code, saved some tens
|
- OPT: Improved ready list and priority ordered lists code, saved some tens
|
||||||
of bytes here and there in the kernel.
|
of bytes here and there in the kernel.
|
||||||
- Modified the test thread function to return the global test result flag.
|
- Modified the test thread function to return the global test result flag.
|
||||||
|
|
Loading…
Reference in New Issue