#include "fw.h" #include "io.h" extern const char __dram_init_start[], __dram_init_end[], __dram_init_len[]; extern const char __dram_bss_start[], __dram_bss_end[], __dram_bss_len[]; uint32_t romcopy_time[2]; IRQHANDLER(romcopy) { static unsigned int romcopy_state; switch (romcopy_state++) { case 0: /* Copy testdata */ ROMCOPY_RAMADDR = (size_t)__dram_init_start; ROMCOPY_ROMADDR = __rom_offset; ROMCOPY_DATALEN = (size_t)__dram_init_len; break; case 1: /* Zero .dram.bss */ romcopy_time[0] = rdtime() - time_zero; ROMCOPY_RAMADDR = (size_t)__dram_bss_start; ROMCOPY_ROMADDR = 0; /* Clear */ ROMCOPY_DATALEN = (size_t)__dram_bss_len; break; default: romcopy_time[1] = rdtime() - romcopy_time[0]; mask_irq(ROMCOPY_IRQ); return; } }