I cannot see the need for your _sram and _ram attributes. Where did you get that code from?
Can you please post your complete project so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Like i mentioned, the code was from page 153 of the psoc 4 architecture TRM (http://www.cypress.com/file/126171/download)
From what i understand, the function SpcIntHandler() needs to be placed in the ram (more specifically at address 0x20000000) because we want the interrupt to be handled by this handler in RAM instead of the one in Flash. The motivation for this project was too see how these interrupts were called when making such system calls.
Anyway attached is the bundle.
There is still no code to be found on page 153 on your provided manual link.
I cannot see any advantages from using the provided flash-write routines which are already provided in your chip in the system rom.
Have a look into chapter 8 regarding Flash in the "System Reference Guide" (from Creator Help menu).
Whoops, my apologies i was referring to an older version. The code is in page 293 of this manual.