Hi,
I would like to use the flash resident boot loader that comes with Stellarisware to perform updates (via UART).
The problem I'm running into is that the boot loader receive function is a while loop.
void
UARTReceive(unsigned char *pucData, unsigned long ulSize)
{
//
// Send out the number of bytes requested.
//
while(ulSize--)
{
//
// Wait for the FIFO to not be empty.
//
while((HWREG(UART1_BASE + UART_O_FR) & UART_FR_RXFE))
{
}
//
// Receive a byte from the UART.
//
*pucData++ = HWREG(UART1_BASE + UART_O_DR);
}
}
This method does not handle garbage data and incomplete packet receives (it hangs in the receive loop). I would think that the boot loader would be designed to use an interrupt to receive data rather than an infinite loop, making it cleaner to implement timeouts and allow other things to run while waiting for data to be received. Why was this design choice made? Is it a bad idea to use interrupts in the bootloader, or is this something I should be able to do?
I know that the boot loader copies code to RAM then branches there, but I don't understand the differences between executing code in flash versus RAM (and haven't been very successful in searching for relevant information on this topic).