From 1102a0df4e56f9fc63e8385b01f1fcbc51f43606 Mon Sep 17 00:00:00 2001 From: Joseph Julicher Date: Wed, 8 Dec 2021 14:27:48 -0700 Subject: Cortex M3 QEMU demo now builds with -Wall -Wextra (#727) * Added -Wall -Wextra to the Coretex M3 QEMU demo * Fixed warnings & errors in Cortex M3 QEMU demo * Fixed the FULL demo to compile with full errors. * Update FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/init/startup.c Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> * Applied the ( void ) r0 pattern to prvGetRegisterFromStack Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> --- FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile | 1 + FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/init/startup.c | 13 +++++++++++-- FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main.c | 10 ---------- FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_full.c | 10 +++++----- FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/syscall.c | 14 +++++++------- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile index 73476feeb..bc7b74c46 100644 --- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/Makefile @@ -71,6 +71,7 @@ LDFLAGS += -Xlinker -Map=${BUILD_DIR}/output.map CFLAGS += -nostartfiles -mthumb -mcpu=cortex-m3 -Wno-error=implicit-function-declaration CFLAGS += -Wno-builtin-declaration-mismatch -Werror +CFLAGS += -Wall -Wextra ifeq ($(DEBUG), 1) CFLAGS += -ggdb3 -Og diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/init/startup.c b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/init/startup.c index d856dba3f..db70e6cde 100644 --- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/init/startup.c +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/init/startup.c @@ -96,6 +96,15 @@ void prvGetRegistersFromStack( uint32_t * pulFaultStackAddress ) for( ; ; ) { } + /* remove the warning: variable is set but not used */ + ( void ) r0; + ( void ) r1; + ( void ) r2; + ( void ) r3; + ( void ) r12; + ( void ) lr; + ( void ) pc; + ( void ) psr; } static void Default_Handler( void ) __attribute__( ( naked ) ); @@ -114,7 +123,7 @@ void Default_Handler( void ) "NVIC_INT_CTRL_CONST: .word 0xe000ed04\n" ); } -static void HardFault_Handler( void ) __attribute__( ( naked ) ); +static void Default_Handler2( void ) __attribute__( ( naked ) ); void Default_Handler2( void ) { __asm volatile @@ -199,7 +208,7 @@ void _start( void ) exit( 0 ); } -__attribute__( ( naked ) ) void exit( int status ) +__attribute__( ( naked ) ) void exit(__attribute__((unused)) int status ) { /* Force qemu to exit using ARM Semihosting */ __asm volatile ( diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main.c b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main.c index 273816220..1d31868aa 100644 --- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main.c +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main.c @@ -68,7 +68,6 @@ int main() #error "Invalid Selection...\nPlease Select a Demo application from the main command" } #endif /* if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) */ - snprint return 0; } @@ -108,15 +107,6 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask, void vApplicationIdleHook( void ) { - volatile size_t xFreeHeapSpace; - - /* This is just a trivial example of an idle hook. It is called on each - * cycle of the idle task. It must *NOT* attempt to block. In this case the - * idle task just queries the amount of FreeRTOS heap that remains. See the - * memory management section on the https://www.FreeRTOS.org web site for memory - * management options. If there is a lot of heap memory free then the - * configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up - * RAM. */ #if ( mainCREATE_FULL_DEMO_ONLY == 1 ) { /* Call the idle task processing used by the full demo. The simple diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_full.c b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_full.c index ecd8aa8e1..6688cb2c9 100644 --- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/main_full.c @@ -221,6 +221,7 @@ int main_full( void ) xTaskCreate( prvDemoQueueSpaceFunctions, "QSpace", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); xTaskCreate( prvPermanentlyBlockingSemaphoreTask, "BlockSem", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); xTaskCreate( prvPermanentlyBlockingNotificationTask, "BlockNoti", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( prvDemonstrateChangingTimerReloadMode, "TimerMode", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL ); vStartMessageBufferTasks( configMINIMAL_STACK_SIZE ); vStartStreamBufferTasks(); @@ -270,7 +271,6 @@ static void prvCheckTask( void * pvParameters ) { TickType_t xNextWakeTime; const TickType_t xCycleFrequency = pdMS_TO_TICKS( 10000UL ); - HeapStats_t xHeapStats; /* Just to remove compiler warning. */ ( void ) pvParameters; @@ -428,7 +428,7 @@ static void prvCheckTask( void * pvParameters ) } #endif /* configSUPPORT_STATIC_ALLOCATION */ - printf( "%s - tick count %u \r\n", + printf( "%s - tick count %lu \r\n", pcStatusMessage, xTaskGetTickCount() ); @@ -582,10 +582,10 @@ void vFullDemoTickHookFunction( void ) static void prvPendedFunction( void * pvParameter1, uint32_t ulParameter2 ) { - static intptr_t ulLastParameter1 = 1000UL, ulLastParameter2 = 0UL; - intptr_t ulParameter1; + static uintptr_t ulLastParameter1 = 1000UL, ulLastParameter2 = 0UL; + uintptr_t ulParameter1; - ulParameter1 = ( intptr_t ) pvParameter1; + ulParameter1 = ( uintptr_t ) pvParameter1; /* Ensure the parameters are as expected. */ configASSERT( ulParameter1 == ( ulLastParameter1 + 1 ) ); diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/syscall.c b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/syscall.c index 4782e8c77..471bf4fcd 100644 --- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/syscall.c +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/syscall.c @@ -66,7 +66,7 @@ void uart_init() * @todo implement if necessary * */ -int _fstat( int file ) +int _fstat(__attribute__((unused)) int file ) { return 0; } @@ -76,9 +76,9 @@ int _fstat( int file ) * @todo implement if necessary * */ -int _read( int file, - char * buf, - int len ) +int _read(__attribute__((unused)) int file, + __attribute__((unused)) char * buf, + __attribute__((unused)) int len ) { return -1; } @@ -91,9 +91,9 @@ int _read( int file, * @param [in] len length of the buffer * @returns the number of bytes written */ -int _write( int file, - char * buf, - int len ) +int _write(__attribute__((unused)) int file, + __attribute__((unused)) char * buf, + int len ) { int todo; -- cgit v1.2.1