Skip to main content.
Navigation:
DENX
>
DULG
>
UBootStandalone
Translations:
Edit
|
Attach
|
Raw
|
Ref-By
|
Printable
|
More
DULG
Sections of this site:
DENX Home
|
DULG
|
ELDK-5
|
Know
|
Training
|
U-Boot
|
U-Bootdoc
Topics
DULG Home
BoardSelect
Manual
FAQ
Application Notes
Changes
Index
List of pages in DULG
Search
%SECTION0{name=UBootStandalone}% U-Boot Standalone Applications U-Boot supports "standalone" applications, which are loaded dynamically; these applications can have access to the U-Boot console I/O functions, memory allocation and interrupt services. A couple of simple examples are included with the U-Boot source code: %SECTION1{name=UBootDemoHello}% "Hello World" Demo _examples/hello_world.c_ contains a small "Hello World" Demo application; it is automatically compiled when you build U-Boot. It's configured to run at address 0x00040004, so you can play with it like that: <pre> %UBOOT_PROMPT% loads ## Ready for S-Record download ... ~>examples/hello_world.srec 1 2 3 4 5 6 7 8 9 10 11 ... [file transfer complete] [connected] ## Start Addr = 0x00040004 %UBOOT_PROMPT% go 40004 Hello World! This is a test. ## Starting application at 0x00040004 ... Hello World argc = 7 argv[0] = "40004" argv[1] = "Hello" argv[2] = "World!" argv[3] = "This" argv[4] = "is" argv[5] = "a" argv[6] = "test." argv[7] = "<NULL>" Hit any key to exit ... ## Application terminated, rc = 0x0 </pre> Alternatively, you can of course use =TFTP= to download the image over the network. In this case the binary image (=hello_world.bin=) is used. %T% Note that the entry point of the program is at offset 0x0004 from the start of file, i. e. the download address and the entry point address differ by four bytes. <pre> %UBOOT_PROMPT% tftp 40000 /tftpboot/hello_world.bin ... %UBOOT_PROMPT% go 40004 This is another test. ## Starting application at 0x00040004 ... Hello World argc = 5 argv[0] = "40004" argv[1] = "This" argv[2] = "is" argv[3] = "another" argv[4] = "test." argv[5] = "<NULL>" Hit any key to exit ... ## Application terminated, rc = 0x0 </pre> %SECTION1{name=UBootDemoTimer}% Timer Demo %X% This example is only available on MPC8xx CPUs. %IF{ "%ARCHITECTURE%" eq "powerpc" }% %T% This example, which demonstrates how to register a CPM interrupt handler with the U-Boot code, can be found in _examples/timer.c_. Here, a CPM timer is set up to generate an interrupt every second. The interrupt service routine is trivial, just printing a '.' character, but this is just a demo program. The application can be controlled by the following keys: <pre> ? - print current values of the CPM Timer registers b - enable interrupts and start timer e - stop timer and disable interrupts q - quit application %UBOOT_PROMPT% loads ## Ready for S-Record download ... ~>examples/timer.srec 1 2 3 4 5 6 7 8 9 10 11 ... [file transfer complete] [connected] ## Start Addr = 0x00040004 %UBOOT_PROMPT% go 40004 ## Starting application at 0x00040004 ... TIMERS=0xfff00980 Using timer 1 tgcr @ 0xfff00980, tmr @ 0xfff00990, trr @ 0xfff00994, tcr @ 0xfff00998, tcn @ 0xfff0099c, ter @ 0xfff009b0 Hit 'b': [q, b, e, ?] Set interval 1000000 us Enabling timer Hit '?': [q, b, e, ?] ........ tgcr=0x1, tmr=0xff1c, trr=0x3d09, tcr=0x0, tcn=0xef6, ter=0x0 Hit '?': [q, b, e, ?] . tgcr=0x1, tmr=0xff1c, trr=0x3d09, tcr=0x0, tcn=0x2ad4, ter=0x0 Hit '?': [q, b, e, ?] . tgcr=0x1, tmr=0xff1c, trr=0x3d09, tcr=0x0, tcn=0x1efc, ter=0x0 Hit '?': [q, b, e, ?] . tgcr=0x1, tmr=0xff1c, trr=0x3d09, tcr=0x0, tcn=0x169d, ter=0x0 Hit 'e': [q, b, e, ?] ...Stopping timer Hit 'q': [q, b, e, ?] ## Application terminated, rc = 0x0 </pre> %ENDIF%
5.11. U-Boot Scripting Capabilities
1. Abstract
5.13. U-Boot Image Formats
Prev
Home
Next