source: rtems/c/src/lib/libbsp/arm/beagle/simscripts/sdcard.sh @ 0afac6a

4.115
Last change on this file since 0afac6a was 53dd6d61, checked in by Ben Gras <beng@…>, on 11/03/14 at 18:53:40

BSP for several Beagle products

Specifically the beagleboard, beagleboard xM, beaglebone, beaglebone black.

More info on these targets: http://www.beagleboard.org/

This commit forms a basic BSP by combining Claas's work with

. new clock and irq code and definitions for

beagle targets (beagleboard and beaglebones), mostly
reused from the Minix codebase, thus making
irqs, ticks and non-polled console mode work too

. new timer code for ns timing with high timer resolution,

24MHz on the AM335X and 13MHz on the DM37XX

. select the console uart based on target at configure time
. removing all the lpc32xx-specific macros and code and

other unused code and definitions that the beagle bsp
was based on

. re-using some standard functions instead of lpc32xx versions
. fixed some whitespace problem in preinstall.am
. fixed some compile warnings
. configure MMU: set 1MB sections directly in the TTBR,

just to show the difference between cacheable RAM and
non-cacheable device memory and invalid ranges; this lets us
turn on caches and not rely on boot loader MMU configuration.
Verified to work when MMU is initially either on or off when
RTEMS gets control.

Thanks for testing, commentary, improvements and fixes to Chris Johns,
Brandon Matthews, Matt Carberry, Romain Bornet, AZ technology and others.

Signed-Off-By: Ben Gras <beng@…>

  • Property mode set to 100644
File size: 2.0 KB
Line 
1# we store all generated files here.
2TMPDIR=tmp_sdcard_dir.$$
3
4FATIMG=$TMPDIR/bbxm_boot_fat.img
5SIZE=65536
6OFFSET=2048
7FATSIZE=`expr $SIZE - $OFFSET`
8UENV=uEnv.txt
9
10rm -rf $TMPDIR
11mkdir -p $TMPDIR
12
13if [ $# -ne 2 ]
14then    echo "Usage: $0 <RTEMS prefix> <RTEMS executable>"
15        exit 1
16fi
17
18PREFIX=$1
19
20if [ ! -d "$PREFIX" ]
21then    echo "This script needs the RTEMS tools bindir as the first argument."
22        exit 1
23fi
24
25executable=$2
26
27case "$2" in
28        *beagleboard*)
29                ubootcfg=omap3_beagle
30                imgtype=bb
31                ;;
32        *beaglebone*)
33                ubootcfg=am335x_evm
34                imgtype=bone
35                ;;
36        *)
37                echo "Can't guess which uboot to use - please specify full path to executable."
38                exit 1
39                ;;
40esac
41
42app=rtems-app.img
43
44if [ ! -f "$executable" ]
45then    echo "Expecting RTEMS executable as arg; $executable not found."
46        exit 1
47fi
48
49set -e
50
51IMG=${imgtype}_`basename $2`-sdcard.img
52
53# Make an empty image
54dd if=/dev/zero of=$IMG bs=512 seek=`expr $SIZE - 1` count=1
55dd if=/dev/zero of=$FATIMG bs=512 seek=`expr $FATSIZE - 1` count=1
56
57# Make an ms-dos FS on it
58$PREFIX/bin/newfs_msdos -r 1 -m 0xf8 -c 4 -F16  -h 64 -u 32 -S 512 -s $FATSIZE -o 0 ./$FATIMG
59
60# Prepare the executable.
61base=`basename $executable`
62$PREFIX/bin/arm-rtems4.11-objcopy $executable -O binary $TMPDIR/$base.bin
63gzip -9 $TMPDIR/$base.bin
64$PREFIX/bin/mkimage -A arm -O rtems -T kernel -a 0x80000000 -e 0x80000000 -n RTEMS -d $TMPDIR/$base.bin.gz $TMPDIR/$app
65echo "setenv bootdelay 5
66uenvcmd=run boot
67boot=fatload mmc 0 0x80800000 $app ; bootm 0x80800000" >$TMPDIR/$UENV
68
69# Copy the uboot and app image onto the FAT image
70$PREFIX/bin/mcopy -bsp -i $FATIMG $PREFIX/uboot/$ubootcfg/MLO ::MLO
71$PREFIX/bin/mcopy -bsp -i $FATIMG $PREFIX/uboot/$ubootcfg/u-boot.img ::u-boot.img
72$PREFIX/bin/mcopy -bsp -i $FATIMG $TMPDIR/$app ::$app
73$PREFIX/bin/mcopy -bsp -i $FATIMG $TMPDIR/$UENV ::$UENV
74
75# Just a single FAT partition (type C) that uses all of the image
76$PREFIX/bin/partition -m $IMG $OFFSET c:${FATSIZE}\*
77
78# Put the FAT image into the SD image
79dd if=$FATIMG of=$IMG seek=$OFFSET
80
81# cleanup
82rm -rf $TMPDIR
83
84echo "Result is in $IMG."
Note: See TracBrowser for help on using the repository browser.