This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF_DRV_SPIS_INSTANCE(1) results in GCC Exits with code 1

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.

Parents
  • Hi,

     

    static const nrf_drv_spis_t m_spi_slave_1 = NRF_DRV_SPIS_INSTANCE(1);

    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.

     

    Kind regards,

    Håkon

  • Hi Håkon,

    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:

    nrf_drv_spis_t m_spi_slave_1; 

    I dont get any error.

Reply
  • Hi Håkon,

    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:

    nrf_drv_spis_t m_spi_slave_1; 

    I dont get any error.

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

    Kind regards,

    Håkon

  • Hi I was looking in the wrong window for the output from the GCC compiler (see below):

    The problem is the Macro expansion. It turned out that changing the extension of the file from CPP to C resolved the issue  (thanks to the help of Nguyen Hoan Hoang)


    1>------ Build started: Project: SPI_Slave, Configuration: Debug VisualGDB ------
    1>main.cpp
    1>main.cpp(11):
    1>C:/Users/Ad/AppData/Local/VisualGDB/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.nordic.nrf5x/12.0/nRF5x/components/drivers_nrf/spi_slave/nrf_drv_spis.h:117:1: sorry, unimplemented: non-trivial designated initializers not supported
    1> }
    1> ^
    1>main.cpp(33,45): note :  in expansion of macro 'NRF_DRV_SPIS_INSTANCE'
    1> static const nrf_drv_spis_t m_spi_slave_1 = NRF_DRV_SPIS_INSTANCE(1);
    1>                                             ^~~~~~~~~~~~~~~~~~~~~
    1>C:/Users/Ad/AppData/Local/VisualGDB/EmbeddedBSPs/arm-eabi/com.sysprogs.arm.nordic.nrf5x/12.0/nRF5x/components/drivers_nrf/spi_slave/nrf_drv_spis.h:117:1: sorry, unimplemented: non-trivial designated initializers not supported
    1> }
    1> ^
    1>main.cpp(33,45): note :  in expansion of macro 'NRF_DRV_SPIS_INSTANCE'
    1> static const nrf_drv_spis_t m_spi_slave_1 = NRF_DRV_SPIS_INSTANCE(1);
    1>                                             ^~~~~~~~~~~~~~~~~~~~~
    1>C:\Program Files (x86)\Sysprogs\VisualGDB\MSBuild\Targets\gcc.targets(206,5): error : Failed to compile main.cpp. GCC exited with code 1
    1>Done building project "SPI_Slave.vcxproj" -- FAILED.
    ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

Related