@echo off setlocal REM ===== CubeMX After Code Generation Restore Script ===== REM 进入工程根目录 pushd "%~dp0.." >nul 2>nul set LOG_FILE=tools\restore_freertos_port.log echo ===== Restore FreeRTOS Port Files ===== > "%LOG_FILE%" echo ProjectDir=%CD% >> "%LOG_FILE%" set SRC_DIR=tools\freertos_port_backup set DST_DIR=Middlewares\Third_Party\FreeRTOS\Source\portable\RVDS\ARM_CM4F echo SRC_DIR=%SRC_DIR% >> "%LOG_FILE%" echo DST_DIR=%DST_DIR% >> "%LOG_FILE%" if not exist "%SRC_DIR%" ( echo Backup dir not found. >> "%LOG_FILE%" popd >nul 2>nul exit /b 0 ) if not exist "%DST_DIR%" ( mkdir "%DST_DIR%" >> "%LOG_FILE%" 2>&1 ) if exist "%SRC_DIR%\port.c" ( copy /Y "%SRC_DIR%\port.c" "%DST_DIR%\port.c" >> "%LOG_FILE%" 2>&1 ) if exist "%SRC_DIR%\portmacro.h" ( copy /Y "%SRC_DIR%\portmacro.h" "%DST_DIR%\portmacro.h" >> "%LOG_FILE%" 2>&1 ) if exist "%SRC_DIR%\port.h" ( copy /Y "%SRC_DIR%\port.h" "%DST_DIR%\port.h" >> "%LOG_FILE%" 2>&1 ) if exist "%SRC_DIR%\portasm.s" ( copy /Y "%SRC_DIR%\portasm.s" "%DST_DIR%\portasm.s" >> "%LOG_FILE%" 2>&1 ) echo Restore finished. >> "%LOG_FILE%" popd >nul 2>nul exit /b 0