Forum Discussion

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

U-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's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I think kernel toolchain may be linking in glibc code for the div64 function. I don't know why the glibc code doesn't work in U-Boot (or why this would suddenly change).

    I ran in to something similar with mul64 recently. I worked around it by implementing my own mul64, so it wouldn't try to link in the glibc version.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Pinta, thanks for the clue.

    jhwu0625, I added gcc4 support, please pull.

    - Hippo