Skip to content

Commit

Permalink
Merge pull request arduino#37 from bcmi-labs/fix_ethernet_client
Browse files Browse the repository at this point in the history
Fix ethernet client
  • Loading branch information
facchinm authored Jan 5, 2023
2 parents 4049560 + 619db76 commit 0cb999a
Show file tree
Hide file tree
Showing 185 changed files with 30,825 additions and 51 deletions.
8 changes: 4 additions & 4 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ portenta_h33.upload_port.1.pid=0x0368

portenta_h33.compiler.fsp.defines={build.variant.path}/defines.txt
portenta_h33.compiler.fsp.ldflags={build.variant.path}/ldflags.txt
portenta_h33.compiler.fsp.cflags=-mthumb -D_RA_CORE=CM33 -D_RENESAS_RA_ -DAGT_PIN_FOR_25MHZ=BSP_IO_PORT_06_PIN_00 -DAGT_TIMER_FOR_25MHZ=3
portenta_h33.compiler.fsp.cxxflags=-mthumb -D_RA_CORE=CM33 -D_RENESAS_RA_ -DAGT_PIN_FOR_25MHZ=BSP_IO_PORT_06_PIN_00 -DAGT_TIMER_FOR_25MHZ=3
portenta_h33.compiler.fsp.cflags=-mthumb @{compiler.fsp.defines}
portenta_h33.compiler.fsp.cxxflags=-mthumb @{compiler.fsp.defines}
portenta_h33.compiler.tinyusb.cflags=-DCFG_TUSB_MCU=OPT_MCU_RAXXX
portenta_h33.compiler.tinyusb.cxxflags=-DCFG_TUSB_MCU=OPT_MCU_RAXXX
portenta_h33.compiler.fsp.includes={build.variant.path}/includes.txt
Expand Down Expand Up @@ -72,8 +72,8 @@ santiago.upload_port.1.pid=0x0369

santiago.compiler.fsp.defines={build.variant.path}/defines.txt
santiago.compiler.fsp.ldflags={build.variant.path}/ldflags.txt
santiago.compiler.fsp.cflags=-mthumb -D_RA_CORE=CM4 -D_RENESAS_RA_
santiago.compiler.fsp.cxxflags=-mthumb -D_RA_CORE=CM4 -D_RENESAS_RA_
santiago.compiler.fsp.cflags=-mthumb @{compiler.fsp.defines}
santiago.compiler.fsp.cxxflags=-mthumb @{compiler.fsp.defines}
santiago.compiler.tinyusb.cflags=-DCFG_TUSB_MCU=OPT_MCU_RAXXX
santiago.compiler.tinyusb.cxxflags=-DCFG_TUSB_MCU=OPT_MCU_RAXXX
santiago.compiler.fsp.includes={build.variant.path}/includes.txt
Expand Down
1 change: 1 addition & 0 deletions cores/arduino/FifoBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <stdint.h>
#include <string.h>
#include <Arduino.h>

namespace arduino {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

#include <lwIP_Arduino.h>
#include <EthernetRA.h>

// Enter an IP address for your controller below.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
by sstaub
*/

#include <lwIP_Arduino.h>
#include <EthernetRA.h>
// the sensor communicates using SPI, so include the library:
#include <SPI.h>
Expand Down
1 change: 0 additions & 1 deletion libraries/Ethernet/examples/ChatServer/ChatServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
by sstaub
*/

#include <lwIP_Arduino.h>
#include <EthernetRA.h>

// Enter an IP address for your controller below.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
by sstaub
*/

#include <lwIP_Arduino.h>
#include <EthernetRA.h>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
by sstaub
*/

#include <lwIP_Arduino.h>
#include <EthernetRA.h>

// Enter an IP address for your controller below.
Expand Down
7 changes: 5 additions & 2 deletions libraries/Ethernet/examples/TelnetClient/TelnetClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
by sstaub
*/

#include <lwIP_Arduino.h>
#include <EthernetRA.h>

// Enter an IP address for your controller below.
Expand All @@ -37,7 +36,11 @@ EthernetClient client;

void setup() {
// start the Ethernet connection:
Ethernet.begin(ip);
if (Ethernet.begin() == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// try to configure using IP address instead of DHCP:
Ethernet.begin(ip);
}
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
This code is in the public domain.
*/

#include <lwIP_Arduino.h>
#include <EthernetRA.h>
#include <EthernetUdp.h> // UDP library from: bjoern@cs.stanford.edu 12/30/2008

Expand All @@ -35,7 +34,11 @@ EthernetUDP Udp;

void setup() {
// start the Ethernet and UDP:
Ethernet.begin(ip);
Eif (Ethernet.begin() == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// try to configure using IP address instead of DHCP:
Ethernet.begin(ip);
}
Udp.begin(localPort);

Serial.begin(9600);
Expand Down
1 change: 0 additions & 1 deletion libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/

#include <lwIP_Arduino.h>
#include <EthernetRA.h>
#include <EthernetUdp.h>

Expand Down
1 change: 0 additions & 1 deletion libraries/Ethernet/examples/WebClient/WebClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
by sstaub
*/

#include <lwIP_Arduino.h>
#include <EthernetRA.h>

// if you don't want to use DNS (and reduce your sketch size)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

#include <lwIP_Arduino.h>
#include <EthernetRA.h>

// fill in an available IP address on your network here,
Expand Down
8 changes: 5 additions & 3 deletions libraries/Ethernet/examples/WebServer/WebServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
by sstaub
*/

#include <lwIP_Arduino.h>
#include <EthernetRA.h>

// Enter an IP address for your controller below.
Expand All @@ -37,9 +36,12 @@ void setup() {
; // wait for serial port to connect. Needed for native USB port only
}


// start the Ethernet connection and the server:
Ethernet.begin(ip);
if (Ethernet.begin() == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// try to configure using IP address instead of DHCP:
Ethernet.begin(ip);
}
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
Expand Down
2 changes: 2 additions & 0 deletions libraries/Ethernet/library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ category=Communication
url=https://github.com/arduino/ArduinoCore-renesas/tree/master/libraries/Ethernet
architectures=renesas
includes=EthernetRA.h
precompiled=true
ldflags=-llwIP
2 changes: 1 addition & 1 deletion libraries/Ethernet/src/EthernetClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int EthernetClient::connect(const char *host, uint16_t port)
if (ret == 1) {
return connect(remote_addr, port);
} else {
return ret;
return 0;
}
}

Expand Down
2 changes: 1 addition & 1 deletion libraries/Ethernet/src/arch/ethernetDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ typedef enum {



#define ETHERNET_DEBUG_ENABLED 1
#define ETHERNET_DEBUG_ENABLED 0

class EthernetDriver {
public:
Expand Down
Binary file added libraries/Ethernet/src/cortex-m33/liblwIP.a
Binary file not shown.
33 changes: 33 additions & 0 deletions libraries/Ethernet/src/lwip/include/compat/posix/arpa/inet.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* @file
* This file is a posix wrapper for lwip/sockets.h.
*/

/*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
*/

#include "lwip/sockets.h"
36 changes: 36 additions & 0 deletions libraries/Ethernet/src/lwip/include/compat/posix/net/if.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* @file
* This file is a posix wrapper for lwip/if_api.h.
*/

/*
* Copyright (c) 2017 Joel Cunningham, Garmin International, Inc. <joel.cunningham@garmin.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
*/

#include "lwip/if_api.h"
33 changes: 33 additions & 0 deletions libraries/Ethernet/src/lwip/include/compat/posix/netdb.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* @file
* This file is a posix wrapper for lwip/netdb.h.
*/

/*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
*/

#include "lwip/netdb.h"
33 changes: 33 additions & 0 deletions libraries/Ethernet/src/lwip/include/compat/posix/sys/socket.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* @file
* This file is a posix wrapper for lwip/sockets.h.
*/

/*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
*/

#include "lwip/sockets.h"
33 changes: 33 additions & 0 deletions libraries/Ethernet/src/lwip/include/compat/stdc/errno.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* @file
* This file is a posix/stdc wrapper for lwip/errno.h.
*/

/*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
*/

#include "lwip/errno.h"
Loading

0 comments on commit 0cb999a

Please sign in to comment.