 #endif
 }
 
+// main sketch logic
 void setup () {
     Serial.begin(115200);
     Serial.print("[stm32f1init] ");

    RDUNP_CMD = 0x92,
};

static uint8_t getData (uint16_t index) {
    return pgm_read_byte(data + index);
}

static uint8_t getReply () {
    for (long i = 0; i < TIMEOUT; ++i)
        if (Target.available())

    return 0;
}

// wait for an ACK reply, else print an error message and halt
static void wantAck () {
    uint8_t b = 0;
    // wait a bit longer than normal getReply() timeouts, if needed
    for (int i = 0; i < 5; ++i) {
        b = getReply();
        if (b == 0) {
            Serial.print('.'); // each retry prints a dot
            continue;
        }
        if (b != ACK)
            break;
        check = 0; // the global checksum is always cleared after an ACK
        return;
    }
    Serial.print(" FAILED - got 0x");
    Serial.println(b, HEX);
    while (true) ; // halt
}

// send a byte to the target and update the global checkum value
static void sendByte (uint8_t b) {
    check ^= b;
    Target.write(b);
}

// send a command and wait for the coorresponding ACK
static void sendCmd (uint8_t cmd) {
    Serial.flush();
    sendByte(cmd);
