I've been working with the C6657 EVM from eInfoChips trying to get the TFTP boot mode working. It's been quite a journey, but now I am stuck.
The first step was to rebuild the ibl since by default when placed in IBL TFTP Boot mode, the default method is Bootp. This is configured in
C:\ti\mcsdk_2_01_01_04\tools\boot_loader\ibl\src\util\iblConfig\src\device.c
I changed the following lines to enable TFTP boot mode.
ibl.bootModes[2].u.ethBoot.doBootp = FALSE;
ibl.bootModes[2].u.ethBoot.useBootpServerIp = FALSE;
ibl.bootModes[2].u.ethBoot.useBootpFileName = FALSE;
Yes, I realize I am using an older ibl, but I could not get the newer one, in pdk_c665x_2_0_14 to run at all. Like it is incompatible with the ROM code that calls the ibl.
Anyway, after much work I was finally able to see the arp requests from the EVM to my host device. Mostly I seemed to have cache issues. However, while debugging those I was able to see the raw packet in memory before being sent to the EMAC. Specifically this code in cpmac_drv_send()
/* Fill out the transmit buffer descriptor */
pDesc->pNext = 0;
pDesc->pBuffer = (Uint8 *)deviceLocalAddrToGlobal((Uint32)buffer);
pDesc->BufOffLen = num_bytes;
pDesc->PktFlgLen = EMAC_DSC_FLAG_SOP | EMAC_DSC_FLAG_EOP | num_bytes | EMAC_DSC_FLAG_OWNER;
/* Send the packet out. */
ptr_EMACRegs->TX0HDP = (Uint32)pDesc;
The raw ethernet data is contained in "buffer" which contains the mac addresses and ip address, etc. The write of the pDesc to TX0HDP causes the emac to send the data.
The TFTP Boot Request is sent first. But the evm does not yet have the mac address so it must do an ARP Request. This code is in arp_resolve().
The destination MAC Address for an ARP Request is FF:FF:FF:FF:FF:FF, a broadcast message. When I look at the raw packet buffer, I see just that, FF:FF:FF:FF:FF:FF followed by the MAC address of the EVM. I then see the packet on Wireshark to my host and I see the host response an ARP Reply. I see the host MAC Address and I have traced the code and indeed arp_receive() is called.
It should be noted that when arp_resolve() detects that the mac address is not in the arp cache, it not only does a ARP Request, but it also caches the original packet, which in this case was the TFTP Boot Request. When arp_receive() gets the ARP Reply, it saves the Hosts MAC Address and checks for a cached packet, which it has, then builds the new Eth Header with the correct Host MAC Address and sends the packet just as it did with the ARP Request. Same exact code is called with the same exact descriptor setup.
I can look at the raw packet and see the correct host mac address. I can see the flag EMAC_DSC_FLAG_OWNER get reset, so the EMAC thinks it sent the packet. However, I never see the packet in wireshark. So, as a test, at the point the buffer is built and ready to send to the EMAC via the write to TX0HDP, I modified the Host Mac Address to be FF:FF:FF:FF:FF:FF and sure enough, I see the packet in wireshark, with the Host MAC of FF:FF:FF:FF:FF:FF and the TFTP Boot Request packet.
My wireshark on the host will capture other traffic with other MAC Addresses, so I don't feel like this is a host side issue or a wireshark issue, but I am open to troubleshooting that if required.
I feel like for some reason the EMAC is just not sending the packet out when the mac address is not FF:FF:FF:FF:FF:FF. I realize that makes no sense, but I seem to be stuck here so any help troubleshooting this further would be appreciated.
Thanks,
Chris