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

GNU Cross compiler for NIOS II

Altera_Forum
Honored Contributor II
1,968 Views

Hi, 

 

I am working on NIOS II processor. Could any one send GNU cross compiler / Tool chain for NIOS II embedded processor. 

 

I want to compile U-boot for NIOS II, I already have tool chain for NIOS. 

 

Thanks in Advance! 

 

Thanks & Regards, 

Vijay
0 Kudos
11 Replies
Altera_Forum
Honored Contributor II
957 Views

 

--- Quote Start ---  

originally posted by vijay@Jul 5 2006, 03:14 AM 

hi, 

 

i am working on nios ii processor. could any one send gnu cross compiler / tool chain for nios ii embedded processor. 

 

i want to compile u-boot for nios ii, i already have tool chain for nios. 

 

thanks in advance! 

 

thanks & regards, 

vijay 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16659) 

--- quote end ---  

 

--- Quote End ---  

 

 

Errr if you have the tool chain for Nios it IS a cross compiler!
0 Kudos
Altera_Forum
Honored Contributor II
957 Views

 

--- Quote Start ---  

originally posted by vijay@Jul 5 2006, 04:14 PM 

hi, 

 

i am working on nios ii processor. could any one send gnu cross compiler / tool chain for nios ii embedded processor. 

 

i want to compile u-boot for nios ii, i already have tool chain for nios. 

 

thanks in advance! 

 

thanks & regards, 

vijay 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16659) 

--- quote end ---  

 

--- Quote End ---  

 

There is a package for nios2 uclinux, can be used to build u-boot, too. 

http://nioswiki.jot.com/wikihome/operating...binarytoolchain (http://nioswiki.jot.com/wikihome/operatingsystems/binarytoolchain

 

Or try build it from source if you won&#39;t run uclinux, 

http://nioswiki.jot.com/crossgcc (http://nioswiki.jot.com/crossgcc)
0 Kudos
Altera_Forum
Honored Contributor II
957 Views

Thanks all! 

 

I solve problem today. 

That is a bug for Cygwin&#39;s bash, I replace bash with ash, it work fine!
0 Kudos
Altera_Forum
Honored Contributor II
957 Views

Hi hippo, 

 

Thanks. I could compile u-boot with binary tool chain. 

Could you please let me know how to copy u-boot to flash. What is the JTAG used and where will I get the full information about the memory map and also the address in flash where the u-boot image to be copied. 

 

Thanks 

 

 

 

--- Quote Start ---  

originally posted by hippo+jul 10 2006, 01:29 am--><div class='quotetop'>quote (hippo @ jul 10 2006, 01:29 am)</div> 

--- quote start ---  

<!--quotebegin-vijay@Jul 5 2006, 04:14 PM 

hi, 

 

i am working on nios ii processor. could any one send gnu cross compiler / tool chain for nios ii embedded processor. 

 

i want to compile u-boot for nios ii, i already have tool chain for nios. 

 

thanks in advance! 

 

thanks & regards, 

vijay 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16659) 

--- quote end ---  

 

--- Quote End ---  

 

There is a package for nios2 uclinux, can be used to build u-boot, too. 

http://nioswiki.jot.com/wikihome/operating...binarytoolchain (http://nioswiki.jot.com/wikihome/operatingsystems/binarytoolchain

 

Or try build it from source if you won&#39;t run uclinux, 

http://nioswiki.jot.com/crossgcc (http://nioswiki.jot.com/crossgcc

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16748)</div> 

[/b] 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
957 Views

you can find address map from sopc builder of your project. 

u-boot will be linked to somewhere near the end of sdram. 

check with nios2-linux-uclibc-objdump -h u-boot, to see the VMA. 

 

first try to run u-boot from sdram, it is similar to tryout linux, but u-boot replace zImage. 

http://nioswiki.jot.com/wikihome/operating...s/tryoutuclinux (http://nioswiki.jot.com/wikihome/operatingsystems/tryoutuclinux

 

if it works, then you can program it to flash, 

http://nioswiki.jot.com/wikihome/operating...flashprogrammer (http://nioswiki.jot.com/wikihome/operatingsystems/flashprogrammer

it will insert an Altera supplied cfi boot loader, which will copy u-boot image from flash to sdram, and jump start on sdram to run u-boot.
0 Kudos
Altera_Forum
Honored Contributor II
957 Views

Hi hippo, 

 

Thanks for your valuable guidance and information. Let me try and get back to you. 

 

thanks 

Vijay 

 

 

--- Quote Start ---  

originally posted by hippo@Jul 11 2006, 08:48 PM 

you can find address map from sopc builder of your project. 

u-boot will be linked to somewhere near the end of sdram. 

check with nios2-linux-uclibc-objdump -h u-boot, to see the vma. 

 

first try to run u-boot from sdram, it is similar to tryout linux, but u-boot replace zimage. 

http://nioswiki.jot.com/wikihome/operating...s/tryoutuclinux (http://nioswiki.jot.com/wikihome/operatingsystems/tryoutuclinux

 

if it works, then you can program it to flash, 

http://nioswiki.jot.com/wikihome/operating...flashprogrammer (http://nioswiki.jot.com/wikihome/operatingsystems/flashprogrammer

it will insert an altera supplied cfi boot loader, which will copy u-boot image from flash to sdram, and jump start on sdram to run u-boot. 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16803) 

--- quote end ---  

 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
957 Views

Hi hippo, 

 

Thanks for your valuable guidance. 

I have some queries here. 

 

I checked with nios2-linux-objdump -h u-boot. 

Below is the dump. 

 

1) The .text address being 0x018e0000, which is the address of the _start function in u-boot. 

Question) So up on reset, nios processor should start executing code from this address(This is my understanding). How exactly nios ii knows that it has to jump to this address. 

 

2. If not how to make nios ii to jump there. I do not have data sheet of nios ii. could you please give me the pointer from where I can download. 

 

3. I have working experiance with u-boot for freescale processors MPC 8540. 

In this case the reset vector being 0xfffffffc . This is the last location of flash and contains jump instrction to an address where u-boot starts its .text. 

 

I bit confused in Nios about booting sequence. Could you please let me know. 

 

Thanks 

Vijay 

 

 

[root@localhost u-boot-1.1.3]# nios2-linux-objdump -h u-boot 

 

u-boot: file format elf32-littlenios2 

 

Sections: 

Idx Name Size VMA LMA File off Algn 

0 .text 00016fe1 018e0000 018e0000 00000094 2**4 

CONTENTS, ALLOC, LOAD, READONLY, CODE 

1 .u_boot_cmd 000003c0 018f6fe4 018f6fe4 00017075 2**2 

CONTENTS, ALLOC, LOAD, DATA 

2 .data 000009e8 018f73a4 018f73a4 00017435 2**2 

CONTENTS, ALLOC, LOAD, DATA 

3 .sdata 0000008c 018f7d90 018f7d90 00017e1d 2**2 

CONTENTS, ALLOC, LOAD, DATA, SMALL_DATA 

4 .sbss 00000144 018f7e1c 018f7e1c 00017ea9 2**2 

ALLOC, SMALL_DATA 

5 .bss 00003d70 018f7f60 018f7f60 00017ea9 2**2 

ALLOC 

6 .stab 000009c0 00000000 00000000 00017eac 2**2 

CONTENTS, READONLY, DEBUGGING 

7 .stabstr 000000b9 00000000 00000000 0001886c 2**0 

CONTENTS, READONLY, DEBUGGING 

8 .comment 0000034e 00000000 00000000 00018925 2**0 

CONTENTS, READONLY 

9 .debug_aranges 000005c0 00000000 00000000 00018c73 2**0 

CONTENTS, READONLY, DEBUGGING 

10 .debug_pubnames 00001b49 00000000 00000000 00019233 2**0 

CONTENTS, READONLY, DEBUGGING 

11 .debug_info 000111f8 00000000 00000000 0001ad7c 2**0 

CONTENTS, READONLY, DEBUGGING 

12 .debug_abbrev 00004130 00000000 00000000 0002bf74 2**0 

CONTENTS, READONLY, DEBUGGING 

13 .debug_line 00014659 00000000 00000000 000300a4 2**0 

CONTENTS, READONLY, DEBUGGING 

14 .debug_frame 00002bf8 00000000 00000000 00044700 2**2 

CONTENTS, READONLY, DEBUGGING 

15 .debug_str 0000355b 00000000 00000000 000472f8 2**0 

CONTENTS, READONLY, DEBUGGING 

16 .debug_ranges 00000660 0000355b 0000355b 0004a853 2**0 

CONTENTS, READONLY, DEBUGGING 

[root@localhost u-boot-1.1.3]#  

 

 

 

--- Quote Start ---  

originally posted by hippo@Jul 11 2006, 08:48 PM 

you can find address map from sopc builder of your project. 

u-boot will be linked to somewhere near the end of sdram. 

check with nios2-linux-uclibc-objdump -h u-boot, to see the vma. 

 

first try to run u-boot from sdram, it is similar to tryout linux, but u-boot replace zimage. 

http://nioswiki.jot.com/wikihome/operating...s/tryoutuclinux (http://nioswiki.jot.com/wikihome/operatingsystems/tryoutuclinux

 

if it works, then you can program it to flash, 

http://nioswiki.jot.com/wikihome/operating...flashprogrammer (http://nioswiki.jot.com/wikihome/operatingsystems/flashprogrammer

it will insert an altera supplied cfi boot loader, which will copy u-boot image from flash to sdram, and jump start on sdram to run u-boot. 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16803) 

--- quote end ---  

 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
957 Views

you may find the doc of nios2 from altera&#39;s web site. 

 

you may find the reset vector from sopc builder in your project. 

say, if it is set to flash_base, 

if you program u-boot to flash with elf2flash and nios2-flash-programmer, 

there is a altera supplied cfi boot loader at flash_base, and u-boot image as it payload. 

after reset, nios2 will start from flash_base, run the cfi boot loader, which will copy the u-boot image to sdram, at 018e0000 in your project. Then it will jump start at 018e0000 to run u-boot. 

 

(it is still possible to start from u-boot at flash without altera cfi boot loader, u-boot will relocate itself from flash to 018e0000 . )
0 Kudos
Altera_Forum
Honored Contributor II
957 Views

Hi vijay, 

 

> it is still possible to start from u-boot at flash without altera cfi boot loader, u-boot will relocate 

> itself from flash to 018e0000 .  

 

hippo is correct, u-boot will relocate itself -- so you can program it anywhere in flash. In general 

you should _not_ use the CFI boot loader with u-boot. Use the u-boot binary image (u-boot.bin) 

with bin2flash. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
957 Views

Hi Hippo, 

 

Thanks for your help. 

 

I have one question. I have one file(.c) , can i compile (standalone it and download to target using shell or some other way when the processor contains cfi and call that routine from the shell to test some of the interfaces? 

 

Thanks 

Vijay 

 

 

--- Quote Start ---  

originally posted by hippo@Jul 12 2006, 02:57 AM 

you may find the doc of nios2 from altera&#39;s web site. 

 

you may find the reset vector from sopc builder in your project. 

say, if it is set to flash_base, 

if you program u-boot to flash with elf2flash and nios2-flash-programmer, 

there is a altera supplied cfi boot loader at flash_base, and u-boot image as it payload. 

after reset, nios2 will start from flash_base, run the cfi boot loader, which will copy the u-boot image to sdram, at 018e0000 in your project. then it will jump start at 018e0000 to run u-boot. 

 

(it is still possible to start from u-boot at flash without altera cfi boot loader, u-boot will relocate itself from flash to 018e0000 . ) 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16822) 

--- quote end ---  

 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
957 Views

Hi Scott, 

 

Thanks for your suggestion. 

 

I have one question. I have one file(.c) , can i compile (standalone it and download to target using shell or some other way when the processor contains cfi and call that routine from the shell to test some of the interfaces? 

 

Thanks 

Vijay 

 

 

 

 

 

--- Quote Start ---  

originally posted by smcnutt@Jul 12 2006, 06:59 PM 

hi vijay, 

 

> it is still possible to start from u-boot at flash without altera cfi boot loader, u-boot will relocate 

> itself from flash to 018e0000 .  

 

hippo is correct, u-boot will relocate itself -- so you can program it anywhere in flash. in general 

you should _not_ use the cfi boot loader with u-boot. use the u-boot binary image (u-boot.bin) 

with bin2flash. 

 

regards, 

--scott 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16845) 

--- quote end ---  

 

--- Quote End ---  

0 Kudos
Reply