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++
12603 Discussions

The problem concerning uClinux uploading to UP3

Altera_Forum
Honored Contributor II
1,523 Views

Hello everyone!I need your help now... 

 

The problem is concerning uClinux uploading to UP3 board. 

 

Here is my developing enviornment: 

 

target board: UP3 Education Kit 

Cyclone EP1C6Q240  

TC58FVT160 Flash Memory 2MB(1M*16b) 

1S42S16400B SDRAM 8MB 

128KB(64K*16b) SRAM  

Software: Quartus 4.2 + NIOS IDE1.0 

Nios2linux1_3 

 

Since there is no ptf file from linux_example support for UP3,i have no idea. 

I try to use NiosII_lab_up3 ptf. 

According to the Linux Quick Start Guide,creat Linux Kernel Project,Configure Kernel,then Build Project,waiting... 

the final error are as follows: 

--- 

2.6.x/drivers/char/altera_pio_button.c:112: error: `na_button_pio_irq' undeclared (first use in this function) 

/cygdrive/c/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.kernel_0.1.5/linux-2.6.x/drivers/char/altera_pio_button.c:112: error: (Each undeclared identifier is reported only once 

/cygdrive/c/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.kernel_0.1.5/linux-2.6.x/drivers/char/altera_pio_button.c:112: error: for each function it appears in.) 

/cygdrive/c/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.kernel_0.1.5/linux-2.6.x/drivers/char/altera_pio_button.c: In function `button_release': 

/cygdrive/c/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.kernel_0.1.5/linux-2.6.x/drmake: Leaving directory `/cygdrive/c/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.kernel_0.1.5/linux-2.6.x' 

ivers/char/altera_pio_button.c:156: error: `na_button_pio_irq' undeclared (first use in this function) 

make[3]: *** [drivers/char/altera_pio_button.o] Error 1 

make[2]: *** [drivers/char] Error 2 

make[1]: *** [drivers] Error 2 

make: *** [_all] Error 2 

----- 

And what's the matter,need to modify the UP3 ptf file? and how to?I'm a newer in this developing 

what i should complete,is Web Server using in Industry data gathering,based on Nios-uClinux board system.(UP3) 

 

Thank you for everyone here, it&#39;s my first title here,and english is not good. Maybe should description more details.http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif
0 Kudos
11 Replies
Altera_Forum
Honored Contributor II
546 Views

Hi, sounds like a cool little project. Though I have to warn you that the board may not have enough flash or sdram to comfortably run Linux. 

 

The current distribution uses the first 2 MB of flash to hold the kernel and any remaining flash to hold a read-only filesystem. With only 2 MB of space, I&#39;d recommend browsing around the forum to learn how to use u-boot and a compressed kernel. You should be able to fit u-boot and the kernel into the first meg of flash. 

 

The next step would be to ensure that you&#39;re flash is supported in the kernel and to set up a flash partition map so that you can mount the last MB of flash as a filesystem. With only 1 MB to work with, it would be best to use cramfs I think... again, people on this forum have successfully used cramfs in the past, so searching around should give you some answers. 

 

As for the error that you&#39;re getting during the build process, configure your kernel to turn off Altera PIO Button support... you can find it at: 

 

Device Drivers 

--> Character Devices 

----> Nios PIO buttons support 

 

Once you turn it off, try re-building again, it should help.
0 Kudos
Altera_Forum
Honored Contributor II
546 Views

Hi: 

 

Thank you very much! 

This UP3 board is supply by Altera,using for the university NIOS  

 

competition.So we have no chose,also should build a web server on this  

 

board,based on uClinux operating system.  

 

According your suggestion,turn &#39;Nios PIO buttons support&#39; off,build  

 

again,the former error disppear,but another error appears: 

-------------------------------------------------------- 

make: Leaving directory  

 

`/cygdrive/c/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2li 

 

nux.kernel_0.1.5/linux-2.6.x&#39; 

ive/c/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.ker 

 

nel_0.1.5/linux-2.6.x/drivers/net/smc91111.c:2062: warning:  

 

`MOD_DEC_USE_COUNT&#39; is deprecated (declared at  

 

/cygdrive/c/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2lin 

 

ux.kernel_0.1.5/linux-2.6.x/include/linux/module.h:567) 

/cygdrive/c/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2lin 

 

ux.kernel_0.1.5/linux-2.6.x/drivers/net/smc91111.c: In function  

 

`init_module&#39;: 

/cygdrive/c/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2lin 

 

ux.kernel_0.1.5/linux-2.6.x/drivers/net/smc91111.c:2173: warning:  

 

assignment from incompatible pointer type 

make[3]: *** [drivers/net/smc91111.o] Error 1 

make[2]: *** [drivers/net] Error 2 

make[1]: *** [drivers] Error 2 

make: *** [_all] Error 2 

--------------------------------------------------------- 

Then i think it&#39;s the smc9111&#39;s problem, so i turn it off 

other errors appear: 

arch/nios2nommu/lib/.checksum.o.d: done. 

CC arch/nios2nommu/lib/string.o 

arch/nios2nommu/lib/.string.o.d: done. 

AR arch/nios2nommu/lib/lib.a 

GEN .version 

CHK include/linux/compile.h 

UPD include/linux/compile.h 

CC init/version.o 

init/.version.o.d: done. 

LD init/built-in.o 

LD .tmp_vmlinux1 

nios2-elf-ld: region ram is full (.tmp_vmlinux1 section .text) 

nios2-elf-ld: region ram is full (.tmp_vmlinux1 section .bss) 

nios2-elf-ld: section .data [00020000 -> 0002dfff] overlaps section .text  

 

[00020000 -> 0017b43b] 

nios2-elf-ld: section .init [0002e000 -> 0003a51f] overlaps section .text  

 

[00020000 -> 0017b43b] 

nios2-elf-ld: section .bss [0003a520 -> 0004afc7] overlaps section .text  

 

[00020000 -> 0017b43b] 

nios2-elf-ld: section .sbss [00020000 -> 0002003c] overlaps section .text  

 

[00020000 -> 0017b43b] 

make[1]: *** [.tmp_vmlinux1] Error 1 

make: *** [_all] Error 2 

make: Leaving directory  

 

`/cygdrive/c/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2li 

 

nux.kernel_0.1.5/linux-2.6.x&#39; 

------------------------------------- 

I don&#39;t know how to deal with this problem.  

 

Another questions: 

As some other embedded developing board as ARM-9,it has some crossing complie tools(arm-gcc), using in developing application through linux. 

So what about NIOS-board, does NIOS has the likely gcc developing eviornment(NIOS-gcc) 

When i develop the U-boot, do i need to using the nios-gcc, and how,using in linux system....? 

 

Thank you again!:) 

Best Regards!
0 Kudos
Altera_Forum
Honored Contributor II
546 Views

Hi Justin, 

 

> When i develop the U-boot, do i need to using the nios-gcc, and how,using in linux system....? 

 

Yes, you should use nios2-elf-xxx. When building u-boot for Nios-II, nios2-elf is the default 

cross compile prefix. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
546 Views

Hi: 

This days I browse around the forum,and try to find how to use u-boot. 

But where can I download the u-boot and the nios2-elf-gcc tool. 

 

Thank you! 

Regards, 

-Justin
0 Kudos
Altera_Forum
Honored Contributor II
546 Views

Hi Justin, 

 

> where can I download the u-boot and the nios2-elf-gcc tool. 

 

You can get u-boot from two places. The official sources can be found at: 

 

http://www.sourceforge.net/projects/u-boot (http://www.sourceforge.net/projects/u-boot

 

The source tree at sourceforge contains the sources for all supported 

architectures and boards. You can also get the u-boot sources from: 

 

http://www.psyent.com/download (http://www.psyent.com/download

 

The sources at psyent contain only the files necessary to support Nios-II, and 

a few of the files have minor changes to support an error/warning free build 

using the standard Nios-II tools under cygwin. The psyent site from time-to-time 

also has certain updates applied before they are incorporated into the 

source tree a sourceforge (u-boot patches can take as long as 3 months 

to be added to the sourceforge tree). 

 

As for the nios2-elf-xxx tools ... they&#39;re part of the Nios-II development kit. 

I believe you can download the tools from the Altera website ... but I&#39;m not 

sure ... never needed to do this. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
546 Views

Hi again:) 

 

Thank you for your given links, i have down the software as follows: 

1:uClinux-dist-20041215.tar 

2:nios-gcc.tar 

3:u-boot-1.1.2.tar 

And today i try to compile the uClinux kernel for NIOS,follow the point steps: 

$ make xconfig  

$ make dep  

$ make  

but when the final step &#39;make&#39;,following info appears: 

 

----------------------------------------------------------------- 

/home/JustinYan/uClinux-dist/linux-2.4.x/include/linux/coda.h:116:  

 

redefinition 

of `struct timespec&#39; 

{standard input}: Assembler messages: 

{standard input}:824: Error: Unknown pseudo-op: `.subsection&#39; 

{standard input}:832: Error: Unknown pseudo-op: `.previous&#39; 

{standard input}:1000: Error: Unknown pseudo-op: `.subsection&#39; 

{standard input}:1008: Error: Unknown pseudo-op: `.previous&#39; 

make: *** [init/main.o] Error 1 

----------------------------------------------------------------- 

 

I have no idea about it.why? 

 

The another problem i meet,is about the rpm command. 

I have download &#39;cdk-nios-example-u-boot-20040316cvs-20040317.src.rpm&#39; for the U-boot. 

when: 

--------------------------------------------------------------------- 

JustinYan@JUSTINYAN ~/setup/cdk-nios-example-u-boot 

$ rpm -ivh cdk-nios-example-u-boot-20040316cvs-20040317.src.rpm 

cdk-nios-example-u-boot  

# ################################################# 

 

JustinYan@JUSTINYAN ~/setup/cdk-nios-example-u-boot 

$ rpm -qi cdk-nios-example-u-boot-20040316cvs-20040317.src.rpm 

package cdk-nios-example-u-boot-20040316cvs-20040317.src.rpm is not installed 

---------------------------------------------------------------------------------------------------- 

why this package is not installed, the rpm command using is correct,i think. 

 

I&#39;m a beginner , so forgive me for asking this simple questions. 

Thank you again!:) 

Best Regards! 

Justin
0 Kudos
Altera_Forum
Honored Contributor II
546 Views

Hi~Anybody here? 

 

The first problem above has been solved today. 

I have convert the kernel into a raw binary image--linux.bin(2.4MB), 

and compress the binary image to linux.bin.gz(1.1MB) 

Then package linux.bin.gz for U-Boot, 

but when i build the U-Boot in this final step: 

# make make: Entering directory `/usr/Setup_Nios/u-boot-1.1.2/tools&#39; make: `.depend&#39; is up to date. make: Leaving directory `/usr/Setup_Nios/u-boot-1.1.2/tools&#39; make: Entering directory `/usr/Setup_Nios/u-boot-1.1.2/examples&#39; make: `.depend&#39; is up to date. make: Leaving directory `/usr/Setup_Nios/u-boot-1.1.2/examples&#39; make: Entering directory `/usr/Setup_Nios/u-boot-1.1.2/post&#39; make: `.depend&#39; is up to date. make: Leaving directory `/usr/Setup_Nios/u-boot-1.1.2/post&#39; make: Entering directory `/usr/Setup_Nios/u-boot-1.1.2/post/cpu&#39; make: `.depend&#39; is up to date. make: Leaving directory `/usr/Setup_Nios/u-boot-1.1.2/post/cpu&#39; make -C tools all make: Entering directory `/usr/Setup_Nios/u-boot-1.1.2/tools&#39; make: Leaving directory `/usr/Setup_Nios/u-boot-1.1.2/tools&#39; make -C examples all make: Entering directory `/usr/Setup_Nios/u-boot-1.1.2/examples&#39; nios-elf-gcc -g  -Os    -D__KERNEL__ -DTEXT_BASE=0x018c0000 -I/usr/Setup_Nios/u-boot-1.1.2/include -fno-builtin -ffreestanding -nostdinc -isystem /usr/local/nios-elf/lib/gcc-lib/nios-elf/2.9-nios-010801-20030923/include -pipe  -m32 -DCONFIG_NIOS -D__NIOS__ -ffixed-g7 -gstabs -Wall -Wno-trigraphs -g  -Os    -D__KERNEL__ -DTEXT_BASE=0x018c0000 -I/usr/Setup_Nios/u-boot-1.1.2/include -fno-builtin -ffreestanding -nostdinc -isystem /usr/local/nios-elf/lib/gcc-lib/nios-elf/2.9-nios-010801-20030923/include -pipe  -m32 -DCONFIG_NIOS -D__NIOS__ -ffixed-g7 -gstabs -I.. -Bstatic -T /usr/Setup_Nios/u-boot-1.1.2/board/altera/dk1c20/u-boot.lds -Ttext 0x018c0000   hello_world.c   -o hello_world /usr/local/nios-elf/lib/gcc-lib/nios-elf/2.9-nios-010801-20030923/../../../../nios-elf/bin/ld: cannot open crt0.o: No such file or directory collect2: ld returned 1 exit status nios-elf-gcc: file path prefix `static&#39; never used make: *** Error 1 make: Leaving directory `/usr/Setup_Nios/u-boot-1.1.2/examples&#39; make: *** Error 2 

 

 

This time, I really don&#39;t know how to fix this error. 

Can anyone tell me how to solve this problem? 

Thank you very much!!! 

Best regards! 

Justin
0 Kudos
Altera_Forum
Honored Contributor II
546 Views

Hi Scott: 

I can&#39; open this link: http://www.psyent.com/download (http://www.psyent.com/download

Can you sent me the U-boot sources, containing only the files necessary to support Nios-II, using in email. 

My email address is BTEL221@163.com 

 

Thank you very much! 

 

Regards! 

Justin
0 Kudos
Altera_Forum
Honored Contributor II
546 Views

Hi Justin, 

 

My first recommendation is: delete anything and everything you downloaded from 

the cdk4nios project -- It&#39;s dead ... it&#39;s junk ... it never amounted to much more than 

a semester project ... and it does not support nios-ii

 

> Can you sent me the U-boot sources, containing only the files necessary to support Nios-II, 

> using in email. 

 

It will my pleasure ... but you must promise to get rid of the CDK4NIOS code ;-) 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
546 Views

Hi: 

Thank you very very much! Scott:) 

My board is UP3,with Cyclone EP1C6Q240(with CPU 48MHz),TC58FVT160 Flash Memory 2MB(1M*16b),1S42S16400B SDRAM 8MB,128KB(64K*16b) SRAM. 

 

So i should create a suitable u-boot for this board,because u-boot-nios2-src just has the pci5441 and pk1c20. 

And i should modify the sample files, and fit it to UP3. 

1:<target_board>.h include/configs/up3.h 

2:<target_board>.c board/up3/up3.c 

3:flash driver board/up3/flash.c  

 

The first problem is that i can&#39;t find the up3-flash datasheet(TC58FVT160),  

to use in the flash.c. No help in the UP3 munual reference. 

 

And in the work of creating up3.h,just getting little info from the SOPC Builder,a exiting up3_board example.Just like the below info:  

CPU: Clock 48.0MHz Base 0x00000000 End 0x000007FF 

jtag_uart: JTAG UART Base 0x00000800 End 0x00000807 

ext_ram:Sram_UP3 Base 0x00020000 End 0x0003FFFF 

 

So the second problem is where can I find some details using for this u-boot work,such as,  

CFG_Nios_CONSOLE,CF G_GBL_DATA_OFFSET,CFG_Nios_TMRBASE,CFG_Nios_TMRIRQ and so on, 

because the UP3 munual reference doesn&#39;t have this data. 

 

 

 

Thank you again~! 

Regards! 

Justin
0 Kudos
Altera_Forum
Honored Contributor II
546 Views

Hi Justin, 

 

> The first problem is that i can&#39;t find the up3-flash datasheet(TC58FVT160),  

 

http://www.toshiba.com/taec/components/dat...60aft_axb_e.pdf (http://www.toshiba.com/taec/components/datasheet/tc58fvtb160aft_axb_e.pdf

 

You might want to search the u-boot sources at sourceforge to find a board that supports 

this flash device and just copy it into your board-specific tree. 

 

> So the second problem is where can I find some details using for this u-boot work,such as, 

> CFG_Nios_CONSOLE,CF G_GBL_DATA_OFFSET,CFG_Nios_TMRBASE,CFG_Nios_TMRIRQ and so on, 

> because the UP3 munual reference doesn&#39;t have this data. 

 

Yes, u-boot configuration isn&#39;t the easiest task. A nice document for Nios-II would be great ... maybe 

I&#39;ll take a stab at it once I have some spare time ;-) That being said, let me try to help with the 

following minimum configuration: 

 

1. top-level configuration 

 

All of the following are configured via SOPC builder and are in your ptf file with the tag shown 

in (braces): 

 

CONFIG_SYS_CLK_FREQ -the Nios-II clock frequency in hertz (clock_freq) 

CFG_RESET_ADDR -the Nios-II reset address (reset_offset + the device base) 

CFG_EXCEPTION_ADDR - The Nios-II Exception address (exc_offset) 

CFG_ICACHE_SIZE - Size of the icache in bytes or zero (nasys_icache_size) 

CFG_ICACHELINE_SIZE - Size of icache line in bytes (nasys_icache_line_size) 

CFG_DCACHE_SIZE - Size of the dcache in bytes or zero (nasys_dcache_size) 

CFG_DCACHELINE_SIZE - Size of the dcache line in bytes (nasys_dcache_line_size) 

 

2. memory base addresses 

 

Define all of these ... set size to zero if not applicable. These should be available in 

your SOPC builder memory map. 

 

CFG_FLASH_BASE - base address of flash 

CFG_FLASH_SIZE - size in bytes of flash 

CFG_SDRAM_BASE - base address of SDRAM 

CFG_SDRAM_SIZE - size in bytes of SDRAM 

CFG_SRAM_BASE - base address of SRAM 

CFG_SRAM_SIZE - size in bytes of SRAM 

 

3. memory organization 

 

CFG_MONITOR_LEN - the size in bytes reserved for u-boot 

CFG_GBL_DATA_SIZE - the size in bytes reserved for u-boot&#39;s global data (128 will do) 

CFG_MALLOC_LEN - the size in bytes of the u-boot heap 

 

These can be quite confusing, but they let you fine-tune your configuration. Normally, they&#39;re 

all defined relative to the u-boot text base. See the PK1C20.h file for example. 

 

CFG_MONITOR_BASE - u-boot text base address (same as the .cfg file) 

CFG_MALLOC_BASE - base address of heap 

CFG_GBL_DATA_OFFSET - base address of u-boot&#39;s global data 

CFG_INIT_SP - initial stack pointer 

 

4. required component configuration 

 

u-boot needs a uart and a timer. Here&#39;s the configuration macros you should use: 

 

CFG_NIOS_TMRBASE - base address of the timer used by u-boot 

CFG_NIOS_TMRIRQ - the interrupt request number used by the timer 

CFG_NIOS_TMRMS - the timer interval in milliseconds 

 

If the timer provides period registers AND the default count is not acceptable 

to you, you can configure CFG_NIOS_TMRCNT. 

 

CFG_NIOS_TMRCNT - value used to load the period registers of the u-boot timer. 

 

CFG_HZ - number of hertz per timer tick. This is used by networking code and is dependent 

on the timer macros above. 

 

CFG_NIOS_CONSOLE - Base address of the uart or jtag uart component. 

CONFIG_CONSOLE_JTAG - Define this when using the jtag uart 

 

CFG_NIOS_FIXEDBAUD - Define this when uart is fixed baudrate or with jtag uart 

CONFIG_BAUDRATE - the initial baudrate (or the fixed baudrate) in bps 

CFG_BAUDRATE_TABLE - a table of allowed baudrates. This has one entry for fixed rate uart/jtag 

 

E.g.: 

# define CFG_BAUDRATE_TABLE {115200} /* It&#39;s fixed */ 

or# define CFG_BAUDRATE_TABLE {9600, 19200, 115200} /* Allows selection of rate via cli */ 

 

 

I hope this is useful ... configuring u-boot via a gui would be great ... but, good or bad, 

if you want a very high level of control, editing a configuration file will force you to really 

know your code. 

 

If you have any questions or need additional information, just post or shoot me some email. 

 

Best Regards, 

--Scott
0 Kudos
Reply