From 8715c1708fc9d4c83dd10afb8c25c65617afc31d Mon Sep 17 00:00:00 2001 From: Jason2866 Date: Wed, 17 Sep 2025 00:09:47 +0200 Subject: [PATCH] Arduino v3.3.1 --- .github/workflows/examples.yml | 3 + README.md | 2 +- boards/dfrobot_firebeetle2_esp32c6.json | 38 + boards/esp32-c5-devkitc1-n16r4.json | 39 + ...c-1-v12.json => esp32-c5-devkitc1-n4.json} | 8 +- boards/esp32-c5-devkitc1-n8r4.json | 39 + boards/m5stack-core-esp32-16M.json | 7 +- boards/m5stack-core-esp32.json | 7 +- boards/m5stack-grey.json | 7 +- boards/m5stack-tab5-p4.json | 39 + boards/m5stack-tab5-p4.py | 12 + builder/frameworks/_embed_files.py | 63 +- builder/frameworks/arduino.py | 19 +- builder/frameworks/component_manager.py | 892 +-- builder/frameworks/espidf.py | 798 ++- builder/frameworks/ulp.py | 78 +- builder/main.py | 490 +- builder/penv_setup.py | 481 ++ examples/arduino-blink/.gitignore | 1 + examples/arduino-blink/platformio.ini | 260 +- examples/arduino-matter-light/src/.gitignore | 5 + examples/arduino-rmt-blink/platformio.ini | 76 +- examples/arduino-usb-keyboard/.gitignore | 1 + examples/arduino-wifiscan/.gitignore | 1 + .../espidf-arduino-C6-ULP-blink/.gitignore | 5 + examples/espidf-arduino-blink/.gitignore | 1 + examples/espidf-arduino-littlefs/.gitignore | 2 + examples/espidf-arduino-wifiscan/.gitignore | 1 + examples/espidf-blink/.gitignore | 1 + examples/espidf-coap-server/.gitignore | 1 + .../components/CMakeLists.txt | 41 - .../espidf-coap-server/components/Kconfig | 109 - .../espidf-coap-server/components/LICENSE | 85 - .../espidf-coap-server/components/README.md | 89 - .../components/idf_component.yml | 5 - .../components/libcoap/AUTHORS | 8 - .../components/libcoap/BUILDING | 157 - .../components/libcoap/CMakeLists.txt | 723 --- .../components/libcoap/CONTRIBUTE | 218 - .../components/libcoap/COPYING | 6 - .../components/libcoap/ChangeLog | 332 -- .../components/libcoap/Dockerfile | 7 - .../components/libcoap/HOWTO.dual.gnutls | 98 - .../components/libcoap/HOWTO.dual.openssl | 50 - .../components/libcoap/HOWTO.dual.softhsm2 | 90 - .../components/libcoap/HOWTO.pkcs11 | 129 - .../components/libcoap/LICENSE | 85 - .../components/libcoap/Makefile.am | 281 - .../components/libcoap/Makefile.libcoap | 7 - .../components/libcoap/NEWS | 0 .../components/libcoap/README | 89 - .../components/libcoap/README.md | 89 - .../components/libcoap/TODO | 27 - .../components/libcoap/autogen.sh | 142 - .../libcoap/build-env/Dockerfile.build-env | 7 - .../libcoap/build-env/Dockerfile.develop | 36 - .../components/libcoap/build-env/build.sh | 16 - .../components/libcoap/build-env/imagename | 2 - .../components/libcoap/cmake-format.yaml | 25 - .../libcoap/cmake/FindMbedTLS.cmake | 35 - .../libcoap/cmake/FindTinyDTLS.cmake | 88 - .../components/libcoap/cmake_coap_config.h.in | 177 - .../components/libcoap/coap_config.h.contiki | 215 - .../components/libcoap/coap_config.h.lwip | 42 - .../components/libcoap/coap_config.h.lwip.in | 42 - .../components/libcoap/coap_config.h.riot | 143 - .../components/libcoap/coap_config.h.riot.in | 143 - .../components/libcoap/coap_config.h.windows | 118 - .../libcoap/coap_config.h.windows.in | 118 - .../components/libcoap/configure.ac | 1106 ---- .../components/libcoap/doc/Doxyfile.in | 2612 --------- .../components/libcoap/doc/Makefile.am | 288 - .../components/libcoap/doc/docbook.local.css | 47 - .../components/libcoap/doc/main.md | 69 - .../components/libcoap/doc/module_api_wrap.h | 21 - .../libcoap/doc/upgrade_4.2.1_4.3.0.txt | 431 -- .../libcoap/doc/upgrade_4.3.0_4.3.1.txt | 6 - .../components/libcoap/examples/Makefile.am | 129 - .../libcoap/examples/README.etsi_iot | 43 - .../components/libcoap/examples/coap-client.c | 1944 ------- .../components/libcoap/examples/coap-rd.c | 879 --- .../components/libcoap/examples/coap-server.c | 2980 ---------- .../components/libcoap/examples/coap_list.c | 67 - .../components/libcoap/examples/coap_list.h | 52 - .../libcoap/examples/contiki/Makefile.contiki | 33 - .../libcoap/examples/contiki/README | 30 - .../libcoap/examples/contiki/coap-observer.c | 186 - .../examples/contiki/radvd.conf.sample | 14 - .../libcoap/examples/contiki/server.c | 222 - .../libcoap/examples/etsi_coaptest.sh | 210 - .../components/libcoap/examples/etsi_iot_01.c | 633 --- .../examples/etsi_iot_01_largedata.txt | 7 - .../libcoap/examples/etsi_testcases.sh | 765 --- .../components/libcoap/examples/getopt.c | 66 - .../components/libcoap/examples/lwip/README | 30 - .../libcoap/examples/lwip/lwipopts.h | 37 - .../libcoap/examples/lwip/server-coap.c | 147 - .../libcoap/examples/lwip/server-coap.h | 17 - .../components/libcoap/examples/lwip/server.c | 91 - .../examples/share.libcoap.examples.Makefile | 43 - .../examples/share.libcoap.examples.README | 9 - .../components/libcoap/examples/tiny.c | 183 - .../components/libcoap/ext/tinydtls/ABOUT.md | 60 - .../libcoap/ext/tinydtls/AutoConf.cmake | 101 - .../libcoap/ext/tinydtls/CMakeLists.txt | 85 - .../libcoap/ext/tinydtls/CONTRIBUTING.md | 144 - .../components/libcoap/ext/tinydtls/LICENSE | 12 - .../libcoap/ext/tinydtls/Makefile.riot | 7 - .../libcoap/ext/tinydtls/Makefile.tinydtls | 9 - .../components/libcoap/ext/tinydtls/README.md | 81 - .../libcoap/ext/tinydtls/aes/Makefile.riot | 5 - .../libcoap/ext/tinydtls/aes/rijndael.c | 1231 ----- .../libcoap/ext/tinydtls/aes/rijndael.h | 69 - .../libcoap/ext/tinydtls/aes/rijndael_wrap.c | 69 - .../components/libcoap/ext/tinydtls/alert.h | 85 - .../libcoap/ext/tinydtls/autogen.sh | 21 - .../components/libcoap/ext/tinydtls/ccm.c | 303 -- .../components/libcoap/ext/tinydtls/ccm.h | 61 - .../libcoap/ext/tinydtls/configure.ac | 153 - .../components/libcoap/ext/tinydtls/crypto.c | 641 --- .../components/libcoap/ext/tinydtls/crypto.h | 434 -- .../libcoap/ext/tinydtls/doc/Doxyfile.in | 1551 ------ .../ext/tinydtls/doc/DoxygenLayout.xml | 184 - .../components/libcoap/ext/tinydtls/dtls.c | 4780 ----------------- .../components/libcoap/ext/tinydtls/dtls.h | 755 --- .../ext/tinydtls/dtls_config.h.cmake.in | 162 - .../libcoap/ext/tinydtls/dtls_debug.c | 460 -- .../libcoap/ext/tinydtls/dtls_debug.h | 123 - .../libcoap/ext/tinydtls/dtls_mutex.h | 68 - .../libcoap/ext/tinydtls/dtls_prng.c | 39 - .../libcoap/ext/tinydtls/dtls_prng.h | 56 - .../libcoap/ext/tinydtls/dtls_time.c | 98 - .../libcoap/ext/tinydtls/dtls_time.h | 96 - .../libcoap/ext/tinydtls/ecc/Makefile.contiki | 7 - .../libcoap/ext/tinydtls/ecc/Makefile.ecc | 3 - .../libcoap/ext/tinydtls/ecc/Makefile.riot | 5 - .../components/libcoap/ext/tinydtls/ecc/ecc.c | 727 --- .../components/libcoap/ext/tinydtls/ecc/ecc.h | 86 - .../libcoap/ext/tinydtls/ecc/test_helper.c | 79 - .../libcoap/ext/tinydtls/ecc/test_helper.h | 51 - .../libcoap/ext/tinydtls/ecc/testecc.c | 234 - .../libcoap/ext/tinydtls/ecc/testfield.c | 303 -- .../components/libcoap/ext/tinydtls/global.h | 143 - .../components/libcoap/ext/tinydtls/hmac.c | 107 - .../components/libcoap/ext/tinydtls/hmac.h | 151 - .../components/libcoap/ext/tinydtls/netq.c | 176 - .../components/libcoap/ext/tinydtls/netq.h | 122 - .../components/libcoap/ext/tinydtls/numeric.h | 134 - .../components/libcoap/ext/tinydtls/peer.c | 107 - .../components/libcoap/ext/tinydtls/peer.h | 168 - .../platform-specific/dtls_prng_contiki.c | 60 - .../platform-specific/dtls_prng_espidf.c | 42 - .../platform-specific/dtls_prng_posix.c | 73 - .../platform-specific/dtls_prng_riot.c | 35 - .../platform-specific/dtls_prng_zephyr.c | 35 - .../ext/tinydtls/platform-specific/platform.h | 90 - .../tinydtls/platform-specific/riot_boards.h | 152 - .../components/libcoap/ext/tinydtls/session.c | 152 - .../components/libcoap/ext/tinydtls/session.h | 129 - .../libcoap/ext/tinydtls/sha2/README | 272 - .../libcoap/ext/tinydtls/sha2/sha2.c | 1106 ---- .../libcoap/ext/tinydtls/sha2/sha2.h | 216 - .../libcoap/ext/tinydtls/sha2/sha2prog.c | 134 - .../libcoap/ext/tinydtls/sha2/sha2speed.c | 176 - .../libcoap/ext/tinydtls/sha2/sha2test.pl | 358 -- .../tinydtls/sha2/testvectors/vector001.dat | 1 - .../tinydtls/sha2/testvectors/vector001.info | 21 - .../tinydtls/sha2/testvectors/vector002.dat | 1 - .../tinydtls/sha2/testvectors/vector002.info | 21 - .../tinydtls/sha2/testvectors/vector003.dat | 1 - .../tinydtls/sha2/testvectors/vector003.info | 22 - .../tinydtls/sha2/testvectors/vector004.dat | 1 - .../tinydtls/sha2/testvectors/vector004.info | 22 - .../tinydtls/sha2/testvectors/vector005.dat | 0 .../tinydtls/sha2/testvectors/vector005.info | 23 - .../tinydtls/sha2/testvectors/vector006.dat | 1 - .../tinydtls/sha2/testvectors/vector006.info | 22 - .../tinydtls/sha2/testvectors/vector007.dat | 1 - .../tinydtls/sha2/testvectors/vector007.info | 22 - .../tinydtls/sha2/testvectors/vector008.dat | 1 - .../tinydtls/sha2/testvectors/vector008.info | 22 - .../tinydtls/sha2/testvectors/vector009.dat | 1 - .../tinydtls/sha2/testvectors/vector009.info | 22 - .../tinydtls/sha2/testvectors/vector010.dat | Bin 320 -> 0 bytes .../tinydtls/sha2/testvectors/vector010.info | 22 - .../tinydtls/sha2/testvectors/vector011.dat | Bin 447 -> 0 bytes .../tinydtls/sha2/testvectors/vector011.info | 22 - .../tinydtls/sha2/testvectors/vector012.dat | Bin 640 -> 0 bytes .../tinydtls/sha2/testvectors/vector012.info | 22 - .../tinydtls/sha2/testvectors/vector013.dat | Bin 2175 -> 0 bytes .../tinydtls/sha2/testvectors/vector013.info | 22 - .../tinydtls/sha2/testvectors/vector014.dat | Bin 16384 -> 0 bytes .../tinydtls/sha2/testvectors/vector014.info | 22 - .../tinydtls/sha2/testvectors/vector015.dat | 1 - .../tinydtls/sha2/testvectors/vector015.info | 21 - .../tinydtls/sha2/testvectors/vector016.dat | 1 - .../tinydtls/sha2/testvectors/vector016.info | 23 - .../tinydtls/sha2/testvectors/vector017.dat | Bin 12271 -> 0 bytes .../tinydtls/sha2/testvectors/vector017.info | 32 - .../tinydtls/sha2/testvectors/vector018.dat | Bin 1079 -> 0 bytes .../tinydtls/sha2/testvectors/vector018.info | 26 - .../components/libcoap/ext/tinydtls/state.h | 60 - .../libcoap/ext/tinydtls/tests/CMakeLists.txt | 37 - .../ext/tinydtls/tests/cbc_aes128-test.c | 60 - .../ext/tinydtls/tests/cbc_aes128-testdata.c | 66 - .../libcoap/ext/tinydtls/tests/ccm-test.c | 90 - .../libcoap/ext/tinydtls/tests/ccm-testdata.c | 449 -- .../libcoap/ext/tinydtls/tests/dsrv-test.c | 110 - .../libcoap/ext/tinydtls/tests/dtls-client.c | 554 -- .../libcoap/ext/tinydtls/tests/dtls-server.c | 402 -- .../libcoap/ext/tinydtls/tests/netq-test.c | 123 - .../libcoap/ext/tinydtls/tests/pcap.c | 478 -- .../ext/tinydtls/tests/unit-tests/test_ccm.c | 215 - .../ext/tinydtls/tests/unit-tests/test_ccm.h | 15 - .../ext/tinydtls/tests/unit-tests/test_ecc.c | 242 - .../ext/tinydtls/tests/unit-tests/test_ecc.h | 15 - .../ext/tinydtls/tests/unit-tests/test_prf.c | 287 - .../ext/tinydtls/tests/unit-tests/test_prf.h | 15 - .../tinydtls/tests/unit-tests/testdriver.c | 30 - .../libcoap/ext/tinydtls/tinydtls.h | 51 - .../libcoap/ext/tinydtls/tinydtls.pc.in | 26 - .../components/libcoap/ext/tinydtls/uthash.h | 1210 ----- .../components/libcoap/ext/tinydtls/utlist.h | 1073 ---- .../ext/tinydtls/zephyr/CMakeLists.txt | 43 - .../libcoap/ext/tinydtls/zephyr/Kconfig | 47 - .../components/libcoap/include/coap3/block.h | 431 -- .../libcoap/include/coap3/coap.h.in | 65 - .../libcoap/include/coap3/coap.h.windows | 65 - .../libcoap/include/coap3/coap.h.windows.in | 65 - .../libcoap/include/coap3/coap_address.h | 213 - .../include/coap3/coap_asn1_internal.h | 90 - .../libcoap/include/coap3/coap_async.h | 128 - .../include/coap3/coap_async_internal.h | 69 - .../include/coap3/coap_block_internal.h | 231 - .../libcoap/include/coap3/coap_cache.h | 234 - .../include/coap3/coap_cache_internal.h | 115 - .../libcoap/include/coap3/coap_debug.h | 260 - .../libcoap/include/coap3/coap_dtls.h | 491 -- .../include/coap3/coap_dtls_internal.h | 408 -- .../libcoap/include/coap3/coap_event.h | 146 - .../include/coap3/coap_forward_decls.h | 107 - .../libcoap/include/coap3/coap_hashkey.h | 61 - .../libcoap/include/coap3/coap_internal.h | 80 - .../libcoap/include/coap3/coap_io.h | 77 - .../libcoap/include/coap3/coap_io_internal.h | 186 - .../libcoap/include/coap3/coap_mutex.h | 82 - .../libcoap/include/coap3/coap_net_internal.h | 386 -- .../libcoap/include/coap3/coap_option.h | 440 -- .../libcoap/include/coap3/coap_pdu_internal.h | 318 -- .../libcoap/include/coap3/coap_prng.h | 114 - .../include/coap3/coap_resource_internal.h | 145 - .../libcoap/include/coap3/coap_riot.h | 39 - .../libcoap/include/coap3/coap_session.h | 624 --- .../include/coap3/coap_session_internal.h | 436 -- .../libcoap/include/coap3/coap_subscribe.h | 69 - .../include/coap3/coap_subscribe_internal.h | 162 - .../libcoap/include/coap3/coap_tcp_internal.h | 112 - .../libcoap/include/coap3/coap_time.h | 204 - .../components/libcoap/include/coap3/encode.h | 128 - .../libcoap/include/coap3/libcoap.h | 68 - .../libcoap/include/coap3/lwippools.h | 117 - .../components/libcoap/include/coap3/mem.h | 144 - .../components/libcoap/include/coap3/net.h | 825 --- .../components/libcoap/include/coap3/pdu.h | 603 --- .../libcoap/include/coap3/resource.h | 499 -- .../components/libcoap/include/coap3/str.h | 210 - .../components/libcoap/include/coap3/uri.h | 182 - .../components/libcoap/include/coap3/uthash.h | 1136 ---- .../components/libcoap/include/coap3/utlist.h | 1073 ---- .../components/libcoap/libcoap-3.map | 252 - .../components/libcoap/libcoap-3.pc.in | 12 - .../components/libcoap/libcoap-3.sym | 247 - .../libcoap/m4/ac_check_cryptolibs.m4 | 84 - .../libcoap/m4/ax_check_a2x_to_man.m4 | 57 - .../libcoap/m4/ax_check_compile_flag.m4 | 74 - .../libcoap/m4/ax_check_link_flag.m4 | 74 - .../components/libcoap/man/Makefile.am | 162 - .../components/libcoap/man/coap-client.txt.in | 299 -- .../components/libcoap/man/coap-rd.txt.in | 163 - .../components/libcoap/man/coap-server.txt.in | 268 - .../components/libcoap/man/coap.txt.in | 87 - .../components/libcoap/man/coap_async.txt.in | 203 - .../libcoap/man/coap_attribute.txt.in | 158 - .../components/libcoap/man/coap_block.txt.in | 534 -- .../components/libcoap/man/coap_cache.txt.in | 390 -- .../libcoap/man/coap_context.txt.in | 149 - .../libcoap/man/coap_encryption.txt.in | 1237 ----- .../libcoap/man/coap_endpoint_client.txt.in | 421 -- .../libcoap/man/coap_endpoint_server.txt.in | 584 -- .../libcoap/man/coap_handler.txt.in | 348 -- .../components/libcoap/man/coap_io.txt.in | 463 -- .../libcoap/man/coap_keepalive.txt.in | 78 - .../libcoap/man/coap_logging.txt.in | 185 - .../libcoap/man/coap_observe.txt.in | 405 -- .../libcoap/man/coap_pdu_access.txt.in | 393 -- .../libcoap/man/coap_pdu_setup.txt.in | 721 --- .../libcoap/man/coap_recovery.txt.in | 216 - .../libcoap/man/coap_resource.txt.in | 584 -- .../libcoap/man/coap_session.txt.in | 238 - .../components/libcoap/man/coap_string.txt.in | 182 - .../libcoap/man/coap_tls_library.txt.in | 153 - .../libcoap/man/examples-code-check.c | 437 -- .../libcoap/scripts/api-version-bump.sh | 60 - .../components/libcoap/scripts/build.sh | 86 - .../components/libcoap/scripts/dist.sh | 70 - .../components/libcoap/scripts/fix-cunit.sh | 15 - .../libcoap/scripts/format_cmake.sh | 23 - .../components/libcoap/scripts/github_dist.sh | 24 - .../libcoap/scripts/msbuild.sln.cmd | 16 - .../components/libcoap/src/block.c | 2451 --------- .../components/libcoap/src/coap_address.c | 115 - .../components/libcoap/src/coap_asn1.c | 107 - .../components/libcoap/src/coap_async.c | 237 - .../components/libcoap/src/coap_cache.c | 281 - .../components/libcoap/src/coap_debug.c | 1052 ---- .../components/libcoap/src/coap_event.c | 38 - .../components/libcoap/src/coap_gnutls.c | 2960 ---------- .../components/libcoap/src/coap_hashkey.c | 33 - .../components/libcoap/src/coap_io.c | 1615 ------ .../components/libcoap/src/coap_io_lwip.c | 242 - .../components/libcoap/src/coap_io_riot.c | 286 - .../components/libcoap/src/coap_mbedtls.c | 2540 --------- .../components/libcoap/src/coap_notls.c | 271 - .../components/libcoap/src/coap_openssl.c | 3527 ------------ .../components/libcoap/src/coap_option.c | 605 --- .../components/libcoap/src/coap_prng.c | 113 - .../components/libcoap/src/coap_session.c | 1709 ------ .../components/libcoap/src/coap_subscribe.c | 25 - .../components/libcoap/src/coap_tcp.c | 324 -- .../components/libcoap/src/coap_time.c | 141 - .../components/libcoap/src/coap_tinydtls.c | 1311 ----- .../components/libcoap/src/encode.c | 93 - .../components/libcoap/src/mem.c | 477 -- .../components/libcoap/src/net.c | 3885 -------------- .../components/libcoap/src/pdu.c | 1301 ----- .../components/libcoap/src/resource.c | 1170 ---- .../components/libcoap/src/str.c | 112 - .../components/libcoap/src/uri.c | 679 --- .../components/libcoap/tests/Makefile.am | 43 - .../libcoap/tests/oss-fuzz/Makefile.ci.in | 38 - .../libcoap/tests/oss-fuzz/Makefile.oss-fuzz | 15 - .../libcoap/tests/oss-fuzz/pdu_parse_target.c | 23 - .../libcoap/tests/oss-fuzz/split_uri_target.c | 8 - .../components/libcoap/tests/test_common.h.in | 12 - .../components/libcoap/tests/test_encode.c | 266 - .../components/libcoap/tests/test_encode.h | 13 - .../libcoap/tests/test_error_response.c | 366 -- .../libcoap/tests/test_error_response.h | 13 - .../components/libcoap/tests/test_options.c | 1049 ---- .../components/libcoap/tests/test_options.h | 19 - .../components/libcoap/tests/test_pdu.c | 1327 ----- .../components/libcoap/tests/test_pdu.h | 13 - .../components/libcoap/tests/test_sendqueue.c | 367 -- .../components/libcoap/tests/test_sendqueue.h | 13 - .../components/libcoap/tests/test_session.c | 226 - .../components/libcoap/tests/test_session.h | 13 - .../components/libcoap/tests/test_tls.c | 129 - .../components/libcoap/tests/test_tls.h | 13 - .../components/libcoap/tests/test_uri.c | 623 --- .../components/libcoap/tests/test_uri.h | 13 - .../components/libcoap/tests/test_wellknown.c | 278 - .../components/libcoap/tests/test_wellknown.h | 13 - .../components/libcoap/tests/testdriver.c | 59 - .../libcoap/tests/valgrind_suppression | 12 - .../win32/coap-client/coap-client.vcxproj | 387 -- .../coap-client/coap-client.vcxproj.filters | 22 - .../libcoap/win32/coap-rd/coap-rd.vcxproj | 377 -- .../win32/coap-rd/coap-rd.vcxproj.filters | 22 - .../win32/coap-server/coap-server.vcxproj | 378 -- .../coap-server/coap-server.vcxproj.filters | 22 - .../components/libcoap/win32/libcoap.props | 82 - .../components/libcoap/win32/libcoap.sln | 144 - .../components/libcoap/win32/libcoap.vcxproj | 629 --- .../libcoap/win32/libcoap.vcxproj.filters | 204 - .../win32/testdriver/testdriver.vcxproj | 401 -- .../testdriver/testdriver.vcxproj.filters | 72 - .../components/port/include/coap3/coap.h | 51 - .../components/port/include/coap_config.h | 59 - .../port/include/coap_config_posix.h | 61 - .../espidf-coap-server/src/idf_component.yml | 4 + examples/espidf-exceptions/.gitignore | 1 + examples/espidf-hello-world/.gitignore | 1 + examples/espidf-http-request/.gitignore | 1 + examples/espidf-peripherals-uart/.gitignore | 1 + examples/espidf-peripherals-usb/.gitignore | 1 + examples/espidf-storage-sdcard/.gitignore | 1 + monitor/filter_exception_decoder.py | 3 +- platform.json | 22 +- platform.py | 243 +- 389 files changed, 2101 insertions(+), 100083 deletions(-) create mode 100644 boards/dfrobot_firebeetle2_esp32c6.json create mode 100644 boards/esp32-c5-devkitc1-n16r4.json rename boards/{esp32-c5-devkitc-1-v12.json => esp32-c5-devkitc1-n4.json} (83%) create mode 100644 boards/esp32-c5-devkitc1-n8r4.json create mode 100644 boards/m5stack-tab5-p4.json create mode 100644 boards/m5stack-tab5-p4.py create mode 100644 builder/penv_setup.py create mode 100644 examples/arduino-blink/.gitignore create mode 100644 examples/arduino-matter-light/src/.gitignore create mode 100644 examples/arduino-usb-keyboard/.gitignore create mode 100644 examples/arduino-wifiscan/.gitignore create mode 100644 examples/espidf-arduino-C6-ULP-blink/.gitignore create mode 100644 examples/espidf-arduino-blink/.gitignore create mode 100644 examples/espidf-arduino-littlefs/.gitignore create mode 100644 examples/espidf-arduino-wifiscan/.gitignore create mode 100644 examples/espidf-blink/.gitignore create mode 100644 examples/espidf-coap-server/.gitignore delete mode 100644 examples/espidf-coap-server/components/CMakeLists.txt delete mode 100644 examples/espidf-coap-server/components/Kconfig delete mode 100644 examples/espidf-coap-server/components/LICENSE delete mode 100644 examples/espidf-coap-server/components/README.md delete mode 100644 examples/espidf-coap-server/components/idf_component.yml delete mode 100644 examples/espidf-coap-server/components/libcoap/AUTHORS delete mode 100644 examples/espidf-coap-server/components/libcoap/BUILDING delete mode 100644 examples/espidf-coap-server/components/libcoap/CMakeLists.txt delete mode 100644 examples/espidf-coap-server/components/libcoap/CONTRIBUTE delete mode 100644 examples/espidf-coap-server/components/libcoap/COPYING delete mode 100644 examples/espidf-coap-server/components/libcoap/ChangeLog delete mode 100644 examples/espidf-coap-server/components/libcoap/Dockerfile delete mode 100644 examples/espidf-coap-server/components/libcoap/HOWTO.dual.gnutls delete mode 100644 examples/espidf-coap-server/components/libcoap/HOWTO.dual.openssl delete mode 100644 examples/espidf-coap-server/components/libcoap/HOWTO.dual.softhsm2 delete mode 100644 examples/espidf-coap-server/components/libcoap/HOWTO.pkcs11 delete mode 100644 examples/espidf-coap-server/components/libcoap/LICENSE delete mode 100644 examples/espidf-coap-server/components/libcoap/Makefile.am delete mode 100644 examples/espidf-coap-server/components/libcoap/Makefile.libcoap delete mode 100644 examples/espidf-coap-server/components/libcoap/NEWS delete mode 100644 examples/espidf-coap-server/components/libcoap/README delete mode 100644 examples/espidf-coap-server/components/libcoap/README.md delete mode 100644 examples/espidf-coap-server/components/libcoap/TODO delete mode 100644 examples/espidf-coap-server/components/libcoap/autogen.sh delete mode 100644 examples/espidf-coap-server/components/libcoap/build-env/Dockerfile.build-env delete mode 100644 examples/espidf-coap-server/components/libcoap/build-env/Dockerfile.develop delete mode 100644 examples/espidf-coap-server/components/libcoap/build-env/build.sh delete mode 100644 examples/espidf-coap-server/components/libcoap/build-env/imagename delete mode 100644 examples/espidf-coap-server/components/libcoap/cmake-format.yaml delete mode 100644 examples/espidf-coap-server/components/libcoap/cmake/FindMbedTLS.cmake delete mode 100644 examples/espidf-coap-server/components/libcoap/cmake/FindTinyDTLS.cmake delete mode 100644 examples/espidf-coap-server/components/libcoap/cmake_coap_config.h.in delete mode 100644 examples/espidf-coap-server/components/libcoap/coap_config.h.contiki delete mode 100644 examples/espidf-coap-server/components/libcoap/coap_config.h.lwip delete mode 100644 examples/espidf-coap-server/components/libcoap/coap_config.h.lwip.in delete mode 100644 examples/espidf-coap-server/components/libcoap/coap_config.h.riot delete mode 100644 examples/espidf-coap-server/components/libcoap/coap_config.h.riot.in delete mode 100644 examples/espidf-coap-server/components/libcoap/coap_config.h.windows delete mode 100644 examples/espidf-coap-server/components/libcoap/coap_config.h.windows.in delete mode 100644 examples/espidf-coap-server/components/libcoap/configure.ac delete mode 100644 examples/espidf-coap-server/components/libcoap/doc/Doxyfile.in delete mode 100644 examples/espidf-coap-server/components/libcoap/doc/Makefile.am delete mode 100644 examples/espidf-coap-server/components/libcoap/doc/docbook.local.css delete mode 100644 examples/espidf-coap-server/components/libcoap/doc/main.md delete mode 100644 examples/espidf-coap-server/components/libcoap/doc/module_api_wrap.h delete mode 100644 examples/espidf-coap-server/components/libcoap/doc/upgrade_4.2.1_4.3.0.txt delete mode 100644 examples/espidf-coap-server/components/libcoap/doc/upgrade_4.3.0_4.3.1.txt delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/Makefile.am delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/README.etsi_iot delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/coap-client.c delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/coap-rd.c delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/coap-server.c delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/coap_list.c delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/coap_list.h delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/contiki/Makefile.contiki delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/contiki/README delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/contiki/coap-observer.c delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/contiki/radvd.conf.sample delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/contiki/server.c delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/etsi_coaptest.sh delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/etsi_iot_01.c delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/etsi_iot_01_largedata.txt delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/etsi_testcases.sh delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/getopt.c delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/lwip/README delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/lwip/lwipopts.h delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/lwip/server-coap.c delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/lwip/server-coap.h delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/lwip/server.c delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/share.libcoap.examples.Makefile delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/share.libcoap.examples.README delete mode 100644 examples/espidf-coap-server/components/libcoap/examples/tiny.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/ABOUT.md delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/AutoConf.cmake delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/CMakeLists.txt delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/CONTRIBUTING.md delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/LICENSE delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/Makefile.riot delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/Makefile.tinydtls delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/README.md delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/aes/Makefile.riot delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/aes/rijndael.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/aes/rijndael.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/aes/rijndael_wrap.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/alert.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/autogen.sh delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/ccm.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/ccm.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/configure.ac delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/crypto.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/crypto.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/doc/Doxyfile.in delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/doc/DoxygenLayout.xml delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/dtls.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/dtls.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/dtls_config.h.cmake.in delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/dtls_debug.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/dtls_debug.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/dtls_mutex.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/dtls_prng.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/dtls_prng.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/dtls_time.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/dtls_time.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/ecc/Makefile.contiki delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/ecc/Makefile.ecc delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/ecc/Makefile.riot delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/ecc/ecc.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/ecc/ecc.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/ecc/test_helper.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/ecc/test_helper.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/ecc/testecc.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/ecc/testfield.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/global.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/hmac.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/hmac.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/netq.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/netq.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/numeric.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/peer.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/peer.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/platform-specific/dtls_prng_contiki.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/platform-specific/dtls_prng_espidf.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/platform-specific/dtls_prng_posix.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/platform-specific/dtls_prng_riot.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/platform-specific/dtls_prng_zephyr.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/platform-specific/platform.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/platform-specific/riot_boards.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/session.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/session.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/README delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/sha2.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/sha2.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/sha2prog.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/sha2speed.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/sha2test.pl delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector001.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector001.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector002.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector002.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector003.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector003.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector004.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector004.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector005.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector005.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector006.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector006.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector007.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector007.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector008.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector008.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector009.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector009.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector010.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector010.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector011.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector011.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector012.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector012.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector013.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector013.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector014.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector014.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector015.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector015.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector016.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector016.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector017.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector017.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector018.dat delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/sha2/testvectors/vector018.info delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/state.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tests/CMakeLists.txt delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tests/cbc_aes128-test.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tests/cbc_aes128-testdata.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tests/ccm-test.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tests/ccm-testdata.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tests/dsrv-test.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tests/dtls-client.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tests/dtls-server.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tests/netq-test.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tests/pcap.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tests/unit-tests/test_ccm.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tests/unit-tests/test_ccm.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tests/unit-tests/test_ecc.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tests/unit-tests/test_ecc.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tests/unit-tests/test_prf.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tests/unit-tests/test_prf.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tests/unit-tests/testdriver.c delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tinydtls.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/tinydtls.pc.in delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/uthash.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/utlist.h delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/zephyr/CMakeLists.txt delete mode 100644 examples/espidf-coap-server/components/libcoap/ext/tinydtls/zephyr/Kconfig delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/block.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap.h.in delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap.h.windows delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap.h.windows.in delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_address.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_asn1_internal.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_async.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_async_internal.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_block_internal.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_cache.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_cache_internal.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_debug.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_dtls.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_dtls_internal.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_event.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_forward_decls.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_hashkey.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_internal.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_io.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_io_internal.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_mutex.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_net_internal.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_option.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_pdu_internal.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_prng.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_resource_internal.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_riot.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_session.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_session_internal.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_subscribe.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_subscribe_internal.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_tcp_internal.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/coap_time.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/encode.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/libcoap.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/lwippools.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/mem.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/net.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/pdu.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/resource.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/str.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/uri.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/uthash.h delete mode 100644 examples/espidf-coap-server/components/libcoap/include/coap3/utlist.h delete mode 100644 examples/espidf-coap-server/components/libcoap/libcoap-3.map delete mode 100644 examples/espidf-coap-server/components/libcoap/libcoap-3.pc.in delete mode 100644 examples/espidf-coap-server/components/libcoap/libcoap-3.sym delete mode 100644 examples/espidf-coap-server/components/libcoap/m4/ac_check_cryptolibs.m4 delete mode 100644 examples/espidf-coap-server/components/libcoap/m4/ax_check_a2x_to_man.m4 delete mode 100644 examples/espidf-coap-server/components/libcoap/m4/ax_check_compile_flag.m4 delete mode 100644 examples/espidf-coap-server/components/libcoap/m4/ax_check_link_flag.m4 delete mode 100644 examples/espidf-coap-server/components/libcoap/man/Makefile.am delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap-client.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap-rd.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap-server.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_async.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_attribute.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_block.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_cache.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_context.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_encryption.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_endpoint_client.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_endpoint_server.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_handler.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_io.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_keepalive.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_logging.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_observe.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_pdu_access.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_pdu_setup.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_recovery.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_resource.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_session.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_string.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/coap_tls_library.txt.in delete mode 100644 examples/espidf-coap-server/components/libcoap/man/examples-code-check.c delete mode 100644 examples/espidf-coap-server/components/libcoap/scripts/api-version-bump.sh delete mode 100644 examples/espidf-coap-server/components/libcoap/scripts/build.sh delete mode 100644 examples/espidf-coap-server/components/libcoap/scripts/dist.sh delete mode 100644 examples/espidf-coap-server/components/libcoap/scripts/fix-cunit.sh delete mode 100644 examples/espidf-coap-server/components/libcoap/scripts/format_cmake.sh delete mode 100644 examples/espidf-coap-server/components/libcoap/scripts/github_dist.sh delete mode 100644 examples/espidf-coap-server/components/libcoap/scripts/msbuild.sln.cmd delete mode 100644 examples/espidf-coap-server/components/libcoap/src/block.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_address.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_asn1.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_async.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_cache.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_debug.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_event.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_gnutls.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_hashkey.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_io.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_io_lwip.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_io_riot.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_mbedtls.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_notls.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_openssl.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_option.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_prng.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_session.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_subscribe.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_tcp.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_time.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/coap_tinydtls.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/encode.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/mem.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/net.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/pdu.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/resource.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/str.c delete mode 100644 examples/espidf-coap-server/components/libcoap/src/uri.c delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/Makefile.am delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/oss-fuzz/Makefile.ci.in delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/oss-fuzz/Makefile.oss-fuzz delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/oss-fuzz/pdu_parse_target.c delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/oss-fuzz/split_uri_target.c delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_common.h.in delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_encode.c delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_encode.h delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_error_response.c delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_error_response.h delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_options.c delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_options.h delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_pdu.c delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_pdu.h delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_sendqueue.c delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_sendqueue.h delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_session.c delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_session.h delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_tls.c delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_tls.h delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_uri.c delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_uri.h delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_wellknown.c delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/test_wellknown.h delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/testdriver.c delete mode 100644 examples/espidf-coap-server/components/libcoap/tests/valgrind_suppression delete mode 100644 examples/espidf-coap-server/components/libcoap/win32/coap-client/coap-client.vcxproj delete mode 100644 examples/espidf-coap-server/components/libcoap/win32/coap-client/coap-client.vcxproj.filters delete mode 100644 examples/espidf-coap-server/components/libcoap/win32/coap-rd/coap-rd.vcxproj delete mode 100644 examples/espidf-coap-server/components/libcoap/win32/coap-rd/coap-rd.vcxproj.filters delete mode 100644 examples/espidf-coap-server/components/libcoap/win32/coap-server/coap-server.vcxproj delete mode 100644 examples/espidf-coap-server/components/libcoap/win32/coap-server/coap-server.vcxproj.filters delete mode 100644 examples/espidf-coap-server/components/libcoap/win32/libcoap.props delete mode 100644 examples/espidf-coap-server/components/libcoap/win32/libcoap.sln delete mode 100644 examples/espidf-coap-server/components/libcoap/win32/libcoap.vcxproj delete mode 100644 examples/espidf-coap-server/components/libcoap/win32/libcoap.vcxproj.filters delete mode 100644 examples/espidf-coap-server/components/libcoap/win32/testdriver/testdriver.vcxproj delete mode 100644 examples/espidf-coap-server/components/libcoap/win32/testdriver/testdriver.vcxproj.filters delete mode 100644 examples/espidf-coap-server/components/port/include/coap3/coap.h delete mode 100644 examples/espidf-coap-server/components/port/include/coap_config.h delete mode 100644 examples/espidf-coap-server/components/port/include/coap_config_posix.h create mode 100644 examples/espidf-coap-server/src/idf_component.yml create mode 100644 examples/espidf-exceptions/.gitignore create mode 100644 examples/espidf-hello-world/.gitignore create mode 100644 examples/espidf-http-request/.gitignore create mode 100644 examples/espidf-peripherals-uart/.gitignore create mode 100644 examples/espidf-peripherals-usb/.gitignore create mode 100644 examples/espidf-storage-sdcard/.gitignore diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index ab87209..86b4a8a 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -26,6 +26,7 @@ jobs: - "examples/espidf-arduino-matter-light" - "examples/espidf-arduino-blink" - "examples/espidf-arduino-littlefs" + - "examples/espidf-arduino-C6-ULP-blink" - "examples/espidf-blink" - "examples/espidf-coap-server" - "examples/espidf-exceptions" @@ -44,6 +45,8 @@ jobs: example: "examples/espidf-ulp-lp" - os: windows-latest example: "examples/espidf-ulp-riscv" + - os: windows-latest + example: "examples/espidf-arduino-C6-ULP-blink" - os: windows-latest example: "examples/espidf-arduino-matter-light" runs-on: ${{ matrix.os }} diff --git a/README.md b/README.md index e2b3c9f..6a29006 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Espressif Systems is a privately held, fabless semiconductor company renowned fo * No support for the Arduino Nora Nano board, issues needs to be solved by the community ## IDE Preparation Prerequisites: -- Python >= 3.10 is required for pioarduino to function properly. +- Python >= 3.10 and git is required for pioarduino to function properly. ## Installation - [Download and install Microsoft Visual Studio Code](https://code.visualstudio.com/). pioarduino IDE is on top of it. diff --git a/boards/dfrobot_firebeetle2_esp32c6.json b/boards/dfrobot_firebeetle2_esp32c6.json new file mode 100644 index 0000000..6bb47fe --- /dev/null +++ b/boards/dfrobot_firebeetle2_esp32c6.json @@ -0,0 +1,38 @@ +{ + "build": { + "core": "esp32", + "extra_flags": [ + "-DARDUINO_DFROBOT_FIREBEETLE_2_ESP32C6", + "-DARDUINO_USB_MODE=1", + "-DARDUINO_USB_CDC_ON_BOOT=1" + ], + "f_cpu": "160000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "mcu": "esp32c6", + "variant": "dfrobot_firebeetle2_esp32c6" + }, + "connectivity": [ + "wifi", + "bluetooth", + "zigbee", + "thread" + ], + "debug": { + "openocd_target": "esp32c6.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "DFRobot FireBeetle 2 ESP32-C6", + "upload": { + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://wiki.dfrobot.com/SKU_DFR1075_FireBeetle_2_Board_ESP32_C6/", + "vendor": "DFRobot" +} diff --git a/boards/esp32-c5-devkitc1-n16r4.json b/boards/esp32-c5-devkitc1-n16r4.json new file mode 100644 index 0000000..bb68f75 --- /dev/null +++ b/boards/esp32-c5-devkitc1-n16r4.json @@ -0,0 +1,39 @@ +{ + "build": { + "arduino": { + "partitions": "default_16MB.csv", + "memory_type": "qio_qspi" + }, + "core": "esp32", + "extra_flags": [ + "-DBOARD_HAS_PSRAM" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "psram_type": "qio", + "mcu": "esp32c5", + "variant": "esp32c5" + }, + "connectivity": [ + "bluetooth", + "wifi" + ], + "debug": { + "openocd_target": "esp32c5.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif ESP32-C5-DevKitC-1 N16R4 (16 MB Flash Quad, 4 MB PSRAM Quad)", + "upload": { + "flash_size": "16MB", + "maximum_ram_size": 327680, + "maximum_size": 16777216, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32c5/esp32-c5-devkitc-1/user_guide.html", + "vendor": "Espressif" +} \ No newline at end of file diff --git a/boards/esp32-c5-devkitc-1-v12.json b/boards/esp32-c5-devkitc1-n4.json similarity index 83% rename from boards/esp32-c5-devkitc-1-v12.json rename to boards/esp32-c5-devkitc1-n4.json index c5ee886..2d86065 100644 --- a/boards/esp32-c5-devkitc-1-v12.json +++ b/boards/esp32-c5-devkitc1-n4.json @@ -18,14 +18,14 @@ "arduino", "espidf" ], - "name": "Espressif ESP32-C5-DevKitC-1 v1.2 8MB no PSRAM", + "name": "Espressif ESP32-C5-DevKitC-1 N4 (4MB no PSRAM)", "upload": { - "flash_size": "8MB", + "flash_size": "4MB", "maximum_ram_size": 327680, - "maximum_size": 8388608, + "maximum_size": 4194304, "require_upload_port": true, "speed": 460800 }, "url": "https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32c5/esp32-c5-devkitc-1/user_guide.html", "vendor": "Espressif" -} +} \ No newline at end of file diff --git a/boards/esp32-c5-devkitc1-n8r4.json b/boards/esp32-c5-devkitc1-n8r4.json new file mode 100644 index 0000000..49d1427 --- /dev/null +++ b/boards/esp32-c5-devkitc1-n8r4.json @@ -0,0 +1,39 @@ +{ + "build": { + "arduino": { + "partitions": "default_8MB.csv", + "memory_type": "qio_qspi" + }, + "core": "esp32", + "extra_flags": [ + "-DBOARD_HAS_PSRAM" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "psram_type": "qio", + "mcu": "esp32c5", + "variant": "esp32c5" + }, + "connectivity": [ + "bluetooth", + "wifi" + ], + "debug": { + "openocd_target": "esp32c5.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif ESP32-C5-DevKitC-1 N8R4 (8 MB Flash Quad, 4 MB PSRAM Quad)", + "upload": { + "flash_size": "8MB", + "maximum_ram_size": 327680, + "maximum_size": 8388608, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32c5/esp32-c5-devkitc-1/user_guide.html", + "vendor": "Espressif" +} \ No newline at end of file diff --git a/boards/m5stack-core-esp32-16M.json b/boards/m5stack-core-esp32-16M.json index 4c5502d..31bfb87 100644 --- a/boards/m5stack-core-esp32-16M.json +++ b/boards/m5stack-core-esp32-16M.json @@ -1,15 +1,12 @@ { "build": { - "arduino":{ - "ldscript": "esp32_out.ld" - }, "core": "esp32", - "extra_flags": "-DARDUINO_M5Stack_Core_ESP32", + "extra_flags": "-DARDUINO_M5Stack_Core", "f_cpu": "240000000L", "f_flash": "80000000L", "flash_mode": "qio", "mcu": "esp32", - "variant": "m5stack_core_esp32" + "variant": "m5stack_core" }, "connectivity": [ "wifi", diff --git a/boards/m5stack-core-esp32.json b/boards/m5stack-core-esp32.json index 8d015f4..6f84ffe 100644 --- a/boards/m5stack-core-esp32.json +++ b/boards/m5stack-core-esp32.json @@ -1,15 +1,12 @@ { "build": { - "arduino":{ - "ldscript": "esp32_out.ld" - }, "core": "esp32", - "extra_flags": "-DARDUINO_M5Stack_Core_ESP32", + "extra_flags": "-DARDUINO_M5Stack_Core", "f_cpu": "240000000L", "f_flash": "80000000L", "flash_mode": "qio", "mcu": "esp32", - "variant": "m5stack_core_esp32" + "variant": "m5stack_core" }, "connectivity": [ "wifi", diff --git a/boards/m5stack-grey.json b/boards/m5stack-grey.json index 886208e..917dd63 100644 --- a/boards/m5stack-grey.json +++ b/boards/m5stack-grey.json @@ -1,15 +1,12 @@ { "build": { - "arduino":{ - "ldscript": "esp32_out.ld" - }, "core": "esp32", - "extra_flags": "-DARDUINO_M5Stack_Core_ESP32", + "extra_flags": "-DARDUINO_M5Stack_Core", "f_cpu": "240000000L", "f_flash": "40000000L", "flash_mode": "dio", "mcu": "esp32", - "variant": "m5stack_core_esp32" + "variant": "m5stack_core" }, "connectivity": [ "wifi", diff --git a/boards/m5stack-tab5-p4.json b/boards/m5stack-tab5-p4.json new file mode 100644 index 0000000..a8fea2b --- /dev/null +++ b/boards/m5stack-tab5-p4.json @@ -0,0 +1,39 @@ +{ + "build": { + "core": "esp32", + "extra_flags": [ + "-DBOARD_HAS_PSRAM", + "-DARDUINO_USB_CDC_ON_BOOT=1", + "-DARDUINO_USB_MODE=1" + ], + "f_cpu": "360000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "mcu": "esp32p4", + "variant": "m5stack_tab5" + }, + "arduino": { + "partitions": "default_16MB.csv" + }, + "connectivity": [ + "bluetooth", + "openthread" + ], + "debug": { + "openocd_target": "esp32p4.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "M5STACK Tab5 esp32-p4 Board", + "upload": { + "flash_size": "16MB", + "maximum_ram_size": 512000, + "maximum_size": 16777216, + "require_upload_port": true, + "speed": 1500000 + }, + "url": "https://docs.m5stack.com/en/core/Tab5", + "vendor": "M5STACK" +} diff --git a/boards/m5stack-tab5-p4.py b/boards/m5stack-tab5-p4.py new file mode 100644 index 0000000..2689b86 --- /dev/null +++ b/boards/m5stack-tab5-p4.py @@ -0,0 +1,12 @@ +def configure_board(env): + if "arduino" in env.get("PIOFRAMEWORK", []): + deps = ["https://github.com/M5Stack/M5Unified.git"] + # Install libraries using PlatformIO Library Manager + from pathlib import Path + from platformio.package.manager.library import LibraryPackageManager + + lib_dir = Path(env.subst("$PROJECT_DIR")) / ".pio" / "libdeps" / env.subst("$PIOENV") + lm = LibraryPackageManager(package_dir=lib_dir) + + for lib in deps: + lm.install(lib) diff --git a/builder/frameworks/_embed_files.py b/builder/frameworks/_embed_files.py index b114fbc..65953f2 100644 --- a/builder/frameworks/_embed_files.py +++ b/builder/frameworks/_embed_files.py @@ -14,13 +14,24 @@ import shutil from os import SEEK_CUR, SEEK_END -from os.path import basename, isfile, join +from os.path import basename, isfile +from pathlib import Path from SCons.Script import Builder Import("env") board = env.BoardConfig() +mcu = board.get("build.mcu", "esp32") +is_xtensa = mcu in ("esp32", "esp32s2", "esp32s3") + +cmake_dir = str(env.PioPlatform().get_package_dir("tool-cmake")) +cmake_cmd = f'"{Path(cmake_dir) / "bin" / "cmake"}"' + +idf_dir = str(env.PioPlatform().get_package_dir("framework-espidf")) +data_embed_script = ( + f'"{Path(idf_dir) / "tools" / "cmake" / "scripts" / "data_file_embed_asm.cmake"}"' +) # # Embedded files helpers @@ -31,7 +42,7 @@ def extract_files(cppdefines, files_type): result = [] files = env.GetProjectOption("board_build.%s" % files_type, "").splitlines() if files: - result.extend([join("$PROJECT_DIR", f.strip()) for f in files if f]) + result.extend([str(Path("$PROJECT_DIR") / f.strip()) for f in files if f.strip()]) else: files_define = "COMPONENT_" + files_type.upper() for define in cppdefines: @@ -51,9 +62,10 @@ def extract_files(cppdefines, files_type): return [] for f in value.split(":"): + f = f.strip() if not f: continue - result.append(join("$PROJECT_DIR", f)) + result.append(str(Path("$PROJECT_DIR") / f)) for f in result: if not isfile(env.subst(f)): @@ -74,10 +86,14 @@ def prepare_file(source, target, env): shutil.copy(filepath, filepath + ".piobkp") with open(filepath, "rb+") as fp: - fp.seek(-1, SEEK_END) - if fp.read(1) != "\0": - fp.seek(0, SEEK_CUR) + fp.seek(0, SEEK_END) + size = fp.tell() + if size == 0: fp.write(b"\0") + else: + fp.seek(-1, SEEK_END) + if fp.read(1) != b"\0": + fp.write(b"\0") def revert_original_file(source, target, env): @@ -89,20 +105,19 @@ def revert_original_file(source, target, env): def embed_files(files, files_type): for f in files: filename = basename(f) + ".txt.o" - file_target = env.TxtToBin(join("$BUILD_DIR", filename), f) + file_target = env.TxtToBin(str(Path("$BUILD_DIR") / filename), f) env.Depends("$PIOMAINPROG", file_target) if files_type == "embed_txtfiles": env.AddPreAction(file_target, prepare_file) env.AddPostAction(file_target, revert_original_file) - env.AppendUnique(PIOBUILDFILES=[env.File(join("$BUILD_DIR", filename))]) + env.AppendUnique(PIOBUILDFILES=[env.File(str(Path("$BUILD_DIR") / filename))]) def transform_to_asm(target, source, env): - files = [join("$BUILD_DIR", s.name + ".S") for s in source] - return files, source + asm_targets = [str(Path("$BUILD_DIR") / (s.name + ".S")) for s in source] + return asm_targets, source - -mcu = board.get("build.mcu", "esp32") + env.Append( BUILDERS=dict( TxtToBin=Builder( @@ -110,14 +125,14 @@ env.Append( " ".join( [ "riscv32-esp-elf-objcopy" - if mcu in ("esp32c2","esp32c3","esp32c5","esp32c6","esp32h2","esp32p4") - else "xtensa-%s-elf-objcopy" % mcu, + if not is_xtensa + else f"xtensa-{mcu}-elf-objcopy", "--input-target", "binary", "--output-target", - "elf32-littleriscv" if mcu in ("esp32c2","esp32c3","esp32c5","esp32c6","esp32h2","esp32p4") else "elf32-xtensa-le", + "elf32-littleriscv" if not is_xtensa else "elf32-xtensa-le", "--binary-architecture", - "riscv" if mcu in ("esp32c2","esp32c3","esp32c5","esp32c6","esp32h2","esp32p4") else "xtensa", + "riscv" if not is_xtensa else "xtensa", "--rename-section", ".data=.rodata.embedded", "$SOURCE", @@ -132,22 +147,12 @@ env.Append( action=env.VerboseAction( " ".join( [ - join( - env.PioPlatform().get_package_dir("tool-cmake") or "", - "bin", - "cmake", - ), + cmake_cmd, "-DDATA_FILE=$SOURCE", "-DSOURCE_FILE=$TARGET", "-DFILE_TYPE=$FILE_TYPE", "-P", - join( - env.PioPlatform().get_package_dir("framework-espidf") or "", - "tools", - "cmake", - "scripts", - "data_file_embed_asm.cmake", - ), + data_embed_script, ] ), "Generating assembly for $TARGET", @@ -170,7 +175,7 @@ for files_type in ("embed_txtfiles", "embed_files"): files = extract_files(flags, files_type) if "espidf" in env.subst("$PIOFRAMEWORK"): env.Requires( - join("$BUILD_DIR", "${PROGNAME}.elf"), + str(Path("$BUILD_DIR") / "${PROGNAME}.elf"), env.FileToAsm( files, FILE_TYPE="TEXT" if files_type == "embed_txtfiles" else "BINARY", diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index ee4a147..ab5c081 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -35,8 +35,7 @@ from typing import Union, List from SCons.Script import DefaultEnvironment, SConscript from platformio import fs from platformio.package.manager.tool import ToolPackageManager - -IS_WINDOWS = sys.platform.startswith("win") +from platformio.compat import IS_WINDOWS # Constants for better performance UNICORE_FLAGS = { @@ -73,7 +72,7 @@ def get_platform_default_threshold(mcu): "esp32": 32000, # Standard ESP32 "esp32s2": 32000, # ESP32-S2 "esp32s3": 32766, # ESP32-S3 - "esp32c3": 30000, # ESP32-C3 + "esp32c3": 32000, # ESP32-C3 "esp32c2": 32000, # ESP32-C2 "esp32c6": 31600, # ESP32-C6 "esp32h2": 32000, # ESP32-H2 @@ -311,7 +310,7 @@ class PathCache: def sdk_dir(self): if self._sdk_dir is None: self._sdk_dir = fs.to_unix_path( - join(self.framework_lib_dir, self.mcu, "include") + str(Path(self.framework_lib_dir) / self.mcu / "include") ) return self._sdk_dir @@ -507,7 +506,7 @@ def safe_remove_sdkconfig_files(): envs = [section.replace("env:", "") for section in config.sections() if section.startswith("env:")] for env_name in envs: - file_path = join(project_dir, f"sdkconfig.{env_name}") + file_path = str(Path(project_dir) / f"sdkconfig.{env_name}") if exists(file_path): safe_delete_file(file_path) @@ -566,9 +565,7 @@ FRAMEWORK_LIB_DIR = path_cache.framework_lib_dir SConscript("_embed_files.py", exports="env") -flag_any_custom_sdkconfig = exists(join( - platform.get_package_dir("framework-arduinoespressif32-libs"), - "sdkconfig")) +flag_any_custom_sdkconfig = exists(str(Path(FRAMEWORK_LIB_DIR) / "sdkconfig")) def has_unicore_flags(): @@ -599,7 +596,7 @@ def matching_custom_sdkconfig(): if not flag_any_custom_sdkconfig: return True, cust_sdk_is_present - last_sdkconfig_path = join(project_dir, "sdkconfig.defaults") + last_sdkconfig_path = str(Path(project_dir) / "sdkconfig.defaults") if not exists(last_sdkconfig_path): return False, cust_sdk_is_present @@ -901,12 +898,12 @@ if ("arduino" in pioframework and "espidf" not in pioframework and component_manager = ComponentManager(env) component_manager.handle_component_settings() silent_action = env.Action(component_manager.restore_pioarduino_build_py) - # hack to silence scons command output + # silence scons command output silent_action.strfunction = lambda target, source, env: '' env.AddPostAction("checkprogsize", silent_action) if IS_WINDOWS: env.AddBuildMiddleware(smart_include_length_shorten) - build_script_path = join(FRAMEWORK_DIR, "tools", "pioarduino-build.py") + build_script_path = str(Path(FRAMEWORK_DIR) / "tools" / "pioarduino-build.py") SConscript(build_script_path) diff --git a/builder/frameworks/component_manager.py b/builder/frameworks/component_manager.py index d775816..118c1f5 100644 --- a/builder/frameworks/component_manager.py +++ b/builder/frameworks/component_manager.py @@ -13,28 +13,28 @@ import shutil import re import yaml from yaml import SafeLoader -from os.path import join -from typing import Set, Optional, Dict, Any, List, Tuple +from pathlib import Path +from typing import Set, Optional, Dict, Any, List, Tuple, Pattern class ComponentManagerConfig: """ Handles configuration and environment setup for component management. - + This class centralizes all configuration-related operations and provides a unified interface for accessing PlatformIO environment settings, - board configurations, and framework paths. + board configurations, and framework paths with optimized caching. """ - + def __init__(self, env): """ Initialize the configuration manager with PlatformIO environment. - + Extracts and stores essential configuration parameters from the PlatformIO environment including platform details, board configuration, MCU type, and framework paths. This initialization ensures all dependent classes have consistent access to configuration data. - + Args: env: PlatformIO environment object containing project configuration, board settings, and platform information @@ -47,61 +47,86 @@ class ComponentManagerConfig: self.mcu = self.board.get("build.mcu", "esp32").lower() # Get project source directory path self.project_src_dir = env.subst("$PROJECT_SRC_DIR") - # Get Arduino framework installation directory - self.arduino_framework_dir = self.platform.get_package_dir("framework-arduinoespressif32") - # Get MCU-specific Arduino libraries directory - self.arduino_libs_mcu = join(self.platform.get_package_dir("framework-arduinoespressif32-libs"), self.mcu) + + # Cache expensive operations using lazy loading + self._arduino_framework_dir = None + self._arduino_libs_mcu = None + + @property + def arduino_framework_dir(self): + """ + Lazy-loaded property for Arduino framework directory. + + Returns: + Path to Arduino ESP32 framework installation directory + """ + if self._arduino_framework_dir is None: + self._arduino_framework_dir = self.platform.get_package_dir("framework-arduinoespressif32") + return self._arduino_framework_dir + + @property + def arduino_libs_mcu(self): + """ + Lazy-loaded property for MCU-specific Arduino libraries directory. + + Returns: + Path to MCU-specific Arduino libraries directory + """ + if self._arduino_libs_mcu is None: + ald = self.platform.get_package_dir("framework-arduinoespressif32-libs") + self._arduino_libs_mcu = str(Path(ald) / self.mcu) if ald else "" + return self._arduino_libs_mcu class ComponentLogger: """ Simple logging functionality for component operations. - + Provides centralized logging for all component management operations, tracking changes made during the build process and offering summary reporting capabilities. """ - + def __init__(self): """ Initialize the logger with empty change tracking. - + Sets up internal data structures for tracking component changes and modifications made during the build process. """ # List to store all change messages for summary reporting self.component_changes: List[str] = [] - + def log_change(self, message: str) -> None: """ Log a change message with immediate console output. - + Records the change message internally for summary reporting and immediately prints it to the console with a component manager prefix for real-time feedback during build operations. - + Args: message: Descriptive message about the change or operation performed """ self.component_changes.append(message) print(f"[ComponentManager] {message}") - + def get_changes_summary(self) -> List[str]: """ Get a copy of all changes made during the session. - + Returns a defensive copy of the change log to prevent external modification while allowing access to the complete change history. - + Returns: List of change messages in chronological order """ return self.component_changes.copy() - + def print_changes_summary(self) -> None: """ Print a formatted summary of all changes made. - + Outputs a nicely formatted summary of all component changes if any were made, or a simple message indicating no changes occurred. Useful for end-of-build reporting and debugging. @@ -118,20 +143,20 @@ class ComponentLogger: class ComponentHandler: """ Handles IDF component addition and removal operations. - + Manages the core functionality for adding and removing ESP-IDF components from Arduino framework projects, including YAML file manipulation, component validation, and cleanup operations. """ - + def __init__(self, config: ComponentManagerConfig, logger: ComponentLogger): """ Initialize the component handler with configuration and logging. - + Sets up the component handler with necessary dependencies for configuration access and change logging. Initializes tracking for removed components to enable proper cleanup operations. - + Args: config: Configuration manager instance providing access to paths and settings logger: Logger instance for recording component operations @@ -140,15 +165,15 @@ class ComponentHandler: self.logger = logger # Track removed components for cleanup operations self.removed_components: Set[str] = set() - + def handle_component_settings(self, add_components: bool = False, remove_components: bool = False) -> None: """ Handle adding and removing IDF components based on project configuration. - + Main entry point for component management operations. Processes both component additions and removals based on project configuration options, manages backup creation, and handles cleanup of removed components. - + Args: add_components: Whether to process component additions from custom_component_add remove_components: Whether to process component removals from custom_component_remove @@ -157,32 +182,32 @@ class ComponentHandler: if remove_components and not self.removed_components or add_components: self._backup_pioarduino_build_py() self.logger.log_change("Created backup of build file") - + # Check if env and GetProjectOption are available if hasattr(self.config, 'env') and hasattr(self.config.env, 'GetProjectOption'): component_yml_path = self._get_or_create_component_yml() component_data = self._load_component_yml(component_yml_path) - + if remove_components: self._process_component_removals(component_data) - + if add_components: self._process_component_additions(component_data) - + self._save_component_yml(component_yml_path, component_data) - + # Clean up removed components if self.removed_components: self._cleanup_removed_components() - + def _process_component_removals(self, component_data: Dict[str, Any]) -> None: """ Process component removal requests from project configuration. - + Reads the custom_component_remove option from platformio.ini and processes each component for removal from the dependency list. Handles errors gracefully and logs all operations. - + Args: component_data: Component configuration data dictionary containing dependencies """ @@ -194,15 +219,15 @@ class ComponentHandler: self._remove_components(component_data, components_to_remove) except Exception as e: self.logger.log_change(f"Error removing components: {str(e)}") - + def _process_component_additions(self, component_data: Dict[str, Any]) -> None: """ Process component addition requests from project configuration. - + Reads the custom_component_add option from platformio.ini and processes each component for addition to the dependency list. Handles errors gracefully and logs all operations. - + Args: component_data: Component configuration data dictionary containing dependencies """ @@ -214,58 +239,59 @@ class ComponentHandler: self._add_components(component_data, components_to_add) except Exception as e: self.logger.log_change(f"Error adding components: {str(e)}") - + def _get_or_create_component_yml(self) -> str: """ Get path to idf_component.yml, creating it if necessary. - + Searches for existing idf_component.yml files in the Arduino framework directory first, then in the project source directory. If no file exists, creates a new one in the project source directory with default content. - + Returns: Absolute path to the component YAML file """ # Try Arduino framework first - framework_yml = join(self.config.arduino_framework_dir, "idf_component.yml") - if os.path.exists(framework_yml): + afd = self.config.arduino_framework_dir + framework_yml = str(Path(afd) / "idf_component.yml") if afd else "" + if framework_yml and os.path.exists(framework_yml): self._create_backup(framework_yml) return framework_yml - + # Try project source directory - project_yml = join(self.config.project_src_dir, "idf_component.yml") + project_yml = str(Path(self.config.project_src_dir) / "idf_component.yml") if os.path.exists(project_yml): self._create_backup(project_yml) return project_yml - + # Create new file in project source self._create_default_component_yml(project_yml) return project_yml - + def _create_backup(self, file_path: str) -> None: """ Create backup of a file with .orig extension. - + Creates a backup copy of the specified file by appending .orig to the filename. Only creates the backup if it doesn't already exist to preserve the original state. - + Args: file_path: Absolute path to the file to backup """ backup_path = f"{file_path}.orig" if not os.path.exists(backup_path): shutil.copy(file_path, backup_path) - + def _create_default_component_yml(self, file_path: str) -> None: """ Create a default idf_component.yml file with basic ESP-IDF dependency. - + Creates a new component YAML file with minimal default content specifying ESP-IDF version 5.1 or higher as the base dependency. This ensures compatibility with modern ESP-IDF features. - + Args: file_path: Absolute path where to create the new YAML file """ @@ -274,21 +300,21 @@ class ComponentHandler: "idf": ">=5.1" } } - + with open(file_path, 'w', encoding='utf-8') as f: yaml.dump(default_content, f) - + def _load_component_yml(self, file_path: str) -> Dict[str, Any]: """ Load and parse idf_component.yml file safely. - + Attempts to load and parse the YAML file using SafeLoader for security. Returns a default structure with empty dependencies if the file cannot be read or parsed. - + Args: file_path: Absolute path to the YAML file to load - + Returns: Parsed YAML data as dictionary, or default structure on failure """ @@ -297,15 +323,15 @@ class ComponentHandler: return yaml.load(f, Loader=SafeLoader) or {"dependencies": {}} except Exception: return {"dependencies": {}} - + def _save_component_yml(self, file_path: str, data: Dict[str, Any]) -> None: """ Save component data to YAML file safely. - + Attempts to write the component data dictionary to the specified YAML file. Handles errors gracefully by silently failing to prevent build interruption. - + Args: file_path: Absolute path to the YAML file to write data: Component data dictionary to serialize @@ -315,74 +341,74 @@ class ComponentHandler: yaml.dump(data, f) except Exception: pass - + def _remove_components(self, component_data: Dict[str, Any], components_to_remove: list) -> None: """ Remove specified components from the configuration. - + Iterates through the list of components to remove, checking if each exists in the dependencies and removing it if found. Tracks removed components for later cleanup operations and logs all actions. - + Args: component_data: Component configuration data dictionary components_to_remove: List of component names to remove """ dependencies = component_data.setdefault("dependencies", {}) - + for component in components_to_remove: component = component.strip() if not component: continue - + if component in dependencies: self.logger.log_change(f"Removed component: {component}") del dependencies[component] - + # Track for cleanup - convert to filesystem-safe name filesystem_name = self._convert_component_name_to_filesystem(component) self.removed_components.add(filesystem_name) else: self.logger.log_change(f"Component not found: {component}") - + def _add_components(self, component_data: Dict[str, Any], components_to_add: list) -> None: """ Add specified components to the configuration. - + Processes each component entry, parsing name and version information, and adds new components to the dependencies. Skips components that already exist and filters out entries that are too short to be valid. - + Args: component_data: Component configuration data dictionary components_to_add: List of component entries to add (format: name@version or name) """ dependencies = component_data.setdefault("dependencies", {}) - + for component in components_to_add: component = component.strip() - if len(component) <= 4: # Skip too short entries + if not component: # Skip empty entries continue - + component_name, version = self._parse_component_entry(component) - + if component_name not in dependencies: dependencies[component_name] = {"version": version} self.logger.log_change(f"Added component: {component_name} ({version})") else: self.logger.log_change(f"Component already exists: {component_name}") - + def _parse_component_entry(self, entry: str) -> Tuple[str, str]: """ Parse component entry into name and version components. - + Splits component entries that contain version information (format: name@version) and returns both parts. If no version is specified, defaults to "*" for latest version. - + Args: entry: Component entry string (e.g., "espressif/esp_timer@1.0.0" or "espressif/esp_timer") - + Returns: Tuple containing (component_name, version) """ @@ -390,122 +416,136 @@ class ComponentHandler: name, version = entry.split("@", 1) return (name.strip(), version.strip()) return (entry.strip(), "*") - + def _convert_component_name_to_filesystem(self, component_name: str) -> str: """ Convert component name from registry format to filesystem format. - + Converts component names from ESP Component Registry format (using forward slashes) to filesystem-safe format (using double underscores) for directory operations. - + Args: component_name: Component name in registry format (e.g., "espressif/esp_timer") - + Returns: Filesystem-safe component name (e.g., "espressif__esp_timer") """ return component_name.replace("/", "__") - + def _backup_pioarduino_build_py(self) -> None: """ Create backup of the original pioarduino-build.py file. - + Creates a backup of the Arduino framework's build script before making modifications. Only operates when Arduino framework is active and creates MCU-specific backup names to avoid conflicts. """ if "arduino" not in self.config.env.subst("$PIOFRAMEWORK"): return - - build_py_path = join(self.config.arduino_libs_mcu, "pioarduino-build.py") - backup_path = join(self.config.arduino_libs_mcu, f"pioarduino-build.py.{self.config.mcu}") - + + if not self.config.arduino_libs_mcu: + return + + build_py_path = str(Path(self.config.arduino_libs_mcu) / "pioarduino-build.py") + backup_path = str(Path(self.config.arduino_libs_mcu) / f"pioarduino-build.py.{self.config.mcu}") + if os.path.exists(build_py_path) and not os.path.exists(backup_path): shutil.copy2(build_py_path, backup_path) - + def _cleanup_removed_components(self) -> None: """ Clean up removed components and restore original build file. - - Performs cleanup operations for all components that were removed, + + Performs optimized batch cleanup operations for all components that were removed, including removing include directories and cleaning up CPPPATH - entries from the build script. + entries from the build script in a single pass. """ + if not self.removed_components: + return + + # Batch remove include directories + self._batch_remove_include_directories() + + # Single pass through build file for all components + self._batch_remove_cpppath_entries() + + def _batch_remove_include_directories(self) -> None: + """ + Remove multiple include directories in one optimized operation. + + Removes all component include directories efficiently without + individual file system calls for each component. + """ + include_base_path = Path(self.config.arduino_libs_mcu) / "include" + for component in self.removed_components: - self._remove_include_directory(component) - - self._remove_cpppath_entries() - - def _remove_include_directory(self, component: str) -> None: + include_path = include_base_path / component + if include_path.exists(): + try: + shutil.rmtree(include_path) + except OSError: + pass # Continue with other components + + def _batch_remove_cpppath_entries(self) -> None: """ - Remove include directory for a specific component. - - Removes the component's include directory from the Arduino framework - libraries to prevent compilation errors and reduce build overhead. - - Args: - component: Component name in filesystem format + Remove CPPPATH entries for all components in single optimized file pass. + + Uses compiled regex patterns and processes all removed components + in a single pass through the build file for maximum efficiency. """ - include_path = join(self.config.arduino_libs_mcu, "include", component) - - if os.path.exists(include_path): - shutil.rmtree(include_path) - - def _remove_cpppath_entries(self) -> None: - """ - Remove CPPPATH entries for removed components from pioarduino-build.py. - - Scans the Arduino build script and removes include path entries - for all components that were removed from the project. Uses - multiple regex patterns to catch different include path formats. - """ - build_py_path = join(self.config.arduino_libs_mcu, "pioarduino-build.py") - + build_py_path = str(Path(self.config.arduino_libs_mcu) / "pioarduino-build.py") + if not os.path.exists(build_py_path): return - + try: with open(build_py_path, 'r', encoding='utf-8') as f: content = f.read() - + original_content = content - - # Remove CPPPATH entries for each removed component - for component in self.removed_components: - patterns = [ - rf'.*join\([^,]*,\s*"include",\s*"{re.escape(component)}"[^)]*\),?\n', - rf'.*"include/{re.escape(component)}"[^,\n]*,?\n', - rf'.*"[^"]*include[^"]*{re.escape(component)}[^"]*"[^,\n]*,?\n' - ] - - for pattern in patterns: - content = re.sub(pattern, '', content) - + + # Create combined pattern for all components for maximum efficiency + escaped_components = [re.escape(comp) for comp in self.removed_components] + component_pattern = '|'.join(escaped_components) + + # Compile patterns once for all components + combined_patterns = [ + re.compile(rf'.*join\([^,]*,\s*"include",\s*"({component_pattern})"[^)]*\),?\n'), + re.compile(rf'.*"include/({component_pattern})"[^,\n]*,?\n'), + re.compile(rf'.*"[^"]*include[^"]*({component_pattern})[^"]*"[^,\n]*,?\n') + ] + + # Apply all patterns in single pass + for pattern in combined_patterns: + content = pattern.sub('', content) + + # Write changes if any were made if content != original_content: with open(build_py_path, 'w', encoding='utf-8') as f: f.write(content) - - except Exception: - pass + + except Exception as e: + print(f"[ComponentManager] Error updating build file during CPPPATH cleanup: {e!s}") class LibraryIgnoreHandler: """ - Handles lib_ignore processing and include removal. - + Handles lib_ignore processing and include removal with optimized performance. + Manages the processing of lib_ignore entries from platformio.ini, converting library names to include paths and removing corresponding entries from the build script while protecting critical components. + Uses compiled regex patterns and caching for maximum performance. """ - + def __init__(self, config: ComponentManagerConfig, logger: ComponentLogger): """ - Initialize the library ignore handler. - + Initialize the library ignore handler with performance optimizations. + Sets up the handler with configuration and logging dependencies, - initializes tracking for ignored libraries, and prepares caching - for Arduino library mappings. - + initializes tracking for ignored libraries, and prepares optimized + caching and compiled patterns for maximum performance. + Args: config: Configuration manager instance for accessing paths and settings logger: Logger instance for recording library operations @@ -514,49 +554,74 @@ class LibraryIgnoreHandler: self.logger = logger # Track ignored libraries for processing self.ignored_libs: Set[str] = set() - # Cache for Arduino library mappings (lazy loaded) + + # Performance optimization: Pre-compute critical components as set for O(1) lookup + self._critical_components = { + 'lwip', # Network stack + 'freertos', # Real-time OS + 'esp_system', # System functions + 'esp_common', # Common ESP functions + 'driver', # Hardware drivers + 'nvs_flash', # Non-volatile storage + 'spi_flash', # Flash memory access + 'esp_timer', # Timer functions + 'esp_event', # Event system + 'log', # Logging system + 'arduino_tinyusb', # Arduino TinyUSB library + 'tinyusb' # TinyUSB library + } + + # Pre-compute BT-related keywords as set for O(1) lookup + self._bt_keywords = { + 'BLE', 'BT', 'NIMBLE', 'BLUETOOTH', 'ESP32_BLE', 'ESP32BLE', + 'BLUETOOTHSERIAL', 'BLE_ARDUINO', 'ESP_BLE', 'ESP_BT' + } + + # Cache for expensive operations (lazy loaded) self._arduino_libraries_cache = None - + self._compiled_patterns_cache = {} + self._cleanup_patterns = None + def handle_lib_ignore(self) -> None: """ Handle lib_ignore entries from platformio.ini and remove corresponding includes. - + Main entry point for library ignore processing. Creates backup if needed, processes lib_ignore entries from the current environment, and removes - corresponding include paths from the build script. + corresponding include paths from the build script using optimized algorithms. """ # Create backup before processing lib_ignore if not self.ignored_libs: self._backup_pioarduino_build_py() - + # Get lib_ignore entries from current environment only lib_ignore_entries = self._get_lib_ignore_entries() - + if lib_ignore_entries: self.ignored_libs.update(lib_ignore_entries) self._remove_ignored_lib_includes() self.logger.log_change(f"Processed {len(lib_ignore_entries)} ignored libraries") - + def _get_lib_ignore_entries(self) -> List[str]: """ - Get lib_ignore entries from current environment configuration only. - + Get lib_ignore entries from current environment configuration with optimized filtering. + Extracts and processes lib_ignore entries from the platformio.ini configuration, converting library names to include directory names - and filtering out critical ESP32 components that should never be ignored. - + and filtering out critical ESP32 components using O(1) set lookups. + Returns: List of processed library names ready for include path removal """ try: # Get lib_ignore from current environment only lib_ignore = self.config.env.GetProjectOption("lib_ignore", []) - + if isinstance(lib_ignore, str): lib_ignore = [lib_ignore] elif lib_ignore is None: lib_ignore = [] - + # Clean and normalize entries cleaned_entries = [] for entry in lib_ignore: @@ -564,115 +629,84 @@ class LibraryIgnoreHandler: if entry: # Convert library names to potential include directory names include_name = self._convert_lib_name_to_include(entry) - cleaned_entries.append(include_name) - - # Filter out critical ESP32 components that should never be ignored - critical_components = [ - 'lwip', # Network stack - 'freertos', # Real-time OS - 'esp_system', # System functions - 'esp_common', # Common ESP functions - 'driver', # Hardware drivers - 'nvs_flash', # Non-volatile storage - 'spi_flash', # Flash memory access - 'esp_timer', # Timer functions - 'esp_event', # Event system - 'log' # Logging system - ] - - filtered_entries = [] - for entry in cleaned_entries: - if entry not in critical_components: - filtered_entries.append(entry) - - return filtered_entries - + # Use optimized set lookup for critical components check (O(1) vs O(n)) + if include_name not in self._critical_components: + cleaned_entries.append(include_name) + + return sorted(set(cleaned_entries)) + except Exception: return [] - + def _has_bt_ble_dependencies(self) -> bool: """ - Check if lib_deps contains any BT/BLE related dependencies. - + Check if lib_deps contains any BT/BLE related dependencies using optimized search. + Scans the lib_deps configuration option for Bluetooth or BLE related keywords to determine if BT components should be protected from removal even if they appear in lib_ignore. - + Returns: True if BT/BLE dependencies are found in lib_deps """ try: # Get lib_deps from current environment lib_deps = self.config.env.GetProjectOption("lib_deps", []) - + if isinstance(lib_deps, str): lib_deps = [lib_deps] elif lib_deps is None: lib_deps = [] - - # Convert to string and check for BT/BLE keywords - lib_deps_str = ' '.join(str(dep) for dep in lib_deps).upper() - - bt_ble_keywords = ['BLE', 'BT', 'NIMBLE', 'BLUETOOTH'] - return any(keyword in lib_deps_str for keyword in bt_ble_keywords) - + # Convert to string and check for BT/BLE keywords using set intersection + lib_deps_str = ' '.join(str(dep) for dep in lib_deps).upper() + return any(keyword in lib_deps_str for keyword in self._bt_keywords) + except Exception: return False - + def _is_bt_related_library(self, lib_name: str) -> bool: """ - Check if a library name is related to Bluetooth/BLE functionality. - + Check if a library name is related to Bluetooth/BLE functionality using optimized lookup. + Examines library names for Bluetooth and BLE related keywords to determine if the library should be protected when BT dependencies - are present in the project. - + are present in the project. Uses pre-computed set for fast lookup. + Args: lib_name: Library name to check for BT/BLE relation - + Returns: True if library name contains BT/BLE related keywords """ lib_name_upper = lib_name.upper() - - bt_related_names = [ - 'BT', - 'BLE', - 'BLUETOOTH', - 'NIMBLE', - 'ESP32_BLE', - 'ESP32BLE', - 'BLUETOOTHSERIAL', - 'BLE_ARDUINO', - 'ESP_BLE', - 'ESP_BT' - ] + return any(bt_keyword in lib_name_upper for bt_keyword in self._bt_keywords) - return any(bt_name in lib_name_upper for bt_name in bt_related_names) - def _get_arduino_core_libraries(self) -> Dict[str, str]: """ Get all Arduino core libraries and their corresponding include paths. - + Scans the Arduino framework libraries directory to build a mapping of library names to their corresponding include paths. Reads library.properties files to get official library names. - + Returns: Dictionary mapping library names to include directory names """ libraries_mapping = {} - + # Path to Arduino Core Libraries - arduino_libs_dir = join(self.config.arduino_framework_dir, "libraries") - + afd = self.config.arduino_framework_dir + if not afd: + return libraries_mapping + arduino_libs_dir = str(Path(afd).resolve() / "libraries") + if not os.path.exists(arduino_libs_dir): return libraries_mapping - + try: for entry in os.listdir(arduino_libs_dir): - lib_path = join(arduino_libs_dir, entry) + lib_path = str(Path(arduino_libs_dir) / entry) if os.path.isdir(lib_path): lib_name = self._get_library_name_from_properties(lib_path) if lib_name: @@ -681,26 +715,26 @@ class LibraryIgnoreHandler: libraries_mapping[entry.lower()] = include_path # Also use directory name as key except Exception: pass - + return libraries_mapping - + def _get_library_name_from_properties(self, lib_dir: str) -> Optional[str]: """ Extract library name from library.properties file. - + Reads the library.properties file in the given directory and extracts the official library name from the 'name=' field. - + Args: lib_dir: Path to library directory containing library.properties - + Returns: Official library name or None if not found or readable """ - prop_path = join(lib_dir, "library.properties") + prop_path = str(Path(lib_dir) / "library.properties") if not os.path.isfile(prop_path): return None - + try: with open(prop_path, 'r', encoding='utf-8') as f: for line in f: @@ -709,27 +743,27 @@ class LibraryIgnoreHandler: return line.split('=', 1)[1].strip() except Exception: pass - + return None - + def _map_library_to_include_path(self, lib_name: str, dir_name: str) -> str: """ Map library name to corresponding include path. - + Converts Arduino library names to their corresponding ESP-IDF component include paths using an extensive mapping table. Handles common Arduino libraries and their ESP-IDF equivalents. - + Args: lib_name: Official library name from library.properties dir_name: Directory name of the library - + Returns: Corresponding ESP-IDF component include path name """ lib_name_lower = lib_name.lower().replace(' ', '').replace('-', '_') dir_name_lower = dir_name.lower() - + # Extended mapping list with Arduino Core Libraries extended_mapping = { # Core ESP32 mappings @@ -753,10 +787,13 @@ class LibraryIgnoreHandler: 'json': 'cjson', 'mbedtls': 'mbedtls', 'openssl': 'openssl', - + # Arduino Core specific mappings (safe mappings that don't conflict with critical components) 'esp32blearduino': 'bt', 'esp32_ble_arduino': 'bt', + 'simpleble': 'bt', + 'esp_nimble_cpp': 'bt', + 'nimble_arduino': 'bt', 'esp32': 'esp32', 'wire': 'driver', 'spi': 'driver', @@ -808,188 +845,279 @@ class LibraryIgnoreHandler: 'esptouch': 'esp_smartconfig', 'ping': 'lwip', 'netif': 'lwip', - 'tcpip': 'lwip' + 'tcpip': 'lwip', + 'usb': 'arduino_tinyusb', + 'tinyusb': 'arduino_tinyusb', + 'dsp': 'espressif__esp-dsp', + 'esp_dsp': 'espressif__esp-dsp', + 'dsps': 'espressif__esp-dsp', + 'fft2r': 'espressif__esp-dsp', + 'dsps_fft2r': 'espressif__esp-dsp', + 'esp-dsp': 'espressif__esp-dsp', + 'espressif/esp-dsp': 'espressif__esp-dsp', + 'espressif__esp-dsp': 'espressif__esp-dsp' } - + # Check extended mapping first if lib_name_lower in extended_mapping: return extended_mapping[lib_name_lower] - + # Check directory name if dir_name_lower in extended_mapping: return extended_mapping[dir_name_lower] - + # Fallback: Use directory name as include path return dir_name_lower - + def _convert_lib_name_to_include(self, lib_name: str) -> str: """ - Convert library name to potential include directory name. - + Convert library name to potential include directory name with optimized fast paths. + Converts library names from platformio.ini lib_ignore entries to their corresponding include directory names. Uses Arduino - core library mappings and common naming conventions. - + core library mappings and common naming conventions with + performance optimizations for common cases like DSP. + Args: lib_name: Library name from lib_ignore configuration - + Returns: Converted include directory name for path removal """ - # Load Arduino Core Libraries on first call - if not hasattr(self, '_arduino_libraries_cache'): - self._arduino_libraries_cache = self._get_arduino_core_libraries() - lib_name_lower = lib_name.lower() - - # Check Arduino Core Libraries first + + # Fast path optimization for DSP components (most performance-critical case) + dsp_patterns = { + 'dsp', 'esp_dsp', 'dsps', 'fft2r', 'dsps_fft2r', 'esp-dsp', + 'espressif/esp-dsp', 'espressif__esp-dsp' + } + if lib_name_lower in dsp_patterns: + return 'espressif__esp-dsp' + + # Fast path for BT components + bt_patterns = { + 'ble', 'bluetooth', 'bluetoothserial', 'simpleble', 'esp-nimble-cpp' + } + if lib_name_lower in bt_patterns: + return 'bt' + + # Load Arduino Core Libraries on first call (lazy loading) + if self._arduino_libraries_cache is None: + self._arduino_libraries_cache = self._get_arduino_core_libraries() + + # Check Arduino Core Libraries cache if lib_name_lower in self._arduino_libraries_cache: return self._arduino_libraries_cache[lib_name_lower] - + + # Continue with full conversion logic for less common cases + return self._full_conversion_logic(lib_name_lower) + + def _full_conversion_logic(self, lib_name_lower: str) -> str: + """ + Full conversion logic for library names not handled by fast paths. + + Args: + lib_name_lower: Lowercase library name to convert + + Returns: + Converted include directory name + """ # Remove common prefixes and suffixes cleaned_name = lib_name_lower - + # Remove common prefixes prefixes_to_remove = ['lib', 'arduino-', 'esp32-', 'esp-'] for prefix in prefixes_to_remove: if cleaned_name.startswith(prefix): cleaned_name = cleaned_name[len(prefix):] - + # Remove common suffixes suffixes_to_remove = ['-lib', '-library', '.h'] for suffix in suffixes_to_remove: if cleaned_name.endswith(suffix): cleaned_name = cleaned_name[:-len(suffix)] - + # Check again with cleaned name if cleaned_name in self._arduino_libraries_cache: return self._arduino_libraries_cache[cleaned_name] - - # Direct mapping for common cases not in Arduino libraries - direct_mapping = { - 'ble': 'bt', - 'bluetooth': 'bt', - 'bluetoothserial': 'bt' - } - - if cleaned_name in direct_mapping: - return direct_mapping[cleaned_name] - + return cleaned_name - + + def _get_compiled_patterns(self, lib_name: str) -> List[Pattern]: + """ + Get pre-compiled regex patterns for a library name with caching. + + Compiles and caches regex patterns for library name matching + to avoid repeated compilation overhead during processing. + + Args: + lib_name: Library name to create patterns for + + Returns: + List of compiled regex patterns for the library + """ + if lib_name not in self._compiled_patterns_cache: + escaped_name = re.escape(lib_name) + patterns = [ + re.compile(rf'.*join\([^,]*,\s*"include",\s*"{escaped_name}"[^)]*\),?\n'), + re.compile(rf'.*"include/{escaped_name}"[^,\n]*,?\n'), + re.compile(rf'.*"[^"]*include[^"]*{escaped_name}[^"]*"[^,\n]*,?\n'), + re.compile(rf'.*"[^"]*/{escaped_name}/include[^"]*"[^,\n]*,?\n'), + re.compile(rf'.*"[^"]*{escaped_name}[^"]*include[^"]*"[^,\n]*,?\n'), + re.compile(rf'.*join\([^)]*"include"[^)]*"{escaped_name}"[^)]*\),?\n'), + re.compile(rf'.*"{escaped_name}/include"[^,\n]*,?\n'), + re.compile(rf'\s*"[^"]*[\\/]{escaped_name}[\\/][^"]*",?\n'), + re.compile(rf'.*Path\([^)]*\)\s*/\s*"include"\s*/\s*"{escaped_name}"[^,\n]*,?\n'), + re.compile(rf'.*Path\([^)]*{escaped_name}[^)]*\)\s*/\s*"include"[^,\n]*,?\n') + ] + self._compiled_patterns_cache[lib_name] = patterns + return self._compiled_patterns_cache[lib_name] + + def _get_cleanup_patterns(self) -> List[Pattern]: + """ + Get compiled cleanup patterns with caching. + + Returns: + List of compiled regex patterns for content cleanup + """ + if self._cleanup_patterns is None: + self._cleanup_patterns = [ + re.compile(r'\n\s*\n'), + re.compile(r',\s*\n\s*\]') + ] + return self._cleanup_patterns + def _remove_ignored_lib_includes(self) -> None: """ - Remove include entries for ignored libraries from pioarduino-build.py. - + Remove include entries for ignored libraries using optimized batch processing. + Processes the Arduino build script to remove CPPPATH entries for - all ignored libraries. Implements protection for BT/BLE and DSP - components when dependencies are detected. Uses multiple regex - patterns to catch different include path formats. + all ignored libraries using compiled regex patterns and batch processing. + Implements protection for BT/BLE components when dependencies are detected. """ - build_py_path = join(self.config.arduino_libs_mcu, "pioarduino-build.py") - + build_py_path = str(Path(self.config.arduino_libs_mcu) / "pioarduino-build.py") + if not os.path.exists(build_py_path): self.logger.log_change("Build file not found") return - - # Check if BT/BLE dependencies exist in lib_deps + + # Check if BT/BLE dependencies exist in lib_deps (single check) bt_ble_protected = self._has_bt_ble_dependencies() if bt_ble_protected: self.logger.log_change("BT/BLE protection enabled") - + try: + # Read file once with open(build_py_path, 'r', encoding='utf-8') as f: content = f.read() - + original_content = content total_removed = 0 - - # Remove CPPPATH entries for each ignored library + + # Pre-filter libraries to process (avoid processing protected libraries) + libs_to_process = [] for lib_name in self.ignored_libs: - # Skip BT-related libraries if BT/BLE dependencies are present if bt_ble_protected and self._is_bt_related_library(lib_name): self.logger.log_change(f"Protected BT library: {lib_name}") continue - - # Hard protection for DSP components - if lib_name.lower() in ['dsp', 'esp_dsp', 'dsps', 'fft2r', 'dsps_fft2r']: - self.logger.log_change(f"Protected DSP component: {lib_name}") - continue - - # Multiple patterns to catch different include formats - patterns = [ - rf'.*join\([^,]*,\s*"include",\s*"{re.escape(lib_name)}"[^)]*\),?\n', - rf'.*"include/{re.escape(lib_name)}"[^,\n]*,?\n', - rf'.*"[^"]*include[^"]*{re.escape(lib_name)}[^"]*"[^,\n]*,?\n', - rf'.*"[^"]*/{re.escape(lib_name)}/include[^"]*"[^,\n]*,?\n', - rf'.*"[^"]*{re.escape(lib_name)}[^"]*include[^"]*"[^,\n]*,?\n', - rf'.*join\([^)]*"include"[^)]*"{re.escape(lib_name)}"[^)]*\),?\n', - rf'.*"{re.escape(lib_name)}/include"[^,\n]*,?\n', - rf'\s*"[^"]*/{re.escape(lib_name)}/[^"]*",?\n' - ] - - removed_count = 0 - for pattern in patterns: - matches = re.findall(pattern, content) - if matches: - content = re.sub(pattern, '', content) - removed_count += len(matches) - - if removed_count > 0: - self.logger.log_change(f"Ignored library: {lib_name} ({removed_count} entries)") - total_removed += removed_count - - # Clean up empty lines and trailing commas - content = re.sub(r'\n\s*\n', '\n', content) - content = re.sub(r',\s*\n\s*\]', '\n]', content) - - # Validate and write changes - if self._validate_changes(original_content, content) and content != original_content: - with open(build_py_path, 'w', encoding='utf-8') as f: - f.write(content) - self.logger.log_change(f"Updated build file ({total_removed} total removals)") - - except (IOError, OSError) as e: - self.logger.log_change(f"Error processing libraries: {str(e)}") + libs_to_process.append(lib_name) + + # Batch process all libraries using compiled patterns + if libs_to_process: + content, total_removed = self._batch_remove_patterns(content, libs_to_process) + + # Clean up content once at the end + if total_removed > 0: + content = self._cleanup_content(content) + + # Validate and write changes + if self._validate_changes(original_content, content): + with open(build_py_path, 'w', encoding='utf-8') as f: + f.write(content) + self.logger.log_change(f"Updated build file ({total_removed} total removals)") + except Exception as e: - self.logger.log_change(f"Unexpected error processing libraries: {str(e)}") - + self.logger.log_change(f"Error processing libraries: {e!s} ({e.__class__.__name__})") + + def _batch_remove_patterns(self, content: str, libs_to_process: List[str]) -> Tuple[str, int]: + """ + Process all libraries in batches using compiled patterns for optimal performance. + + Args: + content: File content to process + libs_to_process: List of library names to remove + + Returns: + Tuple of (modified_content, total_removed_count) + """ + total_removed = 0 + + for lib_name in libs_to_process: + patterns = self._get_compiled_patterns(lib_name) + removed_count = 0 + + for pattern in patterns: + matches = pattern.findall(content) + if matches: + content = pattern.sub('', content) + removed_count += len(matches) + + if removed_count > 0: + self.logger.log_change(f"Ignored library: {lib_name} ({removed_count} entries)") + total_removed += removed_count + + return content, total_removed + + def _cleanup_content(self, content: str) -> str: + """ + Optimized content cleanup using compiled patterns. + + Args: + content: Content to clean up + + Returns: + Cleaned content + """ + cleanup_patterns = self._get_cleanup_patterns() + content = cleanup_patterns[0].sub('\n', content) + content = cleanup_patterns[1].sub('\n]', content) + return content + def _validate_changes(self, original_content: str, new_content: str) -> bool: """ - Validate that the changes are reasonable and safe. - - Performs sanity checks on the modified content to ensure that - the changes don't remove too much content or create invalid - modifications that could break the build process. - + Validate that changes are safe and don't break the build file structure. + Args: - original_content: Original file content before modifications - new_content: Modified file content after processing - + original_content: Original file content + new_content: Modified file content + Returns: - True if changes are within acceptable limits and safe to apply + True if changes are safe to apply """ - original_lines = len(original_content.splitlines()) - new_lines = len(new_content.splitlines()) - removed_lines = original_lines - new_lines - - # Don't allow removing more than 50% of the file or negative changes - return not (removed_lines > original_lines * 0.5 or removed_lines < 0) - + # Basic validation - ensure we haven't broken basic Python syntax + if new_content != original_content: + # Check that we still have essential structure elements + essential_elements = ['CPPPATH', 'env.Append', '[', ']'] + return all(element in new_content for element in essential_elements) + return True + def _backup_pioarduino_build_py(self) -> None: """ Create backup of the original pioarduino-build.py file. - - Creates a backup copy of the Arduino build script before making - modifications. Only operates when Arduino framework is active - and uses MCU-specific backup naming to avoid conflicts. + + Creates a backup of the Arduino framework's build script before + making modifications. Only operates when Arduino framework is active + and creates MCU-specific backup names to avoid conflicts. """ if "arduino" not in self.config.env.subst("$PIOFRAMEWORK"): return - - build_py_path = join(self.config.arduino_libs_mcu, "pioarduino-build.py") - backup_path = join(self.config.arduino_libs_mcu, f"pioarduino-build.py.{self.config.mcu}") - + + if not self.config.arduino_libs_mcu: + return + + build_py_path = str(Path(self.config.arduino_libs_mcu) / "pioarduino-build.py") + backup_path = str(Path(self.config.arduino_libs_mcu) / f"pioarduino-build.py.{self.config.mcu}") + if os.path.exists(build_py_path) and not os.path.exists(backup_path): shutil.copy2(build_py_path, backup_path) @@ -1002,52 +1130,52 @@ class BackupManager: framework build scripts, ensuring that original files can be restored when needed or when builds are cleaned. """ - + def __init__(self, config: ComponentManagerConfig): """ Initialize the backup manager with configuration access. - + Sets up the backup manager with access to configuration paths and settings needed for backup and restore operations. - + Args: config: Configuration manager instance providing access to paths """ self.config = config - + def backup_pioarduino_build_py(self) -> None: """ Create backup of the original pioarduino-build.py file. - + Creates a backup copy of the Arduino framework's build script with MCU-specific naming to prevent conflicts between different ESP32 variants. Only creates backup if it doesn't already exist. """ if "arduino" not in self.config.env.subst("$PIOFRAMEWORK"): return - - build_py_path = join(self.config.arduino_libs_mcu, "pioarduino-build.py") - backup_path = join(self.config.arduino_libs_mcu, f"pioarduino-build.py.{self.config.mcu}") - + + build_py_path = str(Path(self.config.arduino_libs_mcu) / "pioarduino-build.py") + backup_path = str(Path(self.config.arduino_libs_mcu) / f"pioarduino-build.py.{self.config.mcu}") + if os.path.exists(build_py_path) and not os.path.exists(backup_path): shutil.copy2(build_py_path, backup_path) - + def restore_pioarduino_build_py(self, target=None, source=None, env=None) -> None: """ Restore the original pioarduino-build.py from backup. - + Restores the original Arduino build script from the backup copy and removes the backup file. This is typically called during clean operations or when resetting the build environment. - + Args: target: Build target (unused, for PlatformIO compatibility) source: Build source (unused, for PlatformIO compatibility) env: Environment (unused, for PlatformIO compatibility) """ - build_py_path = join(self.config.arduino_libs_mcu, "pioarduino-build.py") - backup_path = join(self.config.arduino_libs_mcu, f"pioarduino-build.py.{self.config.mcu}") - + build_py_path = str(Path(self.config.arduino_libs_mcu) / "pioarduino-build.py") + backup_path = str(Path(self.config.arduino_libs_mcu) / f"pioarduino-build.py.{self.config.mcu}") + if os.path.exists(backup_path): shutil.copy2(backup_path, build_py_path) os.remove(backup_path) @@ -1056,21 +1184,21 @@ class BackupManager: class ComponentManager: """ Main component manager that orchestrates all operations. - + Primary interface for component management operations, coordinating between specialized handlers for components, libraries, and backups. Uses composition pattern to organize functionality into focused classes. """ - + def __init__(self, env): """ Initialize the ComponentManager with composition pattern. - + Creates and configures all specialized handler instances using the composition pattern for better separation of concerns and maintainability. Each handler focuses on a specific aspect of component management. - + Args: env: PlatformIO environment object containing project configuration """ @@ -1079,66 +1207,66 @@ class ComponentManager: self.component_handler = ComponentHandler(self.config, self.logger) self.library_handler = LibraryIgnoreHandler(self.config, self.logger) self.backup_manager = BackupManager(self.config) - + def handle_component_settings(self, add_components: bool = False, remove_components: bool = False) -> None: """ Handle component operations by delegating to specialized handlers. - + Main entry point for component management operations. Coordinates component addition/removal and library ignore processing, then provides a summary of all changes made during the session. - + Args: add_components: Whether to process component additions from configuration remove_components: Whether to process component removals from configuration """ self.component_handler.handle_component_settings(add_components, remove_components) self.library_handler.handle_lib_ignore() - + # Print summary changes = self.logger.get_changes_summary() if changes: self.logger.log_change(f"Session completed with {len(changes)} changes") - + def handle_lib_ignore(self) -> None: """ Delegate lib_ignore handling to specialized handler. - + Provides direct access to library ignore processing for cases where only library handling is needed without component operations. """ self.library_handler.handle_lib_ignore() - + def restore_pioarduino_build_py(self, target=None, source=None, env=None) -> None: """ Delegate backup restoration to backup manager. - + Provides access to backup restoration functionality, typically used during clean operations or build environment resets. - + Args: target: Build target (unused, for PlatformIO compatibility) source: Build source (unused, for PlatformIO compatibility) env: Environment (unused, for PlatformIO compatibility) """ self.backup_manager.restore_pioarduino_build_py(target, source, env) - + def get_changes_summary(self) -> List[str]: """ Get summary of changes from logger. - + Provides access to the complete list of changes made during the current session for reporting or debugging purposes. - + Returns: List of change messages in chronological order """ return self.logger.get_changes_summary() - + def print_changes_summary(self) -> None: """ Print changes summary via logger. - + Outputs a formatted summary of all changes made during the session, useful for build reporting and debugging. """ diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index 43ab386..dffaa2c 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -21,6 +21,7 @@ https://github.com/espressif/esp-idf """ import copy +import importlib.util import json import subprocess import sys @@ -30,6 +31,8 @@ from os.path import join import re import requests import platform as sys_platform +from pathlib import Path +from urllib.parse import urlsplit, unquote import click import semantic_version @@ -44,22 +47,34 @@ from platformio import fs from platformio.compat import IS_WINDOWS from platformio.proc import exec_command from platformio.builder.tools.piolib import ProjectAsLibBuilder -from platformio.project.config import ProjectConfig from platformio.package.version import get_original_version, pepver_to_semver env = DefaultEnvironment() env.SConscript("_embed_files.py", exports="env") +platform = env.PioPlatform() + +_component_manager_file = Path(platform.get_dir()) / "builder" / "frameworks" / "component_manager.py" +_cm_spec = importlib.util.spec_from_file_location("component_manager", _component_manager_file) +_component_manager = importlib.util.module_from_spec(_cm_spec) +_cm_spec.loader.exec_module(_component_manager) +sys.modules["component_manager"] = _component_manager + +_penv_setup_file = str(Path(platform.get_dir()) / "builder" / "penv_setup.py") +_spec = importlib.util.spec_from_file_location("penv_setup", _penv_setup_file) +_penv_setup = importlib.util.module_from_spec(_spec) +_spec.loader.exec_module(_penv_setup) # type: ignore[attr-defined] +sys.modules["penv_setup"] = _penv_setup +get_executable_path = _penv_setup.get_executable_path # remove maybe existing old map file in project root -map_file = os.path.join(env.subst("$PROJECT_DIR"), env.subst("$PROGNAME") + ".map") +map_file = str(Path(env.subst("$PROJECT_DIR")) / (env.subst("$PROGNAME") + ".map")) if os.path.exists(map_file): os.remove(map_file) # Allow changes in folders of managed components os.environ["IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS"] = "1" -platform = env.PioPlatform() config = env.GetProjectConfig() board = env.BoardConfig() mcu = board.get("build.mcu", "esp32") @@ -71,22 +86,24 @@ flag_custom_sdkonfig = False flag_custom_component_add = False flag_custom_component_remove = False -IDF5 = ( - platform.get_package_version("framework-espidf") - .split(".")[1] - .startswith("5") -) IDF_ENV_VERSION = "1.0.0" -FRAMEWORK_DIR = platform.get_package_dir("framework-espidf") +_framework_pkg_dir = platform.get_package_dir("framework-espidf") +if not _framework_pkg_dir or not os.path.isdir(_framework_pkg_dir): + sys.stderr.write(f"Error: Missing framework directory '{_framework_pkg_dir}'\n") + env.Exit(1) +FRAMEWORK_DIR_PATH = Path(_framework_pkg_dir).resolve() +FRAMEWORK_DIR = str(FRAMEWORK_DIR_PATH) TOOLCHAIN_DIR = platform.get_package_dir( "toolchain-xtensa-esp-elf" if mcu in ("esp32", "esp32s2", "esp32s3") else "toolchain-riscv32-esp" ) +PLATFORMIO_DIR = env.subst("$PROJECT_CORE_DIR") +if not TOOLCHAIN_DIR or not os.path.isdir(TOOLCHAIN_DIR): + sys.stderr.write(f"Error: Missing toolchain directory '{TOOLCHAIN_DIR}'\n") + env.Exit(1) -assert os.path.isdir(FRAMEWORK_DIR) -assert os.path.isdir(TOOLCHAIN_DIR) def create_silent_action(action_func): """Create a silent SCons action that suppresses output""" @@ -95,44 +112,58 @@ def create_silent_action(action_func): return silent_action if "arduino" in env.subst("$PIOFRAMEWORK"): - ARDUINO_FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32") - ARDUINO_FRMWRK_LIB_DIR = platform.get_package_dir("framework-arduinoespressif32-libs") + _arduino_pkg_dir = platform.get_package_dir("framework-arduinoespressif32") + if not _arduino_pkg_dir or not os.path.isdir(_arduino_pkg_dir): + sys.stderr.write(f"Error: Missing Arduino framework directory '{_arduino_pkg_dir}'\n") + env.Exit(1) + arduino_pkg_dir = Path(_arduino_pkg_dir) + if "@" in arduino_pkg_dir.name: + new_dir = arduino_pkg_dir.with_name(arduino_pkg_dir.name.replace("@", "-")) + if new_dir.exists(): + arduino_pkg_dir = new_dir + else: + os.rename(str(arduino_pkg_dir), str(new_dir)) + arduino_pkg_dir = new_dir + ARDUINO_FRAMEWORK_DIR_PATH = arduino_pkg_dir.resolve() + ARDUINO_FRAMEWORK_DIR = str(ARDUINO_FRAMEWORK_DIR_PATH) + if not ARDUINO_FRAMEWORK_DIR or not os.path.isdir(ARDUINO_FRAMEWORK_DIR): + sys.stderr.write(f"Error: Arduino framework directory not found: {ARDUINO_FRAMEWORK_DIR}\n") + env.Exit(1) + + _arduino_lib_dir = platform.get_package_dir("framework-arduinoespressif32-libs") + if not _arduino_lib_dir: + sys.stderr.write("Error: Missing framework-arduinoespressif32-libs package\n") + env.Exit(1) + arduino_lib_dir = Path(_arduino_lib_dir) + ARDUINO_FRMWRK_LIB_DIR_PATH = arduino_lib_dir.resolve() + ARDUINO_FRMWRK_LIB_DIR = str(ARDUINO_FRMWRK_LIB_DIR_PATH) + if mcu == "esp32c2": - ARDUINO_FRMWRK_C2_LIB_DIR = join(ARDUINO_FRMWRK_LIB_DIR, mcu) + ARDUINO_FRMWRK_C2_LIB_DIR = str(ARDUINO_FRMWRK_LIB_DIR_PATH / mcu) if not os.path.exists(ARDUINO_FRMWRK_C2_LIB_DIR): - ARDUINO_C2_DIR = join(platform.get_package_dir("framework-arduino-c2-skeleton-lib"),mcu) + _arduino_c2_dir = platform.get_package_dir("framework-arduino-c2-skeleton-lib") + if not _arduino_c2_dir: + sys.stderr.write("Error: Missing framework-arduino-c2-skeleton-lib package\n") + env.Exit(1) + arduino_c2_dir = Path(_arduino_c2_dir) + ARDUINO_C2_DIR = str(arduino_c2_dir / mcu) shutil.copytree(ARDUINO_C2_DIR, ARDUINO_FRMWRK_C2_LIB_DIR, dirs_exist_ok=True) - # Possible package names in 'package@version' format is not compatible with CMake - if "@" in os.path.basename(ARDUINO_FRAMEWORK_DIR): - new_path = os.path.join( - os.path.dirname(ARDUINO_FRAMEWORK_DIR), - os.path.basename(ARDUINO_FRAMEWORK_DIR).replace("@", "-"), - ) - os.rename(ARDUINO_FRAMEWORK_DIR, new_path) - ARDUINO_FRAMEWORK_DIR = new_path - assert ARDUINO_FRAMEWORK_DIR and os.path.isdir(ARDUINO_FRAMEWORK_DIR) - arduino_libs_mcu = join(platform.get_package_dir("framework-arduinoespressif32-libs"), mcu) + arduino_libs_mcu = str(ARDUINO_FRMWRK_LIB_DIR_PATH / mcu) BUILD_DIR = env.subst("$BUILD_DIR") PROJECT_DIR = env.subst("$PROJECT_DIR") PROJECT_SRC_DIR = env.subst("$PROJECT_SRC_DIR") -CMAKE_API_REPLY_PATH = os.path.join(".cmake", "api", "v1", "reply") +CMAKE_API_REPLY_PATH = str(Path(".cmake") / "api" / "v1" / "reply") SDKCONFIG_PATH = os.path.expandvars(board.get( "build.esp-idf.sdkconfig_path", - os.path.join(PROJECT_DIR, "sdkconfig.%s" % env.subst("$PIOENV")), + str(Path(PROJECT_DIR) / ("sdkconfig.%s" % env.subst("$PIOENV"))), )) def contains_path_traversal(url): - """Check for Path Traversal patterns""" - dangerous_patterns = [ - '../', '..\\', # Standard Path Traversal - '%2e%2e%2f', '%2e%2e%5c', # URL-encoded - '..%2f', '..%5c', # Mixed - '%252e%252e%252f', # Double encoded - ] - - url_lower = url.lower() - return any(pattern in url_lower for pattern in dangerous_patterns) + """Best-effort detection of path traversal sequences.""" + path = unquote(unquote(urlsplit(url).path)).replace("\\", "/") + parts = [p for p in path.split("/") if p not in ("", ".")] + return any(p == ".." for p in parts) # # generate modified Arduino IDF sdkconfig, applying settings from "custom_sdkconfig" @@ -185,8 +216,12 @@ def HandleArduinoIDFsettings(env): # Handle local files if "file://" in file_entry: file_ref = file_entry[7:] if file_entry.startswith("file://") else file_entry - filename = os.path.basename(file_ref) - file_path = join(PROJECT_DIR, filename) + + if os.path.isabs(file_ref): + file_path = file_ref + else: + # if it's a relative path, try relative to PROJECT_DIR + file_path = str(Path(PROJECT_DIR) / file_ref) if os.path.exists(file_path): try: with open(file_path, 'r') as f: @@ -257,8 +292,11 @@ def HandleArduinoIDFsettings(env): print("Error: Arduino framework required for sdkconfig processing") return """Write the final sdkconfig.defaults file with checksum.""" - sdkconfig_src = join(arduino_libs_mcu, "sdkconfig") - sdkconfig_dst = join(PROJECT_DIR, "sdkconfig.defaults") + sdkconfig_src = str(Path(arduino_libs_mcu) / "sdkconfig") + sdkconfig_dst = str(Path(PROJECT_DIR) / "sdkconfig.defaults") + if not os.path.isfile(sdkconfig_src): + sys.stderr.write(f"Error: Missing Arduino sdkconfig template at '{sdkconfig_src}'\n") + env.Exit(1) # Generate checksum for validation (maintains original logic) checksum = get_MD5_hash(checksum_source.strip() + mcu) @@ -267,8 +305,6 @@ def HandleArduinoIDFsettings(env): # Write checksum header (critical for compilation decision logic) dst.write(f"# TASMOTA__{checksum}\n") - processed_flags = set() - # Process each line from source sdkconfig for line in src: flag_name = extract_flag_name(line) @@ -287,7 +323,6 @@ def HandleArduinoIDFsettings(env): dst.write(cleaned_flag + "\n") print(f"Replace: {line.strip()} with: {cleaned_flag}") idf_config_flags.remove(custom_flag) - processed_flags.add(custom_flag_name) flag_replaced = True break @@ -351,10 +386,10 @@ if "arduino" in env.subst("$PIOFRAMEWORK"): if flag_custom_sdkonfig == True and "arduino" in env.subst("$PIOFRAMEWORK") and "espidf" not in env.subst("$PIOFRAMEWORK"): HandleArduinoIDFsettings(env) - LIB_SOURCE = os.path.join(ProjectConfig.get_instance().get("platformio", "platforms_dir"), "espressif32", "builder", "build_lib") - if not bool(os.path.exists(os.path.join(PROJECT_DIR, ".dummy"))): - shutil.copytree(LIB_SOURCE, os.path.join(PROJECT_DIR, ".dummy")) - PROJECT_SRC_DIR = os.path.join(PROJECT_DIR, ".dummy") + LIB_SOURCE = str(Path(platform.get_dir()) / "builder" / "build_lib") + if not bool(os.path.exists(str(Path(PROJECT_DIR) / ".dummy"))): + shutil.copytree(LIB_SOURCE, str(Path(PROJECT_DIR) / ".dummy")) + PROJECT_SRC_DIR = str(Path(PROJECT_DIR) / ".dummy") env.Replace( PROJECT_SRC_DIR=PROJECT_SRC_DIR, BUILD_FLAGS="", @@ -382,15 +417,15 @@ def get_project_lib_includes(env): return paths def is_cmake_reconfigure_required(cmake_api_reply_dir): - cmake_cache_file = os.path.join(BUILD_DIR, "CMakeCache.txt") + cmake_cache_file = str(Path(BUILD_DIR) / "CMakeCache.txt") cmake_txt_files = [ - os.path.join(PROJECT_DIR, "CMakeLists.txt"), - os.path.join(PROJECT_SRC_DIR, "CMakeLists.txt"), + str(Path(PROJECT_DIR) / "CMakeLists.txt"), + str(Path(PROJECT_SRC_DIR) / "CMakeLists.txt"), ] - cmake_preconf_dir = os.path.join(BUILD_DIR, "config") - deafult_sdk_config = os.path.join(PROJECT_DIR, "sdkconfig.defaults") - idf_deps_lock = os.path.join(PROJECT_DIR, "dependencies.lock") - ninja_buildfile = os.path.join(BUILD_DIR, "build.ninja") + cmake_preconf_dir = str(Path(BUILD_DIR) / "config") + default_sdk_config = str(Path(PROJECT_DIR) / "sdkconfig.defaults") + idf_deps_lock = str(Path(PROJECT_DIR) / "dependencies.lock") + ninja_buildfile = str(Path(BUILD_DIR) / "build.ninja") for d in (cmake_api_reply_dir, cmake_preconf_dir): if not os.path.isdir(d) or not os.listdir(d): @@ -403,8 +438,8 @@ def is_cmake_reconfigure_required(cmake_api_reply_dir): SDKCONFIG_PATH ) > os.path.getmtime(cmake_cache_file): return True - if os.path.isfile(deafult_sdk_config) and os.path.getmtime( - deafult_sdk_config + if os.path.isfile(default_sdk_config) and os.path.getmtime( + default_sdk_config ) > os.path.getmtime(cmake_cache_file): return True if os.path.isfile(idf_deps_lock) and os.path.getmtime( @@ -424,8 +459,8 @@ def is_proper_idf_project(): return all( os.path.isfile(path) for path in ( - os.path.join(PROJECT_DIR, "CMakeLists.txt"), - os.path.join(PROJECT_SRC_DIR, "CMakeLists.txt"), + str(Path(PROJECT_DIR) / "CMakeLists.txt"), + str(Path(PROJECT_SRC_DIR) / "CMakeLists.txt"), ) ) @@ -444,6 +479,13 @@ def normalize_path(path): return fs.to_unix_path(path) +CMK_TOOL = platform.get_package_dir("tool-cmake") +if not CMK_TOOL or not os.path.isdir(CMK_TOOL): + sys.stderr.write(f"Error: Missing CMake package directory '{CMK_TOOL}'\n") + env.Exit(1) +CMAKE_DIR = str(Path(CMK_TOOL) / "bin" / "cmake") + + def create_default_project_files(): root_cmake_tpl = """cmake_minimum_required(VERSION 3.16.0) include($ENV{IDF_PATH}/tools/cmake/project.cmake) @@ -459,29 +501,29 @@ idf_component_register(SRCS ${app_sources}) if not os.listdir(PROJECT_SRC_DIR): # create a default main file to make CMake happy during first init - with open(os.path.join(PROJECT_SRC_DIR, "main.c"), "w") as fp: + with open(str(Path(PROJECT_SRC_DIR) / "main.c"), "w") as fp: fp.write("void app_main() {}") project_dir = PROJECT_DIR - if not os.path.isfile(os.path.join(project_dir, "CMakeLists.txt")): - with open(os.path.join(project_dir, "CMakeLists.txt"), "w") as fp: + if not os.path.isfile(str(Path(project_dir) / "CMakeLists.txt")): + with open(str(Path(project_dir) / "CMakeLists.txt"), "w") as fp: fp.write(root_cmake_tpl % os.path.basename(project_dir)) project_src_dir = PROJECT_SRC_DIR - if not os.path.isfile(os.path.join(project_src_dir, "CMakeLists.txt")): - with open(os.path.join(project_src_dir, "CMakeLists.txt"), "w") as fp: + if not os.path.isfile(str(Path(project_src_dir) / "CMakeLists.txt")): + with open(str(Path(project_src_dir) / "CMakeLists.txt"), "w") as fp: fp.write(prj_cmake_tpl % normalize_path(PROJECT_SRC_DIR)) def get_cmake_code_model(src_dir, build_dir, extra_args=None): - cmake_api_dir = os.path.join(build_dir, ".cmake", "api", "v1") - cmake_api_query_dir = os.path.join(cmake_api_dir, "query") - cmake_api_reply_dir = os.path.join(cmake_api_dir, "reply") - query_file = os.path.join(cmake_api_query_dir, "codemodel-v2") + cmake_api_dir = str(Path(build_dir) / ".cmake" / "api" / "v1") + cmake_api_query_dir = str(Path(cmake_api_dir) / "query") + cmake_api_reply_dir = str(Path(cmake_api_dir) / "reply") + query_file = str(Path(cmake_api_query_dir) / "codemodel-v2") if not os.path.isfile(query_file): - os.makedirs(os.path.dirname(query_file)) - open(query_file, "a").close() # create an empty file + Path(cmake_api_query_dir).mkdir(parents=True, exist_ok=True) + Path(query_file).touch() if not is_proper_idf_project(): create_default_project_files() @@ -496,35 +538,36 @@ def get_cmake_code_model(src_dir, build_dir, extra_args=None): codemodel = {} for target in os.listdir(cmake_api_reply_dir): if target.startswith("codemodel-v2"): - with open(os.path.join(cmake_api_reply_dir, target), "r") as fp: + with open(str(Path(cmake_api_reply_dir) / target), "r") as fp: codemodel = json.load(fp) + break - assert codemodel["version"]["major"] == 2 + if codemodel.get("version", {}).get("major") != 2: + sys.stderr.write("Error: Unsupported CMake codemodel version (need major=2)\n") + env.Exit(1) return codemodel def populate_idf_env_vars(idf_env): idf_env["IDF_PATH"] = fs.to_unix_path(FRAMEWORK_DIR) + NINJA_DIR = platform.get_package_dir("tool-ninja") + if not NINJA_DIR or not os.path.isdir(NINJA_DIR): + sys.stderr.write(f"Error: Missing ninja package directory '{NINJA_DIR}'\n") + env.Exit(1) additional_packages = [ - os.path.join(TOOLCHAIN_DIR, "bin"), - platform.get_package_dir("tool-ninja"), - os.path.join(platform.get_package_dir("tool-cmake"), "bin"), + str(Path(TOOLCHAIN_DIR) / "bin"), + NINJA_DIR, + CMAKE_DIR, os.path.dirname(get_python_exe()), ] - idf_env["PATH"] = os.pathsep.join(additional_packages + [idf_env["PATH"]]) - - # Some users reported that the `IDF_TOOLS_PATH` var can seep into the - # underlying build system. Unsetting it is a safe workaround. - if "IDF_TOOLS_PATH" in idf_env: - del idf_env["IDF_TOOLS_PATH"] - + idf_env["PATH"] = os.pathsep.join([*additional_packages, idf_env["PATH"]]) idf_env["ESP_ROM_ELF_DIR"] = platform.get_package_dir("tool-esp-rom-elfs") def get_target_config(project_configs, target_index, cmake_api_reply_dir): target_json = project_configs.get("targets")[target_index].get("jsonFile", "") - target_config_file = os.path.join(cmake_api_reply_dir, target_json) + target_config_file = str(Path(cmake_api_reply_dir) / target_json) if not os.path.isfile(target_config_file): sys.stderr.write("Error: Couldn't find target config %s\n" % target_json) env.Exit(1) @@ -552,12 +595,12 @@ def build_library( lib_name = lib_config["nameOnDisk"] lib_path = lib_config["paths"]["build"] if prepend_dir: - lib_path = os.path.join(prepend_dir, lib_path) + lib_path = str(Path(prepend_dir) / lib_path) lib_objects = compile_source_files( lib_config, default_env, project_src_dir, prepend_dir, debug_allowed ) return default_env.Library( - target=os.path.join("$BUILD_DIR", lib_path, lib_name), source=lib_objects + target=str(Path("$BUILD_DIR") / lib_path / lib_name), source=lib_objects ) @@ -649,7 +692,7 @@ def extract_link_args(target_config): if archive_path.startswith(".."): # Precompiled archives from project component _add_archive( - os.path.normpath(os.path.join(BUILD_DIR, archive_path)), + os.path.normpath(str(Path(BUILD_DIR) / archive_path)), link_args, ) else: @@ -706,14 +749,14 @@ def get_app_flags(app_config, default_config): def get_sdk_configuration(): - config_path = os.path.join(BUILD_DIR, "config", "sdkconfig.json") + config_path = str(Path(BUILD_DIR) / "config" / "sdkconfig.json") if not os.path.isfile(config_path): print('Warning: Could not find "sdkconfig.json" file\n') try: with open(config_path, "r") as fp: return json.load(fp) - except: + except (OSError, json.JSONDecodeError): return {} @@ -721,7 +764,7 @@ def load_component_paths(framework_components_dir, ignored_component_prefixes=No def _scan_components_from_framework(): result = [] for component in os.listdir(framework_components_dir): - component_path = os.path.join(framework_components_dir, component) + component_path = str(Path(framework_components_dir) / component) if component.startswith(ignored_component_prefixes) or not os.path.isdir( component_path ): @@ -733,20 +776,16 @@ def load_component_paths(framework_components_dir, ignored_component_prefixes=No # First of all, try to load the list of used components from the project description components = [] ignored_component_prefixes = ignored_component_prefixes or [] - project_description_file = os.path.join(BUILD_DIR, "project_description.json") + project_description_file = str(Path(BUILD_DIR) / "project_description.json") if os.path.isfile(project_description_file): with open(project_description_file) as fp: try: data = json.load(fp) for path in data.get("build_component_paths", []): - if not os.path.basename(path).startswith( - ignored_component_prefixes - ): + if not os.path.basename(path).startswith(ignored_component_prefixes): components.append(path) - except: - print( - "Warning: Could not find load components from project description!\n" - ) + except (OSError, ValueError) as e: + print(f"Warning: Could not load components from project description: {e}\n") return components or _scan_components_from_framework() @@ -759,7 +798,7 @@ def extract_linker_script_fragments_backup(framework_components_dir, sdk_config) result = [] for component_path in project_components: - linker_fragment = os.path.join(component_path, "linker.lf") + linker_fragment = str(Path(component_path) / "linker.lf") if os.path.isfile(linker_fragment): result.append(linker_fragment) @@ -768,29 +807,27 @@ def extract_linker_script_fragments_backup(framework_components_dir, sdk_config) env.Exit(1) if mcu not in ("esp32", "esp32s2", "esp32s3"): - result.append(os.path.join(framework_components_dir, "riscv", "linker.lf")) + result.append(str(Path(framework_components_dir) / "riscv" / "linker.lf")) # Add extra linker fragments for fragment in ( - os.path.join("esp_system", "app.lf"), - os.path.join("esp_common", "common.lf"), - os.path.join("esp_common", "soc.lf"), - os.path.join("newlib", "system_libs.lf"), - os.path.join("newlib", "newlib.lf"), + str(Path("esp_system") / "app.lf"), + str(Path("esp_common") / "common.lf"), + str(Path("esp_common") / "soc.lf"), + str(Path("newlib") / "system_libs.lf"), + str(Path("newlib") / "newlib.lf"), ): - result.append(os.path.join(framework_components_dir, fragment)) + result.append(str(Path(framework_components_dir) / fragment)) if sdk_config.get("SPIRAM_CACHE_WORKAROUND", False): result.append( - os.path.join( - framework_components_dir, "newlib", "esp32-spiram-rom-functions-c.lf" - ) + str(Path(framework_components_dir) / "newlib" / "esp32-spiram-rom-functions-c.lf") ) if board.get("build.esp-idf.extra_lf_files", ""): result.extend( [ - lf if os.path.isabs(lf) else os.path.join(PROJECT_DIR, lf) + lf if os.path.isabs(lf) else str(Path(PROJECT_DIR) / lf) for lf in board.get("build.esp-idf.extra_lf_files").splitlines() if lf.strip() ] @@ -805,16 +842,19 @@ def extract_linker_script_fragments( def _normalize_fragment_path(base_dir, fragment_path): if not os.path.isabs(fragment_path): fragment_path = os.path.abspath( - os.path.join(base_dir, fragment_path) + str(Path(base_dir) / fragment_path) ) if not os.path.isfile(fragment_path): print("Warning! The `%s` fragment is not found!" % fragment_path) return fragment_path - assert os.path.isfile( - ninja_buildfile - ), "Cannot extract linker fragments! Ninja build file is missing!" + if not os.path.isfile(ninja_buildfile): + sys.stderr.write( + "Error: Missing Ninja build file '%s' for linker fragment extraction\n" + % ninja_buildfile + ) + env.Exit(1) result = [] with open(ninja_buildfile, encoding="utf8") as fp: @@ -873,31 +913,27 @@ def create_custom_libraries_list(ldgen_libraries_file, ignore_targets): def generate_project_ld_script(sdk_config, ignore_targets=None): ignore_targets = ignore_targets or [] linker_script_fragments = extract_linker_script_fragments( - os.path.join(BUILD_DIR, "build.ninja"), - os.path.join(FRAMEWORK_DIR, "components"), + str(Path(BUILD_DIR) / "build.ninja"), + str(Path(FRAMEWORK_DIR) / "components"), sdk_config ) # Create a new file to avoid automatically generated library entry as files # from this library are built internally by PlatformIO libraries_list = create_custom_libraries_list( - os.path.join(BUILD_DIR, "ldgen_libraries"), ignore_targets + str(Path(BUILD_DIR) / "ldgen_libraries"), ignore_targets ) args = { - "script": os.path.join(FRAMEWORK_DIR, "tools", "ldgen", "ldgen.py"), + "script": str(Path(FRAMEWORK_DIR) / "tools" / "ldgen" / "ldgen.py"), "config": SDKCONFIG_PATH, "fragments": " ".join( ['"%s"' % fs.to_unix_path(f) for f in linker_script_fragments] ), - "kconfig": os.path.join(FRAMEWORK_DIR, "Kconfig"), - "env_file": os.path.join("$BUILD_DIR", "config.env"), + "kconfig": str(Path(FRAMEWORK_DIR) / "Kconfig"), + "env_file": str(Path("$BUILD_DIR") / "config.env"), "libraries_list": libraries_list, - "objdump": os.path.join( - TOOLCHAIN_DIR, - "bin", - env.subst("$CC").replace("-gcc", "-objdump"), - ), + "objdump": str(Path(TOOLCHAIN_DIR) / "bin" / env.subst("$CC").replace("-gcc", "-objdump")), } cmd = ( @@ -908,30 +944,17 @@ def generate_project_ld_script(sdk_config, ignore_targets=None): '--objdump "{objdump}"' ).format(**args) - initial_ld_script = os.path.join( - FRAMEWORK_DIR, - "components", - "esp_system", - "ld", - idf_variant, - "sections.ld.in", - ) + initial_ld_script = str(Path(FRAMEWORK_DIR) / "components" / "esp_system" / "ld" / idf_variant / "sections.ld.in") framework_version = [int(v) for v in get_framework_version().split(".")] if framework_version[:2] > [5, 2]: initial_ld_script = preprocess_linker_file( initial_ld_script, - os.path.join( - BUILD_DIR, - "esp-idf", - "esp_system", - "ld", - "sections.ld.in", - ) + str(Path(BUILD_DIR) / "esp-idf" / "esp_system" / "ld" / "sections.ld.in"), ) return env.Command( - os.path.join("$BUILD_DIR", "sections.ld"), + str(Path("$BUILD_DIR") / "sections.ld"), initial_ld_script, env.VerboseAction(cmd, "Generating project linker script $TARGET"), ) @@ -997,30 +1020,33 @@ def compile_source_files( ): build_envs = prepare_build_envs(config, default_env, debug_allowed) objects = [] - components_dir = fs.to_unix_path(os.path.join(FRAMEWORK_DIR, "components")) + # Canonical, symlink-resolved absolute path of the components directory + components_dir_path = (Path(FRAMEWORK_DIR) / "components").resolve() for source in config.get("sources", []): if source["path"].endswith(".rule"): continue compile_group_idx = source.get("compileGroupIndex") if compile_group_idx is not None: - src_dir = config["paths"]["source"] - if not os.path.isabs(src_dir): - src_dir = os.path.join(project_src_dir, config["paths"]["source"]) src_path = source.get("path") if not os.path.isabs(src_path): # For cases when sources are located near CMakeLists.txt - src_path = os.path.join(project_src_dir, src_path) + src_path = str(Path(project_src_dir) / src_path) - obj_path = os.path.join("$BUILD_DIR", prepend_dir or "") - if src_path.lower().startswith(components_dir.lower()): - obj_path = os.path.join( - obj_path, os.path.relpath(src_path, components_dir) - ) - else: - if not os.path.isabs(source["path"]): - obj_path = os.path.join(obj_path, source["path"]) - else: - obj_path = os.path.join(obj_path, os.path.basename(src_path)) + obj_path = str(Path("$BUILD_DIR") / (prepend_dir or "")) + src_path_obj = Path(src_path).resolve() + try: + rel = src_path_obj.relative_to(components_dir_path) + obj_path = str(Path(obj_path) / str(rel)) + except ValueError: + # Preserve project substructure when possible + try: + rel_prj = src_path_obj.relative_to(Path(project_src_dir).resolve()) + obj_path = str(Path(obj_path) / str(rel_prj)) + except ValueError: + if not os.path.isabs(source["path"]): + obj_path = str(Path(obj_path) / source["path"]) + else: + obj_path = str(Path(obj_path) / os.path.basename(src_path)) preserve_source_file_extension = board.get( "build.esp-idf.preserve_source_file_extension", "yes" @@ -1033,7 +1059,7 @@ def compile_source_files( if preserve_source_file_extension else os.path.splitext(obj_path)[0] ) + ".o", - source=os.path.realpath(src_path), + source=str(src_path_obj), ) ) @@ -1061,7 +1087,7 @@ def RunMenuconfig(target, source, env): rc = subprocess.call( [ - os.path.join(platform.get_package_dir("tool-cmake"), "bin", "cmake"), + CMAKE_DIR, "--build", BUILD_DIR, "--target", @@ -1077,7 +1103,7 @@ def RunMenuconfig(target, source, env): def run_cmake(src_dir, build_dir, extra_args=None): cmd = [ - os.path.join(platform.get_package_dir("tool-cmake") or "", "bin", "cmake"), + CMAKE_DIR, "-S", src_dir, "-B", @@ -1092,21 +1118,45 @@ def run_cmake(src_dir, build_dir, extra_args=None): run_tool(cmd) +def get_lib_ignore_components(): + """ + Get components to ignore from lib_ignore project option using component_manager. + This ensures consistency with the Arduino framework's lib_ignore handling. + """ + try: + # Create a LibraryIgnoreHandler instance to process lib_ignore + config = _component_manager.ComponentManagerConfig(env) + logger = _component_manager.ComponentLogger() + lib_handler = _component_manager.LibraryIgnoreHandler(config, logger) + + # Get the processed lib_ignore entries (already converted to component names) + lib_ignore_entries = lib_handler._get_lib_ignore_entries() + + return lib_ignore_entries + except (OSError, ValueError, RuntimeError, KeyError) as e: + print(f"[ESP-IDF] Warning: Could not process lib_ignore: {e}") + return [] + + def find_lib_deps(components_map, elf_config, link_args, ignore_components=None): ignore_components = ignore_components or [] - result = [ - components_map[d["id"]]["lib"] - for d in elf_config.get("dependencies", []) - if components_map.get(d["id"], {}) - and not d["id"].startswith(tuple(ignore_components)) - ] + ignore_set = set(ignore_components) + result = [] + for d in elf_config.get("dependencies", []): + comp = components_map.get(d["id"]) + if not comp: + continue + comp_name = comp["config"]["name"] + if comp_name in ignore_set: + continue + result.append(comp["lib"]) implicit_lib_deps = link_args.get("__LIB_DEPS", []) for component in components_map.values(): component_config = component["config"] if ( component_config["type"] not in ("STATIC_LIBRARY", "OBJECT_LIBRARY") - or component_config["name"] in ignore_components + or component_config["name"] in ignore_set ): continue if ( @@ -1119,12 +1169,10 @@ def find_lib_deps(components_map, elf_config, link_args, ignore_components=None) def build_bootloader(sdk_config): - bootloader_src_dir = os.path.join( - FRAMEWORK_DIR, "components", "bootloader", "subproject" - ) + bootloader_src_dir = str(Path(FRAMEWORK_DIR) / "components" / "bootloader" / "subproject") code_model = get_cmake_code_model( bootloader_src_dir, - os.path.join(BUILD_DIR, "bootloader"), + str(Path(BUILD_DIR) / "bootloader"), [ "-DIDF_TARGET=" + idf_variant, "-DPYTHON_DEPS_CHECKED=1", @@ -1133,8 +1181,7 @@ def build_bootloader(sdk_config): "-DSDKCONFIG=" + SDKCONFIG_PATH, "-DPROJECT_SOURCE_DIR=" + PROJECT_DIR, "-DLEGACY_INCLUDE_COMMON_HEADERS=", - "-DEXTRA_COMPONENT_DIRS=" - + os.path.join(FRAMEWORK_DIR, "components", "bootloader"), + "-DEXTRA_COMPONENT_DIRS=" + str(Path(FRAMEWORK_DIR) / "components" / "bootloader"), ], ) @@ -1144,7 +1191,7 @@ def build_bootloader(sdk_config): target_configs = load_target_configurations( code_model, - os.path.join(BUILD_DIR, "bootloader", ".cmake", "api", "v1", "reply"), + str(Path(BUILD_DIR) / "bootloader" / ".cmake" / "api" / "v1" / "reply"), ) elf_config = get_project_elf(target_configs) @@ -1184,9 +1231,9 @@ def build_bootloader(sdk_config): ) return bootloader_env.ElfToBin( - os.path.join("$BUILD_DIR", "bootloader"), + str(Path("$BUILD_DIR") / "bootloader"), bootloader_env.Program( - os.path.join("$BUILD_DIR", "bootloader.elf"), bootloader_libs + str(Path("$BUILD_DIR") / "bootloader.elf"), bootloader_libs ), ) @@ -1241,18 +1288,18 @@ def generate_default_component(): file(GLOB component_sources *.c* *.S) idf_component_register(SRCS ${component_sources}) """ - dummy_component_path = os.path.join(FRAMEWORK_DIR, "components", "__pio_env") + dummy_component_path = str(Path(FRAMEWORK_DIR) / "components" / "__pio_env") if os.path.isdir(dummy_component_path): return - os.makedirs(dummy_component_path) + os.makedirs(dummy_component_path, exist_ok=True) for ext in (".cpp", ".c", ".S"): - dummy_file = os.path.join(dummy_component_path, "__dummy" + ext) + dummy_file = str(Path(dummy_component_path) / ("__dummy" + ext)) if not os.path.isfile(dummy_file): open(dummy_file, "a").close() - component_cmake = os.path.join(dummy_component_path, "CMakeLists.txt") + component_cmake = str(Path(dummy_component_path) / "CMakeLists.txt") if not os.path.isfile(component_cmake): with open(component_cmake, "w") as fp: fp.write(prj_cmake_tpl) @@ -1273,9 +1320,7 @@ def find_default_component(target_configs): def get_framework_version(): def _extract_from_cmake_version_file(): - version_cmake_file = os.path.join( - FRAMEWORK_DIR, "tools", "cmake", "version.cmake" - ) + version_cmake_file = str(Path(FRAMEWORK_DIR) / "tools" / "cmake" / "version.cmake") if not os.path.isfile(version_cmake_file): return @@ -1299,7 +1344,7 @@ def get_framework_version(): def create_version_file(): - version_file = os.path.join(FRAMEWORK_DIR, "version.txt") + version_file = str(Path(FRAMEWORK_DIR) / "version.txt") if not os.path.isfile(version_file): with open(version_file, "w") as fp: fp.write(get_framework_version()) @@ -1312,12 +1357,7 @@ def generate_empty_partition_image(binary_path, image_size): env.VerboseAction( '"$ESPIDF_PYTHONEXE" "%s" %s $TARGET' % ( - os.path.join( - FRAMEWORK_DIR, - "components", - "partition_table", - "gen_empty_partition.py", - ), + str(Path(FRAMEWORK_DIR) / "components" / "partition_table" / "gen_empty_partition.py"), image_size, ), "Generating an empty partition $TARGET", @@ -1337,7 +1377,7 @@ def get_partition_info(pt_path, pt_offset, pt_params): cmd = [ get_python_exe(), - os.path.join(FRAMEWORK_DIR, "components", "partition_table", "parttool.py"), + str(Path(FRAMEWORK_DIR) / "components" / "partition_table" / "parttool.py"), "-q", "--partition-table-offset", hex(pt_offset), @@ -1349,7 +1389,7 @@ def get_partition_info(pt_path, pt_offset, pt_params): "offset", ] - if pt_params["name"] == "boot": + if pt_params.get("name") == "boot": cmd.append("--partition-boot-default") else: cmd.extend( @@ -1380,8 +1420,11 @@ def get_partition_info(pt_path, pt_offset, pt_params): def get_app_partition_offset(pt_table, pt_offset): # Get the default boot partition offset - app_params = get_partition_info(pt_table, pt_offset, {"name": "boot"}) - return app_params.get("offset", "0x10000") + ota_app_params = get_partition_info(pt_table, pt_offset, {"type": "app", "subtype": "ota_0"}) + if ota_app_params.get("offset"): + return ota_app_params["offset"] + factory_app_params = get_partition_info(pt_table, pt_offset, {"type": "app", "subtype": "factory"}) + return factory_app_params.get("offset", "0x10000") def preprocess_linker_file(src_ld_script, target_ld_script): @@ -1391,32 +1434,14 @@ def preprocess_linker_file(src_ld_script, target_ld_script): env.VerboseAction( " ".join( [ - os.path.join( - platform.get_package_dir("tool-cmake"), - "bin", - "cmake", - ), - "-DCC=%s" - % os.path.join( - TOOLCHAIN_DIR, - "bin", - "$CC", - ), + f'"{CMAKE_DIR}"', + f'-DCC="{str(Path(TOOLCHAIN_DIR) / "bin" / "$CC")}"', "-DSOURCE=$SOURCE", "-DTARGET=$TARGET", - "-DCONFIG_DIR=%s" % os.path.join(BUILD_DIR, "config"), - "-DLD_DIR=%s" - % os.path.join( - FRAMEWORK_DIR, "components", "esp_system", "ld" - ), + f'-DCONFIG_DIR="{str(Path(BUILD_DIR) / "config")}"', + f'-DLD_DIR="{str(Path(FRAMEWORK_DIR) / "components" / "esp_system" / "ld")}"', "-P", - os.path.join( - "$BUILD_DIR", - "esp-idf", - "esp_system", - "ld", - "linker_script_generator.cmake", - ), + f'"{str(Path("$BUILD_DIR") / "esp-idf" / "esp_system" / "ld" / "linker_script_generator.cmake")}"', ] ), "Generating LD script $TARGET", @@ -1425,25 +1450,23 @@ def preprocess_linker_file(src_ld_script, target_ld_script): def generate_mbedtls_bundle(sdk_config): - bundle_path = os.path.join("$BUILD_DIR", "x509_crt_bundle") + bundle_path = str(Path("$BUILD_DIR") / "x509_crt_bundle") if os.path.isfile(env.subst(bundle_path)): return - default_crt_dir = os.path.join( - FRAMEWORK_DIR, "components", "mbedtls", "esp_crt_bundle" - ) + default_crt_dir = str(Path(FRAMEWORK_DIR) / "components" / "mbedtls" / "esp_crt_bundle") - cmd = [get_python_exe(), os.path.join(default_crt_dir, "gen_crt_bundle.py")] + cmd = [get_python_exe(), str(Path(default_crt_dir) / "gen_crt_bundle.py")] crt_args = ["--input"] if sdk_config.get("MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL", False): - crt_args.append(os.path.join(default_crt_dir, "cacrt_all.pem")) - crt_args.append(os.path.join(default_crt_dir, "cacrt_local.pem")) + crt_args.append(str(Path(default_crt_dir) / "cacrt_all.pem")) + crt_args.append(str(Path(default_crt_dir) / "cacrt_local.pem")) elif sdk_config.get("MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN", False): - crt_args.append(os.path.join(default_crt_dir, "cacrt_all.pem")) - crt_args.append(os.path.join(default_crt_dir, "cacrt_local.pem")) + crt_args.append(str(Path(default_crt_dir) / "cacrt_all.pem")) + crt_args.append(str(Path(default_crt_dir) / "cacrt_local.pem")) cmd.extend( - ["--filter", os.path.join(default_crt_dir, "cmn_crt_authorities.csv")] + ["--filter", str(Path(default_crt_dir) / "cmn_crt_authorities.csv")] ) if sdk_config.get("MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE", False): @@ -1457,27 +1480,16 @@ def generate_mbedtls_bundle(sdk_config): # Use exec_command to change working directory exec_command(cmd + crt_args, cwd=BUILD_DIR) - bundle_path = os.path.join("$BUILD_DIR", "x509_crt_bundle") env.Execute( env.VerboseAction( " ".join( [ - os.path.join( - env.PioPlatform().get_package_dir("tool-cmake"), - "bin", - "cmake", - ), - "-DDATA_FILE=" + bundle_path, - "-DSOURCE_FILE=%s.S" % bundle_path, + f'"{CMAKE_DIR}"', + f'-DDATA_FILE="{bundle_path}"', + f'-DSOURCE_FILE="{bundle_path}.S"', "-DFILE_TYPE=BINARY", "-P", - os.path.join( - FRAMEWORK_DIR, - "tools", - "cmake", - "scripts", - "data_file_embed_asm.cmake", - ), + f'"{str(Path(FRAMEWORK_DIR) / "tools" / "cmake" / "scripts" / "data_file_embed_asm.cmake")}"', ] ), "Generating assembly for certificate bundle...", @@ -1485,12 +1497,18 @@ def generate_mbedtls_bundle(sdk_config): ) +def _get_uv_exe(): + return get_executable_path(str(Path(PLATFORMIO_DIR) / "penv"), "uv") + + def install_python_deps(): + UV_EXE = _get_uv_exe() + def _get_installed_uv_packages(python_exe_path): result = {} try: uv_output = subprocess.check_output([ - "uv", "pip", "list", "--python", python_exe_path, "--format=json" + UV_EXE, "pip", "list", "--python", python_exe_path, "--format=json" ]) packages = json.loads(uv_output) except (subprocess.CalledProcessError, json.JSONDecodeError, OSError) as e: @@ -1502,12 +1520,11 @@ def install_python_deps(): return result - skip_python_packages = os.path.join(FRAMEWORK_DIR, ".pio_skip_pypackages") + skip_python_packages = str(Path(FRAMEWORK_DIR) / ".pio_skip_pypackages") if os.path.isfile(skip_python_packages): return deps = { - "uv": ">=0.1.0", # https://github.com/platformio/platformio-core/issues/4614 "urllib3": "<2", # https://github.com/platformio/platform-espressif32/issues/635 @@ -1537,7 +1554,7 @@ def install_python_deps(): # Use uv to install packages in the specific Python environment env.Execute( env.VerboseAction( - f'uv pip install --python "{python_exe_path}" {packages_str}', + f'"{UV_EXE}" pip install --python "{python_exe_path}" {packages_str}', "Installing ESP-IDF's Python dependencies with uv", ) ) @@ -1546,7 +1563,7 @@ def install_python_deps(): # Install windows-curses in the IDF Python environment env.Execute( env.VerboseAction( - f'uv pip install --python "{python_exe_path}" windows-curses', + f'"{UV_EXE}" pip install --python "{python_exe_path}" windows-curses', "Installing windows-curses package with uv", ) ) @@ -1558,9 +1575,7 @@ def get_idf_venv_dir(): # as an IDF component requires a different version of the IDF package and # hence a different set of Python deps or their versions idf_version = get_framework_version() - return os.path.join( - env.subst("$PROJECT_CORE_DIR"), "penv", ".espidf-" + idf_version - ) + return str(Path(PLATFORMIO_DIR) / "penv" / f".espidf-{idf_version}") def ensure_python_venv_available(): @@ -1598,15 +1613,11 @@ def ensure_python_venv_available(): ) return True return False - except: + except (OSError, ValueError): return True def _create_venv(venv_dir): - pip_path = os.path.join( - venv_dir, - "Scripts" if IS_WINDOWS else "bin", - "pip" + (".exe" if IS_WINDOWS else ""), - ) + uv_path = _get_uv_exe() if os.path.isdir(venv_dir): try: @@ -1619,20 +1630,22 @@ def ensure_python_venv_available(): ) env.Exit(1) - # Use the built-in PlatformIO Python to create a standalone IDF virtual env + # Use uv to create a standalone IDF virtual env env.Execute( env.VerboseAction( - '"$PYTHONEXE" -m venv --clear "%s"' % venv_dir, - "Creating a new virtual environment for IDF Python dependencies", + '"%s" venv --clear --quiet --python "%s" "%s"' % (uv_path, env.subst("$PYTHONEXE"), venv_dir), + "Creating a new virtual environment for IDF Python dependencies using uv", ) ) - assert os.path.isfile( - pip_path - ), "Error: Failed to create a proper virtual environment. Missing the `pip` binary!" + # Verify that the venv was created successfully by checking for Python executable + python_path = get_executable_path(venv_dir, "python") + if not os.path.isfile(python_path): + sys.stderr.write("Error: Failed to create a proper virtual environment. Missing the Python executable!\n") + env.Exit(1) venv_dir = get_idf_venv_dir() - venv_data_file = os.path.join(venv_dir, "pio-idf-venv.json") + venv_data_file = str(Path(venv_dir) / "pio-idf-venv.json") if not os.path.isfile(venv_data_file) or _is_venv_outdated(venv_data_file): _create_venv(venv_dir) install_python_deps() @@ -1645,15 +1658,10 @@ def ensure_python_venv_available(): def get_python_exe(): - python_exe_path = os.path.join( - get_idf_venv_dir(), - "Scripts" if IS_WINDOWS else "bin", - "python" + (".exe" if IS_WINDOWS else ""), - ) - - assert os.path.isfile(python_exe_path), ( - "Error: Missing Python executable file `%s`" % python_exe_path - ) + python_exe_path = get_executable_path(get_idf_venv_dir(), "python") + if not os.path.isfile(python_exe_path): + sys.stderr.write("Error: Missing Python executable file `%s`\n" % python_exe_path) + env.Exit(1) return python_exe_path @@ -1680,34 +1688,21 @@ generate_default_component() # if not board.get("build.ldscript", ""): - initial_ld_script = board.get("build.esp-idf.ldscript", os.path.join( - FRAMEWORK_DIR, - "components", - "esp_system", - "ld", - idf_variant, - "memory.ld.in", - )) + initial_ld_script = board.get("build.esp-idf.ldscript", str(Path(FRAMEWORK_DIR) / "components" / "esp_system" / "ld" / idf_variant / "memory.ld.in")) framework_version = [int(v) for v in get_framework_version().split(".")] if framework_version[:2] > [5, 2]: initial_ld_script = preprocess_linker_file( initial_ld_script, - os.path.join( - BUILD_DIR, - "esp-idf", - "esp_system", - "ld", - "memory.ld.in", - ) + str(Path(BUILD_DIR) / "esp-idf" / "esp_system" / "ld" / "memory.ld.in") ) linker_script = env.Command( - os.path.join("$BUILD_DIR", "memory.ld"), + str(Path("$BUILD_DIR") / "memory.ld"), initial_ld_script, env.VerboseAction( '$CC -I"$BUILD_DIR/config" -I"%s" -C -P -x c -E $SOURCE -o $TARGET' - % os.path.join(FRAMEWORK_DIR, "components", "esp_system", "ld"), + % str(Path(FRAMEWORK_DIR) / "components" / "esp_system" / "ld"), "Generating LD script $TARGET", ), ) @@ -1739,12 +1734,6 @@ if env.subst("$SRC_FILTER"): ) ) -if os.path.isfile(os.path.join(PROJECT_SRC_DIR, "sdkconfig.h")): - print( - "Warning! Starting with ESP-IDF v4.0, new project structure is required: \n" - "https://docs.platformio.org/en/latest/frameworks/espidf.html#project-structure" - ) - # # Initial targets loading # @@ -1753,17 +1742,13 @@ if os.path.isfile(os.path.join(PROJECT_SRC_DIR, "sdkconfig.h")): # default 'src' folder we need to add this as an extra component. If there is no 'main' # folder CMake won't generate dependencies properly extra_components = [] -if PROJECT_SRC_DIR != os.path.join(PROJECT_DIR, "main"): - extra_components.append(PROJECT_SRC_DIR) +if PROJECT_SRC_DIR != str(Path(PROJECT_DIR) / "main"): + extra_components.append(str(Path(PROJECT_SRC_DIR).resolve())) if "arduino" in env.subst("$PIOFRAMEWORK"): - print( - "Warning! Arduino framework as an ESP-IDF component doesn't handle " - "the `variant` field! The default `esp32` variant will be used." - ) extra_components.append(ARDUINO_FRAMEWORK_DIR) # Add path to internal Arduino libraries so that the LDF will be able to find them env.Append( - LIBSOURCE_DIRS=[os.path.join(ARDUINO_FRAMEWORK_DIR, "libraries")] + LIBSOURCE_DIRS=[str(Path(ARDUINO_FRAMEWORK_DIR) / "libraries")] ) # Set ESP-IDF version environment variables (needed for proper Kconfig processing) @@ -1775,7 +1760,7 @@ os.environ["ESP_IDF_VERSION"] = major_version extra_cmake_args = [ "-DIDF_TARGET=" + idf_variant, "-DPYTHON_DEPS_CHECKED=1", - "-DEXTRA_COMPONENT_DIRS:PATH=" + ";".join(extra_components), + "-DEXTRA_COMPONENT_DIRS:PATH=" + ";".join(str(Path(p).resolve()) for p in extra_components), "-DPYTHON=" + get_python_exe(), "-DSDKCONFIG=" + SDKCONFIG_PATH, f"-DESP_IDF_VERSION={major_version}", @@ -1785,7 +1770,7 @@ extra_cmake_args = [ # This will add the linker flag for the map file extra_cmake_args.append( - f'-DCMAKE_EXE_LINKER_FLAGS=-Wl,-Map={fs.to_unix_path(os.path.join(BUILD_DIR, env.subst("$PROGNAME") + ".map"))}' + f'-DCMAKE_EXE_LINKER_FLAGS=-Wl,-Map={fs.to_unix_path(str(Path(BUILD_DIR) / (env.subst("$PROGNAME") + ".map")))}' ) # Add any extra args from board config @@ -1799,16 +1784,16 @@ project_codemodel = get_cmake_code_model( ) # At this point the sdkconfig file should be generated by the underlying build system -assert os.path.isfile(SDKCONFIG_PATH), ( - "Missing auto-generated SDK configuration file `%s`" % SDKCONFIG_PATH -) +if not os.path.isfile(SDKCONFIG_PATH): + sys.stderr.write("Missing auto-generated SDK configuration file `%s`\n" % SDKCONFIG_PATH) + env.Exit(1) if not project_codemodel: sys.stderr.write("Error: Couldn't find code model generated by CMake\n") env.Exit(1) target_configs = load_target_configurations( - project_codemodel, os.path.join(BUILD_DIR, CMAKE_API_REPLY_PATH) + project_codemodel, str(Path(BUILD_DIR) / CMAKE_API_REPLY_PATH) ) sdk_config = get_sdk_configuration() @@ -1828,10 +1813,10 @@ if project_target_name != "__idf_main" and "__idf_main" in target_configs: ) env.Exit(1) -project_ld_scipt = generate_project_ld_script( +project_ld_script = generate_project_ld_script( sdk_config, [project_target_name, "__pio_env"] ) -env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", project_ld_scipt) +env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", project_ld_script) elf_config = get_project_elf(target_configs) default_config_name = find_default_component(target_configs) @@ -1848,7 +1833,7 @@ if not elf_config: env.Exit(1) for component_config in framework_components_map.values(): - env.Depends(project_ld_scipt, component_config["lib"]) + env.Depends(project_ld_script, component_config["lib"]) project_config = target_configs.get(project_target_name, {}) default_config = target_configs.get(default_config_name, {}) @@ -1879,8 +1864,14 @@ env.AddPlatformTarget( # Process main parts of the framework # +# Get components to ignore from lib_ignore option +lib_ignore_components = get_lib_ignore_components() +if lib_ignore_components: + print(f"[ESP-IDF] Ignoring components based on lib_ignore: {', '.join(lib_ignore_components)}") +ignore_components_list = [project_target_name, *lib_ignore_components] + libs = find_lib_deps( - framework_components_map, elf_config, link_args, [project_target_name] + framework_components_map, elf_config, link_args, ignore_components_list ) # Extra flags which need to be explicitly specified in LINKFLAGS section because SCons @@ -1903,7 +1894,7 @@ try: ld_index = extra_flags.index("memory.ld") extra_flags.pop(ld_index) extra_flags.pop(ld_index - 1) -except: +except (ValueError, IndexError): print("Warning! Couldn't find the main linker script in the CMake code model.") # @@ -1914,9 +1905,14 @@ except: # Remove project source files from following build stages as they're # built as part of the framework def _skip_prj_source_files(node): - if node.srcnode().get_path().lower().startswith(PROJECT_SRC_DIR.lower()): + project_src_resolved = Path(PROJECT_SRC_DIR).resolve() + node_path_resolved = Path(node.srcnode().get_path()).resolve() + try: + node_path_resolved.relative_to(project_src_resolved) + except ValueError: + return node + else: return None - return node env.AddBuildMiddleware(_skip_prj_source_files) @@ -1925,27 +1921,25 @@ env.AddBuildMiddleware(_skip_prj_source_files) # Generate partition table # -fwpartitions_dir = os.path.join(FRAMEWORK_DIR, "components", "partition_table") +fwpartitions_dir = str(Path(FRAMEWORK_DIR) / "components" / "partition_table") partitions_csv = board.get("build.partitions", "partitions_singleapp.csv") partition_table_offset = sdk_config.get("PARTITION_TABLE_OFFSET", 0x8000) env.Replace( PARTITIONS_TABLE_CSV=os.path.abspath( - os.path.join(fwpartitions_dir, partitions_csv) - if os.path.isfile(os.path.join(fwpartitions_dir, partitions_csv)) + str(Path(fwpartitions_dir) / partitions_csv) + if os.path.isfile(str(Path(fwpartitions_dir) / partitions_csv)) else partitions_csv ) ) partition_table = env.Command( - os.path.join("$BUILD_DIR", "partitions.bin"), + str(Path("$BUILD_DIR") / "partitions.bin"), "$PARTITIONS_TABLE_CSV", env.VerboseAction( '"$ESPIDF_PYTHONEXE" "%s" -q --offset "%s" --flash-size "%s" $SOURCE $TARGET' % ( - os.path.join( - FRAMEWORK_DIR, "components", "partition_table", "gen_esp32part.py" - ), + str(Path(FRAMEWORK_DIR) / "components" / "partition_table" / "gen_esp32part.py"), partition_table_offset, board.get("upload.flash_size", "4MB"), ), @@ -1973,11 +1967,11 @@ env.Prepend( "upload.bootloader_offset", "0x1000" if mcu in ["esp32", "esp32s2"] else ("0x2000" if mcu in ["esp32c5", "esp32p4"] else "0x0"), ), - os.path.join("$BUILD_DIR", "bootloader.bin"), + str(Path("$BUILD_DIR") / "bootloader.bin"), ), ( board.get("upload.partition_table_offset", hex(partition_table_offset)), - os.path.join("$BUILD_DIR", "partitions.bin"), + str(Path("$BUILD_DIR") / "partitions.bin"), ), ], ) @@ -1987,19 +1981,12 @@ env.Prepend( # if "arduino" in env.subst("$PIOFRAMEWORK"): - arduino_config_name = list( - filter( - lambda config_name: config_name.startswith( - "__idf_framework-arduinoespressif32" - ), - target_configs, - ) - )[0] - env.AppendUnique( - CPPDEFINES=extract_defines( - target_configs.get(arduino_config_name, {}).get("compileGroups", [])[0] - ) - ) + arduino_candidates = [n for n in target_configs if n.startswith("__idf_framework-arduinoespressif32")] + if arduino_candidates: + arduino_cfg = target_configs.get(arduino_candidates[0], {}) + cg_list = arduino_cfg.get("compileGroups", []) + if cg_list: + env.AppendUnique(CPPDEFINES=extract_defines(cg_list[0])) # Project files should be compiled only when a special # option is enabled when running 'test' command @@ -2090,7 +2077,7 @@ env["BUILDERS"]["ElfToBin"].action = action # Compile ULP sources in 'ulp' folder # -ulp_dir = os.path.join(PROJECT_DIR, "ulp") +ulp_dir = str(Path(PROJECT_DIR) / "ulp") if os.path.isdir(ulp_dir) and os.listdir(ulp_dir) and mcu not in ("esp32c2", "esp32c3", "esp32h2"): env.SConscript("ulp.py", exports="env sdk_config project_config app_includes idf_variant") @@ -2100,44 +2087,61 @@ if os.path.isdir(ulp_dir) and os.listdir(ulp_dir) and mcu not in ("esp32c2", "es if ("arduino" in env.subst("$PIOFRAMEWORK")) and ("espidf" not in env.subst("$PIOFRAMEWORK")): def idf_lib_copy(source, target, env): - env_build = join(env["PROJECT_BUILD_DIR"],env["PIOENV"]) - sdkconfig_h_path = join(env_build,"config","sdkconfig.h") - arduino_libs = ARDUINO_FRMWRK_LIB_DIR - lib_src = join(env_build,"esp-idf") - lib_dst = join(arduino_libs,mcu,"lib") - ld_dst = join(arduino_libs,mcu,"ld") - mem_var = join(arduino_libs,mcu,board.get("build.arduino.memory_type", (board.get("build.flash_mode", "dio") + "_qspi"))) - src = [join(lib_src,x) for x in os.listdir(lib_src)] + def _replace_move(src, dst): + dst_p = Path(dst) + dst_p.parent.mkdir(parents=True, exist_ok=True) + try: + os.remove(dst) + except FileNotFoundError: + pass + try: + os.replace(src, dst) + except OSError: + shutil.move(src, dst) + env_build = str(Path(env["PROJECT_BUILD_DIR"]) / env["PIOENV"]) + sdkconfig_h_path = str(Path(env_build) / "config" / "sdkconfig.h") + arduino_libs = str(Path(ARDUINO_FRMWRK_LIB_DIR)) + lib_src = str(Path(env_build) / "esp-idf") + lib_dst = str(Path(arduino_libs) / mcu / "lib") + ld_dst = str(Path(arduino_libs) / mcu / "ld") + mem_var = str(Path(arduino_libs) / mcu / board.get("build.arduino.memory_type", (board.get("build.flash_mode", "dio") + "_qspi"))) + # Ensure destinations exist + for d in (lib_dst, ld_dst, mem_var, str(Path(mem_var) / "include")): + Path(d).mkdir(parents=True, exist_ok=True) + src = [str(Path(lib_src) / x) for x in os.listdir(lib_src)] src = [folder for folder in src if not os.path.isfile(folder)] # folders only for folder in src: - files = [join(folder,x) for x in os.listdir(folder)] + files = [str(Path(folder) / x) for x in os.listdir(folder)] for file in files: if file.strip().endswith(".a"): - shutil.copyfile(file,join(lib_dst,file.split(os.path.sep)[-1])) + shutil.copyfile(file, str(Path(lib_dst) / file.split(os.path.sep)[-1])) - shutil.move(join(lib_dst,"libspi_flash.a"),join(mem_var,"libspi_flash.a")) - shutil.move(join(env_build,"memory.ld"),join(ld_dst,"memory.ld")) + _replace_move(str(Path(lib_dst) / "libspi_flash.a"), str(Path(mem_var) / "libspi_flash.a")) + _replace_move(str(Path(env_build) / "memory.ld"), str(Path(ld_dst) / "memory.ld")) if mcu == "esp32s3": - shutil.move(join(lib_dst,"libesp_psram.a"),join(mem_var,"libesp_psram.a")) - shutil.move(join(lib_dst,"libesp_system.a"),join(mem_var,"libesp_system.a")) - shutil.move(join(lib_dst,"libfreertos.a"),join(mem_var,"libfreertos.a")) - shutil.move(join(lib_dst,"libbootloader_support.a"),join(mem_var,"libbootloader_support.a")) - shutil.move(join(lib_dst,"libesp_hw_support.a"),join(mem_var,"libesp_hw_support.a")) - shutil.move(join(lib_dst,"libesp_lcd.a"),join(mem_var,"libesp_lcd.a")) + _replace_move(str(Path(lib_dst) / "libesp_psram.a"), str(Path(mem_var) / "libesp_psram.a")) + _replace_move(str(Path(lib_dst) / "libesp_system.a"), str(Path(mem_var) / "libesp_system.a")) + _replace_move(str(Path(lib_dst) / "libfreertos.a"), str(Path(mem_var) / "libfreertos.a")) + _replace_move(str(Path(lib_dst) / "libbootloader_support.a"), str(Path(mem_var) / "libbootloader_support.a")) + _replace_move(str(Path(lib_dst) / "libesp_hw_support.a"), str(Path(mem_var) / "libesp_hw_support.a")) + _replace_move(str(Path(lib_dst) / "libesp_lcd.a"), str(Path(mem_var) / "libesp_lcd.a")) - shutil.copyfile(sdkconfig_h_path,join(mem_var,"include","sdkconfig.h")) - if not bool(os.path.isfile(join(arduino_libs,mcu,"sdkconfig.orig"))): - shutil.move(join(arduino_libs,mcu,"sdkconfig"),join(arduino_libs,mcu,"sdkconfig.orig")) - shutil.copyfile(join(env.subst("$PROJECT_DIR"),"sdkconfig."+env["PIOENV"]),join(arduino_libs,mcu,"sdkconfig")) - shutil.copyfile(join(env.subst("$PROJECT_DIR"),"sdkconfig."+env["PIOENV"]),join(arduino_libs,"sdkconfig")) + shutil.copyfile(sdkconfig_h_path, str(Path(mem_var) / "include" / "sdkconfig.h")) + if not bool(os.path.isfile(str(Path(arduino_libs) / mcu / "sdkconfig.orig"))): + shutil.move(str(Path(arduino_libs) / mcu / "sdkconfig"), str(Path(arduino_libs) / mcu / "sdkconfig.orig")) + shutil.copyfile(str(Path(env.subst("$PROJECT_DIR")) / ("sdkconfig." + env["PIOENV"])), str(Path(arduino_libs) / mcu / "sdkconfig")) + shutil.copyfile(str(Path(env.subst("$PROJECT_DIR")) / ("sdkconfig." + env["PIOENV"])), str(Path(arduino_libs) / "sdkconfig")) try: - os.remove(join(env.subst("$PROJECT_DIR"),"dependencies.lock")) - os.remove(join(env.subst("$PROJECT_DIR"),"CMakeLists.txt")) - except: + os.remove(str(Path(env.subst("$PROJECT_DIR")) / "dependencies.lock")) + os.remove(str(Path(env.subst("$PROJECT_DIR")) / "CMakeLists.txt")) + except FileNotFoundError: pass + except OSError as e: + print(f"Warning: cleanup failed: {e}") print("*** Copied compiled %s IDF libraries to Arduino framework ***" % idf_variant) - pio_exe_path = shutil.which("platformio"+(".exe" if IS_WINDOWS else "")) + PYTHON_EXE = env.subst("$PYTHONEXE") + pio_exe_path = str(Path(os.path.dirname(PYTHON_EXE)) / ("pio" + (".exe" if IS_WINDOWS else ""))) pio_cmd = env["PIOENV"] env.Execute( env.VerboseAction( @@ -2150,9 +2154,9 @@ if ("arduino" in env.subst("$PIOFRAMEWORK")) and ("espidf" not in env.subst("$PI ) if flag_custom_component_add == True or flag_custom_component_remove == True: try: - shutil.copy(join(ARDUINO_FRAMEWORK_DIR,"idf_component.yml.orig"),join(ARDUINO_FRAMEWORK_DIR,"idf_component.yml")) + shutil.copy(str(Path(ARDUINO_FRAMEWORK_DIR) / "idf_component.yml.orig"), str(Path(ARDUINO_FRAMEWORK_DIR) / "idf_component.yml")) print("*** Original Arduino \"idf_component.yml\" restored ***") - except: + except (FileNotFoundError, PermissionError, OSError): print("*** Original Arduino \"idf_component.yml\" couldnt be restored ***") # Restore original pioarduino-build.py from component_manager import ComponentManager @@ -2164,17 +2168,19 @@ if ("arduino" in env.subst("$PIOFRAMEWORK")) and ("espidf" not in env.subst("$PI if "espidf" in env.subst("$PIOFRAMEWORK") and (flag_custom_component_add == True or flag_custom_component_remove == True): def idf_custom_component(source, target, env): try: - shutil.copy(join(ARDUINO_FRAMEWORK_DIR,"idf_component.yml.orig"),join(ARDUINO_FRAMEWORK_DIR,"idf_component.yml")) - print("*** Original Arduino \"idf_component.yml\" restored ***") - except: + if "arduino" in env.subst("$PIOFRAMEWORK"): + shutil.copy(str(Path(ARDUINO_FRAMEWORK_DIR) / "idf_component.yml.orig"), + str(Path(ARDUINO_FRAMEWORK_DIR) / "idf_component.yml")) + print("*** Original Arduino \"idf_component.yml\" restored ***") + except (FileNotFoundError, PermissionError, OSError): try: - shutil.copy(join(PROJECT_SRC_DIR,"idf_component.yml.orig"),join(PROJECT_SRC_DIR,"idf_component.yml")) + shutil.copy(str(Path(PROJECT_SRC_DIR) / "idf_component.yml.orig"), str(Path(PROJECT_SRC_DIR) / "idf_component.yml")) print("*** Original \"idf_component.yml\" restored ***") - except: # no "idf_component.yml" in source folder + except (FileNotFoundError, PermissionError, OSError): # no "idf_component.yml" in source folder try: - os.remove(join(PROJECT_SRC_DIR,"idf_component.yml")) + os.remove(str(Path(PROJECT_SRC_DIR) / "idf_component.yml")) print("*** pioarduino generated \"idf_component.yml\" removed ***") - except: + except (FileNotFoundError, PermissionError, OSError): print("*** no custom \"idf_component.yml\" found for removing ***") if "arduino" in env.subst("$PIOFRAMEWORK"): # Restore original pioarduino-build.py, only used with Arduino @@ -2183,6 +2189,7 @@ if "espidf" in env.subst("$PIOFRAMEWORK") and (flag_custom_component_add == True component_manager.restore_pioarduino_build_py() silent_action = create_silent_action(idf_custom_component) env.AddPostAction("checkprogsize", silent_action) + # # Process OTA partition and image # @@ -2195,9 +2202,9 @@ ota_partition_params = get_partition_info( if ota_partition_params["size"] and ota_partition_params["offset"]: # Generate an empty image if OTA is enabled in partition table - ota_partition_image = os.path.join("$BUILD_DIR", "ota_data_initial.bin") + ota_partition_image = str(Path("$BUILD_DIR") / "ota_data_initial.bin") if "arduino" in env.subst("$PIOFRAMEWORK"): - ota_partition_image = os.path.join(ARDUINO_FRAMEWORK_DIR, "tools", "partitions", "boot_app0.bin") + ota_partition_image = str(Path(ARDUINO_FRAMEWORK_DIR) / "tools" / "partitions" / "boot_app0.bin") else: generate_empty_partition_image(ota_partition_image, ota_partition_params["size"]) @@ -2211,12 +2218,12 @@ if ota_partition_params["size"] and ota_partition_params["offset"]: ) ] ) - EXTRA_IMG_DIR = join(env.subst("$PROJECT_DIR"), "variants", "tasmota") - env.Append( - FLASH_EXTRA_IMAGES=[ - (offset, join(EXTRA_IMG_DIR, img)) for offset, img in board.get("upload.arduino.flash_extra_images", []) - ] - ) + extra_imgs = board.get("upload.arduino.flash_extra_images", []) + if extra_imgs: + extra_img_dir = Path(env.subst("$PROJECT_DIR")) / "variants" / "tasmota" + env.Append( + FLASH_EXTRA_IMAGES=[(offset, str(extra_img_dir / img)) for offset, img in extra_imgs] + ) def _parse_size(value): if isinstance(value, int): @@ -2234,33 +2241,12 @@ def _parse_size(value): # Configure application partition offset # -partitions_csv = env.subst("$PARTITIONS_TABLE_CSV") -result = [] -next_offset = 0 -bound = 0x10000 -with open(partitions_csv) as fp: - for line in fp.readlines(): - line = line.strip() - if not line or line.startswith("#"): - continue - tokens = [t.strip() for t in line.split(",")] - if len(tokens) < 5: - continue - partition = { - "name": tokens[0], - "type": tokens[1], - "subtype": tokens[2], - "offset": tokens[3] or next_offset, - "size": tokens[4], - "flags": tokens[5] if len(tokens) > 5 else None - } - result.append(partition) - next_offset = _parse_size(partition["offset"]) - if (partition["subtype"] == "ota_0"): - bound = next_offset - next_offset = (next_offset + bound - 1) & ~(bound - 1) +app_offset = get_app_partition_offset( + env.subst("$PARTITIONS_TABLE_CSV"), + partition_table_offset +) -env.Replace(ESP32_APP_OFFSET=str(hex(bound))) +env.Replace(ESP32_APP_OFFSET=app_offset) # # Propagate application offset to debug configurations diff --git a/builder/frameworks/ulp.py b/builder/frameworks/ulp.py index 22a591c..be7828e 100644 --- a/builder/frameworks/ulp.py +++ b/builder/frameworks/ulp.py @@ -14,10 +14,11 @@ import os import sys +from pathlib import Path from platformio import fs from platformio.util import get_systype -from platformio.proc import where_is_program, exec_command +from platformio.proc import exec_command from SCons.Script import Import @@ -27,42 +28,41 @@ ulp_env = env.Clone() platform = ulp_env.PioPlatform() FRAMEWORK_DIR = platform.get_package_dir("framework-espidf") BUILD_DIR = ulp_env.subst("$BUILD_DIR") -ULP_BUILD_DIR = os.path.join( - BUILD_DIR, "esp-idf", project_config["name"].replace("__idf_", ""), "ulp_main" -) +ULP_BUILD_DIR = str(Path(BUILD_DIR) / "esp-idf" / project_config["name"].replace("__idf_", "") / "ulp_main") +is_xtensa = idf_variant in ("esp32", "esp32s2", "esp32s3") def prepare_ulp_env_vars(env): ulp_env.PrependENVPath("IDF_PATH", FRAMEWORK_DIR) toolchain_path = platform.get_package_dir( "toolchain-xtensa-esp-elf" - if idf_variant not in ("esp32c5","esp32c6", "esp32p4") + if is_xtensa else "toolchain-riscv32-esp" ) toolchain_path_ulp = platform.get_package_dir( "toolchain-esp32ulp" if sdk_config.get("ULP_COPROC_TYPE_FSM", False) - else "" + else None ) additional_packages = [ toolchain_path, toolchain_path_ulp, platform.get_package_dir("tool-ninja"), - os.path.join(platform.get_package_dir("tool-cmake"), "bin"), - os.path.dirname(where_is_program("python")), + str(Path(platform.get_package_dir("tool-cmake")) / "bin"), ] for package in additional_packages: - ulp_env.PrependENVPath("PATH", package) + if package and os.path.isdir(package): + ulp_env.PrependENVPath("PATH", package) def collect_ulp_sources(): return [ - os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp", f) - for f in os.listdir(os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp")) + str(Path(ulp_env.subst("$PROJECT_DIR")) / "ulp" / f) + for f in os.listdir(str(Path(ulp_env.subst("$PROJECT_DIR")) / "ulp")) if f.endswith((".c", ".S", ".s")) ] @@ -77,7 +77,7 @@ def get_component_includes(target_config): ] ] - return [os.path.join(BUILD_DIR, "config")] + return [str(Path(BUILD_DIR) / "config")] def generate_ulp_config(target_config): @@ -85,7 +85,7 @@ def generate_ulp_config(target_config): riscv_ulp_enabled = sdk_config.get("ULP_COPROC_TYPE_RISCV", False) lp_core_ulp_enabled = sdk_config.get("ULP_COPROC_TYPE_LP_CORE", False) - if lp_core_ulp_enabled == False: + if not lp_core_ulp_enabled: ulp_toolchain = "toolchain-%sulp%s.cmake"% ( "" if riscv_ulp_enabled else idf_variant + "-", "-riscv" if riscv_ulp_enabled else "", @@ -93,36 +93,30 @@ def generate_ulp_config(target_config): else: ulp_toolchain = "toolchain-lp-core-riscv.cmake" - comp_includes = ";".join(get_component_includes(target_config)) - plain_includes = ";".join(app_includes["plain_includes"]) - comp_includes = comp_includes + plain_includes + comp_includes_list = get_component_includes(target_config) + plain_includes_list = app_includes["plain_includes"] + comp_includes = ";".join(comp_includes_list + plain_includes_list) cmd = ( - os.path.join(platform.get_package_dir("tool-cmake"), "bin", "cmake"), + str(Path(platform.get_package_dir("tool-cmake")) / "bin" / "cmake"), "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON", "-DCMAKE_GENERATOR=Ninja", "-DCMAKE_TOOLCHAIN_FILE=" - + os.path.join( - FRAMEWORK_DIR, - "components", - "ulp", - "cmake", - ulp_toolchain, - ), + + str(Path(FRAMEWORK_DIR) / "components" / "ulp" / "cmake" / ulp_toolchain), "-DULP_S_SOURCES=%s" % ";".join([fs.to_unix_path(s.get_abspath()) for s in source]), "-DULP_APP_NAME=ulp_main", - "-DCOMPONENT_DIR=" + os.path.join(ulp_env.subst("$PROJECT_DIR"), "ulp"), - "-DCOMPONENT_INCLUDES=" + comp_includes, + "-DCOMPONENT_DIR=" + str(Path(ulp_env.subst("$PROJECT_DIR")) / "ulp"), + "-DCOMPONENT_INCLUDES=%s" % comp_includes, "-DIDF_TARGET=%s" % idf_variant, "-DIDF_PATH=" + fs.to_unix_path(FRAMEWORK_DIR), - "-DSDKCONFIG_HEADER=" + os.path.join(BUILD_DIR, "config", "sdkconfig.h"), + "-DSDKCONFIG_HEADER=" + str(Path(BUILD_DIR) / "config" / "sdkconfig.h"), "-DPYTHON=" + env.subst("$PYTHONEXE"), - "-DSDKCONFIG_CMAKE=" + os.path.join(BUILD_DIR, "config", "sdkconfig.cmake"), - "-DCMAKE_MODULE_PATH=" + fs.to_unix_path(os.path.join(FRAMEWORK_DIR, "components", "ulp", "cmake")), + "-DSDKCONFIG_CMAKE=" + str(Path(BUILD_DIR) / "config" / "sdkconfig.cmake"), + "-DCMAKE_MODULE_PATH=" + fs.to_unix_path(str(Path(FRAMEWORK_DIR) / "components" / "ulp" / "cmake")), "-GNinja", "-B", ULP_BUILD_DIR, - os.path.join(FRAMEWORK_DIR, "components", "ulp", "cmake"), + str(Path(FRAMEWORK_DIR) / "components" / "ulp" / "cmake"), ) result = exec_command(cmd) @@ -134,7 +128,7 @@ def generate_ulp_config(target_config): ulp_sources.sort() return ulp_env.Command( - os.path.join(ULP_BUILD_DIR, "build.ninja"), + str(Path(ULP_BUILD_DIR) / "build.ninja"), ulp_sources, ulp_env.VerboseAction( _generate_ulp_configuration_action, "Generating ULP configuration" @@ -144,7 +138,7 @@ def generate_ulp_config(target_config): def compile_ulp_binary(): cmd = ( - os.path.join(platform.get_package_dir("tool-cmake"), "bin", "cmake"), + str(Path(platform.get_package_dir("tool-cmake")) / "bin" / "cmake"), "--build", ULP_BUILD_DIR, "--target", @@ -158,9 +152,9 @@ def compile_ulp_binary(): return ulp_binary_env.Command( [ - os.path.join(ULP_BUILD_DIR, "ulp_main.h"), - os.path.join(ULP_BUILD_DIR, "ulp_main.ld"), - os.path.join(ULP_BUILD_DIR, "ulp_main.bin"), + str(Path(ULP_BUILD_DIR) / "ulp_main.h"), + str(Path(ULP_BUILD_DIR) / "ulp_main.ld"), + str(Path(ULP_BUILD_DIR) / "ulp_main.bin"), ], None, ulp_binary_env.VerboseAction(" ".join(cmd), "Generating ULP project files $TARGETS"), @@ -169,19 +163,17 @@ def compile_ulp_binary(): def generate_ulp_assembly(): cmd = ( - os.path.join(platform.get_package_dir("tool-cmake"), "bin", "cmake"), + str(Path(platform.get_package_dir("tool-cmake")) / "bin" / "cmake"), "-DDATA_FILE=$SOURCE", "-DSOURCE_FILE=$TARGET", "-DFILE_TYPE=BINARY", "-P", - os.path.join( - FRAMEWORK_DIR, "tools", "cmake", "scripts", "data_file_embed_asm.cmake" - ), + str(Path(FRAMEWORK_DIR) / "tools" / "cmake" / "scripts" / "data_file_embed_asm.cmake"), ) return ulp_env.Command( - os.path.join(BUILD_DIR, "ulp_main.bin.S"), - os.path.join(ULP_BUILD_DIR, "ulp_main.bin"), + str(Path(BUILD_DIR) / "ulp_main.bin.S"), + str(Path(ULP_BUILD_DIR) / "ulp_main.bin"), ulp_env.VerboseAction(" ".join(cmd), "Generating ULP assembly file $TARGET"), ) @@ -190,7 +182,7 @@ prepare_ulp_env_vars(ulp_env) ulp_assembly = generate_ulp_assembly() ulp_env.Depends(compile_ulp_binary(), generate_ulp_config(project_config)) -ulp_env.Depends(os.path.join("$BUILD_DIR", "${PROGNAME}.elf"), ulp_assembly) -ulp_env.Requires(os.path.join("$BUILD_DIR", "${PROGNAME}.elf"), ulp_assembly) +ulp_env.Depends(str(Path("$BUILD_DIR") / "${PROGNAME}.elf"), ulp_assembly) +ulp_env.Requires(str(Path("$BUILD_DIR") / "${PROGNAME}.elf"), ulp_assembly) env.AppendUnique(CPPPATH=ULP_BUILD_DIR, LIBPATH=ULP_BUILD_DIR) diff --git a/builder/main.py b/builder/main.py index 15d1580..b54a165 100644 --- a/builder/main.py +++ b/builder/main.py @@ -13,14 +13,14 @@ # limitations under the License. import locale -import json import os import re -import semantic_version import shlex import subprocess import sys from os.path import isfile, join +from pathlib import Path +import importlib.util from SCons.Script import ( ARGUMENTS, @@ -32,410 +32,52 @@ from SCons.Script import ( ) from platformio.project.helpers import get_project_dir -from platformio.package.version import pepver_to_semver from platformio.util import get_serial_ports from platformio.compat import IS_WINDOWS - -# Check Python version requirement -if sys.version_info < (3, 10): - sys.stderr.write( - f"Error: Python 3.10 or higher is required. " - f"Current version: {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}\n" - f"Please update your Python installation.\n" - ) - sys.exit(1) - -# Python dependencies required for the build process -python_deps = { - "uv": ">=0.1.0", - "pyyaml": ">=6.0.2", - "rich-click": ">=1.8.6", - "zopfli": ">=0.2.2", - "intelhex": ">=2.3.0", - "rich": ">=14.0.0", - "esp-idf-size": ">=1.6.1" -} +from penv_setup import setup_python_environment # Initialize environment and configuration env = DefaultEnvironment() platform = env.PioPlatform() projectconfig = env.GetProjectConfig() terminal_cp = locale.getpreferredencoding().lower() -PYTHON_EXE = env.subst("$PYTHONEXE") # Global Python executable path +platform_dir = Path(env.PioPlatform().get_dir()) +framework_dir = platform.get_package_dir("framework-arduinoespressif32") +core_dir = projectconfig.get("platformio", "core_dir") +build_dir = Path(projectconfig.get("platformio", "build_dir")) -# Framework directory path -FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32") +# Setup Python virtual environment and get executable paths +PYTHON_EXE, esptool_binary_path = setup_python_environment(env, platform, core_dir) -platformio_dir = projectconfig.get("platformio", "core_dir") -penv_dir = os.path.join(platformio_dir, "penv") - -pip_path = os.path.join( - penv_dir, - "Scripts" if IS_WINDOWS else "bin", - "pip" + (".exe" if IS_WINDOWS else ""), -) - -def setup_pipenv_in_package(): - """ - Checks if 'penv' folder exists in platformio dir and creates virtual environment if not. - """ - if not os.path.exists(penv_dir): - env.Execute( - env.VerboseAction( - '"$PYTHONEXE" -m venv --clear "%s"' % penv_dir, - "Creating a new virtual environment for Python dependencies", - ) - ) - - assert os.path.isfile( - pip_path - ), "Error: Failed to create a proper virtual environment. Missing the `pip` binary!" - - penv_python = os.path.join(penv_dir, "Scripts", "python.exe") if IS_WINDOWS else os.path.join(penv_dir, "bin", "python") - env.Replace(PYTHONEXE=penv_python) - print(f"PYTHONEXE updated to penv environment: {penv_python}") - -setup_pipenv_in_package() -# Update global PYTHON_EXE variable after potential pipenv setup -PYTHON_EXE = env.subst("$PYTHONEXE") -python_exe = PYTHON_EXE - -# Ensure penv Python directory is in PATH for subprocess calls -python_dir = os.path.dirname(PYTHON_EXE) -current_path = os.environ.get("PATH", "") -if python_dir not in current_path: - os.environ["PATH"] = python_dir + os.pathsep + current_path - -# Verify the Python executable exists -assert os.path.isfile(PYTHON_EXE), f"Python executable not found: {PYTHON_EXE}" - -if os.path.isfile(python_exe): - # Update sys.path to include penv site-packages - if IS_WINDOWS: - penv_site_packages = os.path.join(penv_dir, "Lib", "site-packages") - else: - # Find the actual site-packages directory in the venv - penv_lib_dir = os.path.join(penv_dir, "lib") - if os.path.isdir(penv_lib_dir): - for python_dir in os.listdir(penv_lib_dir): - if python_dir.startswith("python"): - penv_site_packages = os.path.join(penv_lib_dir, python_dir, "site-packages") - break - else: - penv_site_packages = None - else: - penv_site_packages = None - - if penv_site_packages and os.path.isdir(penv_site_packages) and penv_site_packages not in sys.path: - sys.path.insert(0, penv_site_packages) - -def add_to_pythonpath(path): - """ - Add a path to the PYTHONPATH environment variable (cross-platform). - - Args: - path (str): The path to add to PYTHONPATH - """ - # Normalize the path for the current OS - normalized_path = os.path.normpath(path) - - # Add to PYTHONPATH environment variable - if "PYTHONPATH" in os.environ: - current_paths = os.environ["PYTHONPATH"].split(os.pathsep) - normalized_current_paths = [os.path.normpath(p) for p in current_paths] - if normalized_path not in normalized_current_paths: - os.environ["PYTHONPATH"] = normalized_path + os.pathsep + os.environ.get("PYTHONPATH", "") - else: - os.environ["PYTHONPATH"] = normalized_path - - # Also add to sys.path for immediate availability - if normalized_path not in sys.path: - sys.path.insert(0, normalized_path) - -def setup_python_paths(): - """ - Setup Python paths based on the actual Python executable being used. - """ - # Get the directory containing the Python executable - python_dir = os.path.dirname(PYTHON_EXE) - add_to_pythonpath(python_dir) - - # Try to find site-packages directory using the actual Python executable - result = subprocess.run( - [PYTHON_EXE, "-c", "import site; print(site.getsitepackages()[0])"], - capture_output=True, - text=True, - timeout=5 - ) - if result.returncode == 0: - site_packages = result.stdout.strip() - if os.path.isdir(site_packages): - add_to_pythonpath(site_packages) - -# Setup Python paths based on the actual Python executable -setup_python_paths() - -def _get_executable_path(python_exe, executable_name): - """ - Get the path to an executable binary (esptool, uv, etc.) based on the Python executable path. - - Args: - python_exe (str): Path to Python executable - executable_name (str): Name of the executable to find (e.g., 'esptool', 'uv') - - Returns: - str: Path to executable or fallback to executable name - """ - - python_dir = os.path.dirname(python_exe) - - if IS_WINDOWS: - executable_path = os.path.join(python_dir, f"{executable_name}.exe") - else: - # For Unix-like systems, executables are typically in the same directory as python - # or in a bin subdirectory - executable_path = os.path.join(python_dir, executable_name) - - # If not found in python directory, try bin subdirectory - if not os.path.isfile(executable_path): - bin_dir = os.path.join(python_dir, "bin") - executable_path = os.path.join(bin_dir, executable_name) - - if os.path.isfile(executable_path): - return executable_path - - return executable_name # Fallback to command name +# Initialize board configuration and MCU settings +board = env.BoardConfig() +board_id = env.subst("$BOARD") +mcu = board.get("build.mcu", "esp32") +is_xtensa = mcu in ("esp32", "esp32s2", "esp32s3") +toolchain_arch = "xtensa-%s" % mcu +filesystem = board.get("build.filesystem", "littlefs") -def _get_esptool_executable_path(python_exe): - """ - Get the path to the esptool executable binary. - - Args: - python_exe (str): Path to Python executable - - Returns: - str: Path to esptool executable - """ - return _get_executable_path(python_exe, "esptool") +def load_board_script(env): + if not board_id: + return + script_path = platform_dir / "boards" / f"{board_id}.py" -def _get_uv_executable_path(python_exe): - """ - Get the path to the uv executable binary. - - Args: - python_exe (str): Path to Python executable - - Returns: - str: Path to uv executable - """ - return _get_executable_path(python_exe, "uv") - - -def get_packages_to_install(deps, installed_packages): - """ - Generator for Python packages that need to be installed. - - Args: - deps (dict): Dictionary of package names and version specifications - installed_packages (dict): Dictionary of currently installed packages - - Yields: - str: Package name that needs to be installed - """ - for package, spec in deps.items(): - if package not in installed_packages: - yield package - else: - version_spec = semantic_version.Spec(spec) - if not version_spec.match(installed_packages[package]): - yield package - - -def install_python_deps(): - """ - Ensure uv package manager is available and install required Python dependencies. - - Returns: - bool: True if successful, False otherwise - """ - # Get uv executable path - uv_executable = _get_uv_executable_path(PYTHON_EXE) - - try: - result = subprocess.run( - [uv_executable, "--version"], - capture_output=True, - text=True, - timeout=3 - ) - uv_available = result.returncode == 0 - except (FileNotFoundError, subprocess.TimeoutExpired): - uv_available = False - - if not uv_available: + if script_path.exists(): try: - result = subprocess.run( - [PYTHON_EXE, "-m", "pip", "install", "uv>=0.1.0", "-q", "-q", "-q"], - capture_output=True, - text=True, - timeout=30, # 30 second timeout - env=os.environ # Use modified environment with custom PYTHONPATH + spec = importlib.util.spec_from_file_location( + f"board_{board_id}", + str(script_path) ) - if result.returncode != 0: - if result.stderr: - print(f"Error output: {result.stderr.strip()}") - return False - - # Update uv executable path after installation - uv_executable = _get_uv_executable_path(PYTHON_EXE) - - # Add Scripts directory to PATH for Windows - if IS_WINDOWS: - python_dir = os.path.dirname(PYTHON_EXE) - scripts_dir = os.path.join(python_dir, "Scripts") - if os.path.isdir(scripts_dir): - os.environ["PATH"] = scripts_dir + os.pathsep + os.environ.get("PATH", "") - - except subprocess.TimeoutExpired: - print("Error: uv installation timed out") - return False - except FileNotFoundError: - print("Error: Python executable not found") - return False + board_module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(board_module) + + if hasattr(board_module, 'configure_board'): + board_module.configure_board(env) + except Exception as e: - print(f"Error installing uv package manager: {e}") - return False - - - def _get_installed_uv_packages(): - """ - Get list of installed packages using uv. - - Returns: - dict: Dictionary of installed packages with versions - """ - result = {} - try: - cmd = [uv_executable, "pip", "list", "--format=json"] - result_obj = subprocess.run( - cmd, - capture_output=True, - text=True, - encoding='utf-8', - timeout=30, # 30 second timeout - env=os.environ # Use modified environment with custom PYTHONPATH - ) - - if result_obj.returncode == 0: - content = result_obj.stdout.strip() - if content: - packages = json.loads(content) - for p in packages: - result[p["name"]] = pepver_to_semver(p["version"]) - else: - print(f"Warning: pip list failed with exit code {result_obj.returncode}") - if result_obj.stderr: - print(f"Error output: {result_obj.stderr.strip()}") - - except subprocess.TimeoutExpired: - print("Warning: uv pip list command timed out") - except (json.JSONDecodeError, KeyError) as e: - print(f"Warning: Could not parse package list: {e}") - except FileNotFoundError: - print("Warning: uv command not found") - except Exception as e: - print(f"Warning! Couldn't extract the list of installed Python packages: {e}") - - return result - - installed_packages = _get_installed_uv_packages() - packages_to_install = list(get_packages_to_install(python_deps, installed_packages)) - - if packages_to_install: - packages_list = [f"{p}{python_deps[p]}" for p in packages_to_install] - - cmd = [ - uv_executable, "pip", "install", - f"--python={PYTHON_EXE}", - "--quiet", "--upgrade" - ] + packages_list - - try: - result = subprocess.run( - cmd, - capture_output=True, - text=True, - timeout=30, # 30 second timeout for package installation - env=os.environ # Use modified environment with custom PYTHONPATH - ) - - if result.returncode != 0: - print(f"Error: Failed to install Python dependencies (exit code: {result.returncode})") - if result.stderr: - print(f"Error output: {result.stderr.strip()}") - return False - - except subprocess.TimeoutExpired: - print("Error: Python dependencies installation timed out") - return False - except FileNotFoundError: - print("Error: uv command not found") - return False - except Exception as e: - print(f"Error installing Python dependencies: {e}") - return False - - return True - - -def install_esptool(): - """ - Install esptool from package folder "tool-esptoolpy" using uv package manager. - Also determines the path to the esptool executable binary. - - Returns: - str: Path to esptool executable, or 'esptool' as fallback - """ - try: - subprocess.check_call( - [PYTHON_EXE, "-c", "import esptool"], - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, - env=os.environ - ) - esptool_binary_path = _get_esptool_executable_path(PYTHON_EXE) - return esptool_binary_path - except (subprocess.CalledProcessError, FileNotFoundError): - pass - - esptool_repo_path = env.subst(platform.get_package_dir("tool-esptoolpy") or "") - if esptool_repo_path and os.path.isdir(esptool_repo_path): - uv_executable = _get_uv_executable_path(PYTHON_EXE) - try: - subprocess.check_call([ - uv_executable, "pip", "install", "--quiet", - f"--python={PYTHON_EXE}", - "-e", esptool_repo_path - ], env=os.environ) - - esptool_binary_path = _get_esptool_executable_path(PYTHON_EXE) - return esptool_binary_path - - except subprocess.CalledProcessError as e: - print(f"Warning: Failed to install esptool: {e}") - return 'esptool' # Fallback - - return 'esptool' # Fallback - - -# Install Python dependencies -install_python_deps() - -# Install esptool after dependencies -esptool_binary_path = install_esptool() - + print(f"Error loading board script {board_id}.py: {e}") def BeforeUpload(target, source, env): """ @@ -802,14 +444,11 @@ def switch_off_ldf(): projectconfig.set(env_section, "lib_ldf_mode", "off") -# Initialize board configuration and MCU settings -board = env.BoardConfig() -mcu = board.get("build.mcu", "esp32") -toolchain_arch = "xtensa-%s" % mcu -filesystem = board.get("build.filesystem", "littlefs") +# Board specific script +load_board_script(env) # Set toolchain architecture for RISC-V based ESP32 variants -if mcu in ("esp32c2", "esp32c3", "esp32c5", "esp32c6", "esp32h2", "esp32p4"): +if not is_xtensa: toolchain_arch = "riscv32-esp" # Initialize integration extra data if not present @@ -817,7 +456,7 @@ if "INTEGRATION_EXTRA_DATA" not in env: env["INTEGRATION_EXTRA_DATA"] = {} # Take care of possible whitespaces in path -objcopy_value = ( +uploader_path = ( f'"{esptool_binary_path}"' if ' ' in esptool_binary_path else esptool_binary_path @@ -837,21 +476,14 @@ env.Replace( GDB=join( platform.get_package_dir( "tool-riscv32-esp-elf-gdb" - if mcu in ( - "esp32c2", - "esp32c3", - "esp32c5", - "esp32c6", - "esp32h2", - "esp32p4", - ) + if not is_xtensa else "tool-xtensa-esp-elf-gdb" ) or "", "bin", "%s-elf-gdb" % toolchain_arch, ), - OBJCOPY=objcopy_value, + OBJCOPY=uploader_path, RANLIB="%s-elf-gcc-ranlib" % toolchain_arch, SIZETOOL="%s-elf-size" % toolchain_arch, ARFLAGS=["rc"], @@ -861,8 +493,8 @@ env.Replace( SIZECHECKCMD="$SIZETOOL -A -d $SOURCES", SIZEPRINTCMD="$SIZETOOL -B -d $SOURCES", ERASEFLAGS=["--chip", mcu, "--port", '"$UPLOAD_PORT"'], - ERASECMD='"$OBJCOPY" $ERASEFLAGS erase-flash', - # mkspiffs package contains two different binaries for IDF and Arduino + ERASETOOL=uploader_path, + ERASECMD='$ERASETOOL $ERASEFLAGS erase-flash', MKFSTOOL="mk%s" % filesystem + ( ( @@ -907,7 +539,7 @@ env.Append( action=env.VerboseAction( " ".join( [ - "$OBJCOPY", + "$ERASETOOL", "--chip", mcu, "elf2image", @@ -918,8 +550,8 @@ env.Append( "--flash-size", board.get("upload.flash_size", "4MB"), "-o", - "$TARGET", - "$SOURCES", + "\"$TARGET\"", + "\"$SOURCES\"", ] ), "Building $TARGET", @@ -969,12 +601,12 @@ def firmware_metrics(target, source, env): print("Firmware metrics can not be shown. Set the terminal codepage to \"utf-8\"") return - map_file = os.path.join(env.subst("$BUILD_DIR"), env.subst("$PROGNAME") + ".map") - if not os.path.isfile(map_file): + map_file = str(Path(env.subst("$BUILD_DIR")) / (env.subst("$PROGNAME") + ".map")) + if not Path(map_file).is_file(): # map file can be in project dir - map_file = os.path.join(get_project_dir(), env.subst("$PROGNAME") + ".map") + map_file = str(Path(get_project_dir()) / (env.subst("$PROGNAME") + ".map")) - if not os.path.isfile(map_file): + if not Path(map_file).is_file(): print(f"Error: Map file not found: {map_file}") print("Make sure the project is built first with 'pio run'") return @@ -993,7 +625,6 @@ def firmware_metrics(target, source, env): dash_index = sys.argv.index("--") if dash_index + 1 < len(sys.argv): cli_args = sys.argv[dash_index + 1:] - cmd.extend(cli_args) # Add CLI arguments before the map file if cli_args: @@ -1011,16 +642,13 @@ def firmware_metrics(target, source, env): if result.returncode != 0: print(f"Warning: esp-idf-size exited with code {result.returncode}") - - except ImportError: - print("Error: esp-idf-size module not found.") - print("Install with: pip install esp-idf-size") + except FileNotFoundError: print("Error: Python executable not found.") print("Check your Python installation.") except Exception as e: print(f"Error: Failed to run firmware metrics: {e}") - print("Make sure esp-idf-size is installed: pip install esp-idf-size") + print(f'Make sure esp-idf-size is installed: uv pip install --python "{PYTHON_EXE}" esp-idf-size') # @@ -1029,12 +657,12 @@ def firmware_metrics(target, source, env): target_elf = None if "nobuild" in COMMAND_LINE_TARGETS: - target_elf = join("$BUILD_DIR", "${PROGNAME}.elf") + target_elf = str(Path("$BUILD_DIR") / "${PROGNAME}.elf") if set(["uploadfs", "uploadfsota"]) & set(COMMAND_LINE_TARGETS): fetch_fs_size(env) - target_firm = join("$BUILD_DIR", "${ESP32_FS_IMAGE_NAME}.bin") + target_firm = str(Path("$BUILD_DIR") / "${ESP32_FS_IMAGE_NAME}.bin") else: - target_firm = join("$BUILD_DIR", "${PROGNAME}.bin") + target_firm = str(Path("$BUILD_DIR") / "${PROGNAME}.bin") else: target_elf = env.BuildProgram() silent_action = env.Action(firmware_metrics) @@ -1043,12 +671,12 @@ else: env.AddPostAction(target_elf, silent_action) if set(["buildfs", "uploadfs", "uploadfsota"]) & set(COMMAND_LINE_TARGETS): target_firm = env.DataToBin( - join("$BUILD_DIR", "${ESP32_FS_IMAGE_NAME}"), "$PROJECT_DATA_DIR" + str(Path("$BUILD_DIR") / "${ESP32_FS_IMAGE_NAME}"), "$PROJECT_DATA_DIR" ) env.NoCache(target_firm) AlwaysBuild(target_firm) else: - target_firm = env.ElfToBin(join("$BUILD_DIR", "${PROGNAME}"), target_elf) + target_firm = env.ElfToBin(str(Path("$BUILD_DIR") / "${PROGNAME}"), target_elf) env.Depends(target_firm, "checkprogsize") # Configure platform targets @@ -1078,7 +706,7 @@ target_size = env.AddPlatformTarget( ) # Target: Upload firmware or FS image -upload_protocol = env.subst("$UPLOAD_PROTOCOL") +upload_protocol = env.subst("$UPLOAD_PROTOCOL") or "esptool" debug_tools = board.get("debug.tools", {}) upload_actions = [] @@ -1106,7 +734,7 @@ if upload_protocol == "espota": "espressif32.html#over-the-air-ota-update\n" ) env.Replace( - UPLOADER=join(FRAMEWORK_DIR, "tools", "espota.py"), + UPLOADER=str(Path(framework_dir).resolve() / "tools" / "espota.py"), UPLOADERFLAGS=["--debug", "--progress", "-i", "$UPLOAD_PORT"], UPLOADCMD=f'"{PYTHON_EXE}" "$UPLOADER" $UPLOADERFLAGS -f $SOURCE', ) @@ -1117,7 +745,7 @@ if upload_protocol == "espota": # Configure upload protocol: esptool elif upload_protocol == "esptool": env.Replace( - UPLOADER=objcopy_value, + UPLOADER=uploader_path, UPLOADERFLAGS=[ "--chip", mcu, @@ -1166,7 +794,7 @@ elif upload_protocol == "esptool": "detect", "$FS_START", ], - UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCE', + UPLOADCMD='$UPLOADER $UPLOADERFLAGS $SOURCE', ) upload_actions = [ @@ -1183,8 +811,8 @@ elif upload_protocol == "dfu": upload_actions = [env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")] env.Replace( - UPLOADER=join( - platform.get_package_dir("tool-dfuutil-arduino") or "", "dfu-util" + UPLOADER=str( + Path(platform.get_package_dir("tool-dfuutil-arduino")).resolve() / "dfu-util" ), UPLOADERFLAGS=[ "-d", diff --git a/builder/penv_setup.py b/builder/penv_setup.py new file mode 100644 index 0000000..f04dc18 --- /dev/null +++ b/builder/penv_setup.py @@ -0,0 +1,481 @@ +# Copyright 2014-present PlatformIO +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +import os +import re +import site +import semantic_version +import subprocess +import sys +import socket +from pathlib import Path + +from platformio.package.version import pepver_to_semver +from platformio.compat import IS_WINDOWS + +# Check Python version requirement +if sys.version_info < (3, 10): + sys.stderr.write( + f"Error: Python 3.10 or higher is required. " + f"Current version: {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}\n" + f"Please update your Python installation.\n" + ) + sys.exit(1) + +github_actions = os.getenv('GITHUB_ACTIONS') + +PLATFORMIO_URL_VERSION_RE = re.compile( + r'/v?(\d+\.\d+\.\d+(?:[.-]\w+)?(?:\.\d+)?)(?:\.(?:zip|tar\.gz|tar\.bz2))?$', + re.IGNORECASE, +) + +# Python dependencies required for the build process +python_deps = { + "platformio": "https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.18.zip", + "pyyaml": ">=6.0.2", + "rich-click": ">=1.8.6", + "zopfli": ">=0.2.2", + "intelhex": ">=2.3.0", + "rich": ">=14.0.0", + "cryptography": ">=45.0.3", + "certifi": ">=2025.8.3", + "ecdsa": ">=0.19.1", + "bitstring": ">=4.3.1", + "reedsolo": ">=1.5.3,<1.8", + "esp-idf-size": ">=1.6.1" +} + + +def has_internet_connection(host="1.1.1.1", port=53, timeout=2): + """ + Checks if an internet connection is available (default: Cloudflare DNS server). + Returns True if a connection is possible, otherwise False. + """ + try: + socket.setdefaulttimeout(timeout) + socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((host, port)) + return True + except Exception: + return False + + +def get_executable_path(penv_dir, executable_name): + """ + Get the path to an executable based on the penv_dir. + """ + exe_suffix = ".exe" if IS_WINDOWS else "" + scripts_dir = "Scripts" if IS_WINDOWS else "bin" + + return str(Path(penv_dir) / scripts_dir / f"{executable_name}{exe_suffix}") + + +def setup_pipenv_in_package(env, penv_dir): + """ + Checks if 'penv' folder exists in platformio dir and creates virtual environment if not. + First tries to create with uv, falls back to python -m venv if uv is not available. + + Returns: + str or None: Path to uv executable if uv was used, None if python -m venv was used + """ + if not os.path.exists(penv_dir): + # First try to create virtual environment with uv + uv_success = False + uv_cmd = None + try: + # Derive uv path from PYTHONEXE path + python_exe = env.subst("$PYTHONEXE") + python_dir = os.path.dirname(python_exe) + uv_exe_suffix = ".exe" if IS_WINDOWS else "" + uv_cmd = str(Path(python_dir) / f"uv{uv_exe_suffix}") + + # Fall back to system uv if derived path doesn't exist + if not os.path.isfile(uv_cmd): + uv_cmd = "uv" + + subprocess.check_call( + [uv_cmd, "venv", "--clear", f"--python={python_exe}", penv_dir], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + timeout=90 + ) + uv_success = True + print(f"Created pioarduino Python virtual environment using uv: {penv_dir}") + + except Exception: + pass + + # Fallback to python -m venv if uv failed or is not available + if not uv_success: + uv_cmd = None + env.Execute( + env.VerboseAction( + '"$PYTHONEXE" -m venv --clear "%s"' % penv_dir, + "Created pioarduino Python virtual environment: %s" % penv_dir, + ) + ) + + # Verify that the virtual environment was created properly + # Check for python executable + assert os.path.isfile( + get_executable_path(penv_dir, "python") + ), f"Error: Failed to create a proper virtual environment. Missing the `python` binary! Created with uv: {uv_success}" + + return uv_cmd if uv_success else None + + return None + + +def setup_python_paths(penv_dir): + """Setup Python module search paths using the penv_dir.""" + # Add site-packages directory + python_ver = f"python{sys.version_info.major}.{sys.version_info.minor}" + site_packages = ( + str(Path(penv_dir) / "Lib" / "site-packages") if IS_WINDOWS + else str(Path(penv_dir) / "lib" / python_ver / "site-packages") + ) + + if os.path.isdir(site_packages): + site.addsitedir(site_packages) + + +def get_packages_to_install(deps, installed_packages): + """ + Generator for Python packages that need to be installed. + Compares package names case-insensitively. + + Args: + deps (dict): Dictionary of package names and version specifications + installed_packages (dict): Dictionary of currently installed packages (keys should be lowercase) + + Yields: + str: Package name that needs to be installed + """ + for package, spec in deps.items(): + name = package.lower() + if name not in installed_packages: + yield package + elif name == "platformio": + # Enforce the version from the direct URL if it looks like one. + # If version can't be parsed, fall back to accepting any installed version. + m = PLATFORMIO_URL_VERSION_RE.search(spec) + if m: + expected_ver = pepver_to_semver(m.group(1)) + if installed_packages.get(name) != expected_ver: + # Reinstall to align with the pinned URL version + yield package + else: + continue + else: + version_spec = semantic_version.SimpleSpec(spec) + if not version_spec.match(installed_packages[name]): + yield package + + +def install_python_deps(python_exe, external_uv_executable): + """ + Ensure uv package manager is available in penv and install required Python dependencies. + + Args: + python_exe: Path to Python executable in the penv + external_uv_executable: Path to external uv executable used to create the penv (can be None) + + Returns: + bool: True if successful, False otherwise + """ + # Get the penv directory to locate uv within it + penv_dir = os.path.dirname(os.path.dirname(python_exe)) + penv_uv_executable = get_executable_path(penv_dir, "uv") + + # Check if uv is available in the penv + uv_in_penv_available = False + try: + result = subprocess.run( + [penv_uv_executable, "--version"], + capture_output=True, + text=True, + timeout=10 + ) + uv_in_penv_available = result.returncode == 0 + except (FileNotFoundError, subprocess.TimeoutExpired): + uv_in_penv_available = False + + # Install uv into penv if not available + if not uv_in_penv_available: + if external_uv_executable: + # Use external uv to install uv into the penv + try: + subprocess.check_call( + [external_uv_executable, "pip", "install", "uv>=0.1.0", f"--python={python_exe}", "--quiet"], + stdout=subprocess.DEVNULL, + stderr=subprocess.STDOUT, + timeout=120 + ) + except subprocess.CalledProcessError as e: + print(f"Error: uv installation failed with exit code {e.returncode}") + return False + except subprocess.TimeoutExpired: + print("Error: uv installation timed out") + return False + except FileNotFoundError: + print("Error: External uv executable not found") + return False + except Exception as e: + print(f"Error installing uv package manager into penv: {e}") + return False + else: + # No external uv available, use pip to install uv into penv + try: + subprocess.check_call( + [python_exe, "-m", "pip", "install", "uv>=0.1.0", "--quiet"], + stdout=subprocess.DEVNULL, + stderr=subprocess.STDOUT, + timeout=120 + ) + except subprocess.CalledProcessError as e: + print(f"Error: uv installation via pip failed with exit code {e.returncode}") + return False + except subprocess.TimeoutExpired: + print("Error: uv installation via pip timed out") + return False + except FileNotFoundError: + print("Error: Python executable not found") + return False + except Exception as e: + print(f"Error installing uv package manager via pip: {e}") + return False + + + def _get_installed_uv_packages(): + """ + Get list of installed packages in virtual env 'penv' using uv. + + Returns: + dict: Dictionary of installed packages with versions + """ + result = {} + try: + cmd = [penv_uv_executable, "pip", "list", f"--python={python_exe}", "--format=json"] + result_obj = subprocess.run( + cmd, + capture_output=True, + text=True, + encoding='utf-8', + timeout=120 + ) + + if result_obj.returncode == 0: + content = result_obj.stdout.strip() + if content: + packages = json.loads(content) + for p in packages: + result[p["name"].lower()] = pepver_to_semver(p["version"]) + else: + print(f"Warning: uv pip list failed with exit code {result_obj.returncode}") + if result_obj.stderr: + print(f"Error output: {result_obj.stderr.strip()}") + + except subprocess.TimeoutExpired: + print("Warning: uv pip list command timed out") + except (json.JSONDecodeError, KeyError) as e: + print(f"Warning: Could not parse package list: {e}") + except FileNotFoundError: + print("Warning: uv command not found") + except Exception as e: + print(f"Warning! Couldn't extract the list of installed Python packages: {e}") + + return result + + installed_packages = _get_installed_uv_packages() + packages_to_install = list(get_packages_to_install(python_deps, installed_packages)) + + if packages_to_install: + packages_list = [] + for p in packages_to_install: + spec = python_deps[p] + if spec.startswith(('http://', 'https://', 'git+', 'file://')): + packages_list.append(spec) + else: + packages_list.append(f"{p}{spec}") + + cmd = [ + penv_uv_executable, "pip", "install", + f"--python={python_exe}", + "--quiet", "--upgrade" + ] + packages_list + + try: + subprocess.check_call( + cmd, + stdout=subprocess.DEVNULL, + stderr=subprocess.STDOUT, + timeout=120 + ) + + except subprocess.CalledProcessError as e: + print(f"Error: Failed to install Python dependencies (exit code: {e.returncode})") + return False + except subprocess.TimeoutExpired: + print("Error: Python dependencies installation timed out") + return False + except FileNotFoundError: + print("Error: uv command not found") + return False + except Exception as e: + print(f"Error installing Python dependencies: {e}") + return False + + return True + + +def install_esptool(env, platform, python_exe, uv_executable): + """ + Install esptool from package folder "tool-esptoolpy" using uv package manager. + Ensures esptool is installed from the specific tool-esptoolpy package directory. + + Args: + env: SCons environment object + platform: PlatformIO platform object + python_exe (str): Path to Python executable in virtual environment + uv_executable (str): Path to uv executable + + Raises: + SystemExit: If esptool installation fails or package directory not found + """ + esptool_repo_path = env.subst(platform.get_package_dir("tool-esptoolpy") or "") + if not esptool_repo_path or not os.path.isdir(esptool_repo_path): + sys.stderr.write( + f"Error: 'tool-esptoolpy' package directory not found: {esptool_repo_path!r}\n" + ) + sys.exit(1) + + # Check if esptool is already installed from the correct path + try: + result = subprocess.run( + [ + python_exe, + "-c", + ( + "import esptool, os, sys; " + "expected_path = os.path.normcase(os.path.realpath(sys.argv[1])); " + "actual_path = os.path.normcase(os.path.realpath(os.path.dirname(esptool.__file__))); " + "print('MATCH' if actual_path.startswith(expected_path) else 'MISMATCH')" + ), + esptool_repo_path, + ], + capture_output=True, + check=True, + text=True, + timeout=5 + ) + + if result.stdout.strip() == "MATCH": + return + + except (subprocess.CalledProcessError, subprocess.TimeoutExpired, FileNotFoundError): + pass + + try: + subprocess.check_call([ + uv_executable, "pip", "install", "--quiet", "--force-reinstall", + f"--python={python_exe}", + "-e", esptool_repo_path + ], timeout=60) + + except subprocess.CalledProcessError as e: + sys.stderr.write( + f"Error: Failed to install esptool from {esptool_repo_path} (exit {e.returncode})\n" + ) + sys.exit(1) + + +def setup_python_environment(env, platform, platformio_dir): + """ + Main function to setup the Python virtual environment and dependencies. + + Args: + env: SCons environment object + platform: PlatformIO platform object + platformio_dir (str): Path to PlatformIO core directory + + Returns: + tuple[str, str]: (Path to penv Python executable, Path to esptool script) + + Raises: + SystemExit: If Python version < 3.10 or dependency installation fails + """ + # Check Python version requirement + if sys.version_info < (3, 10): + sys.stderr.write( + f"Error: Python 3.10 or higher is required. " + f"Current version: {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}\n" + f"Please update your Python installation.\n" + ) + sys.exit(1) + + penv_dir = str(Path(platformio_dir) / "penv") + + # Setup virtual environment if needed + used_uv_executable = setup_pipenv_in_package(env, penv_dir) + + # Set Python Scons Var to env Python + penv_python = get_executable_path(penv_dir, "python") + env.Replace(PYTHONEXE=penv_python) + + # check for python binary, exit with error when not found + assert os.path.isfile(penv_python), f"Python executable not found: {penv_python}" + + # Setup Python module search paths + setup_python_paths(penv_dir) + + # Set executable paths from tools + esptool_binary_path = get_executable_path(penv_dir, "esptool") + uv_executable = get_executable_path(penv_dir, "uv") + + # Install espressif32 Python dependencies + if has_internet_connection() or github_actions: + if not install_python_deps(penv_python, used_uv_executable): + sys.stderr.write("Error: Failed to install Python dependencies into penv\n") + sys.exit(1) + else: + print("Warning: No internet connection detected, Python dependency check will be skipped.") + + # Install esptool after dependencies + install_esptool(env, platform, penv_python, uv_executable) + + # Setup certifi environment variables + def setup_certifi_env(): + try: + import certifi + except ImportError: + print("Info: certifi not available; skipping CA environment setup.") + return + cert_path = certifi.where() + os.environ["CERTIFI_PATH"] = cert_path + os.environ["SSL_CERT_FILE"] = cert_path + os.environ["REQUESTS_CA_BUNDLE"] = cert_path + os.environ["CURL_CA_BUNDLE"] = cert_path + # Also propagate to SCons environment for future env.Execute calls + env_vars = dict(env.get("ENV", {})) + env_vars.update({ + "CERTIFI_PATH": cert_path, + "SSL_CERT_FILE": cert_path, + "REQUESTS_CA_BUNDLE": cert_path, + "CURL_CA_BUNDLE": cert_path, + }) + env.Replace(ENV=env_vars) + + setup_certifi_env() + + return penv_python, esptool_binary_path diff --git a/examples/arduino-blink/.gitignore b/examples/arduino-blink/.gitignore new file mode 100644 index 0000000..03f4a3c --- /dev/null +++ b/examples/arduino-blink/.gitignore @@ -0,0 +1 @@ +.pio diff --git a/examples/arduino-blink/platformio.ini b/examples/arduino-blink/platformio.ini index 00c055b..69dcfeb 100644 --- a/examples/arduino-blink/platformio.ini +++ b/examples/arduino-blink/platformio.ini @@ -8,39 +8,55 @@ ; http://docs.platformio.org/page/projectconf.html [env:esp32solo1] -platform = espressif32 -framework = arduino -board = esp32-solo1 -build_flags = -DLED_BUILTIN=2 -lib_ignore = wifi - spiffs - NetworkClientSecure - -custom_component_remove = - espressif/esp_hosted - espressif/esp_wifi_remote - espressif/esp-dsp - espressif/esp32-camera - espressif/libsodium - espressif/esp-modbus - espressif/qrcode - espressif/esp_insights - espressif/esp_diag_data_store - espressif/esp_diagnostics - espressif/esp_rainmaker - espressif/rmaker_common +platform = espressif32 +framework = arduino +board = esp32-solo1 +build_flags = -DLED_BUILTIN=2 +lib_ignore = wifi + ble + dsp + spiffs + NetworkClientSecure + Matter + Zigbee + ESP RainMaker +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/network_provisioning + espressif/mdns + espressif/esp-dsp + espressif/esp_modem + espressif/esp32-camera + espressif/libsodium + espressif/esp-modbus + espressif/qrcode + espressif/esp_insights + espressif/esp_diag_data_store + espressif/esp_diagnostics + espressif/cbor + espressif/esp_rainmaker + espressif/rmaker_common + chmorgan/esp-libhelix-mp3 [env:esp32-c2-devkitm-1] -platform = espressif32 -framework = arduino -board = esp32-c2-devkitm-1 -monitor_speed = 115200 -lib_ignore = wifi - spiffs - NetworkClientSecure +platform = espressif32 +framework = arduino +board = esp32-c2-devkitm-1 +monitor_speed = 115200 +lib_ignore = wifi + ble + dsp + spiffs + NetworkClientSecure + Matter + Zigbee + ESP RainMaker custom_component_remove = espressif/esp_hosted espressif/esp_wifi_remote + espressif/network_provisioning + espressif/mdns espressif/esp-dsp + espressif/esp_modem espressif/esp32-camera espressif/libsodium espressif/esp-modbus @@ -48,21 +64,31 @@ custom_component_remove = espressif/esp_hosted espressif/esp_insights espressif/esp_diag_data_store espressif/esp_diagnostics + espressif/cbor espressif/esp_rainmaker espressif/rmaker_common -custom_component_add = espressif/cmake_utilities @ 0.* + chmorgan/esp-libhelix-mp3 +custom_component_add = espressif/cmake_utilities @ 0.* [env:esp32-s3-arduino_nano_esp32] -platform = espressif32 -framework = arduino -board = arduino_nano_esp32 -monitor_speed = 115200 -lib_ignore = wifi - spiffs - NetworkClientSecure +platform = espressif32 +framework = arduino +board = arduino_nano_esp32 +monitor_speed = 115200 +lib_ignore = wifi + ble + dsp + spiffs + NetworkClientSecure + Matter + Zigbee + ESP RainMaker custom_component_remove = espressif/esp_hosted espressif/esp_wifi_remote + espressif/network_provisioning + espressif/mdns espressif/esp-dsp + espressif/esp_modem espressif/esp32-camera espressif/libsodium espressif/esp-modbus @@ -70,81 +96,143 @@ custom_component_remove = espressif/esp_hosted espressif/esp_insights espressif/esp_diag_data_store espressif/esp_diagnostics + espressif/cbor espressif/esp_rainmaker espressif/rmaker_common + chmorgan/esp-libhelix-mp3 [env:esp32s3-qio_opi_per] ; OPI Performance settings -> Display use -platform = espressif32 -framework = arduino -board = esp32s3_120_16_8-qio_opi -lib_ignore = - spiffs - NetworkClientSecure -custom_sdkconfig = CONFIG_SPIRAM_MODE_OCT=y - CONFIG_SPIRAM_SPEED_120M=y - CONFIG_LCD_RGB_ISR_IRAM_SAFE=y - CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y - CONFIG_I2S_ISR_IRAM_SAFE=y - CONFIG_GDMA_ISR_IRAM_SAFE=y - CONFIG_SPIRAM_XIP_FROM_PSRAM=y - CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y - CONFIG_SPIRAM_RODATA=y - CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y - CONFIG_ESP32S3_DATA_CACHE_64KB=y - CONFIG_ESP32S3_DATA_CACHE_LINE_64B=y -custom_component_remove = espressif/esp_hosted - espressif/esp_wifi_remote - espressif/qrcode - espressif/esp_insights - espressif/esp_diag_data_store - espressif/esp_diagnostics - espressif/esp_rainmaker - espressif/rmaker_common +platform = espressif32 +framework = arduino +board = esp32s3_120_16_8-qio_opi +lib_ignore = wifi + ble + dsp + spiffs + NetworkClientSecure + Matter + Zigbee + ESP RainMaker +custom_sdkconfig = CONFIG_SPIRAM_MODE_OCT=y + CONFIG_SPIRAM_SPEED_120M=y + CONFIG_LCD_RGB_ISR_IRAM_SAFE=y + CONFIG_GDMA_CTRL_FUNC_IN_IRAM=y + CONFIG_I2S_ISR_IRAM_SAFE=y + CONFIG_GDMA_ISR_IRAM_SAFE=y + CONFIG_SPIRAM_XIP_FROM_PSRAM=y + CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y + CONFIG_SPIRAM_RODATA=y + CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y + CONFIG_ESP32S3_DATA_CACHE_64KB=y + CONFIG_ESP32S3_DATA_CACHE_LINE_64B=y +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/network_provisioning + espressif/mdns + espressif/esp-dsp + espressif/esp_modem + espressif/esp32-camera + espressif/libsodium + espressif/esp-modbus + espressif/qrcode + espressif/esp_insights + espressif/esp_diag_data_store + espressif/esp_diagnostics + espressif/cbor + espressif/esp_rainmaker + espressif/rmaker_common + chmorgan/esp-libhelix-mp3 [env:esp32-c6-devkitc-1] -platform = espressif32 -framework = arduino -build_type = debug -board = esp32-c6-devkitc-1 -monitor_speed = 115200 -lib_ignore = wifi - spiffs - NetworkClientSecure +platform = espressif32 +framework = arduino +build_type = debug +board = esp32-c6-devkitc-1 +monitor_speed = 115200 +lib_ignore = wifi + ble + dsp + spiffs + NetworkClientSecure + Matter + Zigbee + ESP RainMaker custom_component_remove = espressif/esp_hosted espressif/esp_wifi_remote + espressif/network_provisioning espressif/mdns espressif/esp-dsp espressif/esp_modem espressif/esp32-camera + espressif/libsodium + espressif/esp-modbus + espressif/qrcode + espressif/esp_insights + espressif/esp_diag_data_store + espressif/esp_diagnostics + espressif/cbor + espressif/esp_rainmaker + espressif/rmaker_common + chmorgan/esp-libhelix-mp3 [env:esp32-h2-devkitm-1] -platform = espressif32 -framework = arduino -board = esp32-h2-devkitm-1 -monitor_speed = 115200 -lib_ignore = - spiffs - NetworkClientSecure +platform = espressif32 +framework = arduino +board = esp32-h2-devkitm-1 +monitor_speed = 115200 +lib_ignore = ble + dsp + spiffs + NetworkClientSecure + Matter + Zigbee + ESP RainMaker custom_component_remove = espressif/esp_hosted espressif/esp_wifi_remote + espressif/network_provisioning espressif/mdns espressif/esp-dsp espressif/esp_modem espressif/esp32-camera + espressif/libsodium + espressif/esp-modbus + espressif/qrcode + espressif/esp_insights + espressif/esp_diag_data_store + espressif/esp_diagnostics + espressif/cbor + espressif/esp_rainmaker + espressif/rmaker_common + chmorgan/esp-libhelix-mp3 -[env:esp32-p4] -platform = espressif32 -framework = arduino -board = esp32-p4 -build_flags = -DLED_BUILTIN=2 -lib_ignore = wifi - spiffs - NetworkClientSecure -monitor_speed = 115200 +[env:m5stack-tab5-p4] +platform = espressif32 +framework = arduino +board = m5stack-tab5-p4 +build_flags = -DLED_BUILTIN=2 +lib_ignore = wifi + ble + dsp + spiffs + NetworkClientSecure + Matter + Zigbee + ESP RainMaker custom_component_remove = espressif/esp_hosted espressif/esp_wifi_remote + espressif/network_provisioning espressif/mdns espressif/esp-dsp espressif/esp_modem espressif/esp32-camera + espressif/libsodium + espressif/esp-modbus + espressif/qrcode + espressif/esp_insights + espressif/esp_diag_data_store + espressif/esp_diagnostics + espressif/cbor + espressif/esp_rainmaker + espressif/rmaker_common + chmorgan/esp-libhelix-mp3 diff --git a/examples/arduino-matter-light/src/.gitignore b/examples/arduino-matter-light/src/.gitignore new file mode 100644 index 0000000..89cc49c --- /dev/null +++ b/examples/arduino-matter-light/src/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/examples/arduino-rmt-blink/platformio.ini b/examples/arduino-rmt-blink/platformio.ini index 699eef9..d133064 100644 --- a/examples/arduino-rmt-blink/platformio.ini +++ b/examples/arduino-rmt-blink/platformio.ini @@ -1,46 +1,84 @@ [env:esp32-s2] -platform = espressif32 -framework = arduino -board = esp32-s2-saola-1 -lib_ignore = wifi +platform = espressif32 +framework = arduino +board = esp32-s2-saola-1 +lib_ignore = ble + wifi + ESP RainMaker + ESP Insights spiffs NetworkClientSecure + Zigbee + Matter + OpenThread + dsp build_flags = -DBUILTIN_RGBLED_PIN=18 -DNR_OF_LEDS=1 [env:esp32-s3] -platform = espressif32 -framework = arduino -board = esp32-s3-devkitc-1 -lib_ignore = wifi +platform = espressif32 +framework = arduino +board = esp32-s3-devkitc-1 +lib_ignore = ble + wifi + ESP RainMaker + ESP Insights spiffs NetworkClientSecure + Zigbee + Matter + OpenThread + dsp build_flags = -DBUILTIN_RGBLED_PIN=48 -DNR_OF_LEDS=1 [env:esp32-c3] -platform = espressif32 -framework = arduino -board = esp32-c3-devkitm-1 -lib_ignore = wifi +platform = espressif32 +framework = arduino +board = esp32-c3-devkitm-1 +lib_ignore = ble + wifi + ESP RainMaker + ESP Insights spiffs NetworkClientSecure + Zigbee + Matter + OpenThread + dsp build_flags = -DBUILTIN_RGBLED_PIN=8 -DNR_OF_LEDS=1 [env:esp32-c5] -platform = espressif32 -framework = arduino -board = esp32-c5-devkitc-1 +platform = espressif32 +framework = arduino +board = esp32-c5-devkitc-1 +lib_ignore = ble + wifi + ESP RainMaker + ESP Insights + spiffs + NetworkClientSecure + Zigbee + Matter + OpenThread + dsp build_flags = -DBUILTIN_RGBLED_PIN=27 -DNR_OF_LEDS=1 [env:esp32-c6] -platform = espressif32 -framework = arduino -board = esp32-c6-devkitm-1 -lib_ignore = wifi +platform = espressif32 +framework = arduino +board = esp32-c6-devkitm-1 +lib_ignore = ble + wifi + ESP RainMaker + ESP Insights spiffs NetworkClientSecure + Zigbee + Matter + OpenThread + dsp build_flags = -DBUILTIN_RGBLED_PIN=8 -DNR_OF_LEDS=1 diff --git a/examples/arduino-usb-keyboard/.gitignore b/examples/arduino-usb-keyboard/.gitignore new file mode 100644 index 0000000..03f4a3c --- /dev/null +++ b/examples/arduino-usb-keyboard/.gitignore @@ -0,0 +1 @@ +.pio diff --git a/examples/arduino-wifiscan/.gitignore b/examples/arduino-wifiscan/.gitignore new file mode 100644 index 0000000..03f4a3c --- /dev/null +++ b/examples/arduino-wifiscan/.gitignore @@ -0,0 +1 @@ +.pio diff --git a/examples/espidf-arduino-C6-ULP-blink/.gitignore b/examples/espidf-arduino-C6-ULP-blink/.gitignore new file mode 100644 index 0000000..6bdd733 --- /dev/null +++ b/examples/espidf-arduino-C6-ULP-blink/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode +.dependencies.lock +sdkconfig.esp32c6 +managed_components diff --git a/examples/espidf-arduino-blink/.gitignore b/examples/espidf-arduino-blink/.gitignore new file mode 100644 index 0000000..03f4a3c --- /dev/null +++ b/examples/espidf-arduino-blink/.gitignore @@ -0,0 +1 @@ +.pio diff --git a/examples/espidf-arduino-littlefs/.gitignore b/examples/espidf-arduino-littlefs/.gitignore new file mode 100644 index 0000000..b9f3806 --- /dev/null +++ b/examples/espidf-arduino-littlefs/.gitignore @@ -0,0 +1,2 @@ +.pio +.vscode diff --git a/examples/espidf-arduino-wifiscan/.gitignore b/examples/espidf-arduino-wifiscan/.gitignore new file mode 100644 index 0000000..03f4a3c --- /dev/null +++ b/examples/espidf-arduino-wifiscan/.gitignore @@ -0,0 +1 @@ +.pio diff --git a/examples/espidf-blink/.gitignore b/examples/espidf-blink/.gitignore new file mode 100644 index 0000000..03f4a3c --- /dev/null +++ b/examples/espidf-blink/.gitignore @@ -0,0 +1 @@ +.pio diff --git a/examples/espidf-coap-server/.gitignore b/examples/espidf-coap-server/.gitignore new file mode 100644 index 0000000..03f4a3c --- /dev/null +++ b/examples/espidf-coap-server/.gitignore @@ -0,0 +1 @@ +.pio diff --git a/examples/espidf-coap-server/components/CMakeLists.txt b/examples/espidf-coap-server/components/CMakeLists.txt deleted file mode 100644 index f53f6b7..0000000 --- a/examples/espidf-coap-server/components/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -if(NOT CONFIG_LWIP_IPV6 AND NOT CMAKE_BUILD_EARLY_EXPANSION) - message(STATUS "IPV6 support is disabled so the coap component will not be built") - # note: the component is still included in the build so it can become visible again in config - # without needing to re-run CMake. However no source or header files are built. - idf_component_register() - return() -endif() - -set(include_dirs port/include port/include libcoap/include) - -set(srcs - "libcoap/src/block.c" - "libcoap/src/coap_address.c" - "libcoap/src/coap_asn1.c" - "libcoap/src/coap_async.c" - "libcoap/src/coap_cache.c" - "libcoap/src/coap_debug.c" - "libcoap/src/coap_event.c" - "libcoap/src/coap_hashkey.c" - "libcoap/src/coap_io.c" - "libcoap/src/coap_notls.c" - "libcoap/src/coap_option.c" - "libcoap/src/coap_prng.c" - "libcoap/src/coap_session.c" - "libcoap/src/coap_subscribe.c" - "libcoap/src/coap_tcp.c" - "libcoap/src/coap_time.c" - "libcoap/src/encode.c" - "libcoap/src/mem.c" - "libcoap/src/net.c" - "libcoap/src/pdu.c" - "libcoap/src/resource.c" - "libcoap/src/str.c" - "libcoap/src/uri.c" - "libcoap/src/coap_mbedtls.c") - -idf_component_register(SRCS "${srcs}" - INCLUDE_DIRS "${include_dirs}" - REQUIRES lwip mbedtls) -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") - diff --git a/examples/espidf-coap-server/components/Kconfig b/examples/espidf-coap-server/components/Kconfig deleted file mode 100644 index 9deb56a..0000000 --- a/examples/espidf-coap-server/components/Kconfig +++ /dev/null @@ -1,109 +0,0 @@ -menu "CoAP Configuration" - visible if LWIP_IPV6 - - choice COAP_MBEDTLS_ENCRYPTION_MODE - prompt "CoAP Encryption method" - default COAP_MBEDTLS_PSK - help - If the CoAP information is to be encrypted, the encryption environment - can be set up in one of two ways (default being Pre-Shared key mode) - - - Encrypt using defined Pre-Shared Keys (PSK if uri includes coaps://) - - Encrypt using defined Public Key Infrastructure (PKI if uri includes coaps://) - - config COAP_MBEDTLS_PSK - bool "Pre-Shared Keys" - - config COAP_MBEDTLS_PKI - bool "PKI Certificates" - - endchoice #COAP_MBEDTLS_ENCRYPTION_MODE - - config COAP_MBEDTLS_DEBUG - bool "Enable CoAP debugging" - default n - help - Enable CoAP debugging functions at compile time for the example code. - - If this option is enabled, call coap_set_log_level() - at runtime in order to enable CoAP debug output via the ESP - log mechanism. - - Note: The Mbed TLS library logging is controlled by the mbedTLS - configuration, but logging level mbedTLS must be set for CoAP - to log it. - - choice COAP_MBEDTLS_DEBUG_LEVEL - bool "Set CoAP debugging level" - depends on COAP_MBEDTLS_DEBUG - default COAP_LOG_WARNING - help - Set CoAP debugging level - - config COAP_LOG_EMERG - bool "Emergency" - config COAP_LOG_ALERT - bool "Alert" - config COAP_LOG_CRIT - bool "Critical" - config COAP_LOG_ERROR - bool "Error" - config COAP_LOG_WARNING - bool "Warning" - config COAP_LOG_NOTICE - bool "Notice" - config COAP_LOG_INFO - bool "Info" - config COAP_LOG_DEBUG - bool "Debug" - config COAP_LOG_MBEDTLS - bool "mbedTLS" - endchoice - - config COAP_LOG_DEFAULT_LEVEL - int - default 0 if !COAP_MBEDTLS_DEBUG - default 0 if COAP_LOG_EMERG - default 1 if COAP_LOG_ALERT - default 2 if COAP_LOG_CRIT - default 3 if COAP_LOG_ERROR - default 4 if COAP_LOG_WARNING - default 5 if COAP_LOG_NOTICE - default 6 if COAP_LOG_INFO - default 7 if COAP_LOG_DEBUG - default 9 if COAP_LOG_MBEDTLS - - config COAP_TCP_SUPPORT - bool "Enable TCP within CoAP" - default y - help - Enable TCP functionality for CoAP. This is required if TLS sessions - are to be used. - - If this option is disabled, redundent CoAP TCP code is removed. - - config COAP_CLIENT_SUPPORT - bool "Enable Client functionality within CoAP" - default n - help - Enable client functionality (ability to make requests and receive - responses) for CoAP. If the server is going to act as a proxy, then - this needs to be enabled to support the ongoing session going to - the next hop. - - If this option is disabled, redundent CoAP client only code is removed. - If both this option and COAP_SERVER_SUPPORT are disabled, then both - are automatically enabled for backwards compatability. - - config COAP_SERVER_SUPPORT - bool "Enable Server functionality within CoAP" - default n - help - Enable server functionality (ability to receive requests and send - responses) for CoAP. - - If this option is disabled, redundent CoAP server only code is removed. - If both this option and COAP_CLIENT_SUPPORT are disabled, then both - are automatically enabled for backwards compatability. - -endmenu diff --git a/examples/espidf-coap-server/components/LICENSE b/examples/espidf-coap-server/components/LICENSE deleted file mode 100644 index 78d2c55..0000000 --- a/examples/espidf-coap-server/components/LICENSE +++ /dev/null @@ -1,85 +0,0 @@ -Copyright (c) 2010--2022, Olaf Bergmann and others -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - o Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - o 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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"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 COPYRIGHT -HOLDER OR CONTRIBUTORS 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. - -======================================================================== -getopt.c - -License information for getopt.c. This file is only used on Windows -builds of the executables in the examples folder: - -/* - * This file was copied from the following newsgroup posting: - * - * Newsgroups: mod.std.unix - * Subject: public domain AT&T getopt source - * Date: 3 Nov 85 19:34:15 GMT - * - * Here's something you've all been waiting for: the AT&T public domain - * source for getopt(3). It is the code which was given out at the 1985 - * UNIFORUM conference in Dallas. I obtained it by electronic mail - * directly from AT&T. The people there assure me that it is indeed - * in the public domain. - */ - -======================================================================== -uthash - -libcoap uses uthash.h and utlist.h from Troy D. Hanson -(https://troydhanson.github.io/uthash/). These files use the revised -BSD license (BSD-1-Clause license) as included in these two source -files. - -======================================================================== -OpenSSL - -Binaries that are linked against OpenSSL include software developed -by the OpenSSL Project for use in the OpenSSL Toolkit. -(http://www.openssl.org/). Please consult the OpenSSL license -(https://www.openssl.org/source/license.html) for licensing terms. - -======================================================================== -GnuTLS - -When compiled with GnuTLS support, this software includes components -that are licensed under the terms of the the GNU Lesser General Public -License, version 2.1 -(https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html). - -======================================================================== -tinyDTLS - -When compiled with tinyDTLS support, this software includes components -that are licensed under the terms of the Eclipse Distribution License 1.0 -(http://www.eclipse.org/org/documents/edl-v10.php). - -======================================================================== -Mbed TLS - -When compiled with Mbed TLS support, this software includes components -that are licensed under the terms of the Apache 2.0 license -(http://www.apache.org/licenses/LICENSE-2.0). - diff --git a/examples/espidf-coap-server/components/README.md b/examples/espidf-coap-server/components/README.md deleted file mode 100644 index faab272..0000000 --- a/examples/espidf-coap-server/components/README.md +++ /dev/null @@ -1,89 +0,0 @@ -# libcoap: A C implementation of the Constrained Application Protocol (RFC 7252) - -[![Build Status: main](https://github.com/obgm/libcoap/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/obgm/libcoap/actions?query=branch:main) -[![Build Status: develop](https://github.com/obgm/libcoap/actions/workflows/main.yml/badge.svg?branch=develop)](https://github.com/obgm/libcoap/actions?query=branch:develop) -[![Static Analysis](https://scan.coverity.com/projects/10970/badge.svg?flat=1)](https://scan.coverity.com/projects/obgm-libcoap) -[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/libcoap.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:libcoap) - -Copyright (C) 2010—2022 by Olaf Bergmann and others - -ABOUT LIBCOAP -============= - -libcoap is a C implementation of a lightweight application-protocol -for devices that are constrained their resources such as computing -power, RF range, memory, bandwidth, or network packet sizes. This -protocol, CoAP, is standardized by the IETF as RFC 7252. For further -information related to CoAP, see . - -You might want to check out -[libcoap-minimal](https://github.com/obgm/libcoap-minimal) for usage -examples. - -DOCUMENTATION -============= - -Documentation and further information can be found at -. - -PACKAGE CONTENTS -================ - -This package contains a protocol parser and basic networking -functions for platforms with support for malloc() and BSD-style -sockets. In addition, there is support for Contiki, LwIP and -Espressif/ESP-IDF hosted environments. - -The following RFCs are supported - -* RFC7252: The Constrained Application Protocol (CoAP) - -* RFC7390: Group Communication for the Constrained Application Protocol (CoAP) - -* RFC7641: Observing Resources in the Constrained Application Protocol (CoAP) - -* RFC7959: Block-Wise Transfers in the Constrained Application Protocol (CoAP) - -* RFC7967: Constrained Application Protocol (CoAP) Option for No Server Response - -* RFC8132: PATCH and FETCH Methods for the Constrained Application Protocol (CoAP) - -* RFC8323: CoAP (Constrained Application Protocol) over TCP, TLS, and WebSockets - [No WebSockets support] - -* RFC8516: "Too Many Requests" Response Code for the Constrained Application Protocol - -* RFC8768: Constrained Application Protocol (CoAP) Hop-Limit Option - -* RFC9175: CoAP: Echo, Request-Tag, and Token Processing - -There is (D)TLS support for the following libraries - -* OpenSSL (Minimum version 1.1.0) [PKI, PSK and PKCS11] - -* GnuTLS (Minimum version 3.3.0) [PKI, PSK, RPK(3.6.6+) and PKCS11] - -* Mbed TLS (Minimum version 2.7.10) [PKI and PSK] - -* TinyDTLS [PSK and RPK] [DTLS Only] - -The examples directory contain a CoAP client, CoAP Resource Directory server -and a CoAP server to demonstrate the use of this library. - -BUILDING -======== - -Further information can be found at -and [BUILDING](https://raw.githubusercontent.com/obgm/libcoap/develop/BUILDING). - -LICENSE INFORMATION -=================== - -This library is published as open-source software without any warranty -of any kind. Use is permitted under the terms of the simplified BSD -license. It includes public domain software. libcoap binaries may also -include open-source software with their respective licensing terms. -Please refer to -[LICENSE](https://raw.githubusercontent.com/obgm/libcoap/develop/LICENSE) -for further details. - diff --git a/examples/espidf-coap-server/components/idf_component.yml b/examples/espidf-coap-server/components/idf_component.yml deleted file mode 100644 index 177c3ec..0000000 --- a/examples/espidf-coap-server/components/idf_component.yml +++ /dev/null @@ -1,5 +0,0 @@ -dependencies: - idf: '>=4.4' -description: Constrained Application Protocol (CoAP) C Library -url: https://github.com/espressif/idf-extra-components/tree/master/coap -version: 4.3.1~1 diff --git a/examples/espidf-coap-server/components/libcoap/AUTHORS b/examples/espidf-coap-server/components/libcoap/AUTHORS deleted file mode 100644 index d59fb86..0000000 --- a/examples/espidf-coap-server/components/libcoap/AUTHORS +++ /dev/null @@ -1,8 +0,0 @@ -Olaf Bergmann -Carsten Schnert -Jon Shallow -Jean-Claude Michelou -Christian Amsss - -For additional contributors, see -https://github.com/obgm/libcoap/graphs/contributors \ No newline at end of file diff --git a/examples/espidf-coap-server/components/libcoap/BUILDING b/examples/espidf-coap-server/components/libcoap/BUILDING deleted file mode 100644 index 4a38182..0000000 --- a/examples/espidf-coap-server/components/libcoap/BUILDING +++ /dev/null @@ -1,157 +0,0 @@ -For Windows builds - see the Windows Section - -Obtaining the Libcoap Source -============================ - -To get the libcoap library source, you need to do either the following - -* Obtain the latest distribution package file from - https://github.com/obgm/libcoap/archive/develop.zip - [There is a stable version at - https://github.com/obgm/libcoap/archive/main.zip] -* Change to the directory that you want to install the libcoap sub-directory - into -* Unpack the distribution package file -* Change into the top level directory of the unpackaged files - -or alternatively, clone the libcoap git repository from github - -* Change to the directory that you want to install the libcoap sub-directory - into. -* Then clone the latest (develop) version of the code:- - git clone https://github.com/obgm/libcoap.git -* Change into the top level directory of the cloned files -* Optionally, change the branch from develop to the stable main branch:- - git checkout main - -Building Libcoap Libraries and Examples -======================================= - -Follow the appropriate sections below - - -TinyDTLS Only -============= - -It is possible that you may need to execute the following two commands once to -get the TinyDTLS code into your project, so the TinyDTLS library can be used. - - git submodule init - git submodule update - -General Building with cmake for linux/windows/macos/android (not for LwIP or Contiki - see below) -================ - - cmake -E remove_directory build - cmake -E make_directory build - cd build - cmake .. -DENABLE_TESTS=ON - cmake --build . - [sudo] cmake --build . -- install - cd .. - - Note: to see possible options (TLS lib, doc, tests, examples etc.): - cmake -LH build - - Note: For Windows, this is supported by Visual Studio Code with CMake extension - Note: You must use cmake version >=3.10. - - Note: you can use cmake's find package after installation: find_package(libcoap-2 REQUIRED), - and target_link_libraries(myTarget PRIVATE libcoap::coap-2) - - Note: Shared Library support is not currently available for Windows. - -General Building with autoconf (not for LwIP or Contiki - see below) -================ - - ./autogen.sh - ./configure - make - sudo make install - -./autogen.sh will fail if there is a required package for buildling libcoap -that is missing. Install the missing package and try ./autogen.sh again. - -It is possible that you may need to provide some options to ./configure -to customize your installation. - -In particular you may need to define which (D)TLS library to use as well as -disable some building of documentation. - -General configure instructions can be found in INSTALL, which is built -by ./autogen.sh - - ./configure --help -gives the specific options available to libcoap. - -Some examples are:- - -# No DTLS - ./configure --enable-tests --disable-documentation --enable-examples --disable-dtls --enable-shared - -# With TinyDTLS - ./configure --enable-tests --disable-documentation --enable-examples --with-tinydtls --enable-shared - -Note: FreeBSD requires gmake instead of make when building TinyDTLS - i.e. - gmake - sudo gmake install - -# With OpenSSL - ./configure --with-openssl --enable-tests --enable-shared - -# With GnuTLS - ./configure --with-gnutls --enable-tests --enable-shared - -Note: --disable-documentation disables the building of doxygen and man page -files. If you want to only disable one of them, use --disable-doxygen or ---disable-manpages. Doxygen requires the program doxygen and man pages require -the program a2x to build the appropriate files. - -If you need to rebuild the libcoap-*.{map,sym} files to update any exposed -function changes, run - - make update-map-file - -prior to running 'make'. - -LwIP -==== - - ./autogen.sh - ./configure --disable-tests --disable-documentation --disable-examples --disable-dtls - cd examples/lwip - make - -Executable is ./server. See examples/lwip/README for further information - -Contiki -======= - - ./autogen.sh - ./configure --disable-tests --disable-documentation --disable-examples --disable-dtls - cd examples/contiki - make - -Executable is ./server.minimal-net. See examples/contiki/README for further -information - -Windows -======= - -Install OpenSSL (minimum version 1.1.0) including the development libraries if -not already installed. - -Within Visual Studio, "Clone or check out code" using the repository -https://github.com/obgm/libcoap.git - -You may need to update the SDK version of the libcoap Windows Project files to -match that of the SDK version of the Visual Studio you are using. In Solution -Explorer with the view set to libcoap.sln, right click "Solution 'libcoap'" -and then "Retarget solution". - -You may need to edit win32\libcoap.props to update the OpenSSLRootDir and -OpenSSLRootDirDbg variables to point to the top level directory where OpenSSL -is installed so that the include, lib etc. directories are correctly set up. -Note: Make sure that you include a trailing \ in the variable definitions. - -Alternatively you can build everything in Visual Studio with CMake. diff --git a/examples/espidf-coap-server/components/libcoap/CMakeLists.txt b/examples/espidf-coap-server/components/libcoap/CMakeLists.txt deleted file mode 100644 index 606e1dd..0000000 --- a/examples/espidf-coap-server/components/libcoap/CMakeLists.txt +++ /dev/null @@ -1,723 +0,0 @@ -# CMakeLists.txt for libcoap -# -# Copyright (C) 2020 Carlos Gomes Martinho -# Copyright (C) 2020-2022 Jon Shallow -# -# SPDX-License-Identifier: BSD-2-Clause -# -# This file is part of the CoAP library libcoap. Please see README for terms -# of use. - -cmake_minimum_required(VERSION 3.10) - -project( - libcoap - VERSION 4.3.1 - LANGUAGES CXX C) - -set(LIBCOAP_API_VERSION 3) -set(COAP_LIBRARY_NAME "coap-${LIBCOAP_API_VERSION}") - -option( - BUILD_SHARED_LIBS - "Build shared libs" - OFF) - -add_library(${COAP_LIBRARY_NAME}) - -# -# options to tweak the library -# - -option( - ENABLE_DTLS - "Enable building with DTLS support" - ON) -set(DTLS_BACKEND - "default" - CACHE - STRING - "\ -Name of the dtls backend, only relevant if `ENABLE_DTLS` is ON which is default. \ -Possible values: default, gnutls, openssl, tinydtls and mbedtls. \ -If specified then this library will be searched and if found also used. \ -If not found then the cmake configuration will stop with an error. \ -If not specified, then cmake will try to use the first one found in the following order: \ -gnutls, openssl, tinydtls, mbedtls \ - ") -set_property( - CACHE DTLS_BACKEND - PROPERTY STRINGS - default - openssl - gnutls - tinydtls - mbedtls) -option( - USE_VENDORED_TINYDTLS - "compile with the tinydtls project in the submodule if on, otherwise try to find the compiled lib with find_package" - ON) -option( - ENABLE_CLIENT_MODE - "compile with support for client mode code" - ON) -option( - ENABLE_SERVER_MODE - "compile with support for server mode code" - ON) -option( - WITH_EPOLL - "compile with epoll support" - ON) -option( - ENABLE_SMALL_STACK - "Define if the system has small stack size" - OFF) -option( - ENABLE_TCP - "Enable building with TCP support" - ON) -option( - ENABLE_TESTS - "build also tests" - OFF) -option( - ENABLE_EXAMPLES - "build also examples" - ON) -option( - ENABLE_DOCS - "build also doxygen documentation" - ON) - -if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 11) -endif() - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Debug) -endif() - -if(MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS) -endif() - -if(APPLE) - add_definitions(-D__APPLE_USE_RFC_3542=1) -endif() - -list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_BINARY_DIR}) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) - -include(CheckCSourceCompiles) -include(CheckFunctionExists) -include(CheckIncludeFile) -include(CheckSymbolExists) -include(CheckTypeSize) -include(TestBigEndian) - -# check for headers -check_include_file(byteswap.h HAVE_BYTESWAP_H) -check_include_file(inttypes.h HAVE_INTTYPES_H) -check_include_file(limits.h HAVE_LIMITS_H) -check_include_file(memory.h HAVE_MEMORY_H) -check_include_file(strings.h HAVE_STRINGS_H) -check_include_file(string.h HAVE_STRING_H) -check_include_file(sys/sysctl.h HAVE_SYS_SYSCTL_H) -check_include_file(net/if.h HAVE_NET_IF_H) -check_include_file(netinet/in.h HAVE_NETINET_IN_H) -check_include_file(sys/epoll.h HAVE_EPOLL_H) -check_include_file(sys/timerfd.h HAVE_TIMERFD_H) -check_include_file(arpa/inet.h HAVE_ARPA_INET_H) -check_include_file(stdbool.h HAVE_STDBOOL_H) -check_include_file(netdb.h HAVE_NETDB_H) -check_include_file(pthread.h HAVE_PTHREAD_H) -check_include_file(stdlib.h HAVE_STDINT_H) -check_include_file(stdint.h HAVE_STDLIB_H) -check_include_file(syslog.h HAVE_SYSLOG_H) -check_include_file(sys/ioctl.h HAVE_SYS_IOCTL_H) -check_include_file(sys/socket.h HAVE_SYS_SOCKET_H) -check_include_file(sys/stat.h HAVE_SYS_STAT_H) -check_include_file(sys/time.h HAVE_SYS_TIME_H) -check_include_file(sys/types.h HAVE_SYS_TYPES_H) -check_include_file(sys/unistd.h HAVE_SYS_UNISTD_H) -check_include_file(time.h HAVE_TIME_H) -check_include_file(unistd.h HAVE_UNISTD_H) -check_include_file(float.h HAVE_FLOAT_H) -check_include_file(stddef.h HAVE_STDDEF_H) -check_include_file(winsock2.h HAVE_WINSOCK2_H) -check_include_file(ws2tcpip.h HAVE_WS2TCPIP_H) - -# check for functions -check_function_exists(malloc HAVE_MALLOC) -check_function_exists(memset HAVE_MEMSET) -check_function_exists(select HAVE_SELECT) -check_function_exists(socket HAVE_SOCKET) -check_function_exists(strcasecmp HAVE_STRCASECMP) -check_function_exists(pthread_mutex_lock HAVE_PTHREAD_MUTEX_LOCK) -check_function_exists(getaddrinfo HAVE_GETADDRINFO) -check_function_exists(strnlen HAVE_STRNLEN) -check_function_exists(strrchr HAVE_STRRCHR) -check_function_exists(getrandom HAVE_GETRANDOM) -check_function_exists(if_nametoindex HAVE_IF_NAMETOINDEX) - -# check for symbols -if(WIN32) - set(HAVE_STRUCT_CMSGHDR 1) -else() - check_symbol_exists( - CMSG_FIRSTHDR - sys/socket.h - HAVE_STRUCT_CMSGHDR) -endif() - -if(${ENABLE_CLIENT_MODE}) - set(COAP_CLIENT_SUPPORT "1") - message(STATUS "compiling with client support") -else() - message(STATUS "compiling without client support") -endif() - -if(${ENABLE_SERVER_MODE}) - set(COAP_SERVER_SUPPORT "1") - message(STATUS "compiling with server support") -else() - message(STATUS "compiling without server support") -endif() - -if(${WITH_EPOLL} - AND ${HAVE_EPOLL_H} - AND ${HAVE_TIMERFD_H}) - set(COAP_EPOLL_SUPPORT "1") - message(STATUS "compiling with epoll support") -else() - message(STATUS "compiling without epoll support") -endif() - -if(ENABLE_SMALL_STACK) - set(ENABLE_SMALL_STACK "${ENABLE_SMALL_STACK}") - message(STATUS "compiling with small stack support") -endif() - -set(WITH_GNUTLS OFF) -set(WITH_OPENSSL OFF) -set(WITH_TINYDTLS OFF) -set(WITH_MBEDTLS OFF) - -function(compile_tinydtls) - set(TINYDTLS_SOURCES_DIR ${CMAKE_CURRENT_LIST_DIR}/ext/tinydtls) - set(TINYDTLS_SOURCES_GENERATED ${TINYDTLS_SOURCES_DIR}/dtls_config.h) - - message(STATUS "compiling the tinydtls lib") - - include(ExternalProject) - - externalproject_add( - external_tinydtls - SOURCE_DIR "${TINYDTLS_SOURCES_DIR}" - BUILD_IN_SOURCE 1 - DOWNLOAD_COMMAND "" - UPDATE_COMMAND "" - CONFIGURE_COMMAND - ${TINYDTLS_SOURCES_DIR}/configure - --disable-manpages - --prefix=${CMAKE_BINARY_DIR} - BUILD_COMMAND make install - INSTALL_COMMAND "" - LOG_DOWNLOAD 1 - LOG_CONFIGURE 1) - - externalproject_add_step( - external_tinydtls autoreconf - COMMAND autoreconf --force --install - ALWAYS 1 - WORKING_DIRECTORY "${TINYDTLS_SOURCES_DIR}" - DEPENDERS configure - DEPENDEES download) - - # Let cmake know that it needs to execute the external_tinydtls target to generate those files. - add_custom_command( - OUTPUT ${TINYDTLS_SOURCES_GENERATED} - WORKING_DIRECTORY "${TINYDTLS_SOURCES_DIR}" - COMMAND "make install" - DEPENDS external_tinydtls) - - add_dependencies(${COAP_LIBRARY_NAME} external_tinydtls) - - if(BUILD_SHARED_LIBS) - set(LIBTINYDTLS_PATH "${CMAKE_CURRENT_BINARY_DIR}/lib/libtinydtls.so") - else() - set(LIBTINYDTLS_PATH "${CMAKE_CURRENT_BINARY_DIR}/lib/libtinydtls.a") - endif() - - add_library( - tinydtls - UNKNOWN - IMPORTED) - set_target_properties( - tinydtls - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${CMAKE_CURRENT_BINARY_DIR}/include" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${LIBTINYDTLS_PATH}") - -endfunction() - -if(ENABLE_DTLS) - message(STATUS "compiling with DTLS support") - message(STATUS "DTLS_BACKEND: ${DTLS_BACKEND}") - - if(DTLS_BACKEND - STREQUAL - "default") - # try to find a crypto lib and use it, use the first one found - - # libgnutls (e.g. debian libgnutls28-dev) - find_package(GnuTLS) - if(GnuTLS_FOUND) - set(WITH_GNUTLS ON) - message(STATUS "compiling with gnutls support") - set(HAVE_LIBGNUTLS 1) - else() - # gnutls not found - find_package(OpenSSL) - if(OpenSSL_FOUND) - set(WITH_OPENSSL ON) - message(STATUS "compiling with openssl support") - set(HAVE_OPENSSL 1) - else() - # openssl not found - # libmbedtls (e.g. debian libmbedtls-dev) - find_package(MbedTLS) - if(MbedTLS_FOUND) - set(WITH_MBEDTLS ON) - message(STATUS "compiling with mbedtls support") - set(HAVE_MBEDTLS 1) - else() - # mbedtls not found - if(USE_VENDORED_TINYDTLS) - compile_tinydtls() - else() - find_package(TinyDTLS) - if(TINYDTLS_FOUND) - - else() - # no cryto lib found - message( - FATAL_ERROR - "cannot find any cryto lib, either install one or compile without DTLS support" - ) - endif() - - endif() - - set(WITH_TINYDTLS ON) - message(STATUS "compiling with tinydtls support") - set(HAVE_LIBTINYDTLS 1) - - endif() - - endif() - - endif() - - else() - # DTLS_BACKEND variable is not empty, so set all to false and set the only right to true - set(WITH_GNUTLS OFF) - set(WITH_TINYDTLS OFF) - set(WITH_MBEDTLS OFF) - set(WITH_OPENSSL OFF) - - if(DTLS_BACKEND - STREQUAL - "gnutls") - # libgnutls (e.g. debian libgnutls28-dev) - find_package(GnuTLS REQUIRED) - set(WITH_GNUTLS ON) - message(STATUS "compiling with gnutls support") - set(HAVE_LIBGNUTLS 1) - endif() - - if(DTLS_BACKEND - STREQUAL - "openssl") - # libssl (e.g. debian libssl1.0-dev) - find_package(OpenSSL REQUIRED) - set(WITH_OPENSSL ON) - message(STATUS "compiling with openssl support") - set(HAVE_OPENSSL 1) - endif() - - if(DTLS_BACKEND - STREQUAL - "mbedtls") - # libmbedtls (e.g. debian libmbedtls-dev) - find_package(MbedTLS REQUIRED) - set(WITH_MBEDTLS ON) - message(STATUS "compiling with mbedtls support") - set(HAVE_MBEDTLS 1) - endif() - - if(DTLS_BACKEND - STREQUAL - "tinydtls") - - if(USE_VENDORED_TINYDTLS) - compile_tinydtls() - else(USE_VENDORED_TINYDTLS) - find_package(TinyDTLS REQUIRED) - endif(USE_VENDORED_TINYDTLS) - - message(STATUS "compiling with tinydtls support") - set(WITH_TINYDTLS ON) - set(HAVE_LIBTINYDTLS 1) - - endif() - - endif() - -endif() - -execute_process(COMMAND git describe --tags --dirty --always - RESULT_VARIABLE USING_GIT - OUTPUT_VARIABLE LIBCOAP_PACKAGE_BUILD - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_QUIET) -if(NOT ${USING_GIT} EQUAL 0) - set(LIBCOAP_PACKAGE_BUILD ${PROJECT_VERSION}) -else() - set(LIBCOAP_PACKAGE_BUILD "${LIBCOAP_PACKAGE_BUILD}") -endif() - -set(PACKAGE_URL "https://libcoap.net/") -set(PACKAGE_NAME "${PROJECT_NAME}") -set(PACKAGE_TARNAME "${PROJECT_NAME}") -set(PACKAGE_STRING "${PROJECT_NAME} ${PROJECT_VERSION}") -set(PACKAGE_VERSION "${PROJECT_VERSION}") -set(PACKAGE_BUGREPORT "libcoap-developers@lists.sourceforge.net") -set(LIBCOAP_PACKAGE_VERSION "${PACKAGE_VERSION}") -set(LIBCOAP_PACKAGE_URL "${PACKAGE_URL}") -set(LIBCOAP_PACKAGE_NAME "${PACKAGE_NAME}") -set(LIBCOAP_PACKAGE_STRING "${PACKAGE_STRING}") -set(LIBCOAP_PACKAGE_BUGREPORT "${PACKAGE_BUGREPORT}") - -message(STATUS "PACKAGE VERSION..................${PACKAGE_VERSION}") -message(STATUS "PACKAGE BUILD....................${LIBCOAP_PACKAGE_BUILD}") -message(STATUS "ENABLE_DTLS:.....................${ENABLE_DTLS}") -message(STATUS "ENABLE_TCP:......................${ENABLE_TCP}") -message(STATUS "ENABLE_CLIENT_MODE:..............${ENABLE_CLIENT_MODE}") -message(STATUS "ENABLE_SERVER_MODE:..............${ENABLE_SERVER_MODE}") -message(STATUS "ENABLE_DOCS:.....................${ENABLE_DOCS}") -message(STATUS "ENABLE_EXAMPLES:.................${ENABLE_EXAMPLES}") -message(STATUS "DTLS_BACKEND:....................${DTLS_BACKEND}") -message(STATUS "WITH_GNUTLS:.....................${WITH_GNUTLS}") -message(STATUS "WITH_TINYDTLS:...................${WITH_TINYDTLS}") -message(STATUS "WITH_OPENSSL:....................${WITH_OPENSSL}") -message(STATUS "WITH_MBEDTLS:....................${WITH_MBEDTLS}") -message(STATUS "HAVE_LIBTINYDTLS:................${HAVE_LIBTINYDTLS}") -message(STATUS "HAVE_LIBGNUTLS:..................${HAVE_LIBGNUTLS}") -message(STATUS "HAVE_OPENSSL:....................${HAVE_OPENSSL}") -message(STATUS "HAVE_MBEDTLS:....................${HAVE_MBEDTLS}") -message(STATUS "WITH_EPOLL:......................${WITH_EPOLL}") -message(STATUS "CMAKE_C_COMPILER:................${CMAKE_C_COMPILER}") -message(STATUS "BUILD_SHARED_LIBS:...............${BUILD_SHARED_LIBS}") -message(STATUS "CMAKE_BUILD_TYPE:................${CMAKE_BUILD_TYPE}") -message(STATUS "CMAKE_SYSTEM_PROCESSOR:..........${CMAKE_SYSTEM_PROCESSOR}") - -set(top_srcdir "${CMAKE_CURRENT_LIST_DIR}") -set(top_builddir "${CMAKE_CURRENT_BINARY_DIR}") -if(ENABLE_TCP) - set(COAP_DISABLE_TCP 0) -else(ENABLE_TCP) - set(COAP_DISABLE_TCP 1) -endif(ENABLE_TCP) - -# creates config header file in build directory -configure_file(${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap.h.in - ${CMAKE_CURRENT_BINARY_DIR}/include/coap${LIBCOAP_API_VERSION}/coap.h) - -configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake_coap_config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/coap_config.h) - -configure_file(${CMAKE_CURRENT_LIST_DIR}/tests/test_common.h.in - ${CMAKE_CURRENT_LIST_DIR}/tests/test_common.h) - -# -# sources -# - -target_sources( - ${COAP_LIBRARY_NAME} - PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src/coap_address.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_asn1.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_async.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_cache.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_debug.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_event.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_hashkey.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_io.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_notls.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_option.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_prng.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_session.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_subscribe.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_tcp.c - ${CMAKE_CURRENT_LIST_DIR}/src/coap_time.c - ${CMAKE_CURRENT_LIST_DIR}/src/block.c - ${CMAKE_CURRENT_LIST_DIR}/src/encode.c - ${CMAKE_CURRENT_LIST_DIR}/src/mem.c - ${CMAKE_CURRENT_LIST_DIR}/src/net.c - ${CMAKE_CURRENT_LIST_DIR}/src/pdu.c - ${CMAKE_CURRENT_LIST_DIR}/src/resource.c - ${CMAKE_CURRENT_LIST_DIR}/src/str.c - ${CMAKE_CURRENT_LIST_DIR}/src/uri.c - # no need to parse those files if we do not need them - $<$:${CMAKE_CURRENT_LIST_DIR}/src/coap_openssl.c> - $<$:${CMAKE_CURRENT_LIST_DIR}/src/coap_tinydtls.c> - $<$:${CMAKE_CURRENT_LIST_DIR}/src/coap_gnutls.c> - $<$:${CMAKE_CURRENT_LIST_DIR}/src/coap_mbedtls.c> - # headers - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_address.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_async.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_cache.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_debug.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_dtls.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_event.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_hashkey.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_io.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_option.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_prng.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_session.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_subscribe.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/coap_time.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/block.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/encode.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/libcoap.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/lwippools.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/mem.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/net.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/pdu.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/resource.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/str.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/uri.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/uthash.h - ${CMAKE_CURRENT_LIST_DIR}/include/coap${LIBCOAP_API_VERSION}/utlist.h) -target_include_directories( - ${COAP_LIBRARY_NAME} - PUBLIC # config headers are generated during configuration time - $ - $ - $ - $ - $<$,$>:${CMAKE_BINARY_DIR}/include/tinydtls> - $<$:${GNUTLS_INCLUDE_DIR}> - $<$:${MBEDTLS_INCLUDE_DIRS}>) -target_link_libraries( - ${COAP_LIBRARY_NAME} - PUBLIC $<$:OpenSSL::SSL> - $<$:OpenSSL::Crypto> - $<$:${GNUTLS_LIBRARIES}> - $<$:tinydtls> - $<$:${MBEDTLS_LIBRARY}> - $<$:${MBEDX509_LIBRARY}> - $<$:${MBEDCRYPTO_LIBRARY}>) - -target_compile_options( - ${COAP_LIBRARY_NAME} - PUBLIC -DLIBCOAP_PACKAGE_BUILD="${LIBCOAP_PACKAGE_BUILD}") - -add_library( - ${PROJECT_NAME}::${COAP_LIBRARY_NAME} - ALIAS - ${COAP_LIBRARY_NAME}) - -# -# compiler options -# - -add_compile_options( - $<$,$>:-pedantic> - $<$,$>:-Wall> - $<$,$>:-Wcast-qual> - $<$,$>:-Wextra> - $<$,$>:-Wformat-security> - $<$,$>:-Winline> - $<$,$>:-Wmissing-declarations> - $<$,$>:-Wmissing-prototypes> - $<$,$>:-Wnested-externs> - $<$,$>:-Wpointer-arith> - $<$,$>:-Wshadow> - $<$,$>:-Wstrict-prototypes> - $<$,$>:-Wswitch-default> - $<$,$>:-Wswitch-enum> - $<$,$>:-Wunused> - $<$,$>:-Wwrite-strings>) - -# -# tests -# - -if(ENABLE_TESTS) - add_executable( - testdriver - ${CMAKE_CURRENT_LIST_DIR}/tests/testdriver.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_common.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_encode.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_encode.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_error_response.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_error_response.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_options.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_options.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_pdu.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_pdu.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_sendqueue.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_sendqueue.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_session.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_session.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_tls.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_tls.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_uri.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_uri.h - ${CMAKE_CURRENT_LIST_DIR}/tests/test_wellknown.c - ${CMAKE_CURRENT_LIST_DIR}/tests/test_wellknown.h) - # tests require libcunit (e.g. debian libcunit1-dev) - target_link_libraries(testdriver PUBLIC ${PROJECT_NAME}::${COAP_LIBRARY_NAME} - -lcunit) -endif() - -# -# examples -# - -if(ENABLE_EXAMPLES) - add_executable(coap-client ${CMAKE_CURRENT_LIST_DIR}/examples/coap-client.c) - target_link_libraries(coap-client - PUBLIC ${PROJECT_NAME}::${COAP_LIBRARY_NAME}) - - add_executable(coap-rd ${CMAKE_CURRENT_LIST_DIR}/examples/coap-rd.c) - target_include_directories(coap-rd - PRIVATE - $) - target_link_libraries(coap-rd PUBLIC ${PROJECT_NAME}::${COAP_LIBRARY_NAME}) - - add_executable(coap-server ${CMAKE_CURRENT_LIST_DIR}/examples/coap-server.c) - target_link_libraries(coap-server - PUBLIC ${PROJECT_NAME}::${COAP_LIBRARY_NAME}) - - if(NOT WIN32) - add_executable(etsi_iot_01 ${CMAKE_CURRENT_LIST_DIR}/examples/etsi_iot_01.c) - target_link_libraries(etsi_iot_01 - PUBLIC ${PROJECT_NAME}::${COAP_LIBRARY_NAME}) - - add_executable(tiny ${CMAKE_CURRENT_LIST_DIR}/examples/tiny.c) - target_link_libraries(tiny PUBLIC ${PROJECT_NAME}::${COAP_LIBRARY_NAME}) - endif() -endif() - -# -# docs -# - -if(ENABLE_DOCS) - find_package(Doxygen) - - if(Doxygen_FOUND) - # set input and output files - set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in) - set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) - - # Make necessary temporary directories - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/doc/man_tmp) - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/doc/man_html) - - # request to configure the file - configure_file( - ${DOXYGEN_IN} - ${DOXYGEN_OUT} - @ONLY) - - # note the option ALL which allows to build the docs together with the - # application - add_custom_target( - doc_doxygen ALL - COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating API documentation with Doxygen" - VERBATIM) - - message(STATUS "Setup up the Doxygen documention build") - - else(Doxygen_FOUND) - message( - WARNING - "Doxygen need to be installed to generate the doxygen documentation") - endif(Doxygen_FOUND) - -endif() - -# -# install -# - -include(GNUInstallDirs) -include(CMakePackageConfigHelpers) - -set(LIBCOAP_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) -install( - TARGETS ${COAP_LIBRARY_NAME} - EXPORT ${PROJECT_NAME}Targets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib) - -install( - EXPORT ${PROJECT_NAME}Targets - DESTINATION ${LIBCOAP_CONFIG_INSTALL_DIR} - NAMESPACE ${PROJECT_NAME}:: - COMPONENT dev) - -configure_package_config_file( - cmake/Config.cmake.in - ${PROJECT_NAME}Config.cmake - INSTALL_DESTINATION - ${LIBCOAP_CONFIG_INSTALL_DIR}) -write_basic_package_version_file( - ${PROJECT_NAME}ConfigVersion.cmake - COMPATIBILITY SameMajorVersion) -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake - DESTINATION ${LIBCOAP_CONFIG_INSTALL_DIR} - COMPONENT dev) - -install( - DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - COMPONENT dev - FILES_MATCHING - PATTERN "*.h" - PATTERN "coap.h" EXCLUDE - PATTERN "coap_riot.h" EXCLUDE - PATTERN "lwippools.h" EXCLUDE - PATTERN "utlist.h" EXCLUDE - PATTERN "uthash.h" EXCLUDE - PATTERN "*_internal.h" EXCLUDE) -install( - DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - COMPONENT dev - FILES_MATCHING - PATTERN "*.h") -if(ENABLE_EXAMPLES) - install( - TARGETS coap-server coap-client coap-rd - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT dev) - if(NOT WIN32) - install( - TARGETS etsi_iot_01 tiny - DESTINATION ${CMAKE_INSTALL_BINDIR} - COMPONENT dev) - endif() -endif() diff --git a/examples/espidf-coap-server/components/libcoap/CONTRIBUTE b/examples/espidf-coap-server/components/libcoap/CONTRIBUTE deleted file mode 100644 index d7319e9..0000000 --- a/examples/espidf-coap-server/components/libcoap/CONTRIBUTE +++ /dev/null @@ -1,218 +0,0 @@ - ####################################################### - # Developer information for contributing to libcoap # - ####################################################### - -1. The basics -~~~~~~~~~~~~~ -The libcoap project is a FOSS project that is dual licensed. The maintainer -for the libcoap is Olaf Bergmann . -Any contributions have to be made under the terms of the -license - - * BSD 2-Clause (The BSD 2-Clause License) - -Contributions made up to 2017-06-01 have been made under the dual -license model BSD 2-Clause and GPL v2+ (The GNU General Public License -2.0 or later). - -The used VCS for libcoap is Git, the main repository is living on GitHub. -You can clone (or fork directly on GitHub) on the repository site: - - https://github.com/obgm/libcoap - -Please refer also to the libcoap website for additional information - - https://libcoap.net/ - -The build environment is grounded on the classical autotools, the GNU GCC and -the LLVM C-compiler (CLang) are supported. The Windows systems are not -currently supported (until someone is creating support for it). - -Doxygen is used for creating a HTML based online documentation of the -libcoap library. - -2. Communications -~~~~~~~~~~~~~~~~~ -The main discussion and development platform for libcoap is the mailing list -on Sourceforge. -No matter if you just have a simple question, some specific problem or -want to discuss some patches, please write it to the mailing list. Please -avoid personal mailings to the maintainer (or some other contributor) if -your questions will probably be in the interest of other users too. -You can subscribe to the list here: - - https://lists.sourceforge.net/lists/listinfo/libcoap-developers - -The archive of the list can be found on: - - https://sourceforge.net/p/libcoap/mailman/libcoap-developers - -3. Starting contributing -~~~~~~~~~~~~~~~~~~~~~~~~ -As written above libcoap is maintained with the Git tools so you should be -familiar with the various git commands. -The libcoap project is using just two main branches, the 'main' branch is -holding the point releases, all the development process is going on in the -'develop' branch. -To start any contributing you first have to clone the git tree from the main -repository on GitHub: - - git clone https://github.com/obgm/libcoap.git - -4. Working on the source -~~~~~~~~~~~~~~~~~~~~~~~~ -As one golden rule you should work on improvements within *your* own local -development branch! To do so you have to first checkout the 'develop' branch -as local branch and then start on top on this branch your own branch. So -create (or better say checkout) the local 'develop' branch: - - cd libcoap - git checkout develop origin/develop - -Now you can simply start your own local branch (for example 'my-develop') -with the 'origin/develop' as parent so you can later create the patches -against the the upstream development branch: - - git checkout -b my-develop - -At this point you can now work as known with git, modify the source, commit -the changes, amend if needed and test your work. -At some point you will have to generate patches to post them on the mailing -list (and/or push your changes into your public Git tree). It's a good idea to -post your patch series on the mailing list so other contributors will see your -work and give further suggestions or discuss your work. - -To be able to send a patch series you will now create the series itself as -single patches, this will be going easy with the 'git format-patch' command -against the 'develop' branch, remind this is the upstream main development -branch. -To not mix up your series with probably unrelated patches let git place the -patches within a defined directory. Also, while create the patches, tell git to -create a cover letter patch so you can append some introducing words that will -hold probably explanations why you create the patches in the way you have done. - - git format-patch --cover-letter -o ../patches4libcoap - -This command will create a patch series in ../patches4libcoap where you find a -patch named '0000-cover-letter.patch'. Please modify this patch with some -useful information's for the mailing list. After finish this you now can send -your patches to libcoap-developers@lists.sourceforge.net - - git send-email ../patches4libcoap/* --to=libcoap-developers@lists.sourceforge.net - -5. Coding rules -~~~~~~~~~~~~~~~ -As every FOSS project the libcoap project needs also some rules for coding. -There are loss but the main of them are important! - -5.1 License and Copyright -------------------------- -Every new file must contain a license and the copyright holder(s). Please -take a look into existing files and adopt the needed changes to your new -file(s). - -5.2 Source Code Indentation ---------------------------- -* For better reading the indentation is set to 2 characters as spaces, this - is depended on the often used nested functions like 'if-else'. Don't use - TABs any there! Avoid trailing white spaces at the end of a line. - It's appropriate to set up a modline like this one at first line within - the source file: - ---8<---- -/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ ---->8-- - -* Single lines within the source code should not be longer then 78 - characters. - -* If there a functions with a lot of parameters that do not fit into the above - rule split the declaration (in the *.h) and the implementation (in the *.c) - into single lines per parameter. For example like this (from src/block.c): - ---8<---- -int -coap_add_block(coap_pdu_t *pdu, - unsigned int len, - const unsigned char *data, - unsigned int block_num, - unsigned char block_szx); ---->8-- - -5.3 Source Code Documentation ------------------------------ -* A useful source code documentation is mandatory. Mostly to be done within the - source code files, but more complex description should be done in extra - README files. - -* Please set up/adjust the doxygen documentation if you create new functions or - change existing functions. The doxygen documentation has to be done in the - header files as they are the public part of the libcoap and only use the - @-syntax for doxygen commands (akin to javadoc). - -5.4 API Changes ---------------- -* Never break the API! - Don't remove old functions and if there some changes are needed in some kind - always provide a wrapper for the old call to let the library be backward - compatible and mark the old function as @deprecated in the doxygen comment. - Please discuss needed changes on the mailing list. - -5.5 Patches and Commits ------------------------ -* Git commits must be atomic and contain a declarative subject line (max 50 - characters if possible) and a body for a statement if needed. - Use the possibility to write a good explanation why your patch/commit is - handle the changes in the way you have done. Remind that other user can - read your code but not necessary understand why the code is written this - way. Don't use something to generic like "bugfix commit". - -* A patch/commit or a series of patches/commits have to ensure that the - whole project is able to build up every thing, in short: Do not break - any make target and test your work. - -* Every patch/commit should handle one single logical change. If more than - one patch/commit is needed for a change explain it, respect the point - above. If your subject line become much larger than 50 characters then - typically your patch is to big for one single commit. - -* Commit message should begin with a submodule or unit the commit is for. By - this your commit message helps to find thematic other changes. If you have - to search and find something with 'git log | grep [foo]' you will see why - this is useful. Examples: - - rd.c: Fixed type-specifier warning - Makefile.am: Added missing src/address.c - address.[hc]: make coap_address_equals() not inline on POSIX - -6. Where to start contributing? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -There are various things you could starting on to contribute, the best -is you simply pick up an issue you blindly see and just improve the -situation. Please take also a look into the file TODO and choose a point -from there or point the maintainer to add other things here too. - -* Documentation -We are always lacking on a better documentation on the source code, so -maybe you can improve the doxygen documentation. -Also a good documentation on the usage of the libcoap and the example -binaries is always improvable. So we appreciate any help on this. - -* Manual Pages -The source is providing some example binaries which originally just should show -how the libcoap can be used. Right now these binaries are fully usable and -quite more than simple examples on a system. There are man pages for these -binaries available, if you found there is a improvement needed please do so and -write to the mailing list explained in section 2. -Maybe you can write up some good HowTo's on the usage for these binaries. - -* HowTo's -The libcoap library has now a lot of functions you can use. -Unfortunately there is no good user guide on how to use the libcoap in -any external project. This means there is no HowTo or CheatSheet for a -programming person available. You want to write up something? - -* Missing functionality -There are some features that are still missing inside the libcoap. For -example some DTLS implementations and proxy functionality. - diff --git a/examples/espidf-coap-server/components/libcoap/COPYING b/examples/espidf-coap-server/components/libcoap/COPYING deleted file mode 100644 index c64ad63..0000000 --- a/examples/espidf-coap-server/components/libcoap/COPYING +++ /dev/null @@ -1,6 +0,0 @@ -libcoap is published as open-source software without any warranty of any kind. - -Use is permitted under the terms of the simplified BSD 2-Clause license. -It includes public domain software. libcoap binaries may also -include open-source software with their respective licensing terms. -Please refer to LICENSE for further details. diff --git a/examples/espidf-coap-server/components/libcoap/ChangeLog b/examples/espidf-coap-server/components/libcoap/ChangeLog deleted file mode 100644 index 5ae73a5..0000000 --- a/examples/espidf-coap-server/components/libcoap/ChangeLog +++ /dev/null @@ -1,332 +0,0 @@ -2022-08-17 Olaf Bergmann - - Change summary for version 4.3.1: - - * Support for Server only and Client only libcoap builds. - * Add support for repeating requests in coap-client. - * Add in support for defining resources that support multicast. - * Add in more support for async delayed requests. - * Add in support for not closing down Observe when closing session. - * Support for RFC7390, RFC8516 and RFC9175. - * Warn when Tokens are re-used. - * Warn when Options are repeated that are not defined as being - repeatable. - * Support for TLS when using Mbed TLS library. - * support for Mbed TLS 3.1 - * Add in BERT support for block handling. - * More rigorous error handling for Block transfers. - * Support for using external or submodule TinyDTLS. - * Cmake - add in Apple build support. - * Source files renamed to be more consistent in naming. - * Update native Windows VC builds to use libcoap-3 instead of libcoap-2. - * Reported bugs fixed. - * Example applications Help report include build version. - * Documentation added and updated (Doxygen and man). - -2021-05-04 Olaf Bergmann - - Change summary for version 4.3.0: - - * Include directory updated from include/coap2 to include/coap3 as - this is a major version change. - * Other code references updated from coap2 to coap3. - * Examples now have the underlying (D)TLS library name as a suffix. - E.g. coap-server-openssl - * Examples and libraries can be installed with default names using - ./configure --enable-add-default-names - * Many call-back handlers have had their parameter lists changed, some - variables are made const and other ones removed as they can be easily - reconstructed if needed. - * Some functions have their parameters changed to const. - * Internal structures made opaque to applications, requiring the - applications to access the structure information via a new set of - functions. The new functions are of the form coap_X_get_Y() or - coap_X_set_Y() where X is the structure (e.g. session) and Y is - the variable. - * coap_async_state_t - * coap_attr_t - * coap_context_t - * coap_packet_t - * coap_pdu_t - * coap_resource_t - * coap_session_t - * coap_socket_t - * Header files are moved into libcoap space and so are accessed by coap - sub-directory - e.g. #include . - * RFC7959 (Block handling) moved into libcoap from application code - considerably simplifying application code. See coap_block(3) man page. - * CoAP Cache Key support. - * Support for cmake builds. - * Support for RIOT builds. - * Support for Cygwin builds. - * Proxy support for coap-server, enhanced coap-client capabilities - * Updated async support. - * Multicast requests now randomly delayed befor ethe response is - sent. - * Additional RFC support - RFC8768. - * Mbed TLS DTLS library support. - * (D)TLS support for RPK and PKCS11. - * Additional (D)TLS support for PSK (e.g. Identity Hints). - * PKI support consistent across all supported (D)TLS libraries. - * Support for disabling TCP for code reduction. - * More rigorous checking and appropriate rejection of inbound PDU - options. - * Additional unit tests. - * Reported bugs fixed. - * Example applications help reports on (D)TLS library capabilities - and versions. - * Documentation added and updated (Doxygen and man). - -2019-11-05 Olaf Bergmann - - Change summary for version 4.2.1: - - * Builds now support silent rules - * Support building with TinyDTLS as a shared library - * Added in EPOLL support - * Added in support for constrained stacks - * Server sessions hashed for performance lookup - * coap_endpoint_t and coap_subscription_t made opaque to applications - * Documentation updated - -2019-02-11 Olaf Bergmann - - Change summary for version 4.2.0: - - * DTLS support improvements (OpenSSL, GnuTLS, tinydtls) - * Pre-shared keys, X.509 certificates - * new session abstraction - * TCP and TLS support - * improved documentation; manual pages - * changes in internal PDU structure - * improved examples (DTLS usage, block-wise transfer) - * docker images for continuous integration - * support for Google OSS fuzzer - * MS Visual Studio project for Windows builds - -2017-07-10 Olaf Bergmann - - * DTLS support (OpenSSL, tinyDTLS) by Jean-Claude Michelou - * Win32 support by Jean-Claude Michelou - * New Session API by Jean-Claude Michelou - -2016-02-16 Olaf Bergmann - - * Fixed build for Contiki3 and LwIP - * .travis.yml: Enabled continuous integration for platforms - POSIX and Contiki - -2015-03-11 Olaf Bergmann - - * include/coap/resource.h: Replaced custom list structures by - utlist macros. - -2015-03-09 Olaf Bergmann - - * src/uri.c (coap_split_path): Fixed URI parser bug and - removed broken parse iterator. - -2015-03-05 Olaf Bergmann - - * src/coap_time.c (coap_ticks): Changed POSIX implementation - to fixed point arithmetic and removed clock_offset. - -2015-02-21 Olaf Bergmann - - * net.c (coap_send_confirmed): Use fixed point arithmetic - to calculate retransmission timeout. - -2015-02-20 Olaf Bergmann - - * coap_list.[hc]: Moved old list implementation into - sub-directory examples and replaced by linked lists - from utlist.h. As a result, the list must be sorted - explicitly with LL_SORT). - -2015-02-19 Olaf Bergmann - - * net.c (coap_send_confirmed): Fixed retransmission timeout - calculation and renamed transmission parameters according to - Section 4.8 of RFC 7252. - -2015-02-17 Olaf Bergmann - - * major rework to get Contiki and lwip running - * many fixed bugs and warnings - -2014-06-18 Olaf Bergmann - - * mem.c (coap_malloc_type): New functions for allocating memory. - On POSIX systems, coap_malloc_type() and coap_free_type() are just - wrapper functions for malloc() and free(), while on Contiki and - LWIP distinct arrays are used for each type. - -2014-03-09 Olaf Bergmann - - * net.c (coap_cancel): Removed 7.31 again and implemented new - method for cancelling observe relationships. - -2014-02-25 Olaf Bergmann - - * net.c (coap_cancel): Handling of 7.31 responses to cancel - notifications (see Section 4.6 of draft-ietf-core-observe-12) - -2014-02-04 Olaf Bergmann - - * resource.c (coap_print_link): This function now takes an offset - where printing starts. This is used for generating blocks on the - fly. - - * net.c (wellknown_response): Added support for Block2 options - when generating a response for .well-known/core. - - * block.h (coap_opt_block_num): Fixed handling of zero-length - options. COAP_OPT_BLOCK_LAST now returns NULL when the option - value's length is zero. - -2014-01-07 Olaf Bergmann - - * resource.c (coap_print_link): Output partial resource - descriptions. The function now provides a sliding window over the - textual representation of the resource. Output starts at the given - offset and ends at the buffer's upper bound. The meaning of the - return value has changed to allow distinguishing whether or not - the resource description has been truncated at the buffer's upper - bound. - (print_wellknown): Support for the new coap_print_link(). An - additional parameter now is used to provide the offset into the - resource description. The meaning of the return value has been - adjusted accordingly. - -2013-12-23 Olaf Bergmann - - * configure.in: merged with LWIP port from chrysn - . This - introduces new compiler flags WITH_POSIX and WITH_LWIP to - distinguish target platforms. - -2013-09-03 Olaf Bergmann - - * option.h (coap_option_setb): increased size of option type - argument - - * tests/test_error_response.c (t_init_error_response_tests): new - tests for error response generation - - * tests/test_pdu.c (t_encode_pdu5): fixed number for option Accept - - * net.c (coap_new_error_response): fixed option size calculation - -2013-07-04 Olaf Bergmann - - * net.c (coap_new_context): register critical Accept option - - * pdu.c: option codes for Accept and Size1 according to coap-18 - -2013-02-01 Olaf Bergmann - - * coap_time.h (coap_clock_init_impl): fix invalid preprocessor - directive. #warning is now only used for gcc only (close sf bug #15) - - * net.c (wellknown_response): applied patch from chrysn to - fix bug in generation of .well-known/core representation - -2013-01-21 Olaf Bergmann - - * option.h: renamed option field in coap_opt_iterator_t to - next_option to detect erroneous use in old code - -2013-01-18 Olaf Bergmann - - * configure.in: new option --with-tests to enable unit tests - - * tests/testdriver.c: unit tests for parser functions - - * pdu.c (coap_pdu_parse): new PDU parser for Klaus-encoding - according to coap-13 - - * net.c (coap_read): call coap_pdu_parse() to check PDU integrity - - * option.c: Klaus-encoding for coap-13, including new option - iterator interface - -2012-11-20 Olaf Bergmann - - * net.c (next_option_safe): made option parsing more robust in - presence of option jumps - - * pdu.h: new option codes from draft-ietf-core-coap-12 - - * option.c (coap_opt_setlength): new function to set option length - - * uri.c (make_decoded_option): use coap_opt_setlength() instead of - obsolete macro COAP_OPT_SETLENGTH. - -2012-11-19 Olaf Bergmann - - * uri.c (make_decoded_option): use coap_opt_encode() instead of writing - -2012-11-03 Olaf Bergmann - - * net.c (coap_read): read new option encoding - -2012-11-01 Olaf Bergmann - - * option.c (coap_opt_size, coap_opt_value, coap_opt_length): - several functions to access fields of options (possibly preceeded - by option jump) - -2012-10-25 Olaf Bergmann - - * option.c (coap_opt_encode): new function for option encoding - with option jumps - -2012-03-23 Olaf Bergmann - - * examples/client.c (clear_obs): clear observation relationship after - user-specified duration - -2012-03-21 Olaf Bergmann - - * resource.c (print_wellknown): filtering by attributes - -2012-03-19 Olaf Bergmann - - * pdu.c (coap_add_option): allow more than 15 options. - -2012-03-15 Olaf Bergmann - - * examples/client.c (cmdline_uri): split path and query here to - make it easier to include these options in subsequent requests for - block transfer. - -2012-03-14 Olaf Bergmann - - * examples/etsi_iot_01.c: Support for POST, PUT, DELETE on /test - -2012-03-13 Olaf Bergmann - - * encode.c (coap_encode_var_bytes): more efficient coding for 0 - -2012-03-11 Olaf Bergmann - - * examples/etsi_iot_01.c: Test cases for 1st ETSI CoAP Plugtest, - March 24/25, 2012 in Paris, France. - -2012-03-10 Olaf Bergmann - - * block.c: support for block transfer. - -2012-03-07 Olaf Bergmann - - * examples/client.c (usage): new command line options - -B to set timeout after which the main loop is left. - -e to specify a payload (incompatible with -f) - (message_handler): bugfixes - - * resource.h: (coap_method_handler_t): new API for method handlers. - - -Copyright 2012 Olaf Bergmann, TZI -Copying and distribution of this file, with or without modification, are -permitted provided the copyright notice and this notice are preserved. diff --git a/examples/espidf-coap-server/components/libcoap/Dockerfile b/examples/espidf-coap-server/components/libcoap/Dockerfile deleted file mode 100644 index 41b7fc8..0000000 --- a/examples/espidf-coap-server/components/libcoap/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM obgm/libcoap:build-env - -ENV libcoap_dir=/libcoap -ADD . $libcoap_dir -WORKDIR $libcoap_dir - -RUN ./autogen.sh --clean && ./autogen.sh diff --git a/examples/espidf-coap-server/components/libcoap/HOWTO.dual.gnutls b/examples/espidf-coap-server/components/libcoap/HOWTO.dual.gnutls deleted file mode 100644 index e2fc0e1..0000000 --- a/examples/espidf-coap-server/components/libcoap/HOWTO.dual.gnutls +++ /dev/null @@ -1,98 +0,0 @@ -############################################################################ -# -# GnuTLS dual versions -# -# Works with CentOS 7 -# -############################################################################ -# -# Add in alternative GnuTLS support into /usr/local, and put all the -# libraries into /usr/local/lib. -# -# Need the latest of the following packages -# -# gmp (used 6.2.0) https://gmplib.org/#DOWNLOAD -# nettle (used 3.6) https://ftp.gnu.org/gnu/nettle/ -# gnutls (used 3.6.13) https://www.gnutls.org/download.html -# - -GMP_VER=6.2.0 -NETTLE_VER=3.6 -GNUTLS_VER=3.6.13 - -# -# gmp -# -tar xovf gmp-${GMP_VER}.tar.xz -cd gmp-${GMP_VER} -./configure -make -sudo make install -cd .. - -# -# nettle (by default wants to go into /usr/local/lib64 which gets messy) -# -tar zxovf nettle-${NETTLE_VER}.tar.gz -cd nettle-${NETTLE_VER} -PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --libdir=/usr/local/lib \ - LDFLAGS="-L/usr/local/lib" -make -sudo make install -cd .. - -tar xovf gnutls-${GNUTLS_VER}.tar.xz -cd gnutls-${GNUTLS_VER} -# -# -# You may need to make the following change if you have an old version of -# p11-kit -# -# $ diff -Nau a/lib/pkcs11_privkey.c b/lib/pkcs11_privkey.c -# --- a/lib/pkcs11_privkey.c 2020-05-26 11:49:27.374385645 +0100 -# +++ b/lib/pkcs11_privkey.c 2020-05-26 11:58:24.300510455 +0100 -# @@ -265,13 +265,13 @@ -# # define CKG_MGF1_SHA384 0x00000003UL -# # define CKG_MGF1_SHA512 0x00000004UL -# -# +#endif -# struct ck_rsa_pkcs_pss_params { -# ck_mechanism_type_t hash_alg; -# /* ck_rsa_pkcs_mgf_type_t is not defined in old versions of p11-kit */ -# unsigned long mgf; -# unsigned long s_len; -# }; -# -#endif -# -# static const struct hash_mappings_st hash_mappings[] = -# { -# -# -PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --with-included-unistring \ - --disable-hardware-acceleration --disable-tests --with-included-libtasn1 \ - --disable-doc LDFLAGS="-L/usr/local/lib" -make -sudo make install -cd .. - -############################################################################ -# -# libcoap build with updated GnuTLS -# -############################################################################ - -# Get the latest libcoap -git clone https://github.com/obgm/libcoap.git - -# Build code -cd libcoap -./autogen.sh -# Update --enable- / --disable- options as appropriate -# libcoap libraries are put into /usr/lib64 for ease of linking -PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --libdir=/usr/lib64 \ - --with-gnutls --enable-tests --enable-examples --disable-doxygen \ - --enable-manpages -make -sudo make install -cd .. - diff --git a/examples/espidf-coap-server/components/libcoap/HOWTO.dual.openssl b/examples/espidf-coap-server/components/libcoap/HOWTO.dual.openssl deleted file mode 100644 index 6168c3e..0000000 --- a/examples/espidf-coap-server/components/libcoap/HOWTO.dual.openssl +++ /dev/null @@ -1,50 +0,0 @@ -############################################################################ -# -# OpenSSL dual versions -# -# Works with CentOS 7 -# -############################################################################ -# -# Add in alternative OpenSSL support into /opt/openssl. /opt/openssl is -# chosen instead of the default of /usr/local so that existing utilities -# continue to use the original version of OpenSSL and so only specific -# applications that requires the newer version of OpenSSL will pick up the -# new code. -# -# Download latest stable version of openssl.X.Y.Z.tar.gz from -# https://www.openssl.org/source/ - -tar zxovf openssl.X.Y.Z.tar.gz -cd openssl.X.Y.X -./config --prefix=/opt/openssl --openssldir=/opt/openssl -make -sudo make install_sw - -# The following should not clash the existing OpenSSL lib*.so.1.0 usage unless -# the previous OpenSSL version is 1.1.0 or later. -# It just makes things for running executables a lot simpler. -sudo cp /opt/openssl/lib/lib*.so.1.1 /lib64 -cd .. - -############################################################################ -# -# libcoap build with updated OpenSSL -# -############################################################################ - -# Get the latest libcoap -git clone https://github.com/obgm/libcoap.git - -# Build code -cd libcoap -./autogen.sh -# Update --enable- / --disable- options as appropriate -# libcoap libraries are put into /usr/lib64 for ease of linking -PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig ./configure --libdir=/usr/lib64 \ - --with-openssl --enable-tests --enable-examples --disable-doxygen \ - --disable-manpages -make -sudo make install -cd .. - diff --git a/examples/espidf-coap-server/components/libcoap/HOWTO.dual.softhsm2 b/examples/espidf-coap-server/components/libcoap/HOWTO.dual.softhsm2 deleted file mode 100644 index 2eee889..0000000 --- a/examples/espidf-coap-server/components/libcoap/HOWTO.dual.softhsm2 +++ /dev/null @@ -1,90 +0,0 @@ -############################################################################ -# -# SoftHSMv2 dual versions -# -# Works with CentOS 7 -# -# The opensc package needs to be installed. -# -############################################################################ -# -# Install a software HSM module for doing the PKCS11 testing of libcoap. -# Real hardware can be used if you have the appropriate library module. -# -# It is assumed that the opensc package is installed. -# -# When installing SoftHSMv2 from your system's package manager, check that the -# OpenSSL version is at least 1.1.0. If not, then you will need to dual -# install SoftHSMv2 as below; otherwise you can use the existing SoftHSMv2. -# -# SoftHSMv2 is built using OpenSSL, but GnuTLS can use the PKCS11 interface. -# Note that if the default OpenSSL version is less than 1.1.0, you will need -# to install a dual stack version of OpenSSL as per HOWTO.dual.openssl. -# -# Creates module /usr/local/lib/softhsm/libsofthsm2.so -# - -# Add line below to /etc/security/limits.conf to support memory locking - -* - memlock unlimited - -# Get the latest SoftHSM -git clone https://github.com/opendnssec/SoftHSMv2.git - -# Build code -cd SoftHSMv2/ -sh autogen.sh -PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig ./configure --enable-silent-rules \ - --with-crypto-backend=openssl --disable-gost LDFLAGS=-L/opt/openssl/lib \ - CPPFLAGS=-I/opt/openssl/include --with-openssl=/opt/openssl -make -# You may need to comment out constexpr lines (fixes for gcc10) in -# src/lib/crypto/PublicKey.h src/lib/crypto/PrivateKey.h if you get -# compile errors. -sudo make install -cd .. - -# Make sure p11-kit softhsm modules have the correct module: fully qualified -# path where the entry is of the form (in particular for GnuTLS) :- -# /usr/share/p11-kit/modules/softhsm* -# -# module: /usr/local/lib/softhsm/libsofthsm2.so - -# The user you are running this as needs to be in the group defined for -# /var/lib/softhsm/tokens/. E.g. -# $ sudo ls -ld /var/lib/softhsm/tokens/ -# drwxrws--- 3 root softhsm 4096 May 3 09:52 /var/lib/softhsm/tokens/ -# which is softhsm in this case (It could be ods). To verify if you are in -# the correct group -# $ id -# To add user to this group -# $ sudo usermod -a -G softhsm -# and log out and back in again. -# - -############################################################################ -# -# libp11 (needed for OpenSSL as it provides the PKCS11 engine) -# -############################################################################ -# -# Install a pkcs11 library for OpenSSL to use as an engine. -# [GnuTLS has this built in] -# - -# Get the latest libp11 -git clone https://github.com/OpenSC/libp11.git - -# Build code -cd libp11 -./bootstrap -PKG_CONFIG_PATH=/opt/openssl/lib/pkgconfig ./configure \ - --with-pkcs11-module=/usr/local/lib/softhsm/libsofthsm2.so -make -sudo make install -cd .. - -# Verify that pkcs11 is available - -/opt/openssl/bin/openssl engine pkcs11 -t - diff --git a/examples/espidf-coap-server/components/libcoap/HOWTO.pkcs11 b/examples/espidf-coap-server/components/libcoap/HOWTO.pkcs11 deleted file mode 100644 index 64c01f9..0000000 --- a/examples/espidf-coap-server/components/libcoap/HOWTO.pkcs11 +++ /dev/null @@ -1,129 +0,0 @@ -# -# Using PKCS11 with libcoap. -# -# This HOWTO works for CentOS 7. -# -# As CentOS 7 uses OpenSSL prior to 1.1.0, dual OpenSSL support needs to be -# set up and used for libcoap. See HOWTO.dual.openssl for setting this up. -# -# It also is possible that you want to use GnuTLS - and want to use a later -# version. HOWTO.dual.gnutls for setting this up. -# -# OpenSSL and GnuTLS are currently supported -# - -############################################################################ -# -# Testing examples -# -############################################################################ -# -# Update PKCS11 token with certificates and keys -# -# Assumption is that you already have the following PEM files -# ca-cert.pem - The certificate of the CA that signed Server and Client -# server-cert.pem - Contains the server certificate in PEM format -# server-key.pem - Contains the server private key in PEM format -# client-cert.pem - Contains the server certificate in PEM format -# client-key.pem - Contains the server private key in PEM format -# -# Tokens will be stored under /var/lib/softhsm/tokens/ -# -# The user you are running this as needs to be in the group defined for -# /var/lib/softhsm/tokens/. E.g. -# $ sudo ls -ld /var/lib/softhsm/tokens/ -# drwxrws--- 3 root softhsm 4096 May 3 09:52 /var/lib/softhsm/tokens/ -# which is softhsm in this case (It could be ods). To verify if you are in -# the correct group -# $ id -# To add user to this group -# $ sudo usermod -a -G softhsm -# and log out and back in again. -# - -# Set libsofthsm2.so to use (may be /usr/lib/softhsm/libsofthsm2.so) -LIBSOFTHSM=/usr/local/lib/softhsm/libsofthsm2.so - -# Initialize Soft HSM token -# Note: slot 0 is re-allocated to slot XXX. This is presented as a decimal -# number, the hex equivalent (leading 0x) can be used for any slot options.. -# Set SO PIN to 4321, user PIN to 1234 -softhsm2-util --init-token --slot 0 --label "token-0" --pin 1234 --so-pin 4321 - -# CA Certificate (different id to Server/Client Public Certificate) -# (GnuTLS requires this to be trusted) -p11tool --so-login --load-certificate ca-cert.pem --write --label ca-cert \ - --set-so-pin 4321 --id cc00 --mark-trusted "pkcs11:token=token-0" - -# Server Private Key -openssl pkcs8 -topk8 -inform PEM -outform PEM -in server-key.pem \ - -out server-key.pk8 -nocrypt -softhsm2-util --import server-key.pk8 --label "server-key" --id aa00 \ - --pin 1234 --token "token-0" - -# Server Public Certificate -# (Use different id to private key, but not the same as CA/Client cert) -openssl x509 -in server-cert.pem -out server-cert.der -outform DER -pkcs11-tool --module $LIBSOFTHSM --pin 1234 \ - --write-object ./server-cert.der --type cert --id aa01 \ - --label "server-cert" --token-label "token-0" - -# Client Private Key -openssl pkcs8 -topk8 -inform PEM -outform PEM -in client-key.pem \ - -out client-key.pk8 -nocrypt -softhsm2-util --import client-key.pk8 --label "client-key" --id bb00 \ - --pin 1234 --token "token-0" - -# Client Public Certificate -# (Use different id to private key, but not the same as CA/Client cert) -openssl x509 -in client-cert.pem -out client-cert.der -outform DER -pkcs11-tool --module $LIBSOFTHSM --pin 1234 \ - --write-object ./client-cert.der --type cert --id bb01 \ - --label "client-cert" --token-label "token-0" - -# Verify token is correctly populated -pkcs11-tool --module=$LIBSOFTHSM -t -pkcs11-tool --module=$LIBSOFTHSM --list-objects \ - --pin 1234 --token-label "token-0" -p11tool --list-all pkcs11:model=SoftHSM%20v2 - -# -# Run coap-server using PKCS11 (-C option may need to be -C cert.der) -# -coap-server -C 'pkcs11:token=token-0;id=%cc%00?pin-value=1234' \ - -c 'pkcs11:token=token-0;id=%aa%01?pin-value=1234' \ - -j 'pkcs11:token=token-0;id=%aa%00?pin-value=1234' -v9 - -# or -coap-server -C 'pkcs11:token=token-0;id=%cc%00' \ - -c 'pkcs11:token=token-0;id=%aa%01' \ - -j 'pkcs11:token=token-0;id=%aa%00' -J 1234 -v9 - -# or -coap-server -C 'pkcs11:token=token-0;object=ca-cert' \ - -c 'pkcs11:token=token-0;object=server-cert' \ - -j 'pkcs11:token=token-0;object=server-key' -J 1234 -v9 - -# -# Run coap-client using PKCS11 (-C option may need to be -C cert.der) -# -coap-client -C 'pkcs11:token=token-0;id=%cc%00?pin-value=1234' \ - -c 'pkcs11:token=token-0;id=%bb%01?pin-value=1234' \ - -j 'pkcs11:token=token-0;id=%bb%00?pin-value=1234' -v9 coaps://[::1] - -# or -coap-client -C 'pkcs11:token=token-0;id=%cc%00' \ - -c 'pkcs11:token=token-0;id=%bb%01' \ - -j 'pkcs11:token=token-0;id=%bb%00' -J 1234 -v9 coaps://[::1] - -# or -coap-client -C 'pkcs11:token=token-0;object=ca-cert' \ - -c 'pkcs11:token=token-0;object=client-cert' \ - -j 'pkcs11:token=token-0;object=client-key' -J 1234 -v9 coaps://[::1] - -# -# Client and Server using RPK (GnuTLS only) -# -coap-server -M 'pkcs11:token=token-0;object=server-key' -J 1234 -v9 -# and -coap-client -M 'pkcs11:token=token-0;object=client-key' -J 1234 -v9 coaps://[::1] diff --git a/examples/espidf-coap-server/components/libcoap/LICENSE b/examples/espidf-coap-server/components/libcoap/LICENSE deleted file mode 100644 index 78d2c55..0000000 --- a/examples/espidf-coap-server/components/libcoap/LICENSE +++ /dev/null @@ -1,85 +0,0 @@ -Copyright (c) 2010--2022, Olaf Bergmann and others -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - o Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - o 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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"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 COPYRIGHT -HOLDER OR CONTRIBUTORS 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. - -======================================================================== -getopt.c - -License information for getopt.c. This file is only used on Windows -builds of the executables in the examples folder: - -/* - * This file was copied from the following newsgroup posting: - * - * Newsgroups: mod.std.unix - * Subject: public domain AT&T getopt source - * Date: 3 Nov 85 19:34:15 GMT - * - * Here's something you've all been waiting for: the AT&T public domain - * source for getopt(3). It is the code which was given out at the 1985 - * UNIFORUM conference in Dallas. I obtained it by electronic mail - * directly from AT&T. The people there assure me that it is indeed - * in the public domain. - */ - -======================================================================== -uthash - -libcoap uses uthash.h and utlist.h from Troy D. Hanson -(https://troydhanson.github.io/uthash/). These files use the revised -BSD license (BSD-1-Clause license) as included in these two source -files. - -======================================================================== -OpenSSL - -Binaries that are linked against OpenSSL include software developed -by the OpenSSL Project for use in the OpenSSL Toolkit. -(http://www.openssl.org/). Please consult the OpenSSL license -(https://www.openssl.org/source/license.html) for licensing terms. - -======================================================================== -GnuTLS - -When compiled with GnuTLS support, this software includes components -that are licensed under the terms of the the GNU Lesser General Public -License, version 2.1 -(https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html). - -======================================================================== -tinyDTLS - -When compiled with tinyDTLS support, this software includes components -that are licensed under the terms of the Eclipse Distribution License 1.0 -(http://www.eclipse.org/org/documents/edl-v10.php). - -======================================================================== -Mbed TLS - -When compiled with Mbed TLS support, this software includes components -that are licensed under the terms of the Apache 2.0 license -(http://www.apache.org/licenses/LICENSE-2.0). - diff --git a/examples/espidf-coap-server/components/libcoap/Makefile.am b/examples/espidf-coap-server/components/libcoap/Makefile.am deleted file mode 100644 index dba0e61..0000000 --- a/examples/espidf-coap-server/components/libcoap/Makefile.am +++ /dev/null @@ -1,281 +0,0 @@ -# Makefile.am for libcoap -# -# Copyright (C) 2010-2022 Olaf Bergmann -# Copyright (C) 2015-2017 Carsten Schoenert -# Copyright (C) 2018-2022 Jon Shallow -# -# SPDX-License-Identifier: BSD-2-Clause -# -# This file is part of the CoAP C library libcoap. Please see README and -# COPYING for terms of use. - -## Place generated object files (.o) into the same directory as their source -## files, in order to avoid collisions when non-recursive make is used. -AUTOMAKE_OPTIONS = subdir-objects - -ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4 - -LIBCOAP_PACKAGE_BUILD = @DOLLAR_SIGN@(shell git describe --tags --dirty --always 2>/dev/null || echo @PACKAGE_VERSION@) - -## Additional files for the distribution archive -EXTRA_DIST = \ - BUILDING \ - CONTRIBUTE \ - TODO \ - LICENSE \ - CMakeLists.txt \ - cmake_coap_config.h.in \ - cmake/Config.cmake.in \ - cmake/FindMbedTLS.cmake \ - cmake/FindTinyDTLS.cmake \ - coap_config.h.lwip \ - coap_config.h.riot \ - coap_config.h.windows \ - libcoap-$(LIBCOAP_API_VERSION).pc.in \ - libcoap-$(LIBCOAP_API_VERSION).map \ - libcoap-$(LIBCOAP_API_VERSION).sym \ - examples/coap_list.h \ - examples/getopt.c \ - include/coap$(LIBCOAP_API_VERSION)/coap_internal.h \ - include/coap$(LIBCOAP_API_VERSION)/coap_riot.h \ - include/coap$(LIBCOAP_API_VERSION)/coap_asn1_internal.h \ - include/coap$(LIBCOAP_API_VERSION)/coap_async_internal.h \ - include/coap$(LIBCOAP_API_VERSION)/coap_block_internal.h \ - include/coap$(LIBCOAP_API_VERSION)/coap_cache_internal.h \ - include/coap$(LIBCOAP_API_VERSION)/coap_dtls_internal.h \ - include/coap$(LIBCOAP_API_VERSION)/coap_io_internal.h \ - include/coap$(LIBCOAP_API_VERSION)/coap_net_internal.h \ - include/coap$(LIBCOAP_API_VERSION)/coap_pdu_internal.h \ - include/coap$(LIBCOAP_API_VERSION)/coap_resource_internal.h \ - include/coap$(LIBCOAP_API_VERSION)/coap_session_internal.h \ - include/coap$(LIBCOAP_API_VERSION)/coap_subscribe_internal.h \ - include/coap$(LIBCOAP_API_VERSION)/coap_tcp_internal.h \ - include/coap$(LIBCOAP_API_VERSION)/coap.h.in \ - include/coap$(LIBCOAP_API_VERSION)/coap.h.windows \ - include/coap$(LIBCOAP_API_VERSION)/coap.h.windows.in \ - include/coap$(LIBCOAP_API_VERSION)/lwippools.h \ - include/coap$(LIBCOAP_API_VERSION)/uthash.h \ - include/coap$(LIBCOAP_API_VERSION)/utlist.h \ - src/coap_io_riot.c \ - tests/test_error_response.h \ - tests/test_encode.h \ - tests/test_options.h \ - tests/test_pdu.h \ - tests/test_sendqueue.h \ - tests/test_session.h \ - tests/test_tls.h \ - tests/test_uri.h \ - tests/test_wellknown.h \ - win32/coap-client/coap-client.vcxproj \ - win32/coap-client/coap-client.vcxproj.filters \ - win32/coap-rd/coap-rd.vcxproj \ - win32/coap-rd/coap-rd.vcxproj.filters \ - win32/coap-server/coap-server.vcxproj \ - win32/coap-server/coap-server.vcxproj.filters \ - win32/libcoap.sln \ - win32/libcoap.vcxproj \ - win32/libcoap.vcxproj.filters \ - win32/testdriver/testdriver.vcxproj \ - win32/testdriver/testdriver.vcxproj.filters \ - win32/testdriver/testdriver.vcxproj.user - -AM_CFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include $(WARNING_CFLAGS) \ - $(DTLS_CFLAGS) -std=c99 $(EXTRA_CFLAGS) \ - -DLIBCOAP_PACKAGE_BUILD='"$(LIBCOAP_PACKAGE_BUILD)"' - -SUBDIRS = $(subdirs) . man doc tests examples - -## Define a libtool archive target "libcoap-@LIBCOAP_NAME_SUFFIX@.la", with -## @LIBCOAP_NAME_SUFFIX@ substituted into the generated Makefile at configure -## time. -## The libtool archive file (.la) will be installed into the directory named -## by the predefined variable $(bindir), along with the actual shared library -## file (.so). -lib_LTLIBRARIES = libcoap-@LIBCOAP_NAME_SUFFIX@.la - -libcoap_@LIBCOAP_NAME_SUFFIX@_la_CFLAGS = \ - -fPIC \ - -fPIE \ - $(AM_CFLAGS) - -## Define the source file list for the "libcoap.la" target. -## Note that it is not necessary to list header files which are already listed -## elsewhere in a _HEADERS variable assignment. -libcoap_@LIBCOAP_NAME_SUFFIX@_la_SOURCES = \ - src/block.c \ - src/coap_address.c \ - src/coap_asn1.c \ - src/coap_async.c \ - src/coap_cache.c \ - src/coap_debug.c \ - src/coap_event.c \ - src/coap_hashkey.c \ - src/coap_gnutls.c \ - src/coap_io.c \ - src/coap_mbedtls.c \ - src/coap_notls.c \ - src/coap_openssl.c \ - src/coap_option.c \ - src/coap_prng.c \ - src/coap_session.c \ - src/coap_subscribe.c \ - src/coap_tcp.c \ - src/coap_time.c \ - src/coap_tinydtls.c \ - src/encode.c \ - src/mem.c \ - src/net.c \ - src/pdu.c \ - src/resource.c \ - src/str.c \ - src/uri.c - -## Define the list of public header files and their install location. -## The API version is appended to the install folder to being able to -## co-install various versions of libcoap. -libcoap_includedir = $(includedir)/coap$(LIBCOAP_API_VERSION)/ - -# If there is a API change to something $(LIBCOAP_API_VERSION) > 1 the install -# prefix for the header files has to change to not conflict the older version -# if the user want's to install both versions. There will be something used like -# libcoap_include_HEADERS = \ -# $(top_srcdir)/include/coap-$(LIBCOAP_API_VERSION)/* - -libcoap_include_HEADERS = \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/block.h \ - $(top_builddir)/include/coap$(LIBCOAP_API_VERSION)/coap.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_address.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_async.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_cache.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_debug.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_dtls.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_event.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_forward_decls.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_hashkey.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_io.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_mutex.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_option.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_session.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_subscribe.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_time.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/encode.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/libcoap.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/mem.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/net.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/pdu.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_prng.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/resource.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/str.h \ - $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/uri.h - -## Instruct libtool to include API version information in the generated shared -## library file (.so). The library ABI version will later defined in configure.ac, -## so that all version information is kept in one place. -libcoap_@LIBCOAP_NAME_SUFFIX@_la_LDFLAGS = \ - -version-info $(LT_LIBCOAP_CURRENT):$(LT_LIBCOAP_REVISION):$(LT_LIBCOAP_AGE) \ - @libcoap_SYMBOLS@ \ - $(DTLS_LIBS) \ - -pie - -## Collect symbols here we want to ignore while building the helper files -## libcoap-$(LIBCOAP_API_VERSION).{map,sym} for the linker. -CTAGS_IGNORE=-I " \ -coap_pdu_from_pbuf \ -" - -# This helper is called by libcoap-$(LIBCOAP_API_VERSION).{map,sym} to see if -# configure has detected a usable version of the ctags program and aborts if not. -check_ctags: - @if [ "$(CTAGS_PROG)" = "" ]; then \ - echo ;\ - echo "There was no ctags program found by the configure script!" ;\ - echo "ctags is needed for running this target! Please note the warning about the missed ctags program of the configure script." ;\ - echo ;\ - exit 1;\ - fi - -## Helper target to generate the symbol table needed by libtool. -## The .map format is used when ld supports linker scripts, otherwise -## it must fall back to a plain symbol file. -update-map-file: libcoap-$(LIBCOAP_API_VERSION).map libcoap-$(LIBCOAP_API_VERSION).sym - -libcoap-$(LIBCOAP_API_VERSION).map: check_ctags $(libcoap_include_HEADERS) - ( echo "VER_$(LIBCOAP_API_VERSION) {" ; \ - echo "global:" ; \ - $(CTAGS_PROG) $(CTAGS_IGNORE) -f - --c-kinds=p $(libcoap_include_HEADERS) | awk '/^coap_/ { print " " $$1 ";" }' | sort -u ; \ - echo "local:" ; \ - echo " *;" ; \ - echo "};" ) > $(top_builddir)/$@.new - mv $(top_builddir)/$@.new $(top_builddir)/$@ - -libcoap-$(LIBCOAP_API_VERSION).sym: check_ctags $(libcoap_include_HEADERS) - ( $(CTAGS_PROG) $(CTAGS_IGNORE) -f - --c-kinds=p $(libcoap_include_HEADERS) | awk '/^coap_/ { print $$1 }' | sort -u ) \ - > $(top_builddir)/$@.new - mv $(top_builddir)/$@.new $(top_builddir)/$@ - -## Install the generated pkg-config file (.pc) into the expected location for -## architecture-dependent package configuration information. Occasionally, -## pkg-config files are also used for architecture-independent data packages, -## in which case the correct install location would be $(datadir)/pkgconfig. -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libcoap-$(LIBCOAP_NAME_SUFFIX).pc - -## Define an independent executable script for inclusion in the distribution -## archive. However, it will not be installed on an end user's system due to -## the noinst_ prefix. -dist_noinst_SCRIPTS = autogen.sh - -## Set up a common library that causes linking against the common library -## to link with the actual library with (D)TLS support -if BUILD_ADD_DEFAULT_NAMES -install-exec-hook: - (cd $(DESTDIR)$(libdir) ; \ - if [ -f libcoap-$(LIBCOAP_NAME_SUFFIX).so ] ; then \ - rm -f libcoap-$(LIBCOAP_API_VERSION).so ; \ - $(LN_S) libcoap-$(LIBCOAP_NAME_SUFFIX).so libcoap-$(LIBCOAP_API_VERSION).so ; \ - fi ; \ - rm -f libcoap-$(LIBCOAP_API_VERSION).a ; \ - rm -f libcoap-$(LIBCOAP_API_VERSION).la ; \ - $(LN_S) libcoap-$(LIBCOAP_NAME_SUFFIX).a libcoap-$(LIBCOAP_API_VERSION).a ; \ - $(LN_S) libcoap-$(LIBCOAP_NAME_SUFFIX).la libcoap-$(LIBCOAP_API_VERSION).la ; \ - $(MKDIR_P) $(DESTDIR)$(pkgconfigdir) ; \ - cd $(DESTDIR)$(pkgconfigdir) ; \ - rm -f libcoap-$(LIBCOAP_API_VERSION).pc ; \ - $(LN_S) libcoap-$(LIBCOAP_NAME_SUFFIX).pc libcoap-$(LIBCOAP_API_VERSION).pc) - -uninstall-hook: - (cd $(DESTDIR)$(libdir) ; \ - rm -f libcoap-$(LIBCOAP_API_VERSION).a ; \ - rm -f libcoap-$(LIBCOAP_API_VERSION).la ; \ - rm -f libcoap-$(LIBCOAP_API_VERSION).so ; \ - cd $(DESTDIR)$(pkgconfigdir) ; \ - rm -f libcoap-$(LIBCOAP_API_VERSION).pc) -endif # BUILD_ADD_DEFAULT_NAMES - -## various *-local targets -## Remove the helper files for the linker and the pkg-config file if there -## is 'make distclean' called. NOTE: To re create the *.{map,sym} files you -## need to call the target update-map-file after the configure script was -## running! -clean-local: - -find \( -name '*.gcda' -o -name '*.gcno' -o -name '*.gcov' \) -delete - -distclean-local: - @rm -f src/*.o src/*.lo - rm -f libcoap-$(LIBCOAP_API_VERSION).map - rm -f libcoap-$(LIBCOAP_API_VERSION).sym - rm -f libcoap-$(LIBCOAP_NAME_SUFFIX).pc - @echo - @echo " ---> Please note the following important advice! <---" - @echo " The files libcoap-$(LIBCOAP_API_VERSION).{map,sym} are removed by the distclean target!" - @echo " To regenerate this two files you need to call 'make update-map-file' first before any" - @echo " other Make target. Otherwise the build of libcoap will fail!" - @echo - -## Ensure we have actual *.{map,sym} files if we create a release tarball. -dist-local: update-map-file - -## Finaly some phony targets, just to ensure those targets are always buildable -## no matter if the user has created same called files. -.PHONY: update-map-file check_ctags - diff --git a/examples/espidf-coap-server/components/libcoap/Makefile.libcoap b/examples/espidf-coap-server/components/libcoap/Makefile.libcoap deleted file mode 100644 index 88199d4..0000000 --- a/examples/espidf-coap-server/components/libcoap/Makefile.libcoap +++ /dev/null @@ -1,7 +0,0 @@ -libcoap_src = pdu.c net.c coap_cache.c coap_debug.c encode.c uri.c coap_subscribe.c resource.c str.c coap_option.c coap_async.c block.c mem.c coap_io.c coap_session.c coap_notls.c coap_hashkey.c coap_address.c coap_tcp.c - -libcoap_dir := $(filter %libcoap,$(APPDS)) -vpath %c $(libcoap_dir)/src - -# set include path for coap sources -CFLAGS += -I$(libcoap_dir)/include diff --git a/examples/espidf-coap-server/components/libcoap/NEWS b/examples/espidf-coap-server/components/libcoap/NEWS deleted file mode 100644 index e69de29..0000000 diff --git a/examples/espidf-coap-server/components/libcoap/README b/examples/espidf-coap-server/components/libcoap/README deleted file mode 100644 index faab272..0000000 --- a/examples/espidf-coap-server/components/libcoap/README +++ /dev/null @@ -1,89 +0,0 @@ -# libcoap: A C implementation of the Constrained Application Protocol (RFC 7252) - -[![Build Status: main](https://github.com/obgm/libcoap/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/obgm/libcoap/actions?query=branch:main) -[![Build Status: develop](https://github.com/obgm/libcoap/actions/workflows/main.yml/badge.svg?branch=develop)](https://github.com/obgm/libcoap/actions?query=branch:develop) -[![Static Analysis](https://scan.coverity.com/projects/10970/badge.svg?flat=1)](https://scan.coverity.com/projects/obgm-libcoap) -[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/libcoap.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:libcoap) - -Copyright (C) 2010—2022 by Olaf Bergmann and others - -ABOUT LIBCOAP -============= - -libcoap is a C implementation of a lightweight application-protocol -for devices that are constrained their resources such as computing -power, RF range, memory, bandwidth, or network packet sizes. This -protocol, CoAP, is standardized by the IETF as RFC 7252. For further -information related to CoAP, see . - -You might want to check out -[libcoap-minimal](https://github.com/obgm/libcoap-minimal) for usage -examples. - -DOCUMENTATION -============= - -Documentation and further information can be found at -. - -PACKAGE CONTENTS -================ - -This package contains a protocol parser and basic networking -functions for platforms with support for malloc() and BSD-style -sockets. In addition, there is support for Contiki, LwIP and -Espressif/ESP-IDF hosted environments. - -The following RFCs are supported - -* RFC7252: The Constrained Application Protocol (CoAP) - -* RFC7390: Group Communication for the Constrained Application Protocol (CoAP) - -* RFC7641: Observing Resources in the Constrained Application Protocol (CoAP) - -* RFC7959: Block-Wise Transfers in the Constrained Application Protocol (CoAP) - -* RFC7967: Constrained Application Protocol (CoAP) Option for No Server Response - -* RFC8132: PATCH and FETCH Methods for the Constrained Application Protocol (CoAP) - -* RFC8323: CoAP (Constrained Application Protocol) over TCP, TLS, and WebSockets - [No WebSockets support] - -* RFC8516: "Too Many Requests" Response Code for the Constrained Application Protocol - -* RFC8768: Constrained Application Protocol (CoAP) Hop-Limit Option - -* RFC9175: CoAP: Echo, Request-Tag, and Token Processing - -There is (D)TLS support for the following libraries - -* OpenSSL (Minimum version 1.1.0) [PKI, PSK and PKCS11] - -* GnuTLS (Minimum version 3.3.0) [PKI, PSK, RPK(3.6.6+) and PKCS11] - -* Mbed TLS (Minimum version 2.7.10) [PKI and PSK] - -* TinyDTLS [PSK and RPK] [DTLS Only] - -The examples directory contain a CoAP client, CoAP Resource Directory server -and a CoAP server to demonstrate the use of this library. - -BUILDING -======== - -Further information can be found at -and [BUILDING](https://raw.githubusercontent.com/obgm/libcoap/develop/BUILDING). - -LICENSE INFORMATION -=================== - -This library is published as open-source software without any warranty -of any kind. Use is permitted under the terms of the simplified BSD -license. It includes public domain software. libcoap binaries may also -include open-source software with their respective licensing terms. -Please refer to -[LICENSE](https://raw.githubusercontent.com/obgm/libcoap/develop/LICENSE) -for further details. - diff --git a/examples/espidf-coap-server/components/libcoap/README.md b/examples/espidf-coap-server/components/libcoap/README.md deleted file mode 100644 index faab272..0000000 --- a/examples/espidf-coap-server/components/libcoap/README.md +++ /dev/null @@ -1,89 +0,0 @@ -# libcoap: A C implementation of the Constrained Application Protocol (RFC 7252) - -[![Build Status: main](https://github.com/obgm/libcoap/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/obgm/libcoap/actions?query=branch:main) -[![Build Status: develop](https://github.com/obgm/libcoap/actions/workflows/main.yml/badge.svg?branch=develop)](https://github.com/obgm/libcoap/actions?query=branch:develop) -[![Static Analysis](https://scan.coverity.com/projects/10970/badge.svg?flat=1)](https://scan.coverity.com/projects/obgm-libcoap) -[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/libcoap.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:libcoap) - -Copyright (C) 2010—2022 by Olaf Bergmann and others - -ABOUT LIBCOAP -============= - -libcoap is a C implementation of a lightweight application-protocol -for devices that are constrained their resources such as computing -power, RF range, memory, bandwidth, or network packet sizes. This -protocol, CoAP, is standardized by the IETF as RFC 7252. For further -information related to CoAP, see . - -You might want to check out -[libcoap-minimal](https://github.com/obgm/libcoap-minimal) for usage -examples. - -DOCUMENTATION -============= - -Documentation and further information can be found at -. - -PACKAGE CONTENTS -================ - -This package contains a protocol parser and basic networking -functions for platforms with support for malloc() and BSD-style -sockets. In addition, there is support for Contiki, LwIP and -Espressif/ESP-IDF hosted environments. - -The following RFCs are supported - -* RFC7252: The Constrained Application Protocol (CoAP) - -* RFC7390: Group Communication for the Constrained Application Protocol (CoAP) - -* RFC7641: Observing Resources in the Constrained Application Protocol (CoAP) - -* RFC7959: Block-Wise Transfers in the Constrained Application Protocol (CoAP) - -* RFC7967: Constrained Application Protocol (CoAP) Option for No Server Response - -* RFC8132: PATCH and FETCH Methods for the Constrained Application Protocol (CoAP) - -* RFC8323: CoAP (Constrained Application Protocol) over TCP, TLS, and WebSockets - [No WebSockets support] - -* RFC8516: "Too Many Requests" Response Code for the Constrained Application Protocol - -* RFC8768: Constrained Application Protocol (CoAP) Hop-Limit Option - -* RFC9175: CoAP: Echo, Request-Tag, and Token Processing - -There is (D)TLS support for the following libraries - -* OpenSSL (Minimum version 1.1.0) [PKI, PSK and PKCS11] - -* GnuTLS (Minimum version 3.3.0) [PKI, PSK, RPK(3.6.6+) and PKCS11] - -* Mbed TLS (Minimum version 2.7.10) [PKI and PSK] - -* TinyDTLS [PSK and RPK] [DTLS Only] - -The examples directory contain a CoAP client, CoAP Resource Directory server -and a CoAP server to demonstrate the use of this library. - -BUILDING -======== - -Further information can be found at -and [BUILDING](https://raw.githubusercontent.com/obgm/libcoap/develop/BUILDING). - -LICENSE INFORMATION -=================== - -This library is published as open-source software without any warranty -of any kind. Use is permitted under the terms of the simplified BSD -license. It includes public domain software. libcoap binaries may also -include open-source software with their respective licensing terms. -Please refer to -[LICENSE](https://raw.githubusercontent.com/obgm/libcoap/develop/LICENSE) -for further details. - diff --git a/examples/espidf-coap-server/components/libcoap/TODO b/examples/espidf-coap-server/components/libcoap/TODO deleted file mode 100644 index 52df83a..0000000 --- a/examples/espidf-coap-server/components/libcoap/TODO +++ /dev/null @@ -1,27 +0,0 @@ -This is a simple file for all kinds of stuff related on development for -libcoap. Please append (and remove) any issue you think its worthy. - -Classification of issues: - Critical -> Break the library in some kind or a missing feature, maybe not - directly but later - Serious -> No regression on the user side, more likly on the libcoap - development - Minor -> Things that are nice to have, but they are not time critical - -================= -* CRITICAL ISSUES -================= - -================ -* SERIOUS ISSUES -================ --> Create some development rules like: - --> How to submit patches? What about pull requests? - --> How to implement/change platform related code? --> Further improve the API documentation - -============== -* MINOR ISSUES -============== --> Adding a logo for libcoap - diff --git a/examples/espidf-coap-server/components/libcoap/autogen.sh b/examples/espidf-coap-server/components/libcoap/autogen.sh deleted file mode 100644 index 0b97905..0000000 --- a/examples/espidf-coap-server/components/libcoap/autogen.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/sh -e - -# uncomment the set command for debugging -#set -x - -# function to check for needed helper tools -check_helper() { -#echo "Checking for $1 ..." -TOOL=`which "$1" || echo none` - -if [ "$TOOL" = "none" ]; then - echo - echo "Couldn't find '$1'!" - RET=1 -else - RET=0 -fi -} - -PROJECT="libcoap" - -AUTOGEN_FILES=" -INSTALL -aclocal.m4 ar-lib -coap_config.h coap_config.h.in* compile config.guess config.h* config.log config.status config.sub configure -depcomp -doc/Doxyfile doc/doxyfile.stamp doc/doxygen_sqlite3.db doc/Makefile doc/Makefile.in -examples/*.o examples/coap-client examples/coap-server examples/coap-rd -examples/Makefile examples/Makefile.in -include/coap3/coap.h -install-sh -libcoap-*.pc libtool ltmain.sh -man/coap*.[357] man/coap*.txt man/Makefile man/Makefile.in -missing -Makefile Makefile.in -stamp-h1 src/.dirstamp libcoap*.la* src/*.*o -tests/*.o tests/Makefile tests/Makefile.in tests/testdriver tests/test_common.h -tests/oss-fuzz/Makefile.ci -m4/libtool.m4 m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 -" - -AUTOGEN_DIRS=" -.deps -.libs autom4te.cache/ -doc/html/ -examples/.deps/ examples/.libs -man/.deps -man/tmp -src/.deps/ src/.libs/ -tests/.deps/ -" - -# checking for cleaner argument -echo -if [ "$1" = "--clean" ]; then - echo "removing autogenerated files ..." - rm -rf $AUTOGEN_FILES $AUTOGEN_DIRS - echo "done" - exit -else - echo "[HINT] You can run 'autogen.sh --clean' to remove all generated files by the autotools." - echo -fi - -# checking for autoreconf -check_helper autoconf -if [ "$RET" = "1" ]; then - echo "You probably need to install the package 'autoconf'." - ERROR=1 -else - echo "Found 'autoconf'." -fi - -# checking for aclocal -check_helper aclocal -if [ "$RET" = "1" ]; then - echo "You probably need to install the package 'automake'." - ERROR=1 -else - echo "Found 'aclocal'." -fi - -# checking for pkg-config -check_helper pkg-config -if [ "$RET" = "1" ]; then - echo "You probably need to install the package 'pkg-config|pkgconf'." - ERROR=1 -else - echo "Found 'pkg-config'." -fi - -# checking for libtool -# The libtool helper maybe installed as 'libtoolize', checking for 'libtool' first. -check_helper libtool -if [ "$RET" = "1" ]; then - # O.k. libtool not found, searching for libtoolize. - check_helper libtoolize - if [ "$RET" = "1" ]; then - echo "You probably need to install the package 'libtool'." - # That's bad, we found nothing! - ERROR=1 - else - echo "Found 'libtoolize'." - break - fi -else - echo "Found 'libtool'." -fi - -# exit if one tool isn't available -if [ "$ERROR" = "1" ]; then - echo - echo "One or more needed tools are missing, exiting ..." - echo "Please install the needed software packages and restart 'autogen.sh' again." - echo - exit 1 -fi - -echo -echo " ---> Found all needed tools! That's fine." -echo - -# countinue otherwise -test -n "$srcdir" || srcdir=`dirname "$0"` -test -n "$srcdir" || srcdir=. - -# Creating the directory m4 before calling autoreconf to -# not struggle with old versions of aclocal. -mkdir -p $srcdir/m4 - -# create ar-lib if not present to avoid autoreconf throwing an error -# when the file is missing. As autoreconf is called with --force -# the file will get updated with the proper contents afterwards. -touch ar-lib - -echo "Generating needed autotools files for $PROJECT by running autoreconf ..." -autoreconf --force --install --verbose "$srcdir" - -echo -echo "You can now run './configure --help' to see possible configuration options." -echo "Otherwise process the configure script to create the makefiles and generated helper files." -echo diff --git a/examples/espidf-coap-server/components/libcoap/build-env/Dockerfile.build-env b/examples/espidf-coap-server/components/libcoap/build-env/Dockerfile.build-env deleted file mode 100644 index 1cf6079..0000000 --- a/examples/espidf-coap-server/components/libcoap/build-env/Dockerfile.build-env +++ /dev/null @@ -1,7 +0,0 @@ -FROM debian:testing-slim - -RUN apt-get update && apt-get install -y autoconf automake gcc clang \ - libtool libtool-bin make pkg-config libcunit1-dev libssl-dev \ - libgnutls28-dev libmbedtls-dev exuberant-ctags git valgrind \ - graphviz doxygen libxml2-utils xsltproc docbook-xml docbook-xsl asciidoc -RUN apt-get clean diff --git a/examples/espidf-coap-server/components/libcoap/build-env/Dockerfile.develop b/examples/espidf-coap-server/components/libcoap/build-env/Dockerfile.develop deleted file mode 100644 index 3f83e0a..0000000 --- a/examples/espidf-coap-server/components/libcoap/build-env/Dockerfile.develop +++ /dev/null @@ -1,36 +0,0 @@ -FROM obgm/libcoap:build-env - -RUN apt-get update && apt-get install -y cmake git g++ -RUN apt-get clean - -ENV libcoap_dir=/home/libcoap -ADD . $libcoap_dir -WORKDIR $libcoap_dir - -RUN ./autogen.sh --clean && ./autogen.sh -RUN ./configure --disable-documentation --enable-tests --enable-examples --with-openssl && make install clean - -WORKDIR /home -RUN git clone --depth 1 https://github.com/cabo/cn-cbor.git && cd cn-cbor && ./build.sh all doc install - -# The image for development with libcoap -FROM debian:testing-slim - -RUN apt-get update && apt-get install -y autoconf automake gcc g++ gdb libtool libtool-bin make \ - pkg-config libssl-dev libgnutls28-dev libmbedtls-dev -RUN apt-get install -y iproute2 lsof net-tools inetutils-ping netcat-openbsd less vim -RUN apt-get clean - -COPY --from=0 /usr/local/include/coap3 /usr/local/include/coap3 -COPY --from=0 /usr/local/lib /usr/local/lib -COPY --from=0 /usr/local/bin/coap-client /usr/local/bin/ -COPY --from=0 /usr/local/include/cn-cbor /usr/local/include/cn-cbor -RUN echo "/usr/local/lib" >>/etc/ld.so.conf.d/usr_local.conf && ldconfig /usr/local/lib - -ARG user=user -RUN adduser --disabled-password --gecos '' $user -RUN chown -R $user:$user /home/$user -WORKDIR /home/$user -USER $user - -EXPOSE 5683 5684 diff --git a/examples/espidf-coap-server/components/libcoap/build-env/build.sh b/examples/espidf-coap-server/components/libcoap/build-env/build.sh deleted file mode 100644 index 5cf4bc2..0000000 --- a/examples/espidf-coap-server/components/libcoap/build-env/build.sh +++ /dev/null @@ -1,16 +0,0 @@ -#! /usr/bin/env bash - -pushd $(dirname $0) -. ./imagename - -# see https://stackoverflow.com/a/2924755 for switching boldface on/off -bold=$(tput bold) -normal=$(tput sgr0) - -echo "${bold}**** Creating build-env image ****${normal}" -docker build -f Dockerfile.build-env -t $USER/$IMAGE:build-env . - -echo "${bold}**** Creating develop image ****${normal}" -docker build -f Dockerfile.develop -t $USER/$IMAGE:develop .. - -popd diff --git a/examples/espidf-coap-server/components/libcoap/build-env/imagename b/examples/espidf-coap-server/components/libcoap/build-env/imagename deleted file mode 100644 index 8d69844..0000000 --- a/examples/espidf-coap-server/components/libcoap/build-env/imagename +++ /dev/null @@ -1,2 +0,0 @@ -USER=obgm -IMAGE=libcoap diff --git a/examples/espidf-coap-server/components/libcoap/cmake-format.yaml b/examples/espidf-coap-server/components/libcoap/cmake-format.yaml deleted file mode 100644 index 3e25542..0000000 --- a/examples/espidf-coap-server/components/libcoap/cmake-format.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# to format cmake files we use cmake-format: -# pip install cmake-format --upgrade -# information about the configuration here: -# https://github.com/cheshirekow/cmake_format - -# How wide to allow formatted cmake files -line_width: 80 - -# How many spaces to tab for indent -tab_size: 2 - -# Format command names consistently as 'lower' or 'upper' case -command_case: "lower" - -first_comment_is_literal: False - -# enable comment markup parsing and reflow -enable_markup: False - -# If arglists are longer than this, break them always -max_subargs_per_line: 1 - -max_subgroups_hwrap: 2 - -max_pargs_hwrap: 2 diff --git a/examples/espidf-coap-server/components/libcoap/cmake/FindMbedTLS.cmake b/examples/espidf-coap-server/components/libcoap/cmake/FindMbedTLS.cmake deleted file mode 100644 index 75d8598..0000000 --- a/examples/espidf-coap-server/components/libcoap/cmake/FindMbedTLS.cmake +++ /dev/null @@ -1,35 +0,0 @@ -find_path(MBEDTLS_INCLUDE_DIRS mbedtls/ssl.h) - -find_library(MBEDTLS_LIBRARY mbedtls) -find_library(MBEDX509_LIBRARY mbedx509) -find_library(MBEDCRYPTO_LIBRARY mbedcrypto) - -set(MBEDTLS_LIBRARIES - "${MBEDTLS_LIBRARY}" - "${MBEDX509_LIBRARY}" - "${MBEDCRYPTO_LIBRARY}") - -if(MBEDTLS_LIBRARY) - set(MbedTLS_FOUND TRUE) -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - MBEDTLS - DEFAULT_MSG - MBEDTLS_INCLUDE_DIRS - MBEDTLS_LIBRARY - MBEDX509_LIBRARY - MBEDCRYPTO_LIBRARY) - -mark_as_advanced( - MBEDTLS_INCLUDE_DIRS - MBEDTLS_LIBRARY - MBEDX509_LIBRARY - MBEDCRYPTO_LIBRARY) - -message(STATUS "MBEDTLS_INCLUDE_DIRS: ${MBEDTLS_INCLUDE_DIRS}") -message(STATUS "MBEDTLS_LIBRARY: ${MBEDTLS_LIBRARY}") -message(STATUS "MBEDX509_LIBRARY: ${MBEDX509_LIBRARY}") -message(STATUS "MBEDCRYPTO_LIBRARY: ${MBEDCRYPTO_LIBRARY}") -message(STATUS "MBEDTLS_LIBRARIES: ${MBEDTLS_LIBRARIES}") diff --git a/examples/espidf-coap-server/components/libcoap/cmake/FindTinyDTLS.cmake b/examples/espidf-coap-server/components/libcoap/cmake/FindTinyDTLS.cmake deleted file mode 100644 index 9955732..0000000 --- a/examples/espidf-coap-server/components/libcoap/cmake/FindTinyDTLS.cmake +++ /dev/null @@ -1,88 +0,0 @@ -# FindTinyDTLS -# ----------- -# -# Find the tinyDTLS encryption library. -# -# Imported Targets -# ^^^^^^^^^^^^^^^^ -# -# This module defines the following :prop_tgt:`IMPORTED` targets: -# -# ``tinydtls`` -# The tinyDTLS ``tinydtls`` library, if found. -# -# Result Variables -# ^^^^^^^^^^^^^^^^ -# -# This module will set the following variables in your project: -# -# ``TINYDTLS_FOUND`` -# System has the tinyDTLS library. -# ``TINYDTLS_INCLUDE_DIR`` -# The tinyDTLS include directory. -# ``TINYDTLS_LIBRARIES`` -# All tinyDTLS libraries. -# -# Hints -# ^^^^^ -# -# Set ``TINYDTLS_ROOT_DIR`` to the root directory of an tinyDTLS installation. - -if(TINYDTLS_ROOT_DIR) - set(_EXTRA_FIND_ARGS "NO_CMAKE_FIND_ROOT_PATH") -endif() - -find_path( - TINYDTLS_INCLUDE_DIR - NAMES tinydtls/dtls.h - PATH_SUFFIXES include - HINTS ${PROJECT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - ${TINYDTLS_ROOT_DIR} - ${_EXTRA_FIND_ARGS}) - -find_library( - TINYDTLS_LIBRARIES - NAMES tinydtls - PATH_SUFFIXES lib - HINTS ${PROJECT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - ${TINYDTLS_ROOT_DIR} - ${_EXTRA_FIND_ARGS}) - -if(TINYDTLS_LIBRARIES) - set(TINYDTLS_FOUND TRUE) -else() - set(TINYDTLS_FOUND FALSE) - if(TinyDTLS_FIND_REQUIRED) - message(FATAL_ERROR "Tinydtls could not be found") - endif() -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - tinyDTLS - FOUND_VAR - TINYDTLS_FOUND - REQUIRED_VARS - TINYDTLS_INCLUDE_DIR - TINYDTLS_LIBRARIES - VERSION_VAR) - -if(NOT - TARGET - tinydtls) - add_library( - tinydtls - UNKNOWN - IMPORTED) - set_target_properties( - tinydtls - PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${TINYDTLS_INCLUDE_DIR}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${TINYDTLS_LIBRARIES}") -endif() - -message(STATUS "TINYDTLS_INCLUDE_DIR: ${TINYDTLS_INCLUDE_DIR}") -message(STATUS "TINYDTLS_LIBRARIES: ${TINYDTLS_LIBRARIES}") -message(STATUS "TINYDTLS_ROOT_DIR: ${TINYDTLS_ROOT_DIR}") diff --git a/examples/espidf-coap-server/components/libcoap/cmake_coap_config.h.in b/examples/espidf-coap-server/components/libcoap/cmake_coap_config.h.in deleted file mode 100644 index d01ab53..0000000 --- a/examples/espidf-coap-server/components/libcoap/cmake_coap_config.h.in +++ /dev/null @@ -1,177 +0,0 @@ -/* - * cmake_coap_config.h -- cmake configuration for libcoap - * - * Copyright (C) 2020 Carlos Gomes Martinho - * Copyright (C) 2021-2022 Jon Shallow - * - * SPDX-License-Identifier: BSD-2-Clause - * - * This file is part of the CoAP library libcoap. Please see README for terms - * of use. - */ - -#ifndef COAP_CONFIG_H_ -#define COAP_CONFIG_H_ - -#if ! defined(_WIN32) -#define _GNU_SOURCE -#endif - -/* Define to 1 if you have header file. */ -#cmakedefine HAVE_WS2TCPIP_H @HAVE_WS2TCPIP_H@ - -/* Define if the system has small stack size */ -#cmakedefine COAP_CONSTRAINED_STACK @COAP_CONSTRAINED_STACK@ - -/* Define to 1 if you have header file. */ -#cmakedefine HAVE_WINSOCK2_H @HAVE_WINSOCK2_H@ - -/* Define if the library has client support */ -#cmakedefine COAP_CLIENT_SUPPORT @COAP_CLIENT_SUPPORT@ - -/* Define if the library has server support */ -#cmakedefine COAP_SERVER_SUPPORT @COAP_SERVER_SUPPORT@ - -/* Define if the system has epoll support */ -#cmakedefine COAP_EPOLL_SUPPORT @COAP_EPOLL_SUPPORT@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_ARPA_INET_H @HAVE_ARPA_INET_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_ASSERT_H @HAVE_ASSERT_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_DLFCN_H @HAVE_DLFCN_H@ - -/* Define to 1 if you have the `getaddrinfo' function. */ -#cmakedefine HAVE_GETADDRINFO @HAVE_GETADDRINFO@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_INTTYPES_H @HAVE_INTTYPES_H@ - -/* Define if the system has openssl */ -#cmakedefine HAVE_OPENSSL @HAVE_OPENSSL@ - -/* Define if the system has libgnutls28 */ -#cmakedefine HAVE_LIBGNUTLS @HAVE_LIBGNUTLS@ - -/* Define if the system has libtinydtls */ -#cmakedefine HAVE_LIBTINYDTLS @HAVE_LIBTINYDTLS@ - -/* Define if the system has libmbedtls */ -#cmakedefine HAVE_MBEDTLS @HAVE_MBEDTLS@ - -/* Define to 1 to build without TCP support. */ -#cmakedefine01 COAP_DISABLE_TCP - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LIMITS_H @HAVE_LIMITS_H@ - -/* Define to 1 if you have the `malloc' function. */ -#cmakedefine HAVE_MALLOC @HAVE_MALLOC@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_MEMORY_H @HAVE_MEMORY_H@ - -/* Define to 1 if you have the `memset' function. */ -#cmakedefine HAVE_MEMSET @HAVE_MEMSET@ - -/* Define to 1 if you have the `if_nametoindex' function. */ -#cmakedefine HAVE_IF_NAMETOINDEX @HAVE_IF_NAMETOINDEX@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_NETDB_H @HAVE_NETDB_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_NET_IF_H @HAVE_NET_IF_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_NETINET_IN_H @HAVE_NETINET_IN_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_PTHREAD_H @HAVE_PTHREAD_H@ - -/* Define to 1 if you have the `pthread_mutex_lock' function. */ -#cmakedefine HAVE_PTHREAD_MUTEX_LOCK @HAVE_PTHREAD_MUTEX_LOCK@ - -/* Define to 1 if you have the `select' function. */ -#cmakedefine HAVE_SELECT @HAVE_SELECT@ - -/* Define to 1 if you have the `socket' function. */ -#cmakedefine HAVE_SOCKET @HAVE_SOCKET@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDINT_H @HAVE_STDINT_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDLIB_H @HAVE_STDLIB_H@ - -/* Define to 1 if you have the `strcasecmp' function. */ -#cmakedefine HAVE_STRCASECMP @HAVE_STRCASECMP@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STRINGS_H @HAVE_STRINGS_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STRING_H @HAVE_STRING_H@ - -/* Define to 1 if you have the `strnlen' function. */ -#cmakedefine HAVE_STRNLEN @HAVE_STRNLEN@ - -/* Define to 1 if you have the `strrchr' function. */ -#cmakedefine HAVE_STRRCHR @HAVE_STRRCHR@ - -/* Define to 1 if the system has the type `struct cmsghdr'. */ -#cmakedefine HAVE_STRUCT_CMSGHDR @HAVE_STRUCT_CMSGHDR@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYSLOG_H @HAVE_SYSLOG_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_IOCTL_H @HAVE_SYS_IOCTL_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_SOCKET_H @HAVE_SYS_SOCKET_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_STAT_H @HAVE_SYS_STAT_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_TIME_H @HAVE_SYS_TIME_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_UNISTD_H @HAVE_SYS_UNISTD_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_TIME_H @HAVE_TIME_H@ - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@ - -/* Define to the address where bug reports for this package should be sent. */ -#cmakedefine PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" - -/* Define to the full name of this package. */ -#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@" - -/* Define to the full name and version of this package. */ -#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@" - -/* Define to the one symbol short name of this package. */ -#cmakedefine PACKAGE_TARNAME "@PACKAGE_TARNAME@" - -/* Define to the home page for this package. */ -#cmakedefine PACKAGE_URL "@PACKAGE_URL@" - -/* Define to the version of this package. */ -#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@" - -#if defined(_MSC_VER) && (_MSC_VER < 1900) && !defined(snprintf) -#define snprintf _snprintf -#endif - -#endif /* COAP_CONFIG_H_ */ diff --git a/examples/espidf-coap-server/components/libcoap/coap_config.h.contiki b/examples/espidf-coap-server/components/libcoap/coap_config.h.contiki deleted file mode 100644 index 6e4f541..0000000 --- a/examples/espidf-coap-server/components/libcoap/coap_config.h.contiki +++ /dev/null @@ -1,215 +0,0 @@ -#ifndef COAP_CONFIG_H_ -#define COAP_CONFIG_H_ - -#include "contiki.h" -#include "contiki-lib.h" -#include "contiki-net.h" - -#define WITH_CONTIKI 1 - -#ifndef COAP_CONSTRAINED_STACK -#define COAP_CONSTRAINED_STACK 1 -#endif - -#ifndef COAP_DISABLE_TCP -#define COAP_DISABLE_TCP 1 -#endif - -#define PACKAGE_STRING "libcoap" -#define PACKAGE_NAME "libcoap" - -#ifndef COAP_DEFAULT_PDU_SIZE -#define COAP_DEFAULT_PDU_SIZE 64 -#endif /* COAP_DEFAULT_PDU_SIZE */ -#ifndef COAP_RXBUFFER_SIZE -#define COAP_RXBUFFER_SIZE 64 -#endif /* COAP_RXBUFFER_SIZE */ - -/** Number of resources that can be handled by a CoAP server in addition to - * @c /.well-known/core */ -#ifndef COAP_MAX_RESOURCES -#define COAP_MAX_RESOURCES 3 -#endif /* COAP_MAX_RESOURCES */ - -/** Number of attributes that can be handled (should be at least - * @c 2 * COAP_MAX_RESOURCES. to carry the content type and the - * resource type. */ -#ifndef COAP_MAX_ATTRIBUTES -#define COAP_MAX_ATTRIBUTES 4 -#endif /* COAP_MAX_ATTRIBUTES */ - -/** - * Number of PDUs that can be stored simultaneously. This number - * includes both, the PDUs stored for retransmission as well as the - * PDUs received. Beware that choosing a too small value can lead to - * many retransmissions to be dealt with. - */ -#ifndef COAP_PDU_MAXCNT -#define COAP_PDU_MAXCNT 4 -#endif /* COAP_PDU_MAXCNT */ - -/** - * Maximum number of sessions. - */ -#ifndef COAP_MAX_SESSIONS -#define COAP_MAX_SESSIONS 2 -#endif /* COAP_MAX_SESSIONS */ - -/** - * Maximum number of subscriptions. Every additional subscriber costs - * 36 B. - */ -#ifndef COAP_MAX_SUBSCRIBERS -#define COAP_MAX_SUBSCRIBERS 3 -#endif /* COAP_MAX_SUBSCRIBERS */ - -/** - * The maximum number of cache-key entries that allocate - * fixed-size memory blocks. - */ -#ifndef COAP_MAX_CACHE_KEYS -#define COAP_MAX_CACHE_KEYS (2U) -#endif /* COAP_MAX_CACHE_KEYS */ - -/** - * The maximum number of cache-entry entries that allocate - * fixed-size memory blocks. - */ -#ifndef COAP_MAX_CACHE_ENTRIES -#define COAP_MAX_CACHE_ENTRIES (2U) -#endif /* COAP_MAX_CACHE_ENTRIES */ - -/** - * Maximum number of large body transmissions. - */ -#ifndef COAP_MAX_LG_XMIT -#define COAP_MAX_LG_XMIT 2 -#endif /* COAP_MAX_LG_XMIT */ - -/** - * Maximum number of large body client receives. - */ -#ifndef COAP_MAX_LG_CRCV -#define COAP_MAX_LG_CRCV 2 -#endif /* COAP_MAX_LG_CRCV */ - -/** - * Maximum number of large body server receives. - */ -#ifndef COAP_MAX_LG_SRCV -#define COAP_MAX_LG_SRCV 2 -#endif /* COAP_MAX_LG_SRCV */ - -/** - * Number of notifications that may be sent non-confirmable before a confirmable - * message is sent to detect if observers are alive. The maximum allowed value - * here is @c 255. - */ -#ifndef COAP_OBS_MAX_NON -#define COAP_OBS_MAX_NON 5 -#endif /* COAP_OBS_MAX_NON */ -#if COAP_OBS_MAX_NON > 255 -#error COAP_OBS_MAX_NON is too large -#endif /* COAP_OBS_MAX_NON > 255 */ - -/** - * Number of different confirmable notifications that may fail (i.e. those - * that have hit MAX_RETRANSMIT multiple times) before an observer is removed. - * The maximum value for COAP_OBS_MAX_FAIL is @c 255. - */ -#ifndef COAP_OBS_MAX_FAIL -#define COAP_OBS_MAX_FAIL 1 -#endif /* COAP_OBS_MAX_FAIL */ -#if COAP_OBS_MAX_FAIL > 255 -#error COAP_OBS_MAX_FAIL is too large -#endif /* COAP_OBS_MAX_FAIL > 255 */ - -#ifndef DEBUG -# define DEBUG DEBUG_PRINT -#endif - -#define HAVE_STRNLEN 1 -#define HAVE_SNPRINTF 1 -#define HAVE_STRINGS_H 1 - -/* there is no file-oriented output */ -#define COAP_DEBUG_FD NULL -#define COAP_ERR_FD NULL - -#include "contiki-conf.h" - -#if (defined(PLATFORM) && PLATFORM == PLATFORM_MC1322X) || defined(CONTIKI_TARGET_ECONOTAG) -/* Redbee econotags get a special treatment here: endianness is set - * explicitly, and - */ - -#define BYTE_ORDER UIP_LITTLE_ENDIAN - -#define HAVE_ASSERT_H -#define HAVE_UNISTD_H -#define HAVE_SYS_TYPES_H -#define HAVE_LIMITS_H -#endif /* PLATFORM_MC1322X || CONTIKI_TARGET_ECONOTAG */ - -#if defined(TMOTE_SKY) || defined(CONTIKI_TARGET_SKY) || defined(CONTIKI_TARGET_WISMOTE) -/* Need to set the byte order for TMote Sky explicitely */ - -#define BYTE_ORDER UIP_LITTLE_ENDIAN -#undef COAP_DEFAULT_PDU_SIZE -#undef COAP_RXBUFFER_SIZE -#define COAP_DEFAULT_PDU_SIZE 100 -#define COAP_RXBUFFER_SIZE 100 - -#define COAP_MAX_BLOCK_SZX 2 - -typedef int ssize_t; -typedef void FILE; - -#define HAVE_LIMITS_H 1 -#undef HAVE_ASSERT_H -#define HAVE_VPRINTF 1 -#endif /* defined(TMOTE_SKY) */ - -#ifdef CONTIKI_TARGET_MINIMAL_NET -#undef COAP_DEFAULT_PDU_SIZE -#undef COAP_RXBUFFER_SIZE -#define COAP_DEFAULT_PDU_SIZE 1152 -#define COAP_RXBUFFER_SIZE 1472 -#define HAVE_ASSERT_H 1 -#define HAVE_VPRINTF 1 -#define HAVE_SYS_TYPES_H 1 -#endif /* CONTIKI_TARGET_MINIMAL_NET */ - -#ifdef CONTIKI_TARGET_CC2538DK -#define BYTE_ORDER UIP_LITTLE_ENDIAN -#undef COAP_DEFAULT_PDU_SIZE -#undef COAP_RXBUFFER_SIZE -#define COAP_DEFAULT_PDU_SIZE 100 -#define COAP_RXBUFFER_SIZE 100 - -#undef COAP_MAX_BLOCK_SZX -#define COAP_MAX_BLOCK_SZX 2 - -#define HAVE_LIMITS_H 1 -#endif /* CONTIKI_TARGET_CC2538DK */ - -#ifndef BYTE_ORDER -# ifdef UIP_CONF_BYTE_ORDER -# define BYTE_ORDER UIP_CONF_BYTE_ORDER -# else -# error "UIP_CONF_BYTE_ORDER not defined" -# endif /* UIP_CONF_BYTE_ORDER */ -#endif /* BYTE_ORDER */ - -/* Define assert() as empty directive unless HAVE_ASSERT_H is given. */ -#ifndef HAVE_ASSERT_H -# define assert(x) -#endif - -#define ntohs uip_ntohs - -#include -#define coap_log(fd, ...) printf(__VA_ARGS__) - -#endif /* COAP_CONFIG_H_ */ - diff --git a/examples/espidf-coap-server/components/libcoap/coap_config.h.lwip b/examples/espidf-coap-server/components/libcoap/coap_config.h.lwip deleted file mode 100644 index 265e892..0000000 --- a/examples/espidf-coap-server/components/libcoap/coap_config.h.lwip +++ /dev/null @@ -1,42 +0,0 @@ -/* - * coap_config.h.lwip -- LwIP configuration for libcoap - * - * Copyright (C) 2021-2022 Olaf Bergmann and others - * - * SPDX-License-Identifier: BSD-2-Clause - * - * This file is part of the CoAP library libcoap. Please see README for terms - * of use. - */ - -#ifndef COAP_CONFIG_H_ -#define COAP_CONFIG_H_ - -#include -#include -#include /* provide ntohs, htons */ - -#define WITH_LWIP 1 - -#ifndef COAP_CONSTRAINED_STACK -#define COAP_CONSTRAINED_STACK 1 -#endif - -#ifndef COAP_DISABLE_TCP -#define COAP_DISABLE_TCP 1 -#endif - -#define PACKAGE_NAME "libcoap" -#define PACKAGE_VERSION "4.3.1" -#define PACKAGE_STRING "libcoap 4.3.1" - -#define assert(x) LWIP_ASSERT("CoAP assert failed", x) - -/* it's just provided by libc. i hope we don't get too many of those, as - * actually we'd need autotools again to find out what environment we're - * building in */ -#define HAVE_STRNLEN 1 - -#define HAVE_LIMITS_H - -#endif /* COAP_CONFIG_H_ */ diff --git a/examples/espidf-coap-server/components/libcoap/coap_config.h.lwip.in b/examples/espidf-coap-server/components/libcoap/coap_config.h.lwip.in deleted file mode 100644 index 2fcf3cb..0000000 --- a/examples/espidf-coap-server/components/libcoap/coap_config.h.lwip.in +++ /dev/null @@ -1,42 +0,0 @@ -/* - * coap_config.h.lwip -- LwIP configuration for libcoap - * - * Copyright (C) 2021-2022 Olaf Bergmann and others - * - * SPDX-License-Identifier: BSD-2-Clause - * - * This file is part of the CoAP library libcoap. Please see README for terms - * of use. - */ - -#ifndef COAP_CONFIG_H_ -#define COAP_CONFIG_H_ - -#include -#include -#include /* provide ntohs, htons */ - -#define WITH_LWIP 1 - -#ifndef COAP_CONSTRAINED_STACK -#define COAP_CONSTRAINED_STACK 1 -#endif - -#ifndef COAP_DISABLE_TCP -#define COAP_DISABLE_TCP 1 -#endif - -#define PACKAGE_NAME "@PACKAGE_NAME@" -#define PACKAGE_VERSION "@PACKAGE_VERSION@" -#define PACKAGE_STRING "@PACKAGE_STRING@" - -#define assert(x) LWIP_ASSERT("CoAP assert failed", x) - -/* it's just provided by libc. i hope we don't get too many of those, as - * actually we'd need autotools again to find out what environment we're - * building in */ -#define HAVE_STRNLEN 1 - -#define HAVE_LIMITS_H - -#endif /* COAP_CONFIG_H_ */ diff --git a/examples/espidf-coap-server/components/libcoap/coap_config.h.riot b/examples/espidf-coap-server/components/libcoap/coap_config.h.riot deleted file mode 100644 index 58f3f27..0000000 --- a/examples/espidf-coap-server/components/libcoap/coap_config.h.riot +++ /dev/null @@ -1,143 +0,0 @@ -/* - * coap_config.h.riot -- RIOT configuration for libcoap - * - * Copyright (C) 2021-2022 Olaf Bergmann and others - * - * SPDX-License-Identifier: BSD-2-Clause - * - * This file is part of the CoAP library libcoap. Please see README for terms - * of use. - */ - -#ifndef COAP_CONFIG_H_RIOT_ -#define COAP_CONFIG_H_RIOT_ - -#define WITH_POSIX 1 - -#ifndef COAP_CONSTRAINED_STACK -#define COAP_CONSTRAINED_STACK 1 -#endif - -#ifndef COAP_DISABLE_TCP -#define COAP_DISABLE_TCP 1 -#endif - -/* Define if building universal (internal helper macro) */ -/* #undef AC_APPLE_UNIVERSAL_BUILD */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ARPA_INET_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_ASSERT_H 1 - -/* Define to 1 if you have the `getaddrinfo' function. */ -/* #undef HAVE_GETADDRINFO */ - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LIMITS_H */ - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#undef HAVE_MALLOC - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MEMORY_H */ - -/* Define to 1 if you have the `memset' function. */ -#define HAVE_MEMSET 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETDB_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_NETINET_IN_H 1 - -/* Define to 1 if you have the `select' function. */ -/* #undef HAVE_SELECT */ - -/* Define to 1 if you have the `socket' function. */ -#define HAVE_SOCKET 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strcasecmp' function. */ -#define HAVE_STRCASECMP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strnlen' function. */ -/* #undef HAVE_STRNLEN */ - -/* Define to 1 if you have the `strrchr' function. */ -#define HAVE_STRRCHR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SOCKET_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_STAT_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_UNISTD_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "libcoap-developers@lists.sourceforge.net" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "libcoap" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "4.3.1" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "libcoap 4.3.1" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -/* # undef WORDS_BIGENDIAN */ -# endif -#endif - -/* Define to rpl_malloc if the replacement function should be used. */ -/* #undef malloc */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ - -/* Define to `int' if does not define. */ -/* #undef ssize_t */ - -#endif /* COAP_CONFIG_H_RIOT_ */ diff --git a/examples/espidf-coap-server/components/libcoap/coap_config.h.riot.in b/examples/espidf-coap-server/components/libcoap/coap_config.h.riot.in deleted file mode 100644 index d0fecd6..0000000 --- a/examples/espidf-coap-server/components/libcoap/coap_config.h.riot.in +++ /dev/null @@ -1,143 +0,0 @@ -/* - * coap_config.h.riot -- RIOT configuration for libcoap - * - * Copyright (C) 2021-2022 Olaf Bergmann and others - * - * SPDX-License-Identifier: BSD-2-Clause - * - * This file is part of the CoAP library libcoap. Please see README for terms - * of use. - */ - -#ifndef COAP_CONFIG_H_RIOT_ -#define COAP_CONFIG_H_RIOT_ - -#define WITH_POSIX 1 - -#ifndef COAP_CONSTRAINED_STACK -#define COAP_CONSTRAINED_STACK 1 -#endif - -#ifndef COAP_DISABLE_TCP -#define COAP_DISABLE_TCP 1 -#endif - -/* Define if building universal (internal helper macro) */ -/* #undef AC_APPLE_UNIVERSAL_BUILD */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ARPA_INET_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_ASSERT_H 1 - -/* Define to 1 if you have the `getaddrinfo' function. */ -/* #undef HAVE_GETADDRINFO */ - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LIMITS_H */ - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#undef HAVE_MALLOC - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_MEMORY_H */ - -/* Define to 1 if you have the `memset' function. */ -#define HAVE_MEMSET 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETDB_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_NETINET_IN_H 1 - -/* Define to 1 if you have the `select' function. */ -/* #undef HAVE_SELECT */ - -/* Define to 1 if you have the `socket' function. */ -#define HAVE_SOCKET 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strcasecmp' function. */ -#define HAVE_STRCASECMP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strnlen' function. */ -/* #undef HAVE_STRNLEN */ - -/* Define to 1 if you have the `strrchr' function. */ -#define HAVE_STRRCHR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SOCKET_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_STAT_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_UNISTD_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "@PACKAGE_NAME@" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "@PACKAGE_VERSION@" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "@PACKAGE_STRING@" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -/* # undef WORDS_BIGENDIAN */ -# endif -#endif - -/* Define to rpl_malloc if the replacement function should be used. */ -/* #undef malloc */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ - -/* Define to `int' if does not define. */ -/* #undef ssize_t */ - -#endif /* COAP_CONFIG_H_RIOT_ */ diff --git a/examples/espidf-coap-server/components/libcoap/coap_config.h.windows b/examples/espidf-coap-server/components/libcoap/coap_config.h.windows deleted file mode 100644 index 161fe18..0000000 --- a/examples/espidf-coap-server/components/libcoap/coap_config.h.windows +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef COAP_CONFIG_H_ -#define COAP_CONFIG_H_ - -#if defined(_WIN32) - -/* Define to 1 if you have header file. */ -#define HAVE_WS2TCPIP_H 1 - -/* Define to 1 if you have header file. */ -#define HAVE_WINSOCK2_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_ASSERT_H 1 - -/* Define to 1 if you have the `getaddrinfo' function. */ -#define HAVE_GETADDRINFO 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define to 1 if you have the `malloc' function. */ -#define HAVE_MALLOC 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `memset' function. */ -#define HAVE_MEMSET 1 - -/* Define to 1 if you have the `select' function. */ -#define HAVE_SELECT 1 - -/* Define to 1 if you have the `socket' function. */ -#define HAVE_SOCKET 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strnlen' function. */ -#define HAVE_STRNLEN 1 - -/* Define to 1 if you have the `strrchr' function. */ -#define HAVE_STRRCHR 1 - -/* Define to 1 if the system has the type `struct cmsghdr'. */ -#define HAVE_STRUCT_CMSGHDR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_TIME_H 1 - -#if defined(_MSC_VER) && (_MSC_VER < 1900) && !defined(snprintf) -#define snprintf _snprintf -#endif - -#ifndef COAP_DISABLE_TCP -#define COAP_DISABLE_TCP 0 -#endif - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "libcoap-developers@lists.sourceforge.net" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "libcoap" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "libcoap 4.3.1" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "libcoap" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "https://libcoap.net/" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "4.3.1" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -/* # undef WORDS_BIGENDIAN */ -# endif -#endif - -/* Define this to 1 for ancillary data on MacOS */ -/* #undef __APPLE_USE_RFC_3542 */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ - -/* Define to `int' if does not define. */ -/* #undef ssize_t */ - -#endif - -#endif /* COAP_CONFIG_H_ */ diff --git a/examples/espidf-coap-server/components/libcoap/coap_config.h.windows.in b/examples/espidf-coap-server/components/libcoap/coap_config.h.windows.in deleted file mode 100644 index 84ef458..0000000 --- a/examples/espidf-coap-server/components/libcoap/coap_config.h.windows.in +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef COAP_CONFIG_H_ -#define COAP_CONFIG_H_ - -#if defined(_WIN32) - -/* Define to 1 if you have header file. */ -#define HAVE_WS2TCPIP_H 1 - -/* Define to 1 if you have header file. */ -#define HAVE_WINSOCK2_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_ASSERT_H 1 - -/* Define to 1 if you have the `getaddrinfo' function. */ -#define HAVE_GETADDRINFO 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define to 1 if you have the `malloc' function. */ -#define HAVE_MALLOC 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `memset' function. */ -#define HAVE_MEMSET 1 - -/* Define to 1 if you have the `select' function. */ -#define HAVE_SELECT 1 - -/* Define to 1 if you have the `socket' function. */ -#define HAVE_SOCKET 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strnlen' function. */ -#define HAVE_STRNLEN 1 - -/* Define to 1 if you have the `strrchr' function. */ -#define HAVE_STRRCHR 1 - -/* Define to 1 if the system has the type `struct cmsghdr'. */ -#define HAVE_STRUCT_CMSGHDR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_TIME_H 1 - -#if defined(_MSC_VER) && (_MSC_VER < 1900) && !defined(snprintf) -#define snprintf _snprintf -#endif - -#ifndef COAP_DISABLE_TCP -#define COAP_DISABLE_TCP 0 -#endif - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "@PACKAGE_NAME@" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "@PACKAGE_STRING@" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "@PACKAGE_TARNAME@" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "@PACKAGE_URL@" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "@PACKAGE_VERSION@" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -/* # undef WORDS_BIGENDIAN */ -# endif -#endif - -/* Define this to 1 for ancillary data on MacOS */ -/* #undef __APPLE_USE_RFC_3542 */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ - -/* Define to `int' if does not define. */ -/* #undef ssize_t */ - -#endif - -#endif /* COAP_CONFIG_H_ */ diff --git a/examples/espidf-coap-server/components/libcoap/configure.ac b/examples/espidf-coap-server/components/libcoap/configure.ac deleted file mode 100644 index 5c46cc6..0000000 --- a/examples/espidf-coap-server/components/libcoap/configure.ac +++ /dev/null @@ -1,1106 +0,0 @@ -# configure.ac for the libcoap package -# -# Copyright (C) 2010-2022 Olaf Bergmann -# Copyright (C) 2015-2018 Carsten Schoenert -# Copyright (C) 2018-2022 Jon Shallow -# -# SPDX-License-Identifier: BSD-2-Clause -# -# This file is part of the CoAP library libcoap. Please see README for terms -# of use. -# -# Please run 'autogen.sh' to let autoconf produce a configure script. - -# Define the libcoap software version here. Note! The libtool versions are -# defined later. -m4_define([libcoap_major_version], [4]) -m4_define([libcoap_minor_version], [3]) -m4_define([libcoap_micro_version], [1]) - -# define an appending release state if needed, for example for pre-releases -# like 'alpha' or 'rc1', for a full release keep the value empty! -m4_define([libcoap_release_state], []) - -# concatenate the full libcoap version string -m4_define([libcoap_version], [m4_format([%s.%s.%s%s], libcoap_major_version, libcoap_minor_version, libcoap_micro_version, libcoap_release_state)]) - -AC_INIT([libcoap], [libcoap_version], [libcoap-developers@lists.sourceforge.net], [libcoap], [https://libcoap.net/]) -AC_PREREQ([2.64]) -AM_INIT_AUTOMAKE([1.10 -Wall no-define no-dist-gzip dist-bzip2]) -PKG_PROG_PKG_CONFIG([0.20]) -AM_SILENT_RULES([yes]) -AC_HEADER_ASSERT - -# Generate one configuration header file for building the library itself with -# an auto generated template. We need later a second one -# (include/coap$LIBCOAP_API_VERSION/libcoap.h) that will be installed alongside the library. -AC_CONFIG_HEADERS([coap_config.h]) - -AC_PROG_CC -AM_PROG_CC_C_O -AC_PROG_SED -AC_CONFIG_MACRO_DIR([m4]) -m4_pattern_allow([AM_PROG_AR]) -AM_PROG_AR -AC_PROG_LN_S -AC_PROG_MKDIR_P - -AC_C_BIGENDIAN - -# enable the automatically build of shared and static libraries -LT_INIT([shared static]) - -# Setting the libtool versioning -################################################################################### -# # -# To set the version of the library, libtool provides the -version-info # -# parameter, which accepts three numbers, separated by colons, that are called # -# respectively, current, revision and age. Both their name and their behavior, # -# nowadays, have to be considered fully arbitrary, as the explanation provided # -# in the official documentation is confusing to say the least, and can be, in # -# some cases, considered completely wrong. # -# https://autotools.io/libtool/version.html # -# # -################################################################################### -# -# How to work with the libtool versioning? -# -# Follow the following steps from top to bottom. This means always start at point 1 -# if you plan to make a release and change the values. -# Every new library starts with a version 'current' (short 'c') = 0 -# 'revision' (short 'r') = 0 -# 'age' (short 'a') = 0 -# -# Update the libtool versioning only after the release of a public release of libcoap. -# Go through the following checklist from top to bottom and check your needs, following -# the reminded changes if you can say "Yes" for specific check. -# -# 1. Only existing code has changed, no functional changes -# If the library source code has changed but *no* new symbols were added at all -# since the last update, then increment revision (c:r:a becomes c:r+1:a). -# This is usually happen if the existing source of a function was changed for -# bug fixing e.g. -# -# --> Increase the 'LT_LIBCOAP_REVISION' value with *every* new software release -# within one release cycle. -# -# 2. Interfaces were added, functions have changed or are removed -# If any interfaces [exported functions or data] have been added, got internal -# changes that implies a different behavior or removed and by this the visible -# symbols have changed since the last update, increment current, and set -# revision to 0 (c:r:a becomes c+1:r=0:a). -# -# --> Increase the 'LT_LIBCOAP_CURRENT' value whenever as an interface has been added -# or removed. This implies also a API change! You mostly have to change the -# 'libcoap_major_version' or at least 'libcoap_minor_version' then too! -# --> Set 'LT_LIBCOAP_REVISION' to 0. -# -# 3. Interfaces were added but none removed or changed -# If any interfaces have been added since the last public release and non of the -# existing interfaces were removed and existing interfaces have not changed internal -# functionality then the new library is backward compatible. Existing binaries can -# use the new library the same than as the existing old library without loosing -# existing functionality or breakage. -# Increase age by 1 (c:r:a becomes c:r:a+1). -# -# --> Increase the 'LT_LIBCOAP_AGE' value only if the changes made to the ABI are -# backward compatible. -# -# 4. Interfaces were removed or have functional changes -# If any interfaces within the library have been removed since the last public -# release or got some internal changes that let the interface act different than -# before, then set age to 0. The library isn't backwards compatible. -# -# --> Set 'LT_LIBCOAP_AGE' to 0. - -LT_LIBCOAP_CURRENT=3 -LT_LIBCOAP_REVISION=0 -LT_LIBCOAP_AGE=0 -LIBCOAP_SO_VERSION=$LT_LIBCOAP_CURRENT.$LT_LIBCOAP_REVISION.$LT_LIBCOAP_AGE - -# Announce the libtool version -AC_SUBST(LT_LIBCOAP_CURRENT) -AC_SUBST(LT_LIBCOAP_REVISION) -AC_SUBST(LT_LIBCOAP_AGE) -AC_SUBST(LIBCOAP_SO_VERSION) - -# Defining the API Version -LIBCOAP_API_VERSION=3 -AC_SUBST(LIBCOAP_API_VERSION) - -# Define a numeric version string -m4_define([version_number], - [m4_format([%u%03u%03u], - libcoap_major_version, - libcoap_minor_version, - libcoap_micro_version)]) -LIBCOAP_VERSION=version_number -AC_SUBST(LIBCOAP_VERSION) - -# Adding some default warning options for code QS -# see https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html -# and http://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html -WARNING_CFLAGS="\ --pedantic \ --Wall \ --Wcast-qual \ --Wextra \ --Wformat-security \ --Winline \ --Wmissing-declarations \ --Wmissing-prototypes \ --Wnested-externs \ --Wpointer-arith \ --Wshadow \ --Wstrict-prototypes \ --Wswitch-default \ --Wswitch-enum \ --Wunused \ --Wwrite-strings \ -" - -# check whether or not the compiler supports -Wlogical-op (clang does not...) -AX_CHECK_COMPILE_FLAG([-Wlogical-op], [WARNING_CFLAGS="$WARNING_CFLAGS -Wlogical-op"],,[-Werror]) -AX_CHECK_COMPILE_FLAG([-fdiagnostics-color], [CFLAGS="$CFLAGS -fdiagnostics-color"],,[-Werror]) -AX_CHECK_COMPILE_FLAG([-Wunused-result], [WARNING_CFLAGS="$WARNING_CFLAGS -Wunused-result"]) - -AC_SUBST([WARNING_CFLAGS]) - -AX_CHECK_LINK_FLAG([-Wl,--version-script=${srcdir}/libcoap-${LIBCOAP_API_VERSION}.map], - [libcoap_SYMBOLS="-Wl,--version-script=\$(srcdir)/libcoap-\$(LIBCOAP_API_VERSION).map"], - [libcoap_SYMBOLS="-export-symbols \$(top_builddir)/libcoap-\$(LIBCOAP_API_VERSION).sym"]) - -AC_SUBST(libcoap_SYMBOLS) - -# configure options -# __documentation__ - -AC_ARG_ENABLE([documentation], - [AS_HELP_STRING([--enable-documentation], - [Enable building all the documentation [default=yes]])], - [build_documentation="$enableval"], - [build_documentation="yes"]) - -AM_CONDITIONAL(BUILD_DOCUMENTATION, [test "x$build_documentation" = "xyes"]) - -doxygen_version_required=1.7.0 -dot_version_required=2.26.0 - -AC_ARG_ENABLE([doxygen], - [AS_HELP_STRING([--enable-doxygen], - [Enable building the doxygen documentation [default=yes]])], - [build_doxygen="$enableval"], - [build_doxygen="yes"]) - -if test -z "$enable_doxygen"; then - if test "x$enable_documentation" = "xno"; then - build_doxygen="no" - fi -fi - -if test "x$build_doxygen" = "xyes"; then - # Check for doxygen - AC_PATH_PROGS([DOXYGEN], [doxygen]) - if test -z "$DOXYGEN"; then - if test "x$build_doxygen" = "xyes"; then - AC_MSG_WARN([==> You want to build the doxygen documentation but doxygen was not found!]) - AC_MSG_ERROR([==> Install the package that contains doxygen or disable the doxygen documentation using '--disable-doxygen'.]) - fi - else - AC_MSG_CHECKING([for compatible doxygen version (>= $doxygen_version_required)]) - doxygen_version=`$DOXYGEN --version` - AS_VERSION_COMPARE([$doxygen_version], - [$doxygen_version_required], - [AC_MSG_RESULT([no]) - DOXYGEN=""], - [AC_MSG_RESULT([yes $doxygen_version])], - [AC_MSG_RESULT([yes $doxygen_version])]) - if test "x$DOXYGEN" = "x" -a "x$build_doxygen" = "xyes"; then - AC_MSG_WARN([==> Doxygen $doxygen_version too old. Doxygen >= $doxygen_version_required required for documentation build.]) - AC_MSG_ERROR([==> Install required doxygen version or disable the doxygen documentation using '--disable-doxygen'.]) - else - # we found doxygen and the version is valid - # now checking dot (needed for graphics) - AC_PATH_PROG([DOT], [dot]) - if test "x$DOT" = "x"; then - AC_MSG_WARN([==> dot not found - continuing without DOT support]) - AC_MSG_WARN([==> The libcoap html documentation will be build without DOT graphics!]) - HAVE_DOT="NO" - USE_CALL_GRAPH="NO" - else - AC_MSG_CHECKING([for compatible dot version (>= $dot_version_required)]) - case $host in - *-freebsd1*) - # csh and tcsh have a different output redirection than more recent shells - # cmd >& file # Redirect both stdout and stderr to file. - # cmd >>& file # Append both stdout and stderr to file. - # cmd1 | cmd2 # pipe stdout to cmd2 - # cmd1 |& cmd2 # pipe stdout and stderr to cmd2 - # Using an explicit call with the default always available C-shell on FreeBSD, - # the user may have installed another shell from a port which we don't know here - dot_version=`export DOT=$DOT && csh -c '$DOT -V |& cut -f5 -d" "'` - ;; - - *) - dot_version=`$DOT -V 2>&1 | cut -f5 -d" "` - ;; - - esac - AS_VERSION_COMPARE([$dot_version], - [$dot_version_required], - [AC_MSG_RESULT([no]) - DOT=""], - [AC_MSG_RESULT([yes $dot_version])], - [AC_MSG_RESULT([yes $dot_version])]) - if test "x$DOT" = "x" -a "x$build_doxygen" = "xyes"; then - AC_MSG_WARN([==> Graphviz dot $dot_version too old. Graphviz >= $dot_version_required required for doxygen build.]) - AC_MSG_ERROR([==> Install required graphviz version or disable the doxygen documentation using '--disable-doxygen'.]) - fi - # we found dot and the version is valid - HAVE_DOT="YES" - # let doxygen create caller graphics - # see http://www.stack.nl/~dimitri/doxygen/manual/config.html#cfg_call_graph - USE_CALL_GRAPH="YES" - # exporting the tests to doc/Doxygen(.in) - AC_SUBST(HAVE_DOT) - AC_SUBST(USE_CALL_GRAPH) - fi - fi - fi -fi -AM_CONDITIONAL(BUILD_DOXYGEN, [test "x$build_doxygen" = "xyes"]) - -AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"]) -AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile])]) - -# __manpages__ - -AC_ARG_ENABLE([manpages], - [AS_HELP_STRING([--enable-manpages], - [Enable building the manpages [default=yes]])], - [build_manpages="$enableval"], - [build_manpages="yes"]) - -if test -z "$enable_manpages"; then - if test "x$enable_documentation" = "xno"; then - build_manpages="no" - fi -fi - -if test "x$build_manpages" = "xyes"; then - AC_ARG_VAR([A2X], [a2x command]) - AC_PATH_PROG([A2X], [a2x]) - if test "x$A2X" = "x"; then - AC_MSG_WARN([==> You want to build the manpages, but a2x was not found!]) - AC_MSG_ERROR([==> Install the package that contains a2x (mostly asciidoc) or disable the build of the manpages using '--disable-manpages'.]) - build_manpages="no" - else - AX_CHECK_A2X_TO_MANPAGE([], [ - AC_MSG_RESULT([no]) - AC_MSG_WARN([==> You want to build the manpages with a2x, but manpage formatting does not work!]) - AC_MSG_ERROR([==> Install the packages that contains the docbook DTD and XSL stylesheets (presumably docbook, docbook-xml) or disable the build of the manpages using '--disable-manpages'.]) - build_manpages="no" - ]) - fi -fi -AM_CONDITIONAL(BUILD_MANPAGES, [test "x$build_manpages" = "xyes"]) - -# configure options -# __dtls__ -# The Datagram Transport Layer Security (DTLS) feature needs cryptography -# functions. -# We currently support the GnuTLS and OpenSSL library. The user can preselect -# the cryptography library that should be used by adding '--with-gnutls' or -# '--with-openssl'. -# If the user isn't using a selection we first search for GnuTLS and fallback -# to OpenSSL if the GnuTLS library couldn't be found. - -gnutls_version_required=3.3.0 -openssl_version_required=1.1.0 -mbedtls_version_required=2.7.10 -tinydtls_version_required=0.8.6 - -AC_ARG_ENABLE([dtls], - [AS_HELP_STRING([--enable-dtls], - [Enable building with DTLS support [default=yes]])], - [build_dtls="$enableval"], - [build_dtls="yes"]) - -AC_ARG_WITH([gnutls], - [AS_HELP_STRING([--with-gnutls], - [Use GnuTLS for DTLS functions])], - [with_gnutls="$withval"], - [with_gnutls="no"]) - -AC_ARG_WITH([openssl], - [AS_HELP_STRING([--with-openssl], - [Use OpenSSL for DTLS functions])], - [with_openssl="$withval"], - [with_openssl="no"]) - -AC_ARG_WITH([mbedtls], - [AS_HELP_STRING([--with-mbedtls], - [Use Mbed TLS for DTLS functions])], - [with_mbedtls="$withval"], - [with_mbedtls="no"]) - -AC_ARG_WITH([tinydtls], - [AS_HELP_STRING([--with-tinydtls], - [Use TinyDTLS for DTLS functions])], - [with_tinydtls="$withval"], - [with_tinydtls="no"]) - -AC_ARG_WITH([submodule-tinydtls], - [AS_HELP_STRING([--with-submodule-tinydtls], - [Use the TinyDTLS provided in the git submodule over the system-provided version [default=fallback to submodule if --with-tinydtls is explicitly set and no system-provided version was found])])], - [with_submodule_tinydtls="$withval"], - [with_submodule_tinydtls="explicit_fallback"]) - -if test "x$with_gnutls" = "xyes" -o "x$with_openssl" = "xyes" -o "x$with_mbedtls" = "xyes" -o "x$with_tinydtls" = "xyes"; then - if test "x$build_dtls" = "xno"; then - # Give an advice that '--with_gnutls', '--with_openssl', '--with-mbedtls' or '--with-tinydtls' was used but - # DTLS support isn't configured. - AC_MSG_WARN([==> Using the configure options '--with-gnutls', '--with-openssl', '--with-mbedtls' or '--with-tinydtls' without '--enable-dtls' is useless and will be ignored.]) - fi -fi -if test "x$with_submodule_tinydtls" = "xyes"; then - if test "x$with_tinydtls" = "xno"; then - # Give an advice that '--with-submodule-tinydtls' is useless if tinydtls is not also enabled. - AC_MSG_WARN([==> Using the configure option '--with-submodule-tinydtls' without '--with-tinydtls' is useless and it will be ignored.]) - fi -fi - -# O.K. the user hasn't de-selected DTLS -if test "x$build_dtls" = "xyes"; then - # The user can't select multiple crypto libraries. - TLSCOUNT=0 - if test "x$with_gnutls" = "xyes"; then - TLSCOUNT=`expr $TLSCOUNT + 1` - fi - if test "x$with_openssl" = "xyes"; then - TLSCOUNT=`expr $TLSCOUNT + 1` - fi - if test "x$with_mbedtls" = "xyes"; then - TLSCOUNT=`expr $TLSCOUNT + 1` - fi - if test "x$with_tinydtls" = "xyes"; then - TLSCOUNT=`expr $TLSCOUNT + 1` - fi - if test "$TLSCOUNT" -gt 1; then - AC_MSG_ERROR([==> You can't use more than 1 of the options '--with-gnutls', '--with-openssl', '--with-mbedtls' or '--with-tinydtls' at the same time while '--enable-dtls' is selected! - ==> Please note, the option '--enable-dtls' is turned on by default if not explicitly disabled!]) - fi - - # Check for all possible usable and supported SSL crypto libraries - # GnuTLS - PKG_CHECK_MODULES([GnuTLS], - [gnutls], - [have_gnutls="yes"], - [have_gnutls="no"]) - - # OpenSSL - PKG_CHECK_MODULES([OpenSSL], - [openssl], - [have_openssl="yes"], - [have_openssl="no"]) - - # Mbed TLS [does not have mbedtls.pc pkg-config file] - AC_CHECK_LIB(mbedtls, mbedtls_version_get_string, - [have_mbedtls="yes"; MbedTLS_CFLAGS="" ; MbedTLS_LIBS="-lmbedtls -lmbedcrypto -lmbedx509"], - [have_mbedtls="no"], -lmbedx509 -lmbedcrypto) - if test "x$have_mbedtls" = "xyes"; then - if test "x$cross_compiling" = "xyes" ; then - # Have no option but to do this - mbedtls_version=$mbedtls_version_required - else - # Get actual library version - AC_LANG_PUSH(C) - local_MbedTLS_save_LIBS=$LIBS - LIBS="$MbedTLS_LIBS $LIBS" - AC_LINK_IFELSE([dnl - AC_LANG_SOURCE( - [[#include - #include - int main () { - char str[20]; - mbedtls_version_get_string(str); - fprintf(stdout,"%s\n",str); - return 0; - }]])], - [mbedtls_version=$(./conftest$EXEEXT)], - [AC_MSG_WARN(Failed to determine Mbed TLS version) - have_mbedtls=no]) - LIBS=$local_MbedTLS_save_LIBS - AC_LANG_POP(C) - fi - fi - - if test "${TinyDTLS_CFLAGS+set}" = "set"; then - tinydtls_cflags_overridden="yes" - fi - if test "${TinyDTLS_LIBS+set}" = "set"; then - tinydtls_libs_overridden="yes" - fi - # TinyDTLS - PKG_CHECK_MODULES([TinyDTLS], - [tinydtls], - [have_tinydtls="yes"], - [have_tinydtls="no"]) - - # TBD ? - - # The user wants to use explicit GnuTLS if '--with-gnutls' was set. - if test "x$with_gnutls" = "xyes"; then - # Some more sanity checking. - if test "x$have_gnutls" != "xyes"; then - AC_MSG_ERROR([==> You want to build libcoap with DTLS support by the GnuTLS library but pkg-config file 'gnutls.pc' could not be found! - Install the package(s) that contains the development files for GnuTLS, - or select a different TLS library or disable the DTLS support using '--disable-dtls'.]) - fi - AC_MSG_NOTICE([The use of GnuTLS was explicitly requested with configure option '--with-gnutls'!]) - - # check for valid GnuTLS version - gnutls_version=`$PKG_CONFIG --modversion gnutls` - AX_CHECK_GNUTLS_VERSION - have_openssl="no" # don't confuse AC_MSG_RESULT at the end of the script - have_mbedtls="no" # don't confuse AC_MSG_RESULT at the end of the script - have_tinydtls="no" # don't confuse AC_MSG_RESULT at the end of the script - fi - - # The user wants to use explicit OpenSSL if '--with-openssl was set'. - if test "x$with_openssl" = "xyes"; then - # Some more sanity checking. - if test "x$have_openssl" != "xyes"; then - AC_MSG_ERROR([==> You want to build libcoap with DTLS support by the OpenSSL library but pkg-config file 'openssl.pc' could not be found! - Install the package(s) that contains the development files for OpenSSL, - or select a different TLS library or disable the DTLS support using '--disable-dtls'.]) - fi - AC_MSG_NOTICE([The use of OpenSSL was explicitly requested with configure option '--with-openssl'!]) - - # check for valid OpenSSL version - openssl_version=`$PKG_CONFIG --modversion openssl` - AX_CHECK_OPENSSL_VERSION - have_gnutls="no" # don't confuse AC_MSG_RESULT at the end of the script - have_mbedtls="no" # don't confuse AC_MSG_RESULT at the end of the script - have_tinydtls="no" # don't confuse AC_MSG_RESULT at the end of the script - fi - - # The user wants to use explicit Mbed TLS if '--with-mbedtls was set'. - if test "x$with_mbedtls" = "xyes"; then - # Some more sanity checking. - if test "x$have_mbedtls" != "xyes"; then - AC_MSG_ERROR([==> You want to build libcoap with DTLS support by the Mbed TLS library but library 'mbedtls' could not be found! - Install the package(s) that contains the development files for Mbed TLS, - or select a different TLS library or disable the DTLS support using '--disable-dtls'.]) - fi - AC_MSG_NOTICE([The use of Mbed TLS was explicitly requested with configure option '--with-mbedtls'!]) - - # check for valid Mbed TLS version (mbedtls.pc does not exist - hmm) - # mbedtls_version determined previously - AX_CHECK_MBEDTLS_VERSION - have_gnutls="no" # don't confuse AC_MSG_RESULT at the end of the script - have_openssl="no" # don't confuse AC_MSG_RESULT at the end of the script - have_tinydtls="no" # don't confuse AC_MSG_RESULT at the end of the script - fi - - # The user wants to use explicit TinyDTLS if '--with-tinydtls was set'. - if test "x$with_tinydtls" = "xyes" ; then - AC_MSG_NOTICE([The use of TinyDTLS was explicitly requested with configure option '--with-tinydtls'!]) - if [ test "x$have_tinydtls" = "xno" ] && [ test "x$with_submodule_tinydtls" = "xexplicit_fallback" ] || [ test "x$with_submodule_tinydtls" = "xyes" ]; then - AC_MSG_NOTICE([Using TinyDTLS submodule over system-provided version because either "--with-submodule-tinydtls" was set or no system-provided TinyDTLS was found.]) - if test -e "$srcdir/ext/tinydtls/dtls.h"; then - AC_CONFIG_SUBDIRS([ext/tinydtls]) - if test "x$enable_shared" = "xyes"; then - auto_TinyDTLS_LIBS="-L\$(top_builddir)/ext/tinydtls -ltinydtls" - else - # Needed as TinyDTLS compiling does not recognize --disable-shared - # and still builds libtinydtls.so which gets linked in otherwise - auto_TinyDTLS_LIBS="-L\$(top_builddir)/ext/tinydtls -l:libtinydtls.a" - fi - have_submodule_tinydtls="yes" - - auto_TinyDTLS_CFLAGS="-I \$(top_srcdir)/ext -I \$(top_srcdir)/ext/tinydtls" - - if test "x$tinydtls_cflags_overridden" != "xyes"; then - TinyDTLS_CFLAGS="$auto_TinyDTLS_CFLAGS" - fi - if test "x$tinydtls_libs_overridden" != "xyes"; then - TinyDTLS_LIBS="$auto_TinyDTLS_LIBS" - fi - else - AC_MSG_ERROR([==> You want to build libcoap with DTLS support using the TinyDTLS submodule library but no suitable version could be found! - Check whether you have updated the TinyDTLS git submodule, use the system-provided version if available (set '--with-submodule-tinydtls=no'), - select a different TLS library or disable the DTLS support using '--disable-dtls'.]) - have_tinydtls="no" # don't confuse AC_MSG_RESULT at the end of the script - have_submodule_tinydtls="no" # don't confuse AC_MSG_RESULT at the end of the script - fi - elif test "x$have_tinydtls" = "xyes"; then - AC_MSG_NOTICE([Using system-provided TinyDTLS]) - tinydtls_version=`$PKG_CONFIG --modversion tinydtls` - AX_CHECK_TINYDTLS_VERSION - have_gnutls="no" # don't confuse AC_MSG_RESULT at the end of the script - have_mbedtls="no" # don't confuse AC_MSG_RESULT at the end of the script - have_openssl="no" # don't confuse AC_MSG_RESULT at the end of the script - else - AC_MSG_ERROR([==> You want to build libcoap with DTLS support using the TinyDTLS library but no suitable version could be found! - Use the submodule TinyDTLS version (set '--with-submodule-tinydtls=yes' and update the git submodule), - ensure that you have a system-provided version of TinyDTLS that can be found using pkg-config (older versions can not), - select a different TLS library or disable the DTLS support using '--disable-dtls'.]) - have_tinydtls="no" # don't confuse AC_MSG_RESULT at the end of the script - fi - - have_gnutls="no" # don't confuse AC_MSG_RESULT at the end of the script - have_openssl="no" # don't confuse AC_MSG_RESULT at the end of the script - have_mbedtls="no" # don't confuse AC_MSG_RESULT at the end of the script - fi - - if test "$TLSCOUNT" -eq 0; then - # The user hasn't requested the use of a specific cryptography library - # we try first GnuTLS for usability ... - if test "x$have_gnutls" = "xyes"; then - gnutls_version=`$PKG_CONFIG --modversion gnutls` - AX_CHECK_GNUTLS_VERSION - AC_MSG_NOTICE([Using auto selected library GnuTLS for DTLS support!]) - with_gnutls_auto="yes" - have_openssl="no" # don't confuse AC_MSG_RESULT at the end of the script - have_mbedtls="no" # don't confuse AC_MSG_RESULT at the end of the script - have_tinydtls="no" # don't confuse AC_MSG_RESULT at the end of the script - - # ... and if not found check OpenSSL is suitable. - elif test "x$have_openssl" = "xyes"; then - openssl_version=`$PKG_CONFIG --modversion openssl` - AX_CHECK_OPENSSL_VERSION - AC_MSG_NOTICE([Using auto selected library OpenSSL for DTLS support!]) - with_openssl_auto="yes" - have_gnutls="no" # don't confuse AC_MSG_RESULT at the end of the script - have_mbedtls="no" # don't confuse AC_MSG_RESULT at the end of the script - have_tinydtls="no" # don't confuse AC_MSG_RESULT at the end of the script - - # ... and if not found check Mbed TLS is suitable. - elif test "x$have_mbedtls" = "xyes"; then - # Mbed TLS [does not have mbedtls.pc pkg-config file] - # mbedtls_version determined previously - AX_CHECK_MBEDTLS_VERSION - AC_MSG_NOTICE([Using auto selected library Mbed TLS for DTLS support!]) - with_mbedtls_auto="yes" - have_gnutls="no" # don't confuse AC_MSG_RESULT at the end of the script - have_openssl="no" # don't confuse AC_MSG_RESULT at the end of the script - have_tinydtls="no" # don't confuse AC_MSG_RESULT at the end of the script - - elif [ test "x$with_tinydtls" = "xyes" ] && [ test "x$have_tinydtls" = "xyes" ]; then - AC_MSG_NOTICE([Using auto selected library TinyDTLS for DTLS support!]) - tinydtls_version=`$PKG_CONFIG --modversion tinydtls` - AX_CHECK_TINYDTLS_VERSION - with_tinydtls_auto="yes" - have_gnutls="no" # don't confuse AC_MSG_RESULT at the end of the script - have_mbedtls="no" # don't confuse AC_MSG_RESULT at the end of the script - have_openssl="no" # don't confuse AC_MSG_RESULT at the end of the script - - - # Note that the TinyDTLS submodule is used only when explicitly requested. - # Giving out an error message if we haven't found at least one crypto library. - else - AC_MSG_ERROR([==> Option '--enable-dtls' is set but none of the needed cryptography libraries GnuTLS, OpenSSL, Mbed TLS or TinyDTLS could be found! - Install at least one of the package(s) that contains the development files for GnuTLS (>= $gnutls_version_required), OpenSSL(>= $openssl_version_required), Mbed TLS(>= $mbedtls_version_required), or TinyDTLS(>= $tinydtls_version_required) - or disable the DTLS support using '--disable-dtls'.]) - fi - fi - - # Saving the DTLS related Compiler flags. - if test "x$with_gnutls" = "xyes" -o "x$with_gnutls_auto" = "xyes"; then - DTLS_CFLAGS="$GnuTLS_CFLAGS" - DTLS_LIBS="$GnuTLS_LIBS" - AC_DEFINE(HAVE_LIBGNUTLS, [1], [Define if the system has libgnutls28]) - fi - if test "x$with_openssl" = "xyes" -o "x$with_openssl_auto" = "xyes"; then - DTLS_CFLAGS="$OpenSSL_CFLAGS" - DTLS_LIBS="$OpenSSL_LIBS" - AC_DEFINE(HAVE_OPENSSL, [1], [Define if the system has libssl1.1]) - fi - if test "x$with_mbedtls" = "xyes" -o "x$with_mbedtls_auto" = "xyes"; then - DTLS_CFLAGS="$MbedTLS_CFLAGS" - DTLS_LIBS="$MbedTLS_LIBS" - AC_DEFINE(HAVE_MBEDTLS, [1], [Define if the system has libmbedtls2.7.10]) - fi - if test "x$with_tinydtls" = "xyes" -o "x$with_tinydtls_auto" = "xyes"; then - DTLS_CFLAGS="$TinyDTLS_CFLAGS" - DTLS_LIBS="$TinyDTLS_LIBS" - AC_DEFINE(HAVE_LIBTINYDTLS, [1], [Define if the system has libtinydtls]) - fi - AC_SUBST(DTLS_CFLAGS) - AC_SUBST(DTLS_LIBS) -fi - -# Define the Library name extension for the TLS the library was linked against -if test "x$with_openssl" = "xyes" -o "x$with_openssl_auto" = "xyes"; then - LIBCOAP_DTLS_LIB_EXTENSION_NAME=-openssl -elif test "x$with_gnutls" = "xyes" -o "x$with_gnutls_auto" = "xyes"; then - LIBCOAP_DTLS_LIB_EXTENSION_NAME=-gnutls -elif test "x$with_mbedtls" = "xyes" -o "x$with_mbedtls_auto" = "xyes"; then - LIBCOAP_DTLS_LIB_EXTENSION_NAME=-mbedtls -elif test "x$with_tinydtls" = "xyes"; then - LIBCOAP_DTLS_LIB_EXTENSION_NAME=-tinydtls -else - LIBCOAP_DTLS_LIB_EXTENSION_NAME=-notls -fi - -LIBCOAP_NAME_SUFFIX="$LIBCOAP_API_VERSION$LIBCOAP_DTLS_LIB_EXTENSION_NAME" - -AC_SUBST(LIBCOAP_NAME_SUFFIX) -AC_SUBST(LIBCOAP_DTLS_LIB_EXTENSION_NAME) -AC_SUBST([DOLLAR_SIGN],[$]) - -# configure options -# __tests__ -AC_ARG_ENABLE([tests], - [AS_HELP_STRING([--enable-tests], - [Enable building the binary testsuite. Requires --enable-static [default=no]])], - [build_tests="$enableval"], - [build_tests="no"]) - -if test "x$build_tests" = "xyes"; then - PKG_CHECK_MODULES([CUNIT], - [cunit], - [have_cunit=yes - AC_DEFINE(HAVE_LIBCUNIT, [1], [Define if the system has libcunit])], - [have_cunit=no - AC_MSG_WARN([==> You want to build the testing binary but the pkg-config file cunit.pc could not be found or installed CUnit version is too old!]) - AC_MSG_ERROR([==> Install the package(s) that contains the development files for CUnit or disable the testing binary using '--disable-tests'.]) - ]) - if test "x$enable_static" = "xno"; then - enable_static=yes - AC_MSG_WARN([--enable-tests requires --enable-static which is now enabled.]) - fi -fi -AM_CONDITIONAL(HAVE_CUNIT, [test "x$CUNIT_LIBS" != "x"]) - -# configure options -# __examples__ -AC_ARG_ENABLE([examples], - [AS_HELP_STRING([--enable-examples], - [Enable building the example binaries [default=yes]])], - [build_examples="$enableval"], - [build_examples="yes"]) - -AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$build_examples" = "xyes"]) - -# configure options -# __examples-source -AC_ARG_ENABLE([examples-source], - [AS_HELP_STRING([--enable-examples-source], - [Enable installing example source to DATAROOTDIR/libcoap/examples [default=yes]])], - [build_examples_source="$enableval"], - [build_examples_source="yes"]) - -AM_CONDITIONAL(BUILD_EXAMPLES_SOURCE, [test "x$build_examples_source" = "xyes"]) - -# configure options -# __gcov__ -AC_ARG_ENABLE([gcov], - [AS_HELP_STRING([--enable-gcov], - [Enable building with gcov test coverage support [default=no]])], - [build_gcov="$enableval"], - [build_gcov="no" - AC_MSG_WARN([gcov is disabled]) - ]) - -if test "x$build_gcov" = "xyes"; then - if test "x$GCC" != "xyes"; then - AC_MSG_ERROR([Currently, gcov is assumed to work with GCC-compatible compilers only.]) - else - AX_CHECK_COMPILE_FLAG([-fprofile-arcs], [CFLAGS="$CFLAGS -fprofile-arcs"]) - AX_CHECK_COMPILE_FLAG([-ftest-coverage], [CFLAGS="$CFLAGS -ftest-coverage"]) - # FIXME: clang complains about '--coverage' - AX_CHECK_COMPILE_FLAG([--coverage], [CFLAGS="$CFLAGS --coverage -O0" LDFLAGS="$LDFLAGS --coverage"]) - fi -fi - -# configure options -# __license-install__ -AC_ARG_ENABLE([license-install], - [AS_HELP_STRING([--enable-license-install], - [Enable installing LICENSE to DOCDIR [default=yes]])], - [build_license_install="$enableval"], - [build_license_install="yes"]) - -AM_CONDITIONAL(BUILD_LICENSE_INSTALL, [test "x$build_license_install" = "xyes"]) - -# configure options -# __tcp__ -AC_ARG_ENABLE([tcp], - [AS_HELP_STRING([--enable-tcp], - [Enable building with TCP support [default=yes]])], - [build_tcp="$enableval"], - [build_tcp="yes"]) - -AC_DEFINE(COAP_DISABLE_TCP, [0], [Define to 1 to build without TCP support.]) -AS_IF([test "x$build_tcp" != "xyes"], [AC_DEFINE(COAP_DISABLE_TCP, [1])]) -AC_SUBST(COAP_DISABLE_TCP) - -# configure options -# __async__ -AC_ARG_ENABLE([async], - [AS_HELP_STRING([--enable-async], - [Enable building with support for separate responses [default=yes]])], - [build_async="$enableval"], - [build_async="yes"]) - -AS_IF([test "x$build_async" != "xyes"], - [AC_DEFINE(WITHOUT_ASYNC, [1], [Define to build without support for separate responses.])]) - -# configure options -# __add_default_names__ -AC_ARG_ENABLE([add-default-names], - [AS_HELP_STRING([--enable-add-default-names], - [Enable adding libraries / examples with default names [default=yes]])], - [build_add_default_names="$enableval"], - [build_add_default_names="yes"]) - -AM_CONDITIONAL(BUILD_ADD_DEFAULT_NAMES, [test "x$build_add_default_names" = "xyes"]) - -# end configure options -####################### - -########################################### -# from configure options independent checks - -# Check for (ex)ctags binary -# The needed ctags binary name differs on FreeBSD and Linux, on Linux -# systems we search for 'ctags', on FreeBSD for 'exctags' -case $host in - # FreeBSD has exctags from the ctags port - *-freebsd1*) - AC_ARG_VAR([CTAGS_PROG],[the 'exctags' program to use for make target 'update-map-file']) - AC_PATH_PROG([CTAGS_PROG],[exctags]) - ;; - - *) - # Linux distributions have exuberant-ctags - AC_ARG_VAR([CTAGS_PROG],[the 'ctags' program to use for make target 'update-map-file']) - AC_PATH_PROG([CTAGS_PROG],[ctags]) - ;; - -esac - -if test "x$CTAGS_PROG" = "x"; then - AC_MSG_NOTICE([==> Note: '(ex)ctags' command not found!]) - AC_MSG_WARN([==> Without ctags you will be unable to run the target 'update-map-file'!]) - AC_MSG_WARN([==> This is no problem if you just want to build the library libcoap.]) -else - if test "`$CTAGS_PROG --help | grep '\---kinds'`" = ""; then - AC_MSG_NOTICE([==> Note: Your ctags binary does not support '--c-kinds'!]) - AC_MSG_NOTICE([==> Most likely, you are using the GNU Emacs ctag and not exuberant ctag.]) - AC_MSG_WARN([==> This option is required for the target 'update-map-file'.]) - AC_MSG_WARN([==> which is not a problem if you just want to build the library libcoap.]) - fi -fi - -# Checks for header files. -AC_CHECK_HEADERS([assert.h arpa/inet.h limits.h netdb.h netinet/in.h \ - pthread.h \ - stdlib.h string.h strings.h sys/socket.h sys/time.h \ - time.h unistd.h sys/unistd.h syslog.h sys/ioctl.h net/if.h]) - -# For epoll, need two headers (sys/epoll.h sys/timerfd.h), but set up one #define -AC_CHECK_HEADER([sys/epoll.h]) -AC_CHECK_HEADER([sys/timerfd.h]) -if test "x$ac_cv_header_sys_epoll_h" = "xyes" -a "x$ac_cv_header_sys_timerfd_h" = "xyes"; then - have_epoll="yes" - AC_ARG_WITH([epoll], - [AS_HELP_STRING([--with-epoll], - [Use epoll for I/O handling [if O/S supports it]])], - [with_epoll="$withval"], - [with_epoll="yes"]) -else - have_epoll="no" - if test "x$with_epoll" = "xyes"; then - AC_MSG_WARN([==> Underlying O/S does not support epoll - --with-epoll ignored.]) - with_epoll="no" - fi -fi - -if test "x$with_epoll" = "xyes"; then - AC_DEFINE(COAP_EPOLL_SUPPORT, 1, [Define if the system has epoll support]) -fi - -AC_ARG_ENABLE([small-stack], - [AS_HELP_STRING([--enable-small-stack], - [Use small-stack if the available stack space is restricted [default=no]])], - [enable_small_stack="$enableval"], - [enable_small_stack="no"]) - -if test "x$enable_small_stack" = "xyes"; then - AC_DEFINE(COAP_CONSTRAINED_STACK, 1, [Define if the system has small stack size]) -fi - -AC_ARG_ENABLE([server-mode], - [AS_HELP_STRING([--enable-server-mode], - [Enable CoAP server mode supporting code [default=yes]])], - [enable_server_mode="$enableval"], - [enable_server_mode="yes"]) - -if test "x$enable_server_mode" = "xyes"; then - AC_DEFINE(COAP_SERVER_SUPPORT, 1, [Define if libcoap supports server mode code]) -fi -AM_CONDITIONAL(HAVE_SERVER_SUPPORT, [test "x$enable_server_mode" = "xyes"]) - -AC_ARG_ENABLE([client-mode], - [AS_HELP_STRING([--enable-client-mode], - [Enable CoAP client mode supporting code [default=yes]])], - [enable_client_mode="$enableval"], - [enable_client_mode="yes"]) - -if test "x$enable_client_mode" = "xyes"; then - AC_DEFINE(COAP_CLIENT_SUPPORT, 1, [Define if libcoap supports client mode code]) -fi -AM_CONDITIONAL(HAVE_CLIENT_SUPPORT, [test "x$enable_client_mode" = "xyes"]) -if test "x$enable_server_mode" != "xyes" -a "x$enable_client_mode" != "xyes" ; then - AC_MSG_ERROR([==> One or both of '--enable-server-mode' and '--enable-client-mode' need to be set!]) -fi - -# Checks for typedefs, structures, and compiler characteristics. -AC_TYPE_SIZE_T -AC_TYPE_SSIZE_T - -# Checks for library functions. -AC_CHECK_FUNCS([memset select socket strcasecmp strrchr getaddrinfo \ - strnlen malloc pthread_mutex_lock getrandom if_nametoindex]) - -# Check if -lsocket -lnsl is required (specifically Solaris) -AC_SEARCH_LIBS([socket], [socket]) -AC_SEARCH_LIBS([inet_ntop], [nsl]) - -# Check if clock_gettime() requires librt, when available -AC_SEARCH_LIBS([clock_gettime], [rt]) - -#check for struct cmsghdr -AC_CHECK_TYPES([struct cmsghdr],,,[ -AC_INCLUDES_DEFAULT -#include ]) - -AC_MSG_CHECKING([operating system]) - -# Set up here some extra platform depended defines and variables. -# The "ADDITIONAL_CFLAGS" is need as this stand-alone definition -# for the doxygen part. -case $host in - *-linux* | *-uclinux*) - AC_MSG_RESULT([Linux]) - ADDITIONAL_CFLAGS="-D_GNU_SOURCE" - - # Not yet needed but if some code definitions have to depend on the platform. - #AC_DEFINE(OS_LINUX, 1, [Linux backend]) - #AC_SUBST(OS_LINUX) - ;; - - *-cygwin*) - AC_MSG_RESULT([Cygwin]) - ADDITIONAL_CFLAGS="-D_GNU_SOURCE -D_CYGWIN_ENV" - LDFLAGS="-no-undefined $LDFLAGS" - ;; - - *-solaris*) - AC_MSG_RESULT([Solaris]) - # set _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED to enable XPG4v2 (POSIX 2004) - # set __EXTENSION__ to shut up feature test macros that restrict -std=c99 - # to only C99 (and nothing newer) - ADDITIONAL_CFLAGS="-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=600 -D__EXTENSIONS__=1" - ;; - - *-darwin*) - AC_MSG_RESULT([Darwin]) - ADDITIONAL_CFLAGS="-D_GNU_SOURCE" - - AC_DEFINE(__APPLE_USE_RFC_3542, 1, [Define this to 1 for ancillary data on MacOS]) - - # Not yet needed but if some code definitions have to depend on the platform. - #AC_DEFINE(OS_MACOS, 1, [MacOS backend]) - #AC_SUBST(OS_MACOS) - ;; - - *-freebsd1*) - AC_MSG_RESULT([FreeBSD-1x]) - ADDITIONAL_CFLAGS="-D_GNU_SOURCE" - ;; - - *kfreebsd*) - AC_MSG_RESULT([kFreeBSD]) - ADDITIONAL_CFLAGS="-D_GNU_SOURCE" - ;; - - *) - AC_MSG_WARN([==> Currently unsupported operating system '${host}' !]) - AC_MSG_ERROR([==> If you can provide patches to support your operating system please write to 'libcoap-developers@lists.sourceforge.net'.]) -esac - -# Exporting the PREDEFINED_CFLAGS definition -PREDEFINED_CFLAGS=`echo $ADDITIONAL_CFLAGS | $SED -e 's/-D//g'` -AC_SUBST(PREDEFINED_CFLAGS) - -# And finally combining the CFLAGS together ... -CFLAGS="$CFLAGS $ADDITIONAL_CFLAGS" - -# Override the various template files, currently just makefiles and the -# pkgconfig *.pc file. -# Later if the API version is changing don't forget to change the -# libcoap-$LIBCOAP_API_VERSION.pc.in file too!! You will have to change -# the 'Cflags' variable to something like -# Cflags: -I${includedir}/coap-@LIBCOAP_API_VERSION@ -# -AC_CONFIG_FILES([ -Makefile -coap_config.h.lwip -coap_config.h.riot -coap_config.h.windows -doc/Makefile -examples/Makefile -include/coap$LIBCOAP_API_VERSION/coap.h -include/coap$LIBCOAP_API_VERSION/coap.h.windows -man/coap.txt -man/coap_async.txt -man/coap_attribute.txt -man/coap_block.txt -man/coap_cache.txt -man/coap_context.txt -man/coap_encryption.txt -man/coap_endpoint_client.txt -man/coap_endpoint_server.txt -man/coap_handler.txt -man/coap_io.txt -man/coap_keepalive.txt -man/coap_logging.txt -man/coap_observe.txt -man/coap_pdu_access.txt -man/coap_pdu_setup.txt -man/coap_recovery.txt -man/coap_resource.txt -man/coap_session.txt -man/coap_string.txt -man/coap_tls_library.txt -man/coap-client.txt -man/coap-server.txt -man/coap-rd.txt -man/Makefile -tests/test_common.h -tests/Makefile -tests/oss-fuzz/Makefile.ci -libcoap-$LIBCOAP_NAME_SUFFIX.pc:libcoap-$LIBCOAP_API_VERSION.pc.in -]) - -AC_OUTPUT - -AC_MSG_RESULT([ -libcoap configuration summary: - libcoap package version : "$PACKAGE_VERSION" - libcoap library version : "$LIBCOAP_SO_VERSION" - libcoap API version : "$LIBCOAP_API_VERSION" - libcoap DTLS lib extn : "$LIBCOAP_DTLS_LIB_EXTENSION_NAME" - host system : "$host"]); -if test "x$enable_server_mode" = "xyes"; then - AC_MSG_RESULT([ build with server support: "yes"]) -else - AC_MSG_RESULT([ build with server support: "no"]) -fi -if test "x$enable_client_mode" = "xyes"; then - AC_MSG_RESULT([ build with client support: "yes"]) -else - AC_MSG_RESULT([ build with client support: "no"]) -fi -if test "x$build_tcp" != "xno"; then - AC_MSG_RESULT([ build with TCP support : "yes"]) -else - AC_MSG_RESULT([ build with TCP support : "no"]) -fi -if test "x$with_gnutls" = "xyes" -o "x$with_gnutls_auto" = "xyes"; then - AC_MSG_RESULT([ build DTLS support : "yes"]) - AC_MSG_RESULT([ --> GnuTLS around : "yes" (found GnuTLS $gnutls_version)]) - AC_MSG_RESULT([ GNUTLS_CFLAGS : "$GnuTLS_CFLAGS"]) - AC_MSG_RESULT([ GNUTLS_LIBS : "$GnuTLS_LIBS"]) -fi -if test "x$with_openssl" = "xyes" -o "x$with_openssl_auto" = "xyes"; then - AC_MSG_RESULT([ build DTLS support : "yes"]) - AC_MSG_RESULT([ --> OpenSSL around : "yes" (found OpenSSL $openssl_version)]) - AC_MSG_RESULT([ OPENSSL_CFLAGS : "$OpenSSL_CFLAGS"]) - AC_MSG_RESULT([ OPENSSL_LIBS : "$OpenSSL_LIBS"]) -fi -if test "x$with_mbedtls" = "xyes" -o "x$with_mbedtls_auto" = "xyes"; then - AC_MSG_RESULT([ build DTLS support : "yes"]) - AC_MSG_RESULT([ --> Mbed TLS around : "yes" (found Mbed TLS $mbedtls_version)]) - AC_MSG_RESULT([ MBEDTLS_CFLAGS : "$MbedTLS_CFLAGS"]) - AC_MSG_RESULT([ MBEDTLS_LIBS : "$MbedTLS_LIBS"]) -fi -if test "x$with_tinydtls" = "xyes"; then - AC_MSG_RESULT([ build DTLS support : "yes"]) - if test "x$have_submodule_tinydtls" = "xyes"; then - AC_MSG_RESULT([ --> TinyDTLS around : "yes" (submodule)]) - else - AC_MSG_RESULT([ --> TinyDTLS around : "yes (found TinyDTLS $tinydtls_version)"]) - fi - AC_MSG_RESULT([ TinyDTLS_CFLAGS : "$DTLS_CFLAGS"]) - AC_MSG_RESULT([ TinyDTLS_LIBS : "$DTLS_LIBS"]) -fi -if test "x$build_dtls" != "xyes"; then - AC_MSG_RESULT([ build DTLS support : "no"]) -fi -if test "x$build_add_default_names" = "xyes"; then - AC_MSG_RESULT([ add default names : "yes"]) -else - AC_MSG_RESULT([ add default names : "no"]) -fi -if test "x$have_epoll" = "xyes"; then - AC_MSG_RESULT([ build using epoll : "$with_epoll"]) -fi -AC_MSG_RESULT([ enable small stack size : "$enable_small_stack"]) -if test "x$build_async" != "xno"; then - AC_MSG_RESULT([ enable separate responses: "yes"]) -else - AC_MSG_RESULT([ enable separate responses: "no"]) -fi -if test "x$build_doxygen" = "xyes"; then - AC_MSG_RESULT([ build doxygen pages : "yes"]) - AC_MSG_RESULT([ --> Doxygen around : "yes" ($DOXYGEN $doxygen_version)]) - if test "x$DOT" = "x"; then - AC_MSG_RESULT([ --> dot around : "no" (DOT not found!)]) - else - AC_MSG_RESULT([ --> dot around : "yes" ($DOT $dot_version)]) - fi -else - if test "x$build_doxygen" = "xno"; then - AC_MSG_RESULT([ build doxygen pages : "no"]) - fi -fi -if test "x$build_manpages" = "xyes"; then - AC_MSG_RESULT([ build man pages : "yes"]) -else - AC_MSG_RESULT([ build man pages : "no"]) -fi -if test "x$build_tests" = "xyes"; then - AC_MSG_RESULT([ build unit test binary : "yes"]) -else - AC_MSG_RESULT([ build unit test binary : "no"]) -fi -if test "x$build_examples" = "xyes"; then - AC_MSG_RESULT([ build examples : "yes"]) -else - AC_MSG_RESULT([ build examples : "no"]) -fi -if test "x$build_examples_source" = "xyes"; then - AC_MSG_RESULT([ install examples source : "yes"]) -else - AC_MSG_RESULT([ install examples source : "no"]) -fi -if test "x$build_gcov" = "xyes"; then - AC_MSG_RESULT([ build with gcov support : "yes"]) -else - AC_MSG_RESULT([ build with gcov support : "no"]) -fi -if test "x$enable_shared" = "xyes"; then - AC_MSG_RESULT([ build shared library : "yes"]) -else - AC_MSG_RESULT([ build shared library : "no"]) -fi -if test "x$enable_static" = "xyes"; then - AC_MSG_RESULT([ build static library : "yes"]) -else - AC_MSG_RESULT([ build static library : "no"]) -fi diff --git a/examples/espidf-coap-server/components/libcoap/doc/Doxyfile.in b/examples/espidf-coap-server/components/libcoap/doc/Doxyfile.in deleted file mode 100644 index 782410d..0000000 --- a/examples/espidf-coap-server/components/libcoap/doc/Doxyfile.in +++ /dev/null @@ -1,2612 +0,0 @@ -# Doxyfile 1.9.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the configuration -# file that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# https://www.gnu.org/software/libiconv/ for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = @PACKAGE_NAME@ - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = @PACKAGE_VERSION@ - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = - -# With the PROJECT_LOGO tag one can specify a logo or an icon that is included -# in the documentation. The maximum height of the logo should not exceed 55 -# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy -# the logo to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = - -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = NO - -# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII -# characters to appear in the names of generated files. If set to NO, non-ASCII -# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode -# U+3044. -# The default value is: NO. - -ALLOW_UNICODE_NAMES = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = English - -# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all generated output in the proper direction. -# Possible values are: None, LTR, RTL and Context. -# The default value is: None. - -OUTPUT_TEXT_DIRECTION = None - -# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = NO - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the -# first line (until the first dot) of a Javadoc-style comment as the brief -# description. If set to NO, the Javadoc-style will behave just like regular Qt- -# style comments (thus requiring an explicit @brief command for a brief -# description.) -# The default value is: NO. - -JAVADOC_AUTOBRIEF = YES - -# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line -# such as -# /*************** -# as being the beginning of a Javadoc-style comment "banner". If set to NO, the -# Javadoc-style will behave just like regular comments and it will not be -# interpreted by doxygen. -# The default value is: NO. - -JAVADOC_BANNER = NO - -# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first -# line (until the first dot) of a Qt-style comment as the brief description. If -# set to NO, the Qt-style will behave just like regular Qt-style comments (thus -# requiring an explicit \brief command for a brief description.) -# The default value is: NO. - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = NO - -# By default Python docstrings are displayed as preformatted text and doxygen's -# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the -# doxygen's special commands can be used and the contents of the docstring -# documentation blocks is shown as doxygen documentation. -# The default value is: YES. - -PYTHON_DOCSTRING = YES - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new -# page for each member. If set to NO, the documentation of a member will be part -# of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that act as commands in -# the documentation. An alias has the form: -# name=value -# For example adding -# "sideeffect=@par Side Effects:\n" -# will allow you to put the command \sideeffect (or @sideeffect) in the -# documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines (in the resulting output). You can put ^^ in the value part of an -# alias to insert a newline as if a physical newline was in the original file. -# When you need a literal { or } or , in the value part of an alias you have to -# escape them by means of a backslash (\), this can lead to conflicts with the -# commands \{ and \} for these it is advised to use the version @{ and @} or use -# a double escape (\\{ and \\}) - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or -# Python sources only. Doxygen will then generate output that is more tailored -# for that language. For instance, namespaces will be presented as packages, -# qualified scopes will look different, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources. Doxygen will then generate output that is tailored for Fortran. -# The default value is: NO. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for VHDL. -# The default value is: NO. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice -# sources only. Doxygen will then generate output that is more tailored for that -# language. For instance, namespaces will be presented as modules, types will be -# separated into more groups, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_SLICE = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, -# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL, -# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: -# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser -# tries to guess whether the code is fixed or free formatted code, this is the -# default for Fortran type files). For instance to make doxygen treat .inc files -# as Fortran files (default is PHP), and .f files as C (default is Fortran), -# use: inc=Fortran f=C. -# -# Note: For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. When specifying no_extension you should add -# * to the FILE_PATTERNS. -# -# Note see also the list of default file extension mappings. - -EXTENSION_MAPPING = - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See https://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up -# to that level are automatically included in the table of contents, even if -# they do not have an id attribute. -# Note: This feature currently applies only to Markdown headings. -# Minimum value: 0, maximum value: 99, default value: 5. -# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. - -TOC_INCLUDE_HEADINGS = 5 - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by putting a % sign in front of the word or -# globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen -# will parse them like normal C++ but will assume all classes use public instead -# of private inheritance when no explicit protection keyword is present. -# The default value is: NO. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES will make -# doxygen to replace the get and set methods by a property in the documentation. -# This will only work if the methods are indeed getting or setting a simple -# type. If this is not the case, or you want to show the methods anyway, you -# should set this option to NO. -# The default value is: YES. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. -# The default value is: NO. - -DISTRIBUTE_GROUP_DOC = NO - -# If one adds a struct or class to a group and this option is enabled, then also -# any nested class or struct is added to the same group. By default this option -# is disabled and one has to add nested compounds explicitly via \ingroup. -# The default value is: NO. - -GROUP_NESTED_COMPOUNDS = NO - -# Set the SUBGROUPING tag to YES to allow class member groups of the same type -# (for instance a group of public functions) to be put as a subgroup of that -# type (e.g. under the Public Functions section). Set it to NO to prevent -# subgrouping. Alternatively, this can be done per class using the -# \nosubgrouping command. -# The default value is: YES. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions -# are shown inside the group in which they are included (e.g. using \ingroup) -# instead of on a separate page (for HTML and Man pages) or section (for LaTeX -# and RTF). -# -# Note that this feature does not work in combination with -# SEPARATE_MEMBER_PAGES. -# The default value is: NO. - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions -# with only public data fields or simple typedef fields will be shown inline in -# the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO, structs, classes, and unions are shown on a separate page (for HTML and -# Man pages) or section (for LaTeX and RTF). -# The default value is: NO. - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or -# enum is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically be -# useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. -# The default value is: NO. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can be -# an expensive process and often the same symbol appears multiple times in the -# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small -# doxygen will become slower. If the cache is too large, memory is wasted. The -# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range -# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 -# symbols. At the end of a run doxygen will report the cache usage and suggest -# the optimal cache size from a speed point of view. -# Minimum value: 0, maximum value: 9, default value: 0. - -LOOKUP_CACHE_SIZE = 0 - -# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use -# during processing. When set to 0 doxygen will based this on the number of -# cores available in the system. You can set it explicitly to a value larger -# than 0 to get more control over the balance between CPU load and processing -# speed. At this moment only the input processing can be done using multiple -# threads. Since this is still an experimental feature the default is set to 1, -# which efficively disables parallel processing. Please report any issues you -# encounter. Generating dot graphs in parallel is controlled by the -# DOT_NUM_THREADS setting. -# Minimum value: 0, maximum value: 32, default value: 1. - -NUM_PROC_THREADS = 1 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in -# documentation are documented, even if no documentation was available. Private -# class members and static file members will be hidden unless the -# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. -# Note: This will also disable the warnings about undocumented members that are -# normally produced when WARNINGS is set to YES. -# The default value is: NO. - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will -# be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual -# methods of a class will be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIV_VIRTUAL = NO - -# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal -# scope will be included in the documentation. -# The default value is: NO. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be -# included in the documentation. -# The default value is: NO. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO, -# only classes defined in header files are included. Does not have any effect -# for Java sources. -# The default value is: YES. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. If set to YES, local methods, -# which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO, only methods in the interface are -# included. -# The default value is: NO. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base name of -# the file that contains the anonymous namespace. By default anonymous namespace -# are hidden. -# The default value is: NO. - -EXTRACT_ANON_NSPACES = NO - -# If this flag is set to YES, the name of an unnamed parameter in a declaration -# will be determined by the corresponding definition. By default unnamed -# parameters remain unnamed in the output. -# The default value is: YES. - -RESOLVE_UNNAMED_PARAMS = YES - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all -# undocumented members inside documented classes or files. If set to NO these -# members will be included in the various overviews, but no documentation -# section is generated. This option has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. If set -# to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# declarations. If set to NO, these declarations will be included in the -# documentation. -# The default value is: NO. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO, these -# blocks will be appended to the function's detailed documentation block. -# The default value is: NO. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation that is typed after a -# \internal command is included. If the tag is set to NO then the documentation -# will be excluded. Set it to YES to include the internal documentation. -# The default value is: NO. - -INTERNAL_DOCS = NO - -# With the correct setting of option CASE_SENSE_NAMES doxygen will better be -# able to match the capabilities of the underlying filesystem. In case the -# filesystem is case sensitive (i.e. it supports files in the same directory -# whose names only differ in casing), the option must be set to YES to properly -# deal with such files in case they appear in the input. For filesystems that -# are not case sensitive the option should be be set to NO to properly deal with -# output files written for symbols that only differ in casing, such as for two -# classes, one named CLASS and the other named Class, and to also support -# references to files without having to specify the exact matching casing. On -# Windows (including Cygwin) and MacOS, users should typically set this option -# to NO, whereas on Linux or other Unix flavors it should typically be set to -# YES. -# The default value is: system dependent. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES, the -# scope will be hidden. -# The default value is: NO. - -HIDE_SCOPE_NAMES = NO - -# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will -# append additional text to a page's title, such as Class Reference. If set to -# YES the compound reference will be hidden. -# The default value is: NO. - -HIDE_COMPOUND_REFERENCE= NO - -# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of -# the files that are included by a file in the documentation of that file. -# The default value is: YES. - -SHOW_INCLUDE_FILES = YES - -# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each -# grouped member an include statement to the documentation, telling the reader -# which file to include in order to use the member. -# The default value is: NO. - -SHOW_GROUPED_MEMB_INC = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include -# files with double quotes in the documentation rather than with sharp brackets. -# The default value is: NO. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the -# documentation for inline members. -# The default value is: YES. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the -# (detailed) documentation of file and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. -# The default value is: YES. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief -# descriptions of file, namespace and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. Note that -# this will also influence the order of the classes in the class list. -# The default value is: NO. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the -# (brief and detailed) documentation of class members so that constructors and -# destructors are listed first. If set to NO the constructors will appear in the -# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. -# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief -# member documentation. -# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting -# detailed member documentation. -# The default value is: NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy -# of group names into alphabetical order. If set to NO the group names will -# appear in their defined order. -# The default value is: NO. - -SORT_GROUP_NAMES = YES - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by -# fully-qualified names, including namespaces. If set to NO, the class list will -# be sorted only by class name, not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the alphabetical -# list. -# The default value is: NO. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper -# type resolution of all parameters of a function it will reject a match between -# the prototype and the implementation of a member function even if there is -# only one candidate or it is obvious which candidate to choose by doing a -# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still -# accept a match between prototype and implementation in such cases. -# The default value is: NO. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo -# list. This list is created by putting \todo commands in the documentation. -# The default value is: YES. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test -# list. This list is created by putting \test commands in the documentation. -# The default value is: YES. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug -# list. This list is created by putting \bug commands in the documentation. -# The default value is: YES. - -GENERATE_BUGLIST = NO - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) -# the deprecated list. This list is created by putting \deprecated commands in -# the documentation. -# The default value is: YES. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional documentation -# sections, marked by \if ... \endif and \cond -# ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the -# initial value of a variable or macro / define can have for it to appear in the -# documentation. If the initializer consists of more lines than specified here -# it will be hidden. Use a value of 0 to hide initializers completely. The -# appearance of the value of individual variables and macros / defines can be -# controlled using \showinitializer or \hideinitializer command in the -# documentation regardless of this setting. -# Minimum value: 0, maximum value: 10000, default value: 30. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES, the -# list will mention the files that were used to generate the documentation. -# The default value is: YES. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This -# will remove the Files entry from the Quick Index and from the Folder Tree View -# (if specified). -# The default value is: YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces -# page. This will remove the Namespaces entry from the Quick Index and from the -# Folder Tree View (if specified). -# The default value is: YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command command input-file, where command is the value of the -# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided -# by doxygen. Whatever the program writes to standard output is used as the file -# version. For an example see the documentation. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. You can -# optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. -# -# Note that if you run doxygen from a directory containing a file called -# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE -# tag is left empty. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files containing -# the reference definitions. This must be a list of .bib files. The .bib -# extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. -# For LaTeX the style of the bibliography can be controlled using -# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. See also \cite for info how to create references. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated to -# standard output by doxygen. If QUIET is set to YES this implies that the -# messages are off. -# The default value is: NO. - -QUIET = YES - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES -# this implies that the warnings are on. -# -# Tip: Turn warnings on while writing the documentation. -# The default value is: YES. - -WARNINGS = YES - -# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate -# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag -# will automatically be disabled. -# The default value is: YES. - -WARN_IF_UNDOCUMENTED = YES - -# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. -# The default value is: YES. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that -# are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. If -# EXTRACT_ALL is set to YES then this flag will automatically be disabled. -# The default value is: NO. - -WARN_NO_PARAMDOC = NO - -# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when -# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS -# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but -# at the end of the doxygen process doxygen will return with a non-zero status. -# Possible values are: NO, YES and FAIL_ON_WARNINGS. -# The default value is: NO. - -WARN_AS_ERROR = YES - -# The WARN_FORMAT tag determines the format of the warning messages that doxygen -# can produce. The string should contain the $file, $line, and $text tags, which -# will be replaced by the file and line number from which the warning originated -# and the warning text. Optionally the format may contain $version, which will -# be replaced by the version of the file (if it could be obtained via -# FILE_VERSION_FILTER) -# The default value is: $file:$line: $text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning and error -# messages should be written. If left blank the output is written to standard -# error (stderr). - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag is used to specify the files and/or directories that contain -# documented source files. You may enter file names like myfile.cpp or -# directories like /usr/src/myproject. Separate the files or directories with -# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING -# Note: If this tag is empty the current directory is searched. - -INPUT = @top_srcdir@/doc/main.md \ - @top_srcdir@/doc/module_api_wrap.h \ - @top_srcdir@/src \ - @top_srcdir@/include/coap@LIBCOAP_API_VERSION@ \ - @top_builddir@/doc/man_tmp - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses -# libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: -# https://www.gnu.org/software/libiconv/) for the list of possible encodings. -# The default value is: UTF-8. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# read by doxygen. -# -# Note the list of default checked file patterns might differ from the list of -# default file extension mappings. -# -# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, -# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, -# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment), -# *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl, -# *.ucf, *.qsf and *.ice. - -FILE_PATTERNS = - -# The RECURSIVE tag can be used to specify whether or not subdirectories should -# be searched for input files as well. -# The default value is: NO. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = @top_srcdir@/src/coap_io_lwip.c \ - @top_srcdir@/src/coap_io_riot.c \ - @top_srcdir@/include/coap@LIBCOAP_API_VERSION@/lwippools.h \ - @top_srcdir@/include/coap@LIBCOAP_API_VERSION@/uthash.h \ - @top_srcdir@/include/coap@LIBCOAP_API_VERSION@/utlist.h - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. -# The default value is: NO. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or directories -# that contain example code fragments that are included (see the \include -# command). - -EXAMPLE_PATH = @top_builddir@/doc/man_html - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank all -# files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude commands -# irrespective of the value of the RECURSIVE tag. -# The default value is: NO. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or directories -# that contain images that are to be included in the documentation (see the -# \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command: -# -# -# -# where is the value of the INPUT_FILTER tag, and is the -# name of an input file. Doxygen will then use the output that the filter -# program writes to standard output. If FILTER_PATTERNS is specified, this tag -# will be ignored. -# -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: pattern=filter -# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how -# filters are used. If the FILTER_PATTERNS tag is empty or if none of the -# patterns match the file name, INPUT_FILTER is applied. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will also be used to filter the input files that are used for -# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). -# The default value is: NO. - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and -# it is also possible to disable source filtering for a specific pattern using -# *.ext= (so without naming a filter). -# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want to reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = - -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will be -# generated. Documented entities will be cross-referenced with these sources. -# -# Note: To get rid of all source code in the generated output, make sure that -# also VERBATIM_HEADERS is set to NO. -# The default value is: NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. -# The default value is: NO. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any -# special comment blocks from generated source code fragments. Normal C, C++ and -# Fortran comments will always remain visible. -# The default value is: YES. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# entity all documented functions referencing it will be listed. -# The default value is: NO. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES then for each documented function -# all documented entities called/used by that function will be listed. -# The default value is: NO. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES then the hyperlinks from functions in REFERENCES_RELATION and -# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will -# link to the documentation. -# The default value is: YES. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code will -# point to the HTML generated by the htags(1) tool instead of doxygen built-in -# source browser. The htags tool is part of GNU's global source tagging system -# (see https://www.gnu.org/software/global/global.html). You will need version -# 4.8.6 or higher. -# -# To use it do the following: -# - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file -# - Make sure the INPUT points to the root of the source tree -# - Run doxygen as normal -# -# Doxygen will invoke htags (and that will in turn invoke gtags), so these -# tools must be available from the command line (i.e. in the search path). -# -# The result: instead of the source browser generated by doxygen, the links to -# source code will now point to the output of htags. -# The default value is: NO. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a -# verbatim copy of the header file for each class for which an include is -# specified. Set to NO to disable this. -# See also: Section \class. -# The default value is: YES. - -VERBATIM_HEADERS = YES - -# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the -# clang parser (see: -# http://clang.llvm.org/) for more accurate parsing at the cost of reduced -# performance. This can be particularly helpful with template rich C++ code for -# which doxygen's built-in parser lacks the necessary type information. -# Note: The availability of this option depends on whether or not doxygen was -# generated with the -Duse_libclang=ON option for CMake. -# The default value is: NO. - -CLANG_ASSISTED_PARSING = NO - -# If clang assisted parsing is enabled and the CLANG_ADD_INC_PATHS tag is set to -# YES then doxygen will add the directory of each input to the include path. -# The default value is: YES. - -CLANG_ADD_INC_PATHS = YES - -# If clang assisted parsing is enabled you can provide the compiler with command -# line options that you would normally use when invoking the compiler. Note that -# the include paths will already be set by doxygen for the files and directories -# specified with INPUT and INCLUDE_PATH. -# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. - -CLANG_OPTIONS = - -# If clang assisted parsing is enabled you can provide the clang parser with the -# path to the directory containing a file called compile_commands.json. This -# file is the compilation database (see: -# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the -# options used when the source files were built. This is equivalent to -# specifying the -p option to a clang tool, such as clang-check. These options -# will then be passed to the parser. Any options specified with CLANG_OPTIONS -# will be added as well. -# Note: The availability of this option depends on whether or not doxygen was -# generated with the -Duse_libclang=ON option for CMake. - -CLANG_DATABASE_PATH = - -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all -# compounds will be generated. Enable this if the project contains a lot of -# classes, structs, unions or interfaces. -# The default value is: YES. - -ALPHABETICAL_INDEX = NO - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output -# The default value is: YES. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each -# generated HTML page (for example: .htm, .php, .asp). -# The default value is: .html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a user-defined HTML header file for -# each generated HTML page. If the tag is left blank doxygen will generate a -# standard header. -# -# To get valid HTML the header file that includes any scripts and style sheets -# that doxygen needs, which is dependent on the configuration options used (e.g. -# the setting GENERATE_TREEVIEW). It is highly recommended to start with a -# default header using -# doxygen -w html new_header.html new_footer.html new_stylesheet.css -# YourConfigFile -# and then modify the file new_header.html. See also section "Doxygen usage" -# for information on how to generate the default header that doxygen normally -# uses. -# Note: The header is subject to change so you typically have to regenerate the -# default header when upgrading to a newer version of doxygen. For a description -# of the possible markers and block names see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each -# generated HTML page. If the tag is left blank doxygen will generate a standard -# footer. See HTML_HEADER for more information on how to generate a default -# footer and what special commands can be used inside the footer. See also -# section "Doxygen usage" for information on how to generate the default footer -# that doxygen normally uses. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style -# sheet that is used by each HTML page. It can be used to fine-tune the look of -# the HTML output. If left blank doxygen will generate a default style sheet. -# See also section "Doxygen usage" for information on how to generate the style -# sheet that doxygen normally uses. -# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as -# it is more robust and this tag (HTML_STYLESHEET) will in the future become -# obsolete. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined -# cascading style sheets that are included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefore more robust against future updates. -# Doxygen will copy the style sheet files to the output directory. -# Note: The order of the extra style sheet files is of importance (e.g. the last -# style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that the -# files will be copied as-is; there are no commands or markers available. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# https://en.wikipedia.org/wiki/Hue for more information. For instance the value -# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 -# purple, and 360 is red again. -# Minimum value: 0, maximum value: 359, default value: 220. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A -# value of 255 will produce the most vivid colors. -# Minimum value: 0, maximum value: 255, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 -# gradually make the output lighter, whereas values above 100 make the output -# darker. The value divided by 100 is the actual gamma applied, so 80 represents -# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not -# change the gamma. -# Minimum value: 40, maximum value: 240, default value: 80. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to YES can help to show when doxygen was last run and thus if the -# documentation is up to date. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = YES - -# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML -# documentation will contain a main index with vertical navigation menus that -# are dynamically created via JavaScript. If disabled, the navigation index will -# consists of multiple levels of tabs that are statically embedded in every HTML -# page. Disable this option to support browsers that do not have JavaScript, -# like the Qt help browser. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_MENUS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_SECTIONS = YES - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries -# shown in the various tree structured indices initially; the user can expand -# and collapse entries dynamically later on. Doxygen will expand the tree to -# such a level that at most the specified number of entries are visible (unless -# a fully collapsed tree already exceeds this amount). So setting the number of -# entries 1 will produce a full collapsed tree by default. 0 is a special value -# representing an infinite number of entries and will result in a full expanded -# tree by default. -# Minimum value: 0, maximum value: 9999, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files will be -# generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: -# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To -# create a documentation set, doxygen will generate a Makefile in the HTML -# output directory. Running make will produce the docset in that directory and -# running make install will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy -# genXcode/_index.html for more information. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_DOCSET = NO - -# This tag determines the name of the docset feed. A documentation feed provides -# an umbrella under which multiple documentation sets from a single provider -# (such as a company or product suite) can be grouped. -# The default value is: Doxygen generated docs. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# This tag specifies a string that should uniquely identify the documentation -# set bundle. This should be a reverse domain-name style string, e.g. -# com.mycompany.MyDocSet. Doxygen will append .docset to the name. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. -# The default value is: org.doxygen.Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. -# The default value is: Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_NAME = "libcoap build system" - -# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three -# additional HTML index files: index.hhp, index.hhc, and index.hhk. The -# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: -# https://www.microsoft.com/en-us/download/details.aspx?id=21138) on Windows. -# -# The HTML Help Workshop contains a compiler that can convert all HTML output -# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML -# files are now used as the Windows 98 help format, and will replace the old -# Windows help format (.hlp) on all Windows platforms in the future. Compressed -# HTML files also contain an index, a table of contents, and you can search for -# words in the documentation. The HTML workshop also contains a viewer for -# compressed HTML files. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_HTMLHELP = NO - -# The CHM_FILE tag can be used to specify the file name of the resulting .chm -# file. You can add a path in front of the file if the result should not be -# written to the html output directory. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_FILE = - -# The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler (hhc.exe). If non-empty, -# doxygen will try to run the HTML help compiler on the generated index.hhp. -# The file has to be specified with full path. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -HHC_LOCATION = - -# The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the main .chm file (NO). -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -GENERATE_CHI = NO - -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) -# and project file content. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_INDEX_ENCODING = - -# The BINARY_TOC flag controls whether a binary table of contents is generated -# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it -# enables the Previous and Next buttons. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members to -# the table of contents of the HTML help documentation and to the tree view. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that -# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help -# (.qch) of the generated HTML documentation. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify -# the file name of the resulting .qch file. The path specified is relative to -# the HTML output folder. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help -# Project output. For more information please see Qt Help Project / Namespace -# (see: -# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt -# Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: -# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). -# The default value is: doc. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_VIRTUAL_FOLDER = doc - -# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom -# filter to add. For more information please see Qt Help Project / Custom -# Filters (see: -# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: -# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's filter section matches. Qt Help Project / Filter Attributes (see: -# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_SECT_FILTER_ATTRS = - -# The QHG_LOCATION tag can be used to specify the location (absolute path -# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to -# run qhelpgenerator on the generated .qhp file. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be -# generated, together with the HTML files, they form an Eclipse help plugin. To -# install this plugin and make it available under the help contents menu in -# Eclipse, the contents of the directory containing the HTML and XML files needs -# to be copied into the plugins directory of eclipse. The name of the directory -# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. -# After copying Eclipse needs to be restarted before the help appears. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the Eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have this -# name. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# If you want full control over the layout of the generated HTML pages it might -# be necessary to disable the index and replace it with your own. The -# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top -# of each HTML page. A value of NO enables the index and the value YES disables -# it. Since the tabs in the index contain the same information as the navigation -# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. If the tag -# value is set to YES, a side panel will be generated containing a tree-like -# index structure (just like the one that is generated for HTML Help). For this -# to work a browser that supports JavaScript, DHTML, CSS and frames is required -# (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_TREEVIEW = YES - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that -# doxygen will group on one line in the generated HTML documentation. -# -# Note that a value of 0 will completely suppress the enum values from appearing -# in the overview section. -# Minimum value: 0, maximum value: 20, default value: 4. -# This tag requires that the tag GENERATE_HTML is set to YES. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used -# to set the initial width (in pixels) of the frame in which the tree is shown. -# Minimum value: 0, maximum value: 1500, default value: 250. -# This tag requires that the tag GENERATE_HTML is set to YES. - -TREEVIEW_WIDTH = 250 - -# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to -# external symbols imported via tag files in a separate window. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -EXT_LINKS_IN_WINDOW = NO - -# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg -# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see -# https://inkscape.org) to generate formulas as SVG images instead of PNGs for -# the HTML output. These images will generally look nicer at scaled resolutions. -# Possible values are: png (the default) and svg (looks nicer but requires the -# pdf2svg or inkscape tool). -# The default value is: png. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FORMULA_FORMAT = png - -# Use this tag to change the font size of LaTeX formulas included as images in -# the HTML documentation. When you change the font size after a successful -# doxygen run you need to manually remove any form_*.png images from the HTML -# output directory to force them to be regenerated. -# Minimum value: 8, maximum value: 50, default value: 10. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANSPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - -# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands -# to create new LaTeX commands to be used in formulas as building blocks. See -# the section "Including formulas" for details. - -FORMULA_MACROFILE = - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# https://www.mathjax.org) which uses client side JavaScript for the rendering -# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. -# Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. -# The default value is: HTML-CSS. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the HTML -# output directory using the MATHJAX_RELPATH option. The destination directory -# should contain the MathJax.js script. For instance, if the mathjax directory -# is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax -# Content Delivery Network so you can quickly see the result without installing -# MathJax. However, it is strongly recommended to install a local copy of -# MathJax from https://www.mathjax.org before deployment. -# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -# extension names that should be enabled during MathJax rendering. For example -# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces -# of code that will be used on startup of the MathJax code. See the MathJax site -# (see: -# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an -# example see the documentation. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box for -# the HTML output. The underlying search engine uses javascript and DHTML and -# should work on any modern browser. Note that when using HTML help -# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) -# there is already a search function so this one should typically be disabled. -# For large projects the javascript based search engine can be slow, then -# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to -# search using the keyboard; to jump to the search box use + S -# (what the is depends on the OS and browser, but it is typically -# , /