lpcware

make*** Error 1 lpc1769

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by Zahoq on Wed Jan 07 18:02:56 MST 2015
Hello Everyone!

I work with LPCXPRESSO LPC1769, subject is fresh for me. I did project which has to control SHT71 sensor and send that data via uart and ethernet. I tried to convert periph_ethernet example into another file with functions that I'll use in main function. So I adapted enet.c by changing whole int main into:

void ETH_communication(int data1, int data2, int t)
{
uint8_t macaddr[6], *workbuff;
uint32_t physts = 0;
int32_t rxBytes, i;
bool ethpkttgl = true;
volatile int k = 1;
int data3, data4, data5, data6;
data3 = floor(data1/10);
data4 = data1 - data3*10;
data5 = floor(data2/10);
data6 = data2 - data5*10;
SystemCoreClockUpdate();
Board_Init();

/* LED0 is used for the link status, on = PHY cable detected */
/* Initial LED state is off to show an unconnected cable state */
Board_LED_Set(0, false);

/* Setup ethernet and PHY */
#if defined(USE_RMII)
Chip_ENET_Init(LPC_ETHERNET, true);

#else
Chip_ENET_Init(LPC_ETHERNET, false);
#endif

/* Setup MII clock rate and PHY address */
Chip_ENET_SetupMII(LPC_ETHERNET, Chip_ENET_FindMIIDiv(LPC_ETHERNET, 2500000), 1);

lpc_phy_init(true, localMsDelay);

/* Setup MAC address for device */
Board_ENET_GetMacADDR(macaddr);
Chip_ENET_SetADDR(LPC_ETHERNET, macaddr);

/* Setup descriptors */
InitDescriptors();

/* Enable RX/TX after descriptors are setup */
Chip_ENET_TXEnable(LPC_ETHERNET);
Chip_ENET_RXEnable(LPC_ETHERNET);
/* Only if link detected */
if (physts & PHY_LINK_CONNECTED) {
workbuff = ENET_TXBuffGet();
if (workbuff) {
/* Destination is broadcast */
for (i = 0; i < 6; i++) {
workbuff = 0xFF;
}

/* Source is this MAC address */
memcpy(&workbuff[6], macaddr, 6);

/* Size will be 128 bytes (total) */
workbuff[12] = 0;
workbuff[13] = 64;
if(t==1)
{
workbuff[14]=1;
}
if(t==0)
{
workbuff[14]=0;
}
workbuff[14] = data3;
workbuff[15] = data4;
workbuff[16] = data5;
workbuff[17] = data6;

/* Some dummy data, fill beyond end of packet */
for (i = 0; i < 128; i++) {
workbuff[i + 14] = i;                          //(uint8_t) (i & 0xFF);
}

ENET_TXQueue(128);
DEBUGOUT("Packet sent! \r\n");
Board_LED_Set(1, true);
}
}
if (ENET_IsTXFinish()) {
Board_LED_Set(1, false);
}
/* PHY status state machine, LED on when connected. This function will
   not block. */
physts = lpcPHYStsPoll();

/* Only check for connection state when the PHY status has changed */
if (physts & PHY_LINK_CHANGED) {
if (physts & PHY_LINK_CONNECTED) {
Board_LED_Set(0, true);

/* Set interface speed and duplex */
if(physts & PHY_LINK_FULLDUPLX)
Chip_ENET_SetFullDuplex(LPC_ETHERNET);
else
Chip_ENET_SetHalfDuplex(LPC_ETHERNET);
if(physts & PHY_LINK_SPEED100)
Chip_ENET_Set100Mbps(LPC_ETHERNET);
else
Chip_ENET_Set10Mbps(LPC_ETHERNET);
}
else {
Board_LED_Set(0, false);
}

DEBUGOUT("Link connect status: %d\r\n", ((physts & PHY_LINK_CONNECTED) != 0));
}
}


And created simple enet.h:

/*
* enet.h
*
*  Created on: 8 sty 2015
*      Author: Zahoq
*/

#ifndef ENET_H_
#define ENET_H_

#define ENET_NUM_TX_DESC 4
#define ENET_NUM_RX_DESC 4

#if defined(CHIP_LPC175X_6X)
#define ENET_RX_DESC_BASE        (0x2007C000)
#else
/* The Ethernet Block can only access Peripheral SRAM and External Memory. In this example,
   Peripheral SRAM is selected for storing descriptors, status arrays and send/receive buffers.*/
#define ENET_RX_DESC_BASE        (0x20000000UL)
#endif
#define ENET_RX_STAT_BASE        (ENET_RX_DESC_BASE + ENET_NUM_RX_DESC * sizeof(ENET_RXDESC_T))
#define ENET_TX_DESC_BASE        (ENET_RX_STAT_BASE + ENET_NUM_RX_DESC * sizeof(ENET_RXSTAT_T))
#define ENET_TX_STAT_BASE        (ENET_TX_DESC_BASE + ENET_NUM_TX_DESC * sizeof(ENET_TXDESC_T))
#define ENET_RX_BUF_BASE         (ENET_TX_STAT_BASE + ENET_NUM_TX_DESC * sizeof(ENET_TXSTAT_T))
#define ENET_TX_BUF_BASE         (ENET_RX_BUF_BASE  + ENET_NUM_RX_DESC * ENET_ETH_MAX_FLEN)
#define ENET_RX_BUF(i)           (ENET_RX_BUF_BASE + ENET_ETH_MAX_FLEN * i)
#define ENET_TX_BUF(i)           (ENET_TX_BUF_BASE + ENET_ETH_MAX_FLEN * i)

void ETH_communication(int data1, int data2, int t);

#endif /* ENET_H_ */


I added same includes as periph_ethernet example uses. MCU Linker is configured like in image. And still I receive make *** ERROR 1, can anyone help me with that issue? What I'm doing wrong?

Attachments

Outcomes