From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Schweigstill Date: Wed, 07 Nov 2007 17:49:36 +0100 Subject: [U-Boot-Users] Spartan FPGA patch In-Reply-To: <20071107133324.CBCAC248D3@gemini.denx.de> References: <20071107133324.CBCAC248D3@gemini.denx.de> Message-ID: <4731ECA0.1010502@schweigstill.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.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/