diff --git a/uartboot.c b/uartboot.c index d64085c..034dc63 100644 --- a/uartboot.c +++ b/uartboot.c @@ -86,6 +86,7 @@ void uart_boot(uint32_t *jump_entry_point) { #if defined(FLASH_TYPE_NAND) + int wrote_copies = 0; int prog_ok = 0; int block_num; struct nand_image_descriptor_t im_desc; @@ -130,20 +131,26 @@ uart_boot(uint32_t *jump_entry_point) NOR_WriteBytes(nor_get_flashbase(), uart_ack_header.size, (uint32_t) uart_ack_header.recv_buffer); #elif defined(FLASH_TYPE_NAND) + wrote_copies = 0; for (block_num = START_UBL_BLOCK_NUM; block_num <= END_UBL_BLOCK_NUM; block_num++) { im_desc.magic = uart_ack_header.magic; im_desc.block_num = block_num; im_desc.entry_point = uart_ack_header.entry_point; im_desc.load_address = 0; /* Load address not used by RBL */ - if (nand_write_prog(&im_desc, uart_ack_header.recv_buffer, uart_ack_header.size) == E_PASS) + if (nand_write_prog(&im_desc, uart_ack_header.recv_buffer, uart_ack_header.size) == E_PASS) { + wrote_copies += 1; prog_ok = 1; + } } if (!prog_ok) goto uartboot_error; #endif /* Indicate that UBL flashing was successfull. */ + uart_send_str("INFO: UBLs written: "); + uart_send_hexnum(wrote_copies, 1); + uart_send_lf(); host_msg("DONE"); host_msg("SENDAPP"); @@ -193,6 +200,7 @@ uart_boot(uint32_t *jump_entry_point) #elif defined(FLASH_TYPE_NAND) /* Write multiple copy of U-Boot (depending on the defines in NAND.h) */ prog_ok = 0; + wrote_copies = 0; for (block_num = START_UBOOT_BLOCK_NUM; (block_num+MAX_BLOCK_PER_UBOOT-1) <= END_UBOOT_BLOCK_NUM; block_num += MAX_BLOCK_PER_UBOOT) { im_desc.magic = uart_ack_header.magic; im_desc.block_num = block_num; @@ -201,14 +209,19 @@ uart_boot(uint32_t *jump_entry_point) /* Assuming load address is identical to entry point. */ im_desc.load_address = uart_ack_header.entry_point; - if (nand_write_prog(&im_desc, uart_ack_header.recv_buffer, uart_ack_header.size) == E_PASS) + if (nand_write_prog(&im_desc, uart_ack_header.recv_buffer, uart_ack_header.size) == E_PASS) { + wrote_copies += 1; prog_ok = 1; + } } if (!prog_ok) goto uartboot_error; #endif /* Indicate that APP flashing was successfull. */ + uart_send_str("INFO: APPs written: "); + uart_send_hexnum(wrote_copies, 1); + uart_send_lf(); host_msg("DONE"); break;