From 6f0569444dafdae8b367a54a07a4bfaf3675f545 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 27 Nov 2007 16:02:12 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@117 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARM7-LPC214x-GCC-minimal/chcore.c | 7 +++++- demos/ARM7-LPC214x-GCC-minimal/chcore.h | 3 ++- demos/ARM7-LPC214x-GCC/chcore.h | 3 ++- demos/Win32-MSVS/chcore.c | 2 +- demos/Win32-MSVS/chcore.h | 39 ++++++++++++++++++--------------- demos/Win32-MinGW/chcore.h | 39 ++++++++++++++++++--------------- docs/Doxyfile | 3 ++- docs/index.html | 4 ++-- readme.txt | 6 +++-- src/chdebug.c | 15 +++---------- src/include/debug.h | 1 - 11 files changed, 64 insertions(+), 58 deletions(-) diff --git a/demos/ARM7-LPC214x-GCC-minimal/chcore.c b/demos/ARM7-LPC214x-GCC-minimal/chcore.c index 068774d17..f844a6aa5 100644 --- a/demos/ARM7-LPC214x-GCC-minimal/chcore.c +++ b/demos/ARM7-LPC214x-GCC-minimal/chcore.c @@ -24,7 +24,6 @@ //#include "lpc214x_serial.h" //#include "lpc214x_ssp.h" //#include "mmcsd.h" - //#include "buzzer.h" extern void IrqHandler(void); @@ -165,6 +164,12 @@ void chSysHalt(void) { ; } +/* + * System console message (not implemented). + */ +void chSysPuts(char *msg) { +} + /* * Non-vectored IRQs handling here. */ diff --git a/demos/ARM7-LPC214x-GCC-minimal/chcore.h b/demos/ARM7-LPC214x-GCC-minimal/chcore.h index 5c595ae4f..941036830 100644 --- a/demos/ARM7-LPC214x-GCC-minimal/chcore.h +++ b/demos/ARM7-LPC214x-GCC-minimal/chcore.h @@ -97,7 +97,8 @@ extern void chSysUnlock(void); #define UserStackSize(n) StackAlign(sizeof(Thread) + \ sizeof(struct intctx) + \ sizeof(struct extctx) + \ - (n) + (INT_REQUIRED_STACK)) + (n) + \ + INT_REQUIRED_STACK) #define WorkingArea(s, n) ULONG32 s[UserStackSize(n) >> 2]; /* It requires zero bytes, but better be safe.*/ diff --git a/demos/ARM7-LPC214x-GCC/chcore.h b/demos/ARM7-LPC214x-GCC/chcore.h index 5c595ae4f..941036830 100644 --- a/demos/ARM7-LPC214x-GCC/chcore.h +++ b/demos/ARM7-LPC214x-GCC/chcore.h @@ -97,7 +97,8 @@ extern void chSysUnlock(void); #define UserStackSize(n) StackAlign(sizeof(Thread) + \ sizeof(struct intctx) + \ sizeof(struct extctx) + \ - (n) + (INT_REQUIRED_STACK)) + (n) + \ + INT_REQUIRED_STACK) #define WorkingArea(s, n) ULONG32 s[UserStackSize(n) >> 2]; /* It requires zero bytes, but better be safe.*/ diff --git a/demos/Win32-MSVS/chcore.c b/demos/Win32-MSVS/chcore.c index 0df82eec6..3915d6271 100644 --- a/demos/Win32-MSVS/chcore.c +++ b/demos/Win32-MSVS/chcore.c @@ -68,7 +68,7 @@ void ChkIntSources(void) { } } -t_msg _IdleThread(void) { +t_msg _IdleThread(void *p) { chThdSetPriority(IDLEPRIO); diff --git a/demos/Win32-MSVS/chcore.h b/demos/Win32-MSVS/chcore.h index 15a21fb40..91fd7be9e 100644 --- a/demos/Win32-MSVS/chcore.h +++ b/demos/Win32-MSVS/chcore.h @@ -29,7 +29,7 @@ typedef void *regx86; /* * Stack saved context. */ -struct stackregs { +struct intctx { regx86 ebx; regx86 edi; regx86 esi; @@ -38,33 +38,36 @@ struct stackregs { }; typedef struct { - struct stackregs *esp; + struct intctx *esp; } Context; #define APUSH(p, a) (p) -= sizeof(void *), *(void **)(p) = (void*)(a) -#define SETUP_CONTEXT(workspace, wsize, pf, arg) \ -{ \ - BYTE8 *esp = (BYTE8 *)workspace + wsize; \ - APUSH(esp, arg); \ - APUSH(esp, threadexit); \ - esp -= sizeof(struct stackregs); \ - ((struct stackregs *)esp)->eip = pf; \ - ((struct stackregs *)esp)->ebx = 0; \ - ((struct stackregs *)esp)->edi = 0; \ - ((struct stackregs *)esp)->esi = 0; \ - ((struct stackregs *)esp)->ebp = 0; \ - tp->p_ctx.esp = (struct stackregs *)esp; \ +#define SETUP_CONTEXT(workspace, wsize, pf, arg) \ +{ \ + BYTE8 *esp = (BYTE8 *)workspace + wsize; \ + APUSH(esp, arg); \ + APUSH(esp, threadexit); \ + esp -= sizeof(struct intctx); \ + ((struct intctx *)esp)->eip = pf; \ + ((struct intctx *)esp)->ebx = 0; \ + ((struct intctx *)esp)->edi = 0; \ + ((struct intctx *)esp)->esi = 0; \ + ((struct intctx *)esp)->ebp = 0; \ + tp->p_ctx.esp = (struct intctx *)esp; \ } #define chSysLock() #define chSysUnlock() #define chSysPuts(msg) {} -#define INT_REQUIRED_STACK 0x0 -#define UserStackSize(n) (sizeof(Thread) + sizeof(void *)*2 + \ - sizeof(struct stackregs) + (n) + (INT_REQUIRED_STACK)) - +#define INT_REQUIRED_STACK 0 +#define StackAlign(n) ((((n) - 1) | 3) + 1) +#define UserStackSize(n) StackAlign(sizeof(Thread) + \ + sizeof(void *) * 2 + \ + sizeof(struct intctx) + \ + (n) + \ + INT_REQUIRED_STACK) #define WorkingArea(s, n) ULONG32 s[UserStackSize(n) >> 2]; #define IDLE_THREAD_STACK_SIZE 16384 diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index c79b9bf81..2b90dd470 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -29,7 +29,7 @@ typedef void *regx86; /* * Stack saved context. */ -struct stackregs { +struct intctx { regx86 ebx; regx86 edi; regx86 esi; @@ -38,33 +38,36 @@ struct stackregs { }; typedef struct { - struct stackregs *esp; + struct intctx *esp; } Context; #define APUSH(p, a) (p) -= sizeof(void *), *(void **)(p) = (void*)(a) -#define SETUP_CONTEXT(workspace, wsize, pf, arg) \ -{ \ - BYTE8 *esp = (BYTE8 *)workspace + wsize; \ - APUSH(esp, arg); \ - APUSH(esp, threadstart); \ - esp -= sizeof(struct stackregs); \ - ((struct stackregs *)esp)->eip = pf; \ - ((struct stackregs *)esp)->ebx = 0; \ - ((struct stackregs *)esp)->edi = 0; \ - ((struct stackregs *)esp)->esi = 0; \ - ((struct stackregs *)esp)->ebp = 0; \ - tp->p_ctx.esp = (struct stackregs *)esp; \ +#define SETUP_CONTEXT(workspace, wsize, pf, arg) \ +{ \ + BYTE8 *esp = (BYTE8 *)workspace + wsize; \ + APUSH(esp, arg); \ + APUSH(esp, threadstart); \ + esp -= sizeof(struct intctx); \ + ((struct intctx *)esp)->eip = pf; \ + ((struct intctx *)esp)->ebx = 0; \ + ((struct intctx *)esp)->edi = 0; \ + ((struct intctx *)esp)->esi = 0; \ + ((struct intctx *)esp)->ebp = 0; \ + tp->p_ctx.esp = (struct intctx *)esp; \ } #define chSysLock() #define chSysUnlock() #define chSysPuts(msg) {} -#define INT_REQUIRED_STACK 0x0 -#define UserStackSize(n) (sizeof(Thread) + sizeof(void *) * 2 + \ - sizeof(struct stackregs) + (n) + (INT_REQUIRED_STACK)) - +#define INT_REQUIRED_STACK 0 +#define StackAlign(n) ((((n) - 1) | 3) + 1) +#define UserStackSize(n) StackAlign(sizeof(Thread) + \ + sizeof(void *) * 2 + \ + sizeof(struct intctx) + \ + (n) + \ + INT_REQUIRED_STACK) #define WorkingArea(s, n) ULONG32 s[UserStackSize(n) >> 2]; #define IDLE_THREAD_STACK_SIZE 16384 diff --git a/docs/Doxyfile b/docs/Doxyfile index 87ee6c879..d6dd9e5da 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -244,7 +244,8 @@ PREDEFINED = __JUST_STUBS__ \ CH_USE_MESSAGES_TIMEOUT \ CH_USE_MESSAGES_EVENT \ CH_USE_SEMSW \ - CH_USE_DEBUG + CH_USE_DEBUG \ + CH_USE_TRACE EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- diff --git a/docs/index.html b/docs/index.html index 83bd285de..526781160 100644 --- a/docs/index.html +++ b/docs/index.html @@ -13,7 +13,7 @@ Homepage Current -Version 0.4.2
+Version 0.4.3
-
Project on SourceForge
Documentation
@@ -148,4 +148,4 @@ ChibiOS/RT was created using:
- \ No newline at end of file + diff --git a/readme.txt b/readme.txt index 375932bf1..7399f6948 100644 --- a/readme.txt +++ b/readme.txt @@ -40,13 +40,15 @@ AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not complete yet. ***************************************************************************** *** 0.4.3 *** -- Minor improvement in the LPC214x serial driver, unneeded events were - generated. - Size optimization in the events code, now the chEvtWait() reuses the chEvtWaitTimeout() code if it is enabled. - Size optimization in the semaphores code, now the chSemWaitTimeout() just invokes the chSemWaitTimeoutS() inside its system mutex zone. +- Minor improvement in the LPC214x serial driver, unneeded events were + generated in some rare cases. - Fixed a chSysInit() documentation error. +- Added a new debug switch: CH_USE_TRACE, previously the trace functionality + was associated to the CH_USE_DEBUG switch. *** 0.4.2 *** - Added a minimal ARM7-LPC demo, you can use this one as template in order to diff --git a/src/chdebug.c b/src/chdebug.c index 29e855e9c..211e1de33 100644 --- a/src/chdebug.c +++ b/src/chdebug.c @@ -21,7 +21,7 @@ #ifdef CH_USE_DEBUG -char *dbglastmsg; +char *panicmsg; /** * Debug subsystem initialization. @@ -34,23 +34,14 @@ void chDbgInit(void) { #endif } -/** - * Prints a message on the console/debugger. The latest message pointer - * is retained. - */ -void chDbgPuts(char *msg) { - - dbglastmsg = msg; - chSysPuts(msg); -} - /** * Prints a panic message on the console/debugger and then halts the system. */ void chDbgPanic(char *msg) { + panicmsg = msg; chSysPuts("PANIC: "); - chDbgPuts(msg); + chSysPuts(msg); chSysHalt(); } diff --git a/src/include/debug.h b/src/include/debug.h index bf5b3ee7d..f5aed7ffe 100644 --- a/src/include/debug.h +++ b/src/include/debug.h @@ -61,7 +61,6 @@ extern "C" { #else /* CH_USE_DEBUG */ #define chDbgInit() -#define chDbgPuts(msg) {} #define chDbgPanic(msg) {} #endif /* CH_USE_DEBUG */ -- cgit v1.2.3