Code assigned to section ".scratch_x" is linked against address 0x20040000, but does not get copied from flash to ram at startup.
I don't know linker scripts well, but my guess is that *(.scratch_x.*) should have been *(.scratch_x*).
.scratch_x : {
__scratch_x_start__ = .;
*(.scratch_x.*)
. = ALIGN(4);
__scratch_x_end__ = .;
} > SCRATCH_X AT > FLASH
__scratch_x_source__ = LOADADDR(.scratch_x);
Repo case:
edit the blink.c example to:
int attribute ((section (".scratch_x"))) main() {