Hi guys, Does anyone know how to make the Keil tool generate little endian code? Is that possible? I am using uVision 1.32 Can newest version of Keil tools generate little endian code? Thanks, Anh
"The only one that comes to mind is "LCALL", which causes a 16-bit return address to be pushed on the stack (in [i]data memory space)." ...as a little endian value. As does ACALL. And then there's DPTR - it's little endian as well. I wonder what percentage of 8051 projects actually interface to some other architecture? Mine usually do and it's always an Intel PC. I don't really care that I have to swap bytes - with a 50 watt CPU under the hood it's no trouble. It's handy for microwaving my lunch, as well.
"... always an Intel PC. I don't really care that I have to swap bytes" The conversion routines come free: htons(), ntohs(), etc are, I believe, standard & portable on both Windoze and *NIX.
Loading a short, and then byte swapping is quite inefficient; however loading a short value as 2 8 bits values produce much more efficient code. Erik