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

U-Boot : 'make' problem

Altera_Forum
Honored Contributor II
1,358 Views

Hello, 

 

I'm trying to compile a Uboot package in order to upload the .srec file to the NIOSII Cyclone board. My problem is that "make" command terminates with this message :  

 

(...) make: Entering directory `/cygdrive/c/altera/kits/nios2/examples/uboot/u-boot -1.1.2/post/cpu' make: `.depend' is up to date. make: Leaving directory `/cygdrive/c/altera/kits/nios2/examples/uboot/u-boot- 1.1.2/post/cpu' make -C tools all make: Entering directory `/cygdrive/c/altera/kits/nios2/examples/uboot/u-boot -1.1.2/tools' gcc -Wall -pedantic -idirafter ../include -DTEXT_BASE=0x018e0000 -DUSE_HOSTCC -O -c -o img2srec.o img2srec.c In file included from /usr/include/sys/unistd.h:9,                 from /usr/include/unistd.h:6,                 from img2srec.c:61: /usr/include/sys/types.h:106: conflicting types for `int8_t' /usr/include/stdint.h:38: previous declaration of `int8_t' /usr/include/sys/types.h:108: warning: redefinition of `int16_t' /usr/include/stdint.h:39: warning: `int16_t' previously declared here /usr/include/sys/types.h:110: warning: redefinition of `int32_t' /usr/include/stdint.h:40: warning: `int32_t' previously declared here /usr/include/sys/types.h:112: warning: redefinition of `int64_t' /usr/include/stdint.h:45: warning: `int64_t' previously declared here make: *** Error 1 make: Leaving directory `/cygdrive/c/altera/kits/nios2/examples/uboot/u-boot- 1.1.2/tools' make: *** Error 2 

 

It seems that these variables are overlaping each others.  

 

(I've entered "make dk1c20_config" before and everything went ok) 

 

Thanks alot, 

Max
0 Kudos
18 Replies
Altera_Forum
Honored Contributor II
555 Views

Hi Max, 

 

make: Entering directory `/cygdrive/c/altera/kits/nios2/examples/uboot/u-boot-1.1.2/tools' 

 

This looks like the sources directly from sourceforge.net ... this tree assumes you 

have an appropriately configured native gcc and shell environment -- which 

doesn't come with the nios2 toolchain 8-P The easiest thing to do is get the source 

tree from http://www.pysent.com/download (http://www.pysent.com/download) -- this tree has certain "nips & tucks" 

made to build cleanly with the default nios2 toolchain (under cygwin) -- and it's 

more up-to-date than the sourceforge tree (WRT Nios-II, the sourceforge tree 

has been lagging by several months). 

 

Otherwise, you'll either need to start editing the Makefiles (and some other files), 

or build the nios2 toolchain in a standard unix environment (not cygwin). If you're 

determined to edit Makefiles, the first thing you'll want to do is disable building 

the "tools" directory by removing it from the SUBDIRS make variable -- you 

won't need any of the targets from tools to download an srec. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
555 Views

Thanks for your fast answer, 

 

But it looks like your link is broken http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif
0 Kudos
Altera_Forum
Honored Contributor II
555 Views

Sorry, I fat-fingered the URL ... it should be: 

 

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

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
555 Views

Great, it seems that there is a already compiled .srec file ready to use for altera NIOS2 cyclone board. Will spare me some &#39;makefile adventures&#39;. 

 

Thanks alot again, 

 

Max.
0 Kudos
Altera_Forum
Honored Contributor II
555 Views

Hello again, 

 

I have a new problem : 

 

I&#39;ve successfuly compiled u-boot and got my .srec file. When I download it to my board it says : 

 

$ nios2-download -g u-boot Using cable "ByteBlasterMV ", device 1, instance 0x00 Pausing target processor: OK Downloaded 112KB in 2.7s (41.4KB/s) Starting processor at address 0x018E0000 

 

... but I don&#39;t get the u-boot prompt in my terminal. It freezes. 

 

Is it normal that the downloaded size is inferior to the .srec file size ? 

 

Is it possible that the uClinux loaded into flash mem (and started automatically when the nios2 processor is set up) is the problem ? 

 

Do I have to erase the uClinux in order to keep the processor blank of duties before d/l ? 

 

Thanks, 

Max 

 

ps:Sorry if my questions are silly I&#39;m just a student http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/tongue.gif
0 Kudos
Altera_Forum
Honored Contributor II
555 Views

By despair I tried erasing the flash but of course it didn&#39;t fix anything http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif

0 Kudos
Altera_Forum
Honored Contributor II
555 Views

Hi Max, 

 

> ... but I don&#39;t get the u-boot prompt in my terminal. It freezes. 

 

What terminal software are you using? Do you have the comm 

parameters set for 115200,N,8,1? 

 

> Is it normal that the downloaded size is inferior to the .srec file size ? 

 

Yes ... an srec will be at least twice the size of its associated binary. 

 

> Do I have to erase the uClinux in order to keep the processor blank of 

> duties before d/l ? 

 

No. u-boot should be linked to an SDRAM/SRAM address. When you 

download it, the -g option will will cause u-boot to be executed. 

 

BTW: Which Cyclone board are you using? 

 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
555 Views

Hi Scott, 

 

the board I am using is the Altera Cyclone Devboard (with EP1C20), I am currently using the "standard" Nios2 from Altera&#39;s examples. 

 

I am using the MS hyperterminal to get a terminal, and it is apparently correctly configured (115200,N,8,1). 

 

I upload the SREC file through the JTAG, then I suppose it expects to get a connection through the UART, is it right ? I suppose I don&#39;t need any uCLinux running to get all this, the executable file is directly run when I upload it. Is this right ? 

 

Another question : why do I have to upload an SREC file instead of an ELF binary file ? Is there something with the legacy SDK and the &#39;old&#39; GERMS monitor ? 

 

Thanks a lot for these answers
0 Kudos
Altera_Forum
Honored Contributor II
555 Views

Hi Max, 

 

> I am currently using the "standard" Nios2 from Altera&#39;s examples. 

 

Ok. When building u-boot this is the "PK1C20_config" -- so this is correct. 

 

> I am using the MS hyperterminal to get a terminal,  

 

Ok ... make sure you&#39;re using the connector at the rear of the board (next 

to the Ethernet RJ-45). 

 

> it expects to get a connection through the UART, is it right  

 

Yes, you should see the u-boot banner, some SYSID info, then get the u-boot 

command prompt ("==>"). 

 

> I suppose I don&#39;t need any uCLinux 

 

Correct. uClinux is not needed ... in fact, u-boot is normally used to boot 

uClinux (or other OS). 

 

> why do I have to upload an SREC file instead of an ELF binary file ? 

 

I don&#39;t know the internals of nios2-download -- but probably because an srec 

download is much easier to code ;-) 

 

> Is there something with the legacy SDK and the &#39;old&#39; GERMS monitor ? 

 

Yes ... but I don&#39;t think many developers are using it. 

 

A few things to check: Confirm that your Nios-II design and the 

include/configs/PK1C20.h file match up WRT reset address, exception 

address, etc. Also, did you build the example & program it to the EPCS or 

download it via JTAG? Or are you using the factory configuration? 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
555 Views

Hi Scott, 

 

thanks for the answers. 

 

I have checked that include/configs/PK1C20.h uses the same addresses as those set in SOPC builder. I did not even build the example, I am smply using the pre-compiled SOF file I found in the example directory (1C20/standard). I did not put the SOF file in the EPCS, I upload it through uart just before uploading the srec file. 

Anyway, I dont get anything on my uart.......
0 Kudos
Altera_Forum
Honored Contributor II
555 Views

Well, sorry I had not checked everything in the PK1C20.h, some addresses were incompatible. It is fixed. 

 

When I get the prompt, I get this : 

U-Boot 1.1.2 (Apr 19 2005 - 16:56:44) CPU   : Nios-II SYSID : 192c0526, Thu Nov 25 09:37:20 2004 BOARD : Psyent PK-1C20 *** Warning - bad CRC, using default environment ==> 

 

Is the warning important, what CRC is it about ? 

 

Thanks
0 Kudos
Altera_Forum
Honored Contributor II
555 Views

Max, 

 

Great to hear things are working :-) 

 

> Is the warning important, what CRC is it about ? 

 

u-boot maintains environment variables in a flash sector. The default 

for the Altera Cyclone devkit is at 0x0002_0000 (3rd sector). 

 

When u-boot starts up it attempts to read the environment variables from 

this sector ... but runs a 32-bit CRC to ensure integrity. To get rid of the 

warning you can simply issue the &#39;saveenv&#39; command. 

 

BUT BE CAREFUL ... if you already have something else saved in that sector, 

(like uClinux) ... you might want to re-configure the environment address 

(include/configs/PK1C20.c -- see the CFG_ENV_ADDR macro). 

 

Best Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
555 Views

(Thanks for your precise details, Scott.) 

 

Hello, me _again_ with my uboot problems http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/laugh.gif  

 

I&#39;ve followed all the instructions given with U-BOOT in order to load my .bin into flash.  

 

(...) ==> cp.b 800000 0 1bdac Copy to Flash... done 

 

But when I restart am I supposed to have a sort of u-boot config prompt ? For the moment I have nothing. It says in doc that normally uboot starts automatically (because at 0x00). 

 

Ive searched troughout the net for docs about U-BOOT implementation but found nothing really interesting at this stage. 

 

Another thing : "bootm X" command returns  

 

==> bootm 0# # Booting image at 00000000 ... Bad Magic Number 

 

What does it mean ? 

 

If someone can help,  

thanks. 

 

Max
0 Kudos
Altera_Forum
Honored Contributor II
555 Views

Hi Max, 

 

> But when I restart am I supposed to have a sort of u-boot config prompt ? 

 

Yes. Normally, u-boot is stored in flash at the reset address. At startup, 

u-boot copies itself to SDRAM (in this case 018e_0000), then jumps into 

SDRAM. From there, everything is the same. 

 

A few things to check if u-boot doesn&#39;t start on reset/power-on: 

 

1. Make sure u-boot is stored at the actual reset address. 

 

2. When saving u-boot to flash ... make sure you write the entire image. 

If you use loadb/loads to download the binary/srec, the actual size of the 

binary will be reported -- use the reported size. 

 

3. To check the binary image you downloaded to SRAM, you can just 

use the &#39;go&#39; command. Based on your last post, you would execute: 

 

==> go 800000 

 

Or to confirm that the image you stored in flash behaves properly: 

 

==> go 0 

 

If your new image doesn&#39;t run ... you have other problems ;-) 

 

> Another thing : "bootm X" command returns  

> ... 

 

The magic number is invalid in the image header at address 0x0.: 

 

The bootm command is used to boot a u-boot image file generated with the 

mkimage utility (it&#39;s not the same as the &#39;go&#39; command). The bootm command 

does the following: 

 

0. Checks the header magic number. 

1. Performs a 32-bit CRC check of the image header. 

2. Performs a 32-bit CRC check of the image data. 

3. Executes other consistency checks (e.g. image type, architecture, etc). 

4. Optionally decompresses the data. 

5. Relocates the data to the load address. 

6. Disables interrupts. 

7. Finally, jumps to entry point address. 

 

So, it&#39;s normally used to boot a gzipped linux kernel image. 

 

> ... 

> docs about U-BOOT implementation 

> ... 

 

This has information for a PowerPC-based board, but it&#39;s loaded with 

target-independent info as well: 

 

http://www.denx.de/twiki/bin/view/dulg/uboot (http://www.denx.de/twiki/bin/view/dulg/uboot

 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
555 Views

I checked all your precious advices then I got this : 

 

==> go 800000# # Starting application at 0x00800000 ... 

 

then ... nothing. The processor hangs, nothing else possible than reseting. 

 

Damn I must have a problem with my .bin as the one I had with my .srec !
0 Kudos
Altera_Forum
Honored Contributor II
555 Views

Egads!!! Looks like like most of the addresses have changed in the 

standard example since 4.1/Nios-II 1.0!!! That explains why you 

had to change all the addrs ... sorry about not noticing that, Max. 

 

So ... looks like the SRAM has moved as well ... so the quick-start 

info in the README needs to be updated. When you download, 

you&#39;ll have to do something like: 

 

==> loadb 2000000 

... 

==> cp.b 2000000 0 <some hex count> 

 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
555 Views

God yes it&#39;s working http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/laugh.gif  

 

Infinite thanks !
0 Kudos
Altera_Forum
Honored Contributor II
555 Views

Great! Hopefully, the sources at psyent will be updated soon 8-P 

 

Best Regards, 

--Scott
0 Kudos
Reply