Uboot success!

Published on: 2006-3-20

Home | Archive

Uboot success!

2006-03-20T09:38:00

Blackfin `uboot' will now boot my own application code! It seems uboot is running in supervisor mode; you can write a simple C program:

#define pFIO_FLAG_S ((unsigned short *)0xffc00708)
#define pFIO_FLAG_C ((unsigned short *)0xffc00704)
#define pFIO_DIR ((unsigned short *)0xffc00730)
start()
{
	// PF2 configured as output
	*pFIO_DIR |= (1 << 2);

	// PF2 low, LED is HIGH

	*pFIO_FLAG_C = (1 << 2);
	while(1);

}
and compile it without linking the standard libs: bfin-elf-gcc -nostdlib -Ttext=1000 os.c we are setting the address of _start to 1000; we will now load the code at 1000 from uboot:
tftp 0x1000000 a.out
bootelf 0x1000000
The LED on the board has lighted up!