This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] EK-TM4C1294XL:我尝试在我自己的工程中重复使用 EMACbootloader 代码中的 BOOTP 和 TFTP 功能。

Guru**** 2524370 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1563206/ek-tm4c1294xl-i-am-trying-to-reuse-the-bootp-and-tftp-functionalities-from-the-emacbootloader-code-in-my-own-project

器件型号:EK-TM4C1294XL


工具/软件:

我正在尝试在我自己的项目中重复使用 EMACbootloader 代码中的 BOOTP 和 TFTP 功能。 但是、当我直接重复使用并执行 BOOTPThread 函数时、程序会在调用 UIP_UDP_REMOVE (g_PCONN) 时进入 FaultISR。 此函数用于修改变量 g_PCONN。 您是否知道在执行此功能时可能导致问题的原因?

PT_THREAD(BOOTPThread(void))
#endif
{
//
// Begin the proto-thread.
//
PT_BEGIN(&g_sThread);
wait_for_link:
PT_WAIT_UNTIL(&g_sThread,
(LOCAL_EMACPHYRead(EMAC0_BASE, 0, EPHY_BMSR) &
EPHY_BMSR_LINKSTAT) != 0);
//
// Reset the host address.
//
*((uint32_t *)(void *)(&uip_hostaddr)) = 0;
//
// Re-bind the UDP socket for sending requests to the BOOTP server.
//
uip_udp_remove(g_pConn);
*((uint32_t *)(void *)(&g_sServerAddr)) = 0xffffffff;
uip_udp_new(&g_sServerAddr, HTONS(BOOTP_SERVER_PORT));
uip_udp_bind(g_pConn, HTONS(BOOTP_CLIENT_PORT));
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Muneto-San:

    在 bl_emac.c 文件中、g_PCONN 被声明为指针。 确保正确分配此指针变量。 请使用本应用手册查找导致故障的违规指令。  诊断 StellarisRegistered微控制器中的软件故障

    //*****************************************************************************
    //
    // The UDP socket used to communicate with the BOOTP and TFTP servers (in
    // sequence).
    //
    //*****************************************************************************
    struct uip_udp_conn *g_pConn;

     在 uip.h 文件中、您是否设置了 UIP_UDP?

    #if UIP_UDP
    /**
    * Representation of a uIP UDP connection.
    */
    struct uip_udp_conn {
    uip_ipaddr_t ripaddr; /**< The IP address of the remote peer. */
    u16_t lport; /**< The local port number in network byte order. */
    u16_t rport; /**< The remote port number in network byte order. */
    u8_t ttl; /**< Default time-to-live. */

    /** The application state. */
    uip_udp_appstate_t appstate;
    };

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    此问题是由于未使用 malloc 为结构指针分配内存所致。 感谢您的答复。