/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / Where is the default Link file for Raisonance projects?

Username:     
Password:     
             

Forum

# 1   2009-06-13 23:05:16 Where is the default Link file for Raisonance projects?

graham
Member
Registered: 2008-02-23
Posts: 32

Where is the default Link file for Raisonance projects?

Hello all,

I think I have a problem with the default link file, as I've looked at the *.map file and found that the code seems to run right up to the start of my interrupt vector table, and yet I have much more code yet to write, and plenty more Flash memory to do it in.

The reason I'm concerned and have looked into this possibility, is that depending on small changes in my code- i.e. moving a test block around,  bootloader reset can fail, although flash is updated, and works off flash mode reset, and I am having some unexplained glitches with interrupt driven hardware that appear to be affected by where my code compiles to as well.


I'm new to C, so I don't have experience with linkers or map files. My experience is previously all with assembler and 8 bit micros.

At some stage, I'm also hoping to move a portion of my code to RAM for a speed increase, so I will also need to modify the link file for this purpose.

Last edited by graham (2009-06-13 23:07:19)

Offline

 

# 2   2009-06-15 08:03:06 Where is the default Link file for Raisonance projects?

graham
Member
Registered: 2008-02-23
Posts: 32

Re: Where is the default Link file for Raisonance projects?

Still fairly sure this is the problem.

I found a link file at C:\Program Files\Raisonance\Ride\Lib\ARM, named:
"crt0.ld"
That's why I couldn't find the default when doing a windows file search, because in the project, when use default is selected, it automatically selects and greys out:
"ctr0.ld"

Look above carefully, the "rt" in the file I found is tranposed, and is "tr" in the raisonance project selection under scripts.

No wonder I couldn't find it.

My problem's not yet solved, but I can at least copy this file to my project directory now, and check through it, to hopefully track down the cause of the errors I'm encountering.

Offline

 

# 3   2009-06-16 08:29:03 Where is the default Link file for Raisonance projects?

VincentC
Administrator
Registered: 2007-11-08
Posts: 149

Re: Where is the default Link file for Raisonance projects?

Hi,

"crt0.ld" is the standard name for linker script files in gcc. That's why it is selected as default... if you forget the typo. wink

The one present in <Ride>\lib\ARM is the standard template from GCC and is not usable for what you are trying to do, as it is only a partial script, and it is not specific to STM32, and it is designed to be used inside a UNIX-like OS. It contains a lot of useless things, and lacks a lot of useful ones. Just forget about it. (We will probably remove it from Ride, to avoid confusion.)

The linker script file that is used when you check the 'default' option is generated in your project's folder every time you link. Its name depends on the device and options that you selected in your project. Typically, it can be something like that:
"STM32F103_32K_20K_FLASH.ld"

And it includes other sub-scripts, that are also either generated before the link, or copied from templates in the lib directory.

In order to use your own linker script, if you want to start from the default and modify it, the simplest is to link once using the "use default linker script" option, see what file is generated in the project's folder, and then change the project to use this file as custom linker script.


Finally, please note that the default linker script cannot work when using bootloaders. For this you have to create special scripts, one for linking the bootloader and one for linking the loaded applications. The way to do that depends a lot on how your bootloader is specified...


I hope it helps.


Best Regards,

Vincent

Offline

 

# 4   2009-06-16 11:17:01 Where is the default Link file for Raisonance projects?

graham
Member
Registered: 2008-02-23
Posts: 32

Re: Where is the default Link file for Raisonance projects?

VincentC

Thanks for your reply, that explains a lot of my grief:

The difference between this and a user created bootloader, is that STM (or ARM) have hard coded the bootloader, and so there are no address conflicts with the application program.

I chose the USART bootloader over JTAG to maximise hardware for other functions.

Indeed, I believe that the flash is programming OK most of the time, but I suspect problems with setting the entry vector properly. STM's "Flash Loader Demonstrator" program is designed for flash programming only (on the GUI version anyway), and so if there are any RAM addresses being specified in the HEX file, then I doubt that they are being programmed.


I will look into the workarounds you've suggested tomorrow... today's almost gone for me.

regards,
Graham.

Offline

 

# 5   2009-06-17 09:09:46 Where is the default Link file for Raisonance projects?

graham
Member
Registered: 2008-02-23
Posts: 32

Re: Where is the default Link file for Raisonance projects?

Vincent,
I've tried changing from the default link file in project/properties/LD linker/Scripts/Script file to my automatically generated link file: CNC.elf.ld, but this file is not editable in the fashion of a normal text file, it's mostly file names, with no directives for memory allocation, and contains non text printable characters.

I've been persevering anyway on my project, and after a flash program(boot loader reset mode), it appears that my program starts, but with corrupt RAM contents. Considering that my RAM contents are loaded from flash by flash instructions after boot, this is a bit of a mystery. I have some RAM used for stepper motor counters, absolute positions, and for PWM, but all this is initialised into volatile RAM after reset. When I can get the program partially running out of boot loader reset, I can see corrupt RAM values on my LCD but with a normal reset I get the expected values.

The "Flash loader demonstrator" program has a grayed out setting for @ (h) 8000000 , next to the "jump to the user program" tick box.

It would be nice to know exactly what's going wrong...

Offline

 

# 6   2009-06-17 09:37:48 Where is the default Link file for Raisonance projects?

VincentC
Administrator
Registered: 2007-11-08
Posts: 149

Re: Where is the default Link file for Raisonance projects?

Hi,

The "appname.elf.ld" ("CNC.elf.ld" in your case) is the primary linker script, and is always re-generated by Ride at each link, even when you select "custom linker script". It contains the list of input files, the name of the output files, and an "INCLUDE" directive for including the main linker script, which is the one that you specify in the linker option.

So you must just open the "CNC.elf.ld", search in it for the INCLUDE directive, and use the name of the file that is INCLUDE'd as your custom linker script. It should be something like "STM32F103_32K_20K_FLASH.ld".

Best Regards,

Vincent

Offline

 

# 7   2009-06-17 09:51:45 Where is the default Link file for Raisonance projects?

graham
Member
Registered: 2008-02-23
Posts: 32

Re: Where is the default Link file for Raisonance projects?

Thanks Vincent,
I've done as per your instructions.

I can view the file better networked over to my linux machine.
Three further include files to peruse... I'll bring local copies of them into my project and start looking for strange things...

regards,
Graham.

Offline

 

Board footer