完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
小弟最近拿到一块EK-TM41294的demo板,调试远程升级功能。
背景: 目前用tivaware_C_Series-2.1.3.156 固件例子中的boot_serial程序可以实现串口升级。 该目录下没有网口升级例子,于是在SW-DK-TM4C129X-2.1.3.156.exe 例程中找到boot_demo_emac_flash例子 把例子移植到Tivaware_C_Series-2.1.3.156,使用该库的驱动及对应库,可以编译生成bin程序,烧录进去后 可以看到板卡MAC和设置的IP,然后程序就一直在这个位置,使用LM flash program 配置成网络模式升级也失败,连接不上,不知道有没有人做过该例子? 贴上源码 //***************************************************************************** // // Demonstrate the use of the boot loader. // //***************************************************************************** int main(void) [ // tContext sContext; uint32_t ui32IPAddr; SysCtlMOSCConfigSet(SYSCTL_MOSC_HIGHFREQ); // // Run from the PLL at 120 MHz. // g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); // // Configure the device pins. // PinoutSet(true,false); // // Initialize the display driver. // /// Kentec320x240x16_SSD2119Init(g_ui32SysClock); // // Initialize the graphics context. // // GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119); // // Draw the application frame. // // FrameDraw(&sContext, "boot-demo-emac-flash"); // // Initialize the peripherals that each of the boot loader flavors // supports. Although this example is only intended for use with the // Ethernet boot loader, we initialize the other two peripherals too just // in case it is used with the USB or serial boot loaders. // SetupForUART(); SetupForEthernet(); // SetupForUSB(); // // Add the compile-time defined widgets to the widget tree. // // WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sBackground); // // Paint the widget tree to make sure they all appear on the display. // // WidgetPaint(WIDGET_ROOT); // // We don't have an IP address yet so clear the variable to tell us to // check until we are assigned one. // ui32IPAddr = 0; UARTprintf("g_bFirmwareUpdate=%dnr",g_bFirmwareUpdate); // // Loop forever, processing widget messages. // while(!g_bFirmwareUpdate) [ // UARTprintf("ui32IPAddr=%xnr",ui32IPAddr); // // Do we have an IP address yet? If not, check to see if we've been // assigned one since the last time we checked. // #if 1 if(ui32IPAddr == 0 || ui32IPAddr == 0xFFFFFFFF) [ // // What is our current IP address? // ui32IPAddr = lwIPLocalIPAddrGet(); // // If it's non zero, update the display. // if(ui32IPAddr!= 0 && ui32IPAddr != 0xFFFFFFFF) [ UARTprintf("IP: %d.%d.%d.%dnr",ui32IPAddr & 0xff, (ui32IPAddr >> 8) & 0xff, (ui32IPAddr >> 16) & 0xff, ui32IPAddr >> 24); // WidgetPaint((tWidget *)&g_sIPAddr); ] ] #endif // // Process any messages from or for the widgets. // // WidgetMessageQueueProcess(); ] // // If we drop out, the user has sent "Magic Package" via LMFlash // so we tidy up and transfer control to the boot loader. // // // Tell the user that we got their instruction. // // CanvasTextSet(&g_sStatus, "Updating..."); // WidgetPaint((tWidget *)&g_sStatus); UARTprintf("Updating...nr"); // // Process all remaining messages on the queue (including the paint message // we just posted). // // WidgetMessageQueueProcess(); // // Transfer control to the bootloader. // SoftwareUpdateBegin(g_ui32SysClock); // // The previous function never returns but we need to stick in a return // code here to keep the compiler from generating a warning. // return(0); ] 网络配置如下: //***************************************************************************** // // Perform the initialization steps required to start up the Ethernet controller // and lwIP stack. // //***************************************************************************** void SetupForEthernet(void) [ uint32_t ui32User0, ui32User1; uint8_t pui8MACAddr[8]; // // Configure SysTick for a 100Hz interrupt. // ROM_SysTickPeriodSet(g_ui32SysClock / TICKS_PER_SECOND); ROM_SysTickEnable(); ROM_SysTickIntEnable(); // // Get the MAC address from the UART0 and UART1 registers in NV ram. // ROM_FlashUserGet(&ui32User0, &ui32User1); if((ui32User0 == 0xffffffff) || (ui32User1 == 0xffffffff)) [ // // We should never get here. This is an error if the MAC address has // not been programmed into the device. Exit the program. // UARTprintf("MAC Address Not Programmed!nr"); while(1) [ ] ] // // Convert the 24/24 split MAC address from NV ram into a MAC address // array. // pui8MACAddr[0] = ui32User0 & 0xff; pui8MACAddr[1] = (ui32User0 >> 8) & 0xff; pui8MACAddr[2] = (ui32User0 >> 16) & 0xff; pui8MACAddr[3] = ui32User1 & 0xff; pui8MACAddr[4] = (ui32User1 >> 8) & 0xff; pui8MACAddr[5] = (ui32User1 >> 16) & 0xff; // // Format this address into the string used by the relevant widget. // UARTprintf("MAC: %02X-%02X-%02X-%02X-%02X-%02Xnr", pui8MACAddr[0], pui8MACAddr[1], pui8MACAddr[2], pui8MACAddr[3], pui8MACAddr[4], pui8MACAddr[5]); // // Remember that we don't have an IP address yet. // // usnprintf(g_pcIPAddr, SIZE_IP_ADDR_BUFFER, "IP: Not assigned"); UARTprintf("IP: Not assignednr"); // // Initialize the lwIP TCP/IP stack. // // lwIPInit(g_ui32SysClock, pui8MACAddr, 0, 0, 0, IPADDR_USE_AUTOIP); lwIPInit(g_ui32SysClock, pui8MACAddr,0xC0A8010C ,0xFFFFFF0, 0xC0A80101 , IPADDR_USE_STATIC); // // Setup the device locator service. // // LocatorInit(); // LocatorMACAddrSet(pui8MACAddr); // // Start the remote software update module. // UARTprintf("SoftwareUpdateInitnr"); SoftwareUpdateInit(SoftwareUpdateRequestCallback); //这句一直没有运行,不知道为什么 ] |
|
相关推荐
8 个讨论
|
|
只有小组成员才能发言,加入小组>>
NA555DR VCC最低电压需要在5V供电,为什么用3.3V供电搭了个单稳态触发器也使用正常?
702 浏览 3 评论
MSP430F249TPMR出现高温存储后失效了的情况,怎么解决?
613 浏览 1 评论
对于多级放大电路板,在PCB布局中,电源摆放的位置应该注意什么?
1075 浏览 1 评论
771 浏览 0 评论
普中科技F28335开发板每次上电复位后数码管都会显示,如何熄灭它?
535 浏览 1 评论
请问下tpa3220实际测试引脚功能和官方资料不符,哪位大佬可以帮忙解答下
183浏览 20评论
请教下关于TAS5825PEVM评估模块原理图中不太明白的地方,寻求答疑
145浏览 14评论
两个TMP117传感器一个可以正常读取温度值,一个读取的值一直是0,为什么?
8浏览 13评论
在使用3254进行录音的时候出现一个奇怪的现象,右声道有吱吱声,请教一下,是否是什么寄存器设置存在问题?
136浏览 13评论
TLV320芯片内部自带数字滤波功能,请问linein进来的模拟信号是否是先经过ADC的超采样?
130浏览 12评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-2 20:06 , Processed in 1.400817 second(s), Total 77, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号