diff options
Diffstat (limited to 'software')
-rw-r--r-- | software/mpu/Makefile | 2 | ||||
-rw-r--r-- | software/mpu/usb-cdc-shell.c | 41 |
2 files changed, 27 insertions, 16 deletions
diff --git a/software/mpu/Makefile b/software/mpu/Makefile index a690ead..0b6e58f 100644 --- a/software/mpu/Makefile +++ b/software/mpu/Makefile @@ -66,6 +66,8 @@ ifeq ($(MCU),cortex-m4) endif endif +BUILDDIR = build-$(MURSAT_TRGT) + # Enable this if you really want to use the STM FWLib. ifeq ($(USE_FWLIB),) USE_FWLIB = no diff --git a/software/mpu/usb-cdc-shell.c b/software/mpu/usb-cdc-shell.c index c36ca19..ce62ce4 100644 --- a/software/mpu/usb-cdc-shell.c +++ b/software/mpu/usb-cdc-shell.c @@ -176,22 +176,24 @@ static int8_t shell_return_code; #define SHELL_WA_SIZE THD_WA_SIZE(2048) #define TEST_WA_SIZE THD_WA_SIZE(256) -static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) +static int8_t cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) { size_t n, size; (void)argv; if (argc > 0) { chprintf(chp, "Usage: mem\r\n"); - return; + return SHELL_CMD_CONTINUE; } n = chHeapStatus(NULL, &size); chprintf(chp, "core free memory : %u bytes\r\n", chCoreStatus()); chprintf(chp, "heap fragments : %u\r\n", n); chprintf(chp, "heap free total : %u bytes\r\n", size); + + return SHELL_CMD_CONTINUE; } -static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) +static int8_t cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) { static const char *states[] = {THD_STATE_NAMES}; Thread *tp; @@ -199,7 +201,7 @@ static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) (void)argv; if (argc > 0) { chprintf(chp, "Usage: threads\r\n"); - return; + return SHELL_CMD_CONTINUE; } chprintf(chp, " addr stack prio refs state time name\r\n"); tp = chRegFirstThread(); @@ -211,60 +213,67 @@ static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) (tp->p_name == NULL) ? "-" : tp->p_name); tp = chRegNextThread(tp); } while (tp != NULL); + + return SHELL_CMD_CONTINUE; } -static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) +static int8_t cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) { Thread *tp; (void)argv; if (argc > 0) { chprintf(chp, "Usage: test\r\n"); - return; + return SHELL_CMD_CONTINUE; } tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriority(), TestThread, chp); if (tp == NULL) { chprintf(chp, "out of memory\r\n"); - return; + return SHELL_CMD_CONTINUE; } chThdWait(tp); + + return SHELL_CMD_CONTINUE; } -static void cmd_halt(BaseSequentialStream *chp, int argc, char *argv[]) +static int8_t cmd_halt(BaseSequentialStream *chp, int argc, char *argv[]) { (void)argv; if (argc > 0) { chprintf(chp, "Usage: halt\r\n"); - return; + return SHELL_CMD_CONTINUE; } shell_return_code = MPU_HALT; chprintf(chp, "halting system.\r\n"); - /* TODO: tell shell to terminate - but how??? */ + + return SHELL_CMD_EXIT; } -static void cmd_reboot(BaseSequentialStream *chp, int argc, char *argv[]) +static int8_t cmd_reboot(BaseSequentialStream *chp, int argc, char *argv[]) { (void)argv; if (argc > 0) { chprintf(chp, "Usage: reboot\r\n"); - return; + return SHELL_CMD_CONTINUE; } shell_return_code = MPU_REBOOT; chprintf(chp, "rebooting system ...\r\n"); - /* TODO: tell shell to terminate - but how??? */ + + return SHELL_CMD_EXIT; } -static void cmd_bootloader(BaseSequentialStream *chp, int argc, char *argv[]) +static int8_t cmd_bootloader(BaseSequentialStream *chp, int argc, char *argv[]) { (void)argv; if (argc > 0) { chprintf(chp, "Usage: bootloader\r\n"); - return; + return SHELL_CMD_CONTINUE; } shell_return_code = MPU_BOOTLOADER; chprintf(chp, "rebooting to bootloader ...\r\n"); - /* TODO: tell shell to terminate - but how??? */ + + return SHELL_CMD_EXIT; } static const ShellCommand commands[] = { |