File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 4343typedef struct bootInfo {
4444 uint32_t jump_address ; //!< Address for BL to jump
4545 bool skip_bl_loop ; //!< Flag to skip BL loop
46- signatureType_E previus_binary ; //!< Previous detected binary
46+ uint8_t end ; // FIXME: added here because after restart something is messing up with data in the structure and if there is an extra byte at the end it messes only with it
4747} bootInfo_S ;
4848#pragma pack(pop)
4949
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ typedef enum signatureType_ENUM {
5454 signatureType_BOOTLOADER_FLASH = 0x02 , //!< New bootloader for FLASH
5555 signatureType_BOOTLOADER_RAM = 0x03 , //!< Bootloader for RAM
5656 signatureType_UNKNOWN = 0xFF , //!< Not existing or unknown signature
57- } signatureType_E __attribute__ (( __packed__ )) ;
57+ } signatureType_E ;
5858
5959signatureType_E Signature_verification (const signature_S * signature );
6060
Original file line number Diff line number Diff line change 4040#include "signature.h"
4141
4242__attribute__ ((section (".restart_info" )))
43- bootInfo_S boot_info ; //!< Instruction on where to jump after the restart
43+ volatile bootInfo_S boot_info ; //!< Instruction on where to jump after the restart
4444static uint64_t s_address ; //!< Address from where to erase flash and write binary
45- static signatureType_E s_detected_binary ; //!< Detected binary
45+ static signatureType_E s_detected_binary ; //!< Detected binary
4646
4747static bool BinaryUpdate_writeToFlash (uint8_t * write_buffer , const uint32_t data_length );
4848
@@ -93,7 +93,6 @@ BinaryUpdate_handleBootInfo(void) {
9393 default :
9494 boot_info .jump_address = FLASH_FIRMWARE_ADDRESS ;
9595 boot_info .skip_bl_loop = false;
96- boot_info .previus_binary = signatureType_FIRMWARE_FLASH ;
9796 break ;
9897 }
9998}
@@ -128,7 +127,7 @@ BinaryUpdate_erase(uint32_t firmware_size) {
128127 success = FlashAdapter_erase (firmware_size , s_address );
129128 break ;
130129 case signatureType_BOOTLOADER_FLASH :
131- if (signatureType_BOOTLOADER_RAM == boot_info . previus_binary ) {
130+ if (boot_info . jump_address == RAM_FIRMWARE_ADDRESS ) {
132131 //Only allowed to erase if RAM version is running
133132 success = FlashAdapter_erase (firmware_size , s_address );
134133 }
@@ -233,7 +232,8 @@ BinaryUpdate_finish(void) {
233232 break ;
234233 }
235234
236- boot_info .previus_binary = s_detected_binary ;
235+ boot_info .end = 0xFF ;
236+
237237 return success ;
238238}
239239
You can’t perform that action at this time.
0 commit comments