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 43
43
typedef struct bootInfo {
44
44
uint32_t jump_address ; //!< Address for BL to jump
45
45
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
47
47
} bootInfo_S ;
48
48
#pragma pack(pop)
49
49
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ typedef enum signatureType_ENUM {
54
54
signatureType_BOOTLOADER_FLASH = 0x02 , //!< New bootloader for FLASH
55
55
signatureType_BOOTLOADER_RAM = 0x03 , //!< Bootloader for RAM
56
56
signatureType_UNKNOWN = 0xFF , //!< Not existing or unknown signature
57
- } signatureType_E __attribute__ (( __packed__ )) ;
57
+ } signatureType_E ;
58
58
59
59
signatureType_E Signature_verification (const signature_S * signature );
60
60
Original file line number Diff line number Diff line change 40
40
#include "signature.h"
41
41
42
42
__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
44
44
static 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
46
46
47
47
static bool BinaryUpdate_writeToFlash (uint8_t * write_buffer , const uint32_t data_length );
48
48
@@ -93,7 +93,6 @@ BinaryUpdate_handleBootInfo(void) {
93
93
default :
94
94
boot_info .jump_address = FLASH_FIRMWARE_ADDRESS ;
95
95
boot_info .skip_bl_loop = false;
96
- boot_info .previus_binary = signatureType_FIRMWARE_FLASH ;
97
96
break ;
98
97
}
99
98
}
@@ -128,7 +127,7 @@ BinaryUpdate_erase(uint32_t firmware_size) {
128
127
success = FlashAdapter_erase (firmware_size , s_address );
129
128
break ;
130
129
case signatureType_BOOTLOADER_FLASH :
131
- if (signatureType_BOOTLOADER_RAM == boot_info . previus_binary ) {
130
+ if (boot_info . jump_address == RAM_FIRMWARE_ADDRESS ) {
132
131
//Only allowed to erase if RAM version is running
133
132
success = FlashAdapter_erase (firmware_size , s_address );
134
133
}
@@ -233,7 +232,8 @@ BinaryUpdate_finish(void) {
233
232
break ;
234
233
}
235
234
236
- boot_info .previus_binary = s_detected_binary ;
235
+ boot_info .end = 0xFF ;
236
+
237
237
return success ;
238
238
}
239
239
You can’t perform that action at this time.
0 commit comments