uisp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Uisp-dev] [patch] Alignment on ARM


From: Raphael Assenat
Subject: Re: [Uisp-dev] [patch] Alignment on ARM
Date: Wed, 20 Apr 2005 14:39:04 -0400
User-agent: Mozilla Thunderbird 1.0 (X11/20050118)

Wojtek Kaniewski wrote:
Raphael Assenat napisaƂ(a):

The supplemental bytes are due to the sizeof(struct SPrgParams) being equal to 24 on arm due to alignment/padding of the struct by the compiler. On an x86, it is 22 bytes.

I tried using #pragma pack(1), -fpack-structs, but the size of the struct stayed at 24. Finally, I decided to copy manually all the members of the structure into the buffer and I hardcoded the length to 22 (see diff below). That worked.


struct SPrgParams {
  // ...
} __attribute__ ((packed));

should do the thing.
I tried your suggestion and it worked perfectly. And it's much cleaner.

Regards,
Raphael Assenat

diff -Nru uisp/src/Stk500.h uisp-edited2/src/Stk500.h
--- uisp/src/Stk500.h   2005-04-19 11:19:54.859217144 -0400
+++ uisp-edited2/src/Stk500.h   2005-04-20 14:32:06.220387296 -0400
@@ -66,7 +66,7 @@
   const TByte eepromsize[2];    // Size of eeprom in bytes.
   const TByte flashsize[4];     // Size of FLASH in bytes.
   const TByte sync;             // Always 0x20 (Sync_CRC_EOP)
-};
+} __attribute__ ((packed));

 /* Set the Extened Device Programming parameters. In the future, this may
    require more than 3 arguments. */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]