[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] Hello World



Hi Shamus,

Shamus McCarthy wrote:

> Did you use the same MAKEFILE from the wiki?  

Yes

> Did you type "make
> hello" and then just execute the binary?  Any chance you could attach
> a copy of the compiled binary (and maybe your makefile and
> hello_world.c)?

Sure.   Attached are a makefile and a trivial C program that I was using 
yesterday to test the timekeeping stuff.

Just put them in a directory, run 'make timetest', then copy the 
timetest executable to somewhere that it can be accessed by your 
microblaze board (via an NFS mount or whatever).  Then you should be 
able to just run it with ./timetest or whatever.

You must ensure that the uClinux-dist that is pointed to by the 
makefile, has to be "current", and properly configured etc.  I think 
Yashi explains this in his instructions on the OutOfTree compile Wiki page.

Cheers,

John

ifndef ROOTDIR
ROOTDIR=/mnt/home2/jwilliam2/uClinux-dist
endif

UCLINUX_BUILD_USER = 1
include $(ROOTDIR)/.config
LIBCDIR = $(CONFIG_LIBCDIR)
include $(ROOTDIR)/config.arch

HELLO = timetest
HELLO_OBJS = timetest.o

all: $(HELLO)

$(HELLO): $(HELLO_OBJS)
	$(CC) $(LDFLAGS) -o $@ $(HELLO_OBJS) $(LDLIBS)

clean:
	-rm -f $(HELLO) *.elf *.gdb *.o

%.o: %.c
	$(CC) -c $(CFLAGS) -o $@ $<

#include <stdio.h>
#include <sys/time.h>


int main(void)
{
	struct timeval tv;
	while(1)
	{
		gettimeofday(&tv, NULL);
		printf("%li.%06li\n",tv.tv_sec, tv.tv_usec); 
	}
}