Forum Discussion
Altera_Forum
Honored Contributor
15 years agouClinux 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
Hi,
I am trying to import/use uClinux on NIOS on the DE2-70 Board. I see by your comment that you have already done this. Could you please help me regarding this. Thanks, Baishun - Altera_Forum
Honored Contributor
--- Quote Start --- 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 20100621 --- Quote End --- Hi Texblues, this is strange, because I also made the step with "make vendor_hwselect ..." on the distribution 20100621. I use the "test-nios2" branch for the nommu version. But if the mmu version really needs this step I think you have to put your "my_nios2_fpga.h" into the folder "linux-2.6x/arch/nios/include/asm" or something similiar. @baishunwu: It is better to open a new to topic and then tell us what steps you already made on getting uClinux to work. By the way the alterawiki has many sections about getting it started. Urmel - Altera_Forum
Honored Contributor
--- Quote Start --- 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. --- Quote End --- I you are using the mmu version, take a look on the steps http://www.alterawiki.com/wiki/creating_a_nios_ii_design_with_an_mmu about adding the files, copying the folders in arch/nios2/ and so on - Altera_Forum
Honored Contributor
Yes. all the things what I do, I do from this website.
I added new board by copying 3c120 to 2c35. Changed Kconfig and Makefile in boards(adding few lines to my new 2c35 board). Changed Kconfig in 2c35 folder. For one try I did not changed 2c35/include/asm for my board and leaved it without change. I leave number 2 from the tut: 2. add a new board to uClinux-dist using nios2 as a template. Beaceuse I think this is not usefull. I tried compile kernel with my "new" board 2c35(which is old actually) and success. Now I want to change parameters for my real board 2c35. And i changed nios.h: # ifndef _ASM_NIOS2_H__ # define _ASM_NIOS2_H__ # 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_III # 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 //#define GPIO_LED1 0 DDR_SDRAM, FLASH, SYS_CLK_TIMER - those are my names in nios sopc. I dont have yet GPIO so I comment define GPIO_LED1 0. Actually I dont know what for it is. I generated: sopc-create-header-files --single default_mmu.h and copied it to 2c35/include/asm overwriting the old one. Now in uClinux-dist: make menuconfig (I set: Altera, nios2. In kernel selection: default all settings nad customize kernel settings) I get: * * Restart config... * * * NiosII board configuration * board configuration > 1. 3C120 dev board (3C120) 2. 2C35 dev board (2C35) (NEW) 3. Nios Embedded Evaluation Kit (NEEK) choice[1-3]: 2 And now: make I get errors like /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:87: error: 'USER_LED_PIO_8OUT_BASE' undeclared here (not in a function) /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:88: error: 'USER_DIPSW_PIO_8IN_BASE' undeclared here (not in a function) /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:89: error: 'USER_PB_PIO_4IN_BASE' undeclared here (not in a function) /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:108: error: 'GPIO_LED1' undeclared here (not in a function) /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:108: error: initializer element is not constant /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:108: error: (near initialization for 'nios2_led_pins[0].gpio') /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:1157: error: 'TSE_MAC_BASE' undeclared here (not in a function) /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:1157: error: initializer element is not constant /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:1157: error: (near initialization for 'alt_tse_resource[0].start') /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:1158: error: initializer element is not constant /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:1158: error: (near initialization for 'alt_tse_resource[0].end') /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:1163: error: 'SGDMA_RX_BASE' undeclared here (not in a function) /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:1163: error: initializer element is not constant /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:1163: error: (near initialization for 'alt_tse_resource[1].start') /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:1164: error: initializer element is not constant /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:1164: error: (near initialization for 'alt_tse_resource[1].end') /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:1169: error: 'SGDMA_TX_BASE' undeclared here (not in a function) I think the problem is in config.c but how to change it to my nios? - Altera_Forum
Honored Contributor
have you tried giving a make menuconfig and go down to the devices deselecting the Altera Triple Speed Ethernet and leds?
I had some problems with the GPIO, I found the selection for it in the menuconfig under Customize Kernel settings > Linux/NiosII Configuration > Additional NiosII Device Drivers. Not sure this helps you. - Altera_Forum
Honored Contributor
Yes it helped. Now I have less error like:
/util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:1157: error: 'TSE_MAC_BASE' undeclared here (not in a function) /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:1163: error: 'SGDMA_RX_BASE' undeclared here (not in a function) /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:1169: error: 'SGDMA_TX_BASE' undeclared here (not in a function) /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:1175: error: 'SGDMA_RX_IRQ' undeclared here (not in a function) /util/Altera_soft/workspace/nios2-linux/linux-2.6/arch/nios2/boards/2c35/config.c:1181: error: 'SGDMA_TX_IRQ' undeclared here (not in a function) Where can I switch it off? - Altera_Forum
Honored Contributor
Do you want networking/ethernet in your system? If so, then you'll have to resolve this. If not, then I think you can safely remove and/or switch these flags off. Just make sure you've also disabled the TSE (and related) in make menuconfig.
Cheers, slacker - Altera_Forum
Honored Contributor
guess!
Take a tour in kernel configuration > device drivers> Network device support> Ethernet (1000) Check also the other ethernet options. - Altera_Forum
Honored Contributor
Found it and switched off. Now compilation ends with success. Unfortunataly I get error while downloading Image:(
nios2-download -g images/zImage Using cable "USB-Blaster [USB 1-1.3.3]", device 1, instance 0x00 Pausing target processor: not responding. Resetting and trying again: OK Initializing CPU cache (if present) OK Downloaded 3529KB in 20.7s (170.4KB/s) Verifying C1800000 ( 0%) Verify failed between address 0xC1800000 and 0xC180FFFF Leaving target processor paused http://aix.vot.pl/nios/nios_config.jpeg http://aix.vot.pl/nios/cpu.jpeg MMU setting are default When I run on the same project uClinux but cpu without MMU and dual port onchip memory I run uClinux with success. - Altera_Forum
Honored Contributor
Information about the system from .h file:
# define CPU_IMPLEMENTATION "fast" # define BIG_ENDIAN 0 # define CPU_FREQ 50000000 # 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 0xc1800000 # define EXCEPTION_ADDR 0xc0800020 # define RESET_ADDR 0xc0800000 # define BREAK_ADDR 0xc1804820 # 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 25 # define DATA_ADDR_WIDTH 25 # define NUM_OF_SHADOW_REG_SETS 0