cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
500 Views
Registered: ‎03-07-2015

Problems in running simple LED code in Vivado SDK 2018.3

Jump to solution

I am trying to run simple led code to test the working of GPIO. I will get following errors:

C:\Users\Awais\Desktop\Microzed\xadc\project_2\project_2.sdk\xadc2\Debug/../src/helloworld.c:58: undefined reference to `XGpioPs_LookupConfig'
C:\Users\Awais\Desktop\Microzed\xadc\project_2\project_2.sdk\xadc2\Debug/../src/helloworld.c:60: undefined reference to `XGpioPs_CfgInitialize'
C:\Users\Awais\Desktop\Microzed\xadc\project_2\project_2.sdk\xadc2\Debug/../src/helloworld.c:72: undefined reference to `XGpioPs_SetDirectionPin'
C:\Users\Awais\Desktop\Microzed\xadc\project_2\project_2.sdk\xadc2\Debug/../src/helloworld.c:73: undefined reference to `XGpioPs_SetOutputEnablePin'
C:\Users\Awais\Desktop\Microzed\xadc\project_2\project_2.sdk\xadc2\Debug/../src/helloworld.c:74: undefined reference to `XGpioPs_WritePin'

While the code is like this:

#include <stdio.h>
#include "platform.h"
#include "xadcps.h"
#include "xil_types.h"
#include "xil_printf.h"
#include "xplatform_info.h"
#include "xgpiops.h"
#include "xparameters.h"
#include "xgpiops.h"
#include <math.h>

#define XPAR_AXI_XADC_0_DEVICE_ID 0
#define ledpin 52

XGpioPs Gpio;

int main()

{
    int Status;

    XGpioPs_Config *GPIOConfigPtr;

    GPIOConfigPtr = (XGpioPs_LookupConfig(XPAR_PS7_GPIO_0_DEVICE_ID));
    Status = XGpioPs_CfgInitialize(&Gpio, GPIOConfigPtr, GPIOConfigPtr->BaseAddr);
    if (Status != XST_SUCCESS)
    {
    return XST_FAILURE;
    }
    printf("XGpio Setup Successful.\n\r");

    XGpioPs_SetDirectionPin(&Gpio, ledpin, 1);
    XGpioPs_SetOutputEnablePin(&Gpio, ledpin, 1);
    XGpioPs_WritePin(&Gpio, ledpin, 0x0);

    return 0;
}


I am not sure what is causing problem. If I try to write 

GPIOConfigPtr = XGpioPs_LookupConfig(XPAR_PS7_GPIO_0_DEVICE_ID) in xparameters.h;

Then all errors will go away but it will give syntax error of

expected ';' before 'in'

Any workaround to solve this issue?

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Visitor
Visitor
427 Views
Registered: ‎03-07-2015

Solved this problem by enabling GPIO Pin in Zynq PS in IP integrator. I tried to activate through tcl script, but it did not get activated, so I activated manually.

View solution in original post

1 Reply
Highlighted
Visitor
Visitor
428 Views
Registered: ‎03-07-2015

Solved this problem by enabling GPIO Pin in Zynq PS in IP integrator. I tried to activate through tcl script, but it did not get activated, so I activated manually.

View solution in original post