Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 217296

Forum Post: RE: TM4C1294NCPDT: Firmware upgrade over Ethernet with New Firmware Binary uploaded to flash memory.

$
0
0
Hi, I thought you were going to reference the bl_flash.c for programming and erasing the application section. To program and erase the binary section you would have used the similar method. Please see below bootloader code in the bl_emac.c file where the TFTP data is parsed and then the data is programmed to the application section by calling both the BL_FLASH_ERASE_FN_HOOK and BL_FLASH_PROGRAM_FN_HOOK functions. The data is programmed to the beginning at APP_START_ADDRESS. The BL_FLASH_ERASE_FN_HOOK and BL_FLASH_PROGRAM_FN_HOOK are defined in the bl_flash.c. What I was suggesting was that you can reference how it is done in the TivaWare bootloader. Your application will need to parse the received HTTP data and program to the binary section. //***************************************************************************** // //! Parses a packet checking for a TFTP data packet. //! //! This function parses a packet to determine if it is a TFTP data packet for //! out current TFTP transfer. If a valid packet is found, the contents of the //! packet are programmed into flash. //! //! \return Returns 1 if this packet was the last packet of the TFTP data //! transfer and 0 otherwise. // //***************************************************************************** static uint32_t ParseTFTPData(void) { uint8_t *pui8Packet = (uint8_t *)uip_appdata; uint32_t ui32FlashAddr; uint32_t ui32Idx; // // See if this is a TFTP data packet. // if((pui8Packet[0] != ((TFTP_DATA >> 8) && 0xff)) || (pui8Packet[1] != (TFTP_DATA & 0xff))) { return(0); } // // If the remote port on our connection is still the TFTP server port (i.e. // this is the first data packet), then copy the transaction ID for the // TFTP data connection into our connection. This will ensure that our // response will be sent to the correct port. // if(g_pConn->rport == HTONS(TFTP_PORT)) { g_pConn->rport = ((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])->srcport; } // // See if this is the correct data packet. // if((pui8Packet[2] != ((g_ui32TFTPBlock >> 8) & 0xff)) || (pui8Packet[3] != (g_ui32TFTPBlock & 0xff))) { // // Since the wrong data packet was sent, resend the ACK for it since // we've already processed it. // pui8Packet[0] = (TFTP_ACK >> 8) & 0xff; pui8Packet[1] = TFTP_ACK & 0xff; uip_udp_send(4); // // Ignore this packet. // return(0); } // // What address are we about to program to? // ui32FlashAddr = ((g_ui32TFTPBlock - 1) * TFTP_BLOCK_SIZE) + APP_START_ADDRESS; // // Do not program this data into flash if it is beyond the end of flash. // if(ui32FlashAddr > 8) & 0xff; pui8Packet[1] = TFTP_ACK & 0xff; // // Send the ACK packet to the TFTP server. // uip_udp_send(4); } // // If the packet was shorter than TFTP_BLOCK_SIZE bytes then this was the // last packet in the file. // if(ui32Idx != (TFTP_BLOCK_SIZE + 4)) { // // If an end signal hook function has been provided, call it here. // #ifdef BL_END_FN_HOOK BL_END_FN_HOOK(); #endif return(1); } // // There is more data to be read. // return(0); }

Viewing all articles
Browse latest Browse all 217296

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>