Skip to content

Commit 2e5743e

Browse files
committed
Fix enable Update partition
1 parent 1d4973a commit 2e5743e

File tree

2 files changed

+32
-10
lines changed

2 files changed

+32
-10
lines changed

‎cores/esp32/esp32-hal-uart.c‎

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ static uart_t _uart_bus_array[3] ={
5656
{(volatileuart_dev_t*)(DR_REG_UART2_BASE), 2, NULL}
5757
};
5858
#else
59-
#defineUART_MUTEX_LOCK() do{} while (xSemaphoreTake(uart->lock, portMAX_DELAY) != pdPASS)
60-
#defineUART_MUTEX_UNLOCK() xSemaphoreGive(uart->lock)
59+
staticBaseType_t_pxHigherPriorityTaskWoken_=pdFALSE;
60+
#defineUART_MUTEX_LOCK() do{} while (xSemaphoreTakeFromISR(uart->lock, &_pxHigherPriorityTaskWoken_) != pdPASS)
61+
#defineUART_MUTEX_UNLOCK() xSemaphoreGiveFromISR(uart->lock, &_pxHigherPriorityTaskWoken_)
6162

6263
staticuart_t_uart_bus_array[3] ={
6364
{(volatileuart_dev_t*)(DR_REG_UART_BASE), NULL, 0, NULL},
@@ -377,9 +378,10 @@ int log_printf(const char *format, ...)
377378
if(s_uart_debug_nr<0){
378379
return0;
379380
}
380-
staticcharloc_buf[64];
381+
charloc_buf[64];
381382
char*temp=loc_buf;
382-
intlen;
383+
intlen, i;
384+
void (*put_char)(char) =NULL;
383385
va_listarg;
384386
va_listcopy;
385387
va_start(arg, format);
@@ -392,17 +394,37 @@ int log_printf(const char *format, ...)
392394
return0;
393395
}
394396
}
397+
398+
switch(s_uart_debug_nr){
399+
case0:
400+
put_char=&uart0_write_char;
401+
break;
402+
case1:
403+
put_char=&uart1_write_char;
404+
break;
405+
case2:
406+
put_char=&uart2_write_char;
407+
break;
408+
default:
409+
return0;
410+
}
395411
vsnprintf(temp, len+1, format, arg);
396412
#if !CONFIG_DISABLE_HAL_LOCKS
397413
if(_uart_bus_array[s_uart_debug_nr].lock){
398-
while (xSemaphoreTake(_uart_bus_array[s_uart_debug_nr].lock, portMAX_DELAY) !=pdPASS);
399-
ets_printf("%s", temp);
400-
xSemaphoreGive(_uart_bus_array[s_uart_debug_nr].lock);
414+
while (xSemaphoreTakeFromISR(_uart_bus_array[s_uart_debug_nr].lock, &_pxHigherPriorityTaskWoken_) !=pdPASS);
415+
for(i=0;i<len;i++){
416+
put_char(temp[i]);
417+
}
418+
xSemaphoreGiveFromISR(_uart_bus_array[s_uart_debug_nr].lock, &_pxHigherPriorityTaskWoken_);
401419
} else{
402-
ets_printf("%s", temp);
420+
for(i=0;i<len;i++){
421+
put_char(temp[i]);
422+
}
403423
}
404424
#else
405-
ets_printf("%s", temp);
425+
for(i=0;i<len;i++){
426+
put_char(temp[i]);
427+
}
406428
#endif
407429
va_end(arg);
408430
if(len>64){

‎libraries/Update/src/Updater.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ bool UpdateClass::_verifyHeader(uint8_t data){
209209

210210
boolUpdateClass::_verifyEnd(){
211211
if(_command == U_FLASH){
212-
if(!_enablePartition || !_partitionIsBootable(_partition)){
212+
if(!_enablePartition(_partition) || !_partitionIsBootable(_partition)){
213213
_abort(UPDATE_ERROR_READ);
214214
returnfalse;
215215
}

0 commit comments

Comments
(0)