diff --git a/slsDetectorServers/slsDetectorServer/src/common.c b/slsDetectorServers/slsDetectorServer/src/common.c index 2a2b7b857..a04aee5c3 100644 --- a/slsDetectorServers/slsDetectorServer/src/common.c +++ b/slsDetectorServers/slsDetectorServer/src/common.c @@ -360,6 +360,10 @@ int verifyChecksumFromFlash(char *mess, char *functionType, ("\tReached %lu bytes. Not reading more\n", totalBytesRead)); break; } + // for less than 128 bytes + if ((readUnitSize + totalBytesRead) > fsize) { + readUnitSize = fsize - totalBytesRead; + } bytes = fread(buf, 1, readUnitSize, fp); totalBytesRead += bytes; } diff --git a/slsDetectorServers/slsDetectorServer/src/programViaBlackfin.c b/slsDetectorServers/slsDetectorServer/src/programViaBlackfin.c index a143309dc..3e5d8538b 100644 --- a/slsDetectorServers/slsDetectorServer/src/programViaBlackfin.c +++ b/slsDetectorServers/slsDetectorServer/src/programViaBlackfin.c @@ -313,11 +313,13 @@ int eraseAndWriteToFlash(char *mess, enum PROGRAM_INDEX index, return FAIL; } - /* remove condition when flash fpga and flash kernel fixed */ - /*if (verifyChecksumFromFlash(mess, messageType, clientChecksum, - flashDriveName, fsize) == FAIL) { - return FAIL; - }*/ + /* remove condition when flash fpga fixed */ + if (index == PROGRAM_KERNEL) { + if (verifyChecksumFromFlash(mess, messageType, clientChecksum, + flashDriveName, fsize) == FAIL) { + return FAIL; + } + } if (index == PROGRAM_FPGA) { if (waitForFPGAtoTouchFlash(mess) == FAIL) {