UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor
Contributor
167 Views
Registered: ‎10-29-2018

( CAN in Zynq7000 using zc702 ) How to add and where should we copy the file xilinx_can.c ?

Jump to solution

Hallo Experts,

I am a newbie in embeededlinux. I try to make my first CAN project with CANPS using template znyq with zc702 Ev. Board .
I read this link https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842496/Linux+CAN+driver

I created project with vivado and petalinux 2017.4

I edit my system-user.dtsi data as mentioned in link but i get error by building the project. And i deleted it , so let it as default try to build again and it succed to build.
in my head
1. i am really confused is it correct, that i dont need to edit the dtsi data?
2. and i have a question about this xilinx_can.c
what is this file? how to use it  or add it to my petalinux project?

any suggestion? Special User Guide for linux driver ? so i can solve this problem or at least i know what should i do whit this xilinx_can.c file.

Best Regards.

0 Kudos
1 Solution

Accepted Solutions
Xilinx Employee
Xilinx Employee
116 Views
Registered: ‎07-12-2018

Re: ( CAN in Zynq7000 using zc702 ) How to add and where should we copy the file xilinx_can.c ?

Jump to solution

Hi @eyeray 

You can find more detailed info on zynq device tree customization below:

 

Configuring Devicetree
PetaLinux device tree configuration is associated with following config files that are located at <plnx-projroot>/components/plnx_workspace/device-tree-generation/ and <plnx-proj-root>/project-spec/meta-user/recipes-dt/device-tree/.
• pcw.dtsi
• plnx_aarch64-system.dts
• system.dts
• system-conf.dtsi

• system-top.dts

If you wish to add information, like the Ethernet PHY information, this should be included in the system-top.dts file. In this case, device tree should include the information relevant for your specific platform as information (here, Ethernet PHY information) is board level and board specific.
An example of a well-formed Device-tree node for the system-top.dts is below.
/dts-v1/;
/include/ "system-conf.dtsi"
/ {
};
&gem0 {
phy-handle = <&phy0>;
ps7_ethernet_0_mdio: mdio {
phy0: phy@7 {
compatible = "marvell,88e1116r";
device_type = "ethernet-phy";
reg = <7>;
};
};
};

 

You can add the custom dtsi files. All modified or new dtsi files should be placed in <plnx_proj_root>/project-spec/meta-user/recipes-dt/device-tree.

 

You can add your custom dtsi files. All modifications or new dtsi files should be placed in <plnx_proj_root>/project-spec/meta-user/recipes-dt/device-tree
The following example demonstrates adding sample-user-1.dtsi and
sample-user-2.dtsifile:
SRC_URI_append ="\
file://system-top.dts \
file://sample-user-1.dtsi \
file://sample-user-2.dtsi \
"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
do_compile_prepend () {
install -m 644 ${WORKDIR}/sample-user-1.dtsi ${dts_dir}/
install -m 644 ${WORKDIR}/sample-user-2.dtsi ${dts_dir}/
}
changes in system-top.dts
/dts-v1/;
/include/ "system-conf.dtsi"
/include/ "sample-user-1.dtsi.dtsi"
/include/ "sample-user-2.dtsi.dtsi"
It is not recommended to change anything in
<plnx-proj-root>/coponents/plnx_workspace/device-tree-generation/

 

All the changes have to be made in meta-user only. For example, if you want to change anything, you can do in meta-user by rewriting the entire node with your changes in meta-user layer.

Best Regards
Abhinay PS
------------------------------------------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give kudos to a post which you think is helpful and reply oriented.
-------------------------------------------------------------------------------------------------------------------------------

2 Replies
Xilinx Employee
Xilinx Employee
117 Views
Registered: ‎07-12-2018

Re: ( CAN in Zynq7000 using zc702 ) How to add and where should we copy the file xilinx_can.c ?

Jump to solution

Hi @eyeray 

You can find more detailed info on zynq device tree customization below:

 

Configuring Devicetree
PetaLinux device tree configuration is associated with following config files that are located at <plnx-projroot>/components/plnx_workspace/device-tree-generation/ and <plnx-proj-root>/project-spec/meta-user/recipes-dt/device-tree/.
• pcw.dtsi
• plnx_aarch64-system.dts
• system.dts
• system-conf.dtsi

• system-top.dts

If you wish to add information, like the Ethernet PHY information, this should be included in the system-top.dts file. In this case, device tree should include the information relevant for your specific platform as information (here, Ethernet PHY information) is board level and board specific.
An example of a well-formed Device-tree node for the system-top.dts is below.
/dts-v1/;
/include/ "system-conf.dtsi"
/ {
};
&gem0 {
phy-handle = <&phy0>;
ps7_ethernet_0_mdio: mdio {
phy0: phy@7 {
compatible = "marvell,88e1116r";
device_type = "ethernet-phy";
reg = <7>;
};
};
};

 

You can add the custom dtsi files. All modified or new dtsi files should be placed in <plnx_proj_root>/project-spec/meta-user/recipes-dt/device-tree.

 

You can add your custom dtsi files. All modifications or new dtsi files should be placed in <plnx_proj_root>/project-spec/meta-user/recipes-dt/device-tree
The following example demonstrates adding sample-user-1.dtsi and
sample-user-2.dtsifile:
SRC_URI_append ="\
file://system-top.dts \
file://sample-user-1.dtsi \
file://sample-user-2.dtsi \
"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
do_compile_prepend () {
install -m 644 ${WORKDIR}/sample-user-1.dtsi ${dts_dir}/
install -m 644 ${WORKDIR}/sample-user-2.dtsi ${dts_dir}/
}
changes in system-top.dts
/dts-v1/;
/include/ "system-conf.dtsi"
/include/ "sample-user-1.dtsi.dtsi"
/include/ "sample-user-2.dtsi.dtsi"
It is not recommended to change anything in
<plnx-proj-root>/coponents/plnx_workspace/device-tree-generation/

 

All the changes have to be made in meta-user only. For example, if you want to change anything, you can do in meta-user by rewriting the entire node with your changes in meta-user layer.

Best Regards
Abhinay PS
------------------------------------------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give kudos to a post which you think is helpful and reply oriented.
-------------------------------------------------------------------------------------------------------------------------------

Contributor
Contributor
86 Views
Registered: ‎10-29-2018

Re: ( CAN in Zynq7000 using zc702 ) How to add and where should we copy the file xilinx_can.c ?

Jump to solution

Hallo @abhinayp

Thank for replying me,

I try to understand your answer and explain what i understan about petalinux 2017.4.

please correct me if false.

1. In Petalinux 2017.4 there is no file <plnx-proj-root>/project-spec/meta-user/recipes-dt/device-tree/ , so thats mean i cant find the system-top.dts, that man can edit. But in petalinux 2017.4 there is a file <plnx-proj-root>/project-spec/meta-user/recipes-bsp/device-tree/system-user.dtsi. its mean system-user.dtsi in petalinux 2017.4 is like system-top.dts in petalinux 2016.4, rite?


2.in Petalinux 2017.4 every file in <plnx-projroot>/components/plnx_workspace/device-tree-generation/  are automatically generated by Xilinx or Petalinux SDK, as you mentioned its not recommended to do anything in this file, let it as default (No Editting). In this file i never change the "code".


3. in Petalinux 2017.4. i only find the system.top.dts in <plnx-projroot>/components/plnx_workspace/device-tree-generation/ , but this file is automatically generated by Xilinx. but its not recomended to edit this file.

4.My Conclusion is we can only edit the device-tree node for  Petalinux 2017.4 only in <plnx-proj-root>/project-spec/meta-user/recipes-bsp/device-tre using system-user.dtsi.

is it correct?
If it is correct

5. i try to add some sample device-tree "code" for CANPS from this link https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842496/Linux+CAN+driver but by building the project there is an ERROR. but if i let it blank or default no editting code  or even no code its succed to build the project.
 
I am still confuse how to solve this problem.
are there differences code between device tree in petalinux 2017.4 ( <plnx-proj-root>/project-spec/meta-user/recipes-bsp/device-tree/system-user.dtsi) and petalinux 2016.4 (e <plnx-proj-root>/project-spec/meta-user/recipes-dt/device-tree/system-top.dts).

Or there is something to do with CANUtils and the file xilinx_can.c?
In this Link mentioned CANUtils  cross compiled and xilinx_can.c file .
https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842496/Linux+CAN+driver
But i dont have any idea what i should do with them.

Any Suggestion?

Best Regards.

0 Kudos