I am starting kernel or operating system programming for beaglebone with TI - AM3359 SoC. I have written an assembly program to write some characters to the serial interface
I have written an assembly program to write some characters to the serial interface (just to start off with) and i want to run this as kernel on beaglebone, just like linux kernel.
What you have written is called a "standalone program". It does not require any external code to operate, compared to an application program that depends on an OS for resources and services. You should not call it a kernel (not yet anyway), since it does not have any of the capabilities that a kernel should have.
what is the linking address for my program?
Note: For a typical standalone program, "load address" and "linking address" are often the same value, since standalone code is typically not relocatable or position independent.
U-Boot is typically linked, loaded and executed in upper physical main memory.
The Linux kernel is typically linked to execute at the start of physical main memory + 0x8000 (for ARM anyway). But the kernel image, especially if it's a compressed file such as zImage or uImage, is typically loaded into memory at a higher address, and the decompression routine installs the Linux kernel at its proper load & start address.
So any "nice" address in low physical main memory is suitable to link and load your program.
How to boot it from u-boot by default?
U-Boot can transfer execution to two types of "programs" (as well as scripts).
One type of program is a "kernel" that uses the bootm command.
This is for a kernel or program that has a header installed by the mkimage utility, that is fully self-contained, and will take over the system. U-Boot can be customized to prepare the system for this kernel. For Linux a memory buffer is allocated, initialized with user-defined text and passed on to the Linux kernel as the kernel command line. For ARM Linux, another memory buffer is allocated, initialized with data and passed on to the ARM Linux kernel as ATAGs.
The other type of program uses the go command.
This is for a simpler program that can use U-Boot's service functions and maybe even return control back to U-Boot when done. If buffer preparations are not required, then your simple stand-alone program should use the go
command.
You can use either command in your definition of the bootcmd
environment variable, which is the variable that is run/executed when the boot timer expires.
You can create the boot.bin with fsbl, bitstream, uboot.elf and you applications. Then flash in the QSPI flash and choose to boot from it.
Or you can boot from TFTP. Here you need to create the boot.bin just with fsb, bitstream, and uboot.elf. You need the change the uboot header file to force it boot from tftp like tftpboot 0x0 hello.elf; bootelf 0x0;. Once booted it will grab the elf/bin file with tftp and boot the board with bootelf or go command.
The same you can boot from SD card if there is one.