Forum Discussion
Altera_Forum
Honored Contributor
16 years agoU-Boot DIV64 Issue
I just made u-boot works with Ethernet and Flash access and try to boot the linux kernel. but there is an error exception.
--- Quote Start --- ==> imi e8060000 # # Checking Image at e8060000 .... Legacy image found Image Name: test Image Type: NIOS II Linux Kernel Image (uncompressed) Data Size: 3371311 Bytes = *** ERROR: unimplemented instruction @ c7fd5764# ## ERROR# ## Please reset board# ## --- Quote End --- after tracing the code, i found the error is caused by an 64bit-divide-64bit operation. display_options.c in u-boot/lib/ --- Quote Start --- void print_size(unsigned long long size, const char *s) { unsigned long m = 0, n; static const char names[] = {'E', 'P', 'T', 'G', 'M', 'K'}; unsigned long long d = 1ULL << (10 * ARRAY_SIZE(names)); char c = 0; unsigned int i; ... n = size / d; <=== error generated here ... --- Quote End --- Since there is no any warning/error message during u-boot compile. Does anyone have any suggestion ?12 Replies
- Altera_Forum
Honored Contributor
Did you use the nios2-generic approach in nios wiki? I didn't see this kind of error. Did you try the vmImage of uClinux-dist?
- Hippo ==> imi e4d00000 # # Checking Image at e4d00000 ... Legacy image found Image Name: Linux-2.6.30-00517-gcb688a6 Image Type: NIOS II Linux Kernel Image (gzip compressed) Data Size: 1219027 Bytes = 1.2 MB Load Address: c0000000 Entry Point: c0000000 Verifying Checksum ... OK - Altera_Forum
Honored Contributor
I created a custom design from nios2-generic.
I can get files by tftp command, read/write/erase flash, even boot uClinux kernel without any problem if commenting out print_size. two week ago, i didn't have this kind of issue. but last week, i met it suddently. even re-creating design, it still exists. :( image.c in u-boot/common/ --- Quote Start --- void genimg_print_size (uint32_t size) {# ifndef USE_HOSTCC printf ("%d Bytes\n", size); // printf ("%d Bytes = ", size); // print_size (size, "\n");# else printf ("%d Bytes = %.2f kB = %.2f MB\n", size, (double)size / 1.024e3, (double)size / 1.048576e6);# endif } --- Quote End --- Booting kernel message --- Quote Start --- U-Boot 2010.03-00313-gc6d7140-dirty (May 08 2010 - 18:41:13) CPU : Nios-II SYSID : 031fe837, Fri May 07 11:12:13 2010 Board : Nios-II Net: ALTERA_TSE-0 ==> bootm e8060000# # Booting kernel from Legacy Image at e8060000 Image Name: Image Type: NIOS II Linux Kernel Image (gizp compressed) Data Size: 3360162 Bytes Load Address: c0500000 Entry Point: c0500000 Verifying Checksum ... OK Uncompressing Kernel Image ... OK Uncompressing Linux... OK, booting the kernel. Linux version 2.6.30 () (gcc version 4.1.2)# 117 Sat May 8 18:24:12 CST 2010 console [early0] enabled Early printk iniitialized Linux/Nios II-MMU ... --- Quote End --- - Altera_Forum
Honored Contributor
please try save your changes and create a new branch.
git gui # save your changes git fetch origin git checkout -b newgen origin/next - Hippo - Altera_Forum
Honored Contributor
I follow your way to create a new branch.
but the result is still the same. btw, if enable CONFIG_AUTOBOOT_KEYED, u-boot will halt. the code hung is a (uint64_t) * (ulong) operation. it seems that compiled code in my environment can't handle 64b-vs-64b or 64b-vs-32b well. but there is no warning/error during compiling. so discouraged. :( - Altera_Forum
Honored Contributor
Please try this to see if there is warning,
./MAKEALL your_board Please change CONFIG_SYS_MONITOR_LEN to 0x80000 , 512K. What is your compiler version? nios2-elf-gcc -v - Hippo - Altera_Forum
Honored Contributor
no warning/error generatd by MAKEALL command.
and the result is still the same while changing CONFIG_SYS_MONITOR_LEN to 0x80000. MAKEALL result: --- Quote Start --- Configuring for target board... text data bss dec hex filename 109822 3660 41220 154702 25c4e ./u-boot --------------------- SUMMARY ---------------------------- Boards compiled: 1 ---------------------------------------------------------- --- Quote End --- my gcc version is 4.1.2 which comes within uClinux tarball and is also up-to-date. - Altera_Forum
Honored Contributor
please use nios2-elf-gcc which come with altera nios2eds.
- Hippo - Altera_Forum
Honored Contributor
the u-boot compiled by nios2-elf-gcc from altera can work correctly!
it means we have to use different toolchains for u-boot and kernel compile ?. it is a little bit inconvenient. - Altera_Forum
Honored Contributor
It might be possible to use gcc4.1.2 for u-boot. We will need to resolve the issue you found.
- Hippo - Altera_Forum
Honored Contributor
got it!
thanks for your help :)