@@ -116,12 +116,12 @@ bool eraseBootCommandBlock(void) {
116
116
return 1 ;
117
117
}
118
118
119
- uint32_t eboot_command_read_from_flash (void )
119
+ uint32_t eboot_command_read_from_flash (eboot_flash_command_t *cmd )
120
120
{
121
121
eboot_index_t eboot_index;
122
122
eboot_flash_command_t *flash_command;
123
123
uint32_t i;
124
- // const uint32_t dw_count = sizeof(struct eboot_command) / sizeof(uint32_t);
124
+ const uint32_t dw_count = sizeof (struct eboot_command ) / sizeof (uint32_t );
125
125
126
126
if (!eboot_read_flash_index (&eboot_index)) {
127
127
return 0 ;
@@ -131,11 +131,11 @@ uint32_t eboot_command_read_from_flash(void)
131
131
if (((flash_command->flags & EBOOT_CMD_FLAG_SLOT_FREE) == 0 ) &&
132
132
((flash_command->flags & EBOOT_CMD_FLAG_PENDING) == EBOOT_CMD_FLAG_PENDING)) {
133
133
// This is a valid command waiting to be actioned, or should be. The CRC check will determine if it's actually valid
134
- // uint32_t* dst = (uint32_t *) cmd;
135
- // uint32_t* src = (uint32_t *) flash_command->cmd;
136
- // for (uint32_t i = 0; i < dw_count; ++i) {
137
- // dst[i] = src[i];
138
- // }
134
+ uint32_t * dst = (uint32_t *) cmd;
135
+ uint32_t * src = (uint32_t *) &( flash_command->cmd ) ;
136
+ for (uint32_t i = 0 ; i < dw_count; ++i) {
137
+ dst[i] = src[i];
138
+ }
139
139
return 1 ;
140
140
}
141
141
}
@@ -158,7 +158,9 @@ uint32_t eboot_command_write_to_flash(struct eboot_command *cmd)
158
158
} else {
159
159
ets_printf (" Read bootCommand %d, flags: %x\n " , i, flash_command.flags );
160
160
if (((flash_command.flags & EBOOT_CMD_FLAG_SLOT_FREE) == EBOOT_CMD_FLAG_SLOT_FREE) &&
161
- ((flash_command.flags & EBOOT_CMD_FLAG_PENDING) == EBOOT_CMD_FLAG_PENDING)) {
161
+ ((flash_command.flags & EBOOT_CMD_FLAG_PENDING) == EBOOT_CMD_FLAG_PENDING) &&
162
+ (flash_command.cmd .magic == 0 )
163
+ ) {
162
164
target_command_slot = i;
163
165
break ;
164
166
}
0 commit comments