From c0bb58147975b1d05bad1e1afa2c038f9dc3e7f0 Mon Sep 17 00:00:00 2001 From: Gregory Neverov <42853258+gneverov@users.noreply.github.com> Date: Wed, 15 Feb 2023 17:22:54 -0800 Subject: [PATCH] debug build improvements --- ports/raspberrypi/Makefile | 2 +- .../boards/raspberry_pi_pico_w/mpconfigboard.h | 1 + .../boards/raspberry_pi_pico_w/mpconfigboard.mk | 1 + ports/raspberrypi/common-hal/wifi/Monitor.h | 9 +++++---- ports/raspberrypi/common-hal/wifi/Network.h | 4 ++++ ports/raspberrypi/common-hal/wifi/Radio.h | 4 ++++ ports/raspberrypi/common-hal/wifi/ScannedNetworks.h | 4 ++++ ports/raspberrypi/common-hal/wifi/__init__.h | 4 ++++ shared-module/bitbangio/I2C.h | 4 ++++ shared-module/bitbangio/SPI.h | 4 ++++ shared-module/os/__init__.h | 4 ++++ supervisor/shared/web_workflow/web_workflow.c | 7 ------- 12 files changed, 36 insertions(+), 12 deletions(-) diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index ee0356b85244c..b88e190b3dc3f 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -160,7 +160,7 @@ CFLAGS += $(OPTIMIZATION_FLAGS) CFLAGS += $(CFLAGS_CYW43) #Debugging/Optimization ifeq ($(DEBUG), 1) - CFLAGS += -ggdb3 -O3 + CFLAGS += -ggdb3 -O1 # No LTO because we may place some functions in RAM instead of flash. else CFLAGS += -DNDEBUG diff --git a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h index a31ee7327c0a2..54b3c6b487ea8 100644 --- a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h +++ b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h @@ -5,6 +5,7 @@ #define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (1) #define MICROPY_HW_LED_STATUS (&pin_CYW0) +#define MICROPY_PY_COLLECTIONS_DEQUE (1) #define CIRCUITPY_BOARD_I2C (1) #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO5, .sda = &pin_GPIO4}} diff --git a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.mk b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.mk index a0503915058ee..287670d79541a 100644 --- a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.mk +++ b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.mk @@ -15,6 +15,7 @@ CIRCUITPY_SSL = 1 CIRCUITPY_SSL_MBEDTLS = 1 CIRCUITPY_HASHLIB = 1 CIRCUITPY_WEB_WORKFLOW = 1 +CIRCUITPY_OS_GETENV = 1 CIRCUITPY_MDNS = 1 CIRCUITPY_SOCKETPOOL = 1 CIRCUITPY_WIFI = 1 diff --git a/ports/raspberrypi/common-hal/wifi/Monitor.h b/ports/raspberrypi/common-hal/wifi/Monitor.h index 14ee685bbd594..67cb25984c61a 100644 --- a/ports/raspberrypi/common-hal/wifi/Monitor.h +++ b/ports/raspberrypi/common-hal/wifi/Monitor.h @@ -25,8 +25,11 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_WIFI_MONITOR_H -#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_WIFI_MONITOR_H +#pragma once + +#if !CIRCUITPY_WIFI +#error wifi not in build +#endif #include "py/obj.h" @@ -36,5 +39,3 @@ typedef struct { size_t lost; size_t queue_length; } wifi_monitor_obj_t; - -#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_WIFI_MONITOR_H diff --git a/ports/raspberrypi/common-hal/wifi/Network.h b/ports/raspberrypi/common-hal/wifi/Network.h index 8e4e7bd310e82..3393c1e980898 100644 --- a/ports/raspberrypi/common-hal/wifi/Network.h +++ b/ports/raspberrypi/common-hal/wifi/Network.h @@ -26,6 +26,10 @@ #pragma once +#if !CIRCUITPY_WIFI +#error wifi not in build +#endif + #include "py/obj.h" #include "pico/cyw43_arch.h" diff --git a/ports/raspberrypi/common-hal/wifi/Radio.h b/ports/raspberrypi/common-hal/wifi/Radio.h index a4125fe7ba3a9..19fb28359f1b6 100644 --- a/ports/raspberrypi/common-hal/wifi/Radio.h +++ b/ports/raspberrypi/common-hal/wifi/Radio.h @@ -26,6 +26,10 @@ #pragma once +#if !CIRCUITPY_WIFI +#error wifi not in build +#endif + #include "py/obj.h" #include "shared-bindings/wifi/ScannedNetworks.h" diff --git a/ports/raspberrypi/common-hal/wifi/ScannedNetworks.h b/ports/raspberrypi/common-hal/wifi/ScannedNetworks.h index eae783ca4e568..e386b6a768935 100644 --- a/ports/raspberrypi/common-hal/wifi/ScannedNetworks.h +++ b/ports/raspberrypi/common-hal/wifi/ScannedNetworks.h @@ -27,6 +27,10 @@ #pragma once +#if !CIRCUITPY_WIFI +#error wifi not in build +#endif + #include #include "py/obj.h" diff --git a/ports/raspberrypi/common-hal/wifi/__init__.h b/ports/raspberrypi/common-hal/wifi/__init__.h index d34d6310893da..f14b466b748f4 100644 --- a/ports/raspberrypi/common-hal/wifi/__init__.h +++ b/ports/raspberrypi/common-hal/wifi/__init__.h @@ -26,6 +26,10 @@ #pragma once +#if !CIRCUITPY_WIFI +#error wifi not in build +#endif + #include "py/obj.h" #include "py/mpconfig.h" #include "lwip/ip_addr.h" diff --git a/shared-module/bitbangio/I2C.h b/shared-module/bitbangio/I2C.h index 763c03adc6563..08e531fa207ac 100644 --- a/shared-module/bitbangio/I2C.h +++ b/shared-module/bitbangio/I2C.h @@ -27,6 +27,10 @@ #ifndef MICROPY_INCLUDED_SHARED_MODULE_BITBANGIO_I2C_H #define MICROPY_INCLUDED_SHARED_MODULE_BITBANGIO_I2C_H +#if !CIRCUITPY_BITBANGIO +#error bitbangio not in build +#endif + #include "common-hal/digitalio/DigitalInOut.h" #include "py/obj.h" diff --git a/shared-module/bitbangio/SPI.h b/shared-module/bitbangio/SPI.h index cc71a0319a8ce..5d937daf01f31 100644 --- a/shared-module/bitbangio/SPI.h +++ b/shared-module/bitbangio/SPI.h @@ -27,6 +27,10 @@ #ifndef MICROPY_INCLUDED_SHARED_MODULE_BITBANGIO_SPI_H #define MICROPY_INCLUDED_SHARED_MODULE_BITBANGIO_SPI_H +#if (!CIRCUITPY_BITBANGIO) && (!CIRCUITPY_BUSIO_SPI) +#error bitbangio not in build +#endif + #include "common-hal/digitalio/DigitalInOut.h" #include "py/obj.h" diff --git a/shared-module/os/__init__.h b/shared-module/os/__init__.h index 1b18a1f4b96ee..c5534be7e1bd6 100644 --- a/shared-module/os/__init__.h +++ b/shared-module/os/__init__.h @@ -26,6 +26,10 @@ #pragma once +#if !CIRCUITPY_OS_GETENV +#error os_getenv not in build +#endif + typedef enum { GETENV_OK = 0, GETENV_ERR_OPEN, diff --git a/supervisor/shared/web_workflow/web_workflow.c b/supervisor/shared/web_workflow/web_workflow.c index 97530b970ba1c..b300707ea2825 100644 --- a/supervisor/shared/web_workflow/web_workflow.c +++ b/supervisor/shared/web_workflow/web_workflow.c @@ -60,13 +60,9 @@ #include "shared-bindings/socketpool/Socket.h" #include "shared-bindings/socketpool/SocketPool.h" -#if CIRCUITPY_WIFI #include "shared-bindings/wifi/__init__.h" -#endif -#if CIRCUITPY_OS_GETENV #include "shared-module/os/__init__.h" -#endif enum request_state { STATE_METHOD, @@ -254,8 +250,6 @@ void supervisor_web_workflow_status(void) { #endif void supervisor_start_web_workflow(void) { - #if CIRCUITPY_WEB_WORKFLOW && CIRCUITPY_WIFI && CIRCUITPY_OS_GETENV - // Skip starting the workflow if we're not starting from power on or reset. const mcu_reset_reason_t reset_reason = common_hal_mcu_processor_get_reset_reason(); if (reset_reason != RESET_REASON_POWER_ON && @@ -353,7 +347,6 @@ void supervisor_start_web_workflow(void) { _api_password[0] = ':'; _base64_in_place(_api_password, strlen(_api_password), sizeof(_api_password) - 1); } - #endif } void web_workflow_send_raw(socketpool_socket_obj_t *socket, const uint8_t *buf, int len) {