diff --git a/docs/migration_micro_pip_plan.md b/docs/migration_micro_pip_plan.md deleted file mode 100644 index 718a9784..00000000 --- a/docs/migration_micro_pip_plan.md +++ /dev/null @@ -1,223 +0,0 @@ -# План миграции MICRO_PIP → тонкозернистые макросы - -## Архитектура - -**CMakeLists.txt** — центр логики: -- Опции `PIP_NO_*` (можно переопределить вручную) -- Platform-блоки (Pico SDK, FreeRTOS) устанавливают опции автоматически -- `add_definitions(-DPIP_NO_*)` передаёт флаги в компилятор - -**piplatform.h** — минимальная логика: -- `PIP_MIN_MSLEEP` от `PIP_NO_THREADS` -- `PISERIAL_NO_PINS` для embedded -- Определение `LINUX` (без MICRO_PIP) - -**Код** — использует feature flags: `#ifndef PIP_NO_THREADS`, `#ifndef PIP_NO_FILESYSTEM` и т.д. - -## Флаг-карта по платформам - -| Платформа | FS | Threads | Socket | Process | Dynlib | FFT | Serial | -|---|---|---|---|---|---|---|---| -| Linux/Desktop | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Windows | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| macOS | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| Android | ✓ | ✓ | ✓ | ✗ | ✗ | ✗ | ✗ | -| QNX | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| FreeBSD | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -| FreeRTOS (+LWIP) | ✗ | ✓ | ✓ | ✗ | ✗ | ✗ | ✗ | -| FreeRTOS (no LWIP) | ✗ | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ | -| Pico SDK (+FreeRTOS+LWIP) | ✗ | ✓ | ✓ | ✗ | ✗ | ✗ | ✗ | -| Pico SDK (bare metal) | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | - ---- - -## Пошаговый план - -### Шаг 1. CMakeLists.txt — опции + platform-логика - -**Добавить опции:** -```cmake -option(PIP_NO_SOCKET "Disable socket/network support" OFF) -option(PIP_NO_PROCESS "Disable process management" OFF) -option(PIP_NO_DYNLIB "Disable dynamic library loading" OFF) -option(PIP_NO_FFT "Disable FFT support" OFF) -option(PIP_NO_SERIAL "Disable serial port support" OFF) -``` - -**Pico SDK блок:** -```cmake -if(DEFINED PICO_BOARD) - add_definitions(-DPICO_SDK) - set(PIP_NO_FILESYSTEM ON CACHE BOOL "" FORCE) - if(NOT DEFINED PICO_FREERTOS) - set(PIP_NO_THREADS ON CACHE BOOL "" FORCE) - endif() - if(NOT DEFINED PICO_LWIP) - set(PIP_NO_SOCKET ON CACHE BOOL "" FORCE) - endif() - set(PIP_NO_PROCESS ON CACHE BOOL "" FORCE) - set(PIP_NO_DYNLIB ON CACHE BOOL "" FORCE) - set(PIP_NO_FFT ON CACHE BOOL "" FORCE) - set(PIP_NO_SERIAL ON CACHE BOOL "" FORCE) - message(STATUS "Building PIP for Pi Pico SDK ${PICO_SDK_VERSION_STRING}") -endif() -``` - -**FreeRTOS блок:** -```cmake -if(PIP_FREERTOS) - add_definitions(-DPIP_FREERTOS) - set(PIP_NO_FILESYSTEM ON CACHE BOOL "" FORCE) - if(NOT DEFINED LWIP) - set(PIP_NO_SOCKET ON CACHE BOOL "" FORCE) - endif() - set(PIP_NO_PROCESS ON CACHE BOOL "" FORCE) - set(PIP_NO_DYNLIB ON CACHE BOOL "" FORCE) - set(PIP_NO_FFT ON CACHE BOOL "" FORCE) - set(PIP_NO_SERIAL ON CACHE BOOL "" FORCE) -endif() -``` - -**Android блок (если нет):** -```cmake -if(DEFINED ANDROID_PLATFORM) - set(PIP_NO_PROCESS ON CACHE BOOL "" FORCE) - set(PIP_NO_DYNLIB ON CACHE BOOL "" FORCE) - set(PIP_NO_FFT ON CACHE BOOL "" FORCE) -endif() -``` - -**add_definitions для всех флагов:** -```cmake -if(PIP_NO_FILESYSTEM) add_definitions(-DPIP_NO_FILESYSTEM) endif() -if(PIP_NO_THREADS) add_definitions(-DPIP_NO_THREADS) endif() -if(PIP_NO_SOCKET) add_definitions(-DPIP_NO_SOCKET) endif() -if(PIP_NO_PROCESS) add_definitions(-DPIP_NO_PROCESS) endif() -if(PIP_NO_DYNLIB) add_definitions(-DPIP_NO_DYNLIB) endif() -if(PIP_NO_FFT) add_definitions(-DPIP_NO_FFT) endif() -if(PIP_NO_SERIAL) add_definitions(-DPIP_NO_SERIAL) endif() -``` - -**PIP_MIN_MSLEEP:** -```cmake -if(PIP_NO_THREADS) - add_definitions(-DPIP_MIN_MSLEEP=10) -else() - add_definitions(-DPIP_MIN_MSLEEP=1) -endif() -``` - -**Убрать:** блок `PIP_MICRO` / `MICRO_PIP`. - ---- - -### Шаг 2. piplatform.h - -**Заменить блок MICRO_PIP (строки 156-163) на:** -```cpp -#ifdef PICO_SDK - #define PISERIAL_NO_PINS -#endif -#ifdef FREERTOS - #ifndef PISERIAL_NO_PINS - #define PISERIAL_NO_PINS - #endif -#endif -``` - -**Linux определение (строки 165-179):** убрать `MICRO_PIP` из цепочки. - -**Убрать doxygen-документацию MICRO_PIP (строка 77-81).** - ---- - -### Шаг 3. pibase_macros.h - -**Убрать doxygen MICRO_PIP (строки 119-121, 171).** - -**`__PIP_TYPENAME__` (строки 226-232):** уже перенесено на RTTI check. - -**`PIP_MIN_MSLEEP` (строка ~402):** убрать, теперь задается CMake. - ---- - -### Шаг 4. Файлы целиком под MICRO_PIP - -#### 4a. PIProcess → `PIP_NO_PROCESS` -- `libs/main/system/piprocess.h` / `.cpp`: `#ifndef MICRO_PIP` → `#ifndef PIP_NO_PROCESS` - -#### 4b. PILibrary → `PIP_NO_DYNLIB` -- `libs/main/system/pilibrary.h` / `.cpp`: `#ifndef MICRO_PIP` → `#ifndef PIP_NO_DYNLIB` - -#### 4c. PIPluginLoader → `PIP_NO_DYNLIB` -- `libs/main/system/piplugin.h` / `.cpp`: `#ifndef MICRO_PIP` → `#ifndef PIP_NO_DYNLIB` - -#### 4d. PIKbdListener → `PIP_NO_THREADS` -- `libs/main/console/pikbdlistener.h` / `.cpp`: `#ifndef MICRO_PIP` → `#ifndef PIP_NO_THREADS` - -#### 4e. PISerial → `PIP_NO_SERIAL` -- `libs/main/io_devices/piserial.cpp`: `#ifndef MICRO_PIP` → `#ifndef PIP_NO_SERIAL` - -#### 4f. PIWaitEvent → `PIP_NO_THREADS` -- `libs/main/core/piwaitevent_p.h` / `.cpp`: `#ifndef MICRO_PIP` → `#ifndef PIP_NO_THREADS` - -#### 4g. PIFFT → `PIP_NO_FFT` -- `libs/main/math/pifft.h` / `.cpp`: `#ifndef MICRO_PIP` → `#ifndef PIP_NO_FFT` - -#### 4h. PITerminal → `PIP_NO_PROCESS` -- `libs/console/piterminal.cpp`: `#ifndef MICRO_PIP` → `#ifndef PIP_NO_PROCESS` - -#### 4i. PIInit → композитная проверка -- `piinit.h`: композитный макрос `_PIP_INIT_STUB_` -- `piinit.cpp`, `piinit.h`, `piincludes.h`: `MICRO_PIP` → `_PIP_INIT_STUB_` - ---- - -### Шаг 5. Частичные MICRO_PIP - -#### 5a. __PIThreadCollection → `PIP_NO_THREADS` -- `pithread.h` / `.cpp`: все `MICRO_PIP` → `PIP_NO_THREADS` - -#### 5b. PIObject diagnostics -- `piobject.h`: `PIIntrospection` friend → `PIP_INTROSPECTION`, убрать `PIObjectManager`, `dumpApplication` без guard -- `piobject.cpp`: includes по фичам, mutex → `PIP_NO_THREADS` - -#### 5c. Buffer sizes → убрать ветки, оставить дефолтные - -#### 5d. piscreen → `PIP_NO_PROCESS` - -#### 5e. PISystemMonitor → `PIP_NO_PROCESS` / `PIP_NO_FILESYSTEM` - -#### 5f. PIFile → `PICO_SDK` / `LINUX` / `FREE_BSD` - -#### 5g. Time functions → `PICO_SDK` / `FREERTOS` / `PIP_NO_FILESYSTEM` - -#### 5h. Variants → RTTI check / `PIP_NO_FILESYSTEM` - -#### 5i. System tests → `PIP_NO_FILESYSTEM` - -#### 5j. PIIODevice stop → `PIP_NO_THREADS` - -#### 5k. PICAN → `PIP_NO_SOCKET` (уже сделано) - ---- - -### Шаг 6. Doxygen/документация - -Убрать MICRO_PIP из piplatform.h, pibase_macros.h. - -### Шаг 7. Финальная очистка - -`grep -r MICRO_PIP` → 0. Убрать PIP_MICRO из CMakeLists.txt. - ---- - -## Порядок выполнения - -1. CMakeLists.txt — опции + platform-блоки + add_definitions -2. piplatform.h — убрать MICRO_PIP, оставить PISERIAL_NO_PINS -3. pibase_macros.h — убрать MICRO_PIP, PIP_MIN_MSLEEP (теперь CMake) -4. Файлы целиком (шаг 4) -5. Частичные (шаг 5) -6. Doxygen (шаг 6) -7. grep-проверка (шаг 7)