Syntax error sometimes with IO port pin assignments

Hi,

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:

PORT6.PDR.BIT.B2 = 1;

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

PORT6.PDR.BIT.B4 = 1;

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
  • Hi Michael,

    Thank you very much for the new iodefine file. I closed e2 studio and saved the old iodefine under a different name, then put the downloaded iodefine into my project directory, and started e2 studio again. 

    Once i open the project to the same file as before, I get the same exact problem with the exact same assignments, so at first glance, nothing seems to have changed:

    PORT6.PDR.BIT.B4 = 1;

    produces the same problem under the editor, being identified as a syntax error, but when i build, the compiler says:

    E0520134: Expected a field name ... C/C++ Problem

    Which was the same compiler error i've been getting with other similar assignment statements. It doesn't just happen with single bit fields, it also happens with larger fields, depending on...i don't know what.  Don't know where to go from here.  Any ideas?

    Thanks again.

Children
  • 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

    -output=obj

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

    -output=src

    ...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.