diff --git a/httpd/httpd.c b/httpd/httpd.c index d4afc29..78b8339 100644 --- a/httpd/httpd.c +++ b/httpd/httpd.c @@ -296,11 +296,11 @@ uint8_t stream_upload(uint16_t bptr) if (verify_crc) { dbg_string("CRC16: "); dbg_short(crc_final); dbg_char('\n'); if (crc_final == 0xb001) { - dbg_string("Checksum OK."); + print_string("Checksum OK."); } else { - dbg_string("Checksum incorrect!"); + print_string("Checksum incorrect!"); } - dbg_string("Upload to flash done, will reset!\n"); + print_string("\nUpload to flash done, will reset!\n"); reset_chip(); } // Make sure there is a 0 at the end of the uploaded data @@ -424,6 +424,7 @@ void handle_post(void) p += 4; // Skip \r\n\r\n sequence at end of preamble of part if (is_word(request_path, "upload")) { + print_string("Firmware upload started."); uptr = FIRMWARE_UPLOAD_START; verify_crc = 1; max_upload = 1024576; @@ -514,6 +515,7 @@ void httpd_appcall(void) // Check here maxupload by subtracting uip_len and close socekt if fails! if (max_upload - uip_len > 0) { stream_upload(0); + write_char('.'); } else { send_bad_request(); goto do_send; diff --git a/rtl837x_flash.c b/rtl837x_flash.c index 3945bf9..00f7cb5 100644 --- a/rtl837x_flash.c +++ b/rtl837x_flash.c @@ -342,8 +342,8 @@ void flash_sector_erase(void) void flash_write_bytes(__xdata uint8_t *ptr) { - write_char('>'); print_long(flash_region.addr); write_char(':'); print_short(flash_region.len); write_char('-'); print_byte(*ptr); write_char('\n'); - while(1) { + // write_char('\n'); write_char('>'); print_long(flash_region.addr); write_char(':'); print_short(flash_region.len); write_char('-'); print_byte(*ptr); // write_char('\n'); + while(1) { flash_write_enable(); SFR_FLASH_CMD = CMD_PAGE_PROGRAM; SFR_FLASH_TCONF = 0x40 | 8 | 4; // Bytes written is 4, 8 enables write, 0x40 is unknown @@ -369,7 +369,6 @@ void flash_write_bytes(__xdata uint8_t *ptr) flash_region.len -= 4; flash_region.addr += 4; }; - while (flash_read_status() & 0x1); flash_configure_mmio(); } diff --git a/rtlplayground.c b/rtlplayground.c index 5031f0e..ba46007 100644 --- a/rtlplayground.c +++ b/rtlplayground.c @@ -1794,7 +1794,7 @@ void bootloader(void) // Flash controller should be initialized before any code in other banks is being fetched // See this issue: https://github.com/logicog/RTLPlayground/issues/70 print_string("\nInitializing Flash controller\n"); - flash_init(1); + flash_init(0); // Set default for SFP pins so we can start up a module already inserted sfp_pins_last = 0x33; // signal LOS and no module inserted (for both slots, even if only 1 present) @@ -1848,7 +1848,7 @@ void bootloader(void) __xdata uint16_t i = 0; __xdata uint16_t j = 0; __xdata uint8_t * __xdata bptr; - print_string("Identified update image. Checking integrity...\n"); + print_string("Identified update image. Checking integrity..."); crc_value = 0x0000; for (i = 0; i < 1024; i++) { @@ -1857,28 +1857,31 @@ void bootloader(void) flash_read_bulk(flash_buf); bptr = flash_buf; for (j = 0; j < 0x200; j++) { - print_byte(*bptr); write_char(' '); + // print_byte(*bptr); write_char(' '); crc16(bptr++); - print_short(crc_value); write_char(':'); + // print_short(crc_value); write_char(':'); } source += 0x200; - write_char('\n'); print_short(crc_value); write_char(' '); + // write_char('\n'); print_short(crc_value); write_char(' '); + if (i%16 == 0) + write_char('.'); } if (crc_value == 0xb001) { - print_string("Checksum OK\n"); - print_string("Update in progress, moving firmware to start of FLASH!\n"); + print_string("\nChecksum OK\n"); + print_string("Update in progress, moving firmware to start of FLASH."); source = FIRMWARE_UPLOAD_START; - // A 512kByte = 4MBit Flash has 128*8=1024 512k blocks, we copy only 120 - for (i = 0; i < 960; i++) { - print_string("Writing block: "); - print_short(dest); + // A 512kByte = 4MBit Flash has 128*8=1024 512byte blocks, we copy only 896 + // (don't overwrite config @ 0x700000) + for (i = 0; i < 896; i++) { + // print_string("Writing block: "); + // print_short(dest); flash_region.addr = source; flash_region.len = 0x200; flash_read_bulk(flash_buf); - write_char('\n'); if (!(i & 0x7)) { flash_region.addr = dest; flash_sector_erase(); + write_char('.'); } flash_region.addr = dest; flash_region.len = 0x200; @@ -1886,7 +1889,7 @@ void bootloader(void) dest += 0x200; source += 0x200; } - print_string("Deleting uploaded flash image\n"); + print_string("\nDeleting uploaded flash image\n"); dest = FIRMWARE_UPLOAD_START; for (register uint8_t i=0; i < 128; i++) { flash_region.addr = dest;