From 1585e2851cd4d862b4e08efd2b200f0401110133 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 9 Mar 2010 13:43:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1733 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARMCM3-STM32F103-GCC/ride7/ch.rapp | 139 +++++++++++++++++++++++++++++++ demos/ARMCM3-STM32F103-GCC/ride7/ch.rprj | 4 + demos/STM8S-STM8S208-RC/ch.rapp | 66 +++++++-------- docs/Doxyfile | 2 +- os/kernel/include/ch.h | 4 +- os/ports/RC/STM8/chcore.c | 32 +++++++ os/ports/RC/STM8/chcore.h | 25 ++++-- readme.txt | 5 ++ 8 files changed, 232 insertions(+), 45 deletions(-) create mode 100644 demos/ARMCM3-STM32F103-GCC/ride7/ch.rapp create mode 100644 demos/ARMCM3-STM32F103-GCC/ride7/ch.rprj diff --git a/demos/ARMCM3-STM32F103-GCC/ride7/ch.rapp b/demos/ARMCM3-STM32F103-GCC/ride7/ch.rapp new file mode 100644 index 000000000..3dbacd826 --- /dev/null +++ b/demos/ARMCM3-STM32F103-GCC/ride7/ch.rapp @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + + + + +
+ +
+ +
+ + +
+
+ + +
+
+ + +
+ +
+ +
+ + + +
+
+ + + +
+
+ + + +
+
+ + +
+ +
+ +
+ + +
+
+ + +
+ +
+
+
+
\ No newline at end of file diff --git a/demos/ARMCM3-STM32F103-GCC/ride7/ch.rprj b/demos/ARMCM3-STM32F103-GCC/ride7/ch.rprj new file mode 100644 index 000000000..77591474e --- /dev/null +++ b/demos/ARMCM3-STM32F103-GCC/ride7/ch.rprj @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/demos/STM8S-STM8S208-RC/ch.rapp b/demos/STM8S-STM8S208-RC/ch.rapp index 487fe17a7..a1ba8f5c9 100644 --- a/demos/STM8S-STM8S208-RC/ch.rapp +++ b/demos/STM8S-STM8S208-RC/ch.rapp @@ -10,15 +10,15 @@
- +
- +
- + - + - + @@ -34,15 +34,15 @@
- +
- +
- + - + - +
@@ -53,17 +53,17 @@
- +
- +
- + - + - +
- + @@ -78,12 +78,11 @@ - + - - + @@ -98,11 +97,11 @@ - + - + @@ -110,57 +109,58 @@
- +
- +
- +
- +
- +
- +
- +
- + +
- +
- +
- +
- +
diff --git a/docs/Doxyfile b/docs/Doxyfile index b03277073..9ebf7f47d 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = ChibiOS/RT # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.5.3 +PROJECT_NUMBER = 1.5.4 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff --git a/os/kernel/include/ch.h b/os/kernel/include/ch.h index 66d7ce3a6..31845855d 100644 --- a/os/kernel/include/ch.h +++ b/os/kernel/include/ch.h @@ -38,7 +38,7 @@ /** * @brief Kernel version string. */ -#define CH_KERNEL_VERSION "1.5.3unstable" +#define CH_KERNEL_VERSION "1.5.4unstable" /** * @brief Kernel version major number. @@ -53,7 +53,7 @@ /** * @brief Kernel version patch number. */ -#define CH_KERNEL_PATCH 3 +#define CH_KERNEL_PATCH 4 /* * Common values. diff --git a/os/ports/RC/STM8/chcore.c b/os/ports/RC/STM8/chcore.c index bccfc454a..af890f6b9 100644 --- a/os/ports/RC/STM8/chcore.c +++ b/os/ports/RC/STM8/chcore.c @@ -24,9 +24,41 @@ * @addtogroup STM8_CORE * @{ */ +#pragma SRC("tmp.asm") #include "ch.h" +/** + * @brief Performs a context switch between two threads. + * + * @param otp the thread to be switched out + */ +void _port_switch(Thread *otp) { + + (void)otp; + /* Asm because unoptimal code would generated by using _getSP_().*/ +#pragma ASM + EXTRN PAGE0(rlist) + + LDW Y,SP ; old context pointer + LDW (005H,X),Y ; SP saved in otp->p_ctx.sp + LDW X,rlist + 0DH ; r_current (currp) field + LDW X,(005H,X) ; currp->p_ctx.sp + LDW SP,X ; new context pointer +#pragma ENDASM +} + +/** + * @brief Thread start code. + */ +void _port_thread_start(void) { + +#pragma ASM + RIM + POPW X +#pragma ENDASM +} + /** * @brief Halts the system. * @details This function is invoked by the operating system when an diff --git a/os/ports/RC/STM8/chcore.h b/os/ports/RC/STM8/chcore.h index f652a858b..6df8c5a61 100644 --- a/os/ports/RC/STM8/chcore.h +++ b/os/ports/RC/STM8/chcore.h @@ -46,6 +46,13 @@ */ typedef uint8_t stkalign_t; +/** + * @brief Generic STM8 function pointer. + * @note It is used to allocate the proper size for return addresses in + * context-related structures. + */ +typedef void (*stm8func_t)(void); + /** * @brief Interrupt saved context. * @details This structure represents the stack frame saved during a @@ -75,7 +82,7 @@ struct extctx { */ struct intctx { uint8_t _next; - uint16_t pc; + stm8func_t pc; /* Function pointer sized return address. */ }; /** @@ -85,10 +92,10 @@ struct intctx { */ struct startctx { uint8_t _next; - uint16_t ts; /* Trampoline address. */ - uint16_t arg; /* Thread argument. */ - uint16_t pc; /* Thread function address. */ - uint16_t ret; /* chThdExit() address. */ + stm8func_t ts; /* Trampoline address. */ + void *arg; /* Thread argument. */ + stm8func_t pc; /* Thread function address. */ + stm8func_t ret; /* chThdExit() address. */ }; /** @@ -109,10 +116,10 @@ struct context { struct startctx *scp; \ scp = (struct startctx *)((uint8_t *)workspace + wsize - \ sizeof(struct startctx)); \ - scp->ts = (uint16_t)_port_thread_start; \ - scp->arg = (uint16_t)arg; \ - scp->pc = (uint16_t)pf; \ - scp->ret = (uint16_t)chThdExit; \ + scp->ts = _port_thread_start; \ + scp->arg = arg; \ + scp->pc = (stm8func_t)pf; \ + scp->ret = (stm8func_t)chThdExit; \ tp->p_ctx.sp = (struct intctx *)scp; \ } diff --git a/readme.txt b/readme.txt index c61db542e..1aa28a6cf 100644 --- a/readme.txt +++ b/readme.txt @@ -56,6 +56,11 @@ *** Releases *** ***************************************************************************** +*** 1.5.4 *** +- NEW: Added support for the STM8 large memory model to the STM8 port. +- NEW: Added RIDE7 project files to the STM32 demo. The normal makefile is + still available of course. + *** 1.5.3 *** - FIX: Removed C99-style variables declarations (bug 2964418)(backported in 1.4.2). -- cgit v1.2.3