Content originally posted in LPCWare by PhilYoung on Tue Dec 18 09:30:05 MST 2012
The LPC4300's have a lot of flexibility in the external memory controller, but you need to configure it yourself.
By default at power up the EMC will be operating from a slow clock, if you want to speed it up then you need to program the EMC to enable clocking from a faster clock, and to configure the timings for your specific flash type.
Of course external flash will always be slower than running from SRAM, there is no CACHE on the LPC devices, but you can improve things slightly if your flash supports burst mode access.
If you want to run from internal SRAM then it's up to you to define this when you build your code, which depends on what toolchain you are using.
If you are using the ARM MDK then you simple need to use a scatter file that specifies a different load and execute region and the toolchain will include the necessary code relocation at boot time. With other toochains you will do it in a different manner and MAY need to provide your own starup code for this, I don't use GCC so I'm not sure what support that provides, maybe others can help.
for Keil / ARM it's a simple matter, here is a simple example I use that relocates the code to SRAM, but leaves the startup code in flash as there is no point in wasting SRAM. Most code required at runtime ends up in ER_IRAM1 at 0x10000200, but all the init code that only runs once stays in flash.
LR_IROM1 0x00000000 0x00040000 { ; load region size_region
ER_FLASH 0x00000000 { ; root section for startup code and vector table
Startup_lpc43xx.o (RESET, +First)
Startup_lpc43xx.o (FLASH_ENTRY)
Startup_lpc43xx.o (SETREG)
*.o(i.InitMemc)
Startup_lpc43xx.o (+RO)
*(InRoot$$Sections)
System_LPC43xx.o(+RO)
fpu_init.o(+RO)
}
ER_BootExportCode 0x10000000 0x180 {
*.o(BootExportCode)
}
ER_IRAM 0x10000200 {
.ANY(+RO)
}
RW_AHBRAM1 0x20000200 0x0000C000 { ; RW data, 48K
*.o(+RW +ZI)
.ANY (+RW +ZI)
}
DRAM 0x28100000 0x01000000 {
Startup_lpc43xx.o (NETHEAP)
}
ER_BootExportData 0x20000000 UNINIT {
*.o(BootExportData +First )
}
}
regards
Phil.