Do you have a question? Post it now! No Registration Necessary
Subject
- Posted on
How to run a "Hello world" on ppc board?
- 04-07-2004
April 7, 2004, 6:07 am

I am using ppc 405gp and monta vista. How to make a simple "Hello
world" C program so that boot loader can load it and run it in RAM?
The boot loader already has serial port enabled. I will be happy if I
can see the string output on the serial monitor (I am using minicom).
Is this kind of program considered running in kernel space or user
space? Should I use printf or printk? Could anyone give some detailed
compile and link commands?
Thanks!
world" C program so that boot loader can load it and run it in RAM?
The boot loader already has serial port enabled. I will be happy if I
can see the string output on the serial monitor (I am using minicom).
Is this kind of program considered running in kernel space or user
space? Should I use printf or printk? Could anyone give some detailed
compile and link commands?
Thanks!

Re: How to run a "Hello world" on ppc board?

if your serial-device on your ppc would be /dev/ttyS0 then try
/../MyHelloWorld 2>%1 >/dev/ttyS0
in your startup script.
May by you have to set the right baudrate eg. first.
You could also open and configure the device from whithin your programm
const char msg[] = {"\nHallo luna.\n"};
int main(int argc, char** argv, char** envp)
{
int tty=open("/dev/ttYS0",.....
// setup the term by ioctl if needed
write(tty,msg, sizeof(msg));
close(tty);
return main(0,"","");
}
mfg j.
--
Alle in diesem Text gemachte Rechtschreibfehler sind geistiges Eigentum des
Autors. Wer diese Rechtschreibfehler nachmacht oder verfälscht, kann mit
Alle in diesem Text gemachte Rechtschreibfehler sind geistiges Eigentum des
Autors. Wer diese Rechtschreibfehler nachmacht oder verfälscht, kann mit
We've slightly trimmed the long signature. Click to see the full one.

Re: How to run a "Hello world" on ppc board?

Read the manuals that come with MontaVista's distribution, and get the board
to boot the MontaVista kernel via TFTP and NFS. You can then cross-compile a
test program, put it in the NFS exported directory on your host, and either
use ssh or a serial terminal (minicom) to log in and run the program.
Blane.

Re: How to run a "Hello world" on ppc board?
running on my board yet. The board has only a boot loader. The boot
loader has TFTP and serial port enabled. I am wondering if I can run a
program _before_ I load the linux kernel? In another word, can I use
the boot loader to load a C program and send some data to serial port
so that I can monitor it through minicom?
Thanks,
Frank


Re: How to run a "Hello world" on ppc board?
snipped-for-privacy@yahoo.com (Frank) writes:

You must provide more details. Which boot loader, for example?
Some of them, like U-Boot for example, allow you to use "standalone
applications" which can use services provided by the boot loader,
like standard functions as printf() etc.
Other boot loaders don't provide any interface to their builtin
drivers, so you will probably end up re-coding your own serial driver
if you need console output.
Also, there may be a C runtime environment, or there may be not.
I cannot even guess without precise information.
Best regards,
Wolfgang Denk

You must provide more details. Which boot loader, for example?
Some of them, like U-Boot for example, allow you to use "standalone
applications" which can use services provided by the boot loader,
like standard functions as printf() etc.
Other boot loaders don't provide any interface to their builtin
drivers, so you will probably end up re-coding your own serial driver
if you need console output.
Also, there may be a C runtime environment, or there may be not.
I cannot even guess without precise information.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Web: www.denx.de
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Web: www.denx.de
We've slightly trimmed the long signature. Click to see the full one.

Re: How to run a "Hello world" on ppc board?
the last project. I just don't have a way to update the boot loader in
flash, so I just use as it is.
Does vxworks boot loader provide console output interface?
Thanks,
Frank


Re: How to run a "Hello world" on ppc board?
The short answer to your question is "No". The VxWorks boot loader is
intended to load an entire executable OS. You use the loader to load the
OS, (commonly referred to as a BSP), then you can use the tornado
development suite to give you an interface, or you can interact directly
with a shell, if the BSP was built with one. The loader tpyically has
a few built-in commands, but it cannot link new programs into itself.
Speaking only for myself,
Joe Durusau
Frank wrote:

intended to load an entire executable OS. You use the loader to load the
OS, (commonly referred to as a BSP), then you can use the tornado
development suite to give you an interface, or you can interact directly
with a shell, if the BSP was built with one. The loader tpyically has
a few built-in commands, but it cannot link new programs into itself.
Speaking only for myself,
Joe Durusau
Frank wrote:

Site Timeline
- » How to create /dev/log ?
- — Next thread in » Embedded Linux
-
- » Build U-Boot with soft floating point - help!
- — Previous thread in » Embedded Linux
-
- » Crosscompiling for ARM: reloc type R_ARM_ABS32 is not supported for PIC - ...
- — Newest thread in » Embedded Linux
-
- » Processor choice
- — The site's Newest Thread. Posted in » Electronics Design
-
- » Low Noise Direct Coupled Preamp
- — The site's Last Updated Thread. Posted in » Electronics Design
-