Squashed 'third_party/pico-sdk/' changes from 2062372d20..2e6142b15b
2e6142b15b SDK 1.4.0 release
5e9a5e827b Add Pico W and lwIP support
77c04e458c revert TinyUSB update (#889)
bc5d1b8485 Add channel_config_set_high_priority (#888)
85dbbfdf4d Update TinyUSB to commit 39069cf4b to pick up recent RP2040 fixes (#886)
e7267f99fe Fix GPIO # callback parameter (#880)
4c49427bf3 Fix auto_init_recursive_mutex definition for C++ (#875)
33818dd0bd Increase PLL min VCO from 400MHz to 750MHz for improved stability across operating conditions (#869)
8f09099757 sem_acquire has no reason to do a notify! (#857)
9644399993 Suppress new GCC 12 warning (#842)
b3c56e7169 Add stderr support and remove 1us timeout for timeouts of 0us (#858)
7858601a58 stdio_usb improvements (#871)
0bdd463898 Add DatanoiseTV DSP Board. (#866)
7daa20ce4c Add board definition for the RP2040 Stamp Round Carrier (#837)
705b5cedcd Wrap realloc() call with malloc_mutex in multicore (#864)
bdd9746635 Don't copy .data for NO_FLASH binaries, as it's loaded in-place (#859)
babc4a1794 Remove 'default=none' from PICO_CONFIG lines (#865)
6c19d20aa5 Fix up filename displayed by extract_config.py when an invalid attribute is found (#853)
672e48e9e9 Add sem_try_acquire(). Fixes #846 (#856)
ef47dfeeaf Add new GPIO APIs for adding shared GPIO handlers, and improve docs (#850)
6389927cf9 Add some optional header includes, to make per-target changes to config easier (#851)
d3dcbb8292 Add new user_irq claim APIs to make it easier for independent code using them to interoperate (#854)
f3c446ae14 move get_core_num() into platform.h (#852)
4e4cf11d9b Start SDK 1.3.2 development
426e46126b SDK 1.3.1 release
ebc601f71f Re-merge SDK1.3.0 history back into SDK1.3.1
1e6c122fc9 gate inclusion of pico.h in binary info, so as not to break picotool builds (#836)
7880405292 Doxygen typo (#835)
530204ec0c Small tweak to busy_wait_at_least_cycles doxygen (#834)
ea79d29cd6 Merge non-squashed history of 1.3.0 release back in to master
b2ad632c24 Minor additions to PIO documentation (#831)
658a21b946 Update rtc_set_datetime docs to point out that the written value may not be immediately visible (#832)
e44d2c0010 Add busy_wait_at_least_cycles method (#830)
43a5593e8f Pass PIOASM_EXTRA_SOURCE_FILES to Pioasm sub-cmake and add OUTPUT_FORMAT option (fixes #827) (#828)
792813926d Make pioasm accept windows CRLF input (#829)
159d552150 Fix bug in irq_remove_shared_handler and add test #823 (#825)
3a3d5fe6c4 Small IRQ doxygen tweaks (#824)
5e22c09660 convert unlikely panic to hard_assert to not waste space for string (#826)
4e62c26a2c Add documentation to dma_channel_abort regarding errata RP2040-E13 (#816)
5a927792ef Suppress false GCC 11 warning on TinyUSB (#819)
60a6fea534 Fix list management in stdio_set_driver_enabled so drivers can be freely added and removed (#822)
04c68c554b cleanup pico_stdlib_test. add actual check for __builtin bitops (#821)
0d2591e1f1 Pad all but last sector in flash binary to write whole of sector (#800)
81bdcb6681 print build type during CMake config; remove spurious call to pico_is_toplevel_project() (#818)
9c616da1e5 fix bug in pico_float_test (#817)
f260477802 Adapt assembler syntax to eliminate Clang errors. (LLVM 14.0.0) (#798)
e1c5fd34e4 PLL setup check bug (#796) (#806)
5d422deed1 Add extra info about address_range defined values (#652)
0c501c246a Add wiznet_w5100s_evb_pico support (#666)
259da19660 Include structs/iobank0.h from hardware/gpio.h (#733) (#807)
5325008956 Added board definition for upcoming Pimoroni motor driver (#795)
510ca47c92 Additional PWM validation and small tidy-up (#801)
d5121dc880 Removed unnecessary ifdefs from Pimoroni boards (#802)
3c450011da Additional param-validation for PIO (#805)
6149b9e4ec Add board definition for Seeed Xiao RP2040 (#691)
8554fc4ea1 Add is_at_the_end_of_time() method (#784)
01290c4cb3 Added int_frac function for configuring PWM (#768)
8d43364cfb Small typos (#776)
1c9f72ba1c Small edits to the Doxygen mainpage and update the RPi logo (#778)
76c1830aeb Add gpio_deinit (#793)
c66a2c1c3b Remove implicit grouping for PIO defines (#779)
e4a2aa7262 Fix typo in binary_info description (#788)
fc86203f49 comment typo (#794)
6619a2d329 Typo (#799)
5a427fbf1f irq_add_shared_handler assertion fix #724 (#747)
bb5a2a3906 Added definition for Badger RP2040 board (#735)
8291f1013a add #ifdef guards to vgaboard.h to allow user overrides (#746)
e90f831756 add board definition of eetree gamekit rp2040 (#732)
541f93541c improve comment (#658)
17d53af105 Allow 252-byte binaries to be checksummed (#764)
1896b1491b fix __ctzdi2 for values with non-zero low 32 bits (fixes #765) (#766)
3d45276423 Added board definition for upcoming Pimoroni servo driver (#769)
d35083b3f7 Fix typo in SIO register description (#770)
38b26b5d65 pico_sdk_import: don't recurse git submodules (#772)
d54104a1e5 fix when PICO_NO_BINARY_INFO is set (#693)
bc3484e793 Mark __aeabi_lmul section as allocatable and executable (#722)
b7e82b638a Fix function-names reported by hardware_pwm_test (#736)
bf9848eaf9 Updated DMA CTRL_TRIG.CHAIN_TO reset values (#743)
ae7ef546a6 Fix typo in Doxygen comment (#731)
b3cf3e8f6f Correct comment in time.h (#715)
25a3b36793 Fix assert in adc_set_round_robin() (#698)
96afce8ece Add board definition for Adafruit Macropad (#684)
5bcf4ed83a Clarify header-comments about pico_enable_stdio_ CMake-functions (#705)
e379f6764b Add board definition for RP2040 Stamp and Carrier (#696)
91462e430a Add `__attribute__((noreturn))` to `_exit` (#707)
d831eff5a2 fix pioasm python output (#694) (#695)
215f77b836 Moves the #if guards to before the comments (#690)
0f67a6c00c Add board definition for Adafruit KB2040 (#676)
add120e4f6 add missing change to dma.h from __force_inline fix (#680)
386e2a7bc6 Added Tiny2040 2MB (#672)
0562089fab fixup __forceinline for cpp code and add kitchen_sink cpp test (#670)
269332dc21 rename pybstick26_rp2040.h to garatronic_pybstick26_rp2040.h (#675)
a8fa19a74d pio_set_irqn_source_mask_enabled() sets wrong irq (#655)
699838d153 Start SDK 1.3.1 development (#648)
60c5a929cc Remove <b> from mutex doxygen due to PDF generation bug
d0af70bd77 fix __packed attribute for MSVC (#646)
da476610e2 allow override of XOSC_MHZ (#644)
d7358e4ed8 update generated struct headers to fix collision (#641)
ccccff8450 Add pybstick26_rp2040 support (#636)
d0c7642369 Update ADC ENOB comment to match (measured) value in RP2040 datasheet (#643)
cc1e2e8758 Small typo in kitchen_sink (#642)
e4d6ff9ecd Small PICO_PLATFORM=host fixes (#639)
97eec951b1 Another .org -> .com fix (#638)
fba9c8ce4d change SDK version to 1.3.0 (#628)
da7c39bc23 Fix some of the (simpler) errors reported by the doxygen command (#617)
b04a09110f revert additional assertion check which breaks used of hw_alias macro outside of functions (#635)
5641cd0a4a __aeabi_memset* were switching the wrong arguments (#634)
68555c9751 Added some waveshare boards definition (#619)
e5110dfce1 add docs for pio_instructions.h (#624)
3604a6fa13 add CONTRIBUTING.md (#626)
e850214938 Platform updates (#611)
723dfd04ff add more/better documentation to pico/multicore (#620)
05418b4e71 fix minor bug in add_repeating_timer_us, and add some comments (#621)
83cd1da1ef fix build if TinyUSB not present (#631)
0ccd0db163 Update to TinyUSB 0.12.0 (#622)
22b0d5d2ed Update links in Doxygen pages from .org to .com (#625)
3c72e753b6 Split recursive mutex into their own functions (was Reduce performance hit of recursive mutex) (#495)
9320d192c3 add watchdog_enable_caused_reboot (minor compatibility issue) (#594)
68571ad33e Hardware struct regeneration (#613)
a0450d0133 Updated reg_headers and SVD (#612)
3c94bc8137 Change _watchdog_enable to trigger immediate reboot when no delay set (#561)
f808b5f2dc Add DREQ methods for PWM/SPI/UART/I2C (#603)
2f2e62968d Use auto-generated hardware/structs/ headers (based off SVD) SVD errors fixed.
a793222331 add template PR - very polite (#596)
ec4036181f tweak info message for TinyUSB support (#590)
db47fba48d respect OUTPUT_NAME target property when generating supplemental files (#592)
a0d4bdf731 fix pico_set_printf_implementation(TARGET compiler) (#593)
d50e743e0e make type punning of floating point/int in float_math and double_math use union to avoid warnings (#600)
30673fb6d0 move inline assembly constant out into C code so it doesn't get out of range in a large function (#602)
e76d5a9008 add dma_timer related methods (#604)
9f1c37318b add irq_get_priority method - improve efficiency of irq_init_priorities (#609)
4c9ba3e8ad USB: Fix description of Length 0 in dpram_regs. Fixes #541 (#608)
ace97f3387 More accurate register access-types and reset-values (#601)
0fa58ed219 Adding/propage macros/signature typedefs for ROM functions. Make rom_func_lookup non-flash safe for flash functions (#586)
0a32023aac fix arg parsing segfault (#595)
13be546dc3 pico_stdio improvements (#598)
12017a07ab SPINLOCK regs are RW. (#599)
9319ab11d9 Add xip window alias macros (#566) (#585)
62854f5eff shrink max-page-size for linker to more sensible 4096 by default (#587)
13ed99df0d split out usb_reset_interface header into its own library for consumption by picotool or others (#589)
0fdf543126 Missing extern C in datetime.h #581 (#584)
3c53029c24 Fix some typos (#517)
ce0db40223 adafruit_feather_rp2040: Fix default I2C instance (#526)
a119b5bd9f Fix semihosting_putc (#530)
eb42ecfaa5 Added definitions for some upcoming Pimoroni LED driver boards (#535)
cd4e53a202 Use W25Q080 second stage loader for Nano RP2040 Connect (#537)
f63a14e9ee Change PWM_CH1_DIV_INT_LSB to PWM_CH0_DIV_INT_LSB (#560)
2214468b51 Add Adafruit Trinkey QT2040 board (#525)
e12713d70b pio_assembler: typo fix (#538)
e6b8c7b64e bugfix: "WO" registers should be listed in the SVD as write-only, not read-write (#544)
1d0dcc8177 pico_time: Fix alarm_pool_dump_key format string (#557)
46d8597d35 Add hardware_divider to pico_divider dependencies (#571)
d7feac1495 Fix syntax error in cmake when using custom stage2 (#580)
ca232e9404 Add Melopero Shake RP2040 Board header file (#565)
c08136b696 Move ret_dzero to the same section as it get used (#513)
672d18a6f0 Fix default PICO_BOARD value (#536)
2622e9bc29 Enable UART RX timeout IRQ, as well as RX IRQ, so that individual characters can be received.
9a586371db Add doxygen clarifying PWM behaviour when enabled/disabled, and advice for controlling the pin state when disabled (#521)
a6a436b1fe use PUBLIC for pio headers on any target except INTERFACE library
7e90980118 Add explanatory note on 7-bit I2C addresses (#520)
ae6e574f53 Improve wording of comments in irq.h (#509)
ccc0ba5649 elf2uf2: correctly parse ELF files where the program header is not directly following the file header
5e05469373 bug in sleep_until on host mode for macOS (#502)
dc4342f0f6 Update usb regs to fix https://github.com/raspberrypi/pico-feedback/issues/172
35b4965054 make sure PICO_DEFAULT_BOOT_STAGE2_FILE is defined in parent CMake file (#491)
e02c6b327d Allow one of float/double to have 'none' impl but not the other - previously caused a link error
f4ab723eb5 compile failure with PICO_STDOUT_MUTEX=0
529d7087eb fix operatore precedence of */ vs +- in pioasm
cefe5c5b2a Better support for PICO_DISABLE_SHARED_IRQ_HANDLERS (#496)
edcb65c916 Enable I2C FIFO full hold in slave mode (stretch clock when RX full), fixes #456 (#494)
f16ccfa1ff Small comment typos
44feae4caf set DIVISOR for each use of h/w divider
61b7cbdc54 Using ' inline __always_inline' also for GNUC 7. (#484)
21bbaf3ca6 remove -Winline (#481)
4328b2c75f fix pioasm python output (#479)
1f1c6162cd Header info string updates for PIO DBG_PADx and XOSC STARTUP (#478)
979045dc12 removed CMSIS from SDK doxygen
d42e6a9d10 include pico.h so that uint is defined (#475)
654b66693f start 1.3.0 development
git-subtree-dir: third_party/pico-sdk
git-subtree-split: 2e6142b15b8a75c1227dd3edbe839193b2bf9041
Signed-off-by: Ravago Jones <ravagojones@gmail.com>
Change-Id: I7d5ab3e7e797e8e956d3a651b600448157ab0608
diff --git a/src/rp2_common/pico_lwip/CMakeLists.txt b/src/rp2_common/pico_lwip/CMakeLists.txt
new file mode 100644
index 0000000..7b1a8a7
--- /dev/null
+++ b/src/rp2_common/pico_lwip/CMakeLists.txt
@@ -0,0 +1,278 @@
+if (DEFINED ENV{PICO_LWIP_PATH} AND (NOT PICO_LWIP_PATH))
+ set(PICO_LWIP_PATH $ENV{PICO_LWIP_PATH})
+ message("Using PICO_LWIP_PATH from environment ('${PICO_LWIP_PATH}')")
+endif ()
+
+set(LWIP_TEST_PATH "src/Filelists.cmake")
+if (NOT PICO_LWIP_PATH)
+ set(PICO_LWIP_PATH ${PROJECT_SOURCE_DIR}/lib/lwip)
+# if (NOT EXISTS ${PICO_LWIP_PATH}/${LWIP_TEST_PATH})
+# message(WARNING "LWIP submodule has not been initialized; Pico W wireless support will be unavailable
+#hint: try 'git submodule update --init' from your SDK directory (${PICO_SDK_PATH}).")
+# endif()
+elseif (NOT EXISTS ${PICO_LWIP_PATH}/${LWIP_TEST_PATH})
+ message(WARNING "PICO_LWIP_PATH specified but content not present.")
+endif()
+
+if (EXISTS ${PICO_LWIP_PATH}/${LWIP_TEST_PATH})
+ message("lwIP available at ${PICO_LWIP_PATH}")
+
+ # argh... wanted to use this, but they dump stuff into the source tree, which breaks parallel builds
+ #set(LWIP_DIR ${PICO_LWIP_PATH})
+ #include(${PICO_LWIP_PATH}/src/Filelists.cmake)
+
+ pico_register_common_scope_var(PICO_LWIP_PATH)
+
+ # The minimum set of files needed for lwIP.
+ add_library(pico_lwip_core INTERFACE)
+ target_sources(pico_lwip_core INTERFACE
+ ${PICO_LWIP_PATH}/src/core/init.c
+ ${PICO_LWIP_PATH}/src/core/def.c
+ ${PICO_LWIP_PATH}/src/core/dns.c
+ ${PICO_LWIP_PATH}/src/core/inet_chksum.c
+ ${PICO_LWIP_PATH}/src/core/ip.c
+ ${PICO_LWIP_PATH}/src/core/mem.c
+ ${PICO_LWIP_PATH}/src/core/memp.c
+ ${PICO_LWIP_PATH}/src/core/netif.c
+ ${PICO_LWIP_PATH}/src/core/pbuf.c
+ ${PICO_LWIP_PATH}/src/core/raw.c
+ ${PICO_LWIP_PATH}/src/core/stats.c
+ ${PICO_LWIP_PATH}/src/core/sys.c
+ ${PICO_LWIP_PATH}/src/core/altcp.c
+ ${PICO_LWIP_PATH}/src/core/altcp_alloc.c
+ ${PICO_LWIP_PATH}/src/core/altcp_tcp.c
+ ${PICO_LWIP_PATH}/src/core/tcp.c
+ ${PICO_LWIP_PATH}/src/core/tcp_in.c
+ ${PICO_LWIP_PATH}/src/core/tcp_out.c
+ ${PICO_LWIP_PATH}/src/core/timeouts.c
+ ${PICO_LWIP_PATH}/src/core/udp.c
+ ${CMAKE_CURRENT_LIST_DIR}/random.c
+ )
+ target_include_directories(pico_lwip_core INTERFACE
+ ${PICO_LWIP_PATH}/src/include)
+
+ add_library(pico_lwip_core4 INTERFACE)
+ target_sources(pico_lwip_core4 INTERFACE
+ ${PICO_LWIP_PATH}/src/core/ipv4/acd.c
+ ${PICO_LWIP_PATH}/src/core/ipv4/autoip.c
+ ${PICO_LWIP_PATH}/src/core/ipv4/dhcp.c
+ ${PICO_LWIP_PATH}/src/core/ipv4/etharp.c
+ ${PICO_LWIP_PATH}/src/core/ipv4/icmp.c
+ ${PICO_LWIP_PATH}/src/core/ipv4/igmp.c
+ ${PICO_LWIP_PATH}/src/core/ipv4/ip4_frag.c
+ ${PICO_LWIP_PATH}/src/core/ipv4/ip4.c
+ ${PICO_LWIP_PATH}/src/core/ipv4/ip4_addr.c
+ )
+
+ add_library(pico_lwip_core6 INTERFACE)
+ target_sources(pico_lwip_core6 INTERFACE
+ ${PICO_LWIP_PATH}/src/core/ipv6/dhcp6.c
+ ${PICO_LWIP_PATH}/src/core/ipv6/ethip6.c
+ ${PICO_LWIP_PATH}/src/core/ipv6/icmp6.c
+ ${PICO_LWIP_PATH}/src/core/ipv6/inet6.c
+ ${PICO_LWIP_PATH}/src/core/ipv6/ip6.c
+ ${PICO_LWIP_PATH}/src/core/ipv6/ip6_addr.c
+ ${PICO_LWIP_PATH}/src/core/ipv6/ip6_frag.c
+ ${PICO_LWIP_PATH}/src/core/ipv6/mld6.c
+ ${PICO_LWIP_PATH}/src/core/ipv6/nd6.c
+ )
+
+ # APIFILES: The files which implement the sequential and socket APIs.
+ add_library(pico_lwip_api INTERFACE)
+ target_sources(pico_lwip_api INTERFACE
+ ${PICO_LWIP_PATH}/src/api/api_lib.c
+ ${PICO_LWIP_PATH}/src/api/api_msg.c
+ ${PICO_LWIP_PATH}/src/api/err.c
+ ${PICO_LWIP_PATH}/src/api/if_api.c
+ ${PICO_LWIP_PATH}/src/api/netbuf.c
+ ${PICO_LWIP_PATH}/src/api/netdb.c
+ ${PICO_LWIP_PATH}/src/api/netifapi.c
+ ${PICO_LWIP_PATH}/src/api/sockets.c
+ ${PICO_LWIP_PATH}/src/api/tcpip.c
+ )
+
+ # Files implementing various generic network interface functions
+ add_library(pico_lwip_netif INTERFACE)
+ target_sources(pico_lwip_netif INTERFACE
+ ${PICO_LWIP_PATH}/src/netif/ethernet.c
+ ${PICO_LWIP_PATH}/src/netif/bridgeif.c
+ ${PICO_LWIP_PATH}/src/netif/bridgeif_fdb.c
+ ${PICO_LWIP_PATH}/src/netif/slipif.c
+ )
+
+ # 6LoWPAN
+ add_library(pico_lwip_sixlowpan INTERFACE)
+ target_sources(pico_lwip_sixlowpan INTERFACE
+ ${PICO_LWIP_PATH}/src/netif/lowpan6_common.c
+ ${PICO_LWIP_PATH}/src/netif/lowpan6.c
+ ${PICO_LWIP_PATH}/src/netif/lowpan6_ble.c
+ ${PICO_LWIP_PATH}/src/netif/zepif.c
+ )
+
+ # PPP
+ add_library(pico_lwip_ppp INTERFACE)
+ target_sources(pico_lwip_ppp INTERFACE
+ ${PICO_LWIP_PATH}/src/netif/ppp/auth.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/ccp.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/chap-md5.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/chap_ms.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/chap-new.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/demand.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/eap.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/ecp.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/eui64.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/fsm.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/ipcp.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/ipv6cp.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/lcp.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/magic.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/mppe.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/multilink.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/ppp.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/pppapi.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/pppcrypt.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/pppoe.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/pppol2tp.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/pppos.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/upap.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/utils.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/vj.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/polarssl/arc4.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/polarssl/des.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/polarssl/md4.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/polarssl/md5.c
+ ${PICO_LWIP_PATH}/src/netif/ppp/polarssl/sha1.c
+ )
+
+ # SNMPv3 agent
+ add_library(pico_lwip_snmp INTERFACE)
+ target_sources(pico_lwip_snmp INTERFACE
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_asn1.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_core.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_mib2.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_mib2_icmp.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_mib2_interfaces.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_mib2_ip.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_mib2_snmp.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_mib2_system.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_mib2_tcp.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_mib2_udp.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_snmpv2_framework.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_snmpv2_usm.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_msg.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmpv3.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_netconn.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_pbuf_stream.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_raw.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_scalar.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_table.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_threadsync.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmp_traps.c
+ )
+
+ # HTTP server + client
+ add_library(pico_lwip_http INTERFACE)
+ target_sources(pico_lwip_http INTERFACE
+ ${PICO_LWIP_PATH}/src/apps/http/altcp_proxyconnect.c
+ ${PICO_LWIP_PATH}/src/apps/http/fs.c
+ ${PICO_LWIP_PATH}/src/apps/http/http_client.c
+ ${PICO_LWIP_PATH}/src/apps/http/httpd.c
+ )
+
+ # MAKEFSDATA HTTP server host utility
+ add_library(pico_lwip_makefsdata INTERFACE)
+ target_sources(pico_lwip_makefsdata INTERFACE
+ ${PICO_LWIP_PATH}/src/apps/http/makefsdata/makefsdata.c
+ )
+
+ # iperf
+ add_library(pico_lwip_iperf INTERFACE)
+ target_sources(pico_lwip_iperf INTERFACE
+ ${PICO_LWIP_PATH}/src/apps/lwiperf/lwiperf.c
+ )
+
+ # SMTP client
+ add_library(pico_lwip_smtp INTERFACE)
+ target_sources(pico_lwip_smtp INTERFACE
+ ${PICO_LWIP_PATH}/src/apps/smtp/smtp.c
+ )
+
+ # SNTP client
+ add_library(pico_lwip_sntp INTERFACE)
+ target_sources(pico_lwip_sntp INTERFACE
+ ${PICO_LWIP_PATH}/src/apps/sntp/sntp.c
+ )
+
+ # MDNS responder
+ add_library(pico_lwip_mdns INTERFACE)
+ target_sources(pico_lwip_mdns INTERFACE
+ ${PICO_LWIP_PATH}/src/apps/mdns/mdns.c
+ ${PICO_LWIP_PATH}/src/apps/mdns/mdns_out.c
+ ${PICO_LWIP_PATH}/src/apps/mdns/mdns_domain.c
+ )
+
+ # NetBIOS name server
+ add_library(pico_lwip_netbios INTERFACE)
+ target_sources(pico_lwip_netbios INTERFACE
+ ${PICO_LWIP_PATH}/src/apps/netbiosns/netbiosns.c
+ )
+
+ # TFTP server files
+ add_library(pico_lwip_tftp INTERFACE)
+ target_sources(pico_lwip_tftp INTERFACE
+ ${PICO_LWIP_PATH}/src/apps/tftp/tftp.c
+ )
+
+ # MQTT client files
+ add_library(pico_lwip_mbedtls INTERFACE)
+ target_sources(pico_lwip_mbedtls INTERFACE
+ ${PICO_LWIP_PATH}/src/apps/altcp_tls/altcp_tls_mbedtls.c
+ ${PICO_LWIP_PATH}/src/apps/altcp_tls/altcp_tls_mbedtls_mem.c
+ ${PICO_LWIP_PATH}/src/apps/snmp/snmpv3_mbedtls.c
+ )
+
+
+ # All LWIP files without apps
+ add_library(pico_lwip INTERFACE)
+ target_link_libraries(pico_lwip INTERFACE
+ pico_lwip_core
+ pico_lwip_core4
+ pico_lwip_core6
+ pico_lwip_api
+ pico_lwip_netif
+ pico_lwip_sixlowpan
+ pico_lwip_ppp
+ )
+
+ # our arch/cc.h
+ add_library(pico_lwip_arch INTERFACE)
+ target_include_directories(pico_lwip_arch INTERFACE
+ ${CMAKE_CURRENT_LIST_DIR}/include)
+
+ # our nosys impl
+ add_library(pico_lwip_nosys INTERFACE)
+ target_sources(pico_lwip_nosys INTERFACE
+ ${CMAKE_CURRENT_LIST_DIR}/nosys.c
+ )
+ target_link_libraries(pico_lwip_nosys INTERFACE
+ pico_lwip_arch)
+
+
+ if (NOT PICO_LWIP_CONTRIB_PATH)
+ set(PICO_LWIP_CONTRIB_PATH ${PICO_LWIP_PATH}/contrib)
+ endif()
+ pico_register_common_scope_var(PICO_LWIP_CONTRIB_PATH)
+
+ # Make lwip_contrib_freertos library, with the FreeRTOS/lwIP code from lwip-contrib
+ add_library(pico_lwip_contrib_freertos INTERFACE)
+ target_sources(pico_lwip_contrib_freertos INTERFACE
+ ${PICO_LWIP_CONTRIB_PATH}/ports/freertos/sys_arch.c
+ )
+ target_include_directories(pico_lwip_contrib_freertos INTERFACE
+ ${PICO_LWIP_CONTRIB_PATH}/ports/freertos/include
+ )
+ target_link_libraries(pico_lwip_contrib_freertos INTERFACE
+ pico_lwip_arch)
+
+ pico_promote_common_scope_vars()
+endif()
diff --git a/src/rp2_common/pico_lwip/doc.h b/src/rp2_common/pico_lwip/doc.h
new file mode 100644
index 0000000..ede60b6
--- /dev/null
+++ b/src/rp2_common/pico_lwip/doc.h
@@ -0,0 +1,44 @@
+/**
+ * \defgroup pico_lwip pico_lwip
+ * \brief Wrapper libraries for <a href="https://savannah.nongnu.org/projects/lwip/lwIP">lwIP</a>
+ *
+ * The following libraries are provided that contain the equivalent lwIP functionality groups:
+ *
+ * * \c \b pico_lwip_core -
+ * * \c \b pico_lwip_core4 -
+ * * \c \b pico_lwip_core6 -
+ * * \c \b pico_lwip_netif -
+ * * \c \b pico_lwip_sixlowpan -
+ * * \c \b pico_lwip_ppp -
+ * * \c \b pico_lwip_api -
+ *
+ * The following libraries are provided that contain the equivalent lwIP application support:
+ *
+ * * \c \b pico_lwip_snmp -
+ * * \c \b pico_lwip_http -
+ * * \c \b pico_lwip_makefsdata -
+ * * \c \b pico_lwip_iperf -
+ * * \c \b pico_lwip_smtp -
+ * * \c \b pico_lwip_sntp -
+ * * \c \b pico_lwip_mdns -
+ * * \c \b pico_lwip_netbios -
+ * * \c \b pico_lwip_tftp -
+ * * \c \b pico_lwip_mbedtls -
+ *
+ * The SDK Provides a common set of functionality in \c \p pico_lwip which aggregates:
+ *
+ * * \c \b pico_lwip_core -
+ * * \c \b pico_lwip_core4 -
+ * * \c \b pico_lwip_core6 -
+ * * \c \b pico_lwip_netif -
+ * * \c \b pico_lwip_sixlowpan -
+ * * \c \b pico_lwip_ppp -
+ *
+ * The following additional libraries are provided:
+ *
+ * * \c \b pico_lwip - Aggregates the lwIP RAW API: \c \b pico_lwip_core, \c \b pico_lwip_core4, \c \b pico_lwip_core6, \c \b pico_lwip_api, \c \b pico_lwip_netif, \c \b pico_lwip_sixlowpan and \c \b pico_lwip_ppp. It does
+ * not include \c \b pico_lwip_api, which requires NO_SYS=0. You should include the latter separately if you want it.
+ *
+ * * \c \b pico_lwip_arch - lwIP required compiler adapters. This is not included in \c \b pico_lwip in case you wish to replace them.
+ * * \c \b pico_lwip_nosys - basic stub functions for NO_SYS mode.
+ */
diff --git a/src/rp2_common/pico_lwip/include/arch/cc.h b/src/rp2_common/pico_lwip/include/arch/cc.h
new file mode 100644
index 0000000..447e4d2
--- /dev/null
+++ b/src/rp2_common/pico_lwip/include/arch/cc.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
+ * 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.
+ *
+ * Author: Adam Dunkels <adam@sics.se>
+ *
+ */
+#ifndef __CC_H__
+#define __CC_H__
+
+#if NO_SYS
+// todo really we should just not allow SYS_LIGHTWEIGHT_PROT for nosys mode (it doesn't do anything anyway)
+typedef int sys_prot_t;
+#endif
+
+/* define compiler specific symbols */
+#if defined (__ICCARM__)
+
+#define PACK_STRUCT_BEGIN
+#define PACK_STRUCT_STRUCT
+#define PACK_STRUCT_END
+#define PACK_STRUCT_FIELD(x) x
+#define PACK_STRUCT_USE_INCLUDES
+
+#elif defined (__CC_ARM)
+
+#define PACK_STRUCT_BEGIN __packed
+#define PACK_STRUCT_STRUCT
+#define PACK_STRUCT_END
+#define PACK_STRUCT_FIELD(x) x
+
+#elif defined (__GNUC__)
+
+#define PACK_STRUCT_BEGIN
+#define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
+#define PACK_STRUCT_END
+#define PACK_STRUCT_FIELD(x) x
+
+#elif defined (__TASKING__)
+
+#define PACK_STRUCT_BEGIN
+#define PACK_STRUCT_STRUCT
+#define PACK_STRUCT_END
+#define PACK_STRUCT_FIELD(x) x
+
+#endif
+
+#define LWIP_PLATFORM_ASSERT(x) do { if(!(x)) while(1); } while(0)
+
+unsigned int pico_lwip_rand(void);
+#ifndef LWIP_RAND
+// Use ROSC based random number generation, more for the fact that rand() may not be seeded, than anything else
+#define LWIP_RAND pico_lwip_rand
+#endif
+#endif /* __CC_H__ */
diff --git a/src/rp2_common/pico_lwip/nosys.c b/src/rp2_common/pico_lwip/nosys.c
new file mode 100644
index 0000000..4e7605d
--- /dev/null
+++ b/src/rp2_common/pico_lwip/nosys.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2022 Raspberry Pi (Trading) Ltd.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "lwip/init.h"
+#include "pico/time.h"
+
+#if NO_SYS
+/* lwip has provision for using a mutex, when applicable */
+sys_prot_t sys_arch_protect(void) {
+ return 0;
+}
+
+void sys_arch_unprotect(sys_prot_t pval) {
+ (void) pval;
+}
+
+/* lwip needs a millisecond time source, and the TinyUSB board support code has one available */
+uint32_t sys_now(void) {
+ return to_ms_since_boot(get_absolute_time());
+}
+
+#endif
+
diff --git a/src/rp2_common/pico_lwip/random.c b/src/rp2_common/pico_lwip/random.c
new file mode 100644
index 0000000..2c4cdf8
--- /dev/null
+++ b/src/rp2_common/pico_lwip/random.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "pico.h"
+#include "hardware/structs/rosc.h"
+
+static uint8_t pico_lwip_random_byte(int cycles) {
+ static uint8_t byte;
+ assert(cycles >= 8);
+ assert(rosc_hw->status & ROSC_STATUS_ENABLED_BITS);
+ for(int i=0;i<cycles;i++) {
+ // picked a fairly arbitrary polynomial of 0x35u - this doesn't have to be crazily uniform.
+ byte = ((byte << 1) | rosc_hw->randombit) ^ (byte & 0x80u ? 0x35u : 0);
+ // delay a little because the random bit is a little slow
+ busy_wait_at_least_cycles(30);
+ }
+ return byte;
+}
+
+unsigned int pico_lwip_rand(void) {
+ uint32_t value = 0;
+ for (int i = 0; i < 4; i++) {
+ value = (value << 8u) | pico_lwip_random_byte(32);
+ }
+ return value;
+}
\ No newline at end of file