This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

problem

i use keil arm rvct
and have small problem
RVCT have no #pragma pack(1)
but when i got program from my friend i didnt see this program and RVCT didnt say warning about this command - and i have problem
because this command destroy execute program
for example

#pragma pack(1)

typedef struct
{ unsigned char command; unsigned long packets; unsigned char reserved[3];

} COMMAND2;

int main()
{ COMMAND2 cmd2; unsigned long Size;

cmd2.command = 0x01; cmd2.packets = 1000; Size = cmd2.packets; Size = cmd2.command;
}

when run this program Size <> 1 at the end !!!

undetermine command #pragma pack(1) create error and compiler dont say warning about this command
if correct program for RVTC

typedef __packed struct
{ unsigned char command; unsigned long packets; unsigned char reserved[3];

} COMMAND2;

int main()
{ COMMAND2 cmd2; unsigned long Size;

cmd2.command = 0x01; cmd2.packets = 1000; Size = cmd2.packets; Size = cmd2.command;
}

we will get ok result

Parents
  • SUPER
    new version have no this problem :-)))

    IDE-Version:
    µVision3 V3.52
    Copyright (c) Keil Elektronik GmbH / Keil Software, Inc. 1995 - 2007

    Tool Version Numbers:
    Toolchain Path: BIN31\
    C Compiler: Armcc.Exe V3.1.0.903
    Assembler: Armasm.Exe V3.1.0.903
    Linker/Locator: ArmLink.Exe V3.1.0.903
    Librarian: ArmAr.Exe V3.1.0.903
    Hex Converter: FromElf.Exe V3.1.0.903
    CPU DLL: SARM.DLL V3.10
    Dialog DLL: DARMP.DLL V1.17
    Target DLL: BIN\UL2ARM.DLL V1.30
    Dialog DLL: TARMP.DLL V1.17

Reply
  • SUPER
    new version have no this problem :-)))

    IDE-Version:
    µVision3 V3.52
    Copyright (c) Keil Elektronik GmbH / Keil Software, Inc. 1995 - 2007

    Tool Version Numbers:
    Toolchain Path: BIN31\
    C Compiler: Armcc.Exe V3.1.0.903
    Assembler: Armasm.Exe V3.1.0.903
    Linker/Locator: ArmLink.Exe V3.1.0.903
    Librarian: ArmAr.Exe V3.1.0.903
    Hex Converter: FromElf.Exe V3.1.0.903
    CPU DLL: SARM.DLL V3.10
    Dialog DLL: DARMP.DLL V1.17
    Target DLL: BIN\UL2ARM.DLL V1.30
    Dialog DLL: TARMP.DLL V1.17

Children
No data