Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

Download image ok, but boot fail

Hi Guys,

I need help... maybe someone have passed for this trouble.

I try to run Linux on Nios II, obviously. My project is based on DE2_NET.

Now I used a CYCLONE II EP2C8F256C8 in a custom board.

First, I build the project for uCLinux and ran with sucess.

After that, I add the TCMs in the SOPC and uClinux ran with success.

So, after the system was validated, I went to LINUX with MMU.

After some days, I can to program/download the image in a Flash with sucess.

But the Linux don't boot.

The stdout is a jtag_uart.

When I run the “nios2-terminal”, nothing happen.

Don't show error or some information... the terminal was blank, like this:

[NiosII EDS]$ nios2-terminal

nios2-terminal: connected to hardware target using JTAG UART on cable

nios2-terminal: "USB-Blaster [USB-0]", device 1, instance 0

nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate)

Well, the Address Map is this:

cpu.jtag_debug_module 0x08000000 - 0x080007ff

timer_0 0x08400000 - 0x0840001f

sysid 0x08004d40 - 0x08004d47

jtag_uart_0 0x08004d50 - 0x08004d57

timer1 0x08004d00 - 0x08004d1f

sdram_0 0x02000000 - 0x02ffffff

epcs_controller 0x00100000 - 0x001007ff

tri_state_bridge_0

ext_flash 0x00000000 - 0x000fffff

onchip_memory2_0.s1 0x08000800 - 0x08000bff

onchip_memory2_0.s2 0x08400400 - 0x084007ff

the sdram have 8mbyte (pn: is42s16800d).

the flash memory have 8mbyte (pn: mp25p64).

the pll on the sopc builder is 100mhz for all peripherals.

This is my script for download/program:

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

nios2-configure-sof mylinux_top.sof

sof2flash --verbose --epcs --input=mylinux_top.sof --output=mylinux.flash

nios2-flash-programmer --mmu --epcs --base=0x00100000 mylinux.flash

elf2flash --mmu --epcs --after=mylinux.flash --input=zimage.initramfs.gz --output=epcs_controller.flash --boot=$sopc_kit_nios2/components/altera_nios2/boot_loader_epcs.srec

nios2-flash-programmer --mmu --epcs --base=0x00100000 epcs_controller.flash

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

The result after run the “script” is:

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

NiosII EDS]$ ./script

Searching for SOF file:

in .

myLinux_top.sof

Info: *******************************************************************

Info: Running Quartus II Programmer

Info: Command: quartus_pgm --no_banner --mode=jtag -o p; myLinux _top.sof

Info: Using programming cable "USB-Blaster [USB-0]"

Info: Started Programmer operation at Wed May 26 09:35:39 2010

Info: Configuring device index 1

Info: Device 1 contains JTAG ID code 0x020B20DD

Info: Configuration succeeded -- 1 device(s) configured

Info: Successfully performed operation(s)

Info: Ended Programmer operation at Wed May 26 09:35:40 2010

Info: Quartus II Programmer was successful. 0 errors, 0 warnings

Info: Peak virtual memory: 55 megabytes

Info: Processing ended: Wed May 26 09:35:40 2010

Info: Elapsed time: 00:00:05

Info: Total CPU time (on all processors): 00:00:03

26/05/2010 09:35:41 - (FINE) sof2flash: Starting

Info: *******************************************************************

Info: Running Quartus II Convert_programming_file

Info: Command: quartus_cpf --no_banner --convert --device=EPCS128 --option= myLinux.opt myLinux _top.sof myLinux.pof

Info: Quartus II Convert_programming_file was successful. 0 errors, 0 warnings

Info: Peak virtual memory: 69 megabytes

Info: Processing ended: Wed May 26 09:35:48 2010

Info: Elapsed time: 00:00:07

Info: Total CPU time (on all processors): 00:00:05

Info: *******************************************************************

Info: Running Quartus II Convert_programming_file

Info: Command: quartus_cpf --no_banner --convert myLinux.pof myLinux.rpd

Info: Quartus II Convert_programming_file was successful. 0 errors, 0 warnings

Info: Peak virtual memory: 67 megabytes

Info: Processing ended: Wed May 26 09:35:54 2010

Info: Elapsed time: 00:00:06

Info: Total CPU time (on all processors): 00:00:05

26/05/2010 09:35:55 - (FINE) sof2flash: Done

--mmu option was set true, EPCS virtual address is base + offset of 0xC0000000

Using cable "USB-Blaster [USB-0]", device 1, instance 0x00

Resetting and pausing target processor: OK

Checksummed/read 60kB in 1.7s

Erased 192kB in 2.0s (96.0kB/s)

programmed 133kb +59kb in 5.1s (37.6kb/s)

Did not attempt to verify device contents

Leaving target processor paused

--mmu option was set true, EPCS virtual address is base + offset of 0xC0000000

Using cable "USB-Blaster [USB-0]", device 1, instance 0x00

Resetting and pausing target processor: OK

Checksummed/read 58kB in 1.5s

Erased 3712kB in 38.2s (97.1kB/s)

programmed 3655kb +57kb in 128.4s (28.9kb/s)

Did not attempt to verify device contents

Leaving target processor paused

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

After power off/on custom board, I call the terminal:

[NiosII EDS]$ nios2-terminal

nios2-terminal: connected to hardware target using JTAG UART on cable

nios2-terminal: "USB-Blaster [USB-0]", device 1, instance 0

nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate)

Please, suggestions...

Thanks in advance.

Fernando Andrade

16 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Hippo,

    Sorry for my delay.

    See the results:

    # linux.initramfs.gz

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

    [NiosII EDS]$ nios2-configure-sof myLinux_top.sof

    Searching for SOF file:

    in .

    myLinux_top.sof

    Info: *******************************************************************

    Info: Running Quartus II Programmer

    Info: Command: quartus_pgm --no_banner --mode=jtag -o p;myLinux_top.sof

    Info: Using programming cable "USB-Blaster [USB-0]"

    Info: Started Programmer operation at Mon May 31 23:18:01 2010

    Info: Configuring device index 1

    Info: Device 1 contains JTAG ID code 0x020B20DD

    Info: Configuration succeeded -- 1 device(s) configured

    Info: Successfully performed operation(s)

    Info: Ended Programmer operation at Mon May 31 23:18:02 2010

    Info: Quartus II Programmer was successful. 0 errors, 0 warnings

    Info: Peak virtual memory: 89 megabytes

    Info: Processing ended: Mon May 31 23:18:02 2010

    Info: Elapsed time: 00:00:02

    Info: Total CPU time (on all processors): 00:00:00

    ~/Downloads

    [NiosII EDS]$ nios2-download -g linux.initramfs.gz

    Using cable "USB-Blaster [USB-0]", device 1, instance 0x00

    Pausing target processor: OK

    Initializing CPU cache (if present)

    OK

    Downloaded 4845KB in 0.8s (6056.2KB/s)

    Verified OK

    Starting processor at address 0xC2000000

    assertion "m_state == STATE_DEBUG" failed: file "nios2debug.cpp", line 562

    2 [sig] nios2-gdb-server 4752 c:\altera\91\nios2eds\bin\nios2-gdb-server.exe: *** fatal error - called with threadlist_ix -1

    /cygdrive/c/altera/91/nios2eds/bin/nios2-download: line 595: 4752 Hangup nios2-gdb-server --go --tcpport none --write-pid ./nios2-download.pid ./linux.initramfs.gz.srec

    ~/Downloads

    [NiosII EDS]$

    # zImage.initramfs.gz

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

    [NiosII EDS]$ nios2-configure-sof myLinux_top.sof

    Searching for SOF file:

    in .

    myLinux_top.sof

    Info: *******************************************************************

    Info: Running Quartus II Programmer

    Info: Command: quartus_pgm --no_banner --mode=jtag -o p;myLinux_top.sof

    Info: Using programming cable "USB-Blaster [USB-0]"

    Info: Started Programmer operation at Mon May 31 23:20:59 2010

    Info: Configuring device index 1

    Info: Device 1 contains JTAG ID code 0x020B20DD

    Info: Configuration succeeded -- 1 device(s) configured

    Info: Successfully performed operation(s)

    Info: Ended Programmer operation at Mon May 31 23:21:00 2010

    Info: Quartus II Programmer was successful. 0 errors, 0 warnings

    Info: Peak virtual memory: 89 megabytes

    Info: Processing ended: Mon May 31 23:21:00 2010

    Info: Elapsed time: 00:00:02

    Info: Total CPU time (on all processors): 00:00:00

    ~/Downloads

    [NiosII EDS]$ nios2-download -g zImage.initramfs.gz

    Using cable "USB-Blaster [USB-0]", device 1, instance 0x00

    Pausing target processor: OK

    Initializing CPU cache (if present)

    OK

    Downloaded 3643KB in 0.8s (4553.7KB/s)

    Verified OK

    Starting processor at address 0xC2500000

    assertion "m_state == STATE_DEBUG" failed: file "nios2debug.cpp", line 562

    171 [sig] nios2-gdb-server 5988 c:\altera\91\nios2eds\bin\nios2-gdb-server.exe: *** fatal error - called with threadlist_ix -1

    /cygdrive/c/altera/91/nios2eds/bin/nios2-download: line 595: 5988 Hangup nios2-gdb-server --go --tcpport none --write-pid ./nios2-download.pid ./zImage.initramfs.gz.srec

    ~/Downloads

    [NiosII EDS]$

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I looked your address map again

    onchip_memory2_0.s1 0x08000800 - 0x08000bff

    onchip_memory2_0.s2 0x08400400 - 0x084007ffs1 and s2 should have the same address.

    - Hippo
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Hippo,

    Good tip...

    Now, I changed the onchip_memory2_0.S1 and onchip_memory2_0.S2 to same address (0x08000800).

    Well, I got two results because I ran with two USB-Blaster cable.

    One is a original ALTERA USB-Blaster cable (rev c) and other is a CUSTOM USB-Blaster cable (probably based on rev. A).

    Bellow I print the results for each case.

    Sorry for so much information.

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

    custom usb-blaster cable + linux.initramfs.gz

    [NiosII EDS]$ nios2-configure-sof embraer_top.sof

    Searching for SOF file:

    in .

    embraer_top.sof

    Info: *******************************************************************

    Info: Running Quartus II Programmer

    Info: Command: quartus_pgm --no_banner --mode=jtag -o p;embraer_top.sof

    Info: Using programming cable "USB-Blaster [USB-0]"

    Info: Started Programmer operation at Tue Jun 01 20:47:24 2010

    Info: Configuring device index 1

    Info: Device 1 contains JTAG ID code 0x020B20DD

    Info: Configuration succeeded -- 1 device(s) configured

    Info: Successfully performed operation(s)

    Info: Ended Programmer operation at Tue Jun 01 20:47:25 2010

    Info: Quartus II Programmer was successful. 0 errors, 0 warnings

    Info: Peak virtual memory: 89 megabytes

    Info: Processing ended: Tue Jun 01 20:47:25 2010

    Info: Elapsed time: 00:00:02

    Info: Total CPU time (on all processors): 00:00:00

    ~/Downloads

    [NiosII EDS]$ nios2-download -g linux.initramfs.gz

    Using cable "USB-Blaster [USB-0]", device 1, instance 0x00

    Pausing target processor: OK

    Initializing CPU cache (if present)

    OK

    Downloaded 4845KB in 84.7s (57.2KB/s)

    Verified OK

    Starting processor at address 0xC2000000

    ~/Downloads

    [NiosII EDS]$ nios2-terminal

    nios2-terminal: connected to hardware target using JTAG UART on cable

    nios2-terminal: "USB-Blaster [USB-0]", device 1, instance 0

    nios2-terminal: Warning: The JTAG cable you are using is not supported for Nios

    nios2-terminal: II systems. You may experience intermittent JTAG communication

    nios2-terminal: failures with this cable. Please use a USB Blaster revision B

    nios2-terminal: cable or another supported cable. Please refer to the file

    nios2-terminal: errata.txt included in the Nios II development kit documents

    nios2-terminal: directory for more information.

    nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate)

    Linux version 2.6.30-00494-g84a224b-dirty (tcb@vostromdv) (gcc veLinux version 2.6.30-00514-ge7e25ac-dirty (tcb@vostromdv) (gcc version 4.1.2)# 4 Mon May 31 23:02:17 BRT 2010

    console [early0] enabled

    Early printk initialized

    Linux/Nios II-MMU

    init_bootmem_node(?,0x24d3, 0x2000, 0x3000)

    free_bootmem(0x24d3000, 0xb2d000)

    reserve_bootmem(0x24d3000, 0x200)

    Built 1 zonelists in Zone order, mobility grouping off. Total pages: 4064

    Kernel command line:

    NR_IRQS:32

    PID hash table entries: 64 (order: 6, 256 bytes)

    Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)

    Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)

    We have 12288 pages of RAM

    Memory available: 11288k/4937k RAM, 0k/0k ROM (1728k kernel code, 3209k data)

    Calibrating delay loop... 49.35 BogoMIPS (lpj=246784)

    Mount-cache hash table entries: 512

    net_namespace: 296 bytes

    NET: Registered protocol family 16

    init_BSP(): registering device resources

    bio: create slab <bio-0> at 0

    NET: Registered protocol family 2

    IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

    TCP established hash table entries: 512 (order: 0, 4096 bytes)

    TCP bind hash table entries: 512 (order: -1, 2048 bytes)

    TCP: Hash tables configured (established 512 bind 512)

    TCP reno registered

    NET: Registered protocol family 1

    msgmni has been set to 22

    io scheduler noop registered

    io scheduler anticipatory registered

    io scheduler deadline registered

    io scheduler cfq registered (default)

    ttyJ0 at MMIO 0x8004d50 (irq = 1) is a Altera JTAG UART

    console handover: boot [early0] -> real [ttyJ0]

    mice: PS/2 mouse device common for all mice

    TCP cubic registered

    NET: Registered protocol family 17

    RPC: Registered udp transport module.

    RPC: Registered tcp transport module.

    sh invoked oom-killer: gfp_mask=0xd0, order=1, oomkilladj=0

    Stack from c293ce2c:<0>

    <0> 000000d0<0> c2044da4<0> 00000000<0> c24c8e80<0> 000000d0<0> 00000001<0> c202beac<0> c2541c20<0>

    <0> 00000000<0> c2209170<0> c2541c20<0> c2209170<0> c20451ac<0> 00000000<0> c21e2518<0> 00000007<0>

    <0> 0baff100<0> 000000d0<0> 00000001<0> 000000d0<0> 00000001<0> c22155e4<0> 00000000<0> 00000000<0>

    <0> c20452a0<0> 00000000<0> 00000000<0> c2541c20<0> c2048560<0> 00000001<0> 00000048<0> 00000000<0>

    <0> 00000000<0> 00000000<0> 00000042<0> 00000000<0> 00000001<0> 00000010<0> 000200d0<0> 00000001<0>

    <0> 00000000<0> 00000000<0> c24c308c<0> c2541c20<0> 01200011<0> c254b680<0> 00000000<0> 2ac06048<0>

    Call Trace:<0>

    <0> [<c20486ac>]<0> [<c200e1e4>]<0> [<c201f808>]<0> [<c200f1c0>]<0>

    <0> [<c200afd0>]<0> [<c20023b4>]<0> [<c2000cf8>]<0> [<c2000888>]<0>

    Mem-Info:

    DMA per-cpu:

    CPU 0: hi: 0, btch: 1 usd: 0

    Active_anon:12 active_file:0 inactive_anon:32

    inactive_file:0 unevictable:1794 dirty:0 writeback:0 unstable:0

    free:657 slab:280 mapped:151 pagetables:8 bounce:0

    DMA free:2628kB min:4096kB low:5120kB high:6144kB active_anon:48kB inactive_anon:128kB active_file:0kB inactive_file:0kB unevictable:7176kB present:16256kB pages_scanned:0 all_unreclaimable? no

    lowmem_reserve[]: 0 0 0

    DMA: 3*4kB 3*8kB 2*16kB 0*32kB 0*64kB 0*128kB 0*256kB 1*512kB 0*1024kB 1*2048kB 0*4096kB = 2628kB

    1794 total pagecache pages

    4096 pages RAM

    1274 pages reserved

    226 pages shared

    1972 pages non-shared

    Out of memory: kill process 587 (sh) score 30 or a child

    Killed process 587 (sh)

    Kernel panic - not syncing: Out of memory and no killable processes...

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    cont...

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

    altera usb-blaster + zimage.initramfs.gz

    [NiosII EDS]$ nios2-configure-sof embraer_top.sof

    Searching for SOF file:

    in .

    embraer_top.sof

    Info: *******************************************************************

    Info: Running Quartus II Programmer

    Info: Command: quartus_pgm --no_banner --mode=jtag -o p;embraer_top.sof

    Info: Using programming cable "USB-Blaster [USB-0]"

    Info: Started Programmer operation at Tue Jun 01 20:46:05 2010

    Info: Configuring device index 1

    Info: Device 1 contains JTAG ID code 0x020B20DD

    Info: Configuration succeeded -- 1 device(s) configured

    Info: Successfully performed operation(s)

    Info: Ended Programmer operation at Tue Jun 01 20:46:06 2010

    Info: Quartus II Programmer was successful. 0 errors, 0 warnings

    Info: Peak virtual memory: 89 megabytes

    Info: Processing ended: Tue Jun 01 20:46:06 2010

    Info: Elapsed time: 00:00:02

    Info: Total CPU time (on all processors): 00:00:00

    ~/Downloads

    [NiosII EDS]$ nios2-download -g zImage.initramfs.gz

    Using cable "USB-Blaster [USB-0]", device 1, instance 0x00

    Pausing target processor: OK

    Initializing CPU cache (if present)

    OK

    Downloaded 3643KB in 0.7s (5204.2KB/s)

    Verified OK

    Starting processor at address 0xC2500000

    assertion "m_state == STATE_DEBUG" failed: file "nios2debug.cpp", line 562

    3 [sig] nios2-gdb-server 2516 c:\altera\91\nios2eds\bin\nios2-gdb-server.exe: *** fatal error - called with threadlist_ix -1

    /cygdrive/c/altera/91/nios2eds/bin/nios2-download: line 595: 2516 Hangup nios2-gdb-server --go --tcpport none --write-pid ./nios2-download.pid ./zImage.initramfs.gz.srec

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

    altera usb-blaster + linux.initramfs.gz

    [NiosII EDS]$ nios2-configure-sof embraer_top.sof

    Searching for SOF file:

    in .

    embraer_top.sof

    Info: *******************************************************************

    Info: Running Quartus II Programmer

    Info: Command: quartus_pgm --no_banner --mode=jtag -o p;embraer_top.sof

    Info: Using programming cable "USB-Blaster [USB-0]"

    Info: Started Programmer operation at Tue Jun 01 20:45:35 2010

    Info: Configuring device index 1

    Info: Device 1 contains JTAG ID code 0x020B20DD

    Info: Configuration succeeded -- 1 device(s) configured

    Info: Successfully performed operation(s)

    Info: Ended Programmer operation at Tue Jun 01 20:45:36 2010

    Info: Quartus II Programmer was successful. 0 errors, 0 warnings

    Info: Peak virtual memory: 89 megabytes

    Info: Processing ended: Tue Jun 01 20:45:36 2010

    Info: Elapsed time: 00:00:04

    Info: Total CPU time (on all processors): 00:00:00

    ~/Downloads

    [NiosII EDS]$ nios2-download -g linux.initramfs.gz

    Using cable "USB-Blaster [USB-0]", device 1, instance 0x00

    Pausing target processor: OK

    Initializing CPU cache (if present)

    OK

    Downloaded 4845KB in 0.8s (6056.2KB/s)

    Verified OK

    Starting processor at address 0xC2000000

    assertion "m_state == STATE_DEBUG" failed: file "nios2debug.cpp", line 562

    3 [sig] nios2-gdb-server 4736 c:\altera\91\nios2eds\bin\nios2-gdb-server.exe: *** fatal error - called with threadlist_ix -1

    /cygdrive/c/altera/91/nios2eds/bin/nios2-download: line 595: 4736 Hangup nios2-gdb-server --go --tcpport none --write-pid ./nios2-download.pid ./linux.initramfs.gz.srec

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Now we have two issues,

    1. the usb blaster, please check if your jtag has proper termination.

    2. shell in the image, please make clean, use default configuration and make again.

    - Hippo