source: umon/ports/beagleboneblack/README @ ecb72ce

Last change on this file since ecb72ce was ecb72ce, checked in by Ben Gras <beng@…>, on Jun 16, 2016 at 9:39:25 AM

some hooks to help building in RSB

  • Property mode set to 100644
File size: 10.1 KB
Line 
1Getting Started with uMon for the Beaglebone Black
2
3=======================================================================
4Building:
5=======================================================================
6From umon/ports/beagleboneblack:
7$ make TOOLSET=RTEMS RTEMSVERSION=4.12 RTEMSPREFIX=$HOME/development/rtems/4.12 UMONTOP=$HOME/development/umon/main
8
9=======================================================================
10Booting:
11=======================================================================
12
13-----------------------------------------------------------------------
14SD Card:
15-----------------------------------------------------------------------
16The Beaglebone Black can boot uMon from an SD card using two different
17boot modes.  The first boot mode is to boot using "raw" mode.  The
18second boot mode is to boot from a FAT primary partition marked as
19bootable.  The details and the steps required to set up the SD card
20for each of the boot modes are elaborated in the following two sections
21on SD card booting.  For more information on "raw" mode and FAT mode,
22please refer to the AM335s TRM Sections 26.1.7.5.5 "MMC/SD Read Sector
23Procedure in Raw Mode" and 26.1.7.5.6 "MMC/SD Read Sector Procedure
24in FAT Mode" respectively.
25
26In order to boot uMon from an SD card using FAT mode, a GP Header must
27be prepended to the uMon image.  In the case of booting uMon using
28"raw" mode, both a Configuration Header TOC Structure followed by a
29GP Header must be prepended to the uMon image.
30
31The GP Header is 8 bytes long where the first 4 bytes specify the size
32of the uMon image that will be transferred while the last 4 bytes
33specify both the destination address where the uMon image will be
34transferred to and the entry point.
35
36For information on the layout of the Configuration Header TOC Structure
37required for "raw" mode booting, please refer to the AM335x TRM
38Section 26.1.7.5.5.1 "Configuration Header".
39
40One thing worth mentioning is that the Beaglebone Black is connected to
41the SD card using MMC0 and as a result the size of the SD card must not
42be greater than 4GB.  This is indicated in the AM335x TRM Section
4326.1.7.5.2 "System Interconnection".
44
45In order to configure the Beaglebone Black to boot from an SD card,
46a uSD must be inserted and the boot switch held down while the board
47is powered up.  Once the board is powered on, the boot switch can
48be released.  If the attempt to boot from the uSD fails, the
49Beaglebone Black will fall back and attempt to boot using UART.
50As a result, this will provide a way to determine whether the boot
51from SD has succeeded or not.
52
53Before starting, it is recommended that the device that will be
54manipulated is verified to be the right device.  An approach to
55determine the right device name assigned to the SD card is by
56observing the output of
57
58        cat /proc/partitions
59
60before and after inserting the SD card.
61
62
63RAW MODE:
64
65In order to boot from an SD card using "raw" mode, the uMon image
66must be prepended with a Configuration Header TOC Structure and a
67GP Header.  The GP Header is placed right after the Configuration
68Header TOC Structure.
69
70When uMon is built, a uMon image containing the necessary headers
71is already created and is located under ./build_BEAGLEBONEBLACK.
72
73The next step is to setup the SD card.  Fortunately, the script
74./sd_setup.sh can be used to automate the process of setting up
75an SD card for "raw" mode booting.  To do so, invoke the script as
76
77        ./sd_setup.sh RAW <device>
78
79<device> shown above and for the remainder of this document will
80refer to the SD card.
81
82The following information specify how to manually set up the SD
83card.
84
85With the proper headers prepended, the image is ready to be booted.
86In order for the Beaglebone Black/AM335x to boot the image, the
87image must be placed at one of the offsets
880x00000/0x20000/0x40000/0x60000.
89
90As an example, to place the uMon image at the first offset
91
92        # Get the size of the uMon image to transfer into the SD card
93        export UMON_IMG_SIZE=`wc --bytes <uMon image> | cut -f 1 -d ' '`
94
95        # Transfer the uMon image at offset 0x00000
96        dd if=<uMon image> bs=1 count=$UMON_IMG_SIZE of=/dev/<device>
97
98where <uMon image> is the path to the uMon image prepended with a
99Configuration Header TOC Structure and a GP Header.
100
101
102FAT MODE:
103
104In FAT Mode, an "MLO" file is searched for in the root directory of
105a primary partition formatted as FAT12/FAT16 or FAT32 and marked
106bootable.  This "MLO" file must contain a GP Header followed by the
107uMon image.  When uMon is built, an "MLO" file is already created and
108is located in ./build_BEAGLEBONEBLACK.
109
110For convenience, preparing the SD card for FAT Mode booting has
111been automated through the use of the same aforementioned script,
112./sd_setup.sh.
113
114Invoking the script in order to create an SD card for FAT mode booting
115is as follows:
116
117        ./sd_setup.sh FAT <device>
118
119The script simply sets up a primary partition on the SD card, marks
120it as bootable, formats it as FAT16 and then transfers the MLO file
121under ./build_BEAGLEBONEBLACK to the root directory of the primary
122partition on the SD card.
123
124The following elaborates the sequence of steps on how exactly an SD
125card is prepared for FAT Mode booting for the Beaglebone Black
126to boot from.
127
128Assuming that the SD card has not been formatted yet...
129
130Just to be safe, clear out the partition table at the base of the SD
131card to start fresh.
132
133        dd if=/dev/zero of=<device> bs=1M count=1
134
135The next step is to create a primary partition with the filesystem
136type set to FAT16.  This primary partition will be placed as an entry
137in an MBR located in the first sector of the SD card.  Fortunately,
138these intial steps are taken care of by the fdisk utility.
139
140To allocate a partition that will be formatted as FAT16 and to create
141an entry for the partition in the MBR,
142
143        fdisk <device>
144
145Suppose the SD card is registered under /dev as "sdc", this would be
146
147        fdisk /dev/sdc
148
149fdisk will then present a command-line dialog.
150
151From here, a new partition must be created using 'n'.  This partition
152must have a type of 0x06 for FAT16 which is set with 't' and with the
153size allocated to the partition to be at least 3MB.  This size is the
154minimum size required and is more than enough to hold a uMon image and
155to allow for future expansion.  It is recommended that not all of the
156sectors of the SD card are allocated to the FAT16 primary partition
157in order to provide room for the possibility of storing user data or
158perhaps a kernel.
159
160Once that is done, the next step is to mark the primary partition as
161bootable.  This is done using the 'a' option.
162
163With all that in place, the partition can be verified before writing
164it to the SD card with 'p'.  Once the partition has been verified,
165it can be written to the SD card using 'w'.
166
167After using fdisk to set up the partition, the new partition can be
168viewed under /dev.  So for example, if the base of the SD card is given
169as /dev/sdc, then the newly created FAT16 partition will be given as
170/dev/sdc1.
171
172The next step is to format this partition as FAT16:
173
174        mkfs.fat -f 2 -F 16 -M 0xF8 -s 1 -S 512 <device>
175
176with <device> set to the primary partition of the SD card.
177
178The final step is to place the "MLO" file in the root directory
179of the FAT16 primary partition.
180
181        cd ~
182        mkdir mnt
183        mount <device> mnt
184        cp <path_to_umon>/ports/beagleboneblack/build_BEAGLEBONEBLACK/MLO mnt
185        umount mnt
186        rmdir mnt
187
188In the previous set of commands, <device> is set to the primary
189partition of the SD card that was recently formatted as FAT16.
190
191The SD card is now ready.
192
193
194-----------------------------------------------------------------------
195eMMC:
196-----------------------------------------------------------------------
197Booting uMon from the onboard eMMC requires a multiple-step procedure
198that will be simplified in the future as the uMon port progresses.
199
200To transfer a uMon image into the onboard eMMC requires an SD card where
201uMon is configured to boot in RAW mode from a known offset.
202
203With uMon configured to boot in RAW mode from a known offset in the
204SD card, the next step is to determine the size of the uMon image in
205512-byte blocks.
206
207With all of this in place, the sequence of uMon commands required to
208transfer the uMon image are as follows:
209
210    sd init
211    mmc init
212    sd read <destination in RAM> <SD sector address> <# of 512-byte blocks>
213    mmc write <source in RAM> <eMMC sector address> <# of 512-byte blocks>
214
215With these steps, the uMon image is first transferred into DDR3 RAM
216and then written to the eMMC.  The reason for this appraoch is that
217there is currently no supported mechanism to write the eMMC directly
218from an SD card.
219
220The user must take care to transfer the uMon image in a location in
221RAM not currently owned by the uMon image currently in execution.
222
223As for the final destination in the eMMC, the uMon image must be stored
224in a locatation where the internal ROM-bootloader will be able to find
225and boot this image.
226
227
228-----------------------------------------------------------------------
229UART:
230-----------------------------------------------------------------------
231Unlike booting from SD, booting via UART does not require any GP
232Header, Configuration Header TOC Structure, or both to be prepended to
233the uMon image.  The uMon image that will be booted using UART is
234boot.bin which is located in ./build_BEAGLEBONEBLACK.
235
236In order to boot from UART, a 3.3V USB-to-Serial cable is required,
237e.g. the FTDI USB TTL Serial cable is a possible option.
238
239The last requirement is to have a terminal emulator
240(e.g. minicom/picocom/etc.) set up to perform XMODEM transfers using
2411K packets and 16-bit CRC.
242
243To initiate the UART booting procedure on the Beaglebone Black, ensure
244that there is no uSD card inserted and then hold the boot switch down
245while powering up the board.  Once the board is powered on, the boot
246switch can be released.
247
248If a terminal emulator is set up already and connected to the serial
249port of the Beaglebone Black, the character 'C' will be outputted
250continuously.  This indicates that the UART booting procedure has
251initiated and is waiting for an image to be transferred via UART.
252
253From here, the uMon image can now be transferred using the terminal
254emulator.
255
256For more information on the UART boot procedure, please refer to the
257AM335x TRM Section 26.1.8.5 "UART Boot Procedure".
258=======================================================================
Note: See TracBrowser for help on using the repository browser.