diff --git a/0x0001_hello-world/.gitignore b/0x0001_hello-world/.gitignore index 6aa60eb..149d92e 100644 --- a/0x0001_hello-world/.gitignore +++ b/0x0001_hello-world/.gitignore @@ -1,7 +1,5 @@ .idea -.vscode _deps cmake-* build .DS_Store -*.pdf diff --git a/0x0001_hello-world/.vscode/.cortex-debug.peripherals.state.json b/0x0001_hello-world/.vscode/.cortex-debug.peripherals.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x0001_hello-world/.vscode/.cortex-debug.peripherals.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x0001_hello-world/.vscode/.cortex-debug.registers.state.json b/0x0001_hello-world/.vscode/.cortex-debug.registers.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x0001_hello-world/.vscode/.cortex-debug.registers.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x0001_hello-world/.vscode/c_cpp_properties.json b/0x0001_hello-world/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..ada839e --- /dev/null +++ b/0x0001_hello-world/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "Pico", + "includePath": [ + "${workspaceFolder}/**", + "${env:PICO_SDK_PATH}/**" + ], + "defines": [], + "compilerPath": "${env:PICO_INSTALL_PATH}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc.exe", + "cStandard": "c11", + "cppStandard": "c++11", + "intelliSenseMode": "linux-gcc-arm", + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 +} diff --git a/0x0001_hello-world/.vscode/launch.json b/0x0001_hello-world/.vscode/launch.json new file mode 100644 index 0000000..2b22acf --- /dev/null +++ b/0x0001_hello-world/.vscode/launch.json @@ -0,0 +1,58 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Pico Debug (Cortex-Debug)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "openocd", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "configFiles": [ + "interface/cmsis-dap.cfg", + "target/rp2040.cfg" + ], + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main", + "openOCDLaunchCommands": [ + "adapter speed 1000" + ] + }, + { + "name": "Pico Debug (Cortex-Debug with external OpenOCD)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "external", + "gdbTarget": "localhost:3333", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main" + }, + { + "name": "Pico Debug (C++ Debugger)", + "type": "cppdbg", + "request": "launch", + "cwd": "${workspaceFolder}", + "program": "${command:cmake.launchTargetPath}", + "MIMode": "gdb", + "miDebuggerPath": "arm-none-eabi-gdb", + "miDebuggerServerAddress": "localhost:3333", + "debugServerPath": "openocd", + "debugServerArgs": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 1000\"", + "serverStarted": "Listening on port .* for gdb connections", + "filterStderr": true, + "stopAtEntry": true, + "hardwareBreakpoints": { + "require": true, + "limit": 4 + }, + "preLaunchTask": "Flash", + "svdPath": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd" + } + ] +} diff --git a/0x0001_hello-world/.vscode/tasks.json b/0x0001_hello-world/.vscode/tasks.json new file mode 100644 index 0000000..a437c2f --- /dev/null +++ b/0x0001_hello-world/.vscode/tasks.json @@ -0,0 +1,29 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Flash", + "type": "shell", + "command": "openocd", + "args": [ + "-f", + "interface/cmsis-dap.cfg", + "-f", + "target/rp2040.cfg", + "-c", + "adapter speed 1000; program {${command:cmake.launchTargetPath}} verify reset exit" + ], + "problemMatcher": [] + }, + { + "label": "Build", + "type": "cmake", + "command": "build", + "problemMatcher": "$gcc", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/0x0001_hello-world/CMakeLists.txt b/0x0001_hello-world/CMakeLists.txt index b2fc054..984736d 100644 --- a/0x0001_hello-world/CMakeLists.txt +++ b/0x0001_hello-world/CMakeLists.txt @@ -1,57 +1,21 @@ cmake_minimum_required(VERSION 3.13) -set(PICO_BOARD pico_w) - include(pico_sdk_import.cmake) - project(0x0001_hello-world C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) pico_sdk_init() -if (PICO_CYW43_SUPPORTED) # set by PICO_BOARD=pico_w - if (NOT TARGET pico_cyw43_arch) - message("Skipping Pico W examples as support is not available") - else() - - if (DEFINED ENV{WIFI_SSID} AND (NOT WIFI_SSID)) - set(WIFI_SSID $ENV{WIFI_SSID}) - message("Using WIFI_SSID from environment ('${WIFI_SSID}')") - endif() - - if (DEFINED ENV{WIFI_PASSWORD} AND (NOT WIFI_PASSWORD)) - set(WIFI_PASSWORD $ENV{WIFI_PASSWORD}) - message("Using WIFI_PASSWORD from environment") - endif() - - set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID for examples") - set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi password for examples") - endif() -endif() - -set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID") -set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi PASSWORD") - add_executable(0x0001_hello-world - main.c - ) -target_compile_definitions(0x0001_hello-world PRIVATE - WIFI_SSID=\"${WIFI_SSID}\" - WIFI_PASSWORD=\"${WIFI_PASSWORD}\" - ) -target_include_directories(0x0001_hello-world PRIVATE - ${CMAKE_CURRENT_LIST_DIR} - ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts - ) -target_link_libraries(0x0001_hello-world - pico_cyw43_arch_lwip_threadsafe_background - pico_lwip_mbedtls - pico_mbedtls - pico_stdlib - ) + main.c +) -pico_enable_stdio_usb(0x0001_hello-world 0) +pico_enable_stdio_usb(0x0001_hello-world 1) pico_enable_stdio_uart(0x0001_hello-world 1) pico_add_extra_outputs(0x0001_hello-world) + +target_link_libraries(0x0001_hello-world + pico_stdlib +) diff --git a/0x0001_hello-world/lwipopts.h b/0x0001_hello-world/lwipopts.h deleted file mode 100644 index b7f0386..0000000 --- a/0x0001_hello-world/lwipopts.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _LWIPOPTS_H -#define _LWIPOPTS_H - -#include "lwipopts_examples_common.h" - -/* TCP WND must be at least 16 kb to match TLS record size - or you will get a warning "altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!" */ -#undef TCP_WND -#define TCP_WND 16384 - -#define LWIP_ALTCP 1 -#define LWIP_ALTCP_TLS 1 -#define LWIP_ALTCP_TLS_MBEDTLS 1 - -#define LWIP_DEBUG 1 -#define ALTCP_MBEDTLS_DEBUG LWIP_DBG_ON - -#endif \ No newline at end of file diff --git a/0x0001_hello-world/lwipopts_examples_common.h b/0x0001_hello-world/lwipopts_examples_common.h deleted file mode 100644 index d6a2d02..0000000 --- a/0x0001_hello-world/lwipopts_examples_common.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef _LWIPOPTS_EXAMPLE_COMMONH_H -#define _LWIPOPTS_EXAMPLE_COMMONH_H - -// Common settings used in most of the pico_w examples -// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details) - -// allow override in some examples -#ifndef NO_SYS -#define NO_SYS 1 -#endif -// allow override in some examples -#ifndef LWIP_SOCKET -#define LWIP_SOCKET 0 -#endif -#if PICO_CYW43_ARCH_POLL -#define MEM_LIBC_MALLOC 1 -#else -// MEM_LIBC_MALLOC is incompatible with non polling versions -#define MEM_LIBC_MALLOC 0 -#endif -#define MEM_ALIGNMENT 4 -#define MEM_SIZE 4000 -#define MEMP_NUM_TCP_SEG 32 -#define MEMP_NUM_ARP_QUEUE 10 -#define PBUF_POOL_SIZE 24 -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_ICMP 1 -#define LWIP_RAW 1 -#define TCP_WND (8 * TCP_MSS) -#define TCP_MSS 1460 -#define TCP_SND_BUF (8 * TCP_MSS) -#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS)) -#define LWIP_NETIF_STATUS_CALLBACK 1 -#define LWIP_NETIF_LINK_CALLBACK 1 -#define LWIP_NETIF_HOSTNAME 1 -#define LWIP_NETCONN 0 -#define MEM_STATS 0 -#define SYS_STATS 0 -#define MEMP_STATS 0 -#define LINK_STATS 0 -// #define ETH_PAD_SIZE 2 -#define LWIP_CHKSUM_ALGORITHM 3 -#define LWIP_DHCP 1 -#define LWIP_IPV4 1 -#define LWIP_TCP 1 -#define LWIP_UDP 1 -#define LWIP_DNS 1 -#define LWIP_TCP_KEEPALIVE 1 -#define LWIP_NETIF_TX_SINGLE_PBUF 1 -#define DHCP_DOES_ARP_CHECK 0 -#define LWIP_DHCP_DOES_ACD_CHECK 0 - -#ifndef NDEBUG -#define LWIP_DEBUG 1 -#define LWIP_STATS 1 -#define LWIP_STATS_DISPLAY 1 -#endif - -#define ETHARP_DEBUG LWIP_DBG_OFF -#define NETIF_DEBUG LWIP_DBG_OFF -#define PBUF_DEBUG LWIP_DBG_OFF -#define API_LIB_DEBUG LWIP_DBG_OFF -#define API_MSG_DEBUG LWIP_DBG_OFF -#define SOCKETS_DEBUG LWIP_DBG_OFF -#define ICMP_DEBUG LWIP_DBG_OFF -#define INET_DEBUG LWIP_DBG_OFF -#define IP_DEBUG LWIP_DBG_OFF -#define IP_REASS_DEBUG LWIP_DBG_OFF -#define RAW_DEBUG LWIP_DBG_OFF -#define MEM_DEBUG LWIP_DBG_OFF -#define MEMP_DEBUG LWIP_DBG_OFF -#define SYS_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF -#define TCP_INPUT_DEBUG LWIP_DBG_OFF -#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF -#define TCP_RTO_DEBUG LWIP_DBG_OFF -#define TCP_CWND_DEBUG LWIP_DBG_OFF -#define TCP_WND_DEBUG LWIP_DBG_OFF -#define TCP_FR_DEBUG LWIP_DBG_OFF -#define TCP_QLEN_DEBUG LWIP_DBG_OFF -#define TCP_RST_DEBUG LWIP_DBG_OFF -#define UDP_DEBUG LWIP_DBG_OFF -#define TCPIP_DEBUG LWIP_DBG_OFF -#define PPP_DEBUG LWIP_DBG_OFF -#define SLIP_DEBUG LWIP_DBG_OFF -#define DHCP_DEBUG LWIP_DBG_OFF - -#endif /* __LWIPOPTS_H__ */ \ No newline at end of file diff --git a/0x0001_hello-world/main.c b/0x0001_hello-world/main.c index 3c1055b..096aba7 100644 --- a/0x0001_hello-world/main.c +++ b/0x0001_hello-world/main.c @@ -1,13 +1,9 @@ #include #include "pico/stdlib.h" -#include "pico/cyw43_arch.h" -int main(void) -{ +int main(void) { stdio_init_all(); while (true) - { printf("hello, world\r\n"); - } } diff --git a/0x0001_hello-world/mbedtls_config.h b/0x0001_hello-world/mbedtls_config.h deleted file mode 100644 index 83c9f48..0000000 --- a/0x0001_hello-world/mbedtls_config.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Workaround for some mbedtls source files using INT_MAX without including limits.h */ -#include - -#define MBEDTLS_NO_PLATFORM_ENTROPY -#define MBEDTLS_ENTROPY_HARDWARE_ALT - -#define MBEDTLS_SSL_OUT_CONTENT_LEN 2048 - -#define MBEDTLS_ALLOW_PRIVATE_ACCESS -#define MBEDTLS_HAVE_TIME - -#define MBEDTLS_CIPHER_MODE_CBC -#define MBEDTLS_ECP_DP_SECP192R1_ENABLED -#define MBEDTLS_ECP_DP_SECP224R1_ENABLED -#define MBEDTLS_ECP_DP_SECP256R1_ENABLED -#define MBEDTLS_ECP_DP_SECP384R1_ENABLED -#define MBEDTLS_ECP_DP_SECP521R1_ENABLED -#define MBEDTLS_ECP_DP_SECP192K1_ENABLED -#define MBEDTLS_ECP_DP_SECP224K1_ENABLED -#define MBEDTLS_ECP_DP_SECP256K1_ENABLED -#define MBEDTLS_ECP_DP_BP256R1_ENABLED -#define MBEDTLS_ECP_DP_BP384R1_ENABLED -#define MBEDTLS_ECP_DP_BP512R1_ENABLED -#define MBEDTLS_ECP_DP_CURVE25519_ENABLED -#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED -#define MBEDTLS_PKCS1_V15 -#define MBEDTLS_SHA256_SMALLER -#define MBEDTLS_SSL_SERVER_NAME_INDICATION -#define MBEDTLS_AES_C -#define MBEDTLS_ASN1_PARSE_C -#define MBEDTLS_BIGNUM_C -#define MBEDTLS_CIPHER_C -#define MBEDTLS_CTR_DRBG_C -#define MBEDTLS_ENTROPY_C -#define MBEDTLS_ERROR_C -#define MBEDTLS_MD_C -#define MBEDTLS_MD5_C -#define MBEDTLS_OID_C -#define MBEDTLS_PKCS5_C -#define MBEDTLS_PK_C -#define MBEDTLS_PK_PARSE_C -#define MBEDTLS_PLATFORM_C -#define MBEDTLS_RSA_C -#define MBEDTLS_SHA1_C -#define MBEDTLS_SHA224_C -#define MBEDTLS_SHA256_C -#define MBEDTLS_SHA512_C -#define MBEDTLS_SSL_CLI_C -#define MBEDTLS_SSL_SRV_C -#define MBEDTLS_SSL_TLS_C -#define MBEDTLS_X509_CRT_PARSE_C -#define MBEDTLS_X509_USE_C -#define MBEDTLS_AES_FEWER_TABLES - -/* TLS 1.2 */ -#define MBEDTLS_SSL_PROTO_TLS1_2 -#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED -#define MBEDTLS_GCM_C -#define MBEDTLS_ECDH_C -#define MBEDTLS_ECP_C -#define MBEDTLS_ECDSA_C -#define MBEDTLS_ASN1_WRITE_C \ No newline at end of file diff --git a/0x0005_intro-to-variables/.gitignore b/0x0005_intro-to-variables/.gitignore index 6aa60eb..149d92e 100644 --- a/0x0005_intro-to-variables/.gitignore +++ b/0x0005_intro-to-variables/.gitignore @@ -1,7 +1,5 @@ .idea -.vscode _deps cmake-* build .DS_Store -*.pdf diff --git a/0x0005_intro-to-variables/.vscode/.cortex-debug.peripherals.state.json b/0x0005_intro-to-variables/.vscode/.cortex-debug.peripherals.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x0005_intro-to-variables/.vscode/.cortex-debug.peripherals.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x0005_intro-to-variables/.vscode/.cortex-debug.registers.state.json b/0x0005_intro-to-variables/.vscode/.cortex-debug.registers.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x0005_intro-to-variables/.vscode/.cortex-debug.registers.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x0005_intro-to-variables/.vscode/c_cpp_properties.json b/0x0005_intro-to-variables/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..ada839e --- /dev/null +++ b/0x0005_intro-to-variables/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "Pico", + "includePath": [ + "${workspaceFolder}/**", + "${env:PICO_SDK_PATH}/**" + ], + "defines": [], + "compilerPath": "${env:PICO_INSTALL_PATH}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc.exe", + "cStandard": "c11", + "cppStandard": "c++11", + "intelliSenseMode": "linux-gcc-arm", + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 +} diff --git a/0x0005_intro-to-variables/.vscode/extensions.json b/0x0005_intro-to-variables/.vscode/extensions.json new file mode 100644 index 0000000..03ba0af --- /dev/null +++ b/0x0005_intro-to-variables/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "marus25.cortex-debug", + "ms-vscode.cmake-tools", + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "ms-vscode.vscode-serial-monitor" + ] +} diff --git a/0x0005_intro-to-variables/.vscode/launch.json b/0x0005_intro-to-variables/.vscode/launch.json new file mode 100644 index 0000000..2b22acf --- /dev/null +++ b/0x0005_intro-to-variables/.vscode/launch.json @@ -0,0 +1,58 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Pico Debug (Cortex-Debug)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "openocd", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "configFiles": [ + "interface/cmsis-dap.cfg", + "target/rp2040.cfg" + ], + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main", + "openOCDLaunchCommands": [ + "adapter speed 1000" + ] + }, + { + "name": "Pico Debug (Cortex-Debug with external OpenOCD)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "external", + "gdbTarget": "localhost:3333", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main" + }, + { + "name": "Pico Debug (C++ Debugger)", + "type": "cppdbg", + "request": "launch", + "cwd": "${workspaceFolder}", + "program": "${command:cmake.launchTargetPath}", + "MIMode": "gdb", + "miDebuggerPath": "arm-none-eabi-gdb", + "miDebuggerServerAddress": "localhost:3333", + "debugServerPath": "openocd", + "debugServerArgs": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 1000\"", + "serverStarted": "Listening on port .* for gdb connections", + "filterStderr": true, + "stopAtEntry": true, + "hardwareBreakpoints": { + "require": true, + "limit": 4 + }, + "preLaunchTask": "Flash", + "svdPath": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd" + } + ] +} diff --git a/0x0005_intro-to-variables/.vscode/settings.json b/0x0005_intro-to-variables/.vscode/settings.json new file mode 100644 index 0000000..8ad90e8 --- /dev/null +++ b/0x0005_intro-to-variables/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + // These settings tweaks to the cmake plugin will ensure + // that you debug using cortex-debug instead of trying to launch + // a Pico binary on the host + "cmake.statusbar.advanced": { + "debug": { + "visibility": "hidden" + }, + "launch": { + "visibility": "hidden" + }, + "build": { + "visibility": "hidden" + }, + "buildTarget": { + "visibility": "hidden" + } + }, + "cmake.buildBeforeRun": true, + "cmake.configureOnOpen": true, + "cmake.configureSettings": { + "CMAKE_MODULE_PATH": "${env:PICO_INSTALL_PATH}/pico-sdk-tools" + }, + "cmake.generator": "Ninja", + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", + "C_Cpp.errorSquiggles": "enabled", + "files.associations": { + "stdlib.h": "c" + } +} diff --git a/0x0005_intro-to-variables/.vscode/tasks.json b/0x0005_intro-to-variables/.vscode/tasks.json new file mode 100644 index 0000000..a437c2f --- /dev/null +++ b/0x0005_intro-to-variables/.vscode/tasks.json @@ -0,0 +1,29 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Flash", + "type": "shell", + "command": "openocd", + "args": [ + "-f", + "interface/cmsis-dap.cfg", + "-f", + "target/rp2040.cfg", + "-c", + "adapter speed 1000; program {${command:cmake.launchTargetPath}} verify reset exit" + ], + "problemMatcher": [] + }, + { + "label": "Build", + "type": "cmake", + "command": "build", + "problemMatcher": "$gcc", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/0x0005_intro-to-variables/CMakeLists.txt b/0x0005_intro-to-variables/CMakeLists.txt index 8c10ec6..25e5ce4 100644 --- a/0x0005_intro-to-variables/CMakeLists.txt +++ b/0x0005_intro-to-variables/CMakeLists.txt @@ -1,57 +1,21 @@ cmake_minimum_required(VERSION 3.13) -set(PICO_BOARD pico_w) - include(pico_sdk_import.cmake) - -project(0x0005_intro-to-variables C CXX ASM) +project(0x0001_hello-world C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) pico_sdk_init() -if (PICO_CYW43_SUPPORTED) # set by PICO_BOARD=pico_w - if (NOT TARGET pico_cyw43_arch) - message("Skipping Pico W examples as support is not available") - else() - - if (DEFINED ENV{WIFI_SSID} AND (NOT WIFI_SSID)) - set(WIFI_SSID $ENV{WIFI_SSID}) - message("Using WIFI_SSID from environment ('${WIFI_SSID}')") - endif() - - if (DEFINED ENV{WIFI_PASSWORD} AND (NOT WIFI_PASSWORD)) - set(WIFI_PASSWORD $ENV{WIFI_PASSWORD}) - message("Using WIFI_PASSWORD from environment") - endif() - - set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID for examples") - set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi password for examples") - endif() -endif() - -set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID") -set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi PASSWORD") - add_executable(0x0005_intro-to-variables - main.c - ) -target_compile_definitions(0x0005_intro-to-variables PRIVATE - WIFI_SSID=\"${WIFI_SSID}\" - WIFI_PASSWORD=\"${WIFI_PASSWORD}\" - ) -target_include_directories(0x0005_intro-to-variables PRIVATE - ${CMAKE_CURRENT_LIST_DIR} - ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts - ) -target_link_libraries(0x0005_intro-to-variables - pico_cyw43_arch_lwip_threadsafe_background - pico_lwip_mbedtls - pico_mbedtls - pico_stdlib - ) + main.c +) -pico_enable_stdio_usb(0x0005_intro-to-variables 0) +pico_enable_stdio_usb(0x0005_intro-to-variables 1) pico_enable_stdio_uart(0x0005_intro-to-variables 1) pico_add_extra_outputs(0x0005_intro-to-variables) + +target_link_libraries(0x0005_intro-to-variables + pico_stdlib +) diff --git a/0x0005_intro-to-variables/lwipopts.h b/0x0005_intro-to-variables/lwipopts.h deleted file mode 100644 index b7f0386..0000000 --- a/0x0005_intro-to-variables/lwipopts.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _LWIPOPTS_H -#define _LWIPOPTS_H - -#include "lwipopts_examples_common.h" - -/* TCP WND must be at least 16 kb to match TLS record size - or you will get a warning "altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!" */ -#undef TCP_WND -#define TCP_WND 16384 - -#define LWIP_ALTCP 1 -#define LWIP_ALTCP_TLS 1 -#define LWIP_ALTCP_TLS_MBEDTLS 1 - -#define LWIP_DEBUG 1 -#define ALTCP_MBEDTLS_DEBUG LWIP_DBG_ON - -#endif \ No newline at end of file diff --git a/0x0005_intro-to-variables/lwipopts_examples_common.h b/0x0005_intro-to-variables/lwipopts_examples_common.h deleted file mode 100644 index d6a2d02..0000000 --- a/0x0005_intro-to-variables/lwipopts_examples_common.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef _LWIPOPTS_EXAMPLE_COMMONH_H -#define _LWIPOPTS_EXAMPLE_COMMONH_H - -// Common settings used in most of the pico_w examples -// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details) - -// allow override in some examples -#ifndef NO_SYS -#define NO_SYS 1 -#endif -// allow override in some examples -#ifndef LWIP_SOCKET -#define LWIP_SOCKET 0 -#endif -#if PICO_CYW43_ARCH_POLL -#define MEM_LIBC_MALLOC 1 -#else -// MEM_LIBC_MALLOC is incompatible with non polling versions -#define MEM_LIBC_MALLOC 0 -#endif -#define MEM_ALIGNMENT 4 -#define MEM_SIZE 4000 -#define MEMP_NUM_TCP_SEG 32 -#define MEMP_NUM_ARP_QUEUE 10 -#define PBUF_POOL_SIZE 24 -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_ICMP 1 -#define LWIP_RAW 1 -#define TCP_WND (8 * TCP_MSS) -#define TCP_MSS 1460 -#define TCP_SND_BUF (8 * TCP_MSS) -#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS)) -#define LWIP_NETIF_STATUS_CALLBACK 1 -#define LWIP_NETIF_LINK_CALLBACK 1 -#define LWIP_NETIF_HOSTNAME 1 -#define LWIP_NETCONN 0 -#define MEM_STATS 0 -#define SYS_STATS 0 -#define MEMP_STATS 0 -#define LINK_STATS 0 -// #define ETH_PAD_SIZE 2 -#define LWIP_CHKSUM_ALGORITHM 3 -#define LWIP_DHCP 1 -#define LWIP_IPV4 1 -#define LWIP_TCP 1 -#define LWIP_UDP 1 -#define LWIP_DNS 1 -#define LWIP_TCP_KEEPALIVE 1 -#define LWIP_NETIF_TX_SINGLE_PBUF 1 -#define DHCP_DOES_ARP_CHECK 0 -#define LWIP_DHCP_DOES_ACD_CHECK 0 - -#ifndef NDEBUG -#define LWIP_DEBUG 1 -#define LWIP_STATS 1 -#define LWIP_STATS_DISPLAY 1 -#endif - -#define ETHARP_DEBUG LWIP_DBG_OFF -#define NETIF_DEBUG LWIP_DBG_OFF -#define PBUF_DEBUG LWIP_DBG_OFF -#define API_LIB_DEBUG LWIP_DBG_OFF -#define API_MSG_DEBUG LWIP_DBG_OFF -#define SOCKETS_DEBUG LWIP_DBG_OFF -#define ICMP_DEBUG LWIP_DBG_OFF -#define INET_DEBUG LWIP_DBG_OFF -#define IP_DEBUG LWIP_DBG_OFF -#define IP_REASS_DEBUG LWIP_DBG_OFF -#define RAW_DEBUG LWIP_DBG_OFF -#define MEM_DEBUG LWIP_DBG_OFF -#define MEMP_DEBUG LWIP_DBG_OFF -#define SYS_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF -#define TCP_INPUT_DEBUG LWIP_DBG_OFF -#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF -#define TCP_RTO_DEBUG LWIP_DBG_OFF -#define TCP_CWND_DEBUG LWIP_DBG_OFF -#define TCP_WND_DEBUG LWIP_DBG_OFF -#define TCP_FR_DEBUG LWIP_DBG_OFF -#define TCP_QLEN_DEBUG LWIP_DBG_OFF -#define TCP_RST_DEBUG LWIP_DBG_OFF -#define UDP_DEBUG LWIP_DBG_OFF -#define TCPIP_DEBUG LWIP_DBG_OFF -#define PPP_DEBUG LWIP_DBG_OFF -#define SLIP_DEBUG LWIP_DBG_OFF -#define DHCP_DEBUG LWIP_DBG_OFF - -#endif /* __LWIPOPTS_H__ */ \ No newline at end of file diff --git a/0x0005_intro-to-variables/main.c b/0x0005_intro-to-variables/main.c index ba39131..7b2b3ae 100644 --- a/0x0005_intro-to-variables/main.c +++ b/0x0005_intro-to-variables/main.c @@ -1,16 +1,13 @@ #include #include "pico/stdlib.h" -#include "pico/cyw43_arch.h" -int main(void) -{ +int main(void) { uint8_t age = 42; + age = 43; stdio_init_all(); while (true) - { printf("age: %d\r\n", age); - } } diff --git a/0x0005_intro-to-variables/mbedtls_config.h b/0x0005_intro-to-variables/mbedtls_config.h deleted file mode 100644 index 83c9f48..0000000 --- a/0x0005_intro-to-variables/mbedtls_config.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Workaround for some mbedtls source files using INT_MAX without including limits.h */ -#include - -#define MBEDTLS_NO_PLATFORM_ENTROPY -#define MBEDTLS_ENTROPY_HARDWARE_ALT - -#define MBEDTLS_SSL_OUT_CONTENT_LEN 2048 - -#define MBEDTLS_ALLOW_PRIVATE_ACCESS -#define MBEDTLS_HAVE_TIME - -#define MBEDTLS_CIPHER_MODE_CBC -#define MBEDTLS_ECP_DP_SECP192R1_ENABLED -#define MBEDTLS_ECP_DP_SECP224R1_ENABLED -#define MBEDTLS_ECP_DP_SECP256R1_ENABLED -#define MBEDTLS_ECP_DP_SECP384R1_ENABLED -#define MBEDTLS_ECP_DP_SECP521R1_ENABLED -#define MBEDTLS_ECP_DP_SECP192K1_ENABLED -#define MBEDTLS_ECP_DP_SECP224K1_ENABLED -#define MBEDTLS_ECP_DP_SECP256K1_ENABLED -#define MBEDTLS_ECP_DP_BP256R1_ENABLED -#define MBEDTLS_ECP_DP_BP384R1_ENABLED -#define MBEDTLS_ECP_DP_BP512R1_ENABLED -#define MBEDTLS_ECP_DP_CURVE25519_ENABLED -#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED -#define MBEDTLS_PKCS1_V15 -#define MBEDTLS_SHA256_SMALLER -#define MBEDTLS_SSL_SERVER_NAME_INDICATION -#define MBEDTLS_AES_C -#define MBEDTLS_ASN1_PARSE_C -#define MBEDTLS_BIGNUM_C -#define MBEDTLS_CIPHER_C -#define MBEDTLS_CTR_DRBG_C -#define MBEDTLS_ENTROPY_C -#define MBEDTLS_ERROR_C -#define MBEDTLS_MD_C -#define MBEDTLS_MD5_C -#define MBEDTLS_OID_C -#define MBEDTLS_PKCS5_C -#define MBEDTLS_PK_C -#define MBEDTLS_PK_PARSE_C -#define MBEDTLS_PLATFORM_C -#define MBEDTLS_RSA_C -#define MBEDTLS_SHA1_C -#define MBEDTLS_SHA224_C -#define MBEDTLS_SHA256_C -#define MBEDTLS_SHA512_C -#define MBEDTLS_SSL_CLI_C -#define MBEDTLS_SSL_SRV_C -#define MBEDTLS_SSL_TLS_C -#define MBEDTLS_X509_CRT_PARSE_C -#define MBEDTLS_X509_USE_C -#define MBEDTLS_AES_FEWER_TABLES - -/* TLS 1.2 */ -#define MBEDTLS_SSL_PROTO_TLS1_2 -#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED -#define MBEDTLS_GCM_C -#define MBEDTLS_ECDH_C -#define MBEDTLS_ECP_C -#define MBEDTLS_ECDSA_C -#define MBEDTLS_ASN1_WRITE_C \ No newline at end of file diff --git a/0x0008_unitialized-variables/.gitignore b/0x0008_unitialized-variables/.gitignore index 6aa60eb..149d92e 100644 --- a/0x0008_unitialized-variables/.gitignore +++ b/0x0008_unitialized-variables/.gitignore @@ -1,7 +1,5 @@ .idea -.vscode _deps cmake-* build .DS_Store -*.pdf diff --git a/0x0008_unitialized-variables/.vscode/.cortex-debug.peripherals.state.json b/0x0008_unitialized-variables/.vscode/.cortex-debug.peripherals.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x0008_unitialized-variables/.vscode/.cortex-debug.peripherals.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x0008_unitialized-variables/.vscode/.cortex-debug.registers.state.json b/0x0008_unitialized-variables/.vscode/.cortex-debug.registers.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x0008_unitialized-variables/.vscode/.cortex-debug.registers.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x0008_unitialized-variables/.vscode/c_cpp_properties.json b/0x0008_unitialized-variables/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..ada839e --- /dev/null +++ b/0x0008_unitialized-variables/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "Pico", + "includePath": [ + "${workspaceFolder}/**", + "${env:PICO_SDK_PATH}/**" + ], + "defines": [], + "compilerPath": "${env:PICO_INSTALL_PATH}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc.exe", + "cStandard": "c11", + "cppStandard": "c++11", + "intelliSenseMode": "linux-gcc-arm", + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 +} diff --git a/0x0008_unitialized-variables/.vscode/extensions.json b/0x0008_unitialized-variables/.vscode/extensions.json new file mode 100644 index 0000000..03ba0af --- /dev/null +++ b/0x0008_unitialized-variables/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "marus25.cortex-debug", + "ms-vscode.cmake-tools", + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "ms-vscode.vscode-serial-monitor" + ] +} diff --git a/0x0008_unitialized-variables/.vscode/launch.json b/0x0008_unitialized-variables/.vscode/launch.json new file mode 100644 index 0000000..2b22acf --- /dev/null +++ b/0x0008_unitialized-variables/.vscode/launch.json @@ -0,0 +1,58 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Pico Debug (Cortex-Debug)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "openocd", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "configFiles": [ + "interface/cmsis-dap.cfg", + "target/rp2040.cfg" + ], + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main", + "openOCDLaunchCommands": [ + "adapter speed 1000" + ] + }, + { + "name": "Pico Debug (Cortex-Debug with external OpenOCD)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "external", + "gdbTarget": "localhost:3333", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main" + }, + { + "name": "Pico Debug (C++ Debugger)", + "type": "cppdbg", + "request": "launch", + "cwd": "${workspaceFolder}", + "program": "${command:cmake.launchTargetPath}", + "MIMode": "gdb", + "miDebuggerPath": "arm-none-eabi-gdb", + "miDebuggerServerAddress": "localhost:3333", + "debugServerPath": "openocd", + "debugServerArgs": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 1000\"", + "serverStarted": "Listening on port .* for gdb connections", + "filterStderr": true, + "stopAtEntry": true, + "hardwareBreakpoints": { + "require": true, + "limit": 4 + }, + "preLaunchTask": "Flash", + "svdPath": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd" + } + ] +} diff --git a/0x0008_unitialized-variables/.vscode/settings.json b/0x0008_unitialized-variables/.vscode/settings.json new file mode 100644 index 0000000..8ad90e8 --- /dev/null +++ b/0x0008_unitialized-variables/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + // These settings tweaks to the cmake plugin will ensure + // that you debug using cortex-debug instead of trying to launch + // a Pico binary on the host + "cmake.statusbar.advanced": { + "debug": { + "visibility": "hidden" + }, + "launch": { + "visibility": "hidden" + }, + "build": { + "visibility": "hidden" + }, + "buildTarget": { + "visibility": "hidden" + } + }, + "cmake.buildBeforeRun": true, + "cmake.configureOnOpen": true, + "cmake.configureSettings": { + "CMAKE_MODULE_PATH": "${env:PICO_INSTALL_PATH}/pico-sdk-tools" + }, + "cmake.generator": "Ninja", + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", + "C_Cpp.errorSquiggles": "enabled", + "files.associations": { + "stdlib.h": "c" + } +} diff --git a/0x0008_unitialized-variables/.vscode/tasks.json b/0x0008_unitialized-variables/.vscode/tasks.json new file mode 100644 index 0000000..a437c2f --- /dev/null +++ b/0x0008_unitialized-variables/.vscode/tasks.json @@ -0,0 +1,29 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Flash", + "type": "shell", + "command": "openocd", + "args": [ + "-f", + "interface/cmsis-dap.cfg", + "-f", + "target/rp2040.cfg", + "-c", + "adapter speed 1000; program {${command:cmake.launchTargetPath}} verify reset exit" + ], + "problemMatcher": [] + }, + { + "label": "Build", + "type": "cmake", + "command": "build", + "problemMatcher": "$gcc", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/0x0008_unitialized-variables/CMakeLists.txt b/0x0008_unitialized-variables/CMakeLists.txt index e582001..3133cef 100644 --- a/0x0008_unitialized-variables/CMakeLists.txt +++ b/0x0008_unitialized-variables/CMakeLists.txt @@ -1,57 +1,21 @@ cmake_minimum_required(VERSION 3.13) -set(PICO_BOARD pico_w) - include(pico_sdk_import.cmake) - project(0x0008_uninitialized-variables C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) pico_sdk_init() -if (PICO_CYW43_SUPPORTED) # set by PICO_BOARD=pico_w - if (NOT TARGET pico_cyw43_arch) - message("Skipping Pico W examples as support is not available") - else() - - if (DEFINED ENV{WIFI_SSID} AND (NOT WIFI_SSID)) - set(WIFI_SSID $ENV{WIFI_SSID}) - message("Using WIFI_SSID from environment ('${WIFI_SSID}')") - endif() - - if (DEFINED ENV{WIFI_PASSWORD} AND (NOT WIFI_PASSWORD)) - set(WIFI_PASSWORD $ENV{WIFI_PASSWORD}) - message("Using WIFI_PASSWORD from environment") - endif() - - set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID for examples") - set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi password for examples") - endif() -endif() - -set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID") -set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi PASSWORD") - add_executable(0x0008_uninitialized-variables - main.c - ) -target_compile_definitions(0x0008_uninitialized-variables PRIVATE - WIFI_SSID=\"${WIFI_SSID}\" - WIFI_PASSWORD=\"${WIFI_PASSWORD}\" - ) -target_include_directories(0x0008_uninitialized-variables PRIVATE - ${CMAKE_CURRENT_LIST_DIR} - ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts - ) -target_link_libraries(0x0008_uninitialized-variables - pico_cyw43_arch_lwip_threadsafe_background - pico_lwip_mbedtls - pico_mbedtls - pico_stdlib - ) + main.c +) -pico_enable_stdio_usb(0x0008_uninitialized-variables 0) +pico_enable_stdio_usb(0x0008_uninitialized-variables 1) pico_enable_stdio_uart(0x0008_uninitialized-variables 1) pico_add_extra_outputs(0x0008_uninitialized-variables) + +target_link_libraries(0x0008_uninitialized-variables + pico_stdlib +) diff --git a/0x0008_unitialized-variables/lwipopts.h b/0x0008_unitialized-variables/lwipopts.h deleted file mode 100644 index b7f0386..0000000 --- a/0x0008_unitialized-variables/lwipopts.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _LWIPOPTS_H -#define _LWIPOPTS_H - -#include "lwipopts_examples_common.h" - -/* TCP WND must be at least 16 kb to match TLS record size - or you will get a warning "altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!" */ -#undef TCP_WND -#define TCP_WND 16384 - -#define LWIP_ALTCP 1 -#define LWIP_ALTCP_TLS 1 -#define LWIP_ALTCP_TLS_MBEDTLS 1 - -#define LWIP_DEBUG 1 -#define ALTCP_MBEDTLS_DEBUG LWIP_DBG_ON - -#endif \ No newline at end of file diff --git a/0x0008_unitialized-variables/lwipopts_examples_common.h b/0x0008_unitialized-variables/lwipopts_examples_common.h deleted file mode 100644 index d6a2d02..0000000 --- a/0x0008_unitialized-variables/lwipopts_examples_common.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef _LWIPOPTS_EXAMPLE_COMMONH_H -#define _LWIPOPTS_EXAMPLE_COMMONH_H - -// Common settings used in most of the pico_w examples -// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details) - -// allow override in some examples -#ifndef NO_SYS -#define NO_SYS 1 -#endif -// allow override in some examples -#ifndef LWIP_SOCKET -#define LWIP_SOCKET 0 -#endif -#if PICO_CYW43_ARCH_POLL -#define MEM_LIBC_MALLOC 1 -#else -// MEM_LIBC_MALLOC is incompatible with non polling versions -#define MEM_LIBC_MALLOC 0 -#endif -#define MEM_ALIGNMENT 4 -#define MEM_SIZE 4000 -#define MEMP_NUM_TCP_SEG 32 -#define MEMP_NUM_ARP_QUEUE 10 -#define PBUF_POOL_SIZE 24 -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_ICMP 1 -#define LWIP_RAW 1 -#define TCP_WND (8 * TCP_MSS) -#define TCP_MSS 1460 -#define TCP_SND_BUF (8 * TCP_MSS) -#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS)) -#define LWIP_NETIF_STATUS_CALLBACK 1 -#define LWIP_NETIF_LINK_CALLBACK 1 -#define LWIP_NETIF_HOSTNAME 1 -#define LWIP_NETCONN 0 -#define MEM_STATS 0 -#define SYS_STATS 0 -#define MEMP_STATS 0 -#define LINK_STATS 0 -// #define ETH_PAD_SIZE 2 -#define LWIP_CHKSUM_ALGORITHM 3 -#define LWIP_DHCP 1 -#define LWIP_IPV4 1 -#define LWIP_TCP 1 -#define LWIP_UDP 1 -#define LWIP_DNS 1 -#define LWIP_TCP_KEEPALIVE 1 -#define LWIP_NETIF_TX_SINGLE_PBUF 1 -#define DHCP_DOES_ARP_CHECK 0 -#define LWIP_DHCP_DOES_ACD_CHECK 0 - -#ifndef NDEBUG -#define LWIP_DEBUG 1 -#define LWIP_STATS 1 -#define LWIP_STATS_DISPLAY 1 -#endif - -#define ETHARP_DEBUG LWIP_DBG_OFF -#define NETIF_DEBUG LWIP_DBG_OFF -#define PBUF_DEBUG LWIP_DBG_OFF -#define API_LIB_DEBUG LWIP_DBG_OFF -#define API_MSG_DEBUG LWIP_DBG_OFF -#define SOCKETS_DEBUG LWIP_DBG_OFF -#define ICMP_DEBUG LWIP_DBG_OFF -#define INET_DEBUG LWIP_DBG_OFF -#define IP_DEBUG LWIP_DBG_OFF -#define IP_REASS_DEBUG LWIP_DBG_OFF -#define RAW_DEBUG LWIP_DBG_OFF -#define MEM_DEBUG LWIP_DBG_OFF -#define MEMP_DEBUG LWIP_DBG_OFF -#define SYS_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF -#define TCP_INPUT_DEBUG LWIP_DBG_OFF -#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF -#define TCP_RTO_DEBUG LWIP_DBG_OFF -#define TCP_CWND_DEBUG LWIP_DBG_OFF -#define TCP_WND_DEBUG LWIP_DBG_OFF -#define TCP_FR_DEBUG LWIP_DBG_OFF -#define TCP_QLEN_DEBUG LWIP_DBG_OFF -#define TCP_RST_DEBUG LWIP_DBG_OFF -#define UDP_DEBUG LWIP_DBG_OFF -#define TCPIP_DEBUG LWIP_DBG_OFF -#define PPP_DEBUG LWIP_DBG_OFF -#define SLIP_DEBUG LWIP_DBG_OFF -#define DHCP_DEBUG LWIP_DBG_OFF - -#endif /* __LWIPOPTS_H__ */ \ No newline at end of file diff --git a/0x0008_unitialized-variables/main.c b/0x0008_unitialized-variables/main.c index 555d576..5a1a08d 100644 --- a/0x0008_unitialized-variables/main.c +++ b/0x0008_unitialized-variables/main.c @@ -1,15 +1,11 @@ #include #include "pico/stdlib.h" -#include "pico/cyw43_arch.h" -int main(void) -{ +int main(void) { uint8_t age; stdio_init_all(); while (true) - { printf("age: %d\r\n", age); - } } diff --git a/0x0008_unitialized-variables/mbedtls_config.h b/0x0008_unitialized-variables/mbedtls_config.h deleted file mode 100644 index 83c9f48..0000000 --- a/0x0008_unitialized-variables/mbedtls_config.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Workaround for some mbedtls source files using INT_MAX without including limits.h */ -#include - -#define MBEDTLS_NO_PLATFORM_ENTROPY -#define MBEDTLS_ENTROPY_HARDWARE_ALT - -#define MBEDTLS_SSL_OUT_CONTENT_LEN 2048 - -#define MBEDTLS_ALLOW_PRIVATE_ACCESS -#define MBEDTLS_HAVE_TIME - -#define MBEDTLS_CIPHER_MODE_CBC -#define MBEDTLS_ECP_DP_SECP192R1_ENABLED -#define MBEDTLS_ECP_DP_SECP224R1_ENABLED -#define MBEDTLS_ECP_DP_SECP256R1_ENABLED -#define MBEDTLS_ECP_DP_SECP384R1_ENABLED -#define MBEDTLS_ECP_DP_SECP521R1_ENABLED -#define MBEDTLS_ECP_DP_SECP192K1_ENABLED -#define MBEDTLS_ECP_DP_SECP224K1_ENABLED -#define MBEDTLS_ECP_DP_SECP256K1_ENABLED -#define MBEDTLS_ECP_DP_BP256R1_ENABLED -#define MBEDTLS_ECP_DP_BP384R1_ENABLED -#define MBEDTLS_ECP_DP_BP512R1_ENABLED -#define MBEDTLS_ECP_DP_CURVE25519_ENABLED -#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED -#define MBEDTLS_PKCS1_V15 -#define MBEDTLS_SHA256_SMALLER -#define MBEDTLS_SSL_SERVER_NAME_INDICATION -#define MBEDTLS_AES_C -#define MBEDTLS_ASN1_PARSE_C -#define MBEDTLS_BIGNUM_C -#define MBEDTLS_CIPHER_C -#define MBEDTLS_CTR_DRBG_C -#define MBEDTLS_ENTROPY_C -#define MBEDTLS_ERROR_C -#define MBEDTLS_MD_C -#define MBEDTLS_MD5_C -#define MBEDTLS_OID_C -#define MBEDTLS_PKCS5_C -#define MBEDTLS_PK_C -#define MBEDTLS_PK_PARSE_C -#define MBEDTLS_PLATFORM_C -#define MBEDTLS_RSA_C -#define MBEDTLS_SHA1_C -#define MBEDTLS_SHA224_C -#define MBEDTLS_SHA256_C -#define MBEDTLS_SHA512_C -#define MBEDTLS_SSL_CLI_C -#define MBEDTLS_SSL_SRV_C -#define MBEDTLS_SSL_TLS_C -#define MBEDTLS_X509_CRT_PARSE_C -#define MBEDTLS_X509_USE_C -#define MBEDTLS_AES_FEWER_TABLES - -/* TLS 1.2 */ -#define MBEDTLS_SSL_PROTO_TLS1_2 -#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED -#define MBEDTLS_GCM_C -#define MBEDTLS_ECDH_C -#define MBEDTLS_ECP_C -#define MBEDTLS_ECDSA_C -#define MBEDTLS_ASN1_WRITE_C \ No newline at end of file diff --git a/0x000b_integer-data-type/.gitignore b/0x000b_integer-data-type/.gitignore index 6aa60eb..149d92e 100644 --- a/0x000b_integer-data-type/.gitignore +++ b/0x000b_integer-data-type/.gitignore @@ -1,7 +1,5 @@ .idea -.vscode _deps cmake-* build .DS_Store -*.pdf diff --git a/0x000b_integer-data-type/.vscode/.cortex-debug.peripherals.state.json b/0x000b_integer-data-type/.vscode/.cortex-debug.peripherals.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x000b_integer-data-type/.vscode/.cortex-debug.peripherals.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x000b_integer-data-type/.vscode/.cortex-debug.registers.state.json b/0x000b_integer-data-type/.vscode/.cortex-debug.registers.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x000b_integer-data-type/.vscode/.cortex-debug.registers.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x000b_integer-data-type/.vscode/c_cpp_properties.json b/0x000b_integer-data-type/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..ada839e --- /dev/null +++ b/0x000b_integer-data-type/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "Pico", + "includePath": [ + "${workspaceFolder}/**", + "${env:PICO_SDK_PATH}/**" + ], + "defines": [], + "compilerPath": "${env:PICO_INSTALL_PATH}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc.exe", + "cStandard": "c11", + "cppStandard": "c++11", + "intelliSenseMode": "linux-gcc-arm", + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 +} diff --git a/0x000b_integer-data-type/.vscode/extensions.json b/0x000b_integer-data-type/.vscode/extensions.json new file mode 100644 index 0000000..03ba0af --- /dev/null +++ b/0x000b_integer-data-type/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "marus25.cortex-debug", + "ms-vscode.cmake-tools", + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "ms-vscode.vscode-serial-monitor" + ] +} diff --git a/0x000b_integer-data-type/.vscode/launch.json b/0x000b_integer-data-type/.vscode/launch.json new file mode 100644 index 0000000..2b22acf --- /dev/null +++ b/0x000b_integer-data-type/.vscode/launch.json @@ -0,0 +1,58 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Pico Debug (Cortex-Debug)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "openocd", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "configFiles": [ + "interface/cmsis-dap.cfg", + "target/rp2040.cfg" + ], + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main", + "openOCDLaunchCommands": [ + "adapter speed 1000" + ] + }, + { + "name": "Pico Debug (Cortex-Debug with external OpenOCD)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "external", + "gdbTarget": "localhost:3333", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main" + }, + { + "name": "Pico Debug (C++ Debugger)", + "type": "cppdbg", + "request": "launch", + "cwd": "${workspaceFolder}", + "program": "${command:cmake.launchTargetPath}", + "MIMode": "gdb", + "miDebuggerPath": "arm-none-eabi-gdb", + "miDebuggerServerAddress": "localhost:3333", + "debugServerPath": "openocd", + "debugServerArgs": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 1000\"", + "serverStarted": "Listening on port .* for gdb connections", + "filterStderr": true, + "stopAtEntry": true, + "hardwareBreakpoints": { + "require": true, + "limit": 4 + }, + "preLaunchTask": "Flash", + "svdPath": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd" + } + ] +} diff --git a/0x000b_integer-data-type/.vscode/settings.json b/0x000b_integer-data-type/.vscode/settings.json new file mode 100644 index 0000000..8ad90e8 --- /dev/null +++ b/0x000b_integer-data-type/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + // These settings tweaks to the cmake plugin will ensure + // that you debug using cortex-debug instead of trying to launch + // a Pico binary on the host + "cmake.statusbar.advanced": { + "debug": { + "visibility": "hidden" + }, + "launch": { + "visibility": "hidden" + }, + "build": { + "visibility": "hidden" + }, + "buildTarget": { + "visibility": "hidden" + } + }, + "cmake.buildBeforeRun": true, + "cmake.configureOnOpen": true, + "cmake.configureSettings": { + "CMAKE_MODULE_PATH": "${env:PICO_INSTALL_PATH}/pico-sdk-tools" + }, + "cmake.generator": "Ninja", + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", + "C_Cpp.errorSquiggles": "enabled", + "files.associations": { + "stdlib.h": "c" + } +} diff --git a/0x000b_integer-data-type/.vscode/tasks.json b/0x000b_integer-data-type/.vscode/tasks.json new file mode 100644 index 0000000..a437c2f --- /dev/null +++ b/0x000b_integer-data-type/.vscode/tasks.json @@ -0,0 +1,29 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Flash", + "type": "shell", + "command": "openocd", + "args": [ + "-f", + "interface/cmsis-dap.cfg", + "-f", + "target/rp2040.cfg", + "-c", + "adapter speed 1000; program {${command:cmake.launchTargetPath}} verify reset exit" + ], + "problemMatcher": [] + }, + { + "label": "Build", + "type": "cmake", + "command": "build", + "problemMatcher": "$gcc", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/0x000b_integer-data-type/CMakeLists.txt b/0x000b_integer-data-type/CMakeLists.txt index 051ea42..eee00f5 100644 --- a/0x000b_integer-data-type/CMakeLists.txt +++ b/0x000b_integer-data-type/CMakeLists.txt @@ -1,57 +1,21 @@ cmake_minimum_required(VERSION 3.13) -set(PICO_BOARD pico_w) - include(pico_sdk_import.cmake) - project(0x000b_integer-data-type C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) pico_sdk_init() -if (PICO_CYW43_SUPPORTED) # set by PICO_BOARD=pico_w - if (NOT TARGET pico_cyw43_arch) - message("Skipping Pico W examples as support is not available") - else() - - if (DEFINED ENV{WIFI_SSID} AND (NOT WIFI_SSID)) - set(WIFI_SSID $ENV{WIFI_SSID}) - message("Using WIFI_SSID from environment ('${WIFI_SSID}')") - endif() - - if (DEFINED ENV{WIFI_PASSWORD} AND (NOT WIFI_PASSWORD)) - set(WIFI_PASSWORD $ENV{WIFI_PASSWORD}) - message("Using WIFI_PASSWORD from environment") - endif() - - set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID for examples") - set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi password for examples") - endif() -endif() - -set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID") -set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi PASSWORD") - add_executable(0x000b_integer-data-type - main.c - ) -target_compile_definitions(0x000b_integer-data-type PRIVATE - WIFI_SSID=\"${WIFI_SSID}\" - WIFI_PASSWORD=\"${WIFI_PASSWORD}\" - ) -target_include_directories(0x000b_integer-data-type PRIVATE - ${CMAKE_CURRENT_LIST_DIR} - ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts - ) -target_link_libraries(0x000b_integer-data-type - pico_cyw43_arch_lwip_threadsafe_background - pico_lwip_mbedtls - pico_mbedtls - pico_stdlib - ) + main.c +) -pico_enable_stdio_usb(0x000b_integer-data-type 0) +pico_enable_stdio_usb(0x000b_integer-data-type 1) pico_enable_stdio_uart(0x000b_integer-data-type 1) pico_add_extra_outputs(0x000b_integer-data-type) + +target_link_libraries(0x000b_integer-data-type + pico_stdlib +) diff --git a/0x000b_integer-data-type/lwipopts.h b/0x000b_integer-data-type/lwipopts.h deleted file mode 100644 index b7f0386..0000000 --- a/0x000b_integer-data-type/lwipopts.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _LWIPOPTS_H -#define _LWIPOPTS_H - -#include "lwipopts_examples_common.h" - -/* TCP WND must be at least 16 kb to match TLS record size - or you will get a warning "altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!" */ -#undef TCP_WND -#define TCP_WND 16384 - -#define LWIP_ALTCP 1 -#define LWIP_ALTCP_TLS 1 -#define LWIP_ALTCP_TLS_MBEDTLS 1 - -#define LWIP_DEBUG 1 -#define ALTCP_MBEDTLS_DEBUG LWIP_DBG_ON - -#endif \ No newline at end of file diff --git a/0x000b_integer-data-type/lwipopts_examples_common.h b/0x000b_integer-data-type/lwipopts_examples_common.h deleted file mode 100644 index d6a2d02..0000000 --- a/0x000b_integer-data-type/lwipopts_examples_common.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef _LWIPOPTS_EXAMPLE_COMMONH_H -#define _LWIPOPTS_EXAMPLE_COMMONH_H - -// Common settings used in most of the pico_w examples -// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details) - -// allow override in some examples -#ifndef NO_SYS -#define NO_SYS 1 -#endif -// allow override in some examples -#ifndef LWIP_SOCKET -#define LWIP_SOCKET 0 -#endif -#if PICO_CYW43_ARCH_POLL -#define MEM_LIBC_MALLOC 1 -#else -// MEM_LIBC_MALLOC is incompatible with non polling versions -#define MEM_LIBC_MALLOC 0 -#endif -#define MEM_ALIGNMENT 4 -#define MEM_SIZE 4000 -#define MEMP_NUM_TCP_SEG 32 -#define MEMP_NUM_ARP_QUEUE 10 -#define PBUF_POOL_SIZE 24 -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_ICMP 1 -#define LWIP_RAW 1 -#define TCP_WND (8 * TCP_MSS) -#define TCP_MSS 1460 -#define TCP_SND_BUF (8 * TCP_MSS) -#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS)) -#define LWIP_NETIF_STATUS_CALLBACK 1 -#define LWIP_NETIF_LINK_CALLBACK 1 -#define LWIP_NETIF_HOSTNAME 1 -#define LWIP_NETCONN 0 -#define MEM_STATS 0 -#define SYS_STATS 0 -#define MEMP_STATS 0 -#define LINK_STATS 0 -// #define ETH_PAD_SIZE 2 -#define LWIP_CHKSUM_ALGORITHM 3 -#define LWIP_DHCP 1 -#define LWIP_IPV4 1 -#define LWIP_TCP 1 -#define LWIP_UDP 1 -#define LWIP_DNS 1 -#define LWIP_TCP_KEEPALIVE 1 -#define LWIP_NETIF_TX_SINGLE_PBUF 1 -#define DHCP_DOES_ARP_CHECK 0 -#define LWIP_DHCP_DOES_ACD_CHECK 0 - -#ifndef NDEBUG -#define LWIP_DEBUG 1 -#define LWIP_STATS 1 -#define LWIP_STATS_DISPLAY 1 -#endif - -#define ETHARP_DEBUG LWIP_DBG_OFF -#define NETIF_DEBUG LWIP_DBG_OFF -#define PBUF_DEBUG LWIP_DBG_OFF -#define API_LIB_DEBUG LWIP_DBG_OFF -#define API_MSG_DEBUG LWIP_DBG_OFF -#define SOCKETS_DEBUG LWIP_DBG_OFF -#define ICMP_DEBUG LWIP_DBG_OFF -#define INET_DEBUG LWIP_DBG_OFF -#define IP_DEBUG LWIP_DBG_OFF -#define IP_REASS_DEBUG LWIP_DBG_OFF -#define RAW_DEBUG LWIP_DBG_OFF -#define MEM_DEBUG LWIP_DBG_OFF -#define MEMP_DEBUG LWIP_DBG_OFF -#define SYS_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF -#define TCP_INPUT_DEBUG LWIP_DBG_OFF -#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF -#define TCP_RTO_DEBUG LWIP_DBG_OFF -#define TCP_CWND_DEBUG LWIP_DBG_OFF -#define TCP_WND_DEBUG LWIP_DBG_OFF -#define TCP_FR_DEBUG LWIP_DBG_OFF -#define TCP_QLEN_DEBUG LWIP_DBG_OFF -#define TCP_RST_DEBUG LWIP_DBG_OFF -#define UDP_DEBUG LWIP_DBG_OFF -#define TCPIP_DEBUG LWIP_DBG_OFF -#define PPP_DEBUG LWIP_DBG_OFF -#define SLIP_DEBUG LWIP_DBG_OFF -#define DHCP_DEBUG LWIP_DBG_OFF - -#endif /* __LWIPOPTS_H__ */ \ No newline at end of file diff --git a/0x000b_integer-data-type/main.c b/0x000b_integer-data-type/main.c index bad33ab..4019944 100644 --- a/0x000b_integer-data-type/main.c +++ b/0x000b_integer-data-type/main.c @@ -1,9 +1,7 @@ #include #include "pico/stdlib.h" -#include "pico/cyw43_arch.h" -int main(void) -{ +int main(void) { uint8_t age = 0; int8_t range = 0; @@ -12,8 +10,7 @@ int main(void) stdio_init_all(); - while (true) - { + while (true) { printf("age: %d\r\n", age); printf("range: %d\r\n", range); } diff --git a/0x000b_integer-data-type/mbedtls_config.h b/0x000b_integer-data-type/mbedtls_config.h deleted file mode 100644 index 83c9f48..0000000 --- a/0x000b_integer-data-type/mbedtls_config.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Workaround for some mbedtls source files using INT_MAX without including limits.h */ -#include - -#define MBEDTLS_NO_PLATFORM_ENTROPY -#define MBEDTLS_ENTROPY_HARDWARE_ALT - -#define MBEDTLS_SSL_OUT_CONTENT_LEN 2048 - -#define MBEDTLS_ALLOW_PRIVATE_ACCESS -#define MBEDTLS_HAVE_TIME - -#define MBEDTLS_CIPHER_MODE_CBC -#define MBEDTLS_ECP_DP_SECP192R1_ENABLED -#define MBEDTLS_ECP_DP_SECP224R1_ENABLED -#define MBEDTLS_ECP_DP_SECP256R1_ENABLED -#define MBEDTLS_ECP_DP_SECP384R1_ENABLED -#define MBEDTLS_ECP_DP_SECP521R1_ENABLED -#define MBEDTLS_ECP_DP_SECP192K1_ENABLED -#define MBEDTLS_ECP_DP_SECP224K1_ENABLED -#define MBEDTLS_ECP_DP_SECP256K1_ENABLED -#define MBEDTLS_ECP_DP_BP256R1_ENABLED -#define MBEDTLS_ECP_DP_BP384R1_ENABLED -#define MBEDTLS_ECP_DP_BP512R1_ENABLED -#define MBEDTLS_ECP_DP_CURVE25519_ENABLED -#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED -#define MBEDTLS_PKCS1_V15 -#define MBEDTLS_SHA256_SMALLER -#define MBEDTLS_SSL_SERVER_NAME_INDICATION -#define MBEDTLS_AES_C -#define MBEDTLS_ASN1_PARSE_C -#define MBEDTLS_BIGNUM_C -#define MBEDTLS_CIPHER_C -#define MBEDTLS_CTR_DRBG_C -#define MBEDTLS_ENTROPY_C -#define MBEDTLS_ERROR_C -#define MBEDTLS_MD_C -#define MBEDTLS_MD5_C -#define MBEDTLS_OID_C -#define MBEDTLS_PKCS5_C -#define MBEDTLS_PK_C -#define MBEDTLS_PK_PARSE_C -#define MBEDTLS_PLATFORM_C -#define MBEDTLS_RSA_C -#define MBEDTLS_SHA1_C -#define MBEDTLS_SHA224_C -#define MBEDTLS_SHA256_C -#define MBEDTLS_SHA512_C -#define MBEDTLS_SSL_CLI_C -#define MBEDTLS_SSL_SRV_C -#define MBEDTLS_SSL_TLS_C -#define MBEDTLS_X509_CRT_PARSE_C -#define MBEDTLS_X509_USE_C -#define MBEDTLS_AES_FEWER_TABLES - -/* TLS 1.2 */ -#define MBEDTLS_SSL_PROTO_TLS1_2 -#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED -#define MBEDTLS_GCM_C -#define MBEDTLS_ECDH_C -#define MBEDTLS_ECP_C -#define MBEDTLS_ECDSA_C -#define MBEDTLS_ASN1_WRITE_C \ No newline at end of file diff --git a/0x000e_floating-point-data-type/.gitignore b/0x000e_floating-point-data-type/.gitignore index 6aa60eb..149d92e 100644 --- a/0x000e_floating-point-data-type/.gitignore +++ b/0x000e_floating-point-data-type/.gitignore @@ -1,7 +1,5 @@ .idea -.vscode _deps cmake-* build .DS_Store -*.pdf diff --git a/0x000e_floating-point-data-type/.vscode/.cortex-debug.peripherals.state.json b/0x000e_floating-point-data-type/.vscode/.cortex-debug.peripherals.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x000e_floating-point-data-type/.vscode/.cortex-debug.peripherals.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x000e_floating-point-data-type/.vscode/.cortex-debug.registers.state.json b/0x000e_floating-point-data-type/.vscode/.cortex-debug.registers.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x000e_floating-point-data-type/.vscode/.cortex-debug.registers.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x000e_floating-point-data-type/.vscode/c_cpp_properties.json b/0x000e_floating-point-data-type/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..ada839e --- /dev/null +++ b/0x000e_floating-point-data-type/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "Pico", + "includePath": [ + "${workspaceFolder}/**", + "${env:PICO_SDK_PATH}/**" + ], + "defines": [], + "compilerPath": "${env:PICO_INSTALL_PATH}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc.exe", + "cStandard": "c11", + "cppStandard": "c++11", + "intelliSenseMode": "linux-gcc-arm", + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 +} diff --git a/0x000e_floating-point-data-type/.vscode/extensions.json b/0x000e_floating-point-data-type/.vscode/extensions.json new file mode 100644 index 0000000..03ba0af --- /dev/null +++ b/0x000e_floating-point-data-type/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "marus25.cortex-debug", + "ms-vscode.cmake-tools", + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "ms-vscode.vscode-serial-monitor" + ] +} diff --git a/0x000e_floating-point-data-type/.vscode/launch.json b/0x000e_floating-point-data-type/.vscode/launch.json new file mode 100644 index 0000000..2b22acf --- /dev/null +++ b/0x000e_floating-point-data-type/.vscode/launch.json @@ -0,0 +1,58 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Pico Debug (Cortex-Debug)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "openocd", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "configFiles": [ + "interface/cmsis-dap.cfg", + "target/rp2040.cfg" + ], + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main", + "openOCDLaunchCommands": [ + "adapter speed 1000" + ] + }, + { + "name": "Pico Debug (Cortex-Debug with external OpenOCD)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "external", + "gdbTarget": "localhost:3333", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main" + }, + { + "name": "Pico Debug (C++ Debugger)", + "type": "cppdbg", + "request": "launch", + "cwd": "${workspaceFolder}", + "program": "${command:cmake.launchTargetPath}", + "MIMode": "gdb", + "miDebuggerPath": "arm-none-eabi-gdb", + "miDebuggerServerAddress": "localhost:3333", + "debugServerPath": "openocd", + "debugServerArgs": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 1000\"", + "serverStarted": "Listening on port .* for gdb connections", + "filterStderr": true, + "stopAtEntry": true, + "hardwareBreakpoints": { + "require": true, + "limit": 4 + }, + "preLaunchTask": "Flash", + "svdPath": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd" + } + ] +} diff --git a/0x000e_floating-point-data-type/.vscode/settings.json b/0x000e_floating-point-data-type/.vscode/settings.json new file mode 100644 index 0000000..8ad90e8 --- /dev/null +++ b/0x000e_floating-point-data-type/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + // These settings tweaks to the cmake plugin will ensure + // that you debug using cortex-debug instead of trying to launch + // a Pico binary on the host + "cmake.statusbar.advanced": { + "debug": { + "visibility": "hidden" + }, + "launch": { + "visibility": "hidden" + }, + "build": { + "visibility": "hidden" + }, + "buildTarget": { + "visibility": "hidden" + } + }, + "cmake.buildBeforeRun": true, + "cmake.configureOnOpen": true, + "cmake.configureSettings": { + "CMAKE_MODULE_PATH": "${env:PICO_INSTALL_PATH}/pico-sdk-tools" + }, + "cmake.generator": "Ninja", + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", + "C_Cpp.errorSquiggles": "enabled", + "files.associations": { + "stdlib.h": "c" + } +} diff --git a/0x000e_floating-point-data-type/.vscode/tasks.json b/0x000e_floating-point-data-type/.vscode/tasks.json new file mode 100644 index 0000000..a437c2f --- /dev/null +++ b/0x000e_floating-point-data-type/.vscode/tasks.json @@ -0,0 +1,29 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Flash", + "type": "shell", + "command": "openocd", + "args": [ + "-f", + "interface/cmsis-dap.cfg", + "-f", + "target/rp2040.cfg", + "-c", + "adapter speed 1000; program {${command:cmake.launchTargetPath}} verify reset exit" + ], + "problemMatcher": [] + }, + { + "label": "Build", + "type": "cmake", + "command": "build", + "problemMatcher": "$gcc", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/0x000e_floating-point-data-type/CMakeLists.txt b/0x000e_floating-point-data-type/CMakeLists.txt index d760112..6911110 100644 --- a/0x000e_floating-point-data-type/CMakeLists.txt +++ b/0x000e_floating-point-data-type/CMakeLists.txt @@ -1,57 +1,21 @@ cmake_minimum_required(VERSION 3.13) -set(PICO_BOARD pico_w) - include(pico_sdk_import.cmake) - project(0x000e_floating-point-data-type C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) pico_sdk_init() -if (PICO_CYW43_SUPPORTED) # set by PICO_BOARD=pico_w - if (NOT TARGET pico_cyw43_arch) - message("Skipping Pico W examples as support is not available") - else() - - if (DEFINED ENV{WIFI_SSID} AND (NOT WIFI_SSID)) - set(WIFI_SSID $ENV{WIFI_SSID}) - message("Using WIFI_SSID from environment ('${WIFI_SSID}')") - endif() - - if (DEFINED ENV{WIFI_PASSWORD} AND (NOT WIFI_PASSWORD)) - set(WIFI_PASSWORD $ENV{WIFI_PASSWORD}) - message("Using WIFI_PASSWORD from environment") - endif() - - set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID for examples") - set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi password for examples") - endif() -endif() - -set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID") -set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi PASSWORD") - add_executable(0x000e_floating-point-data-type - main.c - ) -target_compile_definitions(0x000e_floating-point-data-type PRIVATE - WIFI_SSID=\"${WIFI_SSID}\" - WIFI_PASSWORD=\"${WIFI_PASSWORD}\" - ) -target_include_directories(0x000e_floating-point-data-type PRIVATE - ${CMAKE_CURRENT_LIST_DIR} - ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts - ) -target_link_libraries(0x000e_floating-point-data-type - pico_cyw43_arch_lwip_threadsafe_background - pico_lwip_mbedtls - pico_mbedtls - pico_stdlib - ) + main.c +) -pico_enable_stdio_usb(0x000e_floating-point-data-type 0) +pico_enable_stdio_usb(0x000e_floating-point-data-type 1) pico_enable_stdio_uart(0x000e_floating-point-data-type 1) pico_add_extra_outputs(0x000e_floating-point-data-type) + +target_link_libraries(0x000e_floating-point-data-type + pico_stdlib +) diff --git a/0x000e_floating-point-data-type/lwipopts.h b/0x000e_floating-point-data-type/lwipopts.h deleted file mode 100644 index b7f0386..0000000 --- a/0x000e_floating-point-data-type/lwipopts.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _LWIPOPTS_H -#define _LWIPOPTS_H - -#include "lwipopts_examples_common.h" - -/* TCP WND must be at least 16 kb to match TLS record size - or you will get a warning "altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!" */ -#undef TCP_WND -#define TCP_WND 16384 - -#define LWIP_ALTCP 1 -#define LWIP_ALTCP_TLS 1 -#define LWIP_ALTCP_TLS_MBEDTLS 1 - -#define LWIP_DEBUG 1 -#define ALTCP_MBEDTLS_DEBUG LWIP_DBG_ON - -#endif \ No newline at end of file diff --git a/0x000e_floating-point-data-type/lwipopts_examples_common.h b/0x000e_floating-point-data-type/lwipopts_examples_common.h deleted file mode 100644 index d6a2d02..0000000 --- a/0x000e_floating-point-data-type/lwipopts_examples_common.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef _LWIPOPTS_EXAMPLE_COMMONH_H -#define _LWIPOPTS_EXAMPLE_COMMONH_H - -// Common settings used in most of the pico_w examples -// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details) - -// allow override in some examples -#ifndef NO_SYS -#define NO_SYS 1 -#endif -// allow override in some examples -#ifndef LWIP_SOCKET -#define LWIP_SOCKET 0 -#endif -#if PICO_CYW43_ARCH_POLL -#define MEM_LIBC_MALLOC 1 -#else -// MEM_LIBC_MALLOC is incompatible with non polling versions -#define MEM_LIBC_MALLOC 0 -#endif -#define MEM_ALIGNMENT 4 -#define MEM_SIZE 4000 -#define MEMP_NUM_TCP_SEG 32 -#define MEMP_NUM_ARP_QUEUE 10 -#define PBUF_POOL_SIZE 24 -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_ICMP 1 -#define LWIP_RAW 1 -#define TCP_WND (8 * TCP_MSS) -#define TCP_MSS 1460 -#define TCP_SND_BUF (8 * TCP_MSS) -#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS)) -#define LWIP_NETIF_STATUS_CALLBACK 1 -#define LWIP_NETIF_LINK_CALLBACK 1 -#define LWIP_NETIF_HOSTNAME 1 -#define LWIP_NETCONN 0 -#define MEM_STATS 0 -#define SYS_STATS 0 -#define MEMP_STATS 0 -#define LINK_STATS 0 -// #define ETH_PAD_SIZE 2 -#define LWIP_CHKSUM_ALGORITHM 3 -#define LWIP_DHCP 1 -#define LWIP_IPV4 1 -#define LWIP_TCP 1 -#define LWIP_UDP 1 -#define LWIP_DNS 1 -#define LWIP_TCP_KEEPALIVE 1 -#define LWIP_NETIF_TX_SINGLE_PBUF 1 -#define DHCP_DOES_ARP_CHECK 0 -#define LWIP_DHCP_DOES_ACD_CHECK 0 - -#ifndef NDEBUG -#define LWIP_DEBUG 1 -#define LWIP_STATS 1 -#define LWIP_STATS_DISPLAY 1 -#endif - -#define ETHARP_DEBUG LWIP_DBG_OFF -#define NETIF_DEBUG LWIP_DBG_OFF -#define PBUF_DEBUG LWIP_DBG_OFF -#define API_LIB_DEBUG LWIP_DBG_OFF -#define API_MSG_DEBUG LWIP_DBG_OFF -#define SOCKETS_DEBUG LWIP_DBG_OFF -#define ICMP_DEBUG LWIP_DBG_OFF -#define INET_DEBUG LWIP_DBG_OFF -#define IP_DEBUG LWIP_DBG_OFF -#define IP_REASS_DEBUG LWIP_DBG_OFF -#define RAW_DEBUG LWIP_DBG_OFF -#define MEM_DEBUG LWIP_DBG_OFF -#define MEMP_DEBUG LWIP_DBG_OFF -#define SYS_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF -#define TCP_INPUT_DEBUG LWIP_DBG_OFF -#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF -#define TCP_RTO_DEBUG LWIP_DBG_OFF -#define TCP_CWND_DEBUG LWIP_DBG_OFF -#define TCP_WND_DEBUG LWIP_DBG_OFF -#define TCP_FR_DEBUG LWIP_DBG_OFF -#define TCP_QLEN_DEBUG LWIP_DBG_OFF -#define TCP_RST_DEBUG LWIP_DBG_OFF -#define UDP_DEBUG LWIP_DBG_OFF -#define TCPIP_DEBUG LWIP_DBG_OFF -#define PPP_DEBUG LWIP_DBG_OFF -#define SLIP_DEBUG LWIP_DBG_OFF -#define DHCP_DEBUG LWIP_DBG_OFF - -#endif /* __LWIPOPTS_H__ */ \ No newline at end of file diff --git a/0x000e_floating-point-data-type/main.c b/0x000e_floating-point-data-type/main.c index 5415d11..fb3d382 100644 --- a/0x000e_floating-point-data-type/main.c +++ b/0x000e_floating-point-data-type/main.c @@ -1,15 +1,11 @@ #include #include "pico/stdlib.h" -#include "pico/cyw43_arch.h" -int main(void) -{ +int main(void) { float fav_num = 42.5; stdio_init_all(); while (true) - { printf("fav_num: %f\r\n", fav_num); - } } diff --git a/0x000e_floating-point-data-type/mbedtls_config.h b/0x000e_floating-point-data-type/mbedtls_config.h deleted file mode 100644 index 83c9f48..0000000 --- a/0x000e_floating-point-data-type/mbedtls_config.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Workaround for some mbedtls source files using INT_MAX without including limits.h */ -#include - -#define MBEDTLS_NO_PLATFORM_ENTROPY -#define MBEDTLS_ENTROPY_HARDWARE_ALT - -#define MBEDTLS_SSL_OUT_CONTENT_LEN 2048 - -#define MBEDTLS_ALLOW_PRIVATE_ACCESS -#define MBEDTLS_HAVE_TIME - -#define MBEDTLS_CIPHER_MODE_CBC -#define MBEDTLS_ECP_DP_SECP192R1_ENABLED -#define MBEDTLS_ECP_DP_SECP224R1_ENABLED -#define MBEDTLS_ECP_DP_SECP256R1_ENABLED -#define MBEDTLS_ECP_DP_SECP384R1_ENABLED -#define MBEDTLS_ECP_DP_SECP521R1_ENABLED -#define MBEDTLS_ECP_DP_SECP192K1_ENABLED -#define MBEDTLS_ECP_DP_SECP224K1_ENABLED -#define MBEDTLS_ECP_DP_SECP256K1_ENABLED -#define MBEDTLS_ECP_DP_BP256R1_ENABLED -#define MBEDTLS_ECP_DP_BP384R1_ENABLED -#define MBEDTLS_ECP_DP_BP512R1_ENABLED -#define MBEDTLS_ECP_DP_CURVE25519_ENABLED -#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED -#define MBEDTLS_PKCS1_V15 -#define MBEDTLS_SHA256_SMALLER -#define MBEDTLS_SSL_SERVER_NAME_INDICATION -#define MBEDTLS_AES_C -#define MBEDTLS_ASN1_PARSE_C -#define MBEDTLS_BIGNUM_C -#define MBEDTLS_CIPHER_C -#define MBEDTLS_CTR_DRBG_C -#define MBEDTLS_ENTROPY_C -#define MBEDTLS_ERROR_C -#define MBEDTLS_MD_C -#define MBEDTLS_MD5_C -#define MBEDTLS_OID_C -#define MBEDTLS_PKCS5_C -#define MBEDTLS_PK_C -#define MBEDTLS_PK_PARSE_C -#define MBEDTLS_PLATFORM_C -#define MBEDTLS_RSA_C -#define MBEDTLS_SHA1_C -#define MBEDTLS_SHA224_C -#define MBEDTLS_SHA256_C -#define MBEDTLS_SHA512_C -#define MBEDTLS_SSL_CLI_C -#define MBEDTLS_SSL_SRV_C -#define MBEDTLS_SSL_TLS_C -#define MBEDTLS_X509_CRT_PARSE_C -#define MBEDTLS_X509_USE_C -#define MBEDTLS_AES_FEWER_TABLES - -/* TLS 1.2 */ -#define MBEDTLS_SSL_PROTO_TLS1_2 -#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED -#define MBEDTLS_GCM_C -#define MBEDTLS_ECDH_C -#define MBEDTLS_ECP_C -#define MBEDTLS_ECDSA_C -#define MBEDTLS_ASN1_WRITE_C \ No newline at end of file diff --git a/0x0011_double-floating-point-data-type/.gitignore b/0x0011_double-floating-point-data-type/.gitignore index 6aa60eb..149d92e 100644 --- a/0x0011_double-floating-point-data-type/.gitignore +++ b/0x0011_double-floating-point-data-type/.gitignore @@ -1,7 +1,5 @@ .idea -.vscode _deps cmake-* build .DS_Store -*.pdf diff --git a/0x0011_double-floating-point-data-type/.vscode/.cortex-debug.peripherals.state.json b/0x0011_double-floating-point-data-type/.vscode/.cortex-debug.peripherals.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x0011_double-floating-point-data-type/.vscode/.cortex-debug.peripherals.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x0011_double-floating-point-data-type/.vscode/.cortex-debug.registers.state.json b/0x0011_double-floating-point-data-type/.vscode/.cortex-debug.registers.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x0011_double-floating-point-data-type/.vscode/.cortex-debug.registers.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x0011_double-floating-point-data-type/.vscode/c_cpp_properties.json b/0x0011_double-floating-point-data-type/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..ada839e --- /dev/null +++ b/0x0011_double-floating-point-data-type/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "Pico", + "includePath": [ + "${workspaceFolder}/**", + "${env:PICO_SDK_PATH}/**" + ], + "defines": [], + "compilerPath": "${env:PICO_INSTALL_PATH}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc.exe", + "cStandard": "c11", + "cppStandard": "c++11", + "intelliSenseMode": "linux-gcc-arm", + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 +} diff --git a/0x0011_double-floating-point-data-type/.vscode/extensions.json b/0x0011_double-floating-point-data-type/.vscode/extensions.json new file mode 100644 index 0000000..03ba0af --- /dev/null +++ b/0x0011_double-floating-point-data-type/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "marus25.cortex-debug", + "ms-vscode.cmake-tools", + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "ms-vscode.vscode-serial-monitor" + ] +} diff --git a/0x0011_double-floating-point-data-type/.vscode/launch.json b/0x0011_double-floating-point-data-type/.vscode/launch.json new file mode 100644 index 0000000..2b22acf --- /dev/null +++ b/0x0011_double-floating-point-data-type/.vscode/launch.json @@ -0,0 +1,58 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Pico Debug (Cortex-Debug)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "openocd", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "configFiles": [ + "interface/cmsis-dap.cfg", + "target/rp2040.cfg" + ], + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main", + "openOCDLaunchCommands": [ + "adapter speed 1000" + ] + }, + { + "name": "Pico Debug (Cortex-Debug with external OpenOCD)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "external", + "gdbTarget": "localhost:3333", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main" + }, + { + "name": "Pico Debug (C++ Debugger)", + "type": "cppdbg", + "request": "launch", + "cwd": "${workspaceFolder}", + "program": "${command:cmake.launchTargetPath}", + "MIMode": "gdb", + "miDebuggerPath": "arm-none-eabi-gdb", + "miDebuggerServerAddress": "localhost:3333", + "debugServerPath": "openocd", + "debugServerArgs": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 1000\"", + "serverStarted": "Listening on port .* for gdb connections", + "filterStderr": true, + "stopAtEntry": true, + "hardwareBreakpoints": { + "require": true, + "limit": 4 + }, + "preLaunchTask": "Flash", + "svdPath": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd" + } + ] +} diff --git a/0x0011_double-floating-point-data-type/.vscode/settings.json b/0x0011_double-floating-point-data-type/.vscode/settings.json new file mode 100644 index 0000000..8ad90e8 --- /dev/null +++ b/0x0011_double-floating-point-data-type/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + // These settings tweaks to the cmake plugin will ensure + // that you debug using cortex-debug instead of trying to launch + // a Pico binary on the host + "cmake.statusbar.advanced": { + "debug": { + "visibility": "hidden" + }, + "launch": { + "visibility": "hidden" + }, + "build": { + "visibility": "hidden" + }, + "buildTarget": { + "visibility": "hidden" + } + }, + "cmake.buildBeforeRun": true, + "cmake.configureOnOpen": true, + "cmake.configureSettings": { + "CMAKE_MODULE_PATH": "${env:PICO_INSTALL_PATH}/pico-sdk-tools" + }, + "cmake.generator": "Ninja", + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", + "C_Cpp.errorSquiggles": "enabled", + "files.associations": { + "stdlib.h": "c" + } +} diff --git a/0x0011_double-floating-point-data-type/.vscode/tasks.json b/0x0011_double-floating-point-data-type/.vscode/tasks.json new file mode 100644 index 0000000..a437c2f --- /dev/null +++ b/0x0011_double-floating-point-data-type/.vscode/tasks.json @@ -0,0 +1,29 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Flash", + "type": "shell", + "command": "openocd", + "args": [ + "-f", + "interface/cmsis-dap.cfg", + "-f", + "target/rp2040.cfg", + "-c", + "adapter speed 1000; program {${command:cmake.launchTargetPath}} verify reset exit" + ], + "problemMatcher": [] + }, + { + "label": "Build", + "type": "cmake", + "command": "build", + "problemMatcher": "$gcc", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/0x0011_double-floating-point-data-type/CMakeLists.txt b/0x0011_double-floating-point-data-type/CMakeLists.txt index f866a9b..e6cd72a 100644 --- a/0x0011_double-floating-point-data-type/CMakeLists.txt +++ b/0x0011_double-floating-point-data-type/CMakeLists.txt @@ -1,57 +1,21 @@ cmake_minimum_required(VERSION 3.13) -set(PICO_BOARD pico_w) - include(pico_sdk_import.cmake) - project(0x0011_double-floating-point-data-type C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) pico_sdk_init() -if (PICO_CYW43_SUPPORTED) # set by PICO_BOARD=pico_w - if (NOT TARGET pico_cyw43_arch) - message("Skipping Pico W examples as support is not available") - else() - - if (DEFINED ENV{WIFI_SSID} AND (NOT WIFI_SSID)) - set(WIFI_SSID $ENV{WIFI_SSID}) - message("Using WIFI_SSID from environment ('${WIFI_SSID}')") - endif() - - if (DEFINED ENV{WIFI_PASSWORD} AND (NOT WIFI_PASSWORD)) - set(WIFI_PASSWORD $ENV{WIFI_PASSWORD}) - message("Using WIFI_PASSWORD from environment") - endif() - - set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID for examples") - set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi password for examples") - endif() -endif() - -set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID") -set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi PASSWORD") - add_executable(0x0011_double-floating-point-data-type - main.c - ) -target_compile_definitions(0x0011_double-floating-point-data-type PRIVATE - WIFI_SSID=\"${WIFI_SSID}\" - WIFI_PASSWORD=\"${WIFI_PASSWORD}\" - ) -target_include_directories(0x0011_double-floating-point-data-type PRIVATE - ${CMAKE_CURRENT_LIST_DIR} - ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts - ) -target_link_libraries(0x0011_double-floating-point-data-type - pico_cyw43_arch_lwip_threadsafe_background - pico_lwip_mbedtls - pico_mbedtls - pico_stdlib - ) + main.c +) -pico_enable_stdio_usb(0x0011_double-floating-point-data-type 0) +pico_enable_stdio_usb(0x0011_double-floating-point-data-type 1) pico_enable_stdio_uart(0x0011_double-floating-point-data-type 1) pico_add_extra_outputs(0x0011_double-floating-point-data-type) + +target_link_libraries(0x0011_double-floating-point-data-type + pico_stdlib +) diff --git a/0x0011_double-floating-point-data-type/lwipopts.h b/0x0011_double-floating-point-data-type/lwipopts.h deleted file mode 100644 index b7f0386..0000000 --- a/0x0011_double-floating-point-data-type/lwipopts.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _LWIPOPTS_H -#define _LWIPOPTS_H - -#include "lwipopts_examples_common.h" - -/* TCP WND must be at least 16 kb to match TLS record size - or you will get a warning "altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!" */ -#undef TCP_WND -#define TCP_WND 16384 - -#define LWIP_ALTCP 1 -#define LWIP_ALTCP_TLS 1 -#define LWIP_ALTCP_TLS_MBEDTLS 1 - -#define LWIP_DEBUG 1 -#define ALTCP_MBEDTLS_DEBUG LWIP_DBG_ON - -#endif \ No newline at end of file diff --git a/0x0011_double-floating-point-data-type/lwipopts_examples_common.h b/0x0011_double-floating-point-data-type/lwipopts_examples_common.h deleted file mode 100644 index d6a2d02..0000000 --- a/0x0011_double-floating-point-data-type/lwipopts_examples_common.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef _LWIPOPTS_EXAMPLE_COMMONH_H -#define _LWIPOPTS_EXAMPLE_COMMONH_H - -// Common settings used in most of the pico_w examples -// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details) - -// allow override in some examples -#ifndef NO_SYS -#define NO_SYS 1 -#endif -// allow override in some examples -#ifndef LWIP_SOCKET -#define LWIP_SOCKET 0 -#endif -#if PICO_CYW43_ARCH_POLL -#define MEM_LIBC_MALLOC 1 -#else -// MEM_LIBC_MALLOC is incompatible with non polling versions -#define MEM_LIBC_MALLOC 0 -#endif -#define MEM_ALIGNMENT 4 -#define MEM_SIZE 4000 -#define MEMP_NUM_TCP_SEG 32 -#define MEMP_NUM_ARP_QUEUE 10 -#define PBUF_POOL_SIZE 24 -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_ICMP 1 -#define LWIP_RAW 1 -#define TCP_WND (8 * TCP_MSS) -#define TCP_MSS 1460 -#define TCP_SND_BUF (8 * TCP_MSS) -#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS)) -#define LWIP_NETIF_STATUS_CALLBACK 1 -#define LWIP_NETIF_LINK_CALLBACK 1 -#define LWIP_NETIF_HOSTNAME 1 -#define LWIP_NETCONN 0 -#define MEM_STATS 0 -#define SYS_STATS 0 -#define MEMP_STATS 0 -#define LINK_STATS 0 -// #define ETH_PAD_SIZE 2 -#define LWIP_CHKSUM_ALGORITHM 3 -#define LWIP_DHCP 1 -#define LWIP_IPV4 1 -#define LWIP_TCP 1 -#define LWIP_UDP 1 -#define LWIP_DNS 1 -#define LWIP_TCP_KEEPALIVE 1 -#define LWIP_NETIF_TX_SINGLE_PBUF 1 -#define DHCP_DOES_ARP_CHECK 0 -#define LWIP_DHCP_DOES_ACD_CHECK 0 - -#ifndef NDEBUG -#define LWIP_DEBUG 1 -#define LWIP_STATS 1 -#define LWIP_STATS_DISPLAY 1 -#endif - -#define ETHARP_DEBUG LWIP_DBG_OFF -#define NETIF_DEBUG LWIP_DBG_OFF -#define PBUF_DEBUG LWIP_DBG_OFF -#define API_LIB_DEBUG LWIP_DBG_OFF -#define API_MSG_DEBUG LWIP_DBG_OFF -#define SOCKETS_DEBUG LWIP_DBG_OFF -#define ICMP_DEBUG LWIP_DBG_OFF -#define INET_DEBUG LWIP_DBG_OFF -#define IP_DEBUG LWIP_DBG_OFF -#define IP_REASS_DEBUG LWIP_DBG_OFF -#define RAW_DEBUG LWIP_DBG_OFF -#define MEM_DEBUG LWIP_DBG_OFF -#define MEMP_DEBUG LWIP_DBG_OFF -#define SYS_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF -#define TCP_INPUT_DEBUG LWIP_DBG_OFF -#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF -#define TCP_RTO_DEBUG LWIP_DBG_OFF -#define TCP_CWND_DEBUG LWIP_DBG_OFF -#define TCP_WND_DEBUG LWIP_DBG_OFF -#define TCP_FR_DEBUG LWIP_DBG_OFF -#define TCP_QLEN_DEBUG LWIP_DBG_OFF -#define TCP_RST_DEBUG LWIP_DBG_OFF -#define UDP_DEBUG LWIP_DBG_OFF -#define TCPIP_DEBUG LWIP_DBG_OFF -#define PPP_DEBUG LWIP_DBG_OFF -#define SLIP_DEBUG LWIP_DBG_OFF -#define DHCP_DEBUG LWIP_DBG_OFF - -#endif /* __LWIPOPTS_H__ */ \ No newline at end of file diff --git a/0x0011_double-floating-point-data-type/main.c b/0x0011_double-floating-point-data-type/main.c index a27785d..d4f3d11 100644 --- a/0x0011_double-floating-point-data-type/main.c +++ b/0x0011_double-floating-point-data-type/main.c @@ -1,15 +1,11 @@ #include #include "pico/stdlib.h" -#include "pico/cyw43_arch.h" -int main(void) -{ +int main(void) { double fav_num = 42.52525; stdio_init_all(); while (true) - { printf("fav_num: %lf\r\n", fav_num); - } } diff --git a/0x0011_double-floating-point-data-type/mbedtls_config.h b/0x0011_double-floating-point-data-type/mbedtls_config.h deleted file mode 100644 index 83c9f48..0000000 --- a/0x0011_double-floating-point-data-type/mbedtls_config.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Workaround for some mbedtls source files using INT_MAX without including limits.h */ -#include - -#define MBEDTLS_NO_PLATFORM_ENTROPY -#define MBEDTLS_ENTROPY_HARDWARE_ALT - -#define MBEDTLS_SSL_OUT_CONTENT_LEN 2048 - -#define MBEDTLS_ALLOW_PRIVATE_ACCESS -#define MBEDTLS_HAVE_TIME - -#define MBEDTLS_CIPHER_MODE_CBC -#define MBEDTLS_ECP_DP_SECP192R1_ENABLED -#define MBEDTLS_ECP_DP_SECP224R1_ENABLED -#define MBEDTLS_ECP_DP_SECP256R1_ENABLED -#define MBEDTLS_ECP_DP_SECP384R1_ENABLED -#define MBEDTLS_ECP_DP_SECP521R1_ENABLED -#define MBEDTLS_ECP_DP_SECP192K1_ENABLED -#define MBEDTLS_ECP_DP_SECP224K1_ENABLED -#define MBEDTLS_ECP_DP_SECP256K1_ENABLED -#define MBEDTLS_ECP_DP_BP256R1_ENABLED -#define MBEDTLS_ECP_DP_BP384R1_ENABLED -#define MBEDTLS_ECP_DP_BP512R1_ENABLED -#define MBEDTLS_ECP_DP_CURVE25519_ENABLED -#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED -#define MBEDTLS_PKCS1_V15 -#define MBEDTLS_SHA256_SMALLER -#define MBEDTLS_SSL_SERVER_NAME_INDICATION -#define MBEDTLS_AES_C -#define MBEDTLS_ASN1_PARSE_C -#define MBEDTLS_BIGNUM_C -#define MBEDTLS_CIPHER_C -#define MBEDTLS_CTR_DRBG_C -#define MBEDTLS_ENTROPY_C -#define MBEDTLS_ERROR_C -#define MBEDTLS_MD_C -#define MBEDTLS_MD5_C -#define MBEDTLS_OID_C -#define MBEDTLS_PKCS5_C -#define MBEDTLS_PK_C -#define MBEDTLS_PK_PARSE_C -#define MBEDTLS_PLATFORM_C -#define MBEDTLS_RSA_C -#define MBEDTLS_SHA1_C -#define MBEDTLS_SHA224_C -#define MBEDTLS_SHA256_C -#define MBEDTLS_SHA512_C -#define MBEDTLS_SSL_CLI_C -#define MBEDTLS_SSL_SRV_C -#define MBEDTLS_SSL_TLS_C -#define MBEDTLS_X509_CRT_PARSE_C -#define MBEDTLS_X509_USE_C -#define MBEDTLS_AES_FEWER_TABLES - -/* TLS 1.2 */ -#define MBEDTLS_SSL_PROTO_TLS1_2 -#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED -#define MBEDTLS_GCM_C -#define MBEDTLS_ECDH_C -#define MBEDTLS_ECP_C -#define MBEDTLS_ECDSA_C -#define MBEDTLS_ASN1_WRITE_C \ No newline at end of file diff --git a/0x0014_static-variables/.gitignore b/0x0014_static-variables/.gitignore index 6aa60eb..149d92e 100644 --- a/0x0014_static-variables/.gitignore +++ b/0x0014_static-variables/.gitignore @@ -1,7 +1,5 @@ .idea -.vscode _deps cmake-* build .DS_Store -*.pdf diff --git a/0x0014_static-variables/.vscode/.cortex-debug.peripherals.state.json b/0x0014_static-variables/.vscode/.cortex-debug.peripherals.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x0014_static-variables/.vscode/.cortex-debug.peripherals.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x0014_static-variables/.vscode/.cortex-debug.registers.state.json b/0x0014_static-variables/.vscode/.cortex-debug.registers.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x0014_static-variables/.vscode/.cortex-debug.registers.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x0014_static-variables/.vscode/c_cpp_properties.json b/0x0014_static-variables/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..ada839e --- /dev/null +++ b/0x0014_static-variables/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "Pico", + "includePath": [ + "${workspaceFolder}/**", + "${env:PICO_SDK_PATH}/**" + ], + "defines": [], + "compilerPath": "${env:PICO_INSTALL_PATH}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc.exe", + "cStandard": "c11", + "cppStandard": "c++11", + "intelliSenseMode": "linux-gcc-arm", + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 +} diff --git a/0x0014_static-variables/.vscode/extensions.json b/0x0014_static-variables/.vscode/extensions.json new file mode 100644 index 0000000..03ba0af --- /dev/null +++ b/0x0014_static-variables/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "marus25.cortex-debug", + "ms-vscode.cmake-tools", + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "ms-vscode.vscode-serial-monitor" + ] +} diff --git a/0x0014_static-variables/.vscode/launch.json b/0x0014_static-variables/.vscode/launch.json new file mode 100644 index 0000000..2b22acf --- /dev/null +++ b/0x0014_static-variables/.vscode/launch.json @@ -0,0 +1,58 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Pico Debug (Cortex-Debug)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "openocd", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "configFiles": [ + "interface/cmsis-dap.cfg", + "target/rp2040.cfg" + ], + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main", + "openOCDLaunchCommands": [ + "adapter speed 1000" + ] + }, + { + "name": "Pico Debug (Cortex-Debug with external OpenOCD)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "external", + "gdbTarget": "localhost:3333", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main" + }, + { + "name": "Pico Debug (C++ Debugger)", + "type": "cppdbg", + "request": "launch", + "cwd": "${workspaceFolder}", + "program": "${command:cmake.launchTargetPath}", + "MIMode": "gdb", + "miDebuggerPath": "arm-none-eabi-gdb", + "miDebuggerServerAddress": "localhost:3333", + "debugServerPath": "openocd", + "debugServerArgs": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 1000\"", + "serverStarted": "Listening on port .* for gdb connections", + "filterStderr": true, + "stopAtEntry": true, + "hardwareBreakpoints": { + "require": true, + "limit": 4 + }, + "preLaunchTask": "Flash", + "svdPath": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd" + } + ] +} diff --git a/0x0014_static-variables/.vscode/settings.json b/0x0014_static-variables/.vscode/settings.json new file mode 100644 index 0000000..8ad90e8 --- /dev/null +++ b/0x0014_static-variables/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + // These settings tweaks to the cmake plugin will ensure + // that you debug using cortex-debug instead of trying to launch + // a Pico binary on the host + "cmake.statusbar.advanced": { + "debug": { + "visibility": "hidden" + }, + "launch": { + "visibility": "hidden" + }, + "build": { + "visibility": "hidden" + }, + "buildTarget": { + "visibility": "hidden" + } + }, + "cmake.buildBeforeRun": true, + "cmake.configureOnOpen": true, + "cmake.configureSettings": { + "CMAKE_MODULE_PATH": "${env:PICO_INSTALL_PATH}/pico-sdk-tools" + }, + "cmake.generator": "Ninja", + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", + "C_Cpp.errorSquiggles": "enabled", + "files.associations": { + "stdlib.h": "c" + } +} diff --git a/0x0014_static-variables/.vscode/tasks.json b/0x0014_static-variables/.vscode/tasks.json new file mode 100644 index 0000000..a437c2f --- /dev/null +++ b/0x0014_static-variables/.vscode/tasks.json @@ -0,0 +1,29 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Flash", + "type": "shell", + "command": "openocd", + "args": [ + "-f", + "interface/cmsis-dap.cfg", + "-f", + "target/rp2040.cfg", + "-c", + "adapter speed 1000; program {${command:cmake.launchTargetPath}} verify reset exit" + ], + "problemMatcher": [] + }, + { + "label": "Build", + "type": "cmake", + "command": "build", + "problemMatcher": "$gcc", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/0x0014_static-variables/CMakeLists.txt b/0x0014_static-variables/CMakeLists.txt index 66598e7..58be2e5 100644 --- a/0x0014_static-variables/CMakeLists.txt +++ b/0x0014_static-variables/CMakeLists.txt @@ -1,57 +1,21 @@ cmake_minimum_required(VERSION 3.13) -set(PICO_BOARD pico_w) - include(pico_sdk_import.cmake) - project(0x0014_static-variables C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) pico_sdk_init() -if (PICO_CYW43_SUPPORTED) # set by PICO_BOARD=pico_w - if (NOT TARGET pico_cyw43_arch) - message("Skipping Pico W examples as support is not available") - else() - - if (DEFINED ENV{WIFI_SSID} AND (NOT WIFI_SSID)) - set(WIFI_SSID $ENV{WIFI_SSID}) - message("Using WIFI_SSID from environment ('${WIFI_SSID}')") - endif() - - if (DEFINED ENV{WIFI_PASSWORD} AND (NOT WIFI_PASSWORD)) - set(WIFI_PASSWORD $ENV{WIFI_PASSWORD}) - message("Using WIFI_PASSWORD from environment") - endif() - - set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID for examples") - set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi password for examples") - endif() -endif() - -set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID") -set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi PASSWORD") - add_executable(0x0014_static-variables - main.c - ) -target_compile_definitions(0x0014_static-variables PRIVATE - WIFI_SSID=\"${WIFI_SSID}\" - WIFI_PASSWORD=\"${WIFI_PASSWORD}\" - ) -target_include_directories(0x0014_static-variables PRIVATE - ${CMAKE_CURRENT_LIST_DIR} - ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts - ) -target_link_libraries(0x0014_static-variables - pico_cyw43_arch_lwip_threadsafe_background - pico_lwip_mbedtls - pico_mbedtls - pico_stdlib - ) + main.c +) -pico_enable_stdio_usb(0x0014_static-variables 0) +pico_enable_stdio_usb(0x0014_static-variables 1) pico_enable_stdio_uart(0x0014_static-variables 1) pico_add_extra_outputs(0x0014_static-variables) + +target_link_libraries(0x0014_static-variables + pico_stdlib +) diff --git a/0x0014_static-variables/lwipopts.h b/0x0014_static-variables/lwipopts.h deleted file mode 100644 index b7f0386..0000000 --- a/0x0014_static-variables/lwipopts.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _LWIPOPTS_H -#define _LWIPOPTS_H - -#include "lwipopts_examples_common.h" - -/* TCP WND must be at least 16 kb to match TLS record size - or you will get a warning "altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!" */ -#undef TCP_WND -#define TCP_WND 16384 - -#define LWIP_ALTCP 1 -#define LWIP_ALTCP_TLS 1 -#define LWIP_ALTCP_TLS_MBEDTLS 1 - -#define LWIP_DEBUG 1 -#define ALTCP_MBEDTLS_DEBUG LWIP_DBG_ON - -#endif \ No newline at end of file diff --git a/0x0014_static-variables/lwipopts_examples_common.h b/0x0014_static-variables/lwipopts_examples_common.h deleted file mode 100644 index d6a2d02..0000000 --- a/0x0014_static-variables/lwipopts_examples_common.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef _LWIPOPTS_EXAMPLE_COMMONH_H -#define _LWIPOPTS_EXAMPLE_COMMONH_H - -// Common settings used in most of the pico_w examples -// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details) - -// allow override in some examples -#ifndef NO_SYS -#define NO_SYS 1 -#endif -// allow override in some examples -#ifndef LWIP_SOCKET -#define LWIP_SOCKET 0 -#endif -#if PICO_CYW43_ARCH_POLL -#define MEM_LIBC_MALLOC 1 -#else -// MEM_LIBC_MALLOC is incompatible with non polling versions -#define MEM_LIBC_MALLOC 0 -#endif -#define MEM_ALIGNMENT 4 -#define MEM_SIZE 4000 -#define MEMP_NUM_TCP_SEG 32 -#define MEMP_NUM_ARP_QUEUE 10 -#define PBUF_POOL_SIZE 24 -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_ICMP 1 -#define LWIP_RAW 1 -#define TCP_WND (8 * TCP_MSS) -#define TCP_MSS 1460 -#define TCP_SND_BUF (8 * TCP_MSS) -#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS)) -#define LWIP_NETIF_STATUS_CALLBACK 1 -#define LWIP_NETIF_LINK_CALLBACK 1 -#define LWIP_NETIF_HOSTNAME 1 -#define LWIP_NETCONN 0 -#define MEM_STATS 0 -#define SYS_STATS 0 -#define MEMP_STATS 0 -#define LINK_STATS 0 -// #define ETH_PAD_SIZE 2 -#define LWIP_CHKSUM_ALGORITHM 3 -#define LWIP_DHCP 1 -#define LWIP_IPV4 1 -#define LWIP_TCP 1 -#define LWIP_UDP 1 -#define LWIP_DNS 1 -#define LWIP_TCP_KEEPALIVE 1 -#define LWIP_NETIF_TX_SINGLE_PBUF 1 -#define DHCP_DOES_ARP_CHECK 0 -#define LWIP_DHCP_DOES_ACD_CHECK 0 - -#ifndef NDEBUG -#define LWIP_DEBUG 1 -#define LWIP_STATS 1 -#define LWIP_STATS_DISPLAY 1 -#endif - -#define ETHARP_DEBUG LWIP_DBG_OFF -#define NETIF_DEBUG LWIP_DBG_OFF -#define PBUF_DEBUG LWIP_DBG_OFF -#define API_LIB_DEBUG LWIP_DBG_OFF -#define API_MSG_DEBUG LWIP_DBG_OFF -#define SOCKETS_DEBUG LWIP_DBG_OFF -#define ICMP_DEBUG LWIP_DBG_OFF -#define INET_DEBUG LWIP_DBG_OFF -#define IP_DEBUG LWIP_DBG_OFF -#define IP_REASS_DEBUG LWIP_DBG_OFF -#define RAW_DEBUG LWIP_DBG_OFF -#define MEM_DEBUG LWIP_DBG_OFF -#define MEMP_DEBUG LWIP_DBG_OFF -#define SYS_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF -#define TCP_INPUT_DEBUG LWIP_DBG_OFF -#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF -#define TCP_RTO_DEBUG LWIP_DBG_OFF -#define TCP_CWND_DEBUG LWIP_DBG_OFF -#define TCP_WND_DEBUG LWIP_DBG_OFF -#define TCP_FR_DEBUG LWIP_DBG_OFF -#define TCP_QLEN_DEBUG LWIP_DBG_OFF -#define TCP_RST_DEBUG LWIP_DBG_OFF -#define UDP_DEBUG LWIP_DBG_OFF -#define TCPIP_DEBUG LWIP_DBG_OFF -#define PPP_DEBUG LWIP_DBG_OFF -#define SLIP_DEBUG LWIP_DBG_OFF -#define DHCP_DEBUG LWIP_DBG_OFF - -#endif /* __LWIPOPTS_H__ */ \ No newline at end of file diff --git a/0x0014_static-variables/main.c b/0x0014_static-variables/main.c index 08dc4b0..147d8fa 100644 --- a/0x0014_static-variables/main.c +++ b/0x0014_static-variables/main.c @@ -1,13 +1,10 @@ #include #include "pico/stdlib.h" -#include "pico/cyw43_arch.h" -int main(void) -{ +int main(void) { stdio_init_all(); - while (true) - { + while (true) { static int static_fav_num = 42; int regular_fav_num = 42; diff --git a/0x0014_static-variables/mbedtls_config.h b/0x0014_static-variables/mbedtls_config.h deleted file mode 100644 index 83c9f48..0000000 --- a/0x0014_static-variables/mbedtls_config.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Workaround for some mbedtls source files using INT_MAX without including limits.h */ -#include - -#define MBEDTLS_NO_PLATFORM_ENTROPY -#define MBEDTLS_ENTROPY_HARDWARE_ALT - -#define MBEDTLS_SSL_OUT_CONTENT_LEN 2048 - -#define MBEDTLS_ALLOW_PRIVATE_ACCESS -#define MBEDTLS_HAVE_TIME - -#define MBEDTLS_CIPHER_MODE_CBC -#define MBEDTLS_ECP_DP_SECP192R1_ENABLED -#define MBEDTLS_ECP_DP_SECP224R1_ENABLED -#define MBEDTLS_ECP_DP_SECP256R1_ENABLED -#define MBEDTLS_ECP_DP_SECP384R1_ENABLED -#define MBEDTLS_ECP_DP_SECP521R1_ENABLED -#define MBEDTLS_ECP_DP_SECP192K1_ENABLED -#define MBEDTLS_ECP_DP_SECP224K1_ENABLED -#define MBEDTLS_ECP_DP_SECP256K1_ENABLED -#define MBEDTLS_ECP_DP_BP256R1_ENABLED -#define MBEDTLS_ECP_DP_BP384R1_ENABLED -#define MBEDTLS_ECP_DP_BP512R1_ENABLED -#define MBEDTLS_ECP_DP_CURVE25519_ENABLED -#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED -#define MBEDTLS_PKCS1_V15 -#define MBEDTLS_SHA256_SMALLER -#define MBEDTLS_SSL_SERVER_NAME_INDICATION -#define MBEDTLS_AES_C -#define MBEDTLS_ASN1_PARSE_C -#define MBEDTLS_BIGNUM_C -#define MBEDTLS_CIPHER_C -#define MBEDTLS_CTR_DRBG_C -#define MBEDTLS_ENTROPY_C -#define MBEDTLS_ERROR_C -#define MBEDTLS_MD_C -#define MBEDTLS_MD5_C -#define MBEDTLS_OID_C -#define MBEDTLS_PKCS5_C -#define MBEDTLS_PK_C -#define MBEDTLS_PK_PARSE_C -#define MBEDTLS_PLATFORM_C -#define MBEDTLS_RSA_C -#define MBEDTLS_SHA1_C -#define MBEDTLS_SHA224_C -#define MBEDTLS_SHA256_C -#define MBEDTLS_SHA512_C -#define MBEDTLS_SSL_CLI_C -#define MBEDTLS_SSL_SRV_C -#define MBEDTLS_SSL_TLS_C -#define MBEDTLS_X509_CRT_PARSE_C -#define MBEDTLS_X509_USE_C -#define MBEDTLS_AES_FEWER_TABLES - -/* TLS 1.2 */ -#define MBEDTLS_SSL_PROTO_TLS1_2 -#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED -#define MBEDTLS_GCM_C -#define MBEDTLS_ECDH_C -#define MBEDTLS_ECP_C -#define MBEDTLS_ECDSA_C -#define MBEDTLS_ASN1_WRITE_C \ No newline at end of file diff --git a/0x0017_constants/.gitignore b/0x0017_constants/.gitignore index 6aa60eb..149d92e 100644 --- a/0x0017_constants/.gitignore +++ b/0x0017_constants/.gitignore @@ -1,7 +1,5 @@ .idea -.vscode _deps cmake-* build .DS_Store -*.pdf diff --git a/0x0017_constants/.vscode/.cortex-debug.peripherals.state.json b/0x0017_constants/.vscode/.cortex-debug.peripherals.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x0017_constants/.vscode/.cortex-debug.peripherals.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x0017_constants/.vscode/.cortex-debug.registers.state.json b/0x0017_constants/.vscode/.cortex-debug.registers.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x0017_constants/.vscode/.cortex-debug.registers.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x0017_constants/.vscode/c_cpp_properties.json b/0x0017_constants/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..ada839e --- /dev/null +++ b/0x0017_constants/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "Pico", + "includePath": [ + "${workspaceFolder}/**", + "${env:PICO_SDK_PATH}/**" + ], + "defines": [], + "compilerPath": "${env:PICO_INSTALL_PATH}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc.exe", + "cStandard": "c11", + "cppStandard": "c++11", + "intelliSenseMode": "linux-gcc-arm", + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 +} diff --git a/0x0017_constants/.vscode/extensions.json b/0x0017_constants/.vscode/extensions.json new file mode 100644 index 0000000..03ba0af --- /dev/null +++ b/0x0017_constants/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "marus25.cortex-debug", + "ms-vscode.cmake-tools", + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "ms-vscode.vscode-serial-monitor" + ] +} diff --git a/0x0017_constants/.vscode/launch.json b/0x0017_constants/.vscode/launch.json new file mode 100644 index 0000000..2b22acf --- /dev/null +++ b/0x0017_constants/.vscode/launch.json @@ -0,0 +1,58 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Pico Debug (Cortex-Debug)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "openocd", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "configFiles": [ + "interface/cmsis-dap.cfg", + "target/rp2040.cfg" + ], + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main", + "openOCDLaunchCommands": [ + "adapter speed 1000" + ] + }, + { + "name": "Pico Debug (Cortex-Debug with external OpenOCD)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "external", + "gdbTarget": "localhost:3333", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main" + }, + { + "name": "Pico Debug (C++ Debugger)", + "type": "cppdbg", + "request": "launch", + "cwd": "${workspaceFolder}", + "program": "${command:cmake.launchTargetPath}", + "MIMode": "gdb", + "miDebuggerPath": "arm-none-eabi-gdb", + "miDebuggerServerAddress": "localhost:3333", + "debugServerPath": "openocd", + "debugServerArgs": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 1000\"", + "serverStarted": "Listening on port .* for gdb connections", + "filterStderr": true, + "stopAtEntry": true, + "hardwareBreakpoints": { + "require": true, + "limit": 4 + }, + "preLaunchTask": "Flash", + "svdPath": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd" + } + ] +} diff --git a/0x0017_constants/.vscode/settings.json b/0x0017_constants/.vscode/settings.json new file mode 100644 index 0000000..8ad90e8 --- /dev/null +++ b/0x0017_constants/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + // These settings tweaks to the cmake plugin will ensure + // that you debug using cortex-debug instead of trying to launch + // a Pico binary on the host + "cmake.statusbar.advanced": { + "debug": { + "visibility": "hidden" + }, + "launch": { + "visibility": "hidden" + }, + "build": { + "visibility": "hidden" + }, + "buildTarget": { + "visibility": "hidden" + } + }, + "cmake.buildBeforeRun": true, + "cmake.configureOnOpen": true, + "cmake.configureSettings": { + "CMAKE_MODULE_PATH": "${env:PICO_INSTALL_PATH}/pico-sdk-tools" + }, + "cmake.generator": "Ninja", + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", + "C_Cpp.errorSquiggles": "enabled", + "files.associations": { + "stdlib.h": "c" + } +} diff --git a/0x0017_constants/.vscode/tasks.json b/0x0017_constants/.vscode/tasks.json new file mode 100644 index 0000000..a437c2f --- /dev/null +++ b/0x0017_constants/.vscode/tasks.json @@ -0,0 +1,29 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Flash", + "type": "shell", + "command": "openocd", + "args": [ + "-f", + "interface/cmsis-dap.cfg", + "-f", + "target/rp2040.cfg", + "-c", + "adapter speed 1000; program {${command:cmake.launchTargetPath}} verify reset exit" + ], + "problemMatcher": [] + }, + { + "label": "Build", + "type": "cmake", + "command": "build", + "problemMatcher": "$gcc", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/0x0017_constants/CMakeLists.txt b/0x0017_constants/CMakeLists.txt index 3db0599..bc6ecfa 100644 --- a/0x0017_constants/CMakeLists.txt +++ b/0x0017_constants/CMakeLists.txt @@ -1,57 +1,21 @@ cmake_minimum_required(VERSION 3.13) -set(PICO_BOARD pico_w) - include(pico_sdk_import.cmake) - -project(0x0017_constants C CXX ASM) +project(0x0017_constant C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) pico_sdk_init() -if (PICO_CYW43_SUPPORTED) # set by PICO_BOARD=pico_w - if (NOT TARGET pico_cyw43_arch) - message("Skipping Pico W examples as support is not available") - else() +add_executable(0x0017_constant + main.c +) - if (DEFINED ENV{WIFI_SSID} AND (NOT WIFI_SSID)) - set(WIFI_SSID $ENV{WIFI_SSID}) - message("Using WIFI_SSID from environment ('${WIFI_SSID}')") - endif() +pico_enable_stdio_usb(0x0017_constant 1) +pico_enable_stdio_uart(0x0017_constant 1) - if (DEFINED ENV{WIFI_PASSWORD} AND (NOT WIFI_PASSWORD)) - set(WIFI_PASSWORD $ENV{WIFI_PASSWORD}) - message("Using WIFI_PASSWORD from environment") - endif() +pico_add_extra_outputs(0x0017_constant) - set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID for examples") - set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi password for examples") - endif() -endif() - -set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID") -set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi PASSWORD") - -add_executable(0x0017_constants - main.c - ) -target_compile_definitions(0x0017_constants PRIVATE - WIFI_SSID=\"${WIFI_SSID}\" - WIFI_PASSWORD=\"${WIFI_PASSWORD}\" - ) -target_include_directories(0x0017_constants PRIVATE - ${CMAKE_CURRENT_LIST_DIR} - ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts - ) -target_link_libraries(0x0017_constants - pico_cyw43_arch_lwip_threadsafe_background - pico_lwip_mbedtls - pico_mbedtls - pico_stdlib - ) - -pico_enable_stdio_usb(0x0017_constants 0) -pico_enable_stdio_uart(0x0017_constants 1) - -pico_add_extra_outputs(0x0017_constants) +target_link_libraries(0x0017_constant + pico_stdlib +) diff --git a/0x0017_constants/lwipopts.h b/0x0017_constants/lwipopts.h deleted file mode 100644 index b7f0386..0000000 --- a/0x0017_constants/lwipopts.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _LWIPOPTS_H -#define _LWIPOPTS_H - -#include "lwipopts_examples_common.h" - -/* TCP WND must be at least 16 kb to match TLS record size - or you will get a warning "altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!" */ -#undef TCP_WND -#define TCP_WND 16384 - -#define LWIP_ALTCP 1 -#define LWIP_ALTCP_TLS 1 -#define LWIP_ALTCP_TLS_MBEDTLS 1 - -#define LWIP_DEBUG 1 -#define ALTCP_MBEDTLS_DEBUG LWIP_DBG_ON - -#endif \ No newline at end of file diff --git a/0x0017_constants/lwipopts_examples_common.h b/0x0017_constants/lwipopts_examples_common.h deleted file mode 100644 index d6a2d02..0000000 --- a/0x0017_constants/lwipopts_examples_common.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef _LWIPOPTS_EXAMPLE_COMMONH_H -#define _LWIPOPTS_EXAMPLE_COMMONH_H - -// Common settings used in most of the pico_w examples -// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details) - -// allow override in some examples -#ifndef NO_SYS -#define NO_SYS 1 -#endif -// allow override in some examples -#ifndef LWIP_SOCKET -#define LWIP_SOCKET 0 -#endif -#if PICO_CYW43_ARCH_POLL -#define MEM_LIBC_MALLOC 1 -#else -// MEM_LIBC_MALLOC is incompatible with non polling versions -#define MEM_LIBC_MALLOC 0 -#endif -#define MEM_ALIGNMENT 4 -#define MEM_SIZE 4000 -#define MEMP_NUM_TCP_SEG 32 -#define MEMP_NUM_ARP_QUEUE 10 -#define PBUF_POOL_SIZE 24 -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_ICMP 1 -#define LWIP_RAW 1 -#define TCP_WND (8 * TCP_MSS) -#define TCP_MSS 1460 -#define TCP_SND_BUF (8 * TCP_MSS) -#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS)) -#define LWIP_NETIF_STATUS_CALLBACK 1 -#define LWIP_NETIF_LINK_CALLBACK 1 -#define LWIP_NETIF_HOSTNAME 1 -#define LWIP_NETCONN 0 -#define MEM_STATS 0 -#define SYS_STATS 0 -#define MEMP_STATS 0 -#define LINK_STATS 0 -// #define ETH_PAD_SIZE 2 -#define LWIP_CHKSUM_ALGORITHM 3 -#define LWIP_DHCP 1 -#define LWIP_IPV4 1 -#define LWIP_TCP 1 -#define LWIP_UDP 1 -#define LWIP_DNS 1 -#define LWIP_TCP_KEEPALIVE 1 -#define LWIP_NETIF_TX_SINGLE_PBUF 1 -#define DHCP_DOES_ARP_CHECK 0 -#define LWIP_DHCP_DOES_ACD_CHECK 0 - -#ifndef NDEBUG -#define LWIP_DEBUG 1 -#define LWIP_STATS 1 -#define LWIP_STATS_DISPLAY 1 -#endif - -#define ETHARP_DEBUG LWIP_DBG_OFF -#define NETIF_DEBUG LWIP_DBG_OFF -#define PBUF_DEBUG LWIP_DBG_OFF -#define API_LIB_DEBUG LWIP_DBG_OFF -#define API_MSG_DEBUG LWIP_DBG_OFF -#define SOCKETS_DEBUG LWIP_DBG_OFF -#define ICMP_DEBUG LWIP_DBG_OFF -#define INET_DEBUG LWIP_DBG_OFF -#define IP_DEBUG LWIP_DBG_OFF -#define IP_REASS_DEBUG LWIP_DBG_OFF -#define RAW_DEBUG LWIP_DBG_OFF -#define MEM_DEBUG LWIP_DBG_OFF -#define MEMP_DEBUG LWIP_DBG_OFF -#define SYS_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF -#define TCP_INPUT_DEBUG LWIP_DBG_OFF -#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF -#define TCP_RTO_DEBUG LWIP_DBG_OFF -#define TCP_CWND_DEBUG LWIP_DBG_OFF -#define TCP_WND_DEBUG LWIP_DBG_OFF -#define TCP_FR_DEBUG LWIP_DBG_OFF -#define TCP_QLEN_DEBUG LWIP_DBG_OFF -#define TCP_RST_DEBUG LWIP_DBG_OFF -#define UDP_DEBUG LWIP_DBG_OFF -#define TCPIP_DEBUG LWIP_DBG_OFF -#define PPP_DEBUG LWIP_DBG_OFF -#define SLIP_DEBUG LWIP_DBG_OFF -#define DHCP_DEBUG LWIP_DBG_OFF - -#endif /* __LWIPOPTS_H__ */ \ No newline at end of file diff --git a/0x0017_constants/main.c b/0x0017_constants/main.c index 54d6fb6..fcaef42 100644 --- a/0x0017_constants/main.c +++ b/0x0017_constants/main.c @@ -1,17 +1,14 @@ #include #include "pico/stdlib.h" -#include "pico/cyw43_arch.h" #define FAV_NUM 42 -int main(void) -{ +const int OTHER_FAV_NUM = 1337; + +int main(void) { stdio_init_all(); - while (true) - { - const int OTHER_FAV_NUM = 1337; - + while (true) { printf("FAV_NUM: %d\r\n", FAV_NUM); printf("regular_fav_num: %d\r\n", OTHER_FAV_NUM); } diff --git a/0x0017_constants/mbedtls_config.h b/0x0017_constants/mbedtls_config.h deleted file mode 100644 index 83c9f48..0000000 --- a/0x0017_constants/mbedtls_config.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Workaround for some mbedtls source files using INT_MAX without including limits.h */ -#include - -#define MBEDTLS_NO_PLATFORM_ENTROPY -#define MBEDTLS_ENTROPY_HARDWARE_ALT - -#define MBEDTLS_SSL_OUT_CONTENT_LEN 2048 - -#define MBEDTLS_ALLOW_PRIVATE_ACCESS -#define MBEDTLS_HAVE_TIME - -#define MBEDTLS_CIPHER_MODE_CBC -#define MBEDTLS_ECP_DP_SECP192R1_ENABLED -#define MBEDTLS_ECP_DP_SECP224R1_ENABLED -#define MBEDTLS_ECP_DP_SECP256R1_ENABLED -#define MBEDTLS_ECP_DP_SECP384R1_ENABLED -#define MBEDTLS_ECP_DP_SECP521R1_ENABLED -#define MBEDTLS_ECP_DP_SECP192K1_ENABLED -#define MBEDTLS_ECP_DP_SECP224K1_ENABLED -#define MBEDTLS_ECP_DP_SECP256K1_ENABLED -#define MBEDTLS_ECP_DP_BP256R1_ENABLED -#define MBEDTLS_ECP_DP_BP384R1_ENABLED -#define MBEDTLS_ECP_DP_BP512R1_ENABLED -#define MBEDTLS_ECP_DP_CURVE25519_ENABLED -#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED -#define MBEDTLS_PKCS1_V15 -#define MBEDTLS_SHA256_SMALLER -#define MBEDTLS_SSL_SERVER_NAME_INDICATION -#define MBEDTLS_AES_C -#define MBEDTLS_ASN1_PARSE_C -#define MBEDTLS_BIGNUM_C -#define MBEDTLS_CIPHER_C -#define MBEDTLS_CTR_DRBG_C -#define MBEDTLS_ENTROPY_C -#define MBEDTLS_ERROR_C -#define MBEDTLS_MD_C -#define MBEDTLS_MD5_C -#define MBEDTLS_OID_C -#define MBEDTLS_PKCS5_C -#define MBEDTLS_PK_C -#define MBEDTLS_PK_PARSE_C -#define MBEDTLS_PLATFORM_C -#define MBEDTLS_RSA_C -#define MBEDTLS_SHA1_C -#define MBEDTLS_SHA224_C -#define MBEDTLS_SHA256_C -#define MBEDTLS_SHA512_C -#define MBEDTLS_SSL_CLI_C -#define MBEDTLS_SSL_SRV_C -#define MBEDTLS_SSL_TLS_C -#define MBEDTLS_X509_CRT_PARSE_C -#define MBEDTLS_X509_USE_C -#define MBEDTLS_AES_FEWER_TABLES - -/* TLS 1.2 */ -#define MBEDTLS_SSL_PROTO_TLS1_2 -#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED -#define MBEDTLS_GCM_C -#define MBEDTLS_ECDH_C -#define MBEDTLS_ECP_C -#define MBEDTLS_ECDSA_C -#define MBEDTLS_ASN1_WRITE_C \ No newline at end of file diff --git a/0x001a_operators/.gitignore b/0x001a_operators/.gitignore index 6aa60eb..149d92e 100644 --- a/0x001a_operators/.gitignore +++ b/0x001a_operators/.gitignore @@ -1,7 +1,5 @@ .idea -.vscode _deps cmake-* build .DS_Store -*.pdf diff --git a/0x001a_operators/.vscode/.cortex-debug.peripherals.state.json b/0x001a_operators/.vscode/.cortex-debug.peripherals.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x001a_operators/.vscode/.cortex-debug.peripherals.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x001a_operators/.vscode/.cortex-debug.registers.state.json b/0x001a_operators/.vscode/.cortex-debug.registers.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x001a_operators/.vscode/.cortex-debug.registers.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x001a_operators/.vscode/c_cpp_properties.json b/0x001a_operators/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..ada839e --- /dev/null +++ b/0x001a_operators/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "Pico", + "includePath": [ + "${workspaceFolder}/**", + "${env:PICO_SDK_PATH}/**" + ], + "defines": [], + "compilerPath": "${env:PICO_INSTALL_PATH}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc.exe", + "cStandard": "c11", + "cppStandard": "c++11", + "intelliSenseMode": "linux-gcc-arm", + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 +} diff --git a/0x001a_operators/.vscode/extensions.json b/0x001a_operators/.vscode/extensions.json new file mode 100644 index 0000000..03ba0af --- /dev/null +++ b/0x001a_operators/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "marus25.cortex-debug", + "ms-vscode.cmake-tools", + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "ms-vscode.vscode-serial-monitor" + ] +} diff --git a/0x001a_operators/.vscode/launch.json b/0x001a_operators/.vscode/launch.json new file mode 100644 index 0000000..2b22acf --- /dev/null +++ b/0x001a_operators/.vscode/launch.json @@ -0,0 +1,58 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Pico Debug (Cortex-Debug)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "openocd", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "configFiles": [ + "interface/cmsis-dap.cfg", + "target/rp2040.cfg" + ], + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main", + "openOCDLaunchCommands": [ + "adapter speed 1000" + ] + }, + { + "name": "Pico Debug (Cortex-Debug with external OpenOCD)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "external", + "gdbTarget": "localhost:3333", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main" + }, + { + "name": "Pico Debug (C++ Debugger)", + "type": "cppdbg", + "request": "launch", + "cwd": "${workspaceFolder}", + "program": "${command:cmake.launchTargetPath}", + "MIMode": "gdb", + "miDebuggerPath": "arm-none-eabi-gdb", + "miDebuggerServerAddress": "localhost:3333", + "debugServerPath": "openocd", + "debugServerArgs": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 1000\"", + "serverStarted": "Listening on port .* for gdb connections", + "filterStderr": true, + "stopAtEntry": true, + "hardwareBreakpoints": { + "require": true, + "limit": 4 + }, + "preLaunchTask": "Flash", + "svdPath": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd" + } + ] +} diff --git a/0x001a_operators/.vscode/settings.json b/0x001a_operators/.vscode/settings.json new file mode 100644 index 0000000..8ad90e8 --- /dev/null +++ b/0x001a_operators/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + // These settings tweaks to the cmake plugin will ensure + // that you debug using cortex-debug instead of trying to launch + // a Pico binary on the host + "cmake.statusbar.advanced": { + "debug": { + "visibility": "hidden" + }, + "launch": { + "visibility": "hidden" + }, + "build": { + "visibility": "hidden" + }, + "buildTarget": { + "visibility": "hidden" + } + }, + "cmake.buildBeforeRun": true, + "cmake.configureOnOpen": true, + "cmake.configureSettings": { + "CMAKE_MODULE_PATH": "${env:PICO_INSTALL_PATH}/pico-sdk-tools" + }, + "cmake.generator": "Ninja", + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", + "C_Cpp.errorSquiggles": "enabled", + "files.associations": { + "stdlib.h": "c" + } +} diff --git a/0x001a_operators/.vscode/tasks.json b/0x001a_operators/.vscode/tasks.json new file mode 100644 index 0000000..a437c2f --- /dev/null +++ b/0x001a_operators/.vscode/tasks.json @@ -0,0 +1,29 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Flash", + "type": "shell", + "command": "openocd", + "args": [ + "-f", + "interface/cmsis-dap.cfg", + "-f", + "target/rp2040.cfg", + "-c", + "adapter speed 1000; program {${command:cmake.launchTargetPath}} verify reset exit" + ], + "problemMatcher": [] + }, + { + "label": "Build", + "type": "cmake", + "command": "build", + "problemMatcher": "$gcc", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/0x001a_operators/CMakeLists.txt b/0x001a_operators/CMakeLists.txt index 19d2aa5..6435209 100644 --- a/0x001a_operators/CMakeLists.txt +++ b/0x001a_operators/CMakeLists.txt @@ -1,57 +1,21 @@ cmake_minimum_required(VERSION 3.13) -set(PICO_BOARD pico_w) - include(pico_sdk_import.cmake) - project(0x001a_operators C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) pico_sdk_init() -if (PICO_CYW43_SUPPORTED) # set by PICO_BOARD=pico_w - if (NOT TARGET pico_cyw43_arch) - message("Skipping Pico W examples as support is not available") - else() - - if (DEFINED ENV{WIFI_SSID} AND (NOT WIFI_SSID)) - set(WIFI_SSID $ENV{WIFI_SSID}) - message("Using WIFI_SSID from environment ('${WIFI_SSID}')") - endif() - - if (DEFINED ENV{WIFI_PASSWORD} AND (NOT WIFI_PASSWORD)) - set(WIFI_PASSWORD $ENV{WIFI_PASSWORD}) - message("Using WIFI_PASSWORD from environment") - endif() - - set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID for examples") - set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi password for examples") - endif() -endif() - -set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID") -set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi PASSWORD") - add_executable(0x001a_operators - main.c - ) -target_compile_definitions(0x001a_operators PRIVATE - WIFI_SSID=\"${WIFI_SSID}\" - WIFI_PASSWORD=\"${WIFI_PASSWORD}\" - ) -target_include_directories(0x001a_operators PRIVATE - ${CMAKE_CURRENT_LIST_DIR} - ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts - ) -target_link_libraries(0x001a_operators - pico_cyw43_arch_lwip_threadsafe_background - pico_lwip_mbedtls - pico_mbedtls - pico_stdlib - ) + main.c +) -pico_enable_stdio_usb(0x001a_operators 0) +pico_enable_stdio_usb(0x001a_operators 1) pico_enable_stdio_uart(0x001a_operators 1) pico_add_extra_outputs(0x001a_operators) + +target_link_libraries(0x001a_operators + pico_stdlib +) diff --git a/0x001a_operators/lwipopts.h b/0x001a_operators/lwipopts.h deleted file mode 100644 index b7f0386..0000000 --- a/0x001a_operators/lwipopts.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _LWIPOPTS_H -#define _LWIPOPTS_H - -#include "lwipopts_examples_common.h" - -/* TCP WND must be at least 16 kb to match TLS record size - or you will get a warning "altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!" */ -#undef TCP_WND -#define TCP_WND 16384 - -#define LWIP_ALTCP 1 -#define LWIP_ALTCP_TLS 1 -#define LWIP_ALTCP_TLS_MBEDTLS 1 - -#define LWIP_DEBUG 1 -#define ALTCP_MBEDTLS_DEBUG LWIP_DBG_ON - -#endif \ No newline at end of file diff --git a/0x001a_operators/lwipopts_examples_common.h b/0x001a_operators/lwipopts_examples_common.h deleted file mode 100644 index d6a2d02..0000000 --- a/0x001a_operators/lwipopts_examples_common.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef _LWIPOPTS_EXAMPLE_COMMONH_H -#define _LWIPOPTS_EXAMPLE_COMMONH_H - -// Common settings used in most of the pico_w examples -// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details) - -// allow override in some examples -#ifndef NO_SYS -#define NO_SYS 1 -#endif -// allow override in some examples -#ifndef LWIP_SOCKET -#define LWIP_SOCKET 0 -#endif -#if PICO_CYW43_ARCH_POLL -#define MEM_LIBC_MALLOC 1 -#else -// MEM_LIBC_MALLOC is incompatible with non polling versions -#define MEM_LIBC_MALLOC 0 -#endif -#define MEM_ALIGNMENT 4 -#define MEM_SIZE 4000 -#define MEMP_NUM_TCP_SEG 32 -#define MEMP_NUM_ARP_QUEUE 10 -#define PBUF_POOL_SIZE 24 -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_ICMP 1 -#define LWIP_RAW 1 -#define TCP_WND (8 * TCP_MSS) -#define TCP_MSS 1460 -#define TCP_SND_BUF (8 * TCP_MSS) -#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS)) -#define LWIP_NETIF_STATUS_CALLBACK 1 -#define LWIP_NETIF_LINK_CALLBACK 1 -#define LWIP_NETIF_HOSTNAME 1 -#define LWIP_NETCONN 0 -#define MEM_STATS 0 -#define SYS_STATS 0 -#define MEMP_STATS 0 -#define LINK_STATS 0 -// #define ETH_PAD_SIZE 2 -#define LWIP_CHKSUM_ALGORITHM 3 -#define LWIP_DHCP 1 -#define LWIP_IPV4 1 -#define LWIP_TCP 1 -#define LWIP_UDP 1 -#define LWIP_DNS 1 -#define LWIP_TCP_KEEPALIVE 1 -#define LWIP_NETIF_TX_SINGLE_PBUF 1 -#define DHCP_DOES_ARP_CHECK 0 -#define LWIP_DHCP_DOES_ACD_CHECK 0 - -#ifndef NDEBUG -#define LWIP_DEBUG 1 -#define LWIP_STATS 1 -#define LWIP_STATS_DISPLAY 1 -#endif - -#define ETHARP_DEBUG LWIP_DBG_OFF -#define NETIF_DEBUG LWIP_DBG_OFF -#define PBUF_DEBUG LWIP_DBG_OFF -#define API_LIB_DEBUG LWIP_DBG_OFF -#define API_MSG_DEBUG LWIP_DBG_OFF -#define SOCKETS_DEBUG LWIP_DBG_OFF -#define ICMP_DEBUG LWIP_DBG_OFF -#define INET_DEBUG LWIP_DBG_OFF -#define IP_DEBUG LWIP_DBG_OFF -#define IP_REASS_DEBUG LWIP_DBG_OFF -#define RAW_DEBUG LWIP_DBG_OFF -#define MEM_DEBUG LWIP_DBG_OFF -#define MEMP_DEBUG LWIP_DBG_OFF -#define SYS_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF -#define TCP_INPUT_DEBUG LWIP_DBG_OFF -#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF -#define TCP_RTO_DEBUG LWIP_DBG_OFF -#define TCP_CWND_DEBUG LWIP_DBG_OFF -#define TCP_WND_DEBUG LWIP_DBG_OFF -#define TCP_FR_DEBUG LWIP_DBG_OFF -#define TCP_QLEN_DEBUG LWIP_DBG_OFF -#define TCP_RST_DEBUG LWIP_DBG_OFF -#define UDP_DEBUG LWIP_DBG_OFF -#define TCPIP_DEBUG LWIP_DBG_OFF -#define PPP_DEBUG LWIP_DBG_OFF -#define SLIP_DEBUG LWIP_DBG_OFF -#define DHCP_DEBUG LWIP_DBG_OFF - -#endif /* __LWIPOPTS_H__ */ \ No newline at end of file diff --git a/0x001a_operators/main.c b/0x001a_operators/main.c index 579d923..e72baff 100644 --- a/0x001a_operators/main.c +++ b/0x001a_operators/main.c @@ -1,9 +1,7 @@ #include #include "pico/stdlib.h" -#include "pico/cyw43_arch.h" -int main(void) -{ +int main(void) { stdio_init_all(); int x = 5; @@ -15,8 +13,7 @@ int main(void) int bitwise_operator = (x<<1); // x is now 6 because of x++ or 0b00000110 and (x<<1) is 0b00001100 or 12 int assignment_operator = (x += 5); - while (true) - { + while (true) { printf("arithmetic_operator: %d\r\n", arithmetic_operator); printf("increment_operator: %d\r\n", increment_operator); printf("relational_operator: %d\r\n", relational_operator); diff --git a/0x001a_operators/mbedtls_config.h b/0x001a_operators/mbedtls_config.h deleted file mode 100644 index 83c9f48..0000000 --- a/0x001a_operators/mbedtls_config.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Workaround for some mbedtls source files using INT_MAX without including limits.h */ -#include - -#define MBEDTLS_NO_PLATFORM_ENTROPY -#define MBEDTLS_ENTROPY_HARDWARE_ALT - -#define MBEDTLS_SSL_OUT_CONTENT_LEN 2048 - -#define MBEDTLS_ALLOW_PRIVATE_ACCESS -#define MBEDTLS_HAVE_TIME - -#define MBEDTLS_CIPHER_MODE_CBC -#define MBEDTLS_ECP_DP_SECP192R1_ENABLED -#define MBEDTLS_ECP_DP_SECP224R1_ENABLED -#define MBEDTLS_ECP_DP_SECP256R1_ENABLED -#define MBEDTLS_ECP_DP_SECP384R1_ENABLED -#define MBEDTLS_ECP_DP_SECP521R1_ENABLED -#define MBEDTLS_ECP_DP_SECP192K1_ENABLED -#define MBEDTLS_ECP_DP_SECP224K1_ENABLED -#define MBEDTLS_ECP_DP_SECP256K1_ENABLED -#define MBEDTLS_ECP_DP_BP256R1_ENABLED -#define MBEDTLS_ECP_DP_BP384R1_ENABLED -#define MBEDTLS_ECP_DP_BP512R1_ENABLED -#define MBEDTLS_ECP_DP_CURVE25519_ENABLED -#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED -#define MBEDTLS_PKCS1_V15 -#define MBEDTLS_SHA256_SMALLER -#define MBEDTLS_SSL_SERVER_NAME_INDICATION -#define MBEDTLS_AES_C -#define MBEDTLS_ASN1_PARSE_C -#define MBEDTLS_BIGNUM_C -#define MBEDTLS_CIPHER_C -#define MBEDTLS_CTR_DRBG_C -#define MBEDTLS_ENTROPY_C -#define MBEDTLS_ERROR_C -#define MBEDTLS_MD_C -#define MBEDTLS_MD5_C -#define MBEDTLS_OID_C -#define MBEDTLS_PKCS5_C -#define MBEDTLS_PK_C -#define MBEDTLS_PK_PARSE_C -#define MBEDTLS_PLATFORM_C -#define MBEDTLS_RSA_C -#define MBEDTLS_SHA1_C -#define MBEDTLS_SHA224_C -#define MBEDTLS_SHA256_C -#define MBEDTLS_SHA512_C -#define MBEDTLS_SSL_CLI_C -#define MBEDTLS_SSL_SRV_C -#define MBEDTLS_SSL_TLS_C -#define MBEDTLS_X509_CRT_PARSE_C -#define MBEDTLS_X509_USE_C -#define MBEDTLS_AES_FEWER_TABLES - -/* TLS 1.2 */ -#define MBEDTLS_SSL_PROTO_TLS1_2 -#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED -#define MBEDTLS_GCM_C -#define MBEDTLS_ECDH_C -#define MBEDTLS_ECP_C -#define MBEDTLS_ECDSA_C -#define MBEDTLS_ASN1_WRITE_C \ No newline at end of file diff --git a/0x001d_static-conditionals/.gitignore b/0x001d_static-conditionals/.gitignore index 6aa60eb..149d92e 100644 --- a/0x001d_static-conditionals/.gitignore +++ b/0x001d_static-conditionals/.gitignore @@ -1,7 +1,5 @@ .idea -.vscode _deps cmake-* build .DS_Store -*.pdf diff --git a/0x001d_static-conditionals/.vscode/.cortex-debug.peripherals.state.json b/0x001d_static-conditionals/.vscode/.cortex-debug.peripherals.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x001d_static-conditionals/.vscode/.cortex-debug.peripherals.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x001d_static-conditionals/.vscode/.cortex-debug.registers.state.json b/0x001d_static-conditionals/.vscode/.cortex-debug.registers.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x001d_static-conditionals/.vscode/.cortex-debug.registers.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x001d_static-conditionals/.vscode/c_cpp_properties.json b/0x001d_static-conditionals/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..ada839e --- /dev/null +++ b/0x001d_static-conditionals/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "Pico", + "includePath": [ + "${workspaceFolder}/**", + "${env:PICO_SDK_PATH}/**" + ], + "defines": [], + "compilerPath": "${env:PICO_INSTALL_PATH}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc.exe", + "cStandard": "c11", + "cppStandard": "c++11", + "intelliSenseMode": "linux-gcc-arm", + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 +} diff --git a/0x001d_static-conditionals/.vscode/extensions.json b/0x001d_static-conditionals/.vscode/extensions.json new file mode 100644 index 0000000..03ba0af --- /dev/null +++ b/0x001d_static-conditionals/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "marus25.cortex-debug", + "ms-vscode.cmake-tools", + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "ms-vscode.vscode-serial-monitor" + ] +} diff --git a/0x001d_static-conditionals/.vscode/launch.json b/0x001d_static-conditionals/.vscode/launch.json new file mode 100644 index 0000000..2b22acf --- /dev/null +++ b/0x001d_static-conditionals/.vscode/launch.json @@ -0,0 +1,58 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Pico Debug (Cortex-Debug)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "openocd", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "configFiles": [ + "interface/cmsis-dap.cfg", + "target/rp2040.cfg" + ], + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main", + "openOCDLaunchCommands": [ + "adapter speed 1000" + ] + }, + { + "name": "Pico Debug (Cortex-Debug with external OpenOCD)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "external", + "gdbTarget": "localhost:3333", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main" + }, + { + "name": "Pico Debug (C++ Debugger)", + "type": "cppdbg", + "request": "launch", + "cwd": "${workspaceFolder}", + "program": "${command:cmake.launchTargetPath}", + "MIMode": "gdb", + "miDebuggerPath": "arm-none-eabi-gdb", + "miDebuggerServerAddress": "localhost:3333", + "debugServerPath": "openocd", + "debugServerArgs": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 1000\"", + "serverStarted": "Listening on port .* for gdb connections", + "filterStderr": true, + "stopAtEntry": true, + "hardwareBreakpoints": { + "require": true, + "limit": 4 + }, + "preLaunchTask": "Flash", + "svdPath": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd" + } + ] +} diff --git a/0x001d_static-conditionals/.vscode/settings.json b/0x001d_static-conditionals/.vscode/settings.json new file mode 100644 index 0000000..8ad90e8 --- /dev/null +++ b/0x001d_static-conditionals/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + // These settings tweaks to the cmake plugin will ensure + // that you debug using cortex-debug instead of trying to launch + // a Pico binary on the host + "cmake.statusbar.advanced": { + "debug": { + "visibility": "hidden" + }, + "launch": { + "visibility": "hidden" + }, + "build": { + "visibility": "hidden" + }, + "buildTarget": { + "visibility": "hidden" + } + }, + "cmake.buildBeforeRun": true, + "cmake.configureOnOpen": true, + "cmake.configureSettings": { + "CMAKE_MODULE_PATH": "${env:PICO_INSTALL_PATH}/pico-sdk-tools" + }, + "cmake.generator": "Ninja", + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", + "C_Cpp.errorSquiggles": "enabled", + "files.associations": { + "stdlib.h": "c" + } +} diff --git a/0x001d_static-conditionals/.vscode/tasks.json b/0x001d_static-conditionals/.vscode/tasks.json new file mode 100644 index 0000000..a437c2f --- /dev/null +++ b/0x001d_static-conditionals/.vscode/tasks.json @@ -0,0 +1,29 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Flash", + "type": "shell", + "command": "openocd", + "args": [ + "-f", + "interface/cmsis-dap.cfg", + "-f", + "target/rp2040.cfg", + "-c", + "adapter speed 1000; program {${command:cmake.launchTargetPath}} verify reset exit" + ], + "problemMatcher": [] + }, + { + "label": "Build", + "type": "cmake", + "command": "build", + "problemMatcher": "$gcc", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/0x001d_static-conditionals/CMakeLists.txt b/0x001d_static-conditionals/CMakeLists.txt index 73f779e..b0a32b9 100644 --- a/0x001d_static-conditionals/CMakeLists.txt +++ b/0x001d_static-conditionals/CMakeLists.txt @@ -1,57 +1,21 @@ cmake_minimum_required(VERSION 3.13) -set(PICO_BOARD pico_w) - include(pico_sdk_import.cmake) - project(0x001d_static-conditionals C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) pico_sdk_init() -if (PICO_CYW43_SUPPORTED) # set by PICO_BOARD=pico_w - if (NOT TARGET pico_cyw43_arch) - message("Skipping Pico W examples as support is not available") - else() - - if (DEFINED ENV{WIFI_SSID} AND (NOT WIFI_SSID)) - set(WIFI_SSID $ENV{WIFI_SSID}) - message("Using WIFI_SSID from environment ('${WIFI_SSID}')") - endif() - - if (DEFINED ENV{WIFI_PASSWORD} AND (NOT WIFI_PASSWORD)) - set(WIFI_PASSWORD $ENV{WIFI_PASSWORD}) - message("Using WIFI_PASSWORD from environment") - endif() - - set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID for examples") - set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi password for examples") - endif() -endif() - -set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID") -set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi PASSWORD") - add_executable(0x001d_static-conditionals - main.c - ) -target_compile_definitions(0x001d_static-conditionals PRIVATE - WIFI_SSID=\"${WIFI_SSID}\" - WIFI_PASSWORD=\"${WIFI_PASSWORD}\" - ) -target_include_directories(0x001d_static-conditionals PRIVATE - ${CMAKE_CURRENT_LIST_DIR} - ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts - ) -target_link_libraries(0x001d_static-conditionals - pico_cyw43_arch_lwip_threadsafe_background - pico_lwip_mbedtls - pico_mbedtls - pico_stdlib - ) + main.c +) -pico_enable_stdio_usb(0x001d_static-conditionals 0) +pico_enable_stdio_usb(0x001d_static-conditionals 1) pico_enable_stdio_uart(0x001d_static-conditionals 1) pico_add_extra_outputs(0x001d_static-conditionals) + +target_link_libraries(0x001d_static-conditionals + pico_stdlib +) diff --git a/0x001d_static-conditionals/lwipopts.h b/0x001d_static-conditionals/lwipopts.h deleted file mode 100644 index b7f0386..0000000 --- a/0x001d_static-conditionals/lwipopts.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _LWIPOPTS_H -#define _LWIPOPTS_H - -#include "lwipopts_examples_common.h" - -/* TCP WND must be at least 16 kb to match TLS record size - or you will get a warning "altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!" */ -#undef TCP_WND -#define TCP_WND 16384 - -#define LWIP_ALTCP 1 -#define LWIP_ALTCP_TLS 1 -#define LWIP_ALTCP_TLS_MBEDTLS 1 - -#define LWIP_DEBUG 1 -#define ALTCP_MBEDTLS_DEBUG LWIP_DBG_ON - -#endif \ No newline at end of file diff --git a/0x001d_static-conditionals/lwipopts_examples_common.h b/0x001d_static-conditionals/lwipopts_examples_common.h deleted file mode 100644 index d6a2d02..0000000 --- a/0x001d_static-conditionals/lwipopts_examples_common.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef _LWIPOPTS_EXAMPLE_COMMONH_H -#define _LWIPOPTS_EXAMPLE_COMMONH_H - -// Common settings used in most of the pico_w examples -// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details) - -// allow override in some examples -#ifndef NO_SYS -#define NO_SYS 1 -#endif -// allow override in some examples -#ifndef LWIP_SOCKET -#define LWIP_SOCKET 0 -#endif -#if PICO_CYW43_ARCH_POLL -#define MEM_LIBC_MALLOC 1 -#else -// MEM_LIBC_MALLOC is incompatible with non polling versions -#define MEM_LIBC_MALLOC 0 -#endif -#define MEM_ALIGNMENT 4 -#define MEM_SIZE 4000 -#define MEMP_NUM_TCP_SEG 32 -#define MEMP_NUM_ARP_QUEUE 10 -#define PBUF_POOL_SIZE 24 -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_ICMP 1 -#define LWIP_RAW 1 -#define TCP_WND (8 * TCP_MSS) -#define TCP_MSS 1460 -#define TCP_SND_BUF (8 * TCP_MSS) -#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS)) -#define LWIP_NETIF_STATUS_CALLBACK 1 -#define LWIP_NETIF_LINK_CALLBACK 1 -#define LWIP_NETIF_HOSTNAME 1 -#define LWIP_NETCONN 0 -#define MEM_STATS 0 -#define SYS_STATS 0 -#define MEMP_STATS 0 -#define LINK_STATS 0 -// #define ETH_PAD_SIZE 2 -#define LWIP_CHKSUM_ALGORITHM 3 -#define LWIP_DHCP 1 -#define LWIP_IPV4 1 -#define LWIP_TCP 1 -#define LWIP_UDP 1 -#define LWIP_DNS 1 -#define LWIP_TCP_KEEPALIVE 1 -#define LWIP_NETIF_TX_SINGLE_PBUF 1 -#define DHCP_DOES_ARP_CHECK 0 -#define LWIP_DHCP_DOES_ACD_CHECK 0 - -#ifndef NDEBUG -#define LWIP_DEBUG 1 -#define LWIP_STATS 1 -#define LWIP_STATS_DISPLAY 1 -#endif - -#define ETHARP_DEBUG LWIP_DBG_OFF -#define NETIF_DEBUG LWIP_DBG_OFF -#define PBUF_DEBUG LWIP_DBG_OFF -#define API_LIB_DEBUG LWIP_DBG_OFF -#define API_MSG_DEBUG LWIP_DBG_OFF -#define SOCKETS_DEBUG LWIP_DBG_OFF -#define ICMP_DEBUG LWIP_DBG_OFF -#define INET_DEBUG LWIP_DBG_OFF -#define IP_DEBUG LWIP_DBG_OFF -#define IP_REASS_DEBUG LWIP_DBG_OFF -#define RAW_DEBUG LWIP_DBG_OFF -#define MEM_DEBUG LWIP_DBG_OFF -#define MEMP_DEBUG LWIP_DBG_OFF -#define SYS_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF -#define TCP_INPUT_DEBUG LWIP_DBG_OFF -#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF -#define TCP_RTO_DEBUG LWIP_DBG_OFF -#define TCP_CWND_DEBUG LWIP_DBG_OFF -#define TCP_WND_DEBUG LWIP_DBG_OFF -#define TCP_FR_DEBUG LWIP_DBG_OFF -#define TCP_QLEN_DEBUG LWIP_DBG_OFF -#define TCP_RST_DEBUG LWIP_DBG_OFF -#define UDP_DEBUG LWIP_DBG_OFF -#define TCPIP_DEBUG LWIP_DBG_OFF -#define PPP_DEBUG LWIP_DBG_OFF -#define SLIP_DEBUG LWIP_DBG_OFF -#define DHCP_DEBUG LWIP_DBG_OFF - -#endif /* __LWIPOPTS_H__ */ \ No newline at end of file diff --git a/0x001d_static-conditionals/main.c b/0x001d_static-conditionals/main.c index c6fa0c2..c92587c 100644 --- a/0x001d_static-conditionals/main.c +++ b/0x001d_static-conditionals/main.c @@ -1,17 +1,12 @@ #include #include "pico/stdlib.h" -#include "pico/cyw43_arch.h" -#define FAV_NUM 42 - -int main(void) -{ +int main(void) { stdio_init_all(); int choice = 1; - while (true) - { + while (true) { if (choice == 1) { printf("1\r\n"); } else if (choice == 2) { diff --git a/0x001d_static-conditionals/mbedtls_config.h b/0x001d_static-conditionals/mbedtls_config.h deleted file mode 100644 index 83c9f48..0000000 --- a/0x001d_static-conditionals/mbedtls_config.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Workaround for some mbedtls source files using INT_MAX without including limits.h */ -#include - -#define MBEDTLS_NO_PLATFORM_ENTROPY -#define MBEDTLS_ENTROPY_HARDWARE_ALT - -#define MBEDTLS_SSL_OUT_CONTENT_LEN 2048 - -#define MBEDTLS_ALLOW_PRIVATE_ACCESS -#define MBEDTLS_HAVE_TIME - -#define MBEDTLS_CIPHER_MODE_CBC -#define MBEDTLS_ECP_DP_SECP192R1_ENABLED -#define MBEDTLS_ECP_DP_SECP224R1_ENABLED -#define MBEDTLS_ECP_DP_SECP256R1_ENABLED -#define MBEDTLS_ECP_DP_SECP384R1_ENABLED -#define MBEDTLS_ECP_DP_SECP521R1_ENABLED -#define MBEDTLS_ECP_DP_SECP192K1_ENABLED -#define MBEDTLS_ECP_DP_SECP224K1_ENABLED -#define MBEDTLS_ECP_DP_SECP256K1_ENABLED -#define MBEDTLS_ECP_DP_BP256R1_ENABLED -#define MBEDTLS_ECP_DP_BP384R1_ENABLED -#define MBEDTLS_ECP_DP_BP512R1_ENABLED -#define MBEDTLS_ECP_DP_CURVE25519_ENABLED -#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED -#define MBEDTLS_PKCS1_V15 -#define MBEDTLS_SHA256_SMALLER -#define MBEDTLS_SSL_SERVER_NAME_INDICATION -#define MBEDTLS_AES_C -#define MBEDTLS_ASN1_PARSE_C -#define MBEDTLS_BIGNUM_C -#define MBEDTLS_CIPHER_C -#define MBEDTLS_CTR_DRBG_C -#define MBEDTLS_ENTROPY_C -#define MBEDTLS_ERROR_C -#define MBEDTLS_MD_C -#define MBEDTLS_MD5_C -#define MBEDTLS_OID_C -#define MBEDTLS_PKCS5_C -#define MBEDTLS_PK_C -#define MBEDTLS_PK_PARSE_C -#define MBEDTLS_PLATFORM_C -#define MBEDTLS_RSA_C -#define MBEDTLS_SHA1_C -#define MBEDTLS_SHA224_C -#define MBEDTLS_SHA256_C -#define MBEDTLS_SHA512_C -#define MBEDTLS_SSL_CLI_C -#define MBEDTLS_SSL_SRV_C -#define MBEDTLS_SSL_TLS_C -#define MBEDTLS_X509_CRT_PARSE_C -#define MBEDTLS_X509_USE_C -#define MBEDTLS_AES_FEWER_TABLES - -/* TLS 1.2 */ -#define MBEDTLS_SSL_PROTO_TLS1_2 -#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED -#define MBEDTLS_GCM_C -#define MBEDTLS_ECDH_C -#define MBEDTLS_ECP_C -#define MBEDTLS_ECDSA_C -#define MBEDTLS_ASN1_WRITE_C \ No newline at end of file diff --git a/0x0020_dynamic-conditionals.uf2 b/0x0020_dynamic-conditionals.uf2 deleted file mode 100644 index 7f09af4..0000000 Binary files a/0x0020_dynamic-conditionals.uf2 and /dev/null differ diff --git a/0x0020_dynamic-conditionals/CMakeLists.txt b/0x0020_dynamic-conditionals/CMakeLists.txt index b8db64d..a0fa111 100644 --- a/0x0020_dynamic-conditionals/CMakeLists.txt +++ b/0x0020_dynamic-conditionals/CMakeLists.txt @@ -1,59 +1,22 @@ cmake_minimum_required(VERSION 3.13) -set(PICO_BOARD pico_w) - include(pico_sdk_import.cmake) - project(0x0020_dynamic-conditionals C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) pico_sdk_init() -if (PICO_CYW43_SUPPORTED) # set by PICO_BOARD=pico_w - if (NOT TARGET pico_cyw43_arch) - message("Skipping Pico W examples as support is not available") - else() - - if (DEFINED ENV{WIFI_SSID} AND (NOT WIFI_SSID)) - set(WIFI_SSID $ENV{WIFI_SSID}) - message("Using WIFI_SSID from environment ('${WIFI_SSID}')") - endif() - - if (DEFINED ENV{WIFI_PASSWORD} AND (NOT WIFI_PASSWORD)) - set(WIFI_PASSWORD $ENV{WIFI_PASSWORD}) - message("Using WIFI_PASSWORD from environment") - endif() - - set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID for examples") - set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi password for examples") - endif() -endif() - -set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID") -set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi PASSWORD") - add_executable(0x0020_dynamic-conditionals - input.c - main.c - ) -target_compile_definitions(0x0020_dynamic-conditionals PRIVATE - WIFI_SSID=\"${WIFI_SSID}\" - WIFI_PASSWORD=\"${WIFI_PASSWORD}\" - ) -target_include_directories(0x0020_dynamic-conditionals PRIVATE - ${CMAKE_CURRENT_LIST_DIR} - ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts - ) -target_link_libraries(0x0020_dynamic-conditionals - pico_cyw43_arch_lwip_threadsafe_background - pico_lwip_mbedtls - pico_mbedtls - pico_stdlib - hardware_uart - ) + input.c + main.c +) -pico_enable_stdio_usb(0x0020_dynamic-conditionals 0) +pico_enable_stdio_usb(0x0020_dynamic-conditionals 1) pico_enable_stdio_uart(0x0020_dynamic-conditionals 1) pico_add_extra_outputs(0x0020_dynamic-conditionals) + +target_link_libraries(0x0020_dynamic-conditionals + pico_stdlib +) diff --git a/0x0020_dynamic-conditionals/input.c b/0x0020_dynamic-conditionals/input.c index 75faf03..329f501 100644 --- a/0x0020_dynamic-conditionals/input.c +++ b/0x0020_dynamic-conditionals/input.c @@ -30,21 +30,20 @@ * configuration in addition to capturing a character from the UART terminal. * * @author Kevin Thomas - * @date 04/06/2024 + * @date 04/20/2024 */ #include "input.h" -void uart0_init(void) -{ +void uart0_init(void) { uart_init(UART_ID, BAUD_RATE); gpio_set_function(UART_TX_PIN, GPIO_FUNC_UART); gpio_set_function(UART_RX_PIN, GPIO_FUNC_UART); } -uint8_t on_uart_rx(void) -{ +uint8_t on_uart_rx(void) { uint8_t c = 0; + while (!uart_is_readable(UART_ID)) { c = uart_getc(UART_ID); return c; diff --git a/0x0020_dynamic-conditionals/input.h b/0x0020_dynamic-conditionals/input.h index 401fb87..f90d22d 100644 --- a/0x0020_dynamic-conditionals/input.h +++ b/0x0020_dynamic-conditionals/input.h @@ -31,7 +31,7 @@ * UART terminal. * * @author Kevin Thomas - * @date 04/06/2024 + * @date 04/20/2024 */ #ifndef _INPUT_H @@ -41,10 +41,10 @@ #include "hardware/uart.h" #include "hardware/irq.h" -#define UART_ID uart0 -#define BAUD_RATE 115200 -#define UART_TX_PIN 0 -#define UART_RX_PIN 1 +#define UART_ID uart0 +#define BAUD_RATE 115200 +#define UART_TX_PIN 0 +#define UART_RX_PIN 1 /** * @brief Initializes UART0 with specified baud rate and pin configurations. diff --git a/0x0020_dynamic-conditionals/lwipopts.h b/0x0020_dynamic-conditionals/lwipopts.h deleted file mode 100644 index b7f0386..0000000 --- a/0x0020_dynamic-conditionals/lwipopts.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _LWIPOPTS_H -#define _LWIPOPTS_H - -#include "lwipopts_examples_common.h" - -/* TCP WND must be at least 16 kb to match TLS record size - or you will get a warning "altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!" */ -#undef TCP_WND -#define TCP_WND 16384 - -#define LWIP_ALTCP 1 -#define LWIP_ALTCP_TLS 1 -#define LWIP_ALTCP_TLS_MBEDTLS 1 - -#define LWIP_DEBUG 1 -#define ALTCP_MBEDTLS_DEBUG LWIP_DBG_ON - -#endif \ No newline at end of file diff --git a/0x0020_dynamic-conditionals/lwipopts_examples_common.h b/0x0020_dynamic-conditionals/lwipopts_examples_common.h deleted file mode 100644 index d6a2d02..0000000 --- a/0x0020_dynamic-conditionals/lwipopts_examples_common.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef _LWIPOPTS_EXAMPLE_COMMONH_H -#define _LWIPOPTS_EXAMPLE_COMMONH_H - -// Common settings used in most of the pico_w examples -// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details) - -// allow override in some examples -#ifndef NO_SYS -#define NO_SYS 1 -#endif -// allow override in some examples -#ifndef LWIP_SOCKET -#define LWIP_SOCKET 0 -#endif -#if PICO_CYW43_ARCH_POLL -#define MEM_LIBC_MALLOC 1 -#else -// MEM_LIBC_MALLOC is incompatible with non polling versions -#define MEM_LIBC_MALLOC 0 -#endif -#define MEM_ALIGNMENT 4 -#define MEM_SIZE 4000 -#define MEMP_NUM_TCP_SEG 32 -#define MEMP_NUM_ARP_QUEUE 10 -#define PBUF_POOL_SIZE 24 -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_ICMP 1 -#define LWIP_RAW 1 -#define TCP_WND (8 * TCP_MSS) -#define TCP_MSS 1460 -#define TCP_SND_BUF (8 * TCP_MSS) -#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS)) -#define LWIP_NETIF_STATUS_CALLBACK 1 -#define LWIP_NETIF_LINK_CALLBACK 1 -#define LWIP_NETIF_HOSTNAME 1 -#define LWIP_NETCONN 0 -#define MEM_STATS 0 -#define SYS_STATS 0 -#define MEMP_STATS 0 -#define LINK_STATS 0 -// #define ETH_PAD_SIZE 2 -#define LWIP_CHKSUM_ALGORITHM 3 -#define LWIP_DHCP 1 -#define LWIP_IPV4 1 -#define LWIP_TCP 1 -#define LWIP_UDP 1 -#define LWIP_DNS 1 -#define LWIP_TCP_KEEPALIVE 1 -#define LWIP_NETIF_TX_SINGLE_PBUF 1 -#define DHCP_DOES_ARP_CHECK 0 -#define LWIP_DHCP_DOES_ACD_CHECK 0 - -#ifndef NDEBUG -#define LWIP_DEBUG 1 -#define LWIP_STATS 1 -#define LWIP_STATS_DISPLAY 1 -#endif - -#define ETHARP_DEBUG LWIP_DBG_OFF -#define NETIF_DEBUG LWIP_DBG_OFF -#define PBUF_DEBUG LWIP_DBG_OFF -#define API_LIB_DEBUG LWIP_DBG_OFF -#define API_MSG_DEBUG LWIP_DBG_OFF -#define SOCKETS_DEBUG LWIP_DBG_OFF -#define ICMP_DEBUG LWIP_DBG_OFF -#define INET_DEBUG LWIP_DBG_OFF -#define IP_DEBUG LWIP_DBG_OFF -#define IP_REASS_DEBUG LWIP_DBG_OFF -#define RAW_DEBUG LWIP_DBG_OFF -#define MEM_DEBUG LWIP_DBG_OFF -#define MEMP_DEBUG LWIP_DBG_OFF -#define SYS_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF -#define TCP_INPUT_DEBUG LWIP_DBG_OFF -#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF -#define TCP_RTO_DEBUG LWIP_DBG_OFF -#define TCP_CWND_DEBUG LWIP_DBG_OFF -#define TCP_WND_DEBUG LWIP_DBG_OFF -#define TCP_FR_DEBUG LWIP_DBG_OFF -#define TCP_QLEN_DEBUG LWIP_DBG_OFF -#define TCP_RST_DEBUG LWIP_DBG_OFF -#define UDP_DEBUG LWIP_DBG_OFF -#define TCPIP_DEBUG LWIP_DBG_OFF -#define PPP_DEBUG LWIP_DBG_OFF -#define SLIP_DEBUG LWIP_DBG_OFF -#define DHCP_DEBUG LWIP_DBG_OFF - -#endif /* __LWIPOPTS_H__ */ \ No newline at end of file diff --git a/0x0020_dynamic-conditionals/main.c b/0x0020_dynamic-conditionals/main.c index eb0c680..b5a6ff9 100644 --- a/0x0020_dynamic-conditionals/main.c +++ b/0x0020_dynamic-conditionals/main.c @@ -1,14 +1,11 @@ #include #include "pico/stdlib.h" -#include "pico/cyw43_arch.h" #include "input.h" -#define FAV_NUM 42 #define ONE 0x31 #define TWO 0x32 -int main(void) -{ +int main(void) { stdio_init_all(); uart0_init(); @@ -16,6 +13,7 @@ int main(void) while (true) { choice = on_uart_rx(); + if (choice == ONE) { printf("1\r\n"); } else if (choice == TWO) { @@ -23,6 +21,7 @@ int main(void) } else { printf("??\r\n"); } + switch (choice) { case '1': printf("one\r\n"); diff --git a/0x0020_dynamic-conditionals/mbedtls_config.h b/0x0020_dynamic-conditionals/mbedtls_config.h deleted file mode 100644 index 83c9f48..0000000 --- a/0x0020_dynamic-conditionals/mbedtls_config.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Workaround for some mbedtls source files using INT_MAX without including limits.h */ -#include - -#define MBEDTLS_NO_PLATFORM_ENTROPY -#define MBEDTLS_ENTROPY_HARDWARE_ALT - -#define MBEDTLS_SSL_OUT_CONTENT_LEN 2048 - -#define MBEDTLS_ALLOW_PRIVATE_ACCESS -#define MBEDTLS_HAVE_TIME - -#define MBEDTLS_CIPHER_MODE_CBC -#define MBEDTLS_ECP_DP_SECP192R1_ENABLED -#define MBEDTLS_ECP_DP_SECP224R1_ENABLED -#define MBEDTLS_ECP_DP_SECP256R1_ENABLED -#define MBEDTLS_ECP_DP_SECP384R1_ENABLED -#define MBEDTLS_ECP_DP_SECP521R1_ENABLED -#define MBEDTLS_ECP_DP_SECP192K1_ENABLED -#define MBEDTLS_ECP_DP_SECP224K1_ENABLED -#define MBEDTLS_ECP_DP_SECP256K1_ENABLED -#define MBEDTLS_ECP_DP_BP256R1_ENABLED -#define MBEDTLS_ECP_DP_BP384R1_ENABLED -#define MBEDTLS_ECP_DP_BP512R1_ENABLED -#define MBEDTLS_ECP_DP_CURVE25519_ENABLED -#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED -#define MBEDTLS_PKCS1_V15 -#define MBEDTLS_SHA256_SMALLER -#define MBEDTLS_SSL_SERVER_NAME_INDICATION -#define MBEDTLS_AES_C -#define MBEDTLS_ASN1_PARSE_C -#define MBEDTLS_BIGNUM_C -#define MBEDTLS_CIPHER_C -#define MBEDTLS_CTR_DRBG_C -#define MBEDTLS_ENTROPY_C -#define MBEDTLS_ERROR_C -#define MBEDTLS_MD_C -#define MBEDTLS_MD5_C -#define MBEDTLS_OID_C -#define MBEDTLS_PKCS5_C -#define MBEDTLS_PK_C -#define MBEDTLS_PK_PARSE_C -#define MBEDTLS_PLATFORM_C -#define MBEDTLS_RSA_C -#define MBEDTLS_SHA1_C -#define MBEDTLS_SHA224_C -#define MBEDTLS_SHA256_C -#define MBEDTLS_SHA512_C -#define MBEDTLS_SSL_CLI_C -#define MBEDTLS_SSL_SRV_C -#define MBEDTLS_SSL_TLS_C -#define MBEDTLS_X509_CRT_PARSE_C -#define MBEDTLS_X509_USE_C -#define MBEDTLS_AES_FEWER_TABLES - -/* TLS 1.2 */ -#define MBEDTLS_SSL_PROTO_TLS1_2 -#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED -#define MBEDTLS_GCM_C -#define MBEDTLS_ECDH_C -#define MBEDTLS_ECP_C -#define MBEDTLS_ECDSA_C -#define MBEDTLS_ASN1_WRITE_C \ No newline at end of file diff --git a/0x0023_functions-wo-params-wo-return/.gitignore b/0x0023_functions-wo-params-wo-return/.gitignore index 6aa60eb..149d92e 100644 --- a/0x0023_functions-wo-params-wo-return/.gitignore +++ b/0x0023_functions-wo-params-wo-return/.gitignore @@ -1,7 +1,5 @@ .idea -.vscode _deps cmake-* build .DS_Store -*.pdf diff --git a/0x0023_functions-wo-params-wo-return/.vscode/.cortex-debug.peripherals.state.json b/0x0023_functions-wo-params-wo-return/.vscode/.cortex-debug.peripherals.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x0023_functions-wo-params-wo-return/.vscode/.cortex-debug.peripherals.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x0023_functions-wo-params-wo-return/.vscode/.cortex-debug.registers.state.json b/0x0023_functions-wo-params-wo-return/.vscode/.cortex-debug.registers.state.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/0x0023_functions-wo-params-wo-return/.vscode/.cortex-debug.registers.state.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/0x0023_functions-wo-params-wo-return/.vscode/c_cpp_properties.json b/0x0023_functions-wo-params-wo-return/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..ada839e --- /dev/null +++ b/0x0023_functions-wo-params-wo-return/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "Pico", + "includePath": [ + "${workspaceFolder}/**", + "${env:PICO_SDK_PATH}/**" + ], + "defines": [], + "compilerPath": "${env:PICO_INSTALL_PATH}/gcc-arm-none-eabi/bin/arm-none-eabi-gcc.exe", + "cStandard": "c11", + "cppStandard": "c++11", + "intelliSenseMode": "linux-gcc-arm", + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 +} diff --git a/0x0023_functions-wo-params-wo-return/.vscode/extensions.json b/0x0023_functions-wo-params-wo-return/.vscode/extensions.json new file mode 100644 index 0000000..03ba0af --- /dev/null +++ b/0x0023_functions-wo-params-wo-return/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "marus25.cortex-debug", + "ms-vscode.cmake-tools", + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "ms-vscode.vscode-serial-monitor" + ] +} diff --git a/0x0023_functions-wo-params-wo-return/.vscode/launch.json b/0x0023_functions-wo-params-wo-return/.vscode/launch.json new file mode 100644 index 0000000..2b22acf --- /dev/null +++ b/0x0023_functions-wo-params-wo-return/.vscode/launch.json @@ -0,0 +1,58 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Pico Debug (Cortex-Debug)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "openocd", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "configFiles": [ + "interface/cmsis-dap.cfg", + "target/rp2040.cfg" + ], + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main", + "openOCDLaunchCommands": [ + "adapter speed 1000" + ] + }, + { + "name": "Pico Debug (Cortex-Debug with external OpenOCD)", + "cwd": "${workspaceFolder}", + "executable": "${command:cmake.launchTargetPath}", + "request": "launch", + "type": "cortex-debug", + "servertype": "external", + "gdbTarget": "localhost:3333", + "gdbPath": "arm-none-eabi-gdb", + "device": "RP2040", + "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd", + "runToEntryPoint": "main" + }, + { + "name": "Pico Debug (C++ Debugger)", + "type": "cppdbg", + "request": "launch", + "cwd": "${workspaceFolder}", + "program": "${command:cmake.launchTargetPath}", + "MIMode": "gdb", + "miDebuggerPath": "arm-none-eabi-gdb", + "miDebuggerServerAddress": "localhost:3333", + "debugServerPath": "openocd", + "debugServerArgs": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 1000\"", + "serverStarted": "Listening on port .* for gdb connections", + "filterStderr": true, + "stopAtEntry": true, + "hardwareBreakpoints": { + "require": true, + "limit": 4 + }, + "preLaunchTask": "Flash", + "svdPath": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd" + } + ] +} diff --git a/0x0023_functions-wo-params-wo-return/.vscode/settings.json b/0x0023_functions-wo-params-wo-return/.vscode/settings.json new file mode 100644 index 0000000..8ad90e8 --- /dev/null +++ b/0x0023_functions-wo-params-wo-return/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + // These settings tweaks to the cmake plugin will ensure + // that you debug using cortex-debug instead of trying to launch + // a Pico binary on the host + "cmake.statusbar.advanced": { + "debug": { + "visibility": "hidden" + }, + "launch": { + "visibility": "hidden" + }, + "build": { + "visibility": "hidden" + }, + "buildTarget": { + "visibility": "hidden" + } + }, + "cmake.buildBeforeRun": true, + "cmake.configureOnOpen": true, + "cmake.configureSettings": { + "CMAKE_MODULE_PATH": "${env:PICO_INSTALL_PATH}/pico-sdk-tools" + }, + "cmake.generator": "Ninja", + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", + "C_Cpp.errorSquiggles": "enabled", + "files.associations": { + "stdlib.h": "c" + } +} diff --git a/0x0023_functions-wo-params-wo-return/.vscode/tasks.json b/0x0023_functions-wo-params-wo-return/.vscode/tasks.json new file mode 100644 index 0000000..a437c2f --- /dev/null +++ b/0x0023_functions-wo-params-wo-return/.vscode/tasks.json @@ -0,0 +1,29 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Flash", + "type": "shell", + "command": "openocd", + "args": [ + "-f", + "interface/cmsis-dap.cfg", + "-f", + "target/rp2040.cfg", + "-c", + "adapter speed 1000; program {${command:cmake.launchTargetPath}} verify reset exit" + ], + "problemMatcher": [] + }, + { + "label": "Build", + "type": "cmake", + "command": "build", + "problemMatcher": "$gcc", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/0x0023_functions-wo-params-wo-return/CMakeLists.txt b/0x0023_functions-wo-params-wo-return/CMakeLists.txt index a3ab608..e6f5c30 100644 --- a/0x0023_functions-wo-params-wo-return/CMakeLists.txt +++ b/0x0023_functions-wo-params-wo-return/CMakeLists.txt @@ -1,57 +1,21 @@ cmake_minimum_required(VERSION 3.13) -set(PICO_BOARD pico_w) - include(pico_sdk_import.cmake) - -project(0x0023_functions-wo-params-wo-return C CXX ASM) +project(0x0023_functions-wo-params-wo-return C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) pico_sdk_init() -if (PICO_CYW43_SUPPORTED) # set by PICO_BOARD=pico_w - if (NOT TARGET pico_cyw43_arch) - message("Skipping Pico W examples as support is not available") - else() +add_executable(0x0023_functions-wo-params-wo-return + main.c +) - if (DEFINED ENV{WIFI_SSID} AND (NOT WIFI_SSID)) - set(WIFI_SSID $ENV{WIFI_SSID}) - message("Using WIFI_SSID from environment ('${WIFI_SSID}')") - endif() - - if (DEFINED ENV{WIFI_PASSWORD} AND (NOT WIFI_PASSWORD)) - set(WIFI_PASSWORD $ENV{WIFI_PASSWORD}) - message("Using WIFI_PASSWORD from environment") - endif() - - set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID for examples") - set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi password for examples") - endif() -endif() - -set(WIFI_SSID "${WIFI_SSID}" CACHE INTERNAL "WiFi SSID") -set(WIFI_PASSWORD "${WIFI_PASSWORD}" CACHE INTERNAL "WiFi PASSWORD") - -add_executable(0x0023_functions-wo-params-wo-return - main.c - ) -target_compile_definitions(0x0023_functions-wo-params-wo-return PRIVATE - WIFI_SSID=\"${WIFI_SSID}\" - WIFI_PASSWORD=\"${WIFI_PASSWORD}\" - ) -target_include_directories(0x0023_functions-wo-params-wo-return PRIVATE - ${CMAKE_CURRENT_LIST_DIR} - ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts - ) -target_link_libraries(0x0023_functions-wo-params-wo-return - pico_cyw43_arch_lwip_threadsafe_background - pico_lwip_mbedtls - pico_mbedtls - pico_stdlib - ) - -pico_enable_stdio_usb(0x0023_functions-wo-params-wo-return 0) -pico_enable_stdio_uart(0x0023_functions-wo-params-wo-return 1) +pico_enable_stdio_usb(0x0023_functions-wo-params-wo-return 1) +pico_enable_stdio_uart(0x0023_functions-wo-params-wo-return 1) pico_add_extra_outputs(0x0023_functions-wo-params-wo-return) + +target_link_libraries(0x0023_functions-wo-params-wo-return + pico_stdlib +) diff --git a/0x0023_functions-wo-params-wo-return/lwipopts.h b/0x0023_functions-wo-params-wo-return/lwipopts.h deleted file mode 100644 index b7f0386..0000000 --- a/0x0023_functions-wo-params-wo-return/lwipopts.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _LWIPOPTS_H -#define _LWIPOPTS_H - -#include "lwipopts_examples_common.h" - -/* TCP WND must be at least 16 kb to match TLS record size - or you will get a warning "altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!" */ -#undef TCP_WND -#define TCP_WND 16384 - -#define LWIP_ALTCP 1 -#define LWIP_ALTCP_TLS 1 -#define LWIP_ALTCP_TLS_MBEDTLS 1 - -#define LWIP_DEBUG 1 -#define ALTCP_MBEDTLS_DEBUG LWIP_DBG_ON - -#endif \ No newline at end of file diff --git a/0x0023_functions-wo-params-wo-return/lwipopts_examples_common.h b/0x0023_functions-wo-params-wo-return/lwipopts_examples_common.h deleted file mode 100644 index d6a2d02..0000000 --- a/0x0023_functions-wo-params-wo-return/lwipopts_examples_common.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef _LWIPOPTS_EXAMPLE_COMMONH_H -#define _LWIPOPTS_EXAMPLE_COMMONH_H - -// Common settings used in most of the pico_w examples -// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details) - -// allow override in some examples -#ifndef NO_SYS -#define NO_SYS 1 -#endif -// allow override in some examples -#ifndef LWIP_SOCKET -#define LWIP_SOCKET 0 -#endif -#if PICO_CYW43_ARCH_POLL -#define MEM_LIBC_MALLOC 1 -#else -// MEM_LIBC_MALLOC is incompatible with non polling versions -#define MEM_LIBC_MALLOC 0 -#endif -#define MEM_ALIGNMENT 4 -#define MEM_SIZE 4000 -#define MEMP_NUM_TCP_SEG 32 -#define MEMP_NUM_ARP_QUEUE 10 -#define PBUF_POOL_SIZE 24 -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_ICMP 1 -#define LWIP_RAW 1 -#define TCP_WND (8 * TCP_MSS) -#define TCP_MSS 1460 -#define TCP_SND_BUF (8 * TCP_MSS) -#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS)) -#define LWIP_NETIF_STATUS_CALLBACK 1 -#define LWIP_NETIF_LINK_CALLBACK 1 -#define LWIP_NETIF_HOSTNAME 1 -#define LWIP_NETCONN 0 -#define MEM_STATS 0 -#define SYS_STATS 0 -#define MEMP_STATS 0 -#define LINK_STATS 0 -// #define ETH_PAD_SIZE 2 -#define LWIP_CHKSUM_ALGORITHM 3 -#define LWIP_DHCP 1 -#define LWIP_IPV4 1 -#define LWIP_TCP 1 -#define LWIP_UDP 1 -#define LWIP_DNS 1 -#define LWIP_TCP_KEEPALIVE 1 -#define LWIP_NETIF_TX_SINGLE_PBUF 1 -#define DHCP_DOES_ARP_CHECK 0 -#define LWIP_DHCP_DOES_ACD_CHECK 0 - -#ifndef NDEBUG -#define LWIP_DEBUG 1 -#define LWIP_STATS 1 -#define LWIP_STATS_DISPLAY 1 -#endif - -#define ETHARP_DEBUG LWIP_DBG_OFF -#define NETIF_DEBUG LWIP_DBG_OFF -#define PBUF_DEBUG LWIP_DBG_OFF -#define API_LIB_DEBUG LWIP_DBG_OFF -#define API_MSG_DEBUG LWIP_DBG_OFF -#define SOCKETS_DEBUG LWIP_DBG_OFF -#define ICMP_DEBUG LWIP_DBG_OFF -#define INET_DEBUG LWIP_DBG_OFF -#define IP_DEBUG LWIP_DBG_OFF -#define IP_REASS_DEBUG LWIP_DBG_OFF -#define RAW_DEBUG LWIP_DBG_OFF -#define MEM_DEBUG LWIP_DBG_OFF -#define MEMP_DEBUG LWIP_DBG_OFF -#define SYS_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF -#define TCP_INPUT_DEBUG LWIP_DBG_OFF -#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF -#define TCP_RTO_DEBUG LWIP_DBG_OFF -#define TCP_CWND_DEBUG LWIP_DBG_OFF -#define TCP_WND_DEBUG LWIP_DBG_OFF -#define TCP_FR_DEBUG LWIP_DBG_OFF -#define TCP_QLEN_DEBUG LWIP_DBG_OFF -#define TCP_RST_DEBUG LWIP_DBG_OFF -#define UDP_DEBUG LWIP_DBG_OFF -#define TCPIP_DEBUG LWIP_DBG_OFF -#define PPP_DEBUG LWIP_DBG_OFF -#define SLIP_DEBUG LWIP_DBG_OFF -#define DHCP_DEBUG LWIP_DBG_OFF - -#endif /* __LWIPOPTS_H__ */ \ No newline at end of file diff --git a/0x0023_functions-wo-params-wo-return/main.c b/0x0023_functions-wo-params-wo-return/main.c index 362130f..a1c6eb7 100644 --- a/0x0023_functions-wo-params-wo-return/main.c +++ b/0x0023_functions-wo-params-wo-return/main.c @@ -1,22 +1,17 @@ #include #include "pico/stdlib.h" -#include "pico/cyw43_arch.h" #define FAV_NUM 42 void print_me(void); -int main(void) -{ +int main(void) { stdio_init_all(); while (true) - { print_me(); - } } -void print_me(void) -{ +void print_me(void) { printf("FAV_NUM: %d\r\n", FAV_NUM); } diff --git a/0x0023_functions-wo-params-wo-return/mbedtls_config.h b/0x0023_functions-wo-params-wo-return/mbedtls_config.h deleted file mode 100644 index 83c9f48..0000000 --- a/0x0023_functions-wo-params-wo-return/mbedtls_config.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Workaround for some mbedtls source files using INT_MAX without including limits.h */ -#include - -#define MBEDTLS_NO_PLATFORM_ENTROPY -#define MBEDTLS_ENTROPY_HARDWARE_ALT - -#define MBEDTLS_SSL_OUT_CONTENT_LEN 2048 - -#define MBEDTLS_ALLOW_PRIVATE_ACCESS -#define MBEDTLS_HAVE_TIME - -#define MBEDTLS_CIPHER_MODE_CBC -#define MBEDTLS_ECP_DP_SECP192R1_ENABLED -#define MBEDTLS_ECP_DP_SECP224R1_ENABLED -#define MBEDTLS_ECP_DP_SECP256R1_ENABLED -#define MBEDTLS_ECP_DP_SECP384R1_ENABLED -#define MBEDTLS_ECP_DP_SECP521R1_ENABLED -#define MBEDTLS_ECP_DP_SECP192K1_ENABLED -#define MBEDTLS_ECP_DP_SECP224K1_ENABLED -#define MBEDTLS_ECP_DP_SECP256K1_ENABLED -#define MBEDTLS_ECP_DP_BP256R1_ENABLED -#define MBEDTLS_ECP_DP_BP384R1_ENABLED -#define MBEDTLS_ECP_DP_BP512R1_ENABLED -#define MBEDTLS_ECP_DP_CURVE25519_ENABLED -#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED -#define MBEDTLS_PKCS1_V15 -#define MBEDTLS_SHA256_SMALLER -#define MBEDTLS_SSL_SERVER_NAME_INDICATION -#define MBEDTLS_AES_C -#define MBEDTLS_ASN1_PARSE_C -#define MBEDTLS_BIGNUM_C -#define MBEDTLS_CIPHER_C -#define MBEDTLS_CTR_DRBG_C -#define MBEDTLS_ENTROPY_C -#define MBEDTLS_ERROR_C -#define MBEDTLS_MD_C -#define MBEDTLS_MD5_C -#define MBEDTLS_OID_C -#define MBEDTLS_PKCS5_C -#define MBEDTLS_PK_C -#define MBEDTLS_PK_PARSE_C -#define MBEDTLS_PLATFORM_C -#define MBEDTLS_RSA_C -#define MBEDTLS_SHA1_C -#define MBEDTLS_SHA224_C -#define MBEDTLS_SHA256_C -#define MBEDTLS_SHA512_C -#define MBEDTLS_SSL_CLI_C -#define MBEDTLS_SSL_SRV_C -#define MBEDTLS_SSL_TLS_C -#define MBEDTLS_X509_CRT_PARSE_C -#define MBEDTLS_X509_USE_C -#define MBEDTLS_AES_FEWER_TABLES - -/* TLS 1.2 */ -#define MBEDTLS_SSL_PROTO_TLS1_2 -#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED -#define MBEDTLS_GCM_C -#define MBEDTLS_ECDH_C -#define MBEDTLS_ECP_C -#define MBEDTLS_ECDSA_C -#define MBEDTLS_ASN1_WRITE_C \ No newline at end of file diff --git a/DDI0419E_armv6m_arm.pdf b/DDI0419E_armv6m_arm.pdf deleted file mode 100644 index 77abc4a..0000000 Binary files a/DDI0419E_armv6m_arm.pdf and /dev/null differ diff --git a/DDI0484C_cortex_m0p_r0p1_trm.pdf b/DDI0484C_cortex_m0p_r0p1_trm.pdf deleted file mode 100644 index 4fab359..0000000 Binary files a/DDI0484C_cortex_m0p_r0p1_trm.pdf and /dev/null differ diff --git a/Embedded-Hacking.pdf b/Embedded-Hacking.pdf index 03ec2b7..863abf8 100644 Binary files a/Embedded-Hacking.pdf and b/Embedded-Hacking.pdf differ diff --git a/LoRa_AT_Command_RYLR998_RYLR498.pdf b/LoRa_AT_Command_RYLR998_RYLR498.pdf new file mode 100644 index 0000000..ce73fa2 Binary files /dev/null and b/LoRa_AT_Command_RYLR998_RYLR498.pdf differ diff --git a/RYLR998_Datasheet.pdf b/RYLR998_Datasheet.pdf new file mode 100644 index 0000000..ea9796d Binary files /dev/null and b/RYLR998_Datasheet.pdf differ diff --git a/connecting-to-the-internet-with-pico-w.pdf b/connecting-to-the-internet-with-pico-w.pdf deleted file mode 100644 index cf738a1..0000000 Binary files a/connecting-to-the-internet-with-pico-w.pdf and /dev/null differ diff --git a/hm11-datasheet.pdf b/hm11-datasheet.pdf new file mode 100644 index 0000000..5bf54da Binary files /dev/null and b/hm11-datasheet.pdf differ diff --git a/nrf24l01-datasheet.pdf b/nrf24l01-datasheet.pdf new file mode 100644 index 0000000..6e5b308 Binary files /dev/null and b/nrf24l01-datasheet.pdf differ diff --git a/pico-w-datasheet.pdf b/pico-w-datasheet.pdf deleted file mode 100644 index 5ba7334..0000000 Binary files a/pico-w-datasheet.pdf and /dev/null differ diff --git a/ssd1306-datasheet.pdf b/ssd1306-datasheet.pdf new file mode 100644 index 0000000..c179409 Binary files /dev/null and b/ssd1306-datasheet.pdf differ diff --git a/ws2812b-datasheet.pdf b/ws2812b-datasheet.pdf new file mode 100644 index 0000000..322cfed Binary files /dev/null and b/ws2812b-datasheet.pdf differ