Forum Discussion

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

Problems booting uClinux on Neek

I've been having some trouble getting uClinux running from flash on the NEEK Cyclone III.

What I have been able to do:

1. Build the kernel with JTAG console and Altera's standard example ptf. Run the kernel from ram using nios2-download and nios2-terminal. Get networking up and telnet into it.

2. Build the kernel with JTAG console and "Bypass output when no connection" and networking set up in the rc file. Run the kernel using nios2-download and telnet into it without running nios2-terminal.

What I have not been able to do:

3. Run the kernel built without JTAG console support. It seems to hang after downloading and I can't telnet to it.

4. Run the kernel with both JTAG and serial UART console support. As far as I understand this is not a supported configuration, but I haven't been able to...

5. Build the kernel with serial UART console support and without JTAG console support. I get a compile error:

In file included from /data/nios/nios2-linux/linux-2.6/arch/nios2/boot/compressed/misc.c:80:
/data/nios/nios2-linux/linux-2.6/arch/nios2/boot/compressed/console.c: In function `console_init':
/data/nios/nios2-linux/linux-2.6/arch/nios2/boot/compressed/console.c:82: error: `na_uart0' undeclared (first use in this function)
/data/nios/nios2-linux/linux-2.6/arch/nios2/boot/compressed/console.c:82: error: (Each undeclared identifier is reported only once
/data/nios/nios2-linux/linux-2.6/arch/nios2/boot/compressed/console.c:82: error: for each function it appears in.)
make: ***  Error 1
make: ***  Error 2
make: ***  Error 2
make: ***  Error 2
make: Leaving directory `/data/nios/nios2-linux/linux-2.6'
make: ***  Error 1

6. Build the kernel in nios2-ide

7. Run the kernel with JTAG console from CFI flash. First problem I noticed was that the reset address used by all the Altera examples is 0x100000. However, the zImage flash file generated has addresses starting at 0x500000. This seems to be controlled by the "Link address offset for booting." in the kernel config, which as I understand should only be for where the kernel goes in RAM. If I set the link address offset to 0x100000, I can't boot the kernel at all, from RAM or flash. So I had the sof changed to boot from 0x500000, but this did not help.

This is what I am doing:

in uClinux-dist directory:

make menuconfig
make vendor_hwselect images/cycloneIII_embedded_evaluation_kit_standard_sopc.ptf
make

where cycloneIII_embedded_evaluation_kit_standard_sopc.ptf is the Altera standard example modified to boot from 0x500000. then, in nios2 shell:

nios2-configure-sof images/cycloneIII_embedded_evaluation_kit_standard.sof
cd /opt/altera/nios2eds/components/altera_nios2/boot_loader_sources
nios2-flash-programmer --base=0x4000000
nios2-flash-programmer --base=0x4000000 --erase 0x8000+0x8000

Back in the uClinux-dist direcotry:

cd images
sof2flash --activeparallel --offset=0x20000 --input=cycloneIII_embedded_evaluation_kit_standard.sof --output=standard7bf.flash
nios2-flash-programmer --base=0x4000000 standard7bf.flash
elf2flash --base=0x04000000 --end=0x04FFFFFF --reset=0x00500000 --input=zImage --output=zImagebf.flash --boot=/opt/altera/nios2eds/components/altera_nios2/boot_loader_cfi.srec
nios2-flash-programmer --base=0x4000000 zImagebf.flash

Using a kernel configuration the same as the one I used for running from RAM, I can't get a nios2-terminal up this way and it doesn't come up on the network.

Any help with any of these problems would be greatly appreciated!

12 Replies

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

    Ok, I got this working, thanks hippo.

    In case it helps someone:

    It turns out that although Altera documentation says the CPU reset offset is 0x100000, the offset they actually use in the standard example (version 7.20) is 0x0. This can be found in the PTF (other useful lines included):

    reset_offset = "0x00000000";
    break_offset = "0x00000020";
    exc_offset = "0x00000020";
    CPU_RESET_ADDRESS = "0x4000000";

    or in the generated linux2.6.x/include/asm/nios2.h:

    #define CPU_RESET_ADDRESS                                     0x04000000# define CPU_EXCEPT_ADDRESS                                    0x00000020

    So, the command to generate the flash image is:

    elf2flash --base=0x04000000 --end=0x04FFFFFF --reset=0x04000000 --input=zImage --output=zImagebf.flash --boot=/opt/altera/nios2eds/components/altera_nios2/boot_loader_cfi.srec

    However, the FPGA is stored at offset 0x2000 (so, addess 0x04002000), so I don't know how this actually is supposed to ever work. Configuring the FPGA using nios2-configure-sof works though, then download Linux into flash, then the CPU reset button on the bottom of the NEEK comes in useful. With a sof/ptf changed in sopc to a CPU reset offset of 0x500000 (--reset=0x04500000) (anything large enough to fit the FPGA (sof) flash image below it should work), I can program both the FPGA and the Linux image into flash and boot into Linux from a cold start.

    So, all solved except for# 3 (running uclinux without JTAG console). Don't really need that since "Bypass output when no connection" works nicely, but should it work at all?