From 50f9e505e509956d401341762da15c1d8267522e Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Tue, 16 Feb 2016 10:47:01 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8903 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- 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 +++++----- 5 files changed, 62 insertions(+), 26 deletions(-) (limited to 'demos/SPC5') 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_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_ENABLE_TRACE FALSE +#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); } -- cgit v1.2.3