Forum Discussion

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

Compiling assembly file to hex file

I am attempting to compile my source.s code into the hex file that will be placed in my system RAM. This must be done completely through the command line and I am having some problems. I am using the following commands in order.

nios2-bsp: This creates the BSP from the .sopcinfo file

nios2-app-generate-makefile : This generates the make file from the source code

make all: Compile the make file and generate the .elf file

elf2hex: This converts the elf file to the hex file

Now, I am running into problems when I run the make all. It appears that the src file (named "code_name" below) is not able to be compiled into the .o file that is required later on in the build process. I am left with the following error:

Assembler messages:

Fatal error: can't create obj/default//C/Users/..../code_name.o: No such file or directory

make: *** [obj/default//C/Users/..../code_name.o] Error 1

The directory exists, but the file does not. Has anyone succesfully created their .hex file for their ram from simply their source code, and the .sopcinfo file using the command line?!?!

Thanks

9 Replies

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

    Anyone? I am sure this is able to be done rather easily outside of the GUI.

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

    Try "make mem_init_generate" after running make all. Is should create a mem_init folder and your hex will contain in it.

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

    Mike,

    I am getting the following error when I run make all. I need to run make all before I can make mem_init_generate.

    Fatal error: can't create obj/default//C/Users/mattmaur/Desktop/sel2740s_mainboa

    rd_SEPARTE_QSYS/sel2740x/rtl/sel2740s_mainboard/sel2740s_mainboard_top/syn/softw

    are/nios_sw/main.o: No such file or directory

    make: *** [obj/default//C/Users/mattmaur/Desktop/sel2740s_mainboard_SEPARTE_QSYS

    /sel2740x/rtl/sel2740s_mainboard/sel2740s_mainboard_top/syn/software/nios_sw/mai

    n.o] Error 1

    make: Leaving directory `C:/Users/mattmaur/Desktop/sel2740s_mainboard_SEPARTE_QS

    YS/sel2740x/rtl/sel2740s_mainboard/sel2740s_mainboard_top/syn/software/nios_sw'
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I do not understand why main.o is getting created at the above directory. It should go to obj/default, not obj/default//"My_Full_Project_Path"

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

    Check the generated Makefile. Do install cygwin?

    How did you generate the Makefile at the first place? Using eclipse or command line?

    You can try using the Nios II command shell.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Cygwin is included in the nios command line tools I believe. I generated the Makefile using nios2-app-generate-makefile.

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

    This problem has been solved.

    I believe the problem came from my path length being too long. When the assembler creates the main.o file, is is placed under your obj/default folder in which the whole directory is created again. It follows this format.

    MY_DIR/project_folder/obj/fefault/MY_DIR/project_folder/main.o

    As you can imagine, this path length can get rather long. My guess is it exceeded the maximum allowed by the Nios Cygwin build tools.

    Simply making my MY_DIR path less levels solved this issue.

    -Matt