Load other .text section with gdb
Dear ST support,
I'm working on STM32L476 and free AC6 toolchain.
I'm trying to create jump table and created dedicated sections in flash to hold the redirection:
please find below a description of what I did:
Exemple is to create a jump table from _mdelay to mdelay function
Assembly file :
.extern mdelay
.section .text.jtable_core_api,"ax",%progbits
.globl _mdelay
.type _mdelay, %function
_mdelay:
ldr r6,=mdelay
bx r6
.size _mdelay, .-_mdelay
linker script:
MEMORY
{
...
ROM_JTABLE_ (rx) : ORIGIN = 0x8078000, LENGTH = 1K
...
}
SECTIONS
{
...
.jtable_core_api :
{
. = ALIGN(8);
KEEP(*(.text.jtable_core_api))
KEEP(*(.text.jtable_core_api*))
. = ALIGN(8);
_ejt_core = .; /* define a global symbols at end of code */
} >ROM_JTABLE_APP
....
}
This works fine and the elf file holds the data at address 0x08078000 as expected (checkable in .map file)
map file:
.jtable_core_api
0x08077c00 0x60
0x08077c00 . = ALIGN (0x8)
*(.text.jtable_core_api)
.text.jtable_core_api
0x08077c00 0x5c src/projects/micropos_app/api/app_api/app_api.o
0x08077c00 _mdelay
*(.text.jtable_core_api*)
0x08077c60 . = ALIGN (0x8)
*fill* 0x08077c5c 0x4
0x08077c60 _ejt_core = .
Nevertheless, the section jtable_core_api is not loaded when launching a debug session and I figure I must configure gdb to take this section into account and process it as a casual text section.
All the more the gdb console says:
976,804 ~"Loading section .jtable_core_api, size 0x60 lma 0x8077c00\n"
976,804 19+download,{section=".jtable_core_api",section-size="96",total-size="2804945"}
Looking at the memory at address 0x08077C00, only 0xFFFFFFFF can be found 😢
Can someone help ?
Thanks for your help,
Regards,
Sylvain