Update: uMon is now booting from SD

Ed Sutter edsutterjr at gmail.com
Sat Jul 4 18:19:58 UTC 2015


On 7/4/2015 2:02 PM, Jarielle Catbagan wrote:
> On Sat, Jul 4, 2015 at 9:54 AM, Ed Sutter <edsutterjr at gmail.com> wrote:
>> On 7/4/2015 11:23 AM, Jarielle Catbagan wrote:
>>> On Sat, Jul 4, 2015 at 6:50 AM, Ed Sutter <edsutterjr at gmail.com> wrote:
>>>> On 7/3/2015 8:49 PM, Jarielle Catbagan wrote:
>>>>> Hi Ed,
>>>>>
>>>>> On Fri, Jul 3, 2015 at 6:03 AM, Ed Sutter <edsutterjr at gmail.com> wrote:
>>>>>> On 7/2/2015 9:27 PM, Jarielle Catbagan wrote:
>>>>>>> Hello Ed and all:
>>>>>>>
>>>>>>> uMon is now booting from SD!
>>>>>>>
>>>>>>> As Ed has indicated to me, the first reason why uMon did not appear to
>>>>>>> boot from SD was that UART initialization was not performed when the
>>>>>>> AM335x was booting from memory.  Originally, when uMon was booting
>>>>>>> from UART, as Ed has mentioned to me, uMon was working and was able to
>>>>>>> use the UART because it appears that the UART was set up already by
>>>>>>> the internal ROM code during the UART boot procedure.
>>>>>>>
>>>>>>> The UART initialization was suppose to be done in cpuio.c.  Ed has
>>>>>>> sent me a diff containing the necessary modifications/additions that
>>>>>>> has served as the basis for the UART initialization.  After applying
>>>>>>> this diff to the current uMon tree, building the uMon image and
>>>>>>> transferring the image to an SD card, attempting to boot from SD still
>>>>>>> resulted in the BBB to appear to not boot up.
>>>>>>>
>>>>>>> Ed has mentioned to me that one of the possible reasons why the SD
>>>>>>> boot is not coming through could be something that is missing during
>>>>>>> the UART initialization like clock management or power control.  This
>>>>>>> has prompted me to go back and look through the AM335x TRM,
>>>>>>> specifically on the sections regarding the PRCM (Power Reset Clock
>>>>>>> Management) and UART modules.
>>>>>>>
>>>>>>> It turned out that one of the UART0 registers, register MDR1, the
>>>>>>> MODESELECT field had the value 0x07 which translates to the UART
>>>>>>> module being disabled. Since the UART in uMon is already set up to
>>>>>>> work with UART 16x mode, and the value for this mode is 0x00, this was
>>>>>>> stored in the MODESELECT field of the MDR1 register.
>>>>>>>
>>>>>>> After setting this field the uMon image was rebuilt, the GP header was
>>>>>>> prepended to the image and was transferred to the SD card as "MLO".
>>>>>>> Booting the SD card resulted in uMon being able to boot and to reach
>>>>>>> the uMon command line.
>>>>>>>
>>>>>>> My next steps before proceeding to finish DDR initialization is to
>>>>>>> clean up the updated files that perform the necessary UART
>>>>>>> initialization and then I will submit the patches that reflect these
>>>>>>> changes for review.
>>>>>>> _______________________________________________
>>>>>>> umon-devel mailing list
>>>>>>> umon-devel at rtems.org
>>>>>>> http://lists.rtems.org/mailman/listinfo/umon-devel
>>>>>>>
>>>>>> Congratulations!  Big step IMHO...
>>>>> Thank you!
>>>>>
>>>>>> This will allow you to experiment a bit more without the need to reboot
>>>>>> manually each time.
>>>>>> Looking forward to the patches!  I assume you used a FAT formatted SD
>>>>>> card
>>>>>> to do this?
>>>>> Yes, I booted the uMon image from a FAT32 formatted SD card.
>>>>>
>>>>>> Make sure you put everything in the port directory needed to reproduce
>>>>>> this.
>>>>>> When you submit the patches I'll push them and then whatever work I did
>>>>>> that
>>>>>> does not
>>>>>> overlap with your patches I'll push up as well.
>>>>>> Great stuff!!!  And excellent reporting!!!
>>>>>> Ed
>>>>> I just finished the patches and I sent them already to umon-devel for
>>>>> your review.  Please let me know if there are any inconsistencies with
>>>>> the patches and I'll be glad to make the necessary changes in order
>>>>> for the patches to meet the specification that you are looking for.
>>>>>
>>>>> Thanks!
>>>>>
>>>>> Best Regards,
>>>>> Jarielle
>>>>>
>>>>> P.S. Have a great Independence Day weekend! :-)
>>>>>
>>>> Jarielle,
>>>> I didn't look at the patches yet, but I'm sure there won't be any
>>>> inconsistencies.  The only
>>>> point I was making with reference to me pushing some stuff in as well was
>>>> to
>>>> make sure
>>>> that we have everything that's been done put into the port for use by
>>>> folks
>>>> in the future.
>>> I agree.
>>>
>>>> For example, I just happened to take the "raw" mode approach, so I want
>>>> to
>>>> make sure
>>>> that is in the port, plus I did that LED/GPIO stuff so while its very
>>>> trivial, its still more to
>>>> go into the port for general use.
>>>> Thanks for the patches!
>>>> Ed
>>> That's great to hear! Yeah, being able to boot using "raw" mode is a
>>> nice option to have.  Integrating the LED/GPIO into the port would be
>>> nice as well.  I think it would be cool to blink some LEDs for status
>>> indication when uMon is running.  What do you think?
>>>
>> Jarielle,
>> Ok I pulled in the patches and things built clean.  I see an MLO file that
>> is the concatenation of
>> gp_header.bin and boot.bin.  Unless I missed something, there are no
>> instructions for the final
>> step of creating the SD card.  For the raw mode, its just a 'dd'; but I
>> suppose there's more to it
>> for FAT correct?
>> Can you add some instructions for this?  Assume the card is not
>> pre-formatted as FAT.  Start
>> from scratch.  Then I'll follow those steps to install the card on my board
>> to verify.
>> Tx
> Ed,
>
> Sorry about that.  I'll create some instructions to detail how to
> setup the SD card.  In the meantime, below are the steps I took to
> format an SD card with a FAT partition marked as active.
>
> I took somewhat of an inefficient approach because I formatted the SD
> card on Windows and then configured the FAT partition on Linux (i.e.
> marking the partition as active).  I am going to try to figure out how
> to do all the steps on Linux.
>
> The reason why I formatted the SD card on windows was becuase there is
> an official SD formatter from
> https://www.sdcard.org/downloads/formatter_4/ to format an SD card.
> This formatter takes care of everything especially setting up the
> FAT32 partition on the SD card as well as setting up the MBR in case
> it was overwritten.
>
> With the SD formatter, I simply did a Full Erase.  More information
> about the "Full Erase" and what is performed exactly in this step can
> be found in the SD formatter User Manual here:
> https://www.sdcard.org/downloads/formatter_4/SDFormatter_4e.pdf,
> section Section 5.
>
> After that, I proceeded to configure the SD card on Linux.
>
> Assuming the SD card is under /dev as "sdc" to mark the FAT partition
> as active, the command I used is
>
> $ sudo fdisk /dev/sdc
>
> Once I entered the 'fdisk' utility, I used the 'a' option to mark the
> partition as active, I verified it by printing the partitions with
> 'p', and then once I verified it I wrote it to the SD card with the
> 'w' option.
>
> Next I mounted the SD card so I could place the MLO file.
>
> The FAT partition should be under /dev/sdc1 assuming that the base of
> the SD card is at /dev/sdc.
>
> In my case, I mounted the SD card in a directory called 'mnt' in my
> home directory.  The sequenc of steps I took from here are:
>
> $ cd ~
> $ mkdir mnt
> $ sudo mount /dev/sdc1 mnt
> $ sudo cp $(HOME)/source/umon/ports/beagleboneblack/build_BEAGLEBONEBLACK/MLO
> mnt
> $ sudo umount mnt
>
> After this, you should be good to go.
>
> Please let me know if you encounter any issues or if any of the steps
> can not be completed, especially formatting the SD card.
>
> Thanks.
>>
Ok, I managed to get it to boot using only Linux for formatting the card.
It wasn't working for me until I just read your email and realized I did not mark
the partition active.  After doing that it booted!
So here are the steps I walked through
(extracted from: http://forum.xda-developers.com/showthread.php?t=502095) :

1. Verify the partition that the SD card installs as:
      - cat /proc/paritions (without the uSD)
      - Insert uSD card
      - cat /proc/paritions (note the difference)
Using /dev/sdc as our partition:
2. sudo fdisk /dev/sdc
     - delete all paritions with 'd' command (d1/d2/d3/d4) as needed
     - use 'n' command to create partition 1
     - use 't' command to relabel partition 1 to 'c'
     - use 'a' command to make the parition active
     - use 'p' to show something like:

    Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048     3932159     1965056    c  W95 FAT32 (LBA)

      - use 'w' to write to the card

3. Run sudo mkfs.vfat /dev/sdc1
4. Mount /dev/sdc1 as /media/boot (or whatever)
5. Copy MLO to /media/boot
6. Run sync; unmount /media/boot
7. Put card in BBB, reset with boot button depressed.


More information about the umon-devel mailing list