Hi,
--- Quote Start ---
What do you meant by genuine Linux with MMU?
I did followed the link below to build the hardware architechture in QSYS:
https://www.youtube.com/watch?v=rxlyezof0rs The uClinux dist that I used is downloaded from the link below:
ftp://ftp.altera.com/outgoing/nios2-linux/20120802/ --- Quote End ---
There are two kinds of Linux kernel. One is using MMU and I sometimes call it 'genuine Linux'. Another can be executed in a small CPU which has no MMU and it's called 'uClinux'. uClinux has excellent features e.g. it does not require much memories, but also it has some disadvantages e.g. we can't use 'bash' on it. If you are using Nios's MMU, it's OK. no problem.
--- Quote Start ---
and what is the difference between nios2-linux-gnu-gcc an nios2-linux-uclibc-gcc command?
I refer to many resources, but some use nios2-linux-gnu-gcc and some use nios2-linux-uclibc-gcc to compile the program.
Then flat format file created will be put into ~/uClinux-dist/romfs/bin before make image.
--- Quote End ---
So you are using the Linux with MMU, you should use the tools in the folder 'nios2-linux-toolchain-mmu-***'.
--- Quote Start ---
However, it still gives these error. I have searched online for the solution. Maybe the project is not linked to the library.
Then I tried to set some path to LD_LIBRARY_PATH. However, the error still there.
I think I didn't set the correct library path.
Do you know where should the library path of SD controller located? Will it be in the Project or Project_BSP folder?
Or actually it's due to other problem?
mun@ubuntu:~/Hello$ nios2-linux-gnu-gcc hello_world.c -o hello
hello_world.c: In function 'main':
hello_world.c:40: warning: incompatible implicit declaration of built-in function 'calloc'
hello_world.c:40: warning: initialization from incompatible pointer type
/tmp/cc7uxjmj.o: In function `main':
hello_world.c:(.text+0x1e8): undefined reference to `sd_set_clock_to_max'
hello_world.c:(.text+0x1f4): undefined reference to `sd_fat_mount_all'
hello_world.c:(.text+0x310): undefined reference to `_impure_ptr'
hello_world.c:(.text+0x314): undefined reference to `_impure_ptr'
hello_world.c:(.text+0x368): undefined reference to `alt_up_char_buffer_open_dev'
hello_world.c:(.text+0x374): undefined reference to `alt_up_char_buffer_init'
hello_world.c:(.text+0x37c): undefined reference to `alt_up_char_buffer_clear'
hello_world.c:(.text+0x450): undefined reference to `alt_up_char_buffer_string'
hello_world.c:(.text+0x464): undefined reference to `alt_up_char_buffer_string'
hello_world.c:(.text+0x478): undefined reference to `alt_up_char_buffer_string'
hello_world.c:(.text+0x71c): undefined reference to `alt_up_char_buffer_draw'
hello_world.c:(.text+0x75c): undefined reference to `alt_up_char_buffer_string'
collect2: ld returned 1 exit status
--- Quote End ---
Maybe, you are misunderstanding the feature of operating systems. The functions 'alt_up_char_buffer_***' are Altera's library functions and you can't use those in your Linux system. Moreover, you can't access the registers directly from the user-land. So If you execute the code
//Switches
a = IORD(SWITCHES_BASE,0);
the kernel will evoke a fault and stop your application.
Kazu