Forum Discussion
uClinux 20100621 - conneting NIOS HW with linux
Hi
I can not connect NIOS hardware with uClinux kernel. I successfully did it when uClinux support make vendor_hwselect. But when I have to build my custom header file with command sopc-create-header-files --single my_nios2_fpga.h I dont't know where exactly put it and how to configure make menuconfig. This is happen with new kernel like 2010062121 Replies
- Altera_Forum
Honored Contributor
seems the download process tries to download the image to the tigthly coupled memory.
Please check this: arch/nios2/kernel/vmlinux.lds.S: . = DDR2_TOP_BASE | KERNEL_REGION_BASE; This means that the image will be built to load at the DDR2_TOP_BASE in my desing. Try to bring it to the ddr_sdram. You may also check nios.h - Altera_Forum
Honored Contributor
When I compile the kernel I see something like this:
UIMAGE arch/nios2/boot/vmImage Image Name: Linux-2.6.34-00692-g5bc7853-dirt Created: Fri Mar 25 12:05:26 2011 Image Type: NIOS II Linux Kernel Image (gzip compressed) Data Size: 1187727 Bytes = 1159.89 kB = 1.13 MB Load Address: 0xC0800000 Entry Point: 0xC0800000 Kernel: arch/nios2/boot/vmImage is ready Load address is 0xC0800000 But when try download image the load address is different : ios2-download -g images/zImage Using cable "USB-Blaster [USB 1-1.3.3]", device 1, instance 0x00 Pausing target processor: OK Initializing CPU cache (if present) OK Downloaded 3529KB in 19.3s (182.8KB/s) Verifying C1800000 ( 0%) Verify failed between address 0xC1800000 and 0xC180FFFF Leaving target processor paused He's trying load to address C1800000. Why? :( Addresses are: # define RESET_ADDR 0xc0800000 # define FAST_TLB_MISS_EXCEPTION_ADDR 0xc1800000 Is my nios_sopc bad created? arch/nios2/kernel/vmlinux.lds.S: . = DDR2_TOP_BASE | KERNEL_REGION_BASE; @gabrigob: I have the same. in nios.h I have: # if defined(CONFIG_NIOS2_MMU) # include <asm/default_mmu.h> /* Added compability mode with macro names from "old" design... * FIXME: we should really fix drivers instead. but this makes it * easier to switch between old and new design... */ # define CONFIG_ALTERA_CYCLONE_II # define DDR2_TOP_BASE DDR_SDRAM_BASE # define DDR2_TOP_SPAN DDR_SDRAM_SPAN # define EXT_FLASH_BASE FLASH_BASE # define EXT_FLASH_SPAN FLASH_SPAN # define TIMER_1MS_FREQ SYS_CLK_TIMER_FREQ # define TIMER_1MS_BASE SYS_CLK_TIMER_BASE # define TIMER_1MS_SPAN SYS_CLK_TIMER_SPAN # define TIMER_1MS_IRQ SYS_CLK_TIMER_IRQ # else # error "No FPGA configuration selected" # endif - Altera_Forum
Honored Contributor
Sorry, the thing I told you are working for me but in you situation I am confused as you are. If somethings comes out of my memory, I'll tell you.
- Altera_Forum
Honored Contributor
I found where is the problem. Here it is: http://www.alterawiki.com/wiki/linux_config
"The zImage load address is ( your sdram base address + link address offset ). The boot loader will uncompress the code to the beginning of sdram. If the uncompressed code is bigger than the default 5M, the two area will overlap and corrupt. The compressed image offset should be adjusted to a higher value when the kernel image is big, eg, large files in romfs dir. You can change this value to about 2/3 of the size of your sdram, eg, 20M out fo 32M. I suggest 2/3 because the gzip compression ratio is about 1:2. The zImage boot loader does not relocate/move itself." In Kernel Settings I can set the offset value. My kernel size is: 3529KB. My sdram is 8MB only. Addresses are: 0x00800000 - 0x00FFFFFF I gave the biggest offset I could: 0x00480000 to make a space for uncompressed kernel but it is still to few:( I have to make the kernel smaller. This is how it looks like: nios2-download -g images/zImage Using cable "USB-Blaster [USB 1-1.3.3]", device 1, instance 0x00 Pausing target processor: OK Initializing CPU cache (if present) OK Downloaded 3529KB in 19.5s (180.9KB/s) Verified OK Starting processor at address 0xC0C80000 In nios2-terminal: nios2-terminal: connected to hardware target using JTAG UART on cable nios2-terminal: "USB-Blaster [USB 1-1.3.3]", device 1, instance 0 nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate) Uncompressing Linux... And silence.. Wenn offset is smaller: Uncompressing Linux... �▒��� In my case two area overlap and corrupt. - Altera_Forum
Honored Contributor
good you've found the offset, I completely forgot about it. To deflate the image dimension, try eliminating some applets/applications from Library/Application settings.
- Altera_Forum
Honored Contributor
A thing you may omit (if you undestand how, at the moment I couldn't) is the libstdc++.so if you don't need c++ is about 800K uncompressed. Deflating the image would also help you with the oom_killer in the other thread you opened.
The oom_killer is someone who takes care of freeing memory for the kernel by means od killing the other processes. If there are no processes to kill the system will run out of memory. - Altera_Forum
Honored Contributor
Do you think if I would have bigger sdram memory i.e. 16MB it would help?
- Altera_Forum
Honored Contributor
Reducing the things in the intiramfs would also help (without changing the memory). I use a board with a bigger memory chip and a kernel image as big as your and I boot. I have problems with FTP server but this is another matter.
- Altera_Forum
Honored Contributor
Hi Texblues,
the problem could be due to different things. One thing you should definitely check is the setting "optimize for size" in "menuconfig". You mustn't turn on this option. My Board didn't start at all with this setting on. 8MB of SDRAM should be enough. I have also 8MB and my uncompressed image is about 3MB. But as I see your compressed image is that big. I don't know how you made it so big. But this is probably not the problem. Have you checked the uncompressed image "vmlinux". It is located in uClinux-dist/linux-2.6.x/. If this image works than it is likely a problem with the offset. Apart from that your problem could be the "optimize for size" setting. Urmel - Altera_Forum
Honored Contributor
I did not have the "optimize for size" set. Actually I changed board to de2-70 with more memory and now I can boot. Now I try to learn how can I use PIO from linux. I created new topic about that. Maybe You can help me or show the way. Thanks for replay