Raspberry Pi SD card support

Andre Marques andre.lousa.marques at gmail.com
Thu Apr 10 23:11:40 UTC 2014


On 04/04/14 20:19, Joel Sherrill wrote:
> On 4/4/2014 1:15 PM, Gedare Bloom wrote:
>> The license looked fine to me.
> +1
>
> As always, we just need to be careful on a file per file basis just in case
> something else in rpi-boot has a different license.

All files in rpi-boot use a similar licence, so I will be using some 
code from rpi-boot as a base for this.

>> On Thu, Apr 3, 2014 at 10:06 PM, Alan Cudmore <alan.cudmore at gmail.com> wrote:
>>>  From my limited research, it looks like the emmc controller in the Raspberry
>>> Pi BCM2835 may be the way to go.
>>> It looks like it is a high level controller for the SD/MMC card slot on the
>>> Pi.
>>>
>>> Since this is a custom controller, I don't think there would be an existing
>>> driver in RTEMS.
>>>
>>> It seems that this emmc controller in the Pi may handle different types of
>>> cards, and at a higher level than just using the SPI bus to access the card.
>>> ( This is based on some searches of conversations on the raspberry pi forums
>>> , not my experience )
>>>
>>> You would have to write a driver for this emmc controller and provide the
>>> interface to libblock for the file system interface on RTEMS. The code you
>>> have linked above for rpi-boot looks like it has a permissive license, so it
>>> *may* be possible to use this code in the RTEMS driver. There is some other
>>> potentially useful code in there too.

The mailbox access, mmio read and write and the timer code will also be 
usefull, and not only for emmc. This timer code differs from the 
misc/timer.h currently in the raspberrypi BSP, as it waits a certain 
amount of time (until some register gets updated). The misc/timer.h is a 
benchmark timer, so one of them would have to be renamed or reorganized.

My plan was to have at the root of the raspberrypi BSP a folder "emmc" 
for the emmc driver code, and the mailbox, mmio and timer on the misc 
folder, with the headers on the include folder. What do you think?

I have been trying the rpi-boot emmc code for the past week, and I 
modified the hello test to use the emmc driver (an overly simplified 
version of the rpi-boot, just to read the slot info register for now), 
and my compilation process has been:

1. Add/change files in Raspberrypi BSP
2. Update Makefile.am
3. Run bootstrap -p and bootstrap from the RaspberryPi BSP folder
4. (Re)configure RTEMS
5. make and make install RTEMS from the root folder

I have been using the --enable-maintainer-mode, but I am not sure about 
exacly what it simplifies, because I always needed to do those steps for 
it to compile and link correctly.

--André Marques

>>>
>>> I'll have to try the serial bootloader, I am also close to ordering an
>>> inexpensive JTAG adapter to try loading and debugging through JTAG. uboot is
>>> another possibility, using a TFTP server.
>>>
>>> Alan
>>>
>>>
>>>
>>>
>>> On Wed, Apr 2, 2014 at 12:02 PM, Andre Marques
>>> <andre.lousa.marques at gmail.com> wrote:
>>>> Hello,
>>>>
>>>> I'm intending to work in the SD card support for the Raspberry Pi BSP,
>>>> using the SD mode instead of the SPI mode.
>>>>
>>>> The references I have gathered so far for this are as follows:
>>>>
>>>> The Raspberry Pi SOC guide: Broadcom BCM2835 Peripherals Guide (Chapter 5
>>>> - EMMC)
>>>>
>>>> The simplified SD standard -
>>>> https://www.sdcard.org/downloads/pls/simplified_specs/
>>>>
>>>> And the following github code -
>>>> https://github.com/jncronin/rpi-boot/blob/master/emmc.c
>>>>
>>>> There is also the libchip/i2c/spi-sd-card libi2c driver, which can also be
>>>> a reference (even though it uses SPI).
>>>>
>>>> Now, the questions:
>>>>
>>>> Should I use the Generic Disk Device driver, as the
>>>> libchip/i2c/spi-sd-card ?
>>>>
>>>> Is there any driver using the SD mode for sd card access, or using an emmc
>>>> interface currently in the RTEMS code base? I haven't found any.
>>>>
>>>> On a side note, I managed to send RTEMS applications to the RPi though the
>>>> UART interface using the xmodem protocol.
>>>>
>>>> For that I used the following bootloader
>>>>
>>>> https://github.com/dwelch67/raspberrypi/tree/master/bootloader05
>>>>
>>>> It takes me 2 minutes to send 1 MB of data to the RPi, but this could be
>>>> improved if it used 1024 byte block transfer instead of the default of 128.
>>>> The bootloader loads the transfered program to memory and runs it. Then the
>>>> RPi must be rebooted so a new program can be sent.
>>>>
>>>> It may not be the best way, but only requires an usb-to-uart cable, and
>>>> avoids the current SD card "dance" to run programs on the Pi.
>>>>
>>>> Thank you for your time.
>>>>
>>>> --André Marques
>>>>
>>>>
>>> _______________________________________________
>>> rtems-devel mailing list
>>> rtems-devel at rtems.org
>>> http://www.rtems.org/mailman/listinfo/rtems-devel
>>>
>> _______________________________________________
>> rtems-devel mailing list
>> rtems-devel at rtems.org
>> http://www.rtems.org/mailman/listinfo/rtems-devel




More information about the devel mailing list