cancel
Showing results for 
Search instead for 
Did you mean: 

How to create separate liker file for Bootloader and application.

Basavanagouda1
Associate II

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 discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
6 REPLIES 6

.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 Venmo
Up vote any posts that you find helpful, it shows what's working..
Basavanagouda1
Associate II

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.

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 Venmo
Up vote any posts that you find helpful, it shows what's working..
Basavanagouda1
Associate II

b

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.

These are presumably GNU tools, not sure what's regenerating them here? Your IDE? If the IDE is constantly breaking things, perhaps use different methods to build the code with the compiler, assembler, linker more directly.

You could presumably move the project files to a safe place, and run make from the console/command line.

@Erwan YVIN Can you find training materials for the SPC5, and perhaps direct Basava to an FAE covering his account?​ 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..