From 0e3a782aa524b751aeb37b1996f0f72d48f49cf7 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Tue, 30 Sep 2025 13:12:17 +0200 Subject: [PATCH 1/2] pbio/platform/ev3: Enable more storage and heap. This bare metal EV3 version has more resources than we know what to do with. We'll start with relatively small values, about four times as much as SPIKE Prime has. --- lib/pbio/platform/ev3/pbdrvconfig.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pbio/platform/ev3/pbdrvconfig.h b/lib/pbio/platform/ev3/pbdrvconfig.h index 020d59f04..0476dfecb 100644 --- a/lib/pbio/platform/ev3/pbdrvconfig.h +++ b/lib/pbio/platform/ev3/pbdrvconfig.h @@ -29,11 +29,11 @@ #define PBDRV_CONFIG_BATTERY_EV3 (1) #define PBDRV_CONFIG_BLOCK_DEVICE (1) -#define PBDRV_CONFIG_BLOCK_DEVICE_RAM_SIZE (10 * 1024) +#define PBDRV_CONFIG_BLOCK_DEVICE_RAM_SIZE (1 * 1024 * 1024) #define PBDRV_CONFIG_BLOCK_DEVICE_EV3 (1) -#define PBDRV_CONFIG_BLOCK_DEVICE_EV3_SIZE (8 * 1024) // TBD, can be a few MB +#define PBDRV_CONFIG_BLOCK_DEVICE_EV3_SIZE (1 * 1024 * 1024 * 3 / 4) #define PBDRV_CONFIG_BLOCK_DEVICE_EV3_SIZE_USER (512) -#define PBDRV_CONFIG_BLOCK_DEVICE_EV3_START_ADDRESS (10 * 1024 * 1024) // TBD +#define PBDRV_CONFIG_BLOCK_DEVICE_EV3_START_ADDRESS (10 * 1024 * 1024) #define PBDRV_CONFIG_IOPORT (1) #define PBDRV_CONFIG_IOPORT_HAS_ADC (1) From aae64625928edc196c5dec23efca32b17592ad0a Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Tue, 30 Sep 2025 21:52:17 +0200 Subject: [PATCH 2/2] pbio/drv/config: Fix broken size check. This still applies, but there is no longer a cross platform way to check it. --- lib/pbio/drv/block_device/block_device_ev3.c | 4 ++++ lib/pbio/drv/block_device/block_device_flash_stm32.c | 4 ++++ lib/pbio/drv/block_device/block_device_w25qxx_stm32.c | 4 ++++ lib/pbio/include/pbdrv/config.h | 7 ------- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/pbio/drv/block_device/block_device_ev3.c b/lib/pbio/drv/block_device/block_device_ev3.c index 0c8ce340d..6e67bea04 100644 --- a/lib/pbio/drv/block_device/block_device_ev3.c +++ b/lib/pbio/drv/block_device/block_device_ev3.c @@ -16,6 +16,10 @@ #if PBDRV_CONFIG_BLOCK_DEVICE_EV3 +#if PBDRV_CONFIG_BLOCK_DEVICE_RAM_SIZE < PBDRV_CONFIG_BLOCK_DEVICE_EV3_SIZE + 2048 +#error "Application RAM not big enough." +#endif + #include #include #include diff --git a/lib/pbio/drv/block_device/block_device_flash_stm32.c b/lib/pbio/drv/block_device/block_device_flash_stm32.c index c6af571c9..92ba51105 100644 --- a/lib/pbio/drv/block_device/block_device_flash_stm32.c +++ b/lib/pbio/drv/block_device/block_device_flash_stm32.c @@ -7,6 +7,10 @@ #if PBDRV_CONFIG_BLOCK_DEVICE_FLASH_STM32 +#if PBDRV_CONFIG_BLOCK_DEVICE_RAM_SIZE < PBDRV_CONFIG_BLOCK_DEVICE_FLASH_STM32_SIZE + 2048 +#error "Application RAM not big enough." +#endif + #include #include diff --git a/lib/pbio/drv/block_device/block_device_w25qxx_stm32.c b/lib/pbio/drv/block_device/block_device_w25qxx_stm32.c index 720e067d5..73a3f41fe 100644 --- a/lib/pbio/drv/block_device/block_device_w25qxx_stm32.c +++ b/lib/pbio/drv/block_device/block_device_w25qxx_stm32.c @@ -7,6 +7,10 @@ #if PBDRV_CONFIG_BLOCK_DEVICE_W25QXX_STM32 +#if PBDRV_CONFIG_BLOCK_DEVICE_RAM_SIZE < PBDRV_CONFIG_BLOCK_DEVICE_W25QXX_STM32_SIZE + 2048 +#error "Application RAM not big enough." +#endif + #include #include #include diff --git a/lib/pbio/include/pbdrv/config.h b/lib/pbio/include/pbdrv/config.h index c8ca90ea5..43135c34e 100644 --- a/lib/pbio/include/pbdrv/config.h +++ b/lib/pbio/include/pbdrv/config.h @@ -57,11 +57,4 @@ #define PBDRV_CONFIG_HAS_PORT_4 (0) #endif -#if PBDRV_CONFIG_BLOCK_DEVICE -// Application RAM must enough to load ROM and still do something useful. -#if PBDRV_CONFIG_BLOCK_DEVICE_RAM_SIZE < PBDRV_CONFIG_BLOCK_DEVICE_ROM_SIZE + 2048 -#error "Application RAM must be at least ROM size + 2K." -#endif -#endif - #endif // _PBDRV_CONFIG_H_