0
votes

My problem is with the Ethernet/Socket calls. In Linux, we have sendto and recvfrom calls to send and receive data from the external devices connected via Ethernet. Now I am executing my code on U-Boot as a standalone application. I need to replace these socket calls which should be independent of OS.

Are there any APIs/drivers provided in U-Boot so that I can use them directly and transfer the data to and from the Target Board? If so where should I check for a processor specific driver? I am unable to find it. The board which I am using is a customized one based on MPC8548E processor.

2

2 Answers

0
votes

U-Boot standalone API does support raw ethernet packet eth_send() and eth_receive(). However, that is much less functionality than Linux sockets.

Protocols over UDP, e.g. DHCP and TFTP are implemented in U-Boot commands (although those protocols are not exported in the standalone API). If you need more functionality than that, e.g. TCP, you'll probably need an OS i.e. Linux, rather than U-Boot.

Ideally, existing commands would do what you need. For example, you could assemble file content in a standalone app invoked through command line, then transmit the file with existing command tftpboot. Or you could implement custom commands inside u-boot rather than standalone app; you could copy/paste from existing protocols' implementation.

If you do pursue standalone application, refer to examples/api/demo.c. That shows the abilities and limitations of standalone API. If you have source code for your customized u-boot, demo.bin will be in the build output (make sure you have #define CONFIG_API in your board config.h), and it may just load/run on your board with no further mods. For eth interface, it will use ethact, and will send a packet filled with 00. The board specific driver is already in your u-boot.

0
votes

U-Boot standalone API does support raw ethernet packet eth_send() and eth_receive(). However, that is much less functionality than Linux sockets.

This point is of more interest to me. As far as I understood, we can export the functions eth_send() and eth_receive() functions from U-Boot and use them in standalone applications. Right? Less functionality, what did you mean by this? By using Linux sockets, I have transmitted the raw Ethernet frame. This is done as per the following link: http://aschauf.landshut.org/fh/linux/udp_vs_raw/ch01s03.html Can't I achieve the similar functionality here using eth_send and eth_receive functions? What I did my standalone application is: Created a unsigned char buffer with 60 elements and tried to send them by calling eth_send() like this: ethSendVar = eth_send (txFrame, 60); Is this the right way to do? When I did this the board was automatically resetting at the place where I called eth_send () in the code.

Ideally, existing commands would do what you need. For example, you could assemble file content in a standalone app invoked through command line, then transmit the file with existing command tftpboot. Or you could implement custom commands inside u-boot rather than standalone app; you could copy/paste from existing protocols' implementation.

This is actually of no interest for now. I should be able to send and receive from the application only.