aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Common
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-05-30 17:33:20 +0300
committerShlomo Hecht <shlomo@twine-s.com>2019-05-30 17:33:20 +0300
commitb525fbcad1ac8c7126caa82ec8458ffbb6284384 (patch)
tree61abe4c1610fc2e0b6af8e5f926d5624692df2fe /Software/Embedded_SW/Embedded/Common
parent405096b3d489f4ea7b50b1d5db7d32241251b8d7 (diff)
downloadTango-b525fbcad1ac8c7126caa82ec8458ffbb6284384.tar.gz
Tango-b525fbcad1ac8c7126caa82ec8458ffbb6284384.zip
Version 1.4.0.4: Improved memory handling, handles SW crash after a job failure
Diffstat (limited to 'Software/Embedded_SW/Embedded/Common')
-rw-r--r--Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c14
-rw-r--r--Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c3
-rw-r--r--Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c2
-rw-r--r--Software/Embedded_SW/Embedded/Common/Utilities/Utils.c14
-rw-r--r--Software/Embedded_SW/Embedded/Common/report/distributor.c3
-rw-r--r--Software/Embedded_SW/Embedded/Common/report/reportInit.c6
6 files changed, 23 insertions, 19 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
index 6c0262f66..c424320ff 100644
--- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
+++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
@@ -109,7 +109,7 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer)
}
else
{
- free (UploadFileHandle);
+ my_free (UploadFileHandle);
UploadFileHandle = 0;
}
@@ -172,7 +172,8 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer)
{
REPORT_MSG (FileReceivedLength,"file upload ended successfully");
f_close(ReceivedFileHandle);
- free (UploadFileHandle);
+ my_free (UploadFileHandle);
+ UploadFileHandle = 0;
FileReceivedLength = 0;
FileDone = true;
}
@@ -182,7 +183,8 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer)
{
REPORT_MSG (FileReceivedLength,"file upload too much data!");
f_close(ReceivedFileHandle);
- free (UploadFileHandle);
+ my_free (UploadFileHandle);
+ UploadFileHandle = 0;
FileReceivedLength = 0;
FileDone = true;
}
@@ -206,7 +208,7 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer)
responseContainer.continuous = false;
uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer));
size_t container_size = message_container__pack(&responseContainer, container_buffer);
- my_free(request->buffer.data);
+ //my_free(request->buffer.data);
file_chunk_upload_request__free_unpacked(request,NULL);
my_free(responseContainer.data.data);
SendCharsWithType(container_buffer, container_size,MESSAGE_TYPE__FileChunkUploadResponse);
@@ -301,7 +303,7 @@ uint32_t FileChunkDownloadRequestFunc(MessageContainer* requestContainer)
{
REPORT_MSG (FileSentLength,"file download ended successfully");
f_close(SentFileHandle);
- free (DownloadFileHandle);
+ my_free (DownloadFileHandle);
FileSentLength = 0;
}
else
@@ -310,7 +312,7 @@ uint32_t FileChunkDownloadRequestFunc(MessageContainer* requestContainer)
{
REPORT_MSG (FileSentLength,"file download too much data!");
f_close(SentFileHandle);
- free (DownloadFileHandle);
+ my_free (DownloadFileHandle);
FileSentLength = 0;
}
}
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c
index 01a30c21a..3bae023db 100644
--- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c
+++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FirmwareUpgrade.c
@@ -102,7 +102,8 @@ uint32_t ActivateVersionRequestFunc(MessageContainer* requestContainer)
ustrncpy (ActivateToken, requestContainer->token,36);
- strcpy (SWUpgradePath,request->path);
+ strncpy (SWUpgradePath,request->path,99);
+ SWUpgradePath[99] = NULL;
strcat(SWUpgradePath,"/package.cfg");
Fresult = FileRead(SWUpgradePath, &Bytes, &buffer);
diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c
index bee894585..05864303f 100644
--- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c
+++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c
@@ -20,7 +20,7 @@ typedef struct
} TangoVersion_t;
-TangoVersion_t _gTangoVersion = {1,4,0,3};
+TangoVersion_t _gTangoVersion = {1,4,0,4};
#define BUILD_DATE __DATE__
char Dat[50] = BUILD_DATE;
char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d
diff --git a/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c b/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c
index 341a43704..3871acb94 100644
--- a/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c
+++ b/Software/Embedded_SW/Embedded/Common/Utilities/Utils.c
@@ -15,12 +15,12 @@
//*****************************************************************************
-#define MAX_MEM_LOG 100
+/*#define MAX_MEM_LOG 100
int freeIndex=0,malloc_index=0;
uint32_t malloc_size[MAX_MEM_LOG+1];
uint32_t malloc_time[MAX_MEM_LOG+1];
void * malloc_addr[MAX_MEM_LOG+1];
-void * free_addr[MAX_MEM_LOG+1];
+void * free_addr[MAX_MEM_LOG+1];*/
//uint32_t total_allocated = 0;
void *my_malloc(size_t _size)
{
@@ -43,14 +43,14 @@ void *my_malloc(size_t _size)
malloc_time[malloc_index] = msec_millisecondCounter;
}
*/
- if ((addr)&&(_size>400))
+ /*if ((addr)&&(_size>400))
{
malloc_addr[malloc_index] = addr;
malloc_size[malloc_index] = _size;
malloc_time[malloc_index] = msec_millisecondCounter;
if (malloc_index++>=MAX_MEM_LOG)
malloc_index = 0;
- }
+ }*/
return addr;
}
int allocated_size = 0;
@@ -80,9 +80,9 @@ void my_free(void *_ptr)
// allocated_size+=malloc_size[i];
*
*/
- free_addr[freeIndex] = _ptr;
- if (freeIndex++>=MAX_MEM_LOG)
- freeIndex = 0;
+// free_addr[freeIndex] = _ptr;
+// if (freeIndex++>=MAX_MEM_LOG)
+// freeIndex = 0;
}
}
diff --git a/Software/Embedded_SW/Embedded/Common/report/distributor.c b/Software/Embedded_SW/Embedded/Common/report/distributor.c
index e4ab5fa36..d485abb70 100644
--- a/Software/Embedded_SW/Embedded/Common/report/distributor.c
+++ b/Software/Embedded_SW/Embedded/Common/report/distributor.c
@@ -728,7 +728,8 @@ static void messageDistribute(char *msg,
Dist_Table[DistTableEntry].dest[index].function(msg,FileName,LineNumber,errorCode,parameter1,parameter2);
}
*/
- strcpy (reportmsg,msg);
+ strncpy (reportmsg,msg,250);
+ reportmsg[251] = NULL;
if (ReportFunc1 != NULL)
ReportFunc1(reportmsg, FileName,LineNumber,errorCode,Severity, parameter);
diff --git a/Software/Embedded_SW/Embedded/Common/report/reportInit.c b/Software/Embedded_SW/Embedded/Common/report/reportInit.c
index 0d5836acf..8a39e8fd4 100644
--- a/Software/Embedded_SW/Embedded/Common/report/reportInit.c
+++ b/Software/Embedded_SW/Embedded/Common/report/reportInit.c
@@ -101,7 +101,7 @@ int ReportResponseFunc(char *message, /* The formatted message
response.message = message;
responseContainer = /*Report*/createContainer(MESSAGE_TYPE__StartDebugLogResponse, protobufToken, false, &response, &start_debug_log_response__pack, &start_debug_log_response__get_packed_size);
responseContainer.continuous = true;
- if (responseContainer.data.data)
+ //if (responseContainer.data.data)
{
uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer));
if (container_buffer)
@@ -111,13 +111,13 @@ int ReportResponseFunc(char *message, /* The formatted message
if (SendCharsWithType(container_buffer, container_size,MESSAGE_TYPE__StartDebugLogResponse) == false) //comm tx mailbox full
{
//CommunicationMailboxFlush();
- //protobufToken[0] = 0;
+ protobufToken[0] = 0;
my_free(container_buffer);
}
}
my_free(responseContainer.data.data);
}
-
+ //Task_sleep(5);
return OK;
}