How to place compiled code at a selected address in STM32 ?

Status
Not open for further replies.

kekon

Full Member level 3
Joined
Sep 19, 2002
Messages
155
Helped
5
Reputation
10
Reaction score
3
Trophy points
1,298
Location
Poland, Białystok
Activity points
1,493
I need to place some compiled source code files at a given address in STM32F103 flash memory. I know this can be made in the linker script. I use Ride7 environment. I could't find any default linker script so I created one by extracting linker commands from automatically generated *.ld files. However, when i try to instruct linker to place some compiled files (with *.o) extension at a given address i get error messages. How can i solve the problem ?

In the section memory i declared "RECORDER SECTION":

MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 20K

RECORDER (rx) : ORIGIN = 0x8005000, LENGTH = 44K

FLASHPATCH (r) : ORIGIN = 0x00000000, LENGTH = 0
ENDFLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0
FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0
EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0
}

Then, i want the "main_loop.o" file to be placed at 0x8005000 address:

. = 0x8005000;
recorder_files :
{
main_loop.o(.recorder_files)
} > RECORDER AT > RECORDER

However, i get error message during compilation such as "multiple definition of `InitRTC'" ("InitRTC" is the name of a function in my program) or "main_loop.c:8: first defined here".
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…