Sign in

username:

password:



Not a member?

Search motoroladsp



Search tips

Subscribe to motoroladsp



motoroladsp by Keywords

56303 | 563xx | 5680 | 56805 | 5680x | 56F80 | 56F800DEMO | 56F805 | 56f807 | 56F830 | ADC | Bootloader | Codec | CodeWarrior | CW5 | CW6 | Debugger | DSP56303 | DSP56303EVM | DSP563xx | DSP5680 | DSP56800 | DSP56807 | DSP56858 | DSP56858EVM | DSP56F803 | DSP56F805 | DSP56F807 | DSP56F80x | DSP56F826 | DSP56F827 | DSP56F8xx | EVM | FFT | Flash_over_jtag | GPIO | Interrupt | Interrupts | JTAG | LCD | Linker | MCF5307 | Metrowerks | Modulus | MSCAN | PCMaster | PWM | Quad | Rif | RTOS | SDK | SPI

Sponsor

Industry's highest performing at the lowest power DSPs now as low as $5.00*
Start development today!
*volume pricing for 10ku

Discussion Groups

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | Freescale DSPs | struct alignment in 56800E

Technical discussions about Freescale (Motorola) DSPs (including the DSP56000, DSP56300, DSP56600, 56800 DSPs).

  

Post a new Thread

struct alignment in 56800E - wich...@op.pl - Nov 14 9:10:35 2007

I use 56f8366(56800E core). According to a manual for CodeWarrior for
56800E (Targeting_56800E, p. 125 and 126) structures are word aligned (or double
word, if they contain any double word variables). Shouldn't that also mean that
data inside the strucutres are word (dword) aligned? What I observed is (see
comments):

struct booStruct{
    int dummyInt;
    char singleChar;
    char charArray[10];
}

main()
{
    struct booStruct structInstance;
    char * charPtr;
    char tempChar;
    structInstance.singleChar = 0x12;
    structInstance.charArray[0] = 0x34;
    structInstance.charArray[1] = 0x56;
    ...
    charPtr = &structInstance.charArray[0];
    tempChar = *charPtr; //ERROR afetr this line here temp char should be
                         //equal to 0x34, it is equal to 0x12. Moreover,
                         //according to debugger:
                         //- address of singleChar is 0x0300;
                         //- address of charArray[0] is 0x0300;    
}
It's similiar with arrays of characters. Is that possible to align characters
(not char arrays!) inside the struct to two-byte boundaries? Just to let
pointers work correctly...

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of motoroladsp -- send a blank email to motoroladsp-subscribe@yahoogroups.com )