Altera_Forum
Honored Contributor
15 years agoDesign with MMU and on my de2 board
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