Skip to main content
Basavanagouda1
Associate II
January 6, 2020
Question

How to create separate liker file for Bootloader and application.

  • January 6, 2020
  • 3 replies
  • 3407 views

Hi All,

I'm developing a secondary bootloader to load my main application to flash memory.

I used example bootloader code for my controller SPC560L3.

I have some questions related to the linker files. How I can create separate linker files for my Bootloader and application code.

As shown in the below pic, Bootloader code starts from 0x0000 address and ends at 0x8000.

Application starts from 0x8000 address.

How I can create .ld file to use these addresses. How to shift my vector table address for main application 0x8000.

Please help me with any example code or suggestions.

Thanks,

Basava.

0690X00000Bvdq9QAB.png

This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
January 6, 2020

.LD files typically have a section at the top describing the FLASH and RAM visible to the linker. Shrink the size, and move the base addresses of the FLASH to describe the appropriate areas, the Bootloader's starting at 0x00000000 and being 32KB in length. The two can share the same RAM, or you can create areas to permit parameters/data to be passed.

https://community.st.com/s/question/0D50X00009XkXeKSAV/how-create-section-in-spc5-studio

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Basavanagouda1
Associate II
January 6, 2020

Hi Clive,

Thank you for the reply,

I have same question as in the above post. I have created the user.ld file, but if I regenerate my project, the application.ld file will generate with the default settings.

How to stop and link my user.ld file to my project and component generate process?

Thanks,

Basava.

Tesla DeLorean
Guru
January 6, 2020

Can you run the compile/linker from a makefile or the command line so your other tools don't regenerate/damage them?

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Basavanagouda1
Associate II
January 6, 2020

As in the Makefile , I have created user.ld file and added below changes in the file.

Makefile

# Define linker script file here

ifneq ($(wildcard user.ld),)

LDSCRIPT = user.ld

else

LDSCRIPT = application.ld

endif

user.ld

__irq_stack_size__   = 0;

__process_stack_size__ = 2048;

MEMORY

{

  flash   : org = 0x00000000, len = 64k 

  dataflash : org = 0x00800000, len = 64k

  ram    : org = 0x40000000, len = 40k

}

I'm dedicated 64k flash to Bootloader. After creating this file, I recompiled and regenerated the project. Application.ld file still regenerated and its not affect changes in the user.ld file.

So, as in the Makefile code will consider user.ld file now? how we can verify it?

Thanks,

Basava.

Basavanagouda1
Associate II
January 6, 2020

b