cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Participant
Participant
9,525 Views
Registered: ‎10-23-2013

How to use the SD Card as a device to store any files?

Jump to solution

Hi,

 

I'm working on the Zynq-7000 All Programmable SoC Video and Imaging Kit.

 

There is a demo of zvik_camera that shows how to use the console mode and Web-baded GUI to record a frame of video image. Since I need to implement the the AVS video coding/decoding compression, how could I use the SD Card as a device to store any files like bitstreams? Thank you. 

1 Solution

Accepted Solutions
Highlighted
Teacher
Teacher
12,273 Views
Registered: ‎03-31-2012

Re: How to use the SD Card as a device to store any files?

Jump to solution

Actually he gave a pretty good starting point. If you can boot linux and read files from SD card, you are almost there. The rest is getting the data to the PL. You have two options both of which involve some AXI work. You can develop an AXI slave in PL which basically maps some BRAM to AXI and you can let PS write the image data to this AXI slave. Or you can write an AXI master which can read the image data from the DDR where the PS stores it. This way PL never needs to know the details of SD card access.

- 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.

View solution in original post

8 Replies
Highlighted
Teacher
Teacher
9,521 Views
Registered: ‎03-31-2012

Re: How to use the SD Card as a device to store any files?

Jump to solution
I am pretty sure the SD card slot is fully supported by linux on Zynq. You can write a small program to read the contents of the SD memory, write it to dram and let PL use it from there.
In terms of booting from it, your board should already support it. Copy the right bitstream on it, flip a few switches on the board, power on and watch it fly.
- 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.
0 Kudos
Highlighted
Participant
Participant
9,517 Views
Registered: ‎10-23-2013

Re: How to use the SD Card as a device to store any files?

Jump to solution

muzaffer,

 

Thanks for your reply.

 

However, I wonder whether I could use SD card to store files while boot load the linux system from it?

 

I'm a newbie. Is there any specific references of how to read the contents of the SD memory and write them to dram? Thank you!

0 Kudos
Highlighted
Teacher
Teacher
9,502 Views
Registered: ‎03-31-2012

Re: How to use the SD Card as a device to store any files?

Jump to solution
After your linux system boots, mount the sd card (if not already mounted) which gives you file system access on it. If you put the files on it properly, you should be just open the files and read them.
To copy them to dram, first you allocate some memory and then write what you read from the file into the allocated addresses.
These have nothing to do with fpgas but straight (l)unix programming. Are you a newbie to that too?
- 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.
0 Kudos
Highlighted
Participant
Participant
9,498 Views
Registered: ‎10-23-2013

Re: How to use the SD Card as a device to store any files?

Jump to solution

Yes, would you please specify the details?

0 Kudos
Highlighted
Anonymous
Not applicable
9,437 Views

Re: How to use the SD Card as a device to store any files?

Jump to solution
Below is details on how to set up the linux system, and how to mount the SD card and to use an image that is on the SD card to program the PL.
 
Firstly, you can create a hardware system in XPS (using the BSB with two gpio's in the PL see ug873 below) then export to SDK and create the BOOT.bin image. You can use the bootgen tool in SDK to create this. Follow the steps on page 52:53
http://www.xilinx.com/support/documentation/sw_manuals/xilinx14_7/ug873-zynq-ctt.pdf
 
You can download the Zynq Release files (devicetree.dtb, uImage and uramdisk.image.gz) needed here from the Wiki:
http://www.wiki.xilinx.com/Zynq+Releases
 
You can use the promgen to create the pl bin file. See AR46913:
http://www.xilinx.com/support/answers/46913.htm
 
Now that you have the BOOT.bin, system.bin the devicetree.dtb, uImage, and the uramdisk.image.gz files all on the SD card, you can insert the SD card into the ZC702 board. You can use the serial port (baud rate 115200). Make sure that the MIO pins are set to boot from the SD card see the ug873 above for help here. You should see the linux boot.
 
use the root for login, and password.
 
Now you want to mount the SD card, use the command ls /dev to see all the devices. The SD card should be mmcblkp01.
 
To mount this, use the command:
mount /dev/mmcblkp01 /mnt
 
Now to see all the files on your sd card, use the command ls /mnt. you should see all the files on your SD card.
 
One typical use case would be to program the PL with the bin file in your SD card. This can be done using the command below:
cat /mnt/<PL_IMAGE>.bin &gt; /dev/xdevcfg
&nbsp;
Hope this helps</PL_IMAGE>
Highlighted
Participant
Participant
9,387 Views
Registered: ‎10-23-2013

Re: How to use the SD Card as a device to store any files?

Jump to solution

Hi Stephenm,

 

Thanks for your detailed reply.

 

However, maybe you did not get the idea of what I want to know.

 

I have some pictures stored in the sd card, and I wonder how to read the pictures in the sd card through PL and do image processing like edge detection or segmentation for the pictures.

 

Could you give me some advice? Thank you!

0 Kudos
Highlighted
Teacher
Teacher
12,274 Views
Registered: ‎03-31-2012

Re: How to use the SD Card as a device to store any files?

Jump to solution

Actually he gave a pretty good starting point. If you can boot linux and read files from SD card, you are almost there. The rest is getting the data to the PL. You have two options both of which involve some AXI work. You can develop an AXI slave in PL which basically maps some BRAM to AXI and you can let PS write the image data to this AXI slave. Or you can write an AXI master which can read the image data from the DDR where the PS stores it. This way PL never needs to know the details of SD card access.

- 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.

View solution in original post

Highlighted
662 Views
Registered: ‎12-04-2019

Re: How to use the SD Card as a device to store any files?

Jump to solution

can someone elobarate the two methods given in the solution?

I have a similar doubt where I have video file (say .mp4) instead of a picture

0 Kudos