diff Discovery/Src/data_central.c @ 1017:5924a2d1d3ba GasConsumption

Prepare custom block update function: In the flash area of the font lib some sectors may be used for custom data or a boot updater image. With this change a flash option is added to the maintainance menu. IMPORTANT: The fimwareEraseProgram.c is needed for compiling the firmware now => Add it e.g. by adding a link from the OtherSources location to your source folder.
author Ideenmodellierer
date Thu, 29 May 2025 22:04:46 +0200
parents 65d35e66efb9
children 677d293c669f
line wrap: on
line diff
--- a/Discovery/Src/data_central.c	Sun May 11 16:18:20 2025 +0200
+++ b/Discovery/Src/data_central.c	Thu May 29 22:04:46 2025 +0200
@@ -717,10 +717,12 @@
 
 uint32_t	CRC_CalcBlockCRC_moreThan768000(uint32_t *buffer1, uint32_t *buffer2, uint32_t words)
 {
- cm_t        crc_model;
- uint32_t      word_to_do;
- uint8_t       byte_to_do;
- int         i;
+	 cm_t        crc_model;
+	 uint32_t      word_to_do;
+	 uint8_t       byte_to_do;
+	 int         i;
+
+	 uint32_t wordCnt = 0;
  
      // Values for the STM32F generator.
  
@@ -733,10 +735,10 @@
  
      cm_ini(&crc_model);
  
-     while (words--)
+     do
      {
          // The STM32F10x hardware does 32-bit words at a time!!!
-				if(words > (768000/4))
+				if(wordCnt >= (768000/4))
 					word_to_do = *buffer2++;
 				else
 					word_to_do = *buffer1++;
@@ -765,7 +767,8 @@
  
              cm_nxt(&crc_model, byte_to_do);
          }
-     }
+         wordCnt++;
+     } while (wordCnt != words);
  
      // Return the final result.