Skip to content

Commit e817bae

Browse files
committed
review fixups
1 parent 7cdeb52 commit e817bae

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

bootloaders/uart/uart_boot.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ void uart_boot() {
7979
while (current_addr < end_addr) {
8080
uart_putc_raw(UART_ID, 'w');
8181
char *buf = (char*)current_addr;
82-
for (int i=0; i < 32; i++) {
82+
int i;
83+
for (i = 0; i < 32; i++) {
8384
uart_putc_raw(UART_ID, buf[i]);
8485
}
8586
if (!uart_is_readable_within_us(UART_ID, 500)) {
@@ -94,7 +95,7 @@ void uart_boot() {
9495
reset_chip();
9596
return;
9697
}
97-
current_addr += 32;
98+
current_addr += i;
9899
}
99100

100101
uint32_t time_end = time_us_32();
@@ -133,19 +134,23 @@ void uart_boot() {
133134
in = uart_getc(UART_ID);
134135
if (in != buf[i]) {
135136
printf("Verify has incorrect data at 0x%08x - resetting\n", current_addr - start_addr + SRAM_BASE);
137+
reset_chip();
138+
return;
136139
}
137140
i++;
138141
}
139142
if (i != 32) {
140143
printf("Verify has incorrect data size - resetting\n");
144+
reset_chip();
145+
return;
141146
}
142147
in = uart_getc(UART_ID);
143148
if (in != 'r') {
144149
printf("Incorrect response - resetting\n");
145150
reset_chip();
146151
return;
147152
}
148-
current_addr += 32;
153+
current_addr += i;
149154
}
150155

151156
time_end = time_us_32();
@@ -186,10 +191,10 @@ int main()
186191
reset_chip();
187192

188193
int attempts = 0;
194+
char splash[] = "RP2350";
195+
char hello[] = "Hello, world";
189196

190197
while (true) {
191-
char splash[] = "RP2350";
192-
char hello[] = "Hello";
193198
char buf[500] = {0};
194199
int i = 0;
195200
while (uart_is_readable(UART_ID) && i < sizeof(buf)) {

0 commit comments

Comments
 (0)