• Packed Structs with Bitfields
    Hi Guys, I'm programing my own TCP/Ip Stack. Therefore I need structs with bitfields. For eg: typedef struct __attribute__ ((packed)) { uint16_t srcPort; uint16_t dstPort; uint32_t seq;...
  • Packed structs unaligned access
    I'll start with a code sample typedef struct { uint16_t len; uint16_t crc; uint8_t data[1]; } __attribute__ ((packed)) packet_t; typedef struct { uint64_t timestamp; uint8_t val1, val2, val3...
  • Packed structure is not packed
    I would like to have a packed structure (because I'm gonna store those data in flash, and need it as small as possible). I'm using Keil 5.22 on nRF51822. typedef struct { uint16_t packedValue;...
  • Array of struct within struct
    Has anyone defined an array of struct inside another struct with C51? I can find no reference document prohibiting it. Yet, when I try to compile following fragment: #include <stdio.h> struct...
  • efficient packing
    First, I am using 7.5 so it is an old compiler, but that is the way it is. I have a number of bit variables that I am trying to pack into a byte. they are scattered all across the bit area volatile...