Quality RTOS & Embedded Software

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


Loading

V8.1.2 Link Error in Eclipse with ARM GNU GCC ...defined in discarded section ....symbol from plugin....

Posted by mrichmond68 on December 11, 2014

I am working from the V8.1.2 GCC/ARMCM3 port. I have successfully built myself a demo in Eclipse(Kepler), my arm gcc is 48_2014q3, my hardware is an STM32F103RE processor based board. I'm also using gnuarmeclipse plugins.

When first building, I received the following link error. I've fixed it, but I suspect something else is wrong and I'm just masking my real problem with my "fix". Just putting this out there to see what folks think.

Here is the link error (-flto is being used in the compile/link process):


'C:UsersmrichmonAppDataLocalTempccq0f0ed.ltrans0.ltrans.o' vTaskSwitchContext' referenced in section.text.PendSVHandler.4125' of C:UsersmrichmonAppDataLocalTempccq0f0ed.ltrans0.ltrans.o: defined in discarded section .text' of ./FreeRTOS_Source/source/tasks.o (symbol from plugin) pxCurrentTCB' referenced in section .text.PendSV_Handler.4125' of C:\Users\mrichmon\AppData\Local\Temp\ccq0f0ed.ltrans0.ltrans.o: defined in discarded section.text' of ./FreeRTOSSource/source/tasks.o (symbol from plugin) pxCurrentTCB' referenced in section.text.SVCHandler.4140' of C:UsersmrichmonAppDataLocalTempccq0f0ed.ltrans0.ltrans.o: defined in discarded section `.text' of ./FreeRTOSSource/source/tasks.o (symbol from plugin) collect2.exe: error: ld returned 1 exit status


I tracked down the two resources being unceremoniously "discarded" during the the linking process: vTaskSwitchContext() pxCurrentTCBG

I fixed the problem by adding the attribute "used" to both resources (yes, I modified source code ---icky right?).

Defined in FreeRTOSConfig.h with a big juicy note:

    #define KEEP_ME		__attribute__((used))

Modified in tasks.c

    void KEEP_ME vTaskSwitchContext( void )
    { . . . }

    PRIVILEGED_DATA TCB_t * volatile pxCurrentTCB KEEP_ME = NULL;

So maybe -flto is the problem -- but maybe I'll want to use it for my app. Are my only two options to avoid -flto or use the "used" attribute? Does either choice represent a good practice?

Thanks!! mjr


V8.1.2 Link Error in Eclipse with ARM GNU GCC ...defined in discarded section ....symbol from plugin....

Posted by rtel on December 11, 2014

I have only ever come across this problem once, and it was not on an ARM architecture, and not using GCC - but then I have never used -flto - so I guess that is the cause.

On the occasion I did have such a problem it was, if I recall correctly, because a symbol was only used in an assembly file.

Regards.


[ 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