Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

Strange compiler warning

Posted by ksoldavin on March 25, 2014

I am getting a compiler warning that I have not seen before and I'm not sure if I should be concerned. I am running version 7.6 on a STM32F4 using CodeSourcery Lite 2013.11-24 tool chain. This is the warning I am seeing:

tasks.c:2526:56: warning: multiple accesses to volatile structure member because of packed attribute [-fstrict-volatile-bitfields]

I see this warning in three different places in the tasks.c source code. The code runs fine but I always try to track down all compiler warnings. The compiler flag that is causing the warning is "-fpack-struct" which I need for other parts of my code.

Any thoughts? Thank you Keith


Strange compiler warning

Posted by rtel on March 25, 2014

It is warning you that, because you have packed the structures, it is taking three memory accesses to read a single member out of a structure - and because that member is marked as volatile the compiler rightly is cautioning you that the member's value might change between the first and third access.

It is probably not a real issue, please post the three line numbers that generate the warning from the link below and I will let you know:

https://sourceforge.net/p/freertos/code/HEAD/tree/tags/V7.6.0/FreeRTOS/Source/tasks.c

Regards.


Strange compiler warning

Posted by ksoldavin on March 26, 2014

Thanks for the prompt help. I am seeing the warnings on line numbers: 2526 pxTaskStatusArray[ uxTask ].xTaskNumber = pxNextTCB->uxTCBNumber; 2532 pxTaskStatusArray[ uxTask ].uxBasePriority = pxNextTCB->uxBasePriority; 2542 pxTaskStatusArray[ uxTask ].ulRunTimeCounter = pxNextTCB->ulRunTimeCounter;


Strange compiler warning

Posted by rtel on March 26, 2014

These fall inside a helper function, rather than in the actual kernel code. The function is only ever called with the scheduler suspended so there is no chance of the data changing during the volatile access - so nothing to worry about. You may find that some of the volatiles inside that function are only actually declared volatile because some compilers will generate warning messages if they are not.

Regards.


Strange compiler warning

Posted by ksoldavin on March 26, 2014

Wonderful! Thank you for all your help.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner