Other Parts Discussed in Thread: MSPM0L1306
This is how my linker cmd file looks like
-uinterruptVectors
--stack_size=256
MEMORY
{
FLASH (RX) : origin = 0x00000000, length = 0x0000F4F7
SEN_CFG (RW) : origin = 0x0000F4F8, length = 0x00000A80
SRAM (RWX) : origin = 0x20000000, length = 0x00001000
BCR_CONFIG (R) : origin = 0x41C00000, length = 0x00000080
BSL_CONFIG (R) : origin = 0x41C00100, length = 0x00000080
}
SECTIONS
{
.intvecs: > 0x00000000
.text : palign(8) {} > FLASH
.const : palign(8) {} > FLASH
.cinit : palign(8) {} > FLASH
.pinit : palign(8) {} > FLASH
.rodata : palign(8) {} > FLASH
.ARM.exidx : palign(8) {} > FLASH
.init_array : palign(8) {} > FLASH
.binit : palign(8) {} > FLASH
.TI.ramfunc : load = FLASH, palign(8), run=SRAM, table(BINIT)
.vtable : > SRAM
.args : > SRAM
.data : > SRAM
.bss : > SRAM
.sysmem : > SRAM
.stack : > SRAM (HIGH)
.SENCFG : {} > SEN_CFG
.BCRConfig : {} > BCR_CONFIG
.BSLConfig : {} > BSL_CONFIG
}As can be seen, I have defined a new section to store (and load) configuration data starting from 0x0000F4F8 spanning 0xA80 bytes. I've reduced the size of the section called 'FLASH' too. My new section is away from the last 8 bytes as mentioned in the manual. I was able to write to one of the locations in this region. However it will occasionally fail here too. It worked a couple of times and now I get a hard fault while writing to the same location. Previously, I was able to write to it but I faced this issue while reading from it.
I'd like to know if I need to do anything more than this aka defining a separate memory section and then directly using an address from within that section as part of code?
To identify the exception, I modified all exceptions and interrupts so that it breaks as suggested by Brandon Fisher94 here. Now it shows that I am getting a 'Hard Fault'. I am not sure why. Does anything here suggest that I may be accessing illegal memory? What could cause a hard fault in a case like mine?