Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12748 Discussions

Design with MMU and on my de2 board

Altera_Forum
Honored Contributor II
1,418 Views

I build a design with MMU and tried it on my de2 board. 

 

When I compile uclinux for my hardware platform I encounter different problems. First I make a board definition for my de2. 

 

In folder: nios2-linux\linux-2.6\arch\nios2\boards\my_de2 

 

See http://www.nioswiki.com/linux/creating_a_nios_ii_design_with_an_mmu for more information. 

 

I had to change /nios2-linux/linux-2.6/arch/nios2/boards/my_nios2/include/asm/nios.h 

 

I added: 

# elif defined(CONFIG_MY_DE2_FPGA)# include <asm/my_nios2_fpga.h> # define CONFIG_ALTERA_DE2# define DDR2_TOP_BASE SDRAM_BASE# define DDR2_TOP_SPAN SDRAM_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# define EXT_FLASH_BASE CFI_FLASH_BASE# define EXT_FLASH_SPAN CFI_FLASH_SPAN# define na_lcd_16207_0 LCD_16207_0_BASE For example SDRAM_BASE is found in <asm/my_nios2_fpga.h>. The my_nios2_fpga.h is generated with "sopc-create-header-files --single my_nios2_fpga.h" 

 

After the changes the kernel compiled. 

 

But when I download the zImage and start the nios2-terminal no response of the nios. See below: 

 

/$ ll -h total 35M -rw-r--r-- 1 roy mkpasswd 549K Aug 13 15:15 System.map.initramfs.gz -rw-r--r-- 1 roy mkpasswd 5.5M Aug 13 15:15 linux.initramfs.gz -rw-r--r-- 1 roy mkpasswd 5.8M Aug 13 15:14 rootfs.initramfs -rw-r--r-- 1 roy mkpasswd 13K Aug 13 15:14 rootfs.initramfs.contents -rw-r--r-- 1 roy mkpasswd 2.4M Aug 13 15:14 rootfs.initramfs.gz -rw-r--r-- 1 roy mkpasswd 3.2M Aug 13 15:14 rootfs.jffs2 -rw-r--r-- 1 roy mkpasswd 1.2M Aug 13 15:14 vmImage -rw-r--r-- 1 roy mkpasswd 3.2M Aug 13 15:14 vmlinux -rw-r--r-- 1 roy mkpasswd 3.5M Aug 13 15:15 zImage -rw-r--r-- 1 roy mkpasswd 3.5M Aug 13 15:15 zImage.initramfs.gz /cygdrive/y/uclinux/nios2-linux/uClinux-dist/images $ nios2-download -g zImage.initramfs.gz Using cable "USB-Blaster ", device 1, instance 0x00 Pausing target processor: OK Initializing CPU cache (if present) OK Downloaded 3560KB in 61.3s (58.0KB/s) Verified OK Starting processor at address 0xD0500000 /cygdrive/y/uclinux/nios2-linux/uClinux-dist/images $ nios2-terminal nios2-terminal: connected to hardware target using JTAG UART on cable nios2-terminal: "USB-Blaster ", device 1, instance 0 nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate) Uncompressing Linux... ERROR ran out of input data -- System halted Loading is stopped add "Uncompressing Linux..." 

 

I followed the instructions on http://www.alteraforum.com/forum/showthread.php?t=24359&highlight=link+address+offset To set the link address offset to 0x00500000 

 

The SDRAM is 8MB and the base address is 0x10000000. The file size of the zImage is 3.5M. therefor I thought it should work now. 

 

maybe someone has an idea what the problem might be. 

 

 

See below for MM of the nios2 system: 

# define SDRAM_BASE 0x10000000# define SDRAM_SPAN 8388608# define SDRAM_END 0x107fffff 

# define CFI_FLASH_BASE 0x0# define CFI_FLASH_SPAN 4194304# define CFI_FLASH_END 0x3fffff 

# define ONCHIP_MEMORY2_0_BASE 0x401000# define ONCHIP_MEMORY2_0_SPAN 1024 

# define SYS_CLK_TIMER_BASE 0x3000000# define SYS_CLK_TIMER_SPAN 32 

# define MMC_SPI_BASE 0x3000020# define MMC_SPI_SPAN 32 

# define UART_BASE 0x3000040# define UART_SPAN 32 

# define CPU_IMPLEMENTATION "fast"# define BIG_ENDIAN 0# define CPU_FREQ 100000000# define ICACHE_LINE_SIZE 32# define ICACHE_LINE_SIZE_LOG2 5# define ICACHE_SIZE 4096# define DCACHE_LINE_SIZE 32# define DCACHE_LINE_SIZE_LOG2 5# define DCACHE_SIZE 2048# define INITDA_SUPPORTED# define FLUSHDA_SUPPORTED# define HAS_JMPI_INSTRUCTION# define MMU_PRESENT# define KERNEL_REGION_BASE 0xc0000000# define IO_REGION_BASE 0xe0000000# define KERNEL_MMU_REGION_BASE 0x80000000# define USER_REGION_BASE 0x0# define PROCESS_ID_NUM_BITS 8# define TLB_NUM_WAYS 16# define TLB_NUM_WAYS_LOG2 4# define TLB_PTR_SZ 7# define TLB_NUM_ENTRIES 128# define FAST_TLB_MISS_EXCEPTION_ADDR 0xc0401000# define EXCEPTION_ADDR 0xd0000020# define RESET_ADDR 0xc0000000# define BREAK_ADDR 0xc0400820# define HAS_DEBUG_STUB# define HAS_DEBUG_CORE 1# define HAS_ILLEGAL_INSTRUCTION_EXCEPTION# define HAS_ILLEGAL_MEMORY_ACCESS_EXCEPTION# define HAS_EXTRA_EXCEPTION_INFO# define CPU_ID_SIZE 1# define CPU_ID_VALUE 0x0# define HARDWARE_DIVIDE_PRESENT 0# define HARDWARE_MULTIPLY_PRESENT 1# define HARDWARE_MULX_PRESENT 0# define INST_ADDR_WIDTH 29# define DATA_ADDR_WIDTH 29# define NUM_OF_SHADOW_REG_SETS 0
0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
632 Views

Hi, 

I met the problem like you in DE0 board which has 8MB SDRAM too. To my opinion, maybe it is not correct, zImage file is a zip file. It must be unzip or uncompressed before being mapped to memory. So in fact the true kernel ran on the memory is lardger than 8MB. One way to test this is that running the same system on the other board which has 16MB or lardger SDRAM, and then use  

ps -v  

to see space used of the memory. 

 

If my thought is wrong, please fogive me. 

 

--Smarter.UJS
0 Kudos
Altera_Forum
Honored Contributor II
632 Views

 

--- Quote Start ---  

Hi, 

I met the problem like you in DE0 board which has 8MB SDRAM too. To my opinion, maybe it is not correct, zImage file is a zip file. It must be unzip or uncompressed before being mapped to memory. So in fact the true kernel ran on the memory is lardger than 8MB. One way to test this is that running the same system on the other board which has 16MB or lardger SDRAM, and then use  

ps -v to see space used of the memory. 

 

If my thought is wrong, please fogive me. 

 

--Smarter.UJS 

--- Quote End ---  

 

 

I don't have a board with 16 MB SDRAM! Is there not a possibility to build a smaller kernel?
0 Kudos
Altera_Forum
Honored Contributor II
632 Views

hi,  

it is described in this document (http://nioswiki.com/@api/deki/files/342/=opensource_linux_niosii_user_guide_-_fixed_toc.doc) that 8MB SDRAM can run nios2-mmu, but in fact I have failed to do this on DE0 board by running Linux directly on SDRAM with 'linux.initramfs.gz' or 'zImage.initramfs.gz'. But there is still a way out: one of the advantages of MMU is that the system(or app) can run on RAM even it is not enough. The system can use virtual address to deal with this problem. So, what I want to say is you can try to boot Linux from other devices such as CF Card(True IDE mode) or SD Card. 

Maybe this method can solve the problem. When I finish my work on hand, I will try. 

 

Regards, 

 

--Smarter.UJS
0 Kudos
Altera_Forum
Honored Contributor II
632 Views

Good idea. We could make a U-boat which will boot from the CFI flash and  

and let u-boot "boot" the linux kernel from the SD card. 

 

Both boards (DE0/DE2) are no different when you compare the sizes of the SDRAM and the FLASH memory. 

 

I try to get U-boot running and will keep you informed. I'm Also curious to read your results.
0 Kudos
Altera_Forum
Honored Contributor II
632 Views

 

--- Quote Start ---  

hi,  

it is described in this document (http://nioswiki.com/@api/deki/files/342/=opensource_linux_niosii_user_guide_-_fixed_toc.doc) that 8MB SDRAM can run nios2-mmu, but in fact I have failed to do this on DE0 board by running Linux directly on SDRAM with 'linux.initramfs.gz' or 'zImage.initramfs.gz'. But there is still a way out: one of the advantages of MMU is that the system(or app) can run on RAM even it is not enough. The system can use virtual address to deal with this problem. So, what I want to say is you can try to boot Linux from other devices such as CF Card(True IDE mode) or SD Card. 

Maybe this method can solve the problem. When I finish my work on hand, I will try. 

 

Regards, 

 

--Smarter.UJS 

--- Quote End ---  

 

 

I build and run U-boot on my DE2 board. To get u-boot compiled was a hard job. A lot of reading (I must say that u-boot was new to me), but at the end it was simple to compile u-boot. 

 

At this point I have the network support up and running. Now I'm working on the SD card.
0 Kudos
Altera_Forum
Honored Contributor II
632 Views

DE2 board has only 8m sdram. 

It is too smaller to run linux with mmu in my opinion.
0 Kudos
Altera_Forum
Honored Contributor II
632 Views

I managed, with the help of people from this forum, to run MMU linux in a DE1 board with 8MB. See here http://www.alteraforum.com/forum/showthread.php?t=23846 .

0 Kudos
Reply