Hi,
there are two ways how external flash is being used
1) either you want to execute compiled code (possibly boot from the external flash)
2) or you want to read and program the data during runtime by user application
Case 1)
Usually you would use standalone programmer like PeMicro Cyclone MAX, or other that is capable to program specified .elf file directly to external memory device connected to MCU with using specific programming algorithm delivered by programmer manufacturer. For instance, following one
http://www.pemicro.com/cyclone/index.cfm
Of course, other third-party programmer’s providers exist.
Case 2)
User can write his own flash programming driver according to sequence of commands over EBI address and data lines according to sequence described if specific memory’s datasheet.
Unfortunately, currently I don't have example code I could share with you.
davidtosenovjan I have made a code of external flash on EVB board, but when I debug the code on EVB, the program will crash once it accesses the 0x20000000. I am confused about this.
uint16_t i = 0;
SIUL2.MSCR_IO[289].R = 0x32000003u;
SIUL2.MSCR_IO[290].R = 0x32010003u;
SIUL2.MSCR_IO[291].R = 0x32390003u;
SIUL2.MSCR_IO[292].R = 0x32000003u;
SIUL2.MSCR_IO[293].R = 0x32000003u;
SIUL2.MSCR_IO[294].R = 0x32000003u;
SIUL2.MSCR_IO[295].R = 0x32010002u;
SIUL2.MSCR_IO[296].R = 0x32390003u;for(i=297; i<321; i++){
SIUL2.MSCR_IO[i].R = 0x32000003u;}
/* PS0-15 PT0-15*/
for(i=257; i<289; i++){
SIUL2.MSCR_IO[i].R = 0x32380003u;
}/* Base Address: 0x20000000, 32-bit, Mux'd bus */
EBI.BR0.R = 0x20000083;
EBI.BR1.R = 0x21000083;
/* Address Mask: 512KBytes, One Wait States - Pipelined Sync SRAM */
EBI.OR0.R = 0xFF000010;
EBI.OR1.R = 0xFF000010;/* MCR - 16-bit mode */
EBI.MCR.R = 0x00000000;
if I use EBI, what reason can make the program can't access the address and crash. Is there anything else to configure? like ld file or something.