2020-01-06 08:17 AM
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.
2020-01-06 08:31 AM
.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
2020-01-06 08:51 AM
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.
2020-01-06 09:01 AM
Can you run the compile/linker from a makefile or the command line so your other tools don't regenerate/damage them?
2020-01-06 09:26 AM
b
2020-01-06 09:26 AM
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.
2020-01-06 09:44 AM
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?