2024-10-07 01:27 AM - last edited on 2024-10-07 01:41 AM by SofLit
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"
}
}
}
/* 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 */
}
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
2024-10-07 01:34 AM
@andy0105 wrote:using Mbed.
Probably best to ask mbed-specific questions on the mbed forum:
How to post "pre-formatted" text - like linker scripts:
Are you aware that Mbed End Of Life has been announced:
https://forums.mbed.com/t/important-update-on-mbed-end-of-life/23644