[realtek-ambz] Update to external lwIP v2.0.0

This commit is contained in:
Kuba Szczodrzyński
2022-05-23 12:49:06 +02:00
parent 157dd2f407
commit bf4d8bb9be
12 changed files with 64 additions and 5 deletions

View File

@@ -6,7 +6,18 @@
#include <stddef.h>
#include <stdint.h>
// disable typedef in basic_types.h
#define boolean boolean_rtl
#include <strproc.h> // define string macros first
#undef isdigit // then remove them, as they conflict
#undef islower // with ctype.h macros
#undef isprint
#undef isspace
#undef isxdigit
#undef strtol
#undef strtoul
#include <ameba_soc.h>
#include <gpio_api.h>
#include <main.h>
@@ -14,6 +25,8 @@
#include <rt_lib_rom.h>
#include <rtl_lib.h>
#include <wait_api.h>
// remove previously defined workaround
#undef boolean
// stdio.h
@@ -36,3 +49,5 @@ extern void wait_us(int us);
extern int LOGUART_SetBaud(uint32_t BaudRate); // from fixups/log_uart.c
extern void DumpForOneBytes(void *addr, int cnt); // cnt max 0x70!
extern void SystemCoreClockUpdate(void);
extern int _sscanf_patch(const char *buf, const char *fmt, ...);

View File

@@ -58,9 +58,14 @@ env.Append(
"M3",
"CONFIG_PLATFORM_8711B",
("F_CPU", "166000000L"),
# LwIP options
("LWIP_TIMEVAL_PRIVATE", "0"),
("LWIP_NETIF_HOSTNAME", "1"), # to support hostname changing
("LWIP_SO_RCVBUF", "1"), # for ioctl(FIONREAD)
("ip_addr", "ip4_addr"), # LwIP 2.0.x compatibility
("ip_addr_t", "ip4_addr_t"), # LwIP 2.0.x compatibility
("IN_ADDR_T_DEFINED", "1"),
("in_addr_t", "u32_t"),
("INT_MAX", "2147483647"), # for RECV_BUFSIZE_DEFAULT
("ERRNO", "1"), # for LwIP
("vprintf", "rtl_vprintf"),
@@ -204,8 +209,8 @@ env.AddLibrary(
],
)
# Sources - lwIP 1.4.1
env.AddLibraryLwIP(version="1.4.1", port="amb1")
# Sources - lwIP 2.0.0
env.AddLibraryLwIP(version="2.0.0", port="amb1")
# Sources - mbedTLS
env.AddLibrary(

View File

@@ -39,7 +39,6 @@ def env_add_lwip(
],
includes=[
"+<src/include>",
"+<src/include/lwip>",
"+<src/include/ipv4>",
*port_includes,
],

View File

@@ -33,7 +33,7 @@
},
"libraries": {
"lwip": [
"v1.4.1-amb1"
"v2.0.0-amb1"
]
}
},

View File

@@ -0,0 +1,5 @@
/* Copyright (c) Kuba Szczodrzyński 2022-05-22. */
#pragma once
#include <lwip/err.h>

View File

@@ -0,0 +1,5 @@
/* Copyright (c) Kuba Szczodrzyński 2022-05-22. */
#pragma once
#include <lwip/timeouts.h>

View File

@@ -41,7 +41,10 @@
/* Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores
should be used instead */
#define LWIP_COMPAT_MUTEX 1
#define LWIP_COMPAT_MUTEX 1
#define LWIP_COMPAT_MUTEX_ALLOWED 1
#define LWIP_TCPIP_TIMEOUT 1
#define ETHARP_TRUST_IP_MAC 0
#define IP_REASSEMBLY 1

View File

@@ -1,6 +1,7 @@
// CHANGES:
// - 2022-05-08 change CONFIG_USE_POLARSSL to CONFIG_USE_MBEDTLS
// - 2022-05-08 use static int errno
// - 2022-05-18 include lwip/init.h
/**
@@ -22,6 +23,7 @@
#undef errno // undefine __errno() macro
extern int errno; // use a static errno
#include <lwip/init.h>
/*For MP mode setting*/
//#define SUPPORT_MP_MODE 1

View File

@@ -0,0 +1,5 @@
/* Copyright (c) Kuba Szczodrzyński 2022-05-23. */
#pragma once
#include <lwip/sockets.h>

View File

@@ -0,0 +1,5 @@
/* Copyright (c) Kuba Szczodrzyński 2022-05-22. */
#pragma once
#include <lwip/sys.h>

View File

@@ -0,0 +1,5 @@
/* Copyright (c) Kuba Szczodrzyński 2022-05-22. */
#pragma once
#include <lwip/tcpip.h>

View File

@@ -0,0 +1,10 @@
/* Copyright (c) Kuba Szczodrzyński 2022-05-23. */
#pragma once
#include <lwip/udp.h>
// this is included only by wifi_simple_config.c
// which uses lwip_ntohl without parentheses
// so the #define from lwip/def.h doesn't work
#define lwip_ntohl lwip_htonl