Patchwork [U-Boot] add more function in hello_world.c for standalone application

login
register
mail settings
Submitter Kassey Lee
Date Aug. 2, 2012, 7:16 a.m.
Message ID <CAKwPUozgoKv65xP-6m_U-4H+JL1hiBdktv7hKb6pbV7PiX0_vQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/174686/
State Not Applicable
Headers show

Comments

Kassey Lee - Aug. 2, 2012, 7:16 a.m.
hi, Wolfgang:

             I've tried the examples/standalone/hello_world.c, it
works on my platform!
             but when i add more functions in
examples/standalone/hello_world.c, for example
             it will take the test function as the entry, but ignore
the hello_world ? can i have more than one functions in a standalone
application C source code ? thanks
             and what's more, can we use IRQ on arm platform for
standalone application that is already supported by u-boot?



here is the log:


U-Boot 2011.12-00889-g7a0eac3-dirty (Aug 02 2012 - 22:36:53)

DRAM:  64 MiB
WARNING: Caches not enabled
NAND:  256 MiB
MMC:   SDHCI: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
[test] loadb 0x81000000
## Ready for binary (kermit) download to 0x81000000 at 115200 bps...
## Total Size      = 0x0000027f = 639 Bytes
## Start Addr      = 0x81000000
[test] go 0x81000000
## Starting application at 0x81000000 ...
 this is a test 1
## Application terminated, rc = 0x13
Wolfgang Denk - Aug. 2, 2012, 7:16 p.m.
Dear Kassey Lee,

In message <CAKwPUozgoKv65xP-6m_U-4H+JL1hiBdktv7hKb6pbV7PiX0_vQ@mail.gmail.com> you wrote:
> 
>              I've tried the examples/standalone/hello_world.c, it
> works on my platform!

Good.

>              but when i add more functions in
> examples/standalone/hello_world.c, for example
>              it will take the test function as the entry, but ignore
> the hello_world ? can i have more than one functions in a standalone
> application C source code ? thanks

You can have as many functions as you like, but there is usually only
one entry point.  Also, please pay attention on the documented,
mandatory entry sequence (including using app_startup() ).

>              and what's more, can we use IRQ on arm platform for
> standalone application that is already supported by u-boot?

The infrastructure is in place, so it should be possible, but I think
not all ARM systems actually implement interrupt support, so please
checn the architecture specific code for your CPU.

Best regards,

Wolfgang Denk

Patch

diff --git a/examples/standalone/hello_world.c
b/examples/standalone/hello_world.c
index 067c390..226ddef 100644
--- a/examples/standalone/hello_world.c
+++ b/examples/standalone/hello_world.c
@@ -24,6 +24,11 @@ 
 #include <common.h>
 #include <exports.h>

+void test(int i)
+{
+       printf(" this is a test %d \n", i);
+}
+
 int hello_world (int argc, char * const argv[])
 {
        int i;