comparison 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
comparison
equal deleted inserted replaced
1014:8c0134a287da 1017:5924a2d1d3ba
715 } 715 }
716 716
717 717
718 uint32_t CRC_CalcBlockCRC_moreThan768000(uint32_t *buffer1, uint32_t *buffer2, uint32_t words) 718 uint32_t CRC_CalcBlockCRC_moreThan768000(uint32_t *buffer1, uint32_t *buffer2, uint32_t words)
719 { 719 {
720 cm_t crc_model; 720 cm_t crc_model;
721 uint32_t word_to_do; 721 uint32_t word_to_do;
722 uint8_t byte_to_do; 722 uint8_t byte_to_do;
723 int i; 723 int i;
724
725 uint32_t wordCnt = 0;
724 726
725 // Values for the STM32F generator. 727 // Values for the STM32F generator.
726 728
727 crc_model.cm_width = 32; // 32-bit CRC 729 crc_model.cm_width = 32; // 32-bit CRC
728 crc_model.cm_poly = 0x04C11DB7; // CRC-32 polynomial 730 crc_model.cm_poly = 0x04C11DB7; // CRC-32 polynomial
731 crc_model.cm_refot = FALSE; // Final result is not bit-reversed 733 crc_model.cm_refot = FALSE; // Final result is not bit-reversed
732 crc_model.cm_xorot = 0x00000000; // Final result XOR'ed with this 734 crc_model.cm_xorot = 0x00000000; // Final result XOR'ed with this
733 735
734 cm_ini(&crc_model); 736 cm_ini(&crc_model);
735 737
736 while (words--) 738 do
737 { 739 {
738 // The STM32F10x hardware does 32-bit words at a time!!! 740 // The STM32F10x hardware does 32-bit words at a time!!!
739 if(words > (768000/4)) 741 if(wordCnt >= (768000/4))
740 word_to_do = *buffer2++; 742 word_to_do = *buffer2++;
741 else 743 else
742 word_to_do = *buffer1++; 744 word_to_do = *buffer1++;
743 745
744 // Do all bytes in the 32-bit word. 746 // Do all bytes in the 32-bit word.
763 word_to_do >>= 8; 765 word_to_do >>= 8;
764 } 766 }
765 767
766 cm_nxt(&crc_model, byte_to_do); 768 cm_nxt(&crc_model, byte_to_do);
767 } 769 }
768 } 770 wordCnt++;
771 } while (wordCnt != words);
769 772
770 // Return the final result. 773 // Return the final result.
771 774
772 return (cm_crc(&crc_model)); 775 return (cm_crc(&crc_model));
773 } 776 }