blackfin server is not in memory

This commit is contained in:
maliakal_d 2021-11-11 10:06:47 +01:00
parent ec1ee635d5
commit 85d350b48b
3 changed files with 22 additions and 5 deletions

View File

@ -37,3 +37,4 @@ int writeToFlash(char *mess, ssize_t fsize, FILE *flashfd, FILE *srcfd);
/** Notify fpga to pick up firmware from flash and wait for status confirmation
*/
int waitForFPGAtoTouchFlash(char *mess);
int moveBinaryFile(char *mess, char *serverName);

View File

@ -574,3 +574,23 @@ int waitForFPGAtoTouchFlash(char *mess) {
LOG(logINFO, ("\tFPGA has picked up the program from flash\n"));
return OK;
}
int moveBinaryFile(char *mess, char *serverName) {
char *format = "mv %s %s";
if (snprintf(cmd, MAX_STR_LENGTH, format, TEMP_PROG_FILE_NAME,
serverName) >= MAX_STR_LENGTH) {
strcpy(mess, "Could not copy detector server. Command "
"to move server binary is too long\n");
LOG(logERROR, (mess));
return FAIL;
}
if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
snprintf(mess, MAX_STR_LENGTH,
"Could not copy detector server (moving). %s\n", retvals);
LOG(logERROR, (mess));
return FAIL;
}
LOG(logINFO, ("\tmoved from temp folder to main with proper name (%s)\n",
serverName));
return OK;
}

View File

@ -9381,11 +9381,7 @@ void receive_program_via_blackfin(int file_des, enum PROGRAM_INDEX index,
totalsize);
break;
case PROGRAM_SERVER:
ret = writeBinaryFile(mess, serverName, src, totalsize);
if (ret == OK) {
ret = verifyChecksumFromFile(mess, functionType, checksum,
serverName);
}
ret = moveBinaryFile(mess, serverName);
if (ret == OK) {
ret = setupDetectorServer(mess, serverName);
}