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

kernel image in SDRAM but not booting?

Altera_Forum
Honored Contributor II
2,417 Views

Hello: 

 

I have used the u-boot successully coping the uclinux kernel image from flash to sdram .I verified the contents at and near the start address of the sdram , same with the kernel image.bin using the ultraedit,md.b command.But the kernel stop .I see the file nios_linux.c I don't know what is the function kernel() ,also I can't find source file . 

Let me know why if you have any more ideas on this... 

 

 

Thank you ! 

 

 

Best Regards 

jigdo
0 Kudos
12 Replies
Altera_Forum
Honored Contributor II
539 Views

The next problem : 

 

 

I use go command but error below: 

 

*****warning unimplemented trap @ 0x100015c  

# # Application terminated, rc = 0xFFFFFF82 

 

my sdram base_addr 0x1000000 

 

 

Best Regards 

 

jigdo
0 Kudos
Altera_Forum
Honored Contributor II
539 Views

Hi jigdo, 

 

First ... what version of u-boot are you using, and where did you get it from? 

 

> I have used the u-boot successully coping the uclinux kernel image from flash to sdram 

 

How did you do this? You must use the bootm command to correctly boot a kernel. 

 

> But the kernel stop  

 

What does this mean? Please provide some details -- it is difficult for us to guess what you 

are observing ;-) 

 

> see the file nios_linux.c I don't know what is the function kernel() 

 

The _variable_ "kernel" is a function pointer ... it points to the entry point of the kernel. When 

you create a u-boot kernel image with mkimage, you specify this address with the -e option. 

 

> I use go command but error below: 

> *****warning unimplemented trap @ 0x100015c 

 

Please provide more details ... what address did you specify? ... what is at the address 

that you specify? What are you trying to do? 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
539 Views

Hi scott: 

 

 

First 

 

> How did you do this? You must use the bootm command to correctly boot a kernel. 

I use bootm command to boot a kernel: 

bootm BASE_ADDR_SDRAM  

 

>But the kernel stop 

 

What does this mean? Please provide some details -- it is difficult for us to guess what you 

are observing ;-) 

 

when the code run to the function kernel( ), in the nios2-terminal : 

 

the last line : 

Uncompressing Kernel Image ...........OK 

cursor wink 

 

> see the file nios_linux.c I don't know what is the function kernel() 

 

The _variable_ "kernel" is a function pointer ... it points to the entry point of the kernel. When 

you create a u-boot kernel image with mkimage, you specify this address with the -e option. 

 

 

I use the printf("%08x\n",hdr->ih_ep);  

the hdr->ih_ep is 0x000000001 (entry_point should be 0x1000000 (BASE_ADDR_SDRAM ) ) 

 

 

>> I use go command but error below: 

> *****warning unimplemented trap @ 0x100015c 

 

Please provide more details ... what address did you specify? ... what is at the address 

that you specify? What are you trying to do? 

 

 

I think the method is wrong . 

 

Besides ,I use the nios2-flash-programmer to download the u-boot and kernel. 

in the mkimage,the load_address and the entry_address both are BASE_ADDR_SDRAM. 

 

 

 

Best Regards 

 

jigdo
0 Kudos
Altera_Forum
Honored Contributor II
539 Views

Hi jigdo, 

 

> I use bootm command to boot a kernel: 

> bootm BASE_ADDR_SDRAM  

... 

> Uncompressing Kernel Image ...........OK 

...  

> Besides ,I use the nios2-flash-programmer to download the u-boot and kernel. 

... 

> in the mkimage,the load_address and the entry_address both 

> are BASE_ADDR_SDRAM. 

 

I _think_ I understand ... but I'm not sure. Based on your comments, you should be doing the 

following: 

 

-Use the flash programmer to download your compressed u-boot kernel image to flash. 

This is the binary file you create using mkimage. 

 

-From the u-boot command line, you should specify the address (in flash) of the image file. 

This tells u-boot to read the image from flash, uncompress it and write the uncompressed data 

to the "load address". U-boot will then disable interrupts, and jump to the "entry point address". 

 

When you try to uncompress a u-boot image to the same address as the u-boot image, 

the uncompressed data will overwrite the compressed data ... and bad things will happen ;-) 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
539 Views

Hi scott: 

 

 

Can you tell me where can I find the source code of "ntohl( )"? 

 

> I use the printf("%08x\n",hdr->ih_ep); 

the hdr->ih_ep is 0x000000001 but the entry address is 0x1000000 (base_addr_sdram) 

 

I don't know why? 

 

 

Best Regards 

 

jigdo
0 Kudos
Altera_Forum
Honored Contributor II
539 Views

Hi jigdo, 

 

Please post the result of the imi command for your u-boot kernel image. E.g. if your compressed 

kernel image is at address 0x00200000: 

 

==> imi 200000 

 

And post the result of a mkimage list. E.g. if your image file name is kernel.img: 

 

$ mkimage -l kernel.img 

 

> the hdr->ih_ep is 0x000000001 but the entry address is 0x1000000 (base_addr_sdram) 

>  

> I don't know why? 

 

It looks like an endian order problem. Did you build the mkimage utility yourself, or are you 

using the pre-built version from psyent.com

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
539 Views

Hi scott: 

 

I use the u-boot-1.1.3 downloaded from www.souceforge.net 

I see the readme the mkimag command used as fellow: 

 

mkimage -A ppc -O linux -T kernel -C gzip  

-a 0 -e 0 -n "Linux Kernel Image"  

-d linux.bin.gz uImage 

 

I think the uImage file also is .bin type file,so I use bin2flash comand convert the uImage to uImage.flash,then download to .flash file use nios2-flash-programmer . 

 

I don't have the .img file. 

 

 

>It looks like an endian order problem 

 

 

I am sure the niosII is little endian,because in the vmlinux.lds file , "OUTPUT_FORMAT("elf32-littlenios2", "elf32-littlenios2", "elf32-littlenios2")" 

 

 

 

Best Regards 

 

jigdo
0 Kudos
Altera_Forum
Honored Contributor II
539 Views

Hi jigdo, 

 

> mkimage -A ppc -O linux -T kernel -C gzip  

> -a 0 -e 0 -n "Linux Kernel Image"  

> -d linux.bin.gz uImage 

 

Based on your previous posts, this should be: 

 

mkimage -A nios2 -O linux -T kernel -C gzip  

-a 0x1000000 -e 0x1000000 -n "Linux Kernel Image"  

-d linux.bin.gz uImage 

 

> I think the uImage file also is .bin type file,so I use bin2flash comand convert the uImage 

> to uImage.flash,then download to .flash file use nios2-flash-programmer . 

 

Correct. 

 

> I don't have the .img file. 

 

It is the uImage file ... the output of mkimage. 

 

> I am sure the niosII is little endian 

 

This is irrelevant. It is the header that is apparently incorrect (which is always stored 

in network byte order by mkimage). 

 

Again, if you post the results of imi and mkimage -l, I may be able to help. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
539 Views

Hi, scott 

I got the same error. And I am from China,too. (cannot surf http://www.pysent.com) (http://www.pysent.com)) 

Could you send me the patch to other1999@163.com or jiangweiquan@hotmail.com, thank u. 

 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

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&#39; 

/usr/include/stdint.h:38: previous declaration of `int8_t&#39; 

/usr/include/sys/types.h:108: warning: redefinition of `int16_t&#39; 

/usr/include/stdint.h:39: warning: `int16_t&#39; previously declared here 

/usr/include/sys/types.h:110: warning: redefinition of `int32_t&#39; 

/usr/include/stdint.h:40: warning: `int32_t&#39; previously declared here 

/usr/include/sys/types.h:112: warning: redefinition of `int64_t&#39; 

/usr/include/stdint.h:45: warning: `int64_t&#39; previously declared here 

make[1]: *** Error 1 

make[1]: Leaving directory `/cygdrive/d/My_Project/MtxCyclone_uBoot/BootLoader/u-boot-1.1.3/tools 

make: *** [tools] Error 2[/b] 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
539 Views

Hi mountain8848, 

 

> Could you send me the patch to other1999@163.com or jiangweiquan@hotmail.com, thank u. 

 

Done ... you&#39;re more than welcome. 

 

Regards, 

--Scott 

 

BTW: The main u-boot source tree is no longer at sourceforge.net ... it has been moved 

to denx.net and is now using git (a welcome change). For details please see: 

 

http://sourceforge.net/mailarchive/message...msg_id=12658390 (http://sourceforge.net/mailarchive/message.php?msg_id=12658390)
0 Kudos
Altera_Forum
Honored Contributor II
539 Views

Hi, Scott 

 

I boot uClinux sucessfully by u-boot . Thank you again. 

My steps: 

1. Modify <u-boot>/include/configs/PK1C20.h to meet my custom board 

2. make PK1C20_config 

3. make 

4. Start HyperTerminal with the following settings:  

baudrate : 115200 

parity : None 

data bits : 8 

stop bits : 1 

flow cntl : None 

 

5. nios2-download -g u-boot 

 

I saw the command promt "==>". :-) 

=================================================== 

TODO: 

My custom board using Davicom&#39;s DM9000A(DM9000X serials). I&#39;d like to using tftp by U-boot. So: 

1. copy dm9000x.c dm9000x.h from original u-boot 1.3.1 

2. modify some codes to remove some errors and meeting my custom board 

3. make 

4. nios2-download -g u-boot 

5. in the terminal: 

==> ping 218.192.171.46 

dm9000 not found at 0x00200920 id: 0xffffffff 

MAC: ff:ff:ff:ff:ff:ff 

operating at unknown: 15 mode 

transmission timeout 

transmission timeout 

ping failed; host 218.192.171.46 is not alive 

 

 

* Maybe IO routes doesn&#39;t work well. 

 

* Another questions, I using MTD patitions over Flash. How can I access patitions in u-boot ? and How in uClinux?  

 

* I need egrep in cygwin, but this version of cygwin dose not provide egrep. I copy egrep from redhat, but not worked. what&#39;s your suggestions? 

 

regards, 

 

Will
0 Kudos
Altera_Forum
Honored Contributor II
539 Views

Hi Will, 

 

> 1. copy dm9000x.c dm9000x.h from original u-boot 1.3.1 

 

Yes, there was lots of driver code that was removed from the u-boot sources at psyent.com

mostly to keep the tarball size reasonable. But you should always be able to grab the latest 

driver code from the main u-boot source tree and just copy it into your local sources. 

 

> dm9000 not found at 0x00200920 id: 0xffffffff 

 

Perhaps, you might also want to define the CONFIG_DM9000_BASE macro using cache 

bypass (if you are using data cache). E.g. 

# define CONFIG_DM9000_BASE 0x80200920 

 

Also, you must correctly define CONFIG_DM9000_USE_xxBIT (for the bus width). 

E.g.: 

# define CONFIG_DM9000_USE_32BIT 

 

If your bus width is not 32-bit, make sure you are using native alignment rather than 

the memory/dynamic alignment. 

 

I have never used this driver in u-boot ... you may need to define CONFIG_DM9000_DEBUG 

to track down any issues. 

 

> I using MTD patitions over Flash. How can I access patitions in u-boot ? and How in uClinux? 

 

This has recently changed in u-boot ... but I believe the following should still work: 

 

- CFG_CMD_JFFS2 to CONFIG_COMMANDS 

- define CFG_JFFS_CUSTOM_PART 

- the in one of your board-specific modules, something like this:#if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CFG_JFFS_CUSTOM_PART) static struct part_info parts = {        {        /* system partition */                .size    = 0x00600000,                .offset    = (char *)(CFG_FLASH_BASE + 0x00200000),        },        {        /* /usr/local partition */                .size    = 0x00040000,                .offset    = (char *)(CFG_FLASH_BASE + 0x00800000),        } }; static int numparts = sizeof(parts)/sizeof(struct part_info); struct part_info *jffs2_part_info (int part_num) {        struct part_info *info = NULL;        if (part_num < numparts)                info = &parts;        return (info); } # endif /* (CONFIG_COMMANDS & CFG_CMD_JFFS2) */ Then you should be able to use the u-boot ls, fsload, etc. commands. To switch between the 

active partition, use the chpart command. 

 

 

BTW: in u-boot you can define a partition in ram/sdram to test your images prior to performing any 

flash programming. 

 

For linux, you will have to write your own mapping driver. 

 

Regards, 

--Scott
0 Kudos
Reply