ARM link error when calling a function residing in different memory

1

I wanted to clean up some code , where a a.c file was included in another b.c file. I wanted to build the a.c file with the whole project , so that all the files in that project can access the functions defined in a.c file.

After building the a.c file with the whole project , I do not get any compile time errors. But as soon as I call any function defined in a.c file from a different file I get arm link errors.

************* Linking 
armlink : error L6291:  Cannot assign Fixed Execution Region Load Address:. 
Load Address must be greater than or equal to next available Load Address:.
armlink : Not enough information to produce a SYMDEFs file.
armlink : Finished: 1 information, 0 warning and 1 error messages.
make[1]: *** [common.axf] Error 1
make[1]: Leaving directory `/scripts'
make: *** Error 2

The file which is calling function in a.c resides in SRAM. While a.c resides in DRAM. If I call the function from a file which also resides in DRAM, I do not get the link error.

Following are the map files generated:

function in a.c not called from calling file. Calling file resides in SRAM:

0x0000faa8   0x00000008   Code   RO         5150    i.time__delay_ticks  rtos.o
0x0000fab0   0x00000008   Code   RO         5203    sram_code_arm       callingfile.o  
0x0000fab8   0x00000020   Data   RO         1397    .constdata          file1.o
0x0000fad8   0x0000000e   Data   RO         3725    .constdata          file2.o
0x0000fae6   0x00000002   PAD
0x0000fae8   0x00000009   Data   RO         4526    .constdata          file3.o
0x0000faf1   0x00000003   PAD
0x0000faf4   0x0000000e   Data   RO         5398    .constdata          file4.o

After calling function which resides in a.c. CallingFile(SRAM)->Calls Function test()->test() in a.c(DRAM)

0x0000faa8   0x00000008   Code   RO         5150    i.time__delay_ticks rtos.o
0x0000fac8   0x00000008   Code   RO         5203    sram_code_arm       callingfile.o
0x0000fad0   0x00038758   Data   RO          996    .constdata          a.o  
0x00048228   0x00000020   Data   RO         1397    .constdata          file1.o
0x00048248   0x0000000e   Data   RO         3725    .constdata          file2.o
0x00048256   0x00000002   PAD
0x00048258   0x00000009   Data   RO         4526    .constdata          file3.o
0x00048261   0x00000003   PAD

Why do we see extra bytes 0x00038758(a.o) when the function is called from calling file?

c
arm
asked on Stack Overflow Apr 14, 2015 by user968000 • edited Apr 14, 2015 by user968000

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0