refactor: migrate MICRO_PIP to fine-grained feature flags

Replace monolithic MICRO_PIP/PIP_MICRO with granular flags:

Feature flags (CMake options + platform auto-detection):
- PIP_NO_FILESYSTEM, PIP_NO_THREADS, PIP_NO_SOCKET
- PIP_NO_PROCESS, PIP_NO_DYNLIB, PIP_NO_FFT, PIP_NO_SERIAL

Embedded optimization flag:
- PIP_EMBEDDED (auto-set for Pico SDK and FreeRTOS)
  Controls buffer sizes, time stubs, terminal fallback, init stubs

Platform blocks in CMakeLists.txt:
- Pico SDK: auto-disables FS, PROCESS, DYNLIB, FFT, SERIAL;
  conditionally disables THREADS (no FreeRTOS) and SOCKET (no LWIP)
- FreeRTOS: auto-disables FS, PROCESS, DYNLIB, FFT, SERIAL;
  conditionally disables SOCKET (no LWIP)
- Android: auto-disables PROCESS, DYNLIB, FFT

Updated 96 files across libs/, utils/, tests/, and CMakeLists.txt.
Builds verified for Linux (547 tests pass) and Pico SDK (100%).
Removed all MICRO_PIP and PIP_MICRO references (0 remaining).
This commit is contained in:
2026-08-11 14:34:59 +03:00
parent 87c53d45a4
commit 4d8b743075
97 changed files with 1555 additions and 914 deletions
+18 -5
View File
@@ -22,7 +22,7 @@
#include "piconditionvar.h"
#include "pithread.h"
#include "pitime.h"
#ifndef MICRO_PIP
#ifndef PIP_NO_THREADS
# include "pifile.h"
# include "piiostream.h"
# include "pisysteminfo.h"
@@ -176,9 +176,13 @@ PIObject::PIObject(const PIString & name): _signature_(__PIOBJECT_SIGNATURE__),
in_event_cnt = 0;
setName(name);
setDebug(true);
#ifndef PIP_NO_THREADS
mutexObjects().lock();
#endif
objects() << this;
#ifndef PIP_NO_THREADS
mutexObjects().unlock();
#endif
// piCout << "new" << this;
}
@@ -186,9 +190,13 @@ PIObject::PIObject(const PIString & name): _signature_(__PIOBJECT_SIGNATURE__),
PIObject::~PIObject() {
in_event_cnt = 0;
// piCout << "delete" << this;
#ifndef PIP_NO_THREADS
mutexObjects().lock();
#endif
objects().removeAll(this);
#ifndef PIP_NO_THREADS
mutexObjects().unlock();
#endif
deleted(this);
piDisconnectAll();
_signature_ = 0;
@@ -464,7 +472,7 @@ void PIObject::piDisconnect(PIObject * src, const PIString & sig) {
src->connections.remove(i);
i--;
if (dest) {
#if !defined(ANDROID) && !defined(MAC_OS) && !defined(MICRO_PIP)
#if !defined(ANDROID) && !defined(MAC_OS) && !defined(PIP_NO_THREADS)
PIMutexLocker _mld(dest->mutex_connect, src != dest);
#endif
dest->updateConnectors();
@@ -482,7 +490,7 @@ void PIObject::piDisconnectAll() {
// piCout << "disconnect"<< src << o;
if (!o || (o == this)) continue;
if (!o->isPIObject()) continue;
#if !defined(ANDROID) && !defined(MAC_OS) && !defined(MICRO_PIP)
#if !defined(ANDROID) && !defined(MAC_OS) && !defined(PIP_NO_THREADS)
PIMutexLocker _mld(o->mutex_connect, this != o);
#endif
PIVector<Connection> & oc(o->connections);
@@ -547,6 +555,7 @@ PIMap<uint, PIObject::__MetaData> & PIObject::__meta_data() {
}
#ifndef PIP_NO_THREADS
void PIObject::callQueuedEvents() {
mutex_queue.lock();
PIVector<__QueuedEvent> qe = events_queue;
@@ -560,6 +569,7 @@ void PIObject::callQueuedEvents() {
if (e.dest_o->thread_safe_) e.dest_o->mutex_.unlock();
}
}
#endif // PIP_NO_THREADS
//! \details
@@ -570,9 +580,11 @@ void PIObject::callQueuedEvents() {
//! При первом вызове стартует фоновый поток для удаления объектов.
//! Каждый объект из очереди удаляется только когда выйдет из всех
//! событий и обработок.
#ifndef PIP_NO_THREADS
void PIObject::deleteLater() {
Deleter::instance()->post(this);
}
#endif // PIP_NO_THREADS
bool PIObject::findSuitableMethodV(const PIString & method, int args, int & ret_args, PIObject::__MetaFunc & ret) {
@@ -732,7 +744,7 @@ void PIObject::dump(const PIString & line_prefix) const {
}
#ifndef MICRO_PIP
#ifndef PIP_NO_THREADS
void dumpApplication(bool with_objects) {
PIMutexLocker _ml(PIObject::mutexObjects());
// printf("dump application ...\n");
@@ -835,7 +847,7 @@ bool PIObject::Connection::disconnect() const {
return ret;
}
#ifndef PIP_NO_THREADS
PRIVATE_DEFINITION_START(PIObject::Deleter)
PIThread thread;
PIConditionVariable cond_var;
@@ -899,3 +911,4 @@ void PIObject::Deleter::deleteObject(PIObject * o) {
}
// piCout << "[Deleter] delete" << (uintptr_t)o << "done";
}
#endif // PIP_NO_THREADS