I'm trying to get the DEMO_CN_CONSOLE to work on a Zybo with Linux installed on it. I can start the program, but it terminates with a bus error everytime. Here is what is displayed in the minicom when I try to get it running:
root@CONTROLLED_NODE:/# ./demo_cn_console
------------------------------------------------------
openPOWERLINK console CN DEMO application
using openPOWERLINK Stack: V2.1.2
------------------------------------------------------
Initializing openPOWERLINK stack...
------------------------------------------------------
List of Ethernet cards found in this system:
------------------------------------------------------
1. eth0
2. Pseudo-device that captures on all interfaces
any
3. lo
------------------------------------------------------
Select the interface to be used for POWERLINK (1-3):1
------------------------------------------------------
device eth0 entered promiscuous mode
Initializing process image...
Size of input process image: 1
Size of output process image: 1
Linking process image vars:
Linking process vars... ok
device eth0 left promiscuous mode
Bus error
I cannot figure out why this occurs and where to search anymore. Can someone of you help me with this?
Last edit: Kevin Redeker 2015-11-23
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
can you tell us how is your application linked? To user space or to the kernel module?
Since it's an error about bus, is your Linux already patched using Preempt_RT?
Regards,
Jimmy
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm not 100% sure if I would answer correctly, so I'm just going to tell you, that the CFG_BUILD_KERNEL_STACK has the value "Link to Application" and think, that will answer your question properly ;). The Linux we're using is not patched yet, since we just wanted to get it to link properly with the demo application before optimizing the performance.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think you can give a try to "Link to Kernel module". Run the application after you install the kernel module, although I am not sure what‘s the difference between Link to Application/User space daemon/kernel module.
Let me know if you make it! Best luck!
Last edit: Jimmy 2015-11-21
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've tried that too in the mean time, though without any success. However, we have fixed an error that we found in the device tree and got an error which has to do with the Xilinx Ethernet Driver (xemacps), which led me to the assumption, that the Linux Edrv Kernel Driver is needed after all (I was under the assumption, that I don't need it, since I was trying to work with the single process solution). At this point however I have encountered new obstacles. After configuring the driver via the cmake-gui, I get the following error message when I try to execute make:
I assume that you use the same set of toolchain and Linux as mentioned in the post in the above link. If there is any difference please lets us know your development environment configurations.
Regards,
POWERLINK Team,
Kalycito
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
thank you for the reply. Unfortunately I have already read the post above and the POWERLINK documentation beforehand and it did not solve the problem. For context: I am in fact using the same toolchain (albeit the newer version of Vivado --> 15.2) and the petalinux toolchain with the respective compiler. After trial and error me and my colleague here got a kernel to run on the zybo with only minor issues remaining, which we can exclude from having influence on the desired application. The problem here was, that Vivado cannot (currently) generate a correct device tree automatically, but we fixed this manually. So far, so good. (By the way, Jimmy and I are basically working on the same problem, as we are project partners at different institutions).
The main issue remaining now for me is, that I cannot build the edrv kernel driver correctly. The output generated in my opening post resulted with the single process solution, which I thought was the only one available to me. I was mislead by the description on http://openpowerlink.sourceforge.net/doc/2.2/2.2.1/df/d06/page_platform_linux.html, thinking I couldn't use any other version, because the network controller built into the zybo (RTL8211E) wasn't listed. I found out later here: http://openpowerlink.sourceforge.net/doc/2.2/2.2.1/dc/d8f/page_build_drivers.html#sect_build_drivers_build_linux_edrv under the options description, that there is support for the emacps driver. After correctly implementing the device tree, we got an error message before the application threw the bus error, saying that a specific hex code command was not implemented, pointing us to the assumption that we need the driver after all.
The main problem here seems to be that the kernel source code structure does not comply with what the driver to be built expects. So far, I've tried it in 2 different ways:
1. Select the appropriate kernel directory, which is the baseline for and contains all the files from the Vivado/Xilinx toolchain. Here I got an error, that there is no autoconf.h file, which is obvious in hindsight, as this directory is only the skeleton for new projects.
2. So I tried to select a configured kernel as the CFG_KERNEL_DIR and got the error message, which I displayed in my last post.
I have checked the directory and there seems to be a rather strange incompliance in the directory structure. The include directive (#include <asm bitsperlong.h="">), which produces the error, asks for a file which is there, but the folder is named differently ("asm-generic" instead of "asm"). Currently I try to resolve this by searching the internet for similar problems, but I am afraid that won't take me very far.
If you need additional information, please don't hesitate to ask me.
Regards,
Kevin Redeker
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It seems that there has been some configuration errors during the compilation of the Linux for the Zynq board.
Please share the following information:
* Which configuration file was used to configure the KConfig settings for the Linux kernel?
* Linux kernel version used?
I would also suggest that you contact Digilent and Xilinx for the queries related to petalinux compilation and configuration.
Regards,
POWERLINK Team,
Kalycito
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I attached the file, which was used for the configuration. The current kernel version we tried is 4.0.0
We also tried the kernel version 3.19, since that version was included in the toolchain. We probably still have a lot of unnecessary stuff in there, but as said in an earlier post, optimization is not the main focus at the moment.
I have tried an older kernel version (3.10) and here the driver can be compiled smoothly. It seems that there is an incompatibility with a macro defined in the newer kernel version, as I got the follwoing error message (this try was with the 3.19):
[ 3%] Generating oplkemacpsmn.ko
/home/Z1060-5/Project/KernelDriverTest/src/veth-linuxkernel.c: In function 'veth_addInstance':
/home/Z1060-5/Project/KernelDriverTest/src/veth-linuxkernel.c:153:48: error: macro "alloc_netdev" requires 4 arguments, but only 3 given
ether_setup);
^
/home/Z1060-5/Project/KernelDriverTest/src/veth-linuxkernel.c:152:24: error: 'alloc_netdev' undeclared (first use in this function)
pVEthNetDevice_g = alloc_netdev(sizeof(struct net_device_stats), PLK_VETH_NAME,
^
/home/Z1060-5/Project/KernelDriverTest/src/veth-linuxkernel.c:152:24: note: each undeclared identifier is reported only once for each function it appears in
gmake[6]: *** [/home/Z1060-5/Project/KernelDriverTest/src/veth-linuxkernel.o] Error 1
gmake[5]: *** [_module_/home/Z1060-5/Project/KernelDriverTest] Error 2
gmake[4]: *** [sub-make] Error 2
gmake[3]: *** [__sub-make] Error 2
make[2]: *** [oplkemacpsmn.ko] Error 2
make[1]: *** [CMakeFiles/oplkemacpsmn.dir/all] Error 2
make: *** [all] Error 2
I don't know exactly up to which version this works, would be nice if someone has additional information on this, or maybe even a patch to get this to work with newer kernel versions.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the newer kernel alloc_netdev macro takes total of 4 arguments, the latest one being name_assign_type.
Can you please try changing the the line alloc_netdev(sizeof(struct net_device_stats), PLK_VETH_NAME, ether_setup); to alloc_netdev(sizeof(struct net_device_stats), PLK_VETH_NAME, NET_NAME_UNKNOWN or NET_NAME_ENUM, ether_setup);
Regards,
Powerlink team
Kalycito
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
thank you for the information. I have stumbled over the fix in the meantime. The kernel and the application now run, but there is still one issue. We have set the local MAC adress in the device tree, but it does not get passed over to the application. There it only says, that the local MAC adress is 0x00 0x00 0x00 0x00 0x00 0x00.
Just to clarify, here is the console output, for when I start the application:
root@CONTROLLED_NODE:/bin# insmod oplkemacpscn.ko
PLK: powerlinkInit() Driver build: Nov 25 2015 / 15:13:16
PLK: powerlinkInit() Stack version: V2.2.2
Allocated major number: 246
root@CONTROLLED_NODE:/bin# CN-Demo_K
----------------------------------------------------
openPOWERLINPLK: + powerlinkOpen...
K console CN DEMO application
PLK: + powerlinkOpen - OK: 2.2.2
----------------------------------------------------
Initializhrestimer_init: IoAddr=60892000
ing openPOWERLINK stack...
hrestimer_init: interrupt0 registered (return=0)
hrestimer_init: interrupt1 registered (return=0)
(edrv_init) Registering the driver to the kernel...(initOnePlatformDev) IOMEM Resource initialization...Done
(initOnePlatformDev) IRQ Resource initialization...Done
MEM_RESOURCE: Start 0x(E000B000), End 0x(E000BFFF)
Requesting IRQ resource ...Done
Allocation of Tx Buffers ...Done
Allocation of Tx Desc ...Done
Allocation of Rx Desc ...Done
Allocation of Rx Buffers ...Done
initOnePlatformDev finished with 0
Done
Local MAC = 0x00 0x00 0x00 0x00 0x00 0x00
Initializing process image...
Size of input process image: 1
Size of output process image: 1
Linking process image vars:
Linking process vars... ok
start POWERLINK Stack... ok
Digital I/O interface with openPOWERLINK is ready!
-------------------------------
Press Esc to leave the programm
Press r to reset the node
Press i to increase digital input
Press d to decrease digital input
Press p to print digital outputs
-------------------------------
Synchronous data thread is starting...
1970/01/01 00:00:21 - StateChangeEvent(0x19) originating event = 0x10 (NmtEventSwReset)
1970/01/01 00:00:21 - StateChangeEvent(0x29) originating event = 0x20 (NmtEventEnterResetApp)
1970/01/01 00:00:21 - StateChangeEvent(0x39) originating event = 0x21 (NmtEventEnterResetCom)
powerlinkMmap() vma: vm_start:36FEA000 vm_end:36FEB000 vm_pgoff:0
powerlinkVmaOpen() vma: vm_start:36FEA000 vm_end:36FEB000 vm_pgoff:0
1970/01/01 00:00:21 - StateChangeEvent(0x79) originating event = 0x23 (NmtEventEnterResetConfig)
1970/01/01 00:00:21 - StateChangeEvent(0x11C) originating event = 0x24 (NmtEventEnterCsNotActive)
1970/01/01 00:00:26 - StateChangeEvent(0x11E) originating event = 0x26 (NmtEventTimerBasicEthernet)
^[Stack is in state off ... Shutdown
powerlinkVmaClose() vma: vm_start:36FEA000 vm_end:36FEB000 vm_pgoff:0
edrv_exit calling platform_driver_unregister()
PLK: + powerlinkRelease...
PLK: + powerlinkRelease - OK
Another issue, that I couldn't get behind, up until now is, that I cannot restart the application after shutting it down for the first time. I suspect, that these two issues are entangled somehow, but if someone could help me out here, that would be much appreciated. The console output for the latter case is:
root@CONTROLLED_NODE:/bin# CN-Demo_K
----------------------------------------------------
openPOWERLINK console CN DEMO application
using openPOWERLINK Stack: 2.2.2
----------------------------------------------------
Initializing openPOWERLINK stack...
oplk_init() failed with "Resource could not be created (Windows, PxROS, ...)" (0x0008)
Stack is in state off ... Shutdown
Last edit: Kevin Redeker 2015-12-07
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The MAC address displayed Local MAC = 0x00 0x00 0x00 0x00 0x00 0x00
is read from the "Specific Address Register 1", i.e. spec_addr1_bot & spec_addr1_top during the device initialization.
As specified in the post ZC702 MAC issue and Permanent MAC address assignment, the U-Boot is responsible to configure the MAC address using the information in device tree. Can you please check if all the requirement for correct MAC address assignements are fulfilled in your device tree and Linux?
Alternatively, you can set the MAC address to be used with openPOWERLINK in the demo application using the variable aMacAddr_l in the main.c.
The second issue you are facing is because the device node created for the openPOWERLINK driver is deleted by the Linux during the stack shutdown which the application cannot find during the subsequent run. This is caused due to issues with the udev in Linux for Zynq platform.
Regards,
POWERLINK Team,
Kalycito
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the meantime, we have setup the U-Boot in such a manner, that it retrieves the onboard MAC from an EEPROM and pass it to the system. Additionally the application starts and runs (seemingly) correctly including the possibility to give keyboard inputs and terminating the program with the ESC button (save for the ability to start the application without reloading the module first). However, there is no connection with the network at all. We used Wireshark to examine the network activity, where only one MN (desktop PC with Linux) and one CN (Linux on Zynq) is running. Since there are no error messages thrown (even with all debug messages turned on) we don't really know how to proceed from here. We suspect, that there might be an incompatibility with the network chip since it is connected to a MDIO Bus Interface and we are not sure if this is foreseen in the EDRV.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
do you mean in the GUI of Wireshark? Anyway I did not unselect the TCP/IP anywhere. We did however also test the (for us only functioning) connection of the Powerlink demo applications between two desktop PCs, which delivered the expected result of SoC, SoA, PRes and Preq Frames being sent over the Network.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello everybody,
I'm trying to get the DEMO_CN_CONSOLE to work on a Zybo with Linux installed on it. I can start the program, but it terminates with a bus error everytime. Here is what is displayed in the minicom when I try to get it running:
I cannot figure out why this occurs and where to search anymore. Can someone of you help me with this?
Last edit: Kevin Redeker 2015-11-23
Hey Kevin,
can you tell us how is your application linked? To user space or to the kernel module?
Since it's an error about bus, is your Linux already patched using Preempt_RT?
Regards,
Jimmy
Hi Jimmy,
I'm not 100% sure if I would answer correctly, so I'm just going to tell you, that the CFG_BUILD_KERNEL_STACK has the value "Link to Application" and think, that will answer your question properly ;). The Linux we're using is not patched yet, since we just wanted to get it to link properly with the demo application before optimizing the performance.
Hey Kevin,
I think you can give a try to "Link to Kernel module". Run the application after you install the kernel module, although I am not sure what‘s the difference between Link to Application/User space daemon/kernel module.
Let me know if you make it! Best luck!
Last edit: Jimmy 2015-11-21
Hey Jimmy,
I've tried that too in the mean time, though without any success. However, we have fixed an error that we found in the device tree and got an error which has to do with the Xilinx Ethernet Driver (xemacps), which led me to the assumption, that the Linux Edrv Kernel Driver is needed after all (I was under the assumption, that I don't need it, since I was trying to work with the single process solution). At this point however I have encountered new obstacles. After configuring the driver via the cmake-gui, I get the following error message when I try to execute make:
Can somebody explain me what I'm missing? If you need additional information about my settings, please tell me, so I can help you help me :)
Last edit: Kevin Redeker 2015-11-23
Hello Kevin,
Can you please have a look into the following post and see if it helps to solve the compilation issues?
https://sourceforge.net/p/openpowerlink/discussion/newbie/thread/c7d189a4/#81e6/c4a8
I assume that you use the same set of toolchain and Linux as mentioned in the post in the above link. If there is any difference please lets us know your development environment configurations.
Regards,
POWERLINK Team,
Kalycito
Hello Kalycito,
thank you for the reply. Unfortunately I have already read the post above and the POWERLINK documentation beforehand and it did not solve the problem. For context: I am in fact using the same toolchain (albeit the newer version of Vivado --> 15.2) and the petalinux toolchain with the respective compiler. After trial and error me and my colleague here got a kernel to run on the zybo with only minor issues remaining, which we can exclude from having influence on the desired application. The problem here was, that Vivado cannot (currently) generate a correct device tree automatically, but we fixed this manually. So far, so good. (By the way, Jimmy and I are basically working on the same problem, as we are project partners at different institutions).
The main issue remaining now for me is, that I cannot build the edrv kernel driver correctly. The output generated in my opening post resulted with the single process solution, which I thought was the only one available to me. I was mislead by the description on http://openpowerlink.sourceforge.net/doc/2.2/2.2.1/df/d06/page_platform_linux.html, thinking I couldn't use any other version, because the network controller built into the zybo (RTL8211E) wasn't listed. I found out later here: http://openpowerlink.sourceforge.net/doc/2.2/2.2.1/dc/d8f/page_build_drivers.html#sect_build_drivers_build_linux_edrv under the options description, that there is support for the emacps driver. After correctly implementing the device tree, we got an error message before the application threw the bus error, saying that a specific hex code command was not implemented, pointing us to the assumption that we need the driver after all.
The main problem here seems to be that the kernel source code structure does not comply with what the driver to be built expects. So far, I've tried it in 2 different ways:
1. Select the appropriate kernel directory, which is the baseline for and contains all the files from the Vivado/Xilinx toolchain. Here I got an error, that there is no autoconf.h file, which is obvious in hindsight, as this directory is only the skeleton for new projects.
2. So I tried to select a configured kernel as the CFG_KERNEL_DIR and got the error message, which I displayed in my last post.
I have checked the directory and there seems to be a rather strange incompliance in the directory structure. The include directive (#include <asm bitsperlong.h="">), which produces the error, asks for a file which is there, but the folder is named differently ("asm-generic" instead of "asm"). Currently I try to resolve this by searching the internet for similar problems, but I am afraid that won't take me very far.
If you need additional information, please don't hesitate to ask me.
Regards,
Kevin Redeker
Hello Kevin,
Thanks for the details.
It seems that there has been some configuration errors during the compilation of the Linux for the Zynq board.
Please share the following information:
* Which configuration file was used to configure the KConfig settings for the Linux kernel?
* Linux kernel version used?
I would also suggest that you contact Digilent and Xilinx for the queries related to petalinux compilation and configuration.
Regards,
POWERLINK Team,
Kalycito
Hi,
I attached the file, which was used for the configuration. The current kernel version we tried is 4.0.0
We also tried the kernel version 3.19, since that version was included in the toolchain. We probably still have a lot of unnecessary stuff in there, but as said in an earlier post, optimization is not the main focus at the moment.
Last edit: Kevin Redeker 2015-11-24
Hi everybody,
I have tried an older kernel version (3.10) and here the driver can be compiled smoothly. It seems that there is an incompatibility with a macro defined in the newer kernel version, as I got the follwoing error message (this try was with the 3.19):
I don't know exactly up to which version this works, would be nice if someone has additional information on this, or maybe even a patch to get this to work with newer kernel versions.
Hi Kevin,
In the newer kernel
alloc_netdev
macro takes total of 4 arguments, the latest one beingname_assign_type
.Can you please try changing the the line
alloc_netdev(sizeof(struct net_device_stats), PLK_VETH_NAME, ether_setup);
toalloc_netdev(sizeof(struct net_device_stats), PLK_VETH_NAME, NET_NAME_UNKNOWN or NET_NAME_ENUM, ether_setup);
Regards,
Powerlink team
Kalycito
Hi,
thank you for the information. I have stumbled over the fix in the meantime. The kernel and the application now run, but there is still one issue. We have set the local MAC adress in the device tree, but it does not get passed over to the application. There it only says, that the local MAC adress is 0x00 0x00 0x00 0x00 0x00 0x00.
Just to clarify, here is the console output, for when I start the application:
Another issue, that I couldn't get behind, up until now is, that I cannot restart the application after shutting it down for the first time. I suspect, that these two issues are entangled somehow, but if someone could help me out here, that would be much appreciated. The console output for the latter case is:
Last edit: Kevin Redeker 2015-12-07
Hello Kevin,
The MAC address displayed
Local MAC = 0x00 0x00 0x00 0x00 0x00 0x00
is read from the "Specific Address Register 1", i.e.
spec_addr1_bot
&spec_addr1_top
during the device initialization.As specified in the post ZC702 MAC issue and Permanent MAC address assignment, the U-Boot is responsible to configure the MAC address using the information in device tree. Can you please check if all the requirement for correct MAC address assignements are fulfilled in your device tree and Linux?
Alternatively, you can set the MAC address to be used with openPOWERLINK in the demo application using the variable
aMacAddr_l
in the main.c.The second issue you are facing is because the device node created for the openPOWERLINK driver is deleted by the Linux during the stack shutdown which the application cannot find during the subsequent run. This is caused due to issues with the udev in Linux for Zynq platform.
Regards,
POWERLINK Team,
Kalycito
In the meantime, we have setup the U-Boot in such a manner, that it retrieves the onboard MAC from an EEPROM and pass it to the system. Additionally the application starts and runs (seemingly) correctly including the possibility to give keyboard inputs and terminating the program with the ESC button (save for the ability to start the application without reloading the module first). However, there is no connection with the network at all. We used Wireshark to examine the network activity, where only one MN (desktop PC with Linux) and one CN (Linux on Zynq) is running. Since there are no error messages thrown (even with all debug messages turned on) we don't really know how to proceed from here. We suspect, that there might be an incompatibility with the network chip since it is connected to a MDIO Bus Interface and we are not sure if this is foreseen in the EDRV.
Hey Kevin,
Glad to hear it. Did you unselect the TCP/IP protocol? It could be noisy even if you disconnect the network.
Regards,
Jimmy
Hi Jimmy,
do you mean in the GUI of Wireshark? Anyway I did not unselect the TCP/IP anywhere. We did however also test the (for us only functioning) connection of the Powerlink demo applications between two desktop PCs, which delivered the expected result of SoC, SoA, PRes and Preq Frames being sent over the Network.