Part Number: MSP432P401R
Hi folks,
I have been trying to get a function executed from SRAM with GCC (to hopefully increase its performance). I have tried the very generic tutorial from here: blog.atollic.com/using-gnu-gcc-on-arm-cortex-devices-placing-code-and-data-on-special-memory-addresses-using-the-gnu-ld-linker . Thus I have modified the linker script in the following way: the memory layout is now:
MEMORY { MAIN_FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x00040000 INFO_FLASH (RX) : ORIGIN = 0x00200000, LENGTH = 0x00004000 SRAM_FUNC (X) : ORIGIN = 0x01000000, LENGTH = 0x00001000 SRAM_CODE (RWX): ORIGIN = 0x01001000, LENGTH = 0x0000F000 SRAM_DATA (RW) : ORIGIN = 0x20000000, LENGTH = 0x00010000 }
and further down between .data and .bss I have added the following:
.SRAM_FUNC : { *(.SRAM_FUNC*); } > SRAM_FUNC
Then I have added __attribute__((section(".SRAM_FUNC"))) to the function I want to have in SRAM.
Unfortunately, that does not work. As soon as the CPU leaves the reset state, it jumps to the bus fault handler and shows a precise bus fault at the address 0x68d3e7c6 (which is in reserved memory that cannot be executed, thus the fault). So I guess my modification is not valid. I am unsure what caused it, but I guess it has something to do with the fact that most functions and objects have very small addresses, e.g. the EUSCIA0_Handler is at 0x6e8 (as reported by gdb) but the function which is placed in SRAM has the address 0x1000000 (that matches the start of the SRAM_FUNC) section.
Is anyone more fond of gnu link scripts and could help me?
Thanks in advance,
Dan