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>
pull/741/head
Joseph Julicher 3 years ago committed by GitHub
parent c1266ddb60
commit 1102a0df4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -71,6 +71,7 @@ LDFLAGS += -Xlinker -Map=${BUILD_DIR}/output.map
CFLAGS += -nostartfiles -mthumb -mcpu=cortex-m3 -Wno-error=implicit-function-declaration CFLAGS += -nostartfiles -mthumb -mcpu=cortex-m3 -Wno-error=implicit-function-declaration
CFLAGS += -Wno-builtin-declaration-mismatch -Werror CFLAGS += -Wno-builtin-declaration-mismatch -Werror
CFLAGS += -Wall -Wextra
ifeq ($(DEBUG), 1) ifeq ($(DEBUG), 1)
CFLAGS += -ggdb3 -Og CFLAGS += -ggdb3 -Og

@ -96,6 +96,15 @@ void prvGetRegistersFromStack( uint32_t * pulFaultStackAddress )
for( ; ; ) for( ; ; )
{ {
} }
/* remove the warning: variable <x> 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 ) ); static void Default_Handler( void ) __attribute__( ( naked ) );
@ -114,7 +123,7 @@ void Default_Handler( void )
"NVIC_INT_CTRL_CONST: .word 0xe000ed04\n" "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 ) void Default_Handler2( void )
{ {
__asm volatile __asm volatile
@ -199,7 +208,7 @@ void _start( void )
exit( 0 ); exit( 0 );
} }
__attribute__( ( naked ) ) void exit( int status ) __attribute__( ( naked ) ) void exit(__attribute__((unused)) int status )
{ {
/* Force qemu to exit using ARM Semihosting */ /* Force qemu to exit using ARM Semihosting */
__asm volatile ( __asm volatile (

@ -68,7 +68,6 @@ int main()
#error "Invalid Selection...\nPlease Select a Demo application from the main command" #error "Invalid Selection...\nPlease Select a Demo application from the main command"
} }
#endif /* if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) */ #endif /* if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) */
snprint
return 0; return 0;
} }
@ -108,15 +107,6 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask,
void vApplicationIdleHook( void ) 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 ) #if ( mainCREATE_FULL_DEMO_ONLY == 1 )
{ {
/* Call the idle task processing used by the full demo. The simple /* Call the idle task processing used by the full demo. The simple

@ -221,6 +221,7 @@ int main_full( void )
xTaskCreate( prvDemoQueueSpaceFunctions, "QSpace", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); xTaskCreate( prvDemoQueueSpaceFunctions, "QSpace", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvPermanentlyBlockingSemaphoreTask, "BlockSem", 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( prvPermanentlyBlockingNotificationTask, "BlockNoti", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvDemonstrateChangingTimerReloadMode, "TimerMode", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );
vStartMessageBufferTasks( configMINIMAL_STACK_SIZE ); vStartMessageBufferTasks( configMINIMAL_STACK_SIZE );
vStartStreamBufferTasks(); vStartStreamBufferTasks();
@ -270,7 +271,6 @@ static void prvCheckTask( void * pvParameters )
{ {
TickType_t xNextWakeTime; TickType_t xNextWakeTime;
const TickType_t xCycleFrequency = pdMS_TO_TICKS( 10000UL ); const TickType_t xCycleFrequency = pdMS_TO_TICKS( 10000UL );
HeapStats_t xHeapStats;
/* Just to remove compiler warning. */ /* Just to remove compiler warning. */
( void ) pvParameters; ( void ) pvParameters;
@ -428,7 +428,7 @@ static void prvCheckTask( void * pvParameters )
} }
#endif /* configSUPPORT_STATIC_ALLOCATION */ #endif /* configSUPPORT_STATIC_ALLOCATION */
printf( "%s - tick count %u \r\n", printf( "%s - tick count %lu \r\n",
pcStatusMessage, pcStatusMessage,
xTaskGetTickCount() ); xTaskGetTickCount() );
@ -582,10 +582,10 @@ void vFullDemoTickHookFunction( void )
static void prvPendedFunction( void * pvParameter1, static void prvPendedFunction( void * pvParameter1,
uint32_t ulParameter2 ) uint32_t ulParameter2 )
{ {
static intptr_t ulLastParameter1 = 1000UL, ulLastParameter2 = 0UL; static uintptr_t ulLastParameter1 = 1000UL, ulLastParameter2 = 0UL;
intptr_t ulParameter1; uintptr_t ulParameter1;
ulParameter1 = ( intptr_t ) pvParameter1; ulParameter1 = ( uintptr_t ) pvParameter1;
/* Ensure the parameters are as expected. */ /* Ensure the parameters are as expected. */
configASSERT( ulParameter1 == ( ulLastParameter1 + 1 ) ); configASSERT( ulParameter1 == ( ulLastParameter1 + 1 ) );

@ -66,7 +66,7 @@ void uart_init()
* @todo implement if necessary * @todo implement if necessary
* *
*/ */
int _fstat( int file ) int _fstat(__attribute__((unused)) int file )
{ {
return 0; return 0;
} }
@ -76,9 +76,9 @@ int _fstat( int file )
* @todo implement if necessary * @todo implement if necessary
* *
*/ */
int _read( int file, int _read(__attribute__((unused)) int file,
char * buf, __attribute__((unused)) char * buf,
int len ) __attribute__((unused)) int len )
{ {
return -1; return -1;
} }
@ -91,9 +91,9 @@ int _read( int file,
* @param [in] len length of the buffer * @param [in] len length of the buffer
* @returns the number of bytes written * @returns the number of bytes written
*/ */
int _write( int file, int _write(__attribute__((unused)) int file,
char * buf, __attribute__((unused)) char * buf,
int len ) int len )
{ {
int todo; int todo;

Loading…
Cancel
Save