cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
vamshig51
Contributor
Contributor
1,165 Views
Registered: ‎06-10-2019

Passing Heap Size as linker option

Jump to solution

Dear Team,

I am working on ZC702, I am trying to pass the HEAP_SIZE while linking the objects, using the below option

-defsym _HEAP_SIZE=0x400000

I am seeing the below error

arm-none-eabi-gcc.exe: error: _HEAP_SIZE=0x400000: No such file or directory

Please give inputs.

Thanks & Regards,

Vamshi G.

0 Kudos
Reply
1 Solution

Accepted Solutions
vamshig51
Contributor
Contributor
1,031 Views
Registered: ‎06-10-2019

hi @ericv ,

In my previous run there is a typo in command, provided "HEAP_SIZE" instead of "_HEAP_SIZE", hence the heap-size did not affected. 

below is the right way to pass.

-Wl,--defsym=_HEAP_SIZE=value

Thanks,

Vamshi G.

View solution in original post

0 Kudos
Reply
8 Replies
ericv
Scholar
Scholar
1,130 Views
Registered: ‎04-13-2015

@vamshig51 

defsym has 2 dashes; i.e. --defsym, not -defsym

0 Kudos
Reply
vamshig51
Contributor
Contributor
1,121 Views
Registered: ‎06-10-2019

Hi @ericv ,

Thanks for your response. I have used the option in reference to this doc https://www.xilinx.com/support/documentation/sw_manuals/xilinx2015_2/ug1043-embedded-system-tools.pdf, page-17

I have a src folder with following files, test_heap.c, Xilinx.spec, Xilinx_lscript.ld 

 

Below is how I am copiling

arm-none-eabi-gcc -c -o ./test_heap.o -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MP -MMD -Wall -Wextra -O0 -g3 ./test_heap.c

Here I am linking

arm-none-eabi-gcc -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -Wl,-build-id=none -specs=Xilinx.spec --defsym _HEAP_SIZE=0x400000 -Wl,-T -Wl,Xilinx_lscript.ld -Wl,-Map=test_heap.map -o ./test_heap.elf test_heap.o -Wl,--start-group -lgcc -lc -Wl,--end-group

Iam seeing below errors, 

arm-none-eabi-gcc: error: _HEAP_SIZE=0x400000: No such file or directory
arm-none-eabi-gcc: error: unrecognized command line option '--defsym'

 

Please give your inputs.

Thanks & Regards,

Vamshi G.

 

 

0 Kudos
Reply
ericv
Scholar
Scholar
1,107 Views
Registered: ‎04-13-2015

@vamshig51 

You are using the command line option --defsym with the compiler. To inform the compiler to pass a command line option to the linker you need to put -Wl, before it.

0 Kudos
Reply
vamshig51
Contributor
Contributor
1,096 Views
Registered: ‎06-10-2019

Hi @ericv ,

 

I tried that, but still the same error

arm-none-eabi-gcc -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -Wl,-build-id=none -specs=Xilinx.spec -Wl, --defsym _HEAP_SIZE=0x40000 -Wl,-T -Wl,Xilinx_lscript.ld -Wl,-Map=test_heap.map -o ./test_heap.elf test_heap.o -Wl,--start-group -lgcc -lc -Wl,--end-group
arm-none-eabi-gcc: error: _HEAP_SIZE=0x40000: No such file or directory

Please provide your inputs.

 

Thanks

0 Kudos
Reply
ericv
Scholar
Scholar
1,087 Views
Registered: ‎04-13-2015

@vamshig51 

Look carefuly at all the other -Wl, on that command line because yours is constructed differently.

0 Kudos
Reply
vamshig51
Contributor
Contributor
1,061 Views
Registered: ‎06-10-2019

Hi @ericv 

I have tried as follows, I am not sure if its valid or not, but able to genreate elf

arm-none-eabi-gcc -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -Wl,--defsym=HEAP_SIZE=0x40000 -Wl,-build-id=none -specs=Xilinx.spec -Wl,-T -Wl,Xilinx_lscript.ld -Wl,-Map=copro.QSPI.map -o ./test_heap.elf test_heap.o -Wl,--start-group -lgcc -lc -Wl,--end-group

but I do not see the change in HEAP_SIZE. 

If you know whats the right way please help me providing the command.

Thanks,

Vamshi G.

0 Kudos
Reply
ericv
Scholar
Scholar
1,053 Views
Registered: ‎04-13-2015

@vamshig51 

Look in the GCC linker reference manual and you will find the exact syntax for --defsym:

https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_mono/ld.html

There is a space required and with -Wl, use by the compiler you can pass a space to the linker by replacing it with a comma.

0 Kudos
Reply
vamshig51
Contributor
Contributor
1,032 Views
Registered: ‎06-10-2019

hi @ericv ,

In my previous run there is a typo in command, provided "HEAP_SIZE" instead of "_HEAP_SIZE", hence the heap-size did not affected. 

below is the right way to pass.

-Wl,--defsym=_HEAP_SIZE=value

Thanks,

Vamshi G.

View solution in original post

0 Kudos
Reply