programs, but flashes checksum wrong

This commit is contained in:
2021-09-09 17:52:36 +02:00
parent aea664f40c
commit a9f82985bc
10 changed files with 115 additions and 35 deletions

View File

@ -1241,7 +1241,7 @@ int DetectorImpl::kbhit() {
}
std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
// validate type of file
/* // validate type of file
bool isPof = false;
switch (multi_shm()->multiDetectorType) {
case JUNGFRAU:
@ -1363,10 +1363,10 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
if (close(dst) != 0) {
throw RuntimeError("Program FPGA: Could not close destination file");
}
LOG(logDEBUG1) << "File has been converted to " << destfname;
LOG(logINFOBLUE) << "File has been converted to " << destfname;
*/
// loading dst file to memory
FILE *fp = fopen(destfname, "r");
FILE *fp = fopen("/tmp/SLS_DET_MCB.ZpfQln", "r");//
if (fp == nullptr) {
throw RuntimeError("Program FPGA: Could not open rawbin file");
}
@ -1389,7 +1389,7 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
"Program FPGA: Could not close destination file after converting");
}
unlink(destfname); // delete temporary file
//unlink(destfname); // delete temporary file
LOG(logDEBUG1) << "Successfully loaded the rawbin file to program memory";
LOG(logDEBUG1) << "Read file into memory";
return buffer;

View File

@ -3474,11 +3474,34 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
<< " returned error: " << client.readErrorMessage();
throw RuntimeError(os.str());
}
if (moduleIndex == 0) {
LOG(logINFO) << "Checksum verified";
LOG(logINFO) << "Checksum verified for module " << moduleIndex << " ("
<< shm()->hostname << ")";
// erasing flash
{
LOG(logINFO) << "Erasing Flash for module " << moduleIndex << " ("
<< shm()->hostname << ")";
printf("%d%%\r", 0);
std::cout << std::flush;
// erasing takes 65 seconds, printing here (otherwise need threads
// in server-unnecessary)
const int ERASE_TIME = 65;
int count = ERASE_TIME + 1;
while (count > 0) {
std::this_thread::sleep_for(std::chrono::seconds(1));
--count;
printf(
"%d%%\r",
static_cast<int>(
(static_cast<double>(ERASE_TIME - count) / ERASE_TIME) * 100));
std::cout << std::flush;
}
printf("\n");
}
// copied to flash
LOG(logINFO) << "Writing to Flash to module " << moduleIndex << " ("
<< shm()->hostname << ")";
if (client.Receive<int>() == FAIL) {
std::ostringstream os;
os << "Detector " << moduleIndex << " (" << shm()->hostname << ")"