Loading...
 
Skip to main content

System Workbench for STM32


expected identifier or '(' before numeric constant

  1. ifndef BCH_H_
  2. define BCH_H_

  3. define T 15
  4. define K 5
  5. define doubleT 6

  6. include
  7. include
  8. include "lfsr.h"


void encode(lfsr shift_reg,uint8_t *gen_poly,uint8_t *msg,uint8_t *result);
int syndrome_calc(uint8_t *received,int *alpha,int i);
int decode(uint8_t *received,int *alpha,uint8_t *result);
int bma(int *alpha, int *syndr, int sigmadoubleT+1doubleT+1,int *k);

  1. endif


Hi someone could help me understand why I'm wrong about #define T 5?

Hi,

I'm not sure but maybe the T has already been defined somewhere else. I also remember T as a reserved identifier for templates. Did you try changing the macro name into something \"more\" unique.

Rgds,
Kévin

Hi,

Some one letter macro are defined in the ARM Cortex-M7 driver to access to the core control register.
Check the core_cm7.h (~ line 380)

typedef union
{
  struct
  {
    uint32_t ISR:9;                      /*!< bit:  0.. 8  Exception number */
    uint32_t _reserved0:7;               /*!< bit:  9..15  Reserved */
    uint32_t GE:4;                       /*!< bit: 16..19  Greater than or Equal flags */
    uint32_t _reserved1:4;               /*!< bit: 20..23  Reserved */
    uint32_t T:1;                        /*!< bit:     24  Thumb bit        (read 0) */
    uint32_t IT:2;                       /*!< bit: 25..26  saved IT state   (read 0) */
    uint32_t Q:1;                        /*!< bit:     27  Saturation condition flag */
    uint32_t V:1;                        /*!< bit:     28  Overflow condition code flag */
    uint32_t C:1;                        /*!< bit:     29  Carry condition code flag */
    uint32_t Z:1;                        /*!< bit:     30  Zero condition code flag */
    uint32_t N:1;                        /*!< bit:     31  Negative condition code flag */
  } b;                                   /*!< Structure used for bit  access */
  uint32_t w;                            /*!< Type      used for word access */
} xPSR_Type;


You should change your macro name to avoid modifying ARM codes.
Regards,
Kevin.