aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates
diff options
context:
space:
mode:
Diffstat (limited to 'src/templates')
-rw-r--r--src/templates/chconf.h6
-rw-r--r--src/templates/chcore.c6
-rw-r--r--src/templates/chcore.h41
3 files changed, 39 insertions, 14 deletions
diff --git a/src/templates/chconf.h b/src/templates/chconf.h
index c8214c623..d8f0f9ae4 100644
--- a/src/templates/chconf.h
+++ b/src/templates/chconf.h
@@ -157,12 +157,16 @@
*/
//#define CH_CURRP_REGISTER_CACHE "reg"
-/** Configuration option: Includes basic debug support to the kernel.
+/** Debug option: Includes basic debug support to the kernel.
* @note the debug support is port-dependent, it may be not present on some
* targets. In that case stub functions will be included.
*/
#define CH_USE_DEBUG
+/** Debug option: Includes the threads context switch tracing feature.
+ */
+#define CH_USE_TRACE
+
#endif /* _CHCONF_H_ */
/** @} */
diff --git a/src/templates/chcore.c b/src/templates/chcore.c
index ec2b39592..195113abf 100644
--- a/src/templates/chcore.c
+++ b/src/templates/chcore.c
@@ -59,4 +59,10 @@ void chSysHalt(void) {
*/
void chSysSwitchI(Context *oldp, Context *newp) {}
+/**
+ * Prints a message on the system console (if any).
+ */
+void chSysPuts(char *msg) {
+}
+
/** @} */
diff --git a/src/templates/chcore.h b/src/templates/chcore.h
index 7f2c5fb0b..c88748f8b 100644
--- a/src/templates/chcore.h
+++ b/src/templates/chcore.h
@@ -25,21 +25,27 @@
#ifndef _CHCORE_H_
#define _CHCORE_H_
-/*
- * Stack saved context.
+/**
+ * Interrupt saved context.
+ */
+struct extctx {
+};
+
+/**
+ * System saved context.
*/
-struct stackregs {
+struct intctx {
};
typedef struct {
- struct stackregs *sp;
+ struct intctx *sp;
} Context;
/**
* Platform dependent part of the \p chThdCreate() API.
*/
-#define SETUP_CONTEXT(workspace, wsize, pf, arg) \
-{ \
+#define SETUP_CONTEXT(workspace, wsize, pf, arg) \
+{ \
}
/**
@@ -53,11 +59,24 @@ typedef struct {
#define INT_REQUIRED_STACK 0
/**
+ * Enforces a stack size alignment.
+ */
+#define StackAlign(n) (n)
+
+/**
* Macro to be used when allocating stack spaces, it adds the system-specific
* overhead.
*/
-#define UserStackSize(n) (sizeof(Thread) + \
- sizeof(struct stackregs) + (n) + (INT_REQUIRED_STACK))
+#define UserStackSize(n) StackAlign(sizeof(Thread) + \
+ sizeof(struct intctx) + \
+ sizeof(struct extctx) + \
+ (n) + (INT_REQUIRED_STACK))
+
+/**
+ * Macro used to allocate a thread working area aligned as both position and
+ * size.
+ */
+#define WorkingArea(s, n) BYTE8 s[UserStackSize(n)];
/**
* Enters the ChibiOS/RT system mutual exclusion zone, the implementation is
@@ -81,14 +100,10 @@ typedef struct {
*/
#define chSysUnlock()
-/**
- * Prints a message on the system console (if any).
- */
-#define chSysPuts(msg) {}
-
void _IdleThread(void *p);
void chSysHalt(void);
void chSysSwitchI(Context *oldp, Context *newp);
+void chSysPuts(char *msg);
#endif /* _CHCORE_H_ */