diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-25 15:06:08 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-26 07:17:57 +0200 |
commit | eb36d1198cdf9dc1e2f776ef6e1e38755f6d13c5 (patch) | |
tree | 14177ad7a58c06a3c537d1e55dae7bc369a1a4b9 /bsps/arm/beagle | |
parent | 8eb264d34782f143e567f44737cd9879cb854410 (diff) |
bsps: Move documentation, etc. files to bsps
This patch is a part of the BSP source reorganization.
Update #3285.
Diffstat (limited to 'bsps/arm/beagle')
-rw-r--r-- | bsps/arm/beagle/README | 118 | ||||
-rw-r--r-- | bsps/arm/beagle/README.JTAG | 20 | ||||
-rw-r--r-- | bsps/arm/beagle/TESTING | 20 | ||||
-rw-r--r-- | bsps/arm/beagle/pwm/README | 197 | ||||
-rw-r--r-- | bsps/arm/beagle/simscripts/bbxm.cfg | 174 | ||||
-rw-r--r-- | bsps/arm/beagle/simscripts/gdbinit.bbxm | 16 | ||||
-rw-r--r-- | bsps/arm/beagle/simscripts/qemu-beagleboard.in | 63 | ||||
-rw-r--r-- | bsps/arm/beagle/simscripts/sdcard.sh | 84 |
8 files changed, 692 insertions, 0 deletions
diff --git a/bsps/arm/beagle/README b/bsps/arm/beagle/README new file mode 100644 index 0000000000..e558287408 --- /dev/null +++ b/bsps/arm/beagle/README @@ -0,0 +1,118 @@ +BSP for beagleboard xm, beaglebone (original aka white), and beaglebone black. + +original beagleboard isn't tested. + +wiki: http://www.rtems.org/wiki/index.php/Beagleboard + +1. *** CONFIGURING ************ + +bsp-specific build options in the environment at build time: +CONSOLE_POLLED=1 use polled i/o for console, required to run testsuite +CONSOLE_BAUD=... override default console baud rate + +BSPs recognized are: +beagleboardorig original beagleboard +beagleboardxm beagleboard xm +beaglebonewhite original beaglebone +beagleboneblack beaglebone black + +Currently the only distinction in the BSP are between the beagleboards and +the beaglebones, but the 4 names are specified in case hardware-specific +distinctions are made in the future, so this can be done without changing the +usage. + + +2. *** BUILDING ************ + +To build BSPs for the beaglebone white and beagleboard xm, starting from +a directory in which you have this source tree in rtems-src: + +$ mkdir b-beagle +$ cd b-beagle +$ ../rtems-src/configure --target=arm-rtems4.11 --enable-rtemsbsp="beaglebonewhite beagleboardxm" +$ make all + +This should give you .exes somewhere. + +Then you need 'mkimage' to transform a .exe file to a u-boot image +file. first make a flat binary: + +$ arm-rtems4.11-objcopy $exe -O binary $exe.bin +$ gzip -9 $exe.bin +$ mkimage -A arm -O rtems -T kernel -a 0x80000000 -e 0x80000000 -n RTEMS -d $exe.bin.gz rtems-app.img + +All beagles have memory starting at 0x80000000 so the load & run syntax is the same. + +3. *** BOOTING ************ + +Then, boot the beaglebone with u-boot on an SD card and load rtems-app.img +from u-boot. Interrupt the u-boot boot to get a prompt. + +Set up a tftp server and a network connection for netbooting. And to +copy rtems-app.img to the tftp dir. Otherwise copy the .img to the FAT +partition on the SD card and make uboot load & run that. + +4. *** BEAGLEBONES ************ + +(tested on both beaglebones) + +Beaglebone original (white) or beaglebone black netbooting: + +uboot# setenv ipaddr 192.168.12.20 +uboot# setenv serverip 192.168.12.10 +uboot# echo starting from TFTP +uboot# tftp 0x80800000 rtems-app.img +uboot# dcache off ; icache off +uboot# bootm 0x80800000 + +Beaglebone original (white) or beaglebone black from a FAT partition: + +uboot# fatload mmc :1 0x80800000 ticker.img +uboot# dcache off ; icache off +uboot# bootm 0x80800000 + +4. *** BEAGLEBOARD ************ + +(tested on xm) + +For the beagleboard the necessary commands are a bit different because +of the ethernet over usb: + +uboot# setenv serverip 192.168.12.10 +uboot# setenv ipaddr 192.168.12.62 +uboot# setenv usbnet_devaddr e8:03:9a:24:f9:10 +uboot# setenv usbethaddr e8:03:9a:24:f9:11 +uboot# usb start +uboot# echo starting from TFTP +uboot# tftp 0x80800000 rtems-app.img +uboot# dcache off ; icache off +uboot# bootm 0x80800000 + +4. *** SD CARD **************** + +There is a script here that automatically writes an SD card for any of +the beagle targets. + +Let's write one for the Beaglebone Black. Assuming your source tree is +at $HOME/development/rtems/rtems-src and your bsp is built and linked +with examples and installed at $HOME/development/rtems/4.11. + + % cd $HOME/development/rtems/rtems-src/c/src/lib/libbsp/arm/beagle/simscripts + % sh sdcard.sh $HOME/development/rtems/4.11 $HOME/development/rtems/b-beagle/arm-rtems4.11/c/beagleboneblack/testsuites/samples/hello/hello.exe + +The script should give you a whole bunch of output, ending in: + + Result is in bone_hello.exe-sdcard.img. + +There you go. dd that to an SD card and boot! + +The script needs to know whether it's for a Beagleboard xM or one of the +Beaglebones. This is to know which uboot to use. It will detect this +from the path the executable is in (in the above example, it contains +'beagleboneblack'), so you have to specify the full path. + + +Good luck & enjoy! + +Ben Gras +beng@shrike-systems.com diff --git a/bsps/arm/beagle/README.JTAG b/bsps/arm/beagle/README.JTAG new file mode 100644 index 0000000000..8d30590b54 --- /dev/null +++ b/bsps/arm/beagle/README.JTAG @@ -0,0 +1,20 @@ +To run RTEMS from scratch (without any other bootcode) on the beagles, +you can comfortably load the executables over JTAG using gdb. This is +necessarily target-specific however. + +1. BBXM + + - For access to JTAG using openocd, see simscripts/bbxm.cfg. + - openocd then offers access to gdb using simscripts/gdbinit.bbxm. + - start openocd using bbxm.cfg + - copy your .exe to a new dir and that gdbinit file as .gdbinit in the same dir + - go there and start gdb: + $ arm-rtems4.11-gdb hello.exe + - gdb will invoke the BBXM hardware initialization in the bbxm.cfg + and load the ELF over JTAG. type 'c' (for continue) to run it. + - breakpoints, C statement and single-instruction stepping work. + +2. beaglebone white + +This has been tested with openocd and works but not in as much detail as for +the BBXM yet (i.e. loading an executable from scratch). diff --git a/bsps/arm/beagle/TESTING b/bsps/arm/beagle/TESTING new file mode 100644 index 0000000000..2fea12b714 --- /dev/null +++ b/bsps/arm/beagle/TESTING @@ -0,0 +1,20 @@ +To build and run the tests for this BSP, use the RTEMS tester. +The necessary software can be built with the RTEMS source builder. + +To build the BSP for testing: + - set CONSOLE_POLLED=1 in the configure environment, some tests + assume console i/o is polled + - add --enable-tests to the configure line + +1. Qemu + +Linaro Qemu can emulate the beagleboard xm and so run all regression +tests in software. Build the bbxm.bset from the RTEMS source builder and +you will get qemu linaro that can run them. There is a beagleboardxm_qemu +bsp in the RTEMS tester to invoke it with every test. + +2. bbxm hardware + +This requires JTAG, see README.JTAG. Use the beagleboardxm bsp in the +RTEMS tester. It starts gdb to connect to openocd to reset the target +and load the RTEMS executable for each test iteration. diff --git a/bsps/arm/beagle/pwm/README b/bsps/arm/beagle/pwm/README new file mode 100644 index 0000000000..d41f5ca668 --- /dev/null +++ b/bsps/arm/beagle/pwm/README @@ -0,0 +1,197 @@ +Pulse Width Modulation subsystem includes EPWM, ECAP , EQEP. There are +different instances available for each one. For PWM there are three +different individual EPWM module 0 , 1 and 2. So wherever pwmss word is +used that affects whole PWM sub system such as EPWM, ECAP and EQEP. This code +has only implementation Non high resolution PWM module. APIs for high +resolution PWM has been yet to develop. + +For Each EPWM instance, has two PWM channels, e.g. EPWM0 has two channel +EPWM0A and EPWM0B. If you configure two PWM outputs(e.g. EPWM0A , EPWM0B) +in the same device, then they *must* be configured with the same frequency. +Changing frequency on one channel (e.g EPWMxA) will automatically change +frequency on another channel(e.g. EPWMxB). However, it is possible to set +different pulse-width/duty cycle to different channel at a time. So always +set the frequency first and then pulse-width/duty cycle. + +For more you can refer : +http://www.ofitselfso.com/BBBCSIO/Source/PWMPortEnum.cs.html + +Pulse Width Modulation uses the system frequency of Beagle Bone Black. + +System frequency = SYSCLKOUT, that is, CPU clock. TBCLK = SYSCLKOUT(By Default) +SYCLKOUT = 100 MHz + +Please visit following link to check why SYSCLKDIV = 100MHz: +https://groups.google.com/forum/#!topic/beagleboard/Ed2J9Txe_E4 +(Refer Technical Reference Manual (TRM) Table 15-41 as well) + +To generate different frequencies with the help of PWM module , SYSCLKOUT +need to be scaled down, which will act as TBCLK and TBCLK will be base clock +for the pwm subsystem. + +TBCLK = SYSCLKOUT/(HSPCLKDIV * CLKDIV) + + |----------------| + | clock | + SYSCLKOUT---> | |---> TBCLK + | prescale | + |----------------| + ^ ^ + | | + TBCTL[CLKDIV]----- ------TBCTL[HSPCLKDIV] + + +CLKDIV and HSPCLKDIV bits are part of the TBCTL register (Refer TRM). +CLKDIV - These bits determine part of the time-base clock prescale value. +Please use the following values of CLKDIV to scale down sysclk respectively. +0h (R/W) = /1 +1h (R/W) = /2 +2h (R/W) = /4 +3h (R/W) = /8 +4h (R/W) = /16 +5h (R/W) = /32 +6h (R/W) = /64 +7h (R/W) = /128 + +These bits determine part of the time-base clock prescale value. +Please use following value of HSPCLKDIV to scale down sysclk respectively +0h (R/W) = /1 +1h (R/W) = /2 +2h (R/W) = /4 +3h (R/W) = /6 +4h (R/W) = /8 +5h (R/W) = /10 +6h (R/W) = /12 +7h (R/W) = /14 + +For example, if you set CLKDIV = 3h and HSPCLKDIV= 2h Then +SYSCLKOUT will be divided by (1/8)(1/4). It means SYSCLKOUT/32 + +How to generate frequency ? + +freq = 1/Period + +TBPRD register is responsible to generate the frequency. These bits determine +the period of the time-base counter. + +By default TBCLK = SYSCLKOUT = 100 MHz + +Here by default period is 1/100MHz = 10 nsec + +Following example shows value to be loaded into TBPRD + +e.g. TBPRD = 1 = 1 count + count x Period = 1 x 1ns = 1ns + freq = 1/Period = 1 / 1ns = 100 MHz + +For duty cycle CMPA and CMPB are the responsible registers. + +To generate single with 50% Duty cycle & 100MHz freq. + + CMPA = count x Duty Cycle + = TBPRD x Duty Cycle + = 1 x 50/100 + = 0.2 + +The value in the active CMPA register is continuously compared to +the time-base counter (TBCNT). When the values are equal, the +counter-compare module generates a "time-base counter equal to +counter compare A" event. This event is sent to the action-qualifier +where it is qualified and converted it into one or more actions. +These actions can be applied to either the EPWMxA or the +EPWMxB output depending on the configuration of the AQCTLA and +AQCTLB registers. + +List of pins for that can be used for different PWM instance : + + ------------------------------------------------ + | EPWM2 | EPWM1 | EPWM0 | + ------------------------------------------------ + | BBB_P8_13_2B | BBB_P8_34_1B | BBB_P9_21_0B | + | BBB_P8_19_2A | BBB_P8_36_1A | BBB_P9_22_0A | + | BBB_P8_45_2A | BBB_P9_14_1A | BBB_P9_29_0B | + | BBB_P8_46_2B | BBB_P9_16_1B | BBB_P9_31_0A | + ------------------------------------------------ +BBB_P8_13_2B represents P8 Header , pin number 13 , 2nd PWM instance and B channel. + +Following sample program can be used to generate 7 Hz frequency. + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <rtems/test.h> +#include <bsp.h> +#include <bsp/gpio.h> +#include <stdio.h> +#include <stdlib.h> +#include <bsp/bbb-pwm.h> + +const char rtems_test_name[] = "Testing PWM driver"; +rtems_printer rtems_test_printer; + +static void inline delay_sec(int sec) +{ + rtems_task_wake_after(sec*rtems_clock_get_ticks_per_second()); +} + +rtems_task Init(rtems_task_argument argument); + +rtems_task Init( + rtems_task_argument ignored +) +{ + rtems_test_begin(); + printf("Starting PWM Testing"); + + /*Initialize GPIO pins in BBB*/ + rtems_gpio_initialize(); + + /* Set P9 Header , 21 Pin number , PWM B channel and 0 PWM instance to generate frequency*/ + beagle_epwm_pinmux_setup(BBB_P9_21_0B,BBB_PWMSS0); + +/** Initialize clock for PWM sub system + * Turn on time base clock for PWM o instance + */ + beagle_pwm_init(BBB_PWMSS0); + + float PWM_HZ = 7.0f ; /* 7 Hz */ + float duty_A = 20.0f ; /* 20% Duty cycle for PWM 0_A output */ + const float duty_B = 50.0f ; /* 50% Duty cycle for PWM 0_B output*/ + + /*Note: Always check whether pwmss clocks are enabled or not before configuring PWM*/ + bool is_running = beagle_pwmss_is_running(BBB_PWMSS2); + + if(is_running) { + + /*To analyse the two different duty cycle Output should be observed at P8_45 and P8_46 pin number */ + beagle_pwm_configure(BBB_PWMSS0, PWM_HZ ,duty_A , duty_B); + printf("PWM enable for 10s ....\n"); + + /*Set Up counter and enable pwm module */ + beagle_pwm_enable(BBB_PWMSS0); + delay_sec(10); + + /*freeze the counter and disable pwm module*/ + beagle_epwm_disable(BBB_PWMSS0); + } +} + +/* NOTICE: the clock driver is enabled */ +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM + +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_EXTRA_TASK_STACKS (2 * RTEMS_MINIMUM_STACK_SIZE) + +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION + +#define CONFIGURE_INIT +#include <rtems/confdefs.h> + diff --git a/bsps/arm/beagle/simscripts/bbxm.cfg b/bsps/arm/beagle/simscripts/bbxm.cfg new file mode 100644 index 0000000000..a5fe36cd01 --- /dev/null +++ b/bsps/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/bsps/arm/beagle/simscripts/gdbinit.bbxm b/bsps/arm/beagle/simscripts/gdbinit.bbxm new file mode 100644 index 0000000000..32ae9dd9ad --- /dev/null +++ b/bsps/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/bsps/arm/beagle/simscripts/qemu-beagleboard.in b/bsps/arm/beagle/simscripts/qemu-beagleboard.in new file mode 100644 index 0000000000..47c3bf489d --- /dev/null +++ b/bsps/arm/beagle/simscripts/qemu-beagleboard.in @@ -0,0 +1,63 @@ +# +# ARM/BeagleBoard Qemu Support +# + +bspUsesGDBSimulator="no" +# bspGeneratesGDBCommands="yes" +# bspSupportsGDBServerMode="yes" +runBSP=NOT_OVERRIDDEN +if [ ! -r ${runBSP} ] ; then + runBSP=qemu-system-arm +fi +bspNeedsDos2Unix="yes" +bspGeneratesDeviceTree="yes" +bspInputDevice=qemu-gumstix.cmds +bspTreeFile=qemu-gumstix.cmds +bspRedirectInput=yes + +runARGS() +{ +# qemu-system-arm -M connex -m 289 -nographic -monitor null -pflash connex-flash.img <cmds >log + + UBOOT=${HOME}/qemu/u-boot-connex-400-r1604.bin + FLASH=connex-flash.img + ( dd of=${FLASH} bs=128k count=128 if=/dev/zero ; + dd of=${FLASH} bs=128k conv=notrunc if=${UBOOT} ; + dd of=${FLASH} bs=1k conv=notrunc seek=4096 if=${1} ) >/dev/null 2>&1 + + if [ ${coverage} = yes ] ; then + rm -f trace ${1}.tra + COVERAGE_ARG="-trace ${1}.tra" + fi + + echo "-M connex -m 289 -nographic -monitor null \ + -pflash ${FLASH} ${COVERAGE_ARG}" +} + +checkBSPFaults() +{ + return 0 +} + +bspLimit() +{ + testname=$1 + case ${testname} in + *stackchk*)limit=5 ;; + *fatal*) limit=1 ;; + *minimum*) limit=1 ;; + *psxtime*) limit=180 ;; + *) limit=60 ;; + esac + echo ${limit} +} + +### Generate the commands we boot with +bspGenerateDeviceTree() +{ +cat >qemu-gumstix.cmds <<EOF + +bootelf 0x400000 + +EOF +} diff --git a/bsps/arm/beagle/simscripts/sdcard.sh b/bsps/arm/beagle/simscripts/sdcard.sh new file mode 100644 index 0000000000..83e3807cc7 --- /dev/null +++ b/bsps/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.12-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." |