CyU3PMutex lock incomplete type

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Dear all,

to get into programming the FX3 I tried to blink the LED on the FX3 Development Kit and tried to establish some debug messages via UART.

So I took the BootLedBlink Example Project and tried to build the UART function into it. I get a bit confused of what the library source ...FX3... and ...U3P... stands for. Seems to me that every function has a BOOT member and a U3P member. What is the difference between these two?

Nevertheless I now get a compiler error:

'Invoking: Cross ARM C Compiler'

arm-none-eabi-gcc -mcpu=arm926ej-s -marm -mthumb-interwork -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall  -g3 -I"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/fw_lib/1_3_3/inc" -I"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/boot_lib/1_3_3/include" -std=gnu11 -MMD -MP -MF"main.d" -MT"main.o" -c -o "main.o" "../main.c"

In file included from C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/fw_lib/1_3_3/inc/cyu3system.h:28:0,

                 from ../main.c:27:

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/fw_lib/1_3_3/inc/cyu3dma.h:701:16: error: field 'lock' has incomplete type

     CyU3PMutex lock;            /**< Lock for this channel structure. */

I get this error even when I didn't use the cyu3dma.h header file.

Here is an excerpt from the main file:

#include "cyfx3device.h"

#include "cyfx3utils.h"

#include "cyfx3gpio.h"

#include "defines.h"

#include "cyu3system.h"

#include "cyu3error.h"

#include "cyu3system.h"

#include "cyu3types.h"

#include "cyu3uart.h"

#include "cyu3gpio.h"

#define FX3_GPIO_TEST_OUT             (50)

#ifndef NULL

#define NULL   ((void *) 0)

#endif

void

CyFxBulkSrcSinkApplnDebugInit (void)

{

....

}

int main (void)

{

    /*CyFx3BootErrorCode_t        status;*/

CyU3PIoMatrixConfig_t io_cfg;

    CyU3PReturnStatus_t status = CY_U3P_SUCCESS;

    CyBool_t                    value;

    /* Initialisiere das Gerät */

    CyU3PSysClockConfig_t clockConfig;

    clockConfig.setSysClk400 = CyFalse;

    clockConfig.cpuClkDiv = 2;

    clockConfig.dmaClkDiv = 2;

    clockConfig.mmioClkDiv =2;

    clockConfig.useStandbyClk = CyFalse;

    clockConfig.clkSrc = CY_U3P_SYS_CLK;

    status = CyU3PDeviceInit (&clockConfig);

    if (status != CY_U3P_SUCCESS)

    {

    goto handle_fatal_error;

    }

    CyFxBulkSrcSinkApplnDebugInit();

    CyU3PDebugPrint (1, "\n\ndebug initialized\r\n");

    CyFx3BootDeviceInit (CyTrue);

    /* Enable the GPIOs for the LED and the switch. */

    io_cfg.isDQ32Bit = CyFalse;

    io_cfg.s0Mode = CY_U3P_SPORT_INACTIVE;

    io_cfg.s1Mode = CY_U3P_SPORT_INACTIVE;

    io_cfg.useUart   = CyTrue;

    io_cfg.useI2C    = CyFalse;

    io_cfg.useI2S    = CyFalse;

    io_cfg.useSpi    = CyFalse;

    io_cfg.lppMode   = CY_U3P_IO_MATRIX_LPP_UART_ONLY;

    io_cfg.gpioSimpleEn[0]  = 0;

    io_cfg.gpioSimpleEn[1]  = (1 << (APP_LED_GPIO - 32)) | (1 << (APP_SWITCH_GPIO - 32));

    io_cfg.gpioComplexEn[0] = 0;

    io_cfg.gpioComplexEn[1] = (1 << (APP_LED_GPIO - 32)) | (1 << (APP_SWITCH_GPIO - 32));

    status = CyU3PDeviceConfigureIOMatrix (&io_cfg);

    if (status != CY_FX3_BOOT_SUCCESS)

    {

        return status;

    }

    /* Flash the LED to indicate that initialization succeeded. */

    CyU3PGpioSetValue (APP_LED_GPIO, CyTrue);

    CyFx3BusyWait (50000);

    CyU3PGpioSetValue (APP_LED_GPIO, CyFalse);

    CyFx3BusyWait (50000);

    CyU3PGpioSetValue (APP_LED_GPIO, CyTrue);

    CyFx3BusyWait (50000);

    CyU3PGpioSetValue (APP_LED_GPIO, CyFalse);

    /* We keep looping around and copying the state of the SWITCH GPIO onto the LED GPIO. */

    while (1)

    {

    CyU3PGpioSetValue (APP_SWITCH_GPIO, value);

    CyU3PGpioSetValue (APP_LED_GPIO, value);

        //CyFx3BootBusyWait (1000000);

        //CyFx3BootGpioSetValue (APP_LED_GPIO, CyFalse);

        CyFx3BusyWait (50000);

    }

    return 0;

    handle_fatal_error:

        /* Cannot recover from this error. */

        while (1);

}

0 Likes
1 Solution
ManaskantD_51
Employee
Employee
Welcome! 25 solutions authored 10 solutions authored

From the code it looks like you have mixed up the bootLed Example and the BulkSrcSink example.

The boot examples use the boot library which is a lighter version of the library with limited functionality. Generally, the APIs in the boot library have a prefix CyFx3 whereas the main library APIs have a prefix CyU3P.

For getting started, please start with the BulkSourceSink Example which already has a GPIO toggle functionality.

View solution in original post

0 Likes
1 Reply
ManaskantD_51
Employee
Employee
Welcome! 25 solutions authored 10 solutions authored

From the code it looks like you have mixed up the bootLed Example and the BulkSrcSink example.

The boot examples use the boot library which is a lighter version of the library with limited functionality. Generally, the APIs in the boot library have a prefix CyFx3 whereas the main library APIs have a prefix CyU3P.

For getting started, please start with the BulkSourceSink Example which already has a GPIO toggle functionality.

0 Likes