From 27e1398be3821f814aee4eaf7627b2d8fb5c4934 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 20 Feb 2016 13:51:02 +0000 Subject: Shell reorganization. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8913 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/STM32F7xx/USB_CDC/Makefile | 9 ++--- testhal/STM32/STM32F7xx/USB_CDC/main.c | 59 +------------------------------- 2 files changed, 6 insertions(+), 62 deletions(-) (limited to 'testhal/STM32') diff --git a/testhal/STM32/STM32F7xx/USB_CDC/Makefile b/testhal/STM32/STM32F7xx/USB_CDC/Makefile index c8262db2d..f94db3344 100644 --- a/testhal/STM32/STM32F7xx/USB_CDC/Makefile +++ b/testhal/STM32/STM32F7xx/USB_CDC/Makefile @@ -99,6 +99,8 @@ include $(CHIBIOS)/os/rt/rt.mk include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk # Other files (optional). include $(CHIBIOS)/test/rt/test.mk +include $(CHIBIOS)/os/hal/lib/streams/streams.mk +include $(CHIBIOS)/os/various/shell/shell.mk # Define linker script file here LDSCRIPT= $(STARTUPLD)/STM32F746xG.ld @@ -113,9 +115,8 @@ CSRC = $(STARTUPSRC) \ $(PLATFORMSRC) \ $(BOARDSRC) \ $(TESTSRC) \ - $(CHIBIOS)/os/various/shell.c \ - $(CHIBIOS)/os/hal/lib/streams/memstreams.c \ - $(CHIBIOS)/os/hal/lib/streams/chprintf.c \ + $(STREAMSSRC) \ + $(SHELLSRC) \ usbcfg.c main.c # C++ sources that can be compiled in ARM or THUMB mode depending on the global @@ -147,7 +148,7 @@ ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM) INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ - $(CHIBIOS)/os/hal/lib/streams $(CHIBIOS)/os/various + $(STREAMSINC) $(SHELLINC) # # Project, sources and paths diff --git a/testhal/STM32/STM32F7xx/USB_CDC/main.c b/testhal/STM32/STM32F7xx/USB_CDC/main.c index b75c37cda..d703f52c5 100644 --- a/testhal/STM32/STM32F7xx/USB_CDC/main.c +++ b/testhal/STM32/STM32F7xx/USB_CDC/main.c @@ -31,59 +31,6 @@ /*===========================================================================*/ #define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(2048) -#define TEST_WA_SIZE THD_WORKING_AREA_SIZE(256) - -static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) { - size_t n, total, largest; - - (void)argv; - if (argc > 0) { - chprintf(chp, "Usage: mem\r\n"); - return; - } - n = chHeapStatus(NULL, &total, &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", total); - chprintf(chp, "heap free largest: %u bytes\r\n", largest); -} - -static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) { - static const char *states[] = {CH_STATE_NAMES}; - thread_t *tp; - - (void)argv; - if (argc > 0) { - chprintf(chp, "Usage: threads\r\n"); - return; - } - chprintf(chp, "stklimit stack addr prio state name\r\n"); - tp = chRegFirstThread(); - do { - chprintf(chp, "%08lx %08lx %08lx %4lu %9s %12s\r\n", - (uint32_t)tp->stklimit, (uint32_t)tp->ctx.r13, (uint32_t)tp, - (uint32_t)tp->prio, states[tp->state], - tp->name == NULL ? "" : tp->name); - tp = chRegNextThread(tp); - } while (tp != NULL); -} - -static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) { - thread_t *tp; - - (void)argv; - if (argc > 0) { - chprintf(chp, "Usage: test\r\n"); - return; - } - tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriorityX(), - TestThread, chp); - if (tp == NULL) { - chprintf(chp, "out of memory\r\n"); - return; - } - chThdWait(tp); -} /* Can be measured using dd if=/dev/xxxx of=/dev/null bs=512 count=10000.*/ static void cmd_write(BaseSequentialStream *chp, int argc, char *argv[]) { @@ -126,9 +73,6 @@ static void cmd_write(BaseSequentialStream *chp, int argc, char *argv[]) { } static const ShellCommand commands[] = { - {"mem", cmd_mem}, - {"threads", cmd_threads}, - {"test", cmd_test}, {"write", cmd_write}, {NULL, NULL} }; @@ -218,8 +162,7 @@ int main(void) { shellThread, (void *)&shell_cfg1); } else if (chThdTerminatedX(shelltp)) { - chThdWait(shelltp); - chHeapFree(chthdGetStackLimitX(shelltp)); + chThdFreeToHeap(shelltp); shelltp = NULL; /* Triggers spawning of a new shell. */ } #if 0 -- cgit v1.2.3