remove FreeRTOS dependency from STM32 build; disable debugging to preserve FLASH space

LittleFS mutex routines are stubs and malloc()/free() are the stdlib
versions
This commit is contained in:
Daniel Peter Chokola 2025-02-16 15:54:53 -05:00
parent 8455defa7a
commit 694f012dd0
6 changed files with 10 additions and 16 deletions

View File

@ -9,7 +9,6 @@ build_type = release
build_flags = build_flags =
${arduino_base.build_flags} ${arduino_base.build_flags}
-Wl,--undefined=vTaskSwitchContext
-flto -flto
-Isrc/platform/stm32wl -g -Isrc/platform/stm32wl -g
-DMESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR -DMESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
@ -21,7 +20,7 @@ build_flags =
-DMESHTASTIC_EXCLUDE_BLUETOOTH -DMESHTASTIC_EXCLUDE_BLUETOOTH
-DMESHTASTIC_EXCLUDE_PKI -DMESHTASTIC_EXCLUDE_PKI
-DMESHTASTIC_EXCLUDE_GPS -DMESHTASTIC_EXCLUDE_GPS
-DconfigUSE_CMSIS_RTOS_V2=1 -DDEBUG_MUTE
-fmerge-all-constants -fmerge-all-constants
-ffunction-sections -ffunction-sections
-fdata-sections -fdata-sections
@ -31,11 +30,11 @@ build_src_filter =
board_upload.offset_address = 0x08000000 board_upload.offset_address = 0x08000000
upload_protocol = stlink upload_protocol = stlink
debug_tool = stlink
lib_deps = lib_deps =
${env.lib_deps} ${env.lib_deps}
${radiolib_base.lib_deps} ${radiolib_base.lib_deps}
stm32duino/STM32duino FreeRTOS@^10.3.2
https://github.com/caveman99/Crypto.git#eae9c768054118a9399690f8af202853d1ae8516 https://github.com/caveman99/Crypto.git#eae9c768054118a9399690f8af202853d1ae8516
lib_ignore = lib_ignore =

View File

@ -12,7 +12,7 @@
#include <freertos/task.h> #include <freertos/task.h>
#endif #endif
#if defined(ARDUINO_NRF52_ADAFRUIT) || defined(ARDUINO_ARCH_RP2040) || defined(STM32WLE5xx) #if defined(ARDUINO_NRF52_ADAFRUIT) || defined(ARDUINO_ARCH_RP2040)
#define HAS_FREE_RTOS #define HAS_FREE_RTOS
#include <FreeRTOS.h> #include <FreeRTOS.h>

View File

@ -42,7 +42,6 @@ STM32_LittleFS::STM32_LittleFS(struct lfs_config *cfg)
varclr(&_lfs); varclr(&_lfs);
_lfs_cfg = cfg; _lfs_cfg = cfg;
_mounted = false; _mounted = false;
_mutex = xSemaphoreCreateMutexStatic(&this->_MutexStorageSpace);
} }
STM32_LittleFS::~STM32_LittleFS() {} STM32_LittleFS::~STM32_LittleFS() {}

View File

@ -76,17 +76,13 @@ class STM32_LittleFS
* code. User should not call these directly * code. User should not call these directly
*------------------------------------------------------------------*/ *------------------------------------------------------------------*/
lfs_t *_getFS(void) { return &_lfs; } lfs_t *_getFS(void) { return &_lfs; }
void _lockFS(void) { xSemaphoreTake(_mutex, portMAX_DELAY); } void _lockFS(void) { /* no-op */ }
void _unlockFS(void) { xSemaphoreGive(_mutex); } void _unlockFS(void) { /* no-op */ }
protected: protected:
bool _mounted; bool _mounted;
struct lfs_config *_lfs_cfg; struct lfs_config *_lfs_cfg;
lfs_t _lfs; lfs_t _lfs;
SemaphoreHandle_t _mutex;
private:
StaticSemaphore_t _MutexStorageSpace;
}; };
#if !CFG_DEBUG #if !CFG_DEBUG

View File

@ -174,8 +174,7 @@ void lfs_crc(uint32_t *crc, const void *buffer, size_t size);
static inline void *lfs_malloc(size_t size) static inline void *lfs_malloc(size_t size)
{ {
#ifndef LFS_NO_MALLOC #ifndef LFS_NO_MALLOC
extern void *pvPortMalloc(size_t xWantedSize); return malloc(size);
return pvPortMalloc(size);
#else #else
(void)size; (void)size;
return NULL; return NULL;
@ -186,8 +185,7 @@ static inline void *lfs_malloc(size_t size)
static inline void lfs_free(void *p) static inline void lfs_free(void *p)
{ {
#ifndef LFS_NO_MALLOC #ifndef LFS_NO_MALLOC
extern void vPortFree(void *pv); free(p);
vPortFree(p);
#else #else
(void)p; (void)p;
#endif #endif

View File

@ -21,6 +21,8 @@ build_flags =
-DMESHTASTIC_EXCLUDE_SCREEN=1 -DMESHTASTIC_EXCLUDE_SCREEN=1
-DMESHTASTIC_EXCLUDE_MQTT=1 -DMESHTASTIC_EXCLUDE_MQTT=1
-DMESHTASTIC_EXCLUDE_POWERMON=1 -DMESHTASTIC_EXCLUDE_POWERMON=1
-DPIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF -DMESHTASTIC_EXCLUDE_PKI
;-DPIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF
;-DCFG_DEBUG
upload_port = stlink upload_port = stlink