Syntax error sometimes with IO port pin assignments


Not sure if this question should be under RX forums or here. I'm seeing errors in the e2 studio IDE regarding assignment of some IO port pins, but not all. For example:

If i write:


this is deemed OK by the editor / builder, but if i write:


i get a syntax error. I am only "allowed", in this case, to use something like:

PORT6.PDR.BYTE |= 0x10;

ie: address it as a whole byte, not a bit field.

Funny thing is, the processor i'm using (RX630 - R5F5630A) does have these pins. I've looked at the iodefine.h for the project and it also has B4 defined, same as B2:


struct st_port6 {
        union {
                  unsigned char BYTE;
                  struct {
                            unsigned char B7:1;
                            unsigned char B6:1;
                            unsigned char B5:1;
                            unsigned char B4:1;
                            unsigned char B3:1;
                            unsigned char B2:1;
                            unsigned char B1:1;
                            unsigned char B0:1;
                           } BIT;
                   } PDR;


It seems to happen randomly, for other ports as well or other bit fields sometimes. 

Does anyone have any idea of what might be causing this?

Thanks for any input.

Parents Reply
  • To me this looks like contamination by another header file that's redefining one of the parts of the expression PORT6.PDR.BIT.B4.

    Can you run the compiler command in a command prompt, except change the option that tells CCRX.EXE to compile the source file containing that statement to an object file


    to the option that tells CCRX.EXE to stop after preprocessing


    ...or move #include "iodefine.h" above your local #includes.

  • Thanks Anthony,

    I decided to try and move the iodefine to the first position above all other header files. Originally it was in second position right after stdint.h.

    However, nothing has changed, same syntax and compiler errors.

    A good thought, though. I don't think i have ever redefined any port pins, but i can check.
  • Another thought: these similar errors are fairly numerous. I don't think i would deliberately redefine anything from an MCU package define perspective, but stranger things have been known to happen...

    i'm not familiar with having the compiler output a source file. Can you tell me what i might see in this file relating to the issue? What should i look for?

    Thanks again.