public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wouter Joris <wouter.joris@intersoft-electronics.com>
To: u-boot@lists.denx.de
Subject: CRC32 endianess
Date: Wed, 20 Oct 2021 14:40:22 +0200	[thread overview]
Message-ID: <75ef34e0-bd00-e914-9c9f-288fa41c41d7@intersoft-electronics.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1250 bytes --]

Dear U-boot maintainers,

I'm working on an Xilinx Zynqmp project ( Checkout tag xilinx-v2019.1 
<https://github.com/Xilinx/u-boot-xlnx/tree/xilinx-v2019.1> ) (ARM 
Cortex A53 ) and I'm facing an endianess mix-up. I'm no C-code guru, so 
I hope you'll stick here with me for a while.

In this example I'm performing a random crc check, the result was placed 
into memory.

  * ZynqMP> crc32 0x8000 0x8002 0x7999
  * crc32 0x8000 0x8002
  * crc32 for 00008000 ... 00010001 ==> 0c9cf37c

This is the result of the CRC read-back:

  * ZynqMP> md 7999 1
  * 00007999: 7cf39c0c

Also the itest confirms something is wrong with the result.

  * ZynqMP> if itest *7999 == 7cf39c0c; then echo true; else echo false; fi
  * true

  * ZynqMP> if itest *7999 == 0c9cf37c; then echo true; else echo false; fi
  * false

I know there was an historic bug 
<https://patchwork.ozlabs.org/project/uboot/patch/1365203470-9099-1-git-send-email-sjg@chromium.org/> 
about the crc endianess describing this exact problem but this issue 
seems to be addressed in later releases, as far as I know.

Uboot Xilinx crc32.c L172 
<https://github.com/Xilinx/u-boot-xlnx/blob/xilinx-v2019.1/lib/crc32.c#L172>


Can you give any advice how to proceed?

Kind regards,

Wouter Joris

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3705 bytes --]

             reply	other threads:[~2021-10-20 21:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20 12:40 Wouter Joris [this message]
2021-10-21  6:39 ` CRC32 endianess Michal Simek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=75ef34e0-bd00-e914-9c9f-288fa41c41d7@intersoft-electronics.com \
    --to=wouter.joris@intersoft-electronics.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox