public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Andreas Schweigstill <andreas@schweigstill.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Spartan FPGA patch
Date: Wed, 07 Nov 2007 17:49:36 +0100	[thread overview]
Message-ID: <4731ECA0.1010502@schweigstill.de> (raw)
In-Reply-To: <20071107133324.CBCAC248D3@gemini.denx.de>

Hello!

Wolfgang Denk schrieb:
> Oops? I can't parse that. What's the difference between "signed char"
> and "int" except the number of bits?

Like mentioned before, accessing data via a (signed|unsigned|.) char *
is independant of the processor endianess. If you want to read a
bitstream which is bytewise formatted you don't want to care about
endianess. Or do you also want some endianess string definitions?

#ifdef __LITTLE_ENDIAN
const char my_text[] = "sihT si xe a \0\0te";
#endif
#ifdef __BIG_ENDIAN
const char my_text[] = "This is a text";
#endif

int * p_text = (int *)my_text;


And it is even worse; on some architectures, like ARM, it is not
allowed to do a 16/32 bit memory access on a non-aligned address,
e.g.:

int val;
int * p_data;

p_data = (int *)0x23400001;
val = *p_data;


Depending of the ARM implementation you either get a data abort or
an "implementation depending" wrong value in val. For write access
it is even worse because this can overwrite some memory.

With best regards
Andreas Schweigstill

-- 
Dipl.-Phys. Andreas Schweigstill
Schweigstill IT | Embedded Systems
Schauenburgerstra?e 116, D-24118 Kiel, Germany
Phone: (+49) 431 5606-435, Fax: (+49) 431 5606-436
Mobile: (+49) 171 6921973, Web: http://www.schweigstill.de/

  reply	other threads:[~2007-11-07 16:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-30 15:51 [U-Boot-Users] Spartan FPGA patch Aggelos Manousarides
2007-11-03 21:46 ` Wolfgang Denk
2007-11-05 12:58   ` Aggelos Manousarides
2007-11-05 19:21     ` Wolfgang Denk
2007-11-07 11:43       ` Aggelos Manousarides
2007-11-07 13:33         ` Wolfgang Denk
2007-11-07 16:49           ` Andreas Schweigstill [this message]
2007-11-07 19:51             ` Wolfgang Denk
2007-11-14 12:05               ` Aggelos Manousarides
2007-11-14 19:46                 ` Wolfgang Denk
2007-11-07 14:29       ` Matthias Fuchs
2007-11-07 19:48         ` Wolfgang Denk
2007-11-07 21:07           ` Jerry Van Baren

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=4731ECA0.1010502@schweigstill.de \
    --to=andreas@schweigstill.de \
    --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