Function address fixing procedure in STM32F103 controller
Hi,
We are using STM32F103 family controllers.
how to fix the function address ,
i have tried below mentioned procedure ,but i am getting error .
Linker script source:
/* Linker script for STM32F4 series with fixed function address */
/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
}
/* Define sections */
SECTIONS
{
/* .text section - code */
.text :
{
*(.text)
*(.text.*)
*(.rodata)
*(.rodata*)
*(.glue_7)
*(.glue_7t)
*(.gcc_except_table)
*(.gcc_except_table.*)
*(.eh_frame)
*(.eh_frame*)
KEEP(*(.isr_vector))
KEEP(*(.init))
KEEP(*(.fini))
. = ALIGN(4);
} > FLASH
/* .data section - initialized data */
.data :
{
_sdata = .;
*(.data)
*(.data.*)
. = ALIGN(4);
_edata = .;
} > RAM AT > FLASH
/* .bss section - uninitialized data */
.bss :
{
_sbss = .;
*(.bss)
*(.bss.*)
*(COMMON)
. = ALIGN(4);
_ebss = .;
} > RAM
/* Other sections */
/* Fix function address at 0x800500 */
.myFunctionSection :
{
KEEP(*(.myFunctionSection))
} > FLASH AT 0x800500
/* Heap and stack section (optional) */
.heap :
{
*(.heap)
. = ALIGN(4);
} > RAM
.stack :
{
. = ALIGN(4);
_estack = .;
PROVIDE(end = .);
} > RAM
Main function source:
// Function declaration with memory section attribute
void myFunction(void) __attribute__((section(".mySection")));
// Function definition
void myFunction(void) {
// Your code here
}
// Main function
int main(void) {
// Call your fixed address function
myFunction();
while (1) {
// Your main application code
}
}
so kindly give correct procedure for function address fixing.
