Page 1 of 1

Compiling for Z.Uno throws error

Posted: 08 Mar 2020 14:30
by karlbaker
Hello,

I am attempting to modify the Adafruit library for a VEML6070 sensor to get the library to compile and run on a Z.Uno device. The .h file I am adapting has the following code to create a C++ union:

Code: Select all

  typedef union {
    struct {
      uint8_t SD:1;
      uint8_t :1;
      uint8_t IT:2;
      uint8_t ACK_THD:1;
      uint8_t ACK:1;
    } bit;
    uint8_t reg;

  } commandRegister;

  commandRegister _commandRegister;

This is used to set the i2c address of the device and bits of the structure during runtime. Unfortunately, when trying to compile the code the preprocessor runs into this condition:

Code: Select all

sdcc: Calling preprocessor...

sdcc: sdcpp.exe -nostdinc -Wall -obj-ext=.rel -D__SDCC_STACK_AUTO -D__SDCC_MODEL_LARGE -D__SDCC_INT_LONG_REENT -D__SDCC_FLOAT_REENT -D__SDCC=3_5_0 -DSDCC=350 -D__SDCC_REVISION=9253 -D__SDCC_mcs51 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem "C:\Users\Karl\AppData\Local\Arduino15\packages\Z-Uno\tools\zuno_toolchain\00.08.80/zuno_toolchain/sdcc/\bin\..\include\mcs51" -isystem "C:\Users\Karl\AppData\Local\Arduino15\packages\Z-Uno\tools\zuno_toolchain\00.08.80/zuno_toolchain/sdcc/\bin\..\include"  "C:\Users\Karl\AppData\Local\Temp\arduino_build_611864\ZUNO_VEML6070_ucxx.c" 

sdcc: Generating code...

sdcpp.exe: fatal error: when writing output to : Broken pipe

strncpyz prevented buffer overrun!

C:\Users\Karl\AppData\Local\Temp\arduino_build_355225\ZUNO_VEML6070_ucxx.c:647: syntax error: token -> ':' ; column 27

Error. SDCC returned: 1



exit status 1
Error compiling for board Z-Wave>ME Z-Uno.
The line of code where it is complaining looks like this:

Code: Select all

typedef struct cxx__class__ZUNO_VEML6070_s 
{
     cxx__class__TwoWire * _i2c;
     struct ZUNO_VEML6070::commandRegister _commandRegister;

}cxx__class__ZUNO_VEML6070;
The definition of the structure

Code: Select all

 struct ZUNO_VEML6070::commandRegister _commandRegister;
is causing the grief during preprocessing.

Could it be that the compiler is having an issue with the definition of the union and structure? Does anybody have any suggestions on how to work around this? Is this something that needs to be raised with the makers of the board?

Any help and direction is greatly appreciated.

Thanks,

Karl Baker

Re: Compiling for Z.Uno throws error

Posted: 09 Mar 2020 03:03
by PoltoS
Indeed, bit fields are not supported by SDCC compiler used in Z-Uno. You should use byte fields and then construct your bits based on them on each send/receive operation

Re: Compiling for Z.Uno throws error

Posted: 09 Mar 2020 03:03
by PoltoS
Indeed, bit fields are not supported by SDCC compiler used in Z-Uno. You should use byte fields and then construct your bits based on them on each send/receive operation

Re: Compiling for Z.Uno throws error

Posted: 09 Mar 2020 11:59
by karlbaker
Hi PoltoS,

Thanks for the update. Is there any intention of support being built into the compiler?

Thanks,

Karl

Re: Compiling for Z.Uno throws error

Posted: 09 Mar 2020 18:08
by PoltoS
No, this is very hard to implement.

But Z-Uno 7 (based on 7th gen chip) will support it for sure.

Re: Compiling for Z.Uno throws error

Posted: 09 Mar 2020 18:08
by PoltoS
No, this is very hard to implement.

But Z-Uno 7 (based on 7th gen chip) will support it for sure.

Re: Compiling for Z.Uno throws error

Posted: 21 Mar 2020 22:12
by karlbaker
Hi PoltoS,

Could you tell us when Z.Uno 7 will be available?

Also, which version of the SDCC compiler is in use today?

Just a little curious.

Thanks,

Karl Baker

Re: Compiling for Z.Uno throws error

Posted: 23 Mar 2020 02:50
by PoltoS
We use SDCC 3.8 or 3.9. We are currently working on Z-Uno 7th gen. We expect it to be ready by July.