Topic : Linker Files

Forum : ARM

Original Post
Post Information Post
July 28, 2008 - 11:30pm
Guest

Although I have long experience using other compilers and debuggers I am new to RIDE and ARM processors, so please pardon my ignorance in asking questions that you may find obvious:

I have a small demonstration project that I can run on the STM32F-10x evaluation hardware using the Anglia IDEaliST. However, I want to try running it on RIDE7, so I have copied all the files to a new folder and configured RIDE to run the project from that folder. To gain familiarity with the necessary system files (such as the Include files) I have copied the LIB folder from the Program Files\Raisonance folder to a sub-folder within my project and modified the project configuration to include this folder.

I have got to the stage where I can compile all the modules from within RIDE by building the project, but I am struggling with the linker. The first problem was that it stopped when it failed to find file such as sections_FLASH.ld and STM32F10x_COMMON.ld. I found some of these in the RIDE\Lib\ARM folder and some in the Anglia\IDEaliST\STM32 folder. However, I couldn't find a way of directing RIDE to look in these sub-folders for the linker files. The only way I could get around to problem was to copy the relevant file into my project root directory. Am I missing something or is this the only solution?

This left only one problem: My project includes a startup.c file that defines, among other things, g_pfnVectors. The linker, however, insists on including crt0_STM32x.o which also defines g_pfnVectors, so generates an error. I would assume you can enable or disable crt0_STM32x from Project\Properties\LD Linker\startup, but answer yes or no to Use Default Startuo seems to make no difference.

Regards
Alan Rouse

Replies
Post Information Post
+1
0
-1
July 29, 2008 - 3:13pm
Guest

Hi

Please find below some answers.

1. Conerning the startup:

Here is one way to use a different Startup file:
+ include in the project source files a startup file (.c).
+ set to "No" Project\Properties\LD Linker\startup\DefaultStartup.
+ make sure that the path in Project\Properties\LD Linker\startupfile is empty!

Here is a nother one:
+ do not include in the project source file a startup file.
+ set to "No" Project\Properties\LD Linker\startup\DefaultStartup.
+ make sure that the path in Project\Properties\LD Linker\startupfile leads to satrtupfile (.o)

2. Concerning the .ld file

May I ask you if you are using the default script file or you own?
I guess when said you modified the project to point to the Library you copied you have changed the Applications Options\Directories\library Directories ? whhich value did you put?
To find why the file has not been found it is possible to open the (name of you application).elf.ld in your application listing directory and then to open the .ld that is included and so on .... until you find where those file are referenced.
Also in the .elf.ld check the "SearchDir()" and see if they correspond to the library you moved.

Best regards,
Matloub

+1
0
-1
October 31, 2008 - 4:34pm
Guest

Hi, I *bump* this topic cause I have to ask a related question.
This is my first post in the raisonance support forums, so bear with me :-)

I've set up a new project in RIDE for the STM32F10B-EVAL, in which I have an Applicaiton named DEMO and an library named FWlibrary (based on the latest FWlib from ST, only difference is "debug and no optimizations") which generates the demo.elf executable and the STM32F10x_thumb_dbg.lib static library to which demo is SUPPOSED to be linked.

For whatever reason, I seem not to be able to link to that lib file.

I wandered through the LD file that RIDE generates to feed the last call to the linker for demo.elf and her eis the result:

SEARCH_DIR(".")
SEARCH_DIR(".")
SEARCH_DIR("..")
SEARCH_DIR("..\Fwlib\library\obj")
SEARCH_DIR("C:\Programmi\Raisonance\Ride\Lib\ARM")
INPUT("D:\Cortex-M\STM3210B-EVAL_APR\Project\..\obj\cortexm3_macro.o")
INPUT("D:\Cortex-M\STM3210B-EVAL_APR\Project\..\obj\stm32f10x_vector.o")
INPUT("D:\Cortex-M\STM3210B-EVAL_APR\Project\..\obj\main.o")
INPUT("D:\Cortex-M\STM3210B-EVAL_APR\Project\..\obj\stm32f10x_it.o")
INPUT("D:\Cortex-M\STM3210B-EVAL_APR\Project\..\obj\orx_demo.o")
INPUT("D:\Cortex-M\STM3210B-EVAL_APR\Project\..\obj\retarget.o")
INPUT("D:\Cortex-M\STM3210B-EVAL_APR\Project\..\obj\itm.o")
INPUT("e_stdio_thumb.a")
OUTPUT("D:\Cortex-M\STM3210B-EVAL_APR\Project\..\obj\Demo.elf")
INCLUDE "C:\Programmi\Raisonance\Ride\Lib\ARM\STM32F103_128K_20K_FLASH_off0.ld"

This is substantially correct till but is sadly missing INCLUDE "STM32F10x_thumb_dbg.lib" line, and I have found no way to get RIDE include it, I can't pass it to the linker via "more options" cause it's called as GCC and not LD and even if I set it as "-Wl,-lSTM32F10x_thhumb_dbg.lib" (whcih would be an option passed to the linker, problem is that the linker is always fed the aforementioned file, which does not include that lib.

Only way is to build the FWlibrary as the default STM32F10x_thumb.lib file and either substitute it to the one under $(RKitLib)\ARM\ or renaming/deleting/moving the original one (so that my file is the only one with that name in the search paths), and set to 'yes' the flag use ST library.

Even thou I understand that I could inlude the required c files under the Demo app (which would have LD link to the correponding obj files) I would like to understand how to feed additional libraries to the linker in RIDE.

Many thanks in advance for you help

Regards

-Andy

+1
0
-1
October 31, 2008 - 6:27pm
Raisonance Support Team

Hi,

RIDE cannot guess that demo.elf should be linked with STM32F10x_thumb_dbg.lib. You have to tell it by dropping your STM32F10x_thumb_dbg.lib file directly in the demo.elf application input files just as if it was a c file. And then it will be included in the link. (you might want to uncheck the option for including the default lib to be sure you use your own and not the default.)

Best Regards,

Vincent

+1
0
-1
October 31, 2008 - 7:00pm
Guest

Thanks a lot!

I uderstand the mechanism, the object colleciton is given by the files inlcuded in your project..there is no need to feed them to the linker via linker options...I did not want to have RIDE *guess* the library ^_^...

This pretty much solves my problem, thanks again!

Cheers
- Andy