summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/beagle/simscripts
diff options
context:
space:
mode:
authorBen Gras <beng@shrike-systems.com>2014-11-03 19:53:40 +0100
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-11-03 14:19:47 -0600
commit53dd6d6130c870d12351d8ca75e4ac9dcc834c86 (patch)
tree022804b833f8fdb47a15ab8940743f91726776b5 /c/src/lib/libbsp/arm/beagle/simscripts
parentAdded BeagleBoard BSP (diff)
downloadrtems-53dd6d6130c870d12351d8ca75e4ac9dcc834c86.tar.bz2
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@shrike-systems.com>
Diffstat (limited to 'c/src/lib/libbsp/arm/beagle/simscripts')
-rw-r--r--c/src/lib/libbsp/arm/beagle/simscripts/bbxm.cfg174
-rw-r--r--c/src/lib/libbsp/arm/beagle/simscripts/gdbinit.bbxm16
-rw-r--r--c/src/lib/libbsp/arm/beagle/simscripts/sdcard.sh84
3 files changed, 274 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/arm/beagle/simscripts/bbxm.cfg b/c/src/lib/libbsp/arm/beagle/simscripts/bbxm.cfg
new file mode 100644
index 0000000000..a5fe36cd01
--- /dev/null
+++ b/c/src/lib/libbsp/arm/beagle/simscripts/bbxm.cfg
@@ -0,0 +1,174 @@
+# Start with: openocd -f interface/ftdi/flyswatter.cfg -f bbxm.cfg -c 'reset init'
+# or with: openocd -f interface/ftdi/flyswatter2.cfg -f bbxm.cfg -c 'reset init'
+source [find board/ti_beagleboard_xm.cfg]
+
+#
+# Use the MLO file from uboot to initialise the board.
+#
+proc beagleboard_xm_mlo { file } {
+ global _CHIPNAME
+ adapter_khz 10
+ catch { mww phys 0x48307250 0x00000004 }
+ reset init
+ icepick_c_wreset $_CHIPNAME.jrc
+ halt
+ dm37x.cpu arm core_state arm
+ puts "Beagleboard xM MLO: $file"
+ load_image $file 0x402005f8 bin
+ resume 0x40200800
+ sleep 500
+ halt
+}
+
+proc beagleboard_xm_init {} {
+ global _CHIPNAME
+ adapter_khz 10
+ catch { mww phys 0x48307250 0x00000004 }
+ reset init
+ icepick_c_wreset $_CHIPNAME.jrc
+ halt
+ dm37x.cpu arm core_state arm
+
+ mwh 0x6e00007c 0x000000ff ;# omap-gpmc
+ mwh 0x6e00007c 0x00000090 ;# omap-gpmc
+ mwh 0x6e000080 0x00000000 ;# omap-gpmc
+ mwh 0x6e00007c 0x00000000 ;# omap-gpmc
+ mwh 0x6e000080 0x00000000 ;# omap-gpmc
+ mwh 0x6e000080 0x00000000 ;# omap-gpmc
+ mwh 0x6e000080 0x00000000 ;# omap-gpmc
+ mwh 0x6e000080 0x00000000 ;# omap-gpmc
+ mwh 0x6e000080 0x00000000 ;# omap-gpmc
+ mwh 0x6e00007c 0x00000030 ;# omap-gpmc
+ mww 0x48004c00 0x00000020 ;# omap3_cm
+ mww 0x48004c10 0x00000020 ;# omap3_cm
+ mww 0x48314048 0x0000aaaa ;# omap3_mpu_wdt
+ mww 0x48314048 0x00005555 ;# omap3_mpu_wdt
+ mww 0x6c000048 0xffffffff ;# omap3_sms
+ mww 0x48004c40 0x00000013 ;# omap3_cm
+ mww 0x48004c10 0x00000025 ;# omap3_cm
+ mww 0x48004c00 0x00000021 ;# omap3_cm
+ mww 0x48306d40 0x00000003 ;# omap3_prm
+ mww 0x48307270 0x00000083 ;# omap3_prm
+ mww 0x48307270 0x00000080 ;# omap3_prm
+ mww 0x48004904 0x00000015 ;# omap3_cm
+ mww 0x48004d00 0x00110016 ;# omap3_cm
+ mww 0x48005140 0x10020a50 ;# omap3_cm
+ mww 0x48004d40 0x08000040 ;# omap3_cm
+ mww 0x48004d40 0x09900040 ;# omap3_cm
+ mww 0x48004d40 0x09900c40 ;# omap3_cm
+ mww 0x48004d40 0x09900c00 ;# omap3_cm
+ mww 0x48004a40 0x00001305 ;# omap3_cm
+ mww 0x48004a40 0x00001125 ;# omap3_cm
+ mww 0x48004a40 0x00001109 ;# omap3_cm
+ mww 0x48004a40 0x0000110a ;# omap3_cm
+ mww 0x48004b40 0x00000005 ;# omap3_cm
+ mww 0x48004c40 0x00000015 ;# omap3_cm
+ mww 0x48004d00 0x00110006 ;# omap3_cm
+ mww 0x48004d00 0x00110007 ;# omap3_cm
+ mww 0x48004d00 0x00110007 ;# omap3_cm
+ mww 0x48005140 0x03020a50 ;# omap3_cm
+ mww 0x48004f40 0x00000004 ;# omap3_cm
+ mww 0x48004e40 0x00000409 ;# omap3_cm
+ mww 0x48004e40 0x00001009 ;# omap3_cm
+ mww 0x48004d48 0x00000009 ;# omap3_cm
+ mww 0x48004d44 0x02436000 ;# omap3_cm
+ mww 0x48004d44 0x0243600c ;# omap3_cm
+ mww 0x48004a40 0x0000110a ;# omap3_cm
+ mww 0x48004d00 0x00170007 ;# omap3_cm
+ mww 0x48004d04 0x00000011 ;# omap3_cm
+ mww 0x48004d50 0x00000001 ;# omap3_cm
+ mww 0x48004d4c 0x00007800 ;# omap3_cm
+ mww 0x48004d4c 0x0000780c ;# omap3_cm
+ mww 0x48004d00 0x00170037 ;# omap3_cm
+ mww 0x48004d04 0x00000017 ;# omap3_cm
+ mww 0x48004004 0x00000011 ;# omap3_cm
+ mww 0x48004044 0x00000001 ;# omap3_cm
+ mww 0x48004040 0x00081400 ;# omap3_cm
+ mww 0x48004040 0x00081400 ;# omap3_cm
+ mww 0x48004004 0x00000017 ;# omap3_cm
+ mww 0x48004944 0x00000001 ;# omap3_cm
+ mww 0x48004940 0x000a5800 ;# omap3_cm
+ mww 0x48004940 0x000a580c ;# omap3_cm
+ mww 0x48004904 0x00000017 ;# omap3_cm
+ mww 0x48005040 0x000000ff ;# omap3_cm
+ mww 0x48004c40 0x00000015 ;# omap3_cm
+ mww 0x48005040 0x000000ff ;# omap3_cm
+ mww 0x48005010 0x00000008 ;# omap3_cm
+ mww 0x48005000 0x00000008 ;# omap3_cm
+ mww 0x48004a00 0x00002000 ;# omap3_cm
+ mww 0x48004a10 0x00002042 ;# omap3_cm
+ mww 0x48005000 0x00000808 ;# omap3_cm
+ mww 0x48005010 0x00000808 ;# omap3_cm
+ mww 0x48004a00 0x0003a000 ;# omap3_cm
+ mww 0x48004a10 0x0003a042 ;# omap3_cm
+ mww 0x48004c10 0x00000025 ;# omap3_cm
+ mww 0x48004000 0x00000001 ;# omap3_cm
+ mww 0x48004a00 0x03fffe29 ;# omap3_cm
+ mww 0x48004a10 0x3ffffffb ;# omap3_cm
+ mww 0x48004a14 0x0000001f ;# omap3_cm
+ mww 0x48004c00 0x000000e9 ;# omap3_cm
+ mww 0x48004c10 0x0000003f ;# omap3_cm
+ mww 0x48004e00 0x00000005 ;# omap3_cm
+ mww 0x48004e10 0x00000001 ;# omap3_cm
+ mww 0x48004f00 0x00000001 ;# omap3_cm
+ mww 0x48004f10 0x00000001 ;# omap3_cm
+ mww 0x48005000 0x0003ffff ;# omap3_cm
+ mww 0x48005010 0x0003ffff ;# omap3_cm
+ mww 0x48005410 0x00000001 ;# omap3_cm
+ mww 0x48005400 0x00000003 ;# omap3_cm
+ mww 0x48004a18 0x00000004 ;# omap3_cm
+ mww 0x48004a08 0x00000004 ;# omap3_cm
+ mww 0x6e000060 0x00001800 ;# omap-gpmc
+ mww 0x6e000064 0x00141400 ;# omap-gpmc
+ mww 0x6e000068 0x00141400 ;# omap-gpmc
+ mww 0x6e00006c 0x0f010f01 ;# omap-gpmc
+ mww 0x6e000070 0x010c1414 ;# omap-gpmc
+ mww 0x6e000074 0x1f0f0a80 ;# omap-gpmc
+ mww 0x6e000078 0x00000870 ;# omap-gpmc
+ mwb 0x6e00007c 0x000000ff ;# omap-gpmc
+ mwb 0x6e00007c 0x00000070 ;# omap-gpmc
+ mwb 0x6e00007c 0x00000090 ;# omap-gpmc
+ mwb 0x6e000080 0x00000000 ;# omap-gpmc
+ mww 0x6d000010 0x00000002 ;# omap.sdrc
+ mww 0x6d000010 0x00000000 ;# omap.sdrc
+ mww 0x6d000044 0x00000100 ;# omap.sdrc
+ mww 0x6d000070 0x04000081 ;# omap.sdrc
+ mww 0x6d000060 0x0000000a ;# omap.sdrc
+ mww 0x6d000080 0x04590099 ;# omap.sdrc
+ mww 0x6d00009c 0xc29dc4c6 ;# omap.sdrc
+ mww 0x6d0000a0 0x00022322 ;# omap.sdrc
+ mww 0x6d0000a4 0x0004e201 ;# omap.sdrc
+ mww 0x6d0000a8 0x00000000 ;# omap.sdrc
+ mww 0x6d0000a8 0x00000001 ;# omap.sdrc
+ mww 0x6d0000a8 0x00000002 ;# omap.sdrc
+ mww 0x6d0000a8 0x00000002 ;# omap.sdrc
+ mww 0x6d000084 0x00000032 ;# omap.sdrc
+ mww 0x6d000040 0x00000004 ;# omap.sdrc
+ mww 0x6d0000b0 0x04590099 ;# omap.sdrc
+ mww 0x6d0000c4 0xc29dc4c6 ;# omap.sdrc
+ mww 0x6d0000c8 0x00022322 ;# omap.sdrc
+ mww 0x6d0000d4 0x0004e201 ;# omap.sdrc
+ mww 0x6d0000d8 0x00000000 ;# omap.sdrc
+ mww 0x6d0000d8 0x00000001 ;# omap.sdrc
+ mww 0x6d0000d8 0x00000002 ;# omap.sdrc
+ mww 0x6d0000d8 0x00000002 ;# omap.sdrc
+ mww 0x6d0000b4 0x00000032 ;# omap.sdrc
+ mww 0x6d0000b0 0x00000000 ;# omap.sdrc
+ mww 0x6e00001c 0x00000000 ;# omap-gpmc
+ mww 0x6e000040 0x00000000 ;# omap-gpmc
+ mww 0x6e000050 0x00000000 ;# omap-gpmc
+ mww 0x6e000078 0x00000000 ;# omap-gpmc
+ mww 0x6e000078 0x00000000 ;# omap-gpmc
+ mww 0x6e000060 0x00001800 ;# omap-gpmc
+ mww 0x6e000064 0x00141400 ;# omap-gpmc
+ mww 0x6e000068 0x00141400 ;# omap-gpmc
+ mww 0x6e00006c 0x0f010f01 ;# omap-gpmc
+ mww 0x6e000070 0x010c1414 ;# omap-gpmc
+ mww 0x6e000074 0x1f0f0a80 ;# omap-gpmc
+ mww 0x6e000078 0x00000870 ;# omap-gpmc
+ mww 0x48004a00 0x437ffe00 ;# omap3_cm
+ mww 0x48004a10 0x637ffed2 ;# omap3_cm
+ puts "Beagleboard xM initialised"
+}
+
+init
diff --git a/c/src/lib/libbsp/arm/beagle/simscripts/gdbinit.bbxm b/c/src/lib/libbsp/arm/beagle/simscripts/gdbinit.bbxm
new file mode 100644
index 0000000000..32ae9dd9ad
--- /dev/null
+++ b/c/src/lib/libbsp/arm/beagle/simscripts/gdbinit.bbxm
@@ -0,0 +1,16 @@
+target remote localhost:3333
+mon reset halt
+mon beagleboard_xm_init
+load
+
+b _ARMV4_Exception_undef_default
+b _ARMV4_Exception_swi_default
+b _ARMV4_Exception_pref_abort_default
+b _ARMV4_Exception_data_abort_default
+b _ARMV4_Exception_reserved_default
+b _ARMV4_Exception_irq_default
+b _ARMV4_Exception_fiq_default
+
+b rtems_fatal
+b rtems_fatal_error_occurred
+b _exit
diff --git a/c/src/lib/libbsp/arm/beagle/simscripts/sdcard.sh b/c/src/lib/libbsp/arm/beagle/simscripts/sdcard.sh
new file mode 100644
index 0000000000..becd2c7720
--- /dev/null
+++ b/c/src/lib/libbsp/arm/beagle/simscripts/sdcard.sh
@@ -0,0 +1,84 @@
+# we store all generated files here.
+TMPDIR=tmp_sdcard_dir.$$
+
+FATIMG=$TMPDIR/bbxm_boot_fat.img
+SIZE=65536
+OFFSET=2048
+FATSIZE=`expr $SIZE - $OFFSET`
+UENV=uEnv.txt
+
+rm -rf $TMPDIR
+mkdir -p $TMPDIR
+
+if [ $# -ne 2 ]
+then echo "Usage: $0 <RTEMS prefix> <RTEMS executable>"
+ exit 1
+fi
+
+PREFIX=$1
+
+if [ ! -d "$PREFIX" ]
+then echo "This script needs the RTEMS tools bindir as the first argument."
+ exit 1
+fi
+
+executable=$2
+
+case "$2" in
+ *beagleboard*)
+ ubootcfg=omap3_beagle
+ imgtype=bb
+ ;;
+ *beaglebone*)
+ ubootcfg=am335x_evm
+ imgtype=bone
+ ;;
+ *)
+ echo "Can't guess which uboot to use - please specify full path to executable."
+ exit 1
+ ;;
+esac
+
+app=rtems-app.img
+
+if [ ! -f "$executable" ]
+then echo "Expecting RTEMS executable as arg; $executable not found."
+ exit 1
+fi
+
+set -e
+
+IMG=${imgtype}_`basename $2`-sdcard.img
+
+# Make an empty image
+dd if=/dev/zero of=$IMG bs=512 seek=`expr $SIZE - 1` count=1
+dd if=/dev/zero of=$FATIMG bs=512 seek=`expr $FATSIZE - 1` count=1
+
+# Make an ms-dos FS on it
+$PREFIX/bin/newfs_msdos -r 1 -m 0xf8 -c 4 -F16 -h 64 -u 32 -S 512 -s $FATSIZE -o 0 ./$FATIMG
+
+# Prepare the executable.
+base=`basename $executable`
+$PREFIX/bin/arm-rtems4.11-objcopy $executable -O binary $TMPDIR/$base.bin
+gzip -9 $TMPDIR/$base.bin
+$PREFIX/bin/mkimage -A arm -O rtems -T kernel -a 0x80000000 -e 0x80000000 -n RTEMS -d $TMPDIR/$base.bin.gz $TMPDIR/$app
+echo "setenv bootdelay 5
+uenvcmd=run boot
+boot=fatload mmc 0 0x80800000 $app ; bootm 0x80800000" >$TMPDIR/$UENV
+
+# Copy the uboot and app image onto the FAT image
+$PREFIX/bin/mcopy -bsp -i $FATIMG $PREFIX/uboot/$ubootcfg/MLO ::MLO
+$PREFIX/bin/mcopy -bsp -i $FATIMG $PREFIX/uboot/$ubootcfg/u-boot.img ::u-boot.img
+$PREFIX/bin/mcopy -bsp -i $FATIMG $TMPDIR/$app ::$app
+$PREFIX/bin/mcopy -bsp -i $FATIMG $TMPDIR/$UENV ::$UENV
+
+# Just a single FAT partition (type C) that uses all of the image
+$PREFIX/bin/partition -m $IMG $OFFSET c:${FATSIZE}\*
+
+# Put the FAT image into the SD image
+dd if=$FATIMG of=$IMG seek=$OFFSET
+
+# cleanup
+rm -rf $TMPDIR
+
+echo "Result is in $IMG."