Line 92... |
Line 92... |
"\tziprun loads the object file into memory, resets the CPU, and leaves it\n"
|
"\tziprun loads the object file into memory, resets the CPU, and leaves it\n"
|
"\tin a halted state ready to start running the object file.\n");
|
"\tin a halted state ready to start running the object file.\n");
|
exit(-1);
|
exit(-1);
|
}
|
}
|
|
|
// FPGAOPEN(m_fpga);
|
|
|
|
printf("Halting the CPU\n");
|
printf("Halting the CPU\n");
|
|
m_fpga->usleep(5);
|
m_fpga->writeio(R_ZIPCTRL, CPU_RESET|CPU_HALT);
|
m_fpga->writeio(R_ZIPCTRL, CPU_RESET|CPU_HALT);
|
|
|
fp = fopen(argv[0], "r");
|
fp = fopen(argv[0], "r");
|
if (fp == NULL) {
|
if (fp == NULL) {
|
fprintf(stderr, "Could not open: %s\n", argv[0]);
|
fprintf(stderr, "Could not open: %s\n", argv[0]);
|
Line 147... |
Line 146... |
|
|
// Clear any buffers
|
// Clear any buffers
|
printf("Clearing the cache\n");
|
printf("Clearing the cache\n");
|
m_fpga->writeio(R_ZIPCTRL, CPU_RESET|CPU_HALT|CPU_CLRCACHE);
|
m_fpga->writeio(R_ZIPCTRL, CPU_RESET|CPU_HALT|CPU_CLRCACHE);
|
|
|
// printf("Clearing all registers to zero, PC regs to MEMBASE\n");
|
printf("Clearing all registers to zero, PC regs to MEMBASE\n");
|
// Clear all registers to zero
|
// Clear all registers to zero
|
for(int i=0; i<32; i++) {
|
for(int i=0; i<32; i++) {
|
unsigned int v;
|
|
try {
|
try {
|
m_fpga->writeio(R_ZIPCTRL, CPU_HALT|i);
|
m_fpga->writeio(R_ZIPCTRL, CPU_HALT|i);
|
m_fpga->readio(R_ZIPCTRL);
|
m_fpga->readio(R_ZIPCTRL);
|
} catch(BUSERR a) {
|
} catch(BUSERR a) {
|
fprintf(stderr, "Bus-ERR while trying to set CPUCTRL to %x\n", CPU_HALT|i);
|
fprintf(stderr, "Bus-ERR while trying to set CPUCTRL to %x\n", CPU_HALT|i);
|
Line 168... |
Line 166... |
// m_fpga->readio(R_ZIPDATA);
|
// m_fpga->readio(R_ZIPDATA);
|
// printf("\t= %08x\n", m_fpga->readio(R_ZIPDATA));
|
// printf("\t= %08x\n", m_fpga->readio(R_ZIPDATA));
|
} catch(BUSERR a) {
|
} catch(BUSERR a) {
|
fprintf(stderr, "Bus-ERR while trying to clear reg %x\n", i);
|
fprintf(stderr, "Bus-ERR while trying to clear reg %x\n", i);
|
}
|
}
|
} for(int i=32; i<32+16; i++) {
|
}
|
|
|
|
|
|
printf("Clearing all peripherals\n");
|
|
for(int i=32; i<32+16; i++) {
|
try {
|
try {
|
if (i==33)
|
if (i==33)
|
continue; // Don't start the watchdog
|
continue; // Don't start the watchdog
|
if (i==34)
|
if (i==34)
|
continue; // Don't start the flash cache
|
continue; // Don't start the flash cache
|