[realtek-ambz2] Keep LOG UART enabled, wipe OTA2 in UF2

This commit is contained in:
Kuba Szczodrzyński
2023-05-28 19:18:54 +02:00
parent babdb1287f
commit af8c7417b3
3 changed files with 20 additions and 10 deletions

View File

@@ -404,6 +404,12 @@ bootloader_dst = env.subst("${BUILD_DIR}/bootloader.axf")
if not isfile(bootloader_dst):
copyfile(bootloader_src, bootloader_dst)
# OTA2 clearing - 4096 bytes of 0xFF
image_ota_clear = env.subst("${BUILD_DIR}/raw_ota_clear.bin")
if not isfile(image_ota_clear):
with open(image_ota_clear, "wb") as f:
f.write(b"\xFF" * 4096)
# Build all libraries
queue.BuildLibraries()
@@ -416,5 +422,7 @@ env.Replace(
UF2OTA=[
# same OTA images for flasher and device
f"{image_firmware_is},{image_firmware_is}=device:ota1,ota2;flasher:ota1,ota2",
# clearing headers of the "other" OTA image (hence the indexes are swapped)
f"{image_ota_clear},{image_ota_clear}=device:ota2,ota1;flasher:ota2,ota1",
],
)

View File

@@ -8,24 +8,30 @@
using namespace arduino;
#if HAS_SERIAL0
#ifndef PIN_SERIAL0_RX
#define PIN_SERIAL0_RX PIN_INVALID
#endif
#ifndef PIN_SERIAL1_RX
#define PIN_SERIAL1_RX PIN_INVALID
#endif
#ifndef PIN_SERIAL2_RX
#define PIN_SERIAL2_RX PIN_INVALID
#endif
#ifndef PIN_SERIAL0_TX
#define PIN_SERIAL0_TX PIN_INVALID
#endif
#endif
#if HAS_SERIAL1
#ifndef PIN_SERIAL1_RX
#define PIN_SERIAL1_RX PIN_INVALID
#endif
#ifndef PIN_SERIAL1_TX
#define PIN_SERIAL1_TX PIN_INVALID
#endif
#endif
#if HAS_SERIAL2
#ifndef PIN_SERIAL2_RX
#define PIN_SERIAL2_RX PIN_INVALID
#endif
#ifndef PIN_SERIAL2_TX
#define PIN_SERIAL2_TX PIN_INVALID
#endif
#endif
class SerialClass : public HardwareSerial {
private:

View File

@@ -33,10 +33,6 @@ void SerialClass::begin(unsigned long baudrate, uint16_t config) {
this->data = new SerialData();
this->buf = &BUF;
if (this->port == 2) {
hal_uart_deinit(&log_uart);
}
// TODO handle PIN_INVALID
hal_uart_init(&UART, this->tx, this->rx, NULL);