1 Reply Latest reply on May 16, 2018 4:13 PM by RodolfoG_11

    Casting buffer pointer to struct

    AnCi_2234676

      I want to cast a byte array pointer to the following structure:

       

      typedef struct {

          uint16_t    data1;

          uint16_t    data2;

          uint16_t    data3;

          uint16_t    data4;

          uint8_t     data5;

      } BleServicesValues_t;

       

      I do something like this:

       

      void func1(uint8_t* buffer) {

          BleServicesValues_t* values;

          values = (BleServicesValues_t*) &buffer[1];

          func2(values->data1);

      }

       

      While debugging, everything looks fine, but when I step into func2, the program jumps to Fault_Handler in startup_psoc63_cm0plus.S.

       

      Does anyone understand why this is not working?