no <sys/stat.h> and <sys/types.h>

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

delphi
Posts: 16
Joined: Sat Jul 27, 2013 8:56 am

no <sys/stat.h> and <sys/types.h>

Post by delphi »

Hello,
I am trying to use lwip. It's seems need the syscalls.h in various folder. However, the syscalls.h requests <sys/stat.h> and <sys/types.h> which are not available in my keil MDK environment.
Can someone help?
Delphi
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: no <sys/stat.h> and <sys/types.h>

Post by Giovanni »

You should not use syscalls.h, it is for newlib support.

Giovanni
delphi
Posts: 16
Joined: Sat Jul 27, 2013 8:56 am

Re: no <sys/stat.h> and <sys/types.h>

Post by delphi »

But there is a lot of function call needed by the files of lwip are in sys calls.h. I attached a linking error list. Any idea?


Delphi
Attachments
08A0D078-0F20-40CD-AE53-AC4B6AB315A5.png
08A0D078-0F20-40CD-AE53-AC4B6AB315A5.png (35.72 KiB) Viewed 9554 times
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: no <sys/stat.h> and <sys/types.h>

Post by Giovanni »

You are not including all the required files, open an existing demo and look at the makefiles.

Giovanni
delphi
Posts: 16
Joined: Sat Jul 27, 2013 8:56 am

Re: no <sys/stat.h> and <sys/types.h>

Post by delphi »

Giovanni, Thanks for your advice. After I read the makefiles from the demo, I can compile my codes without error but it doesn't work. And there is a thread which is blinking the leds also stopped.
I try to make it simple and clear. I go back to my previous project which blinking leds in separate threads only(no LWIP in this project). once i turn the HAL_USE_MAC to TRUE, the leds don't blink.
And the leds blink again when i set the HAL_USE_MAC to FALSE. Any idea?
Delphi
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: no <sys/stat.h> and <sys/types.h>

Post by Giovanni »

Using the debugger, where it stops while enabling the MAC? most likely during PHY initialization. What board are you using? are your board files configured correctly for the PHY you are using?

Giovanni
delphi
Posts: 16
Joined: Sat Jul 27, 2013 8:56 am

Re: no <sys/stat.h> and <sys/types.h>

Post by delphi »

My board is STM32F4 Discovery and the PHY is DP83848. Should I set the Alternative function by my self or the init function of MAC will set for me? Will try debug tool tomorrow since it is almost mid-night in Hong Kong. Thanks anyway.
Delphi
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: no <sys/stat.h> and <sys/types.h>

Post by Giovanni »

Drivers never change pin settings by themselves, you need to create board files or change the settings at runtime.

Probably if you search the forum you will find board files for that combination (google search recommended, the forum search is broken).

Giovanni
delphi
Posts: 16
Joined: Sat Jul 27, 2013 8:56 am

Re: no <sys/stat.h> and <sys/types.h>

Post by delphi »

I did some debug and setups in board.h today. Well the LEDs blink again, but the board still doesn't reply ARP when i ping it. I read the codes in lwipthread.c, at the bottom of the file there is a switch case for determinate if the frame is IP frame or ARP frame,but it looks doesn't handle any. Should i add codes here? or Am I miss anything?

Delphi

Code: Select all

switch (htons(ethhdr->type)) {
        /* IP or ARP packet? */
        case ETHTYPE_IP:
        case ETHTYPE_ARP:
#if PPPOE_SUPPORT
        /* PPPoE packet? */
        case ETHTYPE_PPPOEDISC:
        case ETHTYPE_PPPOE:
#endif /* PPPOE_SUPPORT */
          /* full packet send to tcpip_thread to process */
          if (thisif.input(p, &thisif) == ERR_OK)
            break;
          LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: IP input error\n"));
        default:
          pbuf_free(p);
delphi
Posts: 16
Joined: Sat Jul 27, 2013 8:56 am

Re: no <sys/stat.h> and <sys/types.h>

Post by delphi »

I tried to comment out the lwipthread and wrote a test thread to check if the MAC driver is well configured. The thread init the MAC 's hard address and poll the link status then show on the LEDs. My code shown below

Code: Select all

static WORKING_AREA(waTH21,128);

static msg_t thFunc_MAC(void *arg)
{
   MACConfig MACConf;

   MACConf.mac_address[0] = 0xAA;
   MACConf.mac_address[1] = 0x55;
   MACConf.mac_address[2] = 0x13;
   MACConf.mac_address[3] = 0x37;
   MACConf.mac_address[4] = 0x01;
   MACConf.mac_address[5] = 0x10;
   
   macStart (&ETHD1, &MACConf);
   
   while(true)
   {
         if(macPollLinkStatus (&ETHD1))
            palSetPad(GPIOD, GPIOD_LED6);
         else
            palClearPad(GPIOD, GPIOD_LED6);
   }
}

It works. Once I plug the lan cable into the PHY the LED on, and it off when i unplug the cable. I am pretty sure my board files are configured properly. However, the LWIP still don't work. Anyone help?


Delphi
Post Reply