12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #include "common.h"
- #include "io.h"
- #include "sys.h"
- #include "console.h"
- #include "zlib.h"
- #define VJTAG_FLASH_CMD 0xabc80046
- /* IRQ handler not needed in this system */
- IRQHANDLER_DECL(spurious,0);
- IRQHANDLER(abc,0)
- {
- irqhandler_spurious_0(vector, pc);
- }
- IRQHANDLER(tty,1)
- {
- irqhandler_spurious_0(vector, pc);
- }
- /*
- * SDRAM upload buffer - always first in SDRAM
- */
- static uint8_t __attribute__((section(".jtag_flash_buffer")))
- jtag_flash_buf[17 << 20]; /* 16 MB + some slack */
- void main(void)
- {
- static const char hello[] =
- "\n\nMAX80 JTAG update firmware compiled on: ";
- unmask_irqs((1U << ROMCOPY_IRQ)|(1U << EBREAK_IRQ)|(1U << BUSERR_IRQ));
- con_puts(hello);
- con_puts(__datestamp);
- con_putc('\n');
- wait_romcopy_done();
- while (1) {
- uint32_t cmd;
- waitfor(VJTAG_IRQ);
- eoi(VJTAG_IRQ);
- cmd = VJTAG_CPUCMD;
- if (cmd == VJTAG_FLASH_CMD) {
- con_puts("JTAG: starting firmware flash process\n");
- rom_flash_from_memory(jtag_flash_buf, sizeof jtag_flash_buf);
- con_puts("JTAG: firmware flash process failed\n");
- } else {
- con_printf("JTAG: unknown command: 0x%08x\n", cmd);
- }
- }
- }
|