I'm having a hard fault on the serial bootloader application.
Running the debugger, it seems to be OK with parsing the "bad checksum" data that the Python program sends initially. But as soon as it starts sending real data from the bootloader_blinky hex file, it goes into hard fault.
I've traced it down to the "transformLine" function, and there is something that it doesn't like about this code, but I don't know why:
for (i=0; i<(char_count>>1); i++) {// Get the top nibble (careful of ASCII offsets)if (buffer[i<<1] < 'A') top = buffer[i<<1] - '0' ;else top = buffer[i<<1] - 'A' + 10 ; // Get the bottom nibble (careful of ASCII offsets)if (buffer[(i<<1)+1] < 'A') bottom = buffer[(i<<1)+1] - '0' ;else bottom = buffer[(i<<1)+1] - 'A' + 10 ;// Mask the two nibbles into a bytebuffer[i] = (top<<4) | bottom ;
I'm having a hard fault on the serial bootloader application.
Running the debugger, it seems to be OK with parsing the "bad checksum" data that the Python program sends initially. But as soon as it starts sending real data from the bootloader_blinky hex file, it goes into hard fault.
I've traced it down to the "transformLine" function, and there is something that it doesn't like about this code, but I don't know why:
for (i=0; i<(char_count>>1); i++) {
// Get the top nibble (careful of ASCII offsets)
if (buffer[i<<1] < 'A') top = buffer[i<<1] - '0' ;
else top = buffer[i<<1] - 'A' + 10 ;
// Get the bottom nibble (careful of ASCII offsets)
if (buffer[(i<<1)+1] < 'A') bottom = buffer[(i<<1)+1] - '0' ;
else bottom = buffer[(i<<1)+1] - 'A' + 10 ;
// Mask the two nibbles into a byte
buffer[i] = (top<<4) | bottom ;
I will keep digging.