cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
justinlh
Explorer
Explorer
5,374 Views
Registered: ‎02-18-2014

SD card device driver

Jump to solution

Im using the Zynq zc702 boards, and i am running petalinux.

 

Maybe this is a simple question, that i just havn't been able to figure out just yet.

 

Im trying to write some code to read files from the sd card mounted on the board after bootup. The forum post here refered to a few things that i didn't quite understand but didn't feel related to the issue im having. I believe the device driver that the sd card is using is "/dev/mmcblk0p1" but that being said what is a good way to open it and have the abilities to read files and save them into on board flash?

 

I've spent most the day looking for documentation or uses to get some idea how to work with 'mmcblk0p1' but was coming up empty handed. Could someone reference me to some resources to find the answers to this?

 

Thanks!

 

 

0 Kudos
1 Solution

Accepted Solutions
chandan_e
Observer
Observer
6,838 Views
Registered: ‎11-06-2013

I came across a "flashcp" command in one of the TRD packages a few months ago that will allow you to copy to the on-board flash once you have linux up and running. I looked for it just now, but couldn't find it. You could probably do what you want with a shell script that uses "mount" and "flashcp" instead of writing a program from scratch.

 

You can probably do the same using the "sf" command in u-boot, but I haven't tried it myself.

 

Maybe one of the Xilinx engineers on the forum could tell us where to find flashcp.

View solution in original post

5 Replies
chandan_e
Observer
Observer
5,366 Views
Registered: ‎11-06-2013

Have you tried the following?

 

mkdir /mnt/mysdcard
mount /dev/mmcblk0p1 /mnt/mysdcard
cd /mnt/mysdcard
ls

At this point you should be able see the files on the card which means you can use fopen() from your program to read any file. I haven't worked with Petalinux, but quite a bit with Android on the ZC702 and ZC706 and since the underlying OS is the same, this should work.

umamahe
Xilinx Employee
Xilinx Employee
5,352 Views
Registered: ‎08-01-2012
Check the following AR http://www.xilinx.com/support/answers/55777.htm . It can help for your requirement
________________________________________________

Please mark this post as an "Accept as solution" in case if it helped to resolve your query. So that it will help to other forum users to directly refer to the answer.

Give kudos to this post in case if you think the information is useful and reply oriented.

0 Kudos
justinlh
Explorer
Explorer
5,340 Views
Registered: ‎02-18-2014

This does exactly what i want it to from the console but is there a way to not do anything from the console but all from a application program in c++? Is there a way to mount it in that environement? Then copy over individual files?

 

Thanks for the response.

0 Kudos
justinlh
Explorer
Explorer
5,339 Views
Registered: ‎02-18-2014

@umamahe 

 

Thanks for the post about booting, that however is not the problem that i am running into. I currently already boot from the sd card but want to create the functionality in my software to copy files from the sd card and place them on the flash on the board.

 

An idea that I am currently working with is by trying to use mmap to copy over the files from /mmcblkop1 to a physical address in flash. There are a few bumps in the road with this method so i was hoping there was an easier way to go about it.

0 Kudos
chandan_e
Observer
Observer
6,839 Views
Registered: ‎11-06-2013

I came across a "flashcp" command in one of the TRD packages a few months ago that will allow you to copy to the on-board flash once you have linux up and running. I looked for it just now, but couldn't find it. You could probably do what you want with a shell script that uses "mount" and "flashcp" instead of writing a program from scratch.

 

You can probably do the same using the "sf" command in u-boot, but I haven't tried it myself.

 

Maybe one of the Xilinx engineers on the forum could tell us where to find flashcp.

View solution in original post