First some general info:
* Compiler GCC 7.2.0 GDB 8.0.1
* VisualGDB 5.3R8 Build 1973
* Visual Studio 2017
* SDK 12.0
I try to build an application using the SPI slave. But I'm out of luck quite quick.
The steps I did:
1. Set the SPI Driver to slave in the embedit framework
2. Enable SPIS in the sdk_config.h file (eg #define SPIS_ENABLED 1)
3. Enable instance 1 as this is the only slave instance availible for the nRF51 series (eg #define SPIS1_ENABLED 1)
4. Include the header files:
#include "nrf_spis.h"#include "nrf_drv_spis.h"
Now if I try to create an instance of the SPI slave with:
static const nrf_drv_spis_t m_spi_slave_1 = NRF_DRV_SPIS_INSTANCE(1);
I get the folowing error code:
"Error Failed to compile LEDBlink.cpp. GCC exited with code 1 SPI_Slave C:\Program Files (x86)\Sysprogs\VisualGDB\MSBuild\Targets\gcc.targets 85"
What am I missing here. I did use the SPI master in the past without any problem. So I'm a little bit in the dark here why this time things dont seem to work. Any help is welkom.
As you have "SPIS1_ENABLED" and "SPIS_ENABLED" set to '1', this should not fail.
I suspect that GCC or the IDE is hiding the actual error message here. Are you able to get a more detailed log? I haven't tried visualGDB, unfortunately.
This is the full error tekst:
Severity Code Description Project File Line Suppression State Error Failed to compile LEDBlink.cpp. GCC exited with code 1 SPI_Slave C:\Program Files (x86)\Sysprogs\VisualGDB\MSBuild\Targets\gcc.targets 85
So it actualy refers to the gcc.targets file Line 85 witch is this part of the gcc.target file:
<GCCCompile Condition="'%(ClCompile.ExcludedFromBuild)'!='true' AND '%(ClCompile.PrecompiledHeader)' != 'Create'" Sources = "@(ClCompile)" CommandLineSwitchDefinitionFiles="$(MSBuildThisFileDirectory)..\PropertyPages\gcc.xml;$(ExtraCFlagsDefinitionFiles)" MultiProcessorCompilation = "%(ClCompile.MultiProcessorCompilation)" ToolPath="$(GNUToolchainBinaryDirectory)" ToolchainPrefix="$(GNUToolchainPrefix)" ExtraPath="$(GNUToolchainExtraPath)" VisualGDBSettingsFile="$(VisualGDBSettingsFile)" TargetPath="$(TargetPath)" FastUpToDateCheckDatabaseFile="$(FastUpToDateCheckDatabaseFile)" RemoteBuildMakefile="$(RemoteBuildMakefile)" RemoteGCCAvailability="$(GCCAvailability)" GNUCompilerType="$(GNUCompilerType)" ExplicitSysroot="$(ExplicitSysroot)" ToolchainSettingsContainers="@(ToolchainSettingsContainer)" TestFrameworkPath="$(TestFrameworkPath)" TestFrameworkSubdirectory="$(TestFrameworkSubdirectory)" GNUToolchainEnvironmentFile="$(GNUToolchainEnvironmentFile)" > </GCCCompile>
It feels like the is some problem expanding the NRF_DRV_SPIS_INSTANCE(1) macro.
If I only put this line in my code:
I dont get any error.
Have you tried using GCC directly to see if you can extract the error message from there?
This seems to be a fault in your IDE itself, which does not convey the actual compiler error. Have you heard with visualgdb's technical support regarding this error?
Ad said:Visual Studio 2017
Do you have a particular reason for using this, rather than one of the supported IDEs ?
As Håkon Alseth says, Visual Studio is hindering rather than helping you here - it is hiding the full GCC error message from you!
The full GCC error message would tell you exactly what error was found, in what file, and exactly where in that file.
Or maybe you're looking in the wrong place for it within VS? Not many people here use VS for this, so not many can help you on this point.
That's the advantage of using a supported IDE!
Nordic MACRO such as NRF_DRV_SPSIS_INTANCES(1) and many other like that are not compatible in compilation of C++. You need to manually assign the value instead of using that macro. These kind of macro are bad programming practices anyway, avoid them if you can.