Using an stm32f746 disco, I’m trying to get a function to compile to a different memory location using Mbed.
so far, as a test, i have this mbed_app.json…
{
"target_overrides": {
"*": {
"target.ld_script": "custom_stm32f746.ld"
}
}
}
then this custom_stm32f746.ld…
/* Linker script to configure memory regions. */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 320K
CUSTOM_SECTION (rx) : ORIGIN = 0x080C0000, LENGTH = 128K
}
/* Define entry point */
ENTRY(Reset_Handler)
/* Section Definitions */
SECTIONS
{
.text :
{
*(.text)
*(.text.*)
} > FLASH
.custom_section :
{
KEEP(*(.custom_section))
} > CUSTOM_SECTION
.data :
{
*(.data)
} > RAM AT > FLASH
.bss :
{
*(.bss)
} > RAM
/* Other sections */
}
View more
and this in my main.c…
__attribute__((section(".custom_section"))) void myFunction(void);
__attribute__((section(".custom_section"), used)) void myFunction() {
printf("This function is at %0xH\n", (int) myFunction);
}
but the output is…
This function is at 8000259H
and using the cube programmer the memory at 80c0000 is unchanged