changeset 1056:b241efe09963 Icon_Integration tip

Icon upload: added icon size check: The size of the icon is limited to 128k. To avoid overwritten data (font would no longer be shown correct) in case a larger icon is send, a size check has been added before floshing the icon.
author Ideenmodellierer
date Sat, 03 Jan 2026 20:42:09 +0100
parents de56b8d75504
children
files Discovery/Src/tComm.c
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Src/tComm.c	Sat Jan 03 20:40:11 2026 +0100
+++ b/Discovery/Src/tComm.c	Sat Jan 03 20:42:09 2026 +0100
@@ -1830,9 +1830,16 @@
     else
     if(id == id_ICON)
     {
-    	firmware2_variable_upperpart_eraseFlashMemory(length1Work,0);		/* flash is not in use => can be written immediately */
-    	firmware2_variable_upperpart_programFlashMemory(length1Work,0,pBuffer1,length1Work,0);
-    	ByteCompareStatus = 0;											/* trust flashing for image use case */
+    	if(length1Work < 0x20000)				/* Flash sectors 12-16 are used for icon => limited to 128K */
+    	{
+			firmware2_variable_upperpart_eraseFlashMemory(length1Work,0);		/* flash is not in use => can be written immediately */
+			firmware2_variable_upperpart_programFlashMemory(length1Work,0,pBuffer1,length1Work,0);
+			ByteCompareStatus = 0;											/* trust flashing for image use case */
+    	}
+    	else
+    	{
+    		ByteCompareStatus = 1;
+    	}
     }
 
     releaseFrame(20,(uint32_t)pBufferCompare);