/* * Load and switch to test image */ #include "fw.h" #include "irq.h" #include "io.h" #include "sys.h" extern const char __dram_start[]; extern const char __dram_test_start[], __dram_test_end[], __dram_test_size[]; extern no_return __start_test(void); static inline void disable_abcmem(void) { volatile uint32_t *pg = &ABCMEMMAP_PAGE(0); for (unsigned int addr = 0; addr < 0x10000; addr += 512) *pg++ = 0; } void __dram_text run_test_image(void) { disable_abcmem(); disable_irqs(); ROMCOPY_RAMADDR = (size_t)__dram_test_start; ROMCOPY_ROMADDR = __rom_offset + (__dram_test_start - __dram_start); ROMCOPY_DATALEN = (size_t)__dram_test_size; waitfor(ROMCOPY_IRQ); __start_test(); }