loading a u-boot standalone application from sd card (xm)

Hello, i have been trying to compile and load a standalone application for uboot(i would like to develop an operating system to run on the beagleboard, so booting any custom code would be acceptable, but the easiest way to start out seemed to be the standalone application). i have a short assembler program to print “!” to the serial port of the beagleboard xm rev c. I got it off of osdev.org because i could not find the address of the serial port anywhere else. the code is as follows:

#UART base locations from the TRM
.equ UART1.BASE, 0x4806A000
.equ UART2.BASE, 0x4806C000
#According to the Beagleboard-xM System Reference Manual, UART3 is connected to the serial port.


.equ UART3.BASE, 0x49020000


.equ UART4.BASE, 0x49042000

#We need to be in ARM mode - we may branch to Thumb mode later if desired.

Thankfully, U-BOOT already sets up serial for us, so we don’t need to do all the reset crap.

Just print a ‘!’ symbol to the screen, and hang.

Load the location of the transmit register (THR_REG) into r0. It’s at the UARTx.BASE, since it is offset 0x000.

(load value pointed by the assembler (immediate pointer) into r0)

ldr r0,=UART3.BASE

Move a ‘!’ character into r1

(move a character, ‘!’, which is immediate, into r1)

mov r1,#’!’

According to the TRM, we may only write bytes into THR_REG, else we’ll corrupt stuff.

(store the least-significant-byte of r1 into the address pointed by r0)

strb r1,[r0]

If we kept writing to the serial port, we’d eventually overflow the 64-byte FIFO, and since we don’t handle interrupts yet, we’ll hang (?)

In ASM, labels are like case: statements in C. Code flows into them as if they don’t exist - because they don’t.


(branch (jump, JMP) to _hang)

b _hang

then i have a linker script:

/* rammap */
ram : ORIGIN = 0x80200000, LENGTH = 0x10000

.startup . : { boot.o(.text) }
.text : { (.text) } > ram

and compile using codesourcery:
./arm-none-linux-gnueabi-as -mcpu=cortex-a8 boot.asm -o boot.o
./arm-none-linux-gnueabi-ld -T linker.ld boot.o -o boot.elf
./arm-none-linux-gnueabi-objcopy boot.elf -O binary boot.bin

and then use mkimage to make uImage:
mkimage -A arm -O u-boot -T standalone -C none -a 0x80200000 -e 0x80200000 -n “beagleos” -d ./boot.bin ./uImage

I then put uimage in the boot folder of an angstrom formatted sd card with the following uenv.txt:

bootargs=console=${console} ${optargs} mpurate=${mpurate} buddy=${buddy} camera=${camera} vram=${vram} omapfb.mode=tv:ntsc omapdss.def_disp=${defaultdisplay} root=${mmcroot} rootfstype=${mmcrootfstype} omapdss.tvcable=composite
uenvcmd= mmc init; fatload mmc 0:1 0x80200000 uImage; go 0x80200000

Everything appears to load correctly but i never get the “!”. Can anyone help me figure out how to get this working? Thank you for any help! if you need more information just ask.