EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

LPC1768 copy & execute isr from sram

Started by navman July 5, 2011
Hi,
Is there any example code to make the ISR to run out of SRAM. I know that
it involves the following steps:
1) Copy ISR from flash to SRAM.
2) Copy vector table to SRAM 
3) Remap vector table to SRAM using VTOR

I'm struggling here. Any examples for such code? I'm using the LPC1768
processor with LPCxpresso IDE/compiler. I need to do this to avoid the
annoying lag when jumping to interrupt (maybe due to flash access resulting
from a page fault). 	   
					
---------------------------------------		
Posted through http://www.EmbeddedRelated.com
"navman" <naveen_pn@n_o_s_p_a_m.yahoo.com> wrote in message 
news:vLednfUjWO3REI_TnZ2dnUVZ_vednZ2d@giganews.com...
> Hi, > Is there any example code to make the ISR to run out of SRAM. I know that > it involves the following steps: > 1) Copy ISR from flash to SRAM. > 2) Copy vector table to SRAM > 3) Remap vector table to SRAM using VTOR > > I'm struggling here. Any examples for such code? I'm using the LPC1768 > processor with LPCxpresso IDE/compiler. I need to do this to avoid the > annoying lag when jumping to interrupt (maybe due to flash access > resulting > from a page fault).
I was under the impression that M3 was slower executing from RAM because of load/store conflicting with ifetch. However, you'd have a similar issue accessing flash for data when executing from flash. Peter
On Mon, 04 Jul 2011 23:04:28 -0500, navman wrote:

> Hi, > Is there any example code to make the ISR to run out of SRAM. I know > that it involves the following steps: > 1) Copy ISR from flash to SRAM. > 2) Copy vector table to SRAM > 3) Remap vector table to SRAM using VTOR > > I'm struggling here. Any examples for such code? I'm using the LPC1768 > processor with LPCxpresso IDE/compiler. I need to do this to avoid the > annoying lag when jumping to interrupt (maybe due to flash access > resulting from a page fault). > > --------------------------------------- Posted through > http://www.EmbeddedRelated.com
The stock LPCXpresso IDE is going to fight with you a little on this as it is going to try and make sure everything is in flash. You will have to modify the startup files, cr_startup_lpc176x.c and the files in the CMSIS library if you are using those. You can use the same method as the startup files do to move your code into ram. Look at how the static data sections are initialized from flash. You will probably have to modify the linker script to make sure the stack and other memory areas dont overlap your code. The linker scripts are created by the IDE and I'm not sure what the IDE will do when you modify them. I'm not saying it wont play nicely, just that I have never tried. You might need to convert your project to using your own make file and linker scripts. -- Joe Chisolm

The 2024 Embedded Online Conference