Esempio n. 1
0
static void send_m1284p_fw_packet(df_adr_t fw_img_offset, uint32_t offset, rvn_loc_cmd_fw_packet_t* fw_packet)
{
    // read and send 'RVN_FW_PACKET_SIZE' bytes at time
    df_read(fw_img_offset + offset, RVN_FW_PACKET_SIZE, (uint8_t*)fw_packet->data);
    fw_packet->id = RVN_LOC_CMD_FW_PACKET;
    fw_packet->size = RVN_FW_PACKET_SIZE;
    fw_packet->adr = offset;
    sipc_send_frame(sizeof(rvn_loc_cmd_fw_packet_t)+RVN_FW_PACKET_SIZE, (uint8_t*)fw_packet);
}
static void do_fw_upgrade(df_adr_t fw_image_adr)
{
    // Write FW image from data flash to ATmega3290p application progam area
    for (sp_adr_t adr = 0; adr < SF_APPLICATION_END; adr += SF_PAGE_BYTE_SIZE) {
        // Read data from flash
        df_read(fw_image_adr + adr, SF_PAGE_BYTE_SIZE, page_buffer);
        
        // Display current page
        int page = adr/SF_PAGE_BYTE_SIZE + 1;
        lcd_num_putdec(page, LCD_NUM_PADDING_SPACE);
    
        // Write page to ATmega3290 Application section
        sp_write_flash_page(adr, page_buffer);
    }
}