Line 480... |
Line 480... |
secp= secpp[i];
|
secp= secpp[i];
|
if ((secp->m_start >= RESET_ADDRESS)
|
if ((secp->m_start >= RESET_ADDRESS)
|
&&(secp->m_start+secp->m_len
|
&&(secp->m_start+secp->m_len
|
<= SPIFLASH+FLASHWORDS))
|
<= SPIFLASH+FLASHWORDS))
|
valid = true;
|
valid = true;
|
|
if ((secp->m_start >= RAMBASE)
|
|
&&(secp->m_start+secp->m_len
|
|
<= RAMBASE+MEMWORDS))
|
|
valid = true;
|
if (!valid) {
|
if (!valid) {
|
fprintf(stderr, "No such memory on board: 0x%08x - %08x\n",
|
fprintf(stderr, "No such memory on board: 0x%08x - %08x\n",
|
secp->m_start, secp->m_start+secp->m_len);
|
secp->m_start, secp->m_start+secp->m_len);
|
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
}
|
}
|
}
|
}
|
|
|
for(int i=0; secpp[i]->m_len; i++) {
|
for(int i=0; secpp[i]->m_len; i++) {
|
secp = secpp[i];
|
secp = secpp[i];
|
if (!flash->write(secp->m_start, secp->m_len, secp->m_data, true)) {
|
if ((secp->m_start >= RAMBASE)
|
|
&&(secp->m_start+secp->m_len
|
|
<= RAMBASE+MEMWORDS)) {
|
|
for(int i=0; (unsigned)i<secp->m_len; i++) {
|
|
if (secp->m_data[i] != 0) {
|
|
fprintf(stderr, "ERR: Cannot set RAM upon bootup!\n");
|
|
fprintf(stderr, "(The bootloaders just not that smart ... yet)\n");
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
}
|
|
} else if (!flash->write(secp->m_start, secp->m_len, secp->m_data, true)) {
|
fprintf(stderr, "ERR: Could not write program to flash\n");
|
fprintf(stderr, "ERR: Could not write program to flash\n");
|
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
}
|
}
|
}
|
}
|
m_fpga->readio(R_VERSION); // Check for bus errors
|
m_fpga->readio(R_VERSION); // Check for bus errors
|