Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

Linux executable

Hi people

How can I with the IDE make an executable??? I have my linux kernel up and running and now I want to startup an app.

Have tried using nios2-elf-objcopy but can't really get a exe out of that one.

Hope you can help me out here.

Regards

GreateWhite.DK

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi GreateWhite.DK,

    If you can find the source of the userland applications provided by the Microtronix installation, you will see a lot of examples there (under the directory user).

    Baiscally you need to link all your .o files into a .bin file:

    nios2-elf-gcc -msys-crt0=$(uClibc-CRT0) -r -d -o app.bin m1.o m2.o m3.o $(LDLIBS)

    Then use the linking script provided by microtronix:

    nios2-elf-ld -T elf2flt.ld -Ur -o app.elf app.bin

    At last convert app.elf to FLT format:

    elf2flt -s 16000 -o app.flt app.elf

    These steps are quite confusing, but if you can find and use the rules.mak Microtronix provided in the user applications, all you need to do is some lines in the app Makefile:

    include Rules.mak

    all: app.flt

    app.bin: m1.o m2.o m3.o

    Good luck,
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi

    Thanx wentao for that answer, I had the same problem of compiling objects into the main executable with a makefile and couldn't seem to find a solution.