From 354096a9730611e2af046273e5758c6504cac79e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 25 Mar 2018 15:10:41 +0000 Subject: Fixed bug #930. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11855 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h | 1 - os/hal/src/hal_serial_usb.c | 17 +++++++---- os/various/shell/shell.c | 6 ++-- os/various/shell/shell.h | 15 +++++----- os/various/shell/shell_cmd.c | 34 +++++++++++----------- readme.txt | 2 ++ ...Select ELF file)(OpenOCD, Flash and Run).launch | 4 +-- .../multi/QSPI-MFS/make/stm32l476_discovery.make | 2 +- 8 files changed, 44 insertions(+), 37 deletions(-) diff --git a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h index 56ef3792c..7c2019685 100644 --- a/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h +++ b/os/hal/ports/STM32/LLD/OTGv1/hal_usb_lld.h @@ -616,7 +616,6 @@ extern "C" { void usb_lld_stall_in(USBDriver *usbp, usbep_t ep); void usb_lld_clear_out(USBDriver *usbp, usbep_t ep); void usb_lld_clear_in(USBDriver *usbp, usbep_t ep); - void usb_lld_pump(void *p); #ifdef __cplusplus } #endif diff --git a/os/hal/src/hal_serial_usb.c b/os/hal/src/hal_serial_usb.c index ec1f1c4fe..246360ebc 100644 --- a/os/hal/src/hal_serial_usb.c +++ b/os/hal/src/hal_serial_usb.c @@ -484,20 +484,25 @@ void sduDataTransmitted(USBDriver *usbp, usbep_t ep) { * @param[in] ep OUT endpoint number */ void sduDataReceived(USBDriver *usbp, usbep_t ep) { + size_t size; SerialUSBDriver *sdup = usbp->out_params[ep - 1U]; + if (sdup == NULL) { return; } osalSysLockFromISR(); - /* Signaling that data is available in the input queue.*/ - chnAddFlagsI(sdup, CHN_INPUT_AVAILABLE); + /* Checking for zero-size transactions.*/ + size = usbGetReceiveTransactionSizeX(sdup->config->usbp, + sdup->config->bulk_out); + if (size > (size_t)0) { + /* Signaling that data is available in the input queue.*/ + chnAddFlagsI(sdup, CHN_INPUT_AVAILABLE); - /* Posting the filled buffer in the queue.*/ - ibqPostFullBufferI(&sdup->ibqueue, - usbGetReceiveTransactionSizeX(sdup->config->usbp, - sdup->config->bulk_out)); + /* Posting the filled buffer in the queue.*/ + ibqPostFullBufferI(&sdup->ibqueue, size); + } /* The endpoint cannot be busy, we are in the context of the callback, so a packet is in the buffer for sure. Trying to get a free buffer diff --git a/os/various/shell/shell.c b/os/various/shell/shell.c index 1b6662136..f699901ec 100644 --- a/os/various/shell/shell.c +++ b/os/various/shell/shell.c @@ -353,7 +353,7 @@ THD_FUNCTION(shellThread, p) { #endif chprintf(chp, SHELL_NEWLINE_STR); - chprintf(chp, "ChibiOS/RT Shell"SHELL_NEWLINE_STR); + chprintf(chp, "ChibiOS/RT Shell" SHELL_NEWLINE_STR); while (true) { chprintf(chp, SHELL_PROMPT_STR); if (shellGetLine(scfg, line, sizeof(line), shp)) { @@ -372,7 +372,7 @@ THD_FUNCTION(shellThread, p) { n = 0; while ((lp = parse_arguments(NULL, &tokp)) != NULL) { if (n >= SHELL_MAX_ARGUMENTS) { - chprintf(chp, "too many arguments"SHELL_NEWLINE_STR); + chprintf(chp, "too many arguments" SHELL_NEWLINE_STR); cmd = NULL; break; } @@ -394,7 +394,7 @@ THD_FUNCTION(shellThread, p) { else if (cmdexec(shell_local_commands, chp, cmd, n, args) && ((scp == NULL) || cmdexec(scp, chp, cmd, n, args))) { chprintf(chp, "%s", cmd); - chprintf(chp, " ?"SHELL_NEWLINE_STR); + chprintf(chp, " ?" SHELL_NEWLINE_STR); } } } diff --git a/os/various/shell/shell.h b/os/various/shell/shell.h index 97518b4e0..cecf5969b 100644 --- a/os/various/shell/shell.h +++ b/os/various/shell/shell.h @@ -174,10 +174,10 @@ typedef struct { * * @notapi */ -#define _shell_reset_cur(stream) chprintf(stream, "\033[%dD\033[%dC", \ - SHELL_MAX_LINE_LENGTH + \ - strlen(SHELL_PROMPT_STR) + 2, \ - strlen(SHELL_PROMPT_STR)) +#define _shell_reset_cur(stream) chprintf(stream, "\033[%dD\033[%dC", \ + SHELL_MAX_LINE_LENGTH + \ + strlen(SHELL_PROMPT_STR) + 2, \ + strlen(SHELL_PROMPT_STR)) /** * @brief Send escape codes to clear the rest of the line @@ -196,8 +196,8 @@ typedef struct { * * @api */ -#define shellUsage(stream, message) \ - chprintf(stream, "Usage: %s"SHELL_NEWLINE_STR, message) +#define shellUsage(stream, message) \ + chprintf(stream, "Usage: %s" SHELL_NEWLINE_STR, message) /*===========================================================================*/ /* External declarations. */ @@ -213,7 +213,8 @@ extern "C" { void shellInit(void); THD_FUNCTION(shellThread, p); void shellExit(msg_t msg); - bool shellGetLine(ShellConfig *scfg, char *line, unsigned size, ShellHistory *shp); + bool shellGetLine(ShellConfig *scfg, char *line, + unsigned size, ShellHistory *shp); #ifdef __cplusplus } #endif diff --git a/os/various/shell/shell_cmd.c b/os/various/shell/shell_cmd.c index 37f80020e..525f26980 100644 --- a/os/various/shell/shell_cmd.c +++ b/os/various/shell/shell_cmd.c @@ -78,26 +78,26 @@ static void cmd_info(BaseSequentialStream *chp, int argc, char *argv[]) { return; } - chprintf(chp, "Kernel: %s"SHELL_NEWLINE_STR, CH_KERNEL_VERSION); + chprintf(chp, "Kernel: %s" SHELL_NEWLINE_STR, CH_KERNEL_VERSION); #ifdef PORT_COMPILER_NAME - chprintf(chp, "Compiler: %s"SHELL_NEWLINE_STR, PORT_COMPILER_NAME); + chprintf(chp, "Compiler: %s" SHELL_NEWLINE_STR, PORT_COMPILER_NAME); #endif - chprintf(chp, "Architecture: %s"SHELL_NEWLINE_STR, PORT_ARCHITECTURE_NAME); + chprintf(chp, "Architecture: %s" SHELL_NEWLINE_STR, PORT_ARCHITECTURE_NAME); #ifdef PORT_CORE_VARIANT_NAME - chprintf(chp, "Core Variant: %s"SHELL_NEWLINE_STR, PORT_CORE_VARIANT_NAME); + chprintf(chp, "Core Variant: %s" SHELL_NEWLINE_STR, PORT_CORE_VARIANT_NAME); #endif #ifdef PORT_INFO - chprintf(chp, "Port Info: %s"SHELL_NEWLINE_STR, PORT_INFO); + chprintf(chp, "Port Info: %s" SHELL_NEWLINE_STR, PORT_INFO); #endif #ifdef PLATFORM_NAME - chprintf(chp, "Platform: %s"SHELL_NEWLINE_STR, PLATFORM_NAME); + chprintf(chp, "Platform: %s" SHELL_NEWLINE_STR, PLATFORM_NAME); #endif #ifdef BOARD_NAME - chprintf(chp, "Board: %s"SHELL_NEWLINE_STR, BOARD_NAME); + chprintf(chp, "Board: %s" SHELL_NEWLINE_STR, BOARD_NAME); #endif #ifdef __DATE__ #ifdef __TIME__ - chprintf(chp, "Build time: %s%s%s"SHELL_NEWLINE_STR, __DATE__, " - ", __TIME__); + chprintf(chp, "Build time: %s%s%s" SHELL_NEWLINE_STR, __DATE__, " - ", __TIME__); #endif #endif } @@ -111,7 +111,7 @@ static void cmd_echo(BaseSequentialStream *chp, int argc, char *argv[]) { shellUsage(chp, "echo \"message\""); return; } - chprintf(chp, "%s"SHELL_NEWLINE_STR, argv[0]); + chprintf(chp, "%s" SHELL_NEWLINE_STR, argv[0]); } #endif @@ -123,7 +123,7 @@ static void cmd_systime(BaseSequentialStream *chp, int argc, char *argv[]) { shellUsage(chp, "systime"); return; } - chprintf(chp, "%lu"SHELL_NEWLINE_STR, (unsigned long)chVTGetSystemTime()); + chprintf(chp, "%lu" SHELL_NEWLINE_STR, (unsigned long)chVTGetSystemTime()); } #endif @@ -137,10 +137,10 @@ static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) { return; } n = chHeapStatus(NULL, &total, &largest); - chprintf(chp, "core free memory : %u bytes"SHELL_NEWLINE_STR, chCoreGetStatusX()); - chprintf(chp, "heap fragments : %u"SHELL_NEWLINE_STR, n); - chprintf(chp, "heap free total : %u bytes"SHELL_NEWLINE_STR, total); - chprintf(chp, "heap free largest: %u bytes"SHELL_NEWLINE_STR, largest); + chprintf(chp, "core free memory : %u bytes" SHELL_NEWLINE_STR, chCoreGetStatusX()); + chprintf(chp, "heap fragments : %u" SHELL_NEWLINE_STR, n); + chprintf(chp, "heap free total : %u bytes" SHELL_NEWLINE_STR, total); + chprintf(chp, "heap free largest: %u bytes" SHELL_NEWLINE_STR, largest); } #endif @@ -154,7 +154,7 @@ static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) { shellUsage(chp, "threads"); return; } - chprintf(chp, "stklimit stack addr refs prio state name\r\n"SHELL_NEWLINE_STR); + chprintf(chp, "stklimit stack addr refs prio state name\r\n" SHELL_NEWLINE_STR); tp = chRegFirstThread(); do { #if (CH_DBG_ENABLE_STACK_CHECK == TRUE) || (CH_CFG_USE_DYNAMIC == TRUE) @@ -162,7 +162,7 @@ static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) { #else uint32_t stklimit = 0U; #endif - chprintf(chp, "%08lx %08lx %08lx %4lu %4lu %9s %12s"SHELL_NEWLINE_STR, + chprintf(chp, "%08lx %08lx %08lx %4lu %4lu %9s %12s" SHELL_NEWLINE_STR, stklimit, (uint32_t)tp->ctx.sp, (uint32_t)tp, (uint32_t)tp->refs - 1, (uint32_t)tp->prio, states[tp->state], tp->name == NULL ? "" : tp->name); @@ -205,7 +205,7 @@ static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) { "test", chThdGetPriorityX(), tfp, chp); if (tp == NULL) { - chprintf(chp, "out of memory"SHELL_NEWLINE_STR); + chprintf(chp, "out of memory" SHELL_NEWLINE_STR); return; } chThdWait(tp); diff --git a/readme.txt b/readme.txt index ed1ebbd8b..93740f59a 100644 --- a/readme.txt +++ b/readme.txt @@ -112,6 +112,8 @@ - EX: Updated LSM303DLHC to 1.1.0 (backported to 18.2.1). - HAL: Fixed function mfsReadRecord() causes memory corruption because a buffer overflow (bug #931)(backported to 18.2.1). +- HAL: Fixed silence GCC 7.3.0 warning (bug #930)(backported to 18.2.1 + and 17.6.5). - HAL: Fixed invalid SAI1 clock selection on STM32F7xx (bug #929)(backported to 18.2.1 and 17.6.4). - HAL: Fixed invalid clock checks for SDMMC1 and SDMMC2 on STM32F7xx diff --git a/testhal/STM32/multi/QSPI-MFS/debug/STM32-QSPI-MFS (Select ELF file)(OpenOCD, Flash and Run).launch b/testhal/STM32/multi/QSPI-MFS/debug/STM32-QSPI-MFS (Select ELF file)(OpenOCD, Flash and Run).launch index e9a58e266..d37cc820f 100644 --- a/testhal/STM32/multi/QSPI-MFS/debug/STM32-QSPI-MFS (Select ELF file)(OpenOCD, Flash and Run).launch +++ b/testhal/STM32/multi/QSPI-MFS/debug/STM32-QSPI-MFS (Select ELF file)(OpenOCD, Flash and Run).launch @@ -33,9 +33,9 @@ - + - + diff --git a/testhal/STM32/multi/QSPI-MFS/make/stm32l476_discovery.make b/testhal/STM32/multi/QSPI-MFS/make/stm32l476_discovery.make index e9f97f125..8827f83dc 100644 --- a/testhal/STM32/multi/QSPI-MFS/make/stm32l476_discovery.make +++ b/testhal/STM32/multi/QSPI-MFS/make/stm32l476_discovery.make @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -Og -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). -- cgit v1.2.3