[realtek-ambz2] Replace lwIP with external port

This commit is contained in:
Kuba Szczodrzyński
2023-05-27 20:54:40 +02:00
parent 4532c88873
commit babdb1287f
6 changed files with 52 additions and 32 deletions

View File

@@ -189,6 +189,9 @@ env.Replace(FREERTOS_PORT=env["FAMILY_NAME"], FREERTOS_PORT_DEFINE="REALTEK_AMBZ
queue.AddExternalLibrary("freertos")
queue.AddExternalLibrary("freertos-port")
# Sources - lwIP
queue.AddExternalLibrary("lwip", port="ambz2")
# Sources - network utilities
queue.AddLibrary(
name="ambz2_net",
@@ -216,7 +219,6 @@ queue.AddLibrary(
"+<common/network/httpd/httpd_tls.c>",
# network
"+<common/network/dhcp/dhcps.c>",
"+<common/network/sntp/sntp.c>",
# network - websocket
"+<common/network/websocket/*.c>",
# network - mdns
@@ -301,34 +303,6 @@ queue.AddLibrary(
),
)
# Sources - lwIP 2.0.2
queue.AddLibrary(
name="ambz2_lwip",
base_dir=join(COMPONENT_DIR, "common", "network", "lwip", "lwip_v2.0.2"),
srcs=[
"+<port/realtek/freertos/*.c>",
"+<src/api/*.c>",
"+<src/apps/ping/*.c>",
"+<src/apps/mdns/*.c>",
"+<src/core/*.c>",
"+<src/core/ipv4/*.c>",
"+<src/core/ipv6/*.c>",
"+<src/netif/ethernet.c>",
],
includes=[
"+<port/realtek>",
"+<port/realtek/freertos>",
"+<src/include>",
"+<src/include/netif>",
],
options=dict(
CFLAGS=[
"-Wno-implicit-function-declaration",
],
),
)
# Sources - mbedTLS
queue.AddLibrary(
name="ambz2_mbedtls",

View File

@@ -4,8 +4,14 @@
#include_next "lwipopts.h"
#define ip_addr ip4_addr // LwIP 2.0.x compatibility
#define ip_addr_t ip4_addr_t // LwIP 2.0.x compatibility
#if (!defined(LWIP_IPV4) || LWIP_IPV4) && !LWIP_IPV6
#define ip_addr ip4_addr // LwIP 2.0.x compatibility
#define ip_addr_t ip4_addr_t // LwIP 2.0.x compatibility
#endif
#if !LWIP_IPV4 && LWIP_IPV6
#define ip_addr ip6_addr // LwIP 2.0.x compatibility
#define ip_addr_t ip6_addr_t // LwIP 2.0.x compatibility
#endif
#define in_addr_t u32_t
#define IN_ADDR_T_DEFINED 1

View File

@@ -0,0 +1,10 @@
/* Copyright (c) Kuba Szczodrzyński 2023-05-27. */
#pragma once
// lwipopts.h defines `unsigned int sys_now()`, while lwip/sys.h defines `u32_t sys_now()`
// since u32_t is unsigned long, these are incompatible
#define sys_now sys_now_dummy
#include_next "lwipopts.h"
#undef sys_now
extern unsigned long sys_now(void);

View File

@@ -0,0 +1,5 @@
/* Copyright (c) Kuba Szczodrzyński 2023-05-27. */
#undef IFNAMSIZ
#include_next "wireless.h"

View File

@@ -121,5 +121,25 @@
"+<src/include/ipv4>",
"+<port>"
]
},
"lwip-ambz2": {
"package": "library-lwip",
"sources": [
"+<src/api/*.c>",
"+<src/core/*.c>",
"+<src/core/ipv4/*.c>",
"+<src/netif/ethernet.c>",
"+<src/netif/etharp.c>",
"+<src/apps/mdns/mdns.c>",
"+<src/apps/sntp/sntp.c>",
"+<port/realtek/freertos/ethernetif.c>",
"+<port/realtek/freertos/sys_arch.c>"
],
"includes": [
"+<src/include>",
"+<src/include/ipv4>",
"+<port/realtek>",
"+<port/realtek/freertos>"
]
}
}

View File

@@ -45,7 +45,12 @@
"any": "gccarmnoneeabi@~1.100301.0"
},
"libraries": {
"freertos": "10.0.1"
"freertos": "10.0.1",
"lwip": {
"2.0.3": "2.0.3-ambz2",
"2.1.3": "2.1.3-ambz2",
"default": "2.1.3-ambz2"
}
}
},
"framework-beken-bdk": {