aboutsummaryrefslogtreecommitdiffstats
path: root/demos/AVR-AT90CANx-GCC
diff options
context:
space:
mode:
Diffstat (limited to 'demos/AVR-AT90CANx-GCC')
-rw-r--r--demos/AVR-AT90CANx-GCC/chconf.h4
-rw-r--r--demos/AVR-AT90CANx-GCC/chcore.h31
2 files changed, 17 insertions, 18 deletions
diff --git a/demos/AVR-AT90CANx-GCC/chconf.h b/demos/AVR-AT90CANx-GCC/chconf.h
index c6146f5e7..2bc89dc2f 100644
--- a/demos/AVR-AT90CANx-GCC/chconf.h
+++ b/demos/AVR-AT90CANx-GCC/chconf.h
@@ -163,6 +163,10 @@
*/
//#define CH_USE_DEBUG
+/** Debug option: Includes the threads context switch tracing feature.
+ */
+//#define CH_USE_TRACE
+
#endif /* _CHCONF_H_ */
/** @} */
diff --git a/demos/AVR-AT90CANx-GCC/chcore.h b/demos/AVR-AT90CANx-GCC/chcore.h
index 07cb45f64..9e1b95db8 100644
--- a/demos/AVR-AT90CANx-GCC/chcore.h
+++ b/demos/AVR-AT90CANx-GCC/chcore.h
@@ -83,26 +83,21 @@ typedef struct {
/**
* Platform dependent part of the \p chThdCreate() API.
*/
-#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \
- tp->p_ctx.sp--; \
- tp->p_ctx.sp->r2 = (int)pf; \
- tp->p_ctx.sp->r3 = (int)pf >> 8; \
- tp->p_ctx.sp->r4 = (int)arg; \
- tp->p_ctx.sp->r5 = (int)arg >> 8; \
- tp->p_ctx.sp->pc = (UWORD16)threadstart; \
+#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \
+ tp->p_ctx.sp--; \
+ tp->p_ctx.sp->r2 = (int)pf; \
+ tp->p_ctx.sp->r3 = (int)pf >> 8; \
+ tp->p_ctx.sp->r4 = (int)arg; \
+ tp->p_ctx.sp->r5 = (int)arg >> 8; \
+ tp->p_ctx.sp->pc = (UWORD16)threadstart; \
}
-/*
- * Interrupt stack usage except for saved registers.
- */
-#define EXTRA_INT_STACK 0x10
-
-#define UserStackSize(n) (sizeof(Thread) + \
- sizeof(struct intctx) + \
- sizeof(struct extctx) + \
- EXTRA_INT_STACK + \
- (n))
-
+#define INT_REQUIRED_STACK 0x10
+#define StackAlign(n) (n)
+#define UserStackSize(n) StackAlign(sizeof(Thread) + \
+ sizeof(struct intctx) + \
+ sizeof(struct extctx) + \
+ (n) + (INT_REQUIRED_STACK))
#define WorkingArea(s, n) BYTE8 s[UserStackSize(n)];
#define chSysLock() asm("cli")