From 50f9e505e509956d401341762da15c1d8267522e Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Tue, 16 Feb 2016 10:47:01 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8903 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/LPC21xx/RT-LPC214x-OLIMEX/Makefile | 6 +-- demos/LPC21xx/RT-LPC214x-OLIMEX/chconf.h | 43 +++++++++++++++--- demos/SPC5/NIL-SPC560D-EVB/Makefile | 24 ++++++---- demos/SPC5/NIL-SPC560D-EVB/main.c | 2 +- demos/SPC5/RT-SPC560D-EVB/Makefile | 6 +-- demos/SPC5/RT-SPC560D-EVB/chconf.h | 44 ++++++++++++++++--- demos/SPC5/RT-SPC560D-EVB/main.c | 12 ++--- demos/STM32/RT-STM32F030R8-NUCLEO/Makefile | 6 +-- demos/STM32/RT-STM32F030R8-NUCLEO/chconf.h | 42 +++++++++++++++--- ...0R8-NUCLEO (OpenOCD, Flash and Run).launch | 2 +- demos/STM32/RT-STM32L476RG-NUCLEO/mcuconf.h | 36 --------------- 11 files changed, 142 insertions(+), 81 deletions(-) diff --git a/demos/LPC21xx/RT-LPC214x-OLIMEX/Makefile b/demos/LPC21xx/RT-LPC214x-OLIMEX/Makefile index b6c0a82c6..5a3896d68 100644 --- a/demos/LPC21xx/RT-LPC214x-OLIMEX/Makefile +++ b/demos/LPC21xx/RT-LPC214x-OLIMEX/Makefile @@ -112,7 +112,7 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../.. # Startup files. -include $(CHIBIOS)/os/common/ports/ARM/compilers/GCC/mk/startup_lpc214x.mk +include $(CHIBIOS)/os/common/startup/ARM/compilers/GCC/mk/startup_lpc214x.mk # HAL-OSAL files (optional). include $(CHIBIOS)/os/hal/hal.mk include $(CHIBIOS)/os/hal/ports/LPC/LPC214x/platform.mk @@ -120,7 +120,7 @@ include $(CHIBIOS)/os/hal/boards/OLIMEX_LPC_P2148/board.mk include $(CHIBIOS)/os/hal/osal/rt/osal.mk # RTOS files (optional). include $(CHIBIOS)/os/rt/rt.mk -include $(CHIBIOS)/os/rt/ports/ARM/compilers/GCC/mk/port_generic.mk +include $(CHIBIOS)/os/common/ports/ARM/compilers/GCC/mk/port_generic.mk # Other files (optional). include $(CHIBIOS)/test/rt/test.mk @@ -236,5 +236,5 @@ ULIBS = # End of user defines ############################################################################## -RULESPATH = $(CHIBIOS)/os/common/ports/ARM/compilers/GCC +RULESPATH = $(CHIBIOS)/os/common/startup/ARM/compilers/GCC include $(RULESPATH)/rules.mk diff --git a/demos/LPC21xx/RT-LPC214x-OLIMEX/chconf.h b/demos/LPC21xx/RT-LPC214x-OLIMEX/chconf.h index 4fb581a09..e49bdc2a2 100644 --- a/demos/LPC21xx/RT-LPC214x-OLIMEX/chconf.h +++ b/demos/LPC21xx/RT-LPC214x-OLIMEX/chconf.h @@ -28,6 +28,8 @@ #ifndef _CHCONF_H_ #define _CHCONF_H_ +#define _CHIBIOS_RT_CONF_ + /*===========================================================================*/ /** * @name System timers settings @@ -190,6 +192,7 @@ * memory footprint. * * @note The default is @p FALSE. + * @note Requires @p CH_CFG_USE_MUTEXES. */ #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE @@ -359,9 +362,16 @@ * @details If enabled then the context switch circular trace buffer is * activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_NONE. */ -#define CH_DBG_ENABLE_TRACE FALSE +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_NONE + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_NONE. + */ +#define CH_DBG_TRACE_BUFFER_SIZE 128 /** * @brief Debug option, stack checks. @@ -426,10 +436,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -443,6 +449,20 @@ /* Context switch code here.*/ \ } +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} + /** * @brief Idle thread enter hook. * @note This hook is invoked within a critical zone, no OS functions @@ -450,6 +470,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -459,6 +480,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -487,6 +509,15 @@ /* System halt code here.*/ \ } +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} + /** @} */ /*===========================================================================*/ diff --git a/demos/SPC5/NIL-SPC560D-EVB/Makefile b/demos/SPC5/NIL-SPC560D-EVB/Makefile index ae0cf9460..810804d03 100644 --- a/demos/SPC5/NIL-SPC560D-EVB/Makefile +++ b/demos/SPC5/NIL-SPC560D-EVB/Makefile @@ -82,35 +82,41 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../.. +# Startup files. +include $(CHIBIOS)/os/common/startup/e200/compilers/GCC/mk/startup_spc560dxx.mk +# HAL-OSAL files (optional). include $(CHIBIOS)/os/hal/hal.mk include $(CHIBIOS)/os/hal/boards/ST_EVB_SPC560D/board.mk include $(CHIBIOS)/os/hal/ports/SPC5/SPC560Dxx/platform.mk include $(CHIBIOS)/os/hal/osal/nil/osal.mk +# RTOS files (optional). include $(CHIBIOS)/os/nil/nil.mk -include $(CHIBIOS)/os/nil/ports/e200/compilers/GCC/mk/port_spc560dxx.mk +include $(CHIBIOS)/os/common/ports/e200/compilers/GCC/mk/port.mk +# Other files (optional). include $(CHIBIOS)/test/nil/test.mk # Define linker script file here -LDSCRIPT= $(PORTLD)/SPC560D40.ld +LDSCRIPT= $(STARTUPLD)/SPC560D40.ld # C sources here. -CSRC = $(PORTSRC) \ +CSRC = $(STARTUPSRC) \ $(KERNSRC) \ - $(TESTSRC) \ - $(HALSRC) \ + $(PORTSRC) \ $(OSALSRC) \ + $(HALSRC) \ $(PLATFORMSRC) \ $(BOARDSRC) \ + $(TESTSRC) \ main.c # C++ sources here. CPPSRC = # List ASM source files here -ASMSRC = $(PORTASM) +ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) -INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \ - $(HALINC) $(OSALINC) $(PLATFORMINC) $(BOARDINC) \ +INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ + $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ $(CHIBIOS)/os/various # @@ -175,5 +181,5 @@ ULIBS = # End of user defines ############################################################################## -RULESPATH = $(CHIBIOS)/os/common/ports/e200/compilers/GCC +RULESPATH = $(CHIBIOS)/os/common/startup/e200/compilers/GCC include $(RULESPATH)/rules.mk diff --git a/demos/SPC5/NIL-SPC560D-EVB/main.c b/demos/SPC5/NIL-SPC560D-EVB/main.c index f730fcf62..e4da88028 100644 --- a/demos/SPC5/NIL-SPC560D-EVB/main.c +++ b/demos/SPC5/NIL-SPC560D-EVB/main.c @@ -14,7 +14,7 @@ limitations under the License. */ -#include "nil.h" +#include "ch.h" #include "hal.h" #include "ch_test.h" diff --git a/demos/SPC5/RT-SPC560D-EVB/Makefile b/demos/SPC5/RT-SPC560D-EVB/Makefile index 36836cfdc..e887acb15 100644 --- a/demos/SPC5/RT-SPC560D-EVB/Makefile +++ b/demos/SPC5/RT-SPC560D-EVB/Makefile @@ -83,7 +83,7 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../.. # Startup files. -include $(CHIBIOS)/os/common/ports/e200/compilers/GCC/mk/startup_spc560dxx.mk +include $(CHIBIOS)/os/common/startup/e200/compilers/GCC/mk/startup_spc560dxx.mk # HAL-OSAL files (optional). include $(CHIBIOS)/os/hal/hal.mk include $(CHIBIOS)/os/hal/boards/ST_EVB_SPC560D/board.mk @@ -91,7 +91,7 @@ include $(CHIBIOS)/os/hal/ports/SPC5/SPC560Dxx/platform.mk include $(CHIBIOS)/os/hal/osal/rt/osal.mk # RTOS files (optional). include $(CHIBIOS)/os/rt/rt.mk -include $(CHIBIOS)/os/rt/ports/e200/compilers/GCC/mk/port.mk +include $(CHIBIOS)/os/common/ports/e200/compilers/GCC/mk/port.mk # Other files (optional). include $(CHIBIOS)/test/rt/test.mk @@ -184,5 +184,5 @@ ULIBS = # End of user defines ############################################################################## -RULESPATH = $(CHIBIOS)/os/common/ports/e200/compilers/GCC +RULESPATH = $(CHIBIOS)/os/common/startup/e200/compilers/GCC include $(RULESPATH)/rules.mk diff --git a/demos/SPC5/RT-SPC560D-EVB/chconf.h b/demos/SPC5/RT-SPC560D-EVB/chconf.h index f6244ad4b..e49bdc2a2 100644 --- a/demos/SPC5/RT-SPC560D-EVB/chconf.h +++ b/demos/SPC5/RT-SPC560D-EVB/chconf.h @@ -28,6 +28,8 @@ #ifndef _CHCONF_H_ #define _CHCONF_H_ +#define _CHIBIOS_RT_CONF_ + /*===========================================================================*/ /** * @name System timers settings @@ -360,9 +362,16 @@ * @details If enabled then the context switch circular trace buffer is * activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_NONE. */ -#define CH_DBG_ENABLE_TRACE FALSE +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_NONE + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_NONE. + */ +#define CH_DBG_TRACE_BUFFER_SIZE 128 /** * @brief Debug option, stack checks. @@ -395,7 +404,7 @@ * @note This debug option is not currently compatible with the * tickless mode. */ -#define CH_DBG_THREADS_PROFILING FALSE +#define CH_DBG_THREADS_PROFILING TRUE /** @} */ @@ -427,10 +436,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -444,6 +449,20 @@ /* Context switch code here.*/ \ } +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} + /** * @brief Idle thread enter hook. * @note This hook is invoked within a critical zone, no OS functions @@ -451,6 +470,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -460,6 +480,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -488,6 +509,15 @@ /* System halt code here.*/ \ } +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} + /** @} */ /*===========================================================================*/ diff --git a/demos/SPC5/RT-SPC560D-EVB/main.c b/demos/SPC5/RT-SPC560D-EVB/main.c index 957f0e8c2..a83128f2c 100644 --- a/demos/SPC5/RT-SPC560D-EVB/main.c +++ b/demos/SPC5/RT-SPC560D-EVB/main.c @@ -24,17 +24,18 @@ #define TEST_WA_SIZE THD_WORKING_AREA_SIZE(256) static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) { - size_t n, size; + size_t n, size, largest; (void)argv; if (argc > 0) { chprintf(chp, "Usage: mem\r\n"); return; } - n = chHeapStatus(NULL, &size); + n = chHeapStatus(NULL, &size, &largest); chprintf(chp, "core free memory : %u bytes\r\n", chCoreGetStatusX()); chprintf(chp, "heap fragments : %u\r\n", n); chprintf(chp, "heap free total : %u bytes\r\n", size); + chprintf(chp, "heap free largest: %u bytes\r\n", largest); } static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) { @@ -49,10 +50,9 @@ static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) { chprintf(chp, " addr stack prio refs state time\r\n"); tp = chRegFirstThread(); do { - chprintf(chp, "%08lx %08lx %4lu %4lu %9s\r\n", - (uint32_t)tp, (uint32_t)tp->p_ctx.sp, - (uint32_t)tp->p_prio, (uint32_t)(tp->p_refs - 1), - states[tp->p_state]); + chprintf(chp, "%08lx %08lx %4lu %9s\r\n", + (uint32_t)tp, (uint32_t)tp->ctx.sp, + (uint32_t)tp->prio, states[tp->state]); tp = chRegNextThread(tp); } while (tp != NULL); } diff --git a/demos/STM32/RT-STM32F030R8-NUCLEO/Makefile b/demos/STM32/RT-STM32F030R8-NUCLEO/Makefile index 7b26e8d86..634812f06 100644 --- a/demos/STM32/RT-STM32F030R8-NUCLEO/Makefile +++ b/demos/STM32/RT-STM32F030R8-NUCLEO/Makefile @@ -83,7 +83,7 @@ PROJECT = ch # Imported source files and paths CHIBIOS = ../../.. # Startup files. -include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/startup_stm32f0xx.mk +include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f0xx.mk # HAL-OSAL files (optional). include $(CHIBIOS)/os/hal/hal.mk include $(CHIBIOS)/os/hal/ports/STM32/STM32F0xx/platform.mk @@ -91,7 +91,7 @@ include $(CHIBIOS)/os/hal/boards/ST_NUCLEO_F030R8/board.mk include $(CHIBIOS)/os/hal/osal/rt/osal.mk # RTOS files (optional). include $(CHIBIOS)/os/rt/rt.mk -include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk +include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk # Other files (optional). include $(CHIBIOS)/test/rt/test.mk @@ -207,5 +207,5 @@ ULIBS = # End of user defines ############################################################################## -RULESPATH = $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC +RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC include $(RULESPATH)/rules.mk diff --git a/demos/STM32/RT-STM32F030R8-NUCLEO/chconf.h b/demos/STM32/RT-STM32F030R8-NUCLEO/chconf.h index 3efdfc677..b88665f4c 100644 --- a/demos/STM32/RT-STM32F030R8-NUCLEO/chconf.h +++ b/demos/STM32/RT-STM32F030R8-NUCLEO/chconf.h @@ -28,6 +28,8 @@ #ifndef _CHCONF_H_ #define _CHCONF_H_ +#define _CHIBIOS_RT_CONF_ + /*===========================================================================*/ /** * @name System timers settings @@ -360,9 +362,16 @@ * @details If enabled then the context switch circular trace buffer is * activated. * - * @note The default is @p FALSE. + * @note The default is @p CH_DBG_TRACE_MASK_NONE. */ -#define CH_DBG_ENABLE_TRACE FALSE +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_NONE + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_NONE. + */ +#define CH_DBG_TRACE_BUFFER_SIZE 128 /** * @brief Debug option, stack checks. @@ -427,10 +436,6 @@ /** * @brief Threads finalization hook. * @details User finalization code added to the @p chThdExit() API. - * - * @note It is inserted into lock zone. - * @note It is also invoked when the threads simply return in order to - * terminate. */ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ /* Add threads finalization code here.*/ \ @@ -444,6 +449,20 @@ /* Context switch code here.*/ \ } +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} + /** * @brief Idle thread enter hook. * @note This hook is invoked within a critical zone, no OS functions @@ -451,6 +470,7 @@ * @note This macro can be used to activate a power saving mode. */ #define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ } /** @@ -460,6 +480,7 @@ * @note This macro can be used to deactivate a power saving mode. */ #define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ } /** @@ -488,6 +509,15 @@ /* System halt code here.*/ \ } +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} + /** @} */ /*===========================================================================*/ diff --git a/demos/STM32/RT-STM32F030R8-NUCLEO/debug/RT-STM32F030R8-NUCLEO (OpenOCD, Flash and Run).launch b/demos/STM32/RT-STM32F030R8-NUCLEO/debug/RT-STM32F030R8-NUCLEO (OpenOCD, Flash and Run).launch index 0a8beb859..1ce99493e 100644 --- a/demos/STM32/RT-STM32F030R8-NUCLEO/debug/RT-STM32F030R8-NUCLEO (OpenOCD, Flash and Run).launch +++ b/demos/STM32/RT-STM32F030R8-NUCLEO/debug/RT-STM32F030R8-NUCLEO (OpenOCD, Flash and Run).launch @@ -39,7 +39,7 @@ - + diff --git a/demos/STM32/RT-STM32L476RG-NUCLEO/mcuconf.h b/demos/STM32/RT-STM32L476RG-NUCLEO/mcuconf.h index e2b12de15..8cacd9a2a 100644 --- a/demos/STM32/RT-STM32L476RG-NUCLEO/mcuconf.h +++ b/demos/STM32/RT-STM32L476RG-NUCLEO/mcuconf.h @@ -112,32 +112,6 @@ #define STM32_ADC_ADC3_DMA_IRQ_PRIORITY 5 #define STM32_ADC_ADC123_CLOCK_MODE ADC_CCR_CKMODE_AHB_DIV1 -/* - * CAN driver system settings. - */ -#define STM32_CAN_USE_CAN1 FALSE -#define STM32_CAN_CAN1_IRQ_PRIORITY 11 - -/* - * GPT driver system settings. - */ -#define STM32_GPT_USE_TIM1 FALSE -#define STM32_GPT_USE_TIM2 FALSE -#define STM32_GPT_USE_TIM3 FALSE -#define STM32_GPT_USE_TIM4 FALSE -#define STM32_GPT_USE_TIM5 FALSE -#define STM32_GPT_USE_TIM6 FALSE -#define STM32_GPT_USE_TIM7 FALSE -#define STM32_GPT_USE_TIM8 FALSE -#define STM32_GPT_TIM1_IRQ_PRIORITY 7 -#define STM32_GPT_TIM2_IRQ_PRIORITY 7 -#define STM32_GPT_TIM3_IRQ_PRIORITY 7 -#define STM32_GPT_TIM4_IRQ_PRIORITY 7 -#define STM32_GPT_TIM5_IRQ_PRIORITY 7 -#define STM32_GPT_TIM6_IRQ_PRIORITY 7 -#define STM32_GPT_TIM7_IRQ_PRIORITY 7 -#define STM32_GPT_TIM8_IRQ_PRIORITY 7 - /* * SDC driver system settings. */ @@ -168,16 +142,6 @@ #define STM32_ST_IRQ_PRIORITY 8 #define STM32_ST_USE_TIMER 2 -/* - * USB driver system settings. - */ -#define STM32_USB_USE_OTG1 FALSE -#define STM32_USB_OTG1_IRQ_PRIORITY 14 -#define STM32_USB_OTG1_RX_FIFO_SIZE 512 -#define STM32_USB_OTG_THREAD_PRIO LOWPRIO -#define STM32_USB_OTG_THREAD_STACK_SIZE 128 -#define STM32_USB_OTGFIFO_FILL_BASEPRI 0 - /* * WDG driver system settings. */