Convert GCC Linker file to IAR config file

kat123 wrote on Tuesday, March 27, 2018:

Running the STM32F4 demo for FreeRTOS+TCP on a STM3240G Eval board.

The GCC project comes with a linker file that defines a few things including __bss_end__ and _estack which are then used in the prvInitialiseHeap function in main.

Is there a way to declare these in the IAR linker config file (.icf) to allow this project to be build with IAR?

mani111ece wrote on Tuesday, March 27, 2018:

Newly started freeRTOS. I don’t know how to make it work.but I wanna learn freeRTOS so please guide me.
how you are building and running the sample apps on STM3240G Eval board.

so please let me know hoe to build and run.

rtel wrote on Tuesday, March 27, 2018:

https://sourceforge.net/p/freertos/discussion/382005/thread/7399998f/?limit=25#0dee/1e98

rtel wrote on Tuesday, March 27, 2018:

These are linker variables, you would have to check the IAR manual to
see if IAR provides an equivalent - but probably the simplest method
would be to #define them to constants within the C code, rather than in
the linker script. The important thing is to ensure that the memory
areas used by the heap are not used to store any variables - so you
would have to check the linker script, and update the memory it defines
if needed, to make sure the memory allocated to the heap and the memory
allocated by the linker do not overlap.

kat123 wrote on Tuesday, March 27, 2018:

Thank you very much!

I can definitely see how to do that for _estack as that is defined as an address.

However, _bss_end__ is less clear, what I can see in the linker file

  /* This is used by the startup in order to initialize the .bss secion */
    _sbss = .;         /* define a global symbol at bss start */
    __bss_start__ = _sbss;
    *(.bss)
    *(.bss*)
    *(COMMON)

    . = ALIGN(4);
    _ebss = .;         /* define a global symbol at bss end */
    __bss_end__ = _ebss;

How would I find the address to set this to?

kat123 wrote on Wednesday, March 28, 2018:

I’ve added these lines at the strat of my main file and now the code compiles

#pragma section=".bss"
uint32_t *bss_section_end = __section_end(".bss");
#pragma section="CSTACK"
uint32_t *stack_block_end = __section_end("CSTACK");