QuadFlash incompatible with lib_webserver?

Technical questions regarding the XTC tools and programming with XMOS.
CrAzIaNhAx
Member
Posts: 10
Joined: Thu Mar 17, 2016 7:25 am

QuadFlash incompatible with lib_webserver?

Post by CrAzIaNhAx »

Hi,

I am developing on the xCORE-200 MC Audio board and I am having issues with compiling my project with the Webserver Library (lib_webserver) with my current project. Upon further inspection of the code I have noticed my lib_tsn is using the <quadflash.h> whereas lib_webserver is using <flash.h>, as a result many conflicting type errors arise even when Webserver Flash is disabled. Has anyone else run into this issue? Is there any workaround?

Thanks,
Daniel


srinie
XCore Addict
Posts: 158
Joined: Thu Mar 20, 2014 8:04 am

Post by srinie »

Hi,
My understanding is that when flash usage switch is suppressed in lib_webserver, flash ports would be passed as null and hence should not cause any issue while build.

Can you post the error/simple project to build and check?

Regards,
srinie
CrAzIaNhAx
Member
Posts: 10
Joined: Thu Mar 17, 2016 7:25 am

Post by CrAzIaNhAx »

Yes you can pass the flash ports as Null but all the flash defines, enums and functions are still declared in the project and clash with the quad flash library.

Code: Select all

...
Analyzing main.xc
In file included from ../src/main.xc:22:
In file included from C:/xTime_Workspace_AVB/lib_webserver/api\web_server.h:10:
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:35:3: error: conflicting types for 'PROT_TYPE_NONE'
  PROT_TYPE_NONE=0, /**< No protection. */
  ^~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:36:3: error: conflicting types for 'PROT_TYPE_SR'
  PROT_TYPE_SR=1,   /**< Device can be protected by writing the status register. */
  ^~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:37:3: error: conflicting types for 'PROT_TYPE_SECS'
  PROT_TYPE_SECS=2,  /**< Device has commands for protecting individual sectors. */
  ^~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:38:3: error: conflicting types for 'PROT_TYPE_SR_2X'
  PROT_TYPE_SR_2X=3,   /**< Device can be protected by writing the status register (need double write). */
  ^~~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:39:3: error: redefinition of typedef 'fl_ProtectionType'
} fl_ProtectionType;
  ^~~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:43:3: error: conflicting types for 'SECTOR_LAYOUT_REGULAR'
  SECTOR_LAYOUT_REGULAR=0, /**< All sectors the same size. */
  ^~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:44:3: error: conflicting types for 'SECTOR_LAYOUT_IRREGULAR'
  SECTOR_LAYOUT_IRREGULAR  /**< Sectors have different sizes. */
  ^~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:45:3: error: redefinition of typedef 'fl_SectorLayout'
} fl_SectorLayout;
  ^~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:152:1: error: conflicting types for 'fl_connect'
int fl_connect(fl_SPIPorts& SPI);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:169:1: error: conflicting types for 'fl_connectToDevice'
int fl_connectToDevice(fl_SPIPorts &SPI, const fl_DeviceSpec spec[], unsigned n);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:205:1: error: conflicting types for 'fl_getSpiId'
unsigned fl_getSpiId(fl_SPIPorts & SPI, unsigned id_command);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:240:3: error: redefinition of typedef 'fl_BootImageInfo'
} fl_BootImageInfo;
  ^~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:250:1: error: conflicting types for 'fl_getFactoryImage'
int fl_getFactoryImage(fl_BootImageInfo& bootImageInfo);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:264:1: error: conflicting types for 'fl_getNextBootImage'
int fl_getNextBootImage(fl_BootImageInfo& bootImageInfo);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:275:1: error: conflicting types for 'fl_getImageVersion'
unsigned fl_getImageVersion(fl_BootImageInfo& bootImageInfo);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:295:1: error: conflicting types for 'fl_startImageAdd'
int fl_startImageAdd(fl_BootImageInfo &bootImageInfo, unsigned maxsize,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:332:1: error: conflicting types for 'fl_startImageReplace'
int fl_startImageReplace(fl_BootImageInfo &bootImageInfo, unsigned maxsize);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:358:1: error: conflicting types for 'fl_deleteImage'
int fl_deleteImage(fl_BootImageInfo &bootImageInfo);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:370:1: error: conflicting types for 'fl_startDeleteImage'
int fl_startDeleteImage(fl_BootImageInfo &bootImageInfo);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:380:1: error: conflicting types for 'fl_startImageRead'
int fl_startImageRead(fl_BootImageInfo &bootImageInfo);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../src/main.xc:22:
In file included from C:/xTime_Workspace_AVB/lib_webserver/api\web_server.h:10:
In file included from C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include\flash.h:506:
C:\Program Files (x86)\XMOS\xTIMEcomposer\Community_14.1.2\target/include/SpecEnum.h:6:3: error: conflicting types for 'UNKNOWN'
  UNKNOWN = 0,
  ^~~~~~~~~~~
xmake[1]: *** [.build/src//main.xc.pca.xml] Error 1
xmake: *** [analyze] Error 2

09:11:43 Build Finished (took 32s.436ms)
DemoniacMilk
XCore Addict
Posts: 191
Joined: Tue Jul 05, 2016 2:19 pm

Post by DemoniacMilk »

I am currently facing the same problem. Are there any solutions so far?

I tried to replace all includes of flash.h with quadflashlib.h, adjusted all fl_SPIports to fl_QSPIports and adjusted the module_build_info to use -lquadflash instead of -lflash, but still building fails due to all functions/defines being defined twice, in libquadflash and libflash.

EDIT:
I had libflash included in one of my own files (was using standard SPI for testing before). The adjustments listed above did allow building the project using the webserver and qspi flash.