[realtek-ambz2] Enable compilation of Arduino core
This commit is contained in:
@@ -73,7 +73,6 @@ queue.AppendPublic(
|
||||
("ARDUINO_SDK", 1),
|
||||
],
|
||||
LINKFLAGS=[
|
||||
"--specs=nosys.specs",
|
||||
"-Wl,--as-needed",
|
||||
"-Wl,--build-id=none",
|
||||
"-Wl,--cref",
|
||||
|
||||
@@ -20,13 +20,21 @@ def env_load_defines(env: Environment, path: str):
|
||||
line = line[7:].strip()
|
||||
line = line.split(None, 2)
|
||||
if len(line) == 1:
|
||||
env.Append(CPPDEFINES=[(line[0], 1)])
|
||||
config[line[0]] = 1
|
||||
key, value = line[0], 1
|
||||
elif len(line) == 2:
|
||||
env.Append(CPPDEFINES=[(line[0], line[1])])
|
||||
config[line[0]] = line[1]
|
||||
key, value = line[0], line[1]
|
||||
else:
|
||||
raise ValueError(f"Unknown directive: {line}")
|
||||
for tpl in env["CPPDEFINES"]:
|
||||
if isinstance(tpl, tuple):
|
||||
k = tpl[0]
|
||||
else:
|
||||
k = tpl
|
||||
if k == key:
|
||||
env["CPPDEFINES"].remove(tpl)
|
||||
break
|
||||
env.Append(CPPDEFINES=[(key, value)])
|
||||
config[key] = value
|
||||
env.Append(
|
||||
CONFIG=config,
|
||||
)
|
||||
|
||||
@@ -13,6 +13,8 @@ extern "C" {
|
||||
#include <lwip/netif.h>
|
||||
}
|
||||
|
||||
#if LWIP_MDNS_RESPONDER
|
||||
|
||||
static std::vector<char *> services_name;
|
||||
static std::vector<char *> services;
|
||||
static std::vector<uint8_t> protos;
|
||||
@@ -81,7 +83,11 @@ static bool enableMDNS(struct netif *netif) {
|
||||
err_t ret = mdns_resp_add_netif(netif, hostName, 255);
|
||||
if (ret == ERR_OK) {
|
||||
LT_DM(MDNS, "mDNS started on netif %u, announcing it to network", netif->num);
|
||||
#if LWIP_VERSION_SIMPLE >= 20100
|
||||
mdns_resp_announce(netif);
|
||||
#else
|
||||
#warning "lwIP version older than 2.1.0, mdns_resp_announce() unavailable"
|
||||
#endif
|
||||
return true;
|
||||
} else {
|
||||
LT_DM(MDNS, "Cannot start mDNS on netif %u; ret=%d, errno=%d", netif->num, ret, errno);
|
||||
@@ -188,3 +194,5 @@ bool mDNS::addServiceTxtImpl(const char *service, uint8_t proto, const char *ite
|
||||
MDNSResponder MDNS;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,7 @@ using std::min;
|
||||
#include <api/ArduinoAPI.h>
|
||||
#ifdef __cplusplus
|
||||
#include <LT.h>
|
||||
using namespace arduino;
|
||||
#endif
|
||||
|
||||
// Include family-specific code
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
// clang-format on
|
||||
#endif
|
||||
|
||||
// lwIP version as a decimal number, with 2 digits for each part (major, minor, patch)
|
||||
#define LWIP_VERSION_SIMPLE (LWIP_VERSION_MAJOR * 10000 + LWIP_VERSION_MINOR * 100 + LWIP_VERSION_REVISION)
|
||||
|
||||
// remove family-defined debugging options (use lwIP defaults, or user-defined)
|
||||
#undef ETHARP_DEBUG
|
||||
#undef NETIF_DEBUG
|
||||
|
||||
@@ -5,12 +5,9 @@
|
||||
|
||||
extern "C" {
|
||||
|
||||
#include <cmsis_os.h>
|
||||
#include <core_cm4.h>
|
||||
|
||||
osThreadId main_tid = 0;
|
||||
|
||||
#if LT_AUTO_DOWNLOAD_REBOOT && defined(PIN_SERIAL2_RX) && defined(PIN_SERIAL2_TX)
|
||||
#if LT_AUTO_DOWNLOAD_REBOOT && LT_ARD_HAS_SERIAL && defined(PIN_SERIAL2_RX) && defined(PIN_SERIAL2_TX)
|
||||
void lt_init_arduino() {
|
||||
// initialize auto-download-reboot parser
|
||||
Serial2.begin(115200);
|
||||
|
||||
@@ -31,14 +31,14 @@ extern unsigned long pulseIn(uint8_t pinNumber, uint8_t state, unsigned long tim
|
||||
// digitalRead() instead yields much coarser resolution.
|
||||
PinInfo *pin = pinInfo(pinNumber);
|
||||
if (pin == NULL)
|
||||
return;
|
||||
return 0;
|
||||
uint32_t index = pinIndex(pin);
|
||||
|
||||
gpio_t *pGpio_t;
|
||||
|
||||
uint32_t start_ticks, cur_ticks;
|
||||
|
||||
if (pin < 0 || pin > PINS_COUNT || (pin->gpio == NC))
|
||||
if (pin->gpio == NC)
|
||||
return 0;
|
||||
|
||||
/* Handle */
|
||||
|
||||
@@ -14,6 +14,7 @@ extern "C" {
|
||||
// remove log_printf() if included before sdk_private.h
|
||||
#undef log_printf
|
||||
|
||||
// CMSIS & Realtek APIs
|
||||
#if LT_RTL8710B
|
||||
#include <ameba_soc.h>
|
||||
#include <rand.h>
|
||||
@@ -25,6 +26,9 @@ extern "C" {
|
||||
#include <rtl8710c.h>
|
||||
#endif
|
||||
|
||||
#include <cmsis_os.h>
|
||||
|
||||
// mbed APIs
|
||||
#include <gpio_api.h>
|
||||
#undef MBED_GPIO_API_H // ..no comment
|
||||
#include <gpio_ex_api.h>
|
||||
@@ -48,6 +52,7 @@ extern "C" {
|
||||
#include <wait_api.h>
|
||||
#include <wdt_api.h>
|
||||
|
||||
// other SDK APIs
|
||||
#if __has_include(<sdk_extern.h>)
|
||||
#include <sdk_extern.h>
|
||||
#endif
|
||||
|
||||
@@ -17,3 +17,6 @@
|
||||
#define DBG_SCE_ERR(...)
|
||||
#define DBG_SCE_WARN(...)
|
||||
#define DBG_SCE_INFO(...)
|
||||
|
||||
// ...?
|
||||
#define CONFIG_ADC_EN
|
||||
|
||||
Reference in New Issue
Block a user