[U-Boot] Can a standalone application send data via Ethernet in U-Boot?

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.
-- View this message in context: http://u-boot.10912.n7.nabble.com/Can-a-standalone-application-send-data-via... Sent from the U-Boot mailing list archive at Nabble.com.

Dear rvijay435,
it would be nice if you would disclose your real name...
In message 1382067543913-165775.post@n7.nabble.com you wrote:
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.
U-Boot is just a boot loader, it is not an OS. U-Boot has just a very promitive network stack, it doesn not provide full-blown TCP/IP services. All we can do is a little UDP...
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.
You cannot use the network at all in standalone applications (unless you implement your own network driver and network stack). The network functions are not part of the exported interface. This is intentional.
Note that you also cannot use sockets or similar in U-Boot, as we don't have a full TCP/IP implementation. All we have is a bit of UDP.
Best regards,
Wolfgang Denk

Dear Wolfgang,
it would be nice if you would disclose your real name...
Vijay Kishore.
Thanks for your reply. So, now I will start modifying the registers related to Ethernet and try to send the data over Ethernet.
-- View this message in context: http://u-boot.10912.n7.nabble.com/Can-a-standalone-application-send-data-via... Sent from the U-Boot mailing list archive at Nabble.com.

Dear Wolfgang, Can I use tsec_miiphy_write () function which is defined in drivers/net/tsec.c for sending the data from standalone application via Ethernet. I am trying to export this function and use it. The files I edited for exporting are: "include/exports.h", "include/_exports.h", "common/exports.c". At jumptable_init () function in common/exports.c, I am giving the following line: gd->jt[XF_tsec_miiphy_write] = tsec_miiphy_write.
But the *error* I am getting is:
common/libcommon.a(exports.o):(.got2+0x0): undefined reference to 'tsec_miiphy_write'.
Note: Is this error coming because the function is static?
If so, how to export and use them in standalone application of U-Boot?
-- View this message in context: http://u-boot.10912.n7.nabble.com/Can-a-standalone-application-send-data-via... Sent from the U-Boot mailing list archive at Nabble.com.

Dear rvijay435,
In message 1382594959198-166076.post@n7.nabble.com you wrote:
Can I use tsec_miiphy_write () function which is defined in drivers/net/tsec.c for sending the data from standalone application via
You can use everything you like, if you accept the resuting consequences on the license terms of your code.
Ethernet. I am trying to export this function and use it. The files I edited for exporting are: "include/exports.h", "include/_exports.h", "common/exports.c". At jumptable_init () function in common/exports.c, I am giving the following line: gd->jt[XF_tsec_miiphy_write] = tsec_miiphy_write.
Hm... I'm notr sure what exactly you are trying to do here - I cannot find the string "tsec_miiphy_write" anywhere in the U-Boot source code.
In any case: by doing something like this, you accept that your standalone application is GPLed, so I wonder why you use a SA app in the first place instead of just linking your code with U-Boot?
But the *error* I am getting is:
common/libcommon.a(exports.o):(.got2+0x0): undefined reference to 'tsec_miiphy_write'.
Note: Is this error coming because the function is static?
I can't see how you come to that conclusing - for me, it just does not exist at all.
If so, how to export and use them in standalone application of U-Boot?
Simply: You don't. If you need networking, stay within U-Boot context. Or boot an OS.
Best regards,
Wolfgang Denk

Hm... I'm notr sure what exactly you are trying to do here - I cannot find the string "tsec_miiphy_write" anywhere in the U-Boot source code.
Hi Wolfgang, tsec_miiphy_write function is present in drivers/net/tsec.c of the U-Boot-201009 version which I downloaded.
The flow of calls is: tsec_initialize () which is in drivers/net/tsec.c calls miiphy_register as:
#if defined (CONFIG_MII) || defined (CONFIG_CMD_MII) \ && !defined (BITBANGMII) miiphy_register (dev->name, tsec_miiphy_read, tsec_miiphy_write) #endif
The third argument is actually a function pointer which calls tsec_miiphy_write function.
If you need networking, stay within U-Boot context. Or boot an OS.
Booting an OS is not possible as per the client requirement. What does this sentence means, 'Stay within U-Boot'? After tftp'ing the application image, we will use go command to a particular address to execute the application. We can't be back into U-Boot, once we start running the application. Is my understanding correct?
Please help me to get the networking concepts done in application, by which I can send and receive the data.
-- View this message in context: http://u-boot.10912.n7.nabble.com/Can-a-standalone-application-send-data-via... Sent from the U-Boot mailing list archive at Nabble.com.

Dear rvijay435,
In message 1385728248832-168658.post@n7.nabble.com you wrote:
Hm... I'm notr sure what exactly you are trying to do here - I cannot find the string "tsec_miiphy_write" anywhere in the U-Boot source code.
Hi Wolfgang, tsec_miiphy_write function is present in drivers/net/tsec.c of the U-Boot-201009 version which I downloaded.
I have no idea what you are talking about.
U-Boot-201009 is not an official version, nor is there any such file on the FTP server.
Assuming you mean trhe releas tag "v2010.09" ...
...then this code is > 3 years old, so it is hopelessly obsolete and not worth any discussion.
Booting an OS is not possible as per the client requirement. What does this sentence means, 'Stay within U-Boot'? After tftp'ing the application image, we will use go command to a particular address to execute the application.
Stay within U-Boot means to compile and link your code to be part of the U-Boot binary, instead of an external standalone application. Asintegral part of U-Boot you have access to all capabilities of U-Boot. As a standalone app, you are limited to the exported interface.
Please help me to get the networking concepts done in application, by which I can send and receive the data.
You are not supposed to do network stuff in standalone code. We do not export the interfaces to do that. If you need networking, then either compile your code into U-Boot, or write your own network drivers.
Best regards,
Wolfgang Denk
participants (2)
-
rvijay435
-
Wolfgang Denk