Skip to main content
Priyadarshini Solanki
Associate III
April 5, 2019
Solved

How to use Linker exported symbol in an application?

  • April 5, 2019
  • 1 reply
  • 1419 views

I am using #[STM32 MCUs]​ #Cortex-m0​ . In linker file we have symbol: __ICFEDIT_region_ROM_start__ 

How we can use this symbol in application ?

I have assigned &__ICFEDIT_region_ROM_start__ to Pointer.

i.e int *p = &__ICFEDIT_region_ROM_start__

now using p we can fetch the data define by symbol __ICFEDIT_region_ROM_start__.

I want that data to be in macro definition. How i can use?

#define ROM_address   __ICFEDIT_region_ROM_start__ ( ROM_address holds wrong data )

    This topic has been closed for replies.
    Best answer by After Forever

    Try this way:

    extern uint32_t __ICFEDIT_region_ROM_start__;
     
    #define ROM_address ((void *)(&__ICFEDIT_region_ROM_start__))

    Or change (void *) to whatever pointer type you require. And turn off compiler's strict aliasing rules to be safe (-fno-strict-aliasing option in GCC)

    1 reply

    After Forever
    After ForeverBest answer
    Senior III
    April 5, 2019

    Try this way:

    extern uint32_t __ICFEDIT_region_ROM_start__;
     
    #define ROM_address ((void *)(&__ICFEDIT_region_ROM_start__))

    Or change (void *) to whatever pointer type you require. And turn off compiler's strict aliasing rules to be safe (-fno-strict-aliasing option in GCC)

    Priyadarshini Solanki
    Associate III
    April 5, 2019

    Thanks for the response.

    It's perfectly working as expected.