diff --git a/build_scripts/berry_prebuild.bat b/build_scripts/berry_prebuild.bat new file mode 100644 index 000000000..4bf3e96a0 --- /dev/null +++ b/build_scripts/berry_prebuild.bat @@ -0,0 +1,52 @@ +@echo off +setlocal EnableDelayedExpansion + +:: ======================================================== +:: OpenBeken Berry prebuild script +:: Can be called from any directory - resolves repo root +:: from the script's own location. +:: ======================================================== + +:: Resolve repo root (one level up from build_scripts) +set "REPO_ROOT=%~dp0.." +pushd "!REPO_ROOT!" +set "REPO_ROOT=%CD%" +popd + +echo [INFO] Running Berry prebuild... +echo [INFO] Repo root: !REPO_ROOT! + +set PYTHON_CMD= +where python >nul 2>nul +if %errorlevel% equ 0 ( + set "PYTHON_CMD=python" +) else ( + where python3 >nul 2>nul + if !errorlevel! equ 0 ( + set "PYTHON_CMD=python3" + ) +) + +if "%PYTHON_CMD%"=="" ( + echo [WARNING] Neither 'python' nor 'python3' was found in PATH! + echo [WARNING] Berry prebuild step will be skipped. Please install Python to generate Berry bindings. + exit /b 0 +) + +echo [INFO] Using Python command: !PYTHON_CMD! + +if not exist "!REPO_ROOT!\libraries\berry\generate" ( + echo [INFO] Creating libraries\berry\generate directory... + mkdir "!REPO_ROOT!\libraries\berry\generate" +) + +echo [INFO] Executing Berry C-Object-Compiler (coc)... +!PYTHON_CMD! "!REPO_ROOT!\libraries\berry\tools\coc\coc" -o "!REPO_ROOT!\libraries\berry\generate" "!REPO_ROOT!\libraries\berry\src" "!REPO_ROOT!\src\berry\modules" -c "!REPO_ROOT!\include\berry_conf.h" + +if !errorlevel! neq 0 ( + echo [ERROR] Berry prebuild failed with exit code !errorlevel!! + exit /b !errorlevel! +) + +echo [INFO] Berry prebuild completed successfully. +exit /b 0 diff --git a/build_scripts/build_bk7231n.bat b/build_scripts/build_bk7231n.bat new file mode 100644 index 000000000..82daf2486 --- /dev/null +++ b/build_scripts/build_bk7231n.bat @@ -0,0 +1,185 @@ +@echo off +setlocal EnableDelayedExpansion +pushd "%~dp0\.." + +:: ======================================================== +:: OpenBeken BK7231N Windows build script +:: Uses Git Bash + bundled ARM GCC toolchain + Windows +:: packaging tools that are all already in the SDK. +:: ======================================================== + +set APP_NAME=OpenBK7231N_App +set APP_VERSION=dev_bk7231n +set SDK_DIR=sdk\OpenBK7231N +set OBK_VARIANT=2 +set ACTION=build + +:: Allow overriding version from command line +if not "%~1"=="" set APP_VERSION=%~1 +if not "%~2"=="" set ACTION=%~2 + +echo ============================================== +echo Building OpenBeken for BK7231N on Windows +echo App Name: %APP_NAME% +echo App Version: %APP_VERSION% +echo Variant: %OBK_VARIANT% +echo SDK Dir: %SDK_DIR% +echo Action: %ACTION% +echo ============================================== + +:: --- Check prerequisites --- + +:: 1. Git Bash +set GIT_BASH= +for %%P in ( + "C:\Program Files\Git\bin\bash.exe" + "C:\Program Files (x86)\Git\bin\bash.exe" +) do ( + if exist %%P ( + set "GIT_BASH=%%~P" + goto :found_bash + ) +) +echo [ERROR] Git Bash not found! Please install Git for Windows. +exit /b 1 + +:found_bash +echo [INFO] Using Git Bash: %GIT_BASH% + +:: 2. Check that SDK submodule is checked out +if not exist "%SDK_DIR%\platforms\BK7231N\BK7231N_os\build.sh" ( + echo [INFO] SDK submodule not found, checking out... + git submodule update --init --recursive --depth=1 %SDK_DIR% + if !errorlevel! neq 0 ( + echo [ERROR] Failed to checkout SDK submodule! + exit /b 1 + ) +) +echo [INFO] SDK submodule OK. + +:: 2b. Check that Berry submodule is checked out +if not exist "libraries\berry\src\be_api.c" ( + echo [INFO] Berry submodule not found, checking out... + git submodule update --init --depth=1 libraries\berry + if !errorlevel! neq 0 ( + echo [ERROR] Failed to checkout Berry submodule! + exit /b 1 + ) +) +echo [INFO] Berry submodule OK. + +:: 3. Check that Windows ARM GCC toolchain exists +if not exist "%SDK_DIR%\platforms\BK7231N\toolchain\windows\gcc-arm-none-eabi-4_9-2015q1\bin\arm-none-eabi-gcc.exe" ( + echo [ERROR] Windows ARM GCC toolchain not found in SDK! + echo Expected at: %SDK_DIR%\platforms\BK7231N\toolchain\windows\gcc-arm-none-eabi-4_9-2015q1\bin\ + exit /b 1 +) +echo [INFO] ARM GCC toolchain OK. + +:: 4. Ensure our app symlink/junction exists in SDK apps folder +if not exist "%SDK_DIR%\apps\%APP_NAME%" ( + echo [INFO] Creating junction for app in SDK apps folder... + mklink /J "%SDK_DIR%\apps\%APP_NAME%" "%CD%" + if !errorlevel! neq 0 ( + echo [ERROR] Failed to create junction. Try running as Administrator. + exit /b 1 + ) +) +echo [INFO] App link OK. + +:: 5. Ensure mbedtls is downloaded (needed by the top-level Makefile) +if not exist "output\mbedtls-2.28.5" ( + echo [INFO] Downloading mbedtls... + "%GIT_BASH%" -c "mkdir -p output && cd output && curl -sL https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v2.28.5.tar.gz -o v2.28.5.tar.gz && tar -xf v2.28.5.tar.gz && rm -f v2.28.5.tar.gz && mv mbedtls-2.28.5/library/base64.c mbedtls-2.28.5/library/base64_mbedtls.c" + if !errorlevel! neq 0 ( + echo [WARN] mbedtls download may have failed, build might still work. + ) +) + +:: 6. Ensure output directory exists +if not exist "output\%APP_VERSION%" mkdir "output\%APP_VERSION%" + + +:: --- Berry prebuild --- +call build_scripts\berry_prebuild.bat + +:: --- Build via Git Bash --- +:: The build.sh and application.mk already handle Windows vs Linux toolchain paths. +:: The trick is: application.mk uses `uname` to decide toolchain dir, and build.sh +:: uses `uname` to pick the Windows package tools. +:: Under Git Bash, uname returns MINGW64_NT-... which is NOT "Linux", so it picks +:: the Windows paths. We just need to provide `make` to Git Bash. + +echo [INFO] Starting %ACTION% via Git Bash... +echo. + +:: Run the inner build script, passing parameters as arguments. +:: This avoids the fragile inline echo approach that loses $variables. +"%GIT_BASH%" --login -i "%CD%\build_scripts\build_bk7231n_inner.sh" "%APP_NAME%" "%APP_VERSION%" "%SDK_DIR%" "%OBK_VARIANT%" "%ACTION%" +set BUILD_RESULT=%errorlevel% + +if %BUILD_RESULT% neq 0 ( + echo. + echo [ERROR] BK7231N build failed with exit code %BUILD_RESULT%! + echo. + echo [INFO] Checking for partial build artifacts... + echo [INFO] Looking in: %SDK_DIR%\platforms\BK7231N\BK7231N_os\tools\generate\ + if exist "%SDK_DIR%\platforms\BK7231N\BK7231N_os\tools\generate" ( + dir /b "%SDK_DIR%\platforms\BK7231N\BK7231N_os\tools\generate\*.bin" 2>nul + dir /b "%SDK_DIR%\platforms\BK7231N\BK7231N_os\tools\generate\*.rbl" 2>nul + ) + echo. + echo [INFO] Checking output dir: output\%APP_VERSION%\ + if exist "output\%APP_VERSION%" ( + dir /b "output\%APP_VERSION%\*.bin" 2>nul + dir /b "output\%APP_VERSION%\*.rbl" 2>nul + dir /b "output\%APP_VERSION%\*.axf" 2>nul + ) else ( + echo [INFO] Output dir does not exist yet. + ) + exit /b %BUILD_RESULT% +) + +:: --- Copy output --- +echo. +echo [INFO] Checking output files... +set GEN_DIR=%SDK_DIR%\platforms\BK7231N\BK7231N_os\tools\generate + +set COPIED_COUNT=0 +if exist "%GEN_DIR%\%APP_NAME%_%APP_VERSION%.rbl" ( + copy /y "%GEN_DIR%\%APP_NAME%_%APP_VERSION%.rbl" "output\%APP_VERSION%\" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_%APP_VERSION%.rbl + set /a COPIED_COUNT+=1 +) +if exist "%GEN_DIR%\%APP_NAME%_UG_%APP_VERSION%.bin" ( + copy /y "%GEN_DIR%\%APP_NAME%_UG_%APP_VERSION%.bin" "output\%APP_VERSION%\" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_UG_%APP_VERSION%.bin + set /a COPIED_COUNT+=1 +) +if exist "%GEN_DIR%\%APP_NAME%_UA_%APP_VERSION%.bin" ( + copy /y "%GEN_DIR%\%APP_NAME%_UA_%APP_VERSION%.bin" "output\%APP_VERSION%\" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_UA_%APP_VERSION%.bin + set /a COPIED_COUNT+=1 +) +if exist "%GEN_DIR%\%APP_NAME%_QIO_%APP_VERSION%.bin" ( + copy /y "%GEN_DIR%\%APP_NAME%_QIO_%APP_VERSION%.bin" "output\%APP_VERSION%\" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_QIO_%APP_VERSION%.bin + set /a COPIED_COUNT+=1 +) + +echo. +echo ============================================== +echo BUILD SUCCESSFUL! (%COPIED_COUNT% files copied) +echo ============================================== +echo. +echo Output directory: +echo %CD%\output\%APP_VERSION%\ +echo. +echo Build files: +echo ---------------------------------------------- +for %%F in (output\%APP_VERSION%\*.bin output\%APP_VERSION%\*.rbl) do ( + echo %%~nxF (%%~zF bytes) +) +echo ============================================== +exit /b 0 + diff --git a/build_scripts/build_bk7231n_inner.sh b/build_scripts/build_bk7231n_inner.sh new file mode 100644 index 000000000..742ec861d --- /dev/null +++ b/build_scripts/build_bk7231n_inner.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# Inner build script called by build_BK7231N.bat +# Arguments: APP_NAME APP_VERSION SDK_DIR OBK_VARIANT +set -e + +APP_NAME="$1" +APP_VERSION="$2" +SDK_DIR="$3" +export OBK_VARIANT="$4" + +echo "[INFO] Inner build script started" +echo "[INFO] APP_NAME=$APP_NAME" +echo "[INFO] APP_VERSION=$APP_VERSION" +echo "[INFO] SDK_DIR=$SDK_DIR" +echo "[INFO] OBK_VARIANT=$OBK_VARIANT" + +# First, check if make is available +if type make > /dev/null 2>&1; then + echo "[INFO] GNU make is available." +else + echo "[INFO] GNU make not found in Git Bash. Attempting to get it..." + MAKE_FOUND=0 + for MAKE_PATH in /c/ProgramData/chocolatey/bin/make.exe /c/msys64/usr/bin/make.exe /w/TOOLS/msys64/usr/bin/make.exe; do + if [ -f "$MAKE_PATH" ]; then + export PATH="$(dirname "$MAKE_PATH"):$PATH" + MAKE_FOUND=1 + echo "[INFO] Found make at $MAKE_PATH" + break + fi + done + if [ $MAKE_FOUND -eq 0 ]; then + echo "[ERROR] GNU make not found!" + echo "Please install make via one of:" + echo " choco install make" + echo " pacman -S make (in MSYS2)" + echo " Or download from https://gnuwin32.sourceforge.net/packages/make.htm" + exit 1 + fi +fi + +echo "[INFO] make found: $(which make)" +echo "[INFO] make version: $(make --version | head -1)" + +SCRIPT_DIR="$(pwd)" + +# Set a localized TEMP dir to avoid PyInstaller extraction permission errors +# beken_packager.exe is a PyInstaller bundle that needs to extract VCRUNTIME140.dll +LOCAL_TMP="$(cygpath -m "$SCRIPT_DIR/output/tmp")" +echo "[INFO] Setting local TEMP dir: $LOCAL_TMP" +mkdir -p "$SCRIPT_DIR/output/tmp" +export TEMP="$LOCAL_TMP" +export TMP="$LOCAL_TMP" +export TMPDIR="$LOCAL_TMP" +echo "[INFO] TEMP=$TEMP" +echo "[INFO] TMP=$TMP" +echo "[INFO] TMPDIR=$TMPDIR" + +ACTION="$5" + +# Navigate to the build system directory +cd "$SDK_DIR/platforms/BK7231N/BK7231N_os" + +if [ "$ACTION" = "clean" ]; then + echo "[INFO] Running BK7231N clean from $(pwd)..." + make APP_BIN_NAME="$APP_NAME" USER_SW_VER="$(echo $APP_VERSION | cut -d'-' -f1)" APP_VERSION="$APP_VERSION" clean -C ./ + echo "[INFO] Clean complete!" + exit 0 +fi + +echo "[INFO] Running BK7231N build from $(pwd)..." +bash build.sh "$APP_NAME" "$APP_VERSION" bk7231n "OBK_VARIANT=$OBK_VARIANT TARGET_PLATFORM=bk7231n OBK_DIR=../../../apps/$APP_NAME BERRY_SRCPATH=../../../apps/$APP_NAME/libraries/berry/src BERRY_MODULEPATH=../../../apps/$APP_NAME/src/berry/modules" + +echo "[INFO] Build complete!" diff --git a/build_scripts/build_bk7231t.bat b/build_scripts/build_bk7231t.bat new file mode 100644 index 000000000..76b1ade37 --- /dev/null +++ b/build_scripts/build_bk7231t.bat @@ -0,0 +1,185 @@ +@echo off +setlocal EnableDelayedExpansion +pushd "%~dp0\.." + +:: ======================================================== +:: OpenBeken BK7231T Windows build script +:: Uses Git Bash + bundled ARM GCC toolchain + Windows +:: packaging tools that are all already in the SDK. +:: ======================================================== + +set APP_NAME=OpenBK7231T_App +set APP_VERSION=dev_bk7231t +set SDK_DIR=sdk\OpenBK7231T +set OBK_VARIANT=2 +set ACTION=build + +:: Allow overriding version from command line +if not "%~1"=="" set APP_VERSION=%~1 +if not "%~2"=="" set ACTION=%~2 + +echo ============================================== +echo Building OpenBeken for BK7231T on Windows +echo App Name: %APP_NAME% +echo App Version: %APP_VERSION% +echo Variant: %OBK_VARIANT% +echo SDK Dir: %SDK_DIR% +echo Action: %ACTION% +echo ============================================== + +:: --- Check prerequisites --- + +:: 1. Git Bash +set GIT_BASH= +for %%P in ( + "C:\Program Files\Git\bin\bash.exe" + "C:\Program Files (x86)\Git\bin\bash.exe" +) do ( + if exist %%P ( + set "GIT_BASH=%%~P" + goto :found_bash + ) +) +echo [ERROR] Git Bash not found! Please install Git for Windows. +exit /b 1 + +:found_bash +echo [INFO] Using Git Bash: %GIT_BASH% + +:: 2. Check that SDK submodule is checked out +if not exist "%SDK_DIR%\platforms\bk7231t\bk7231t_os\build.sh" ( + echo [INFO] SDK submodule not found, checking out... + git submodule update --init --recursive --depth=1 %SDK_DIR% + if !errorlevel! neq 0 ( + echo [ERROR] Failed to checkout SDK submodule! + exit /b 1 + ) +) +echo [INFO] SDK submodule OK. + +:: 2b. Check that Berry submodule is checked out +if not exist "libraries\berry\src\be_api.c" ( + echo [INFO] Berry submodule not found, checking out... + git submodule update --init --depth=1 libraries\berry + if !errorlevel! neq 0 ( + echo [ERROR] Failed to checkout Berry submodule! + exit /b 1 + ) +) +echo [INFO] Berry submodule OK. + +:: 3. Check that Windows ARM GCC toolchain exists +if not exist "%SDK_DIR%\platforms\bk7231t\toolchain\windows\gcc-arm-none-eabi-4_9-2015q1\bin\arm-none-eabi-gcc.exe" ( + echo [ERROR] Windows ARM GCC toolchain not found in SDK! + echo Expected at: %SDK_DIR%\platforms\bk7231t\toolchain\windows\gcc-arm-none-eabi-4_9-2015q1\bin\ + exit /b 1 +) +echo [INFO] ARM GCC toolchain OK. + +:: 4. Ensure our app symlink/junction exists in SDK apps folder +if not exist "%SDK_DIR%\apps\%APP_NAME%" ( + echo [INFO] Creating junction for app in SDK apps folder... + mklink /J "%SDK_DIR%\apps\%APP_NAME%" "%CD%" + if !errorlevel! neq 0 ( + echo [ERROR] Failed to create junction. Try running as Administrator. + exit /b 1 + ) +) +echo [INFO] App link OK. + +:: 5. Ensure mbedtls is downloaded (needed by the top-level Makefile) +if not exist "output\mbedtls-2.28.5" ( + echo [INFO] Downloading mbedtls... + "%GIT_BASH%" -c "mkdir -p output && cd output && curl -sL https://github.com/Mbed-TLS/mbedtls/archive/refs/tags/v2.28.5.tar.gz -o v2.28.5.tar.gz && tar -xf v2.28.5.tar.gz && rm -f v2.28.5.tar.gz && mv mbedtls-2.28.5/library/base64.c mbedtls-2.28.5/library/base64_mbedtls.c" + if !errorlevel! neq 0 ( + echo [WARN] mbedtls download may have failed, build might still work. + ) +) + +:: 6. Ensure output directory exists +if not exist "output\%APP_VERSION%" mkdir "output\%APP_VERSION%" + + +:: --- Berry prebuild --- +call build_scripts\berry_prebuild.bat + +:: --- Build via Git Bash --- +:: The build.sh and application.mk already handle Windows vs Linux toolchain paths. +:: The trick is: application.mk uses `uname` to decide toolchain dir, and build.sh +:: uses `uname` to pick the Windows package tools. +:: Under Git Bash, uname returns MINGW64_NT-... which is NOT "Linux", so it picks +:: the Windows paths. We just need to provide `make` to Git Bash. + +echo [INFO] Starting %ACTION% via Git Bash... +echo. + +:: Run the inner build script, passing parameters as arguments. +:: This avoids the fragile inline echo approach that loses $variables. +"%GIT_BASH%" --login -i "%CD%\build_scripts\build_bk7231t_inner.sh" "%APP_NAME%" "%APP_VERSION%" "%SDK_DIR%" "%OBK_VARIANT%" "%ACTION%" +set BUILD_RESULT=%errorlevel% + +if %BUILD_RESULT% neq 0 ( + echo. + echo [ERROR] BK7231T build failed with exit code %BUILD_RESULT%! + echo. + echo [INFO] Checking for partial build artifacts... + echo [INFO] Looking in: %SDK_DIR%\platforms\bk7231t\bk7231t_os\tools\generate\ + if exist "%SDK_DIR%\platforms\bk7231t\bk7231t_os\tools\generate" ( + dir /b "%SDK_DIR%\platforms\bk7231t\bk7231t_os\tools\generate\*.bin" 2>nul + dir /b "%SDK_DIR%\platforms\bk7231t\bk7231t_os\tools\generate\*.rbl" 2>nul + ) + echo. + echo [INFO] Checking output dir: output\%APP_VERSION%\ + if exist "output\%APP_VERSION%" ( + dir /b "output\%APP_VERSION%\*.bin" 2>nul + dir /b "output\%APP_VERSION%\*.rbl" 2>nul + dir /b "output\%APP_VERSION%\*.axf" 2>nul + ) else ( + echo [INFO] Output dir does not exist yet. + ) + exit /b %BUILD_RESULT% +) + +:: --- Copy output --- +echo. +echo [INFO] Checking output files... +set GEN_DIR=%SDK_DIR%\platforms\bk7231t\bk7231t_os\tools\generate + +set COPIED_COUNT=0 +if exist "%GEN_DIR%\%APP_NAME%_%APP_VERSION%.rbl" ( + copy /y "%GEN_DIR%\%APP_NAME%_%APP_VERSION%.rbl" "output\%APP_VERSION%\" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_%APP_VERSION%.rbl + set /a COPIED_COUNT+=1 +) +if exist "%GEN_DIR%\%APP_NAME%_UG_%APP_VERSION%.bin" ( + copy /y "%GEN_DIR%\%APP_NAME%_UG_%APP_VERSION%.bin" "output\%APP_VERSION%\" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_UG_%APP_VERSION%.bin + set /a COPIED_COUNT+=1 +) +if exist "%GEN_DIR%\%APP_NAME%_UA_%APP_VERSION%.bin" ( + copy /y "%GEN_DIR%\%APP_NAME%_UA_%APP_VERSION%.bin" "output\%APP_VERSION%\" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_UA_%APP_VERSION%.bin + set /a COPIED_COUNT+=1 +) +if exist "%GEN_DIR%\%APP_NAME%_QIO_%APP_VERSION%.bin" ( + copy /y "%GEN_DIR%\%APP_NAME%_QIO_%APP_VERSION%.bin" "output\%APP_VERSION%\" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_QIO_%APP_VERSION%.bin + set /a COPIED_COUNT+=1 +) + +echo. +echo ============================================== +echo BUILD SUCCESSFUL! (%COPIED_COUNT% files copied) +echo ============================================== +echo. +echo Output directory: +echo %CD%\output\%APP_VERSION%\ +echo. +echo Build files: +echo ---------------------------------------------- +for %%F in (output\%APP_VERSION%\*.bin output\%APP_VERSION%\*.rbl) do ( + echo %%~nxF (%%~zF bytes) +) +echo ============================================== +exit /b 0 + diff --git a/build_scripts/build_bk7231t_inner.sh b/build_scripts/build_bk7231t_inner.sh new file mode 100644 index 000000000..303f71d1b --- /dev/null +++ b/build_scripts/build_bk7231t_inner.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# Inner build script called by build_bk7231t.bat +# Arguments: APP_NAME APP_VERSION SDK_DIR OBK_VARIANT +set -e + +APP_NAME="$1" +APP_VERSION="$2" +SDK_DIR="$3" +export OBK_VARIANT="$4" + +echo "[INFO] Inner build script started" +echo "[INFO] APP_NAME=$APP_NAME" +echo "[INFO] APP_VERSION=$APP_VERSION" +echo "[INFO] SDK_DIR=$SDK_DIR" +echo "[INFO] OBK_VARIANT=$OBK_VARIANT" + +# First, check if make is available +if type make > /dev/null 2>&1; then + echo "[INFO] GNU make is available." +else + echo "[INFO] GNU make not found in Git Bash. Attempting to get it..." + MAKE_FOUND=0 + for MAKE_PATH in /c/ProgramData/chocolatey/bin/make.exe /c/msys64/usr/bin/make.exe /w/TOOLS/msys64/usr/bin/make.exe; do + if [ -f "$MAKE_PATH" ]; then + export PATH="$(dirname "$MAKE_PATH"):$PATH" + MAKE_FOUND=1 + echo "[INFO] Found make at $MAKE_PATH" + break + fi + done + if [ $MAKE_FOUND -eq 0 ]; then + echo "[ERROR] GNU make not found!" + echo "Please install make via one of:" + echo " choco install make" + echo " pacman -S make (in MSYS2)" + echo " Or download from https://gnuwin32.sourceforge.net/packages/make.htm" + exit 1 + fi +fi + +echo "[INFO] make found: $(which make)" +echo "[INFO] make version: $(make --version | head -1)" + +SCRIPT_DIR="$(pwd)" + +# Set a localized TEMP dir to avoid PyInstaller extraction permission errors +# beken_packager.exe is a PyInstaller bundle that needs to extract VCRUNTIME140.dll +LOCAL_TMP="$(cygpath -m "$SCRIPT_DIR/output/tmp")" +echo "[INFO] Setting local TEMP dir: $LOCAL_TMP" +mkdir -p "$SCRIPT_DIR/output/tmp" +export TEMP="$LOCAL_TMP" +export TMP="$LOCAL_TMP" +export TMPDIR="$LOCAL_TMP" +echo "[INFO] TEMP=$TEMP" +echo "[INFO] TMP=$TMP" +echo "[INFO] TMPDIR=$TMPDIR" + +ACTION="$5" + +# Navigate to the build system directory +cd "$SDK_DIR/platforms/bk7231t/bk7231t_os" + +if [ "$ACTION" = "clean" ]; then + echo "[INFO] Running BK7231T clean from $(pwd)..." + make APP_BIN_NAME="$APP_NAME" USER_SW_VER="$(echo $APP_VERSION | cut -d'-' -f1)" APP_VERSION="$APP_VERSION" clean -C ./ + echo "[INFO] Clean complete!" + exit 0 +fi + +echo "[INFO] Running BK7231T build from $(pwd)..." +bash build.sh "$APP_NAME" "$APP_VERSION" bk7231t "OBK_VARIANT=$OBK_VARIANT TARGET_PLATFORM=bk7231t" + +echo "[INFO] Build complete!" diff --git a/build_scripts/build_bk7231u.bat b/build_scripts/build_bk7231u.bat new file mode 100644 index 000000000..a6d5fc677 --- /dev/null +++ b/build_scripts/build_bk7231u.bat @@ -0,0 +1,129 @@ +@echo off +setlocal EnableDelayedExpansion +pushd "%~dp0\.." + +:: ======================================================== +:: OpenBeken BK7231U Windows build script +:: Uses Git Bash + bundled ARM GCC toolchain from BK7231N +:: ======================================================== + +set APP_NAME=OpenBK7231U_App +set APP_VERSION=dev_bk7231u +set SDK_DIR=sdk\beken_freertos_sdk +set OBK_VARIANT=2 +set ACTION=build + +:: Allow overriding version from command line +if not "%~1"=="" set APP_VERSION=%~1 +if not "%~2"=="" set ACTION=%~2 + +echo ============================================== +echo Building OpenBeken for BK7231U on Windows +echo App Version: %APP_VERSION% +echo Variant: %OBK_VARIANT% +echo SDK Dir: %SDK_DIR% +echo Action: %ACTION% +echo ============================================== + +:: --- Check prerequisites --- + +:: 1. Git Bash +set GIT_BASH= +for %%P in ( + "C:\Program Files\Git\bin\bash.exe" + "C:\Program Files (x86)\Git\bin\bash.exe" +) do ( + if exist %%P ( + set "GIT_BASH=%%~P" + goto :found_bash + ) +) +echo [ERROR] Git Bash not found! Please install Git for Windows. +exit /b 1 + +:found_bash +echo [INFO] Using Git Bash: %GIT_BASH% + +:: 2. Check that SDK submodule is checked out +if not exist "%SDK_DIR%\build.sh" ( + echo [INFO] SDK submodule not found, checking out... + git submodule update --init --recursive --depth=1 %SDK_DIR% + if !errorlevel! neq 0 ( + echo [ERROR] Failed to checkout SDK submodule! + exit /b 1 + ) +) +echo [INFO] SDK submodule OK. + +:: 3. Check Windows ARM GCC toolchain in OpenBK7231N (borrowed) +if not exist "sdk\OpenBK7231N\platforms\BK7231N\toolchain\windows\gcc-arm-none-eabi-4_9-2015q1\bin\arm-none-eabi-gcc.exe" ( + echo [ERROR] Windows ARM GCC toolchain not found! + echo Needed from: sdk\OpenBK7231N\platforms\... + echo Run build_bk7231n.bat once to initialize it, or pull submodules. + exit /b 1 +) +echo [INFO] ARM GCC toolchain OK. + +:: 4. Ensure our app 'app' junction exists in SDK folder +if exist "%SDK_DIR%\app\" ( + echo [INFO] App junction exists. +) else ( + echo [INFO] Creating junction for app in SDK folder... + if exist "%SDK_DIR%\app" del /q /f "%SDK_DIR%\app" + mklink /J "%SDK_DIR%\app" "%CD%\src" + if !errorlevel! neq 0 ( + echo [ERROR] Failed to create junction. Try running as Administrator. + exit /b 1 + ) +) + +:: 5. Ensure output directory exists +if not exist "output\%APP_VERSION%" mkdir "output\%APP_VERSION%" + + +:: --- Berry prebuild --- +call build_scripts\berry_prebuild.bat + +echo [INFO] Starting %ACTION% via Git Bash... +echo. + +"%GIT_BASH%" --login -i "%CD%\build_scripts\build_bk72xx_freertos_inner.sh" "%APP_NAME%" "%APP_VERSION%" "%SDK_DIR%" "%OBK_VARIANT%" "%ACTION%" "bk7231u" +set BUILD_RESULT=%errorlevel% + +if %BUILD_RESULT% neq 0 ( + echo. + echo [ERROR] BK7231U build failed with exit code %BUILD_RESULT%! + exit /b %BUILD_RESULT% +) + +:: --- Copy output --- +echo. +echo [INFO] Checking output files... +set GEN_DIR=%SDK_DIR%\out + +set COPIED_COUNT=0 +if exist "%GEN_DIR%\app.rbl" ( + copy /y "%GEN_DIR%\app.rbl" "output\%APP_VERSION%\%APP_NAME%_%APP_VERSION%.rbl" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_%APP_VERSION%.rbl + set /a COPIED_COUNT+=1 +) +if exist "%GEN_DIR%\bk7231u_QIO.bin" ( + copy /y "%GEN_DIR%\bk7231u_QIO.bin" "output\%APP_VERSION%\%APP_NAME%_QIO_%APP_VERSION%.bin" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_QIO_%APP_VERSION%.bin + set /a COPIED_COUNT+=1 +) +if exist "%GEN_DIR%\bk7231u_UA.bin" ( + copy /y "%GEN_DIR%\bk7231u_UA.bin" "output\%APP_VERSION%\%APP_NAME%_UA_%APP_VERSION%.bin" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_UA_%APP_VERSION%.bin + set /a COPIED_COUNT+=1 +) + +echo. +echo ============================================== +echo BUILD SUCCESSFUL! (%COPIED_COUNT% files copied) +echo ============================================== +echo. +echo Output directory: +echo %CD%\output\%APP_VERSION%\ +exit /b 0 + diff --git a/build_scripts/build_bk7238.bat b/build_scripts/build_bk7238.bat new file mode 100644 index 000000000..7331c432b --- /dev/null +++ b/build_scripts/build_bk7238.bat @@ -0,0 +1,129 @@ +@echo off +setlocal EnableDelayedExpansion +pushd "%~dp0\.." + +:: ======================================================== +:: OpenBeken BK7238 Windows build script +:: Uses Git Bash + bundled ARM GCC toolchain from BK7231N +:: ======================================================== + +set APP_NAME=OpenBK7238_App +set APP_VERSION=dev_bk7238 +set SDK_DIR=sdk\beken_freertos_sdk +set OBK_VARIANT=2 +set ACTION=build + +:: Allow overriding version from command line +if not "%~1"=="" set APP_VERSION=%~1 +if not "%~2"=="" set ACTION=%~2 + +echo ============================================== +echo Building OpenBeken for BK7238 on Windows +echo App Version: %APP_VERSION% +echo Variant: %OBK_VARIANT% +echo SDK Dir: %SDK_DIR% +echo Action: %ACTION% +echo ============================================== + +:: --- Check prerequisites --- + +:: 1. Git Bash +set GIT_BASH= +for %%P in ( + "C:\Program Files\Git\bin\bash.exe" + "C:\Program Files (x86)\Git\bin\bash.exe" +) do ( + if exist %%P ( + set "GIT_BASH=%%~P" + goto :found_bash + ) +) +echo [ERROR] Git Bash not found! Please install Git for Windows. +exit /b 1 + +:found_bash +echo [INFO] Using Git Bash: %GIT_BASH% + +:: 2. Check that SDK submodule is checked out +if not exist "%SDK_DIR%\build.sh" ( + echo [INFO] SDK submodule not found, checking out... + git submodule update --init --recursive --depth=1 %SDK_DIR% + if !errorlevel! neq 0 ( + echo [ERROR] Failed to checkout SDK submodule! + exit /b 1 + ) +) +echo [INFO] SDK submodule OK. + +:: 3. Check Windows ARM GCC toolchain in OpenBK7231N (borrowed) +if not exist "sdk\OpenBK7231N\platforms\BK7231N\toolchain\windows\gcc-arm-none-eabi-4_9-2015q1\bin\arm-none-eabi-gcc.exe" ( + echo [ERROR] Windows ARM GCC toolchain not found! + echo Needed from: sdk\OpenBK7231N\platforms\... + echo Run build_bk7231n.bat once to initialize it, or pull submodules. + exit /b 1 +) +echo [INFO] ARM GCC toolchain OK. + +:: 4. Ensure our app 'app' junction exists in SDK folder +if exist "%SDK_DIR%\app\" ( + echo [INFO] App junction exists. +) else ( + echo [INFO] Creating junction for app in SDK folder... + if exist "%SDK_DIR%\app" del /q /f "%SDK_DIR%\app" + mklink /J "%SDK_DIR%\app" "%CD%\src" + if !errorlevel! neq 0 ( + echo [ERROR] Failed to create junction. Try running as Administrator. + exit /b 1 + ) +) + +:: 5. Ensure output directory exists +if not exist "output\%APP_VERSION%" mkdir "output\%APP_VERSION%" + + +:: --- Berry prebuild --- +call build_scripts\berry_prebuild.bat + +echo [INFO] Starting %ACTION% via Git Bash... +echo. + +"%GIT_BASH%" --login -i "%CD%\build_scripts\build_bk72xx_freertos_inner.sh" "%APP_NAME%" "%APP_VERSION%" "%SDK_DIR%" "%OBK_VARIANT%" "%ACTION%" "bk7238" +set BUILD_RESULT=%errorlevel% + +if %BUILD_RESULT% neq 0 ( + echo. + echo [ERROR] BK7238 build failed with exit code %BUILD_RESULT%! + exit /b %BUILD_RESULT% +) + +:: --- Copy output --- +echo. +echo [INFO] Checking output files... +set GEN_DIR=%SDK_DIR%\out + +set COPIED_COUNT=0 +if exist "%GEN_DIR%\app.rbl" ( + copy /y "%GEN_DIR%\app.rbl" "output\%APP_VERSION%\%APP_NAME%_%APP_VERSION%.rbl" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_%APP_VERSION%.rbl + set /a COPIED_COUNT+=1 +) +if exist "%GEN_DIR%\bk7238_QIO.bin" ( + copy /y "%GEN_DIR%\bk7238_QIO.bin" "output\%APP_VERSION%\%APP_NAME%_QIO_%APP_VERSION%.bin" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_QIO_%APP_VERSION%.bin + set /a COPIED_COUNT+=1 +) +if exist "%GEN_DIR%\bk7238_UA.bin" ( + copy /y "%GEN_DIR%\bk7238_UA.bin" "output\%APP_VERSION%\%APP_NAME%_UA_%APP_VERSION%.bin" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_UA_%APP_VERSION%.bin + set /a COPIED_COUNT+=1 +) + +echo. +echo ============================================== +echo BUILD SUCCESSFUL! (%COPIED_COUNT% files copied) +echo ============================================== +echo. +echo Output directory: +echo %CD%\output\%APP_VERSION%\ +exit /b 0 + diff --git a/build_scripts/build_bk7238_inner.sh b/build_scripts/build_bk7238_inner.sh new file mode 100644 index 000000000..08338150a --- /dev/null +++ b/build_scripts/build_bk7238_inner.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# Inner build script for BK7238 +# Arguments: APP_NAME APP_VERSION SDK_DIR OBK_VARIANT ACTION +set -e + +APP_NAME="$1" +APP_VERSION="$2" +SDK_DIR="$3" +export OBK_VARIANT="$4" +ACTION="$5" + +echo "[INFO] Inner build script started for BK7238" + +SCRIPT_DIR="$(pwd)" + +# Export the borrowed ARM GCC toolchain to the environment for Beken FreeRTOS SDK Makefile to pick up +TOOLCHAIN_RAW="$(pwd)/sdk/OpenBK7231N/platforms/BK7231N/toolchain/windows/gcc-arm-none-eabi-4_9-2015q1/bin/" +export ARM_GCC_TOOLCHAIN="$(cygpath -u "$TOOLCHAIN_RAW")/" +export PATH="$ARM_GCC_TOOLCHAIN:$PATH" +echo "[INFO] Toolchain: $ARM_GCC_TOOLCHAIN" + +# Set a localized TEMP dir to avoid PyInstaller extraction permission errors (AntiVirus/Defender locking) +# beken_packager.exe is a PyInstaller bundle that needs to extract VCRUNTIME140.dll +# Use native Windows Temp directory where DLL drops are historically trusted by Defender +# We must double-escape backslashes so MSYS Make doesn't swallow them when passing to subshells! +LOCAL_TMP="$(cygpath -w "$USERPROFILE/AppData/Local/Temp/obk_p_$$" | sed 's/\\/\\\\/g')" +echo "[INFO] Setting local TEMP dir: $LOCAL_TMP" +mkdir -p "$USERPROFILE/AppData/Local/Temp/obk_p_$$" +export TEMP="$LOCAL_TMP" +export TMP="$LOCAL_TMP" +export TMPDIR="$LOCAL_TMP" + +# Navigate to the build system directory +cd "$SDK_DIR" + +# First, check if make is available +if type make > /dev/null 2>&1; then + echo "[INFO] GNU make is available." +else + echo "[INFO] GNU make not found in Git Bash. Attempting to get it..." + MAKE_FOUND=0 + for MAKE_PATH in /c/ProgramData/chocolatey/bin/make.exe /w/TOOLS/msys64/usr/bin/make.exe /c/msys64/usr/bin/make.exe; do + if [ -f "$MAKE_PATH" ]; then + export PATH="$(dirname "$MAKE_PATH"):$PATH" + MAKE_FOUND=1 + echo "[INFO] Found make at $MAKE_PATH" + break + fi + done + if [ $MAKE_FOUND -eq 0 ]; then + echo "[ERROR] GNU make not found!" + exit 1 + fi +fi + +if [ "$ACTION" = "clean" ]; then + echo "[INFO] Running BK7238 clean from $(pwd)..." + make clean -C ./ + exit 0 +fi + +echo "[INFO] Running BK7238 build from $(pwd)..." + +# Strip GCC 4.9 unsupported Wno-error flags from application.mk +sed -i 's/-Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types -Wno-error=return-mismatch -Wno-error=int-conversion -Wno-error=changes-meaning//g' application.mk +# Force encrypt.exe on Windows MSYS (which identifies as MINGW64, unlike MINGW32 tracked in application.mk) +sed -i 's/"\.\/tools\/crc_binary\/encrypt_n"/"\.\/tools\/crc_binary\/encrypt\.exe"/g' application.mk + +# Replace encrypt.exe with the compatible one from OpenBK7231T SDK that supports multi-key arguments +cp "$(cygpath -u "$SCRIPT_DIR/sdk/OpenBK7231T/platforms/bk7231t/bk7231t_os/tools/generate/package_tool/windows/encrypt.exe")" ./tools/crc_binary/encrypt.exe + +make TEMP="$LOCAL_TMP" TMP="$LOCAL_TMP" TMPDIR="$LOCAL_TMP" bk7238 -j8 USER_SW_VER="$APP_VERSION" OBK_DIR="../../src" +./tools/rtt_ota/rt_ota_packaging_tool_cli.exe -f ./out/bsp.bin -o ./out/app.rbl -p app -c gzip -s aes -k 0123456789ABCDEF0123456789ABCDEF -i 0123456789ABCDEF -v "$APP_VERSION" + +echo "[INFO] Build complete!" diff --git a/build_scripts/build_bk7251.bat b/build_scripts/build_bk7251.bat new file mode 100644 index 000000000..1e07ef81b --- /dev/null +++ b/build_scripts/build_bk7251.bat @@ -0,0 +1,129 @@ +@echo off +setlocal EnableDelayedExpansion +pushd "%~dp0\.." + +:: ======================================================== +:: OpenBeken BK7251 Windows build script +:: Uses Git Bash + bundled ARM GCC toolchain from BK7231N +:: ======================================================== + +set APP_NAME=OpenBK7251_App +set APP_VERSION=dev_bk7251 +set SDK_DIR=sdk\beken_freertos_sdk +set OBK_VARIANT=2 +set ACTION=build + +:: Allow overriding version from command line +if not "%~1"=="" set APP_VERSION=%~1 +if not "%~2"=="" set ACTION=%~2 + +echo ============================================== +echo Building OpenBeken for BK7251 on Windows +echo App Version: %APP_VERSION% +echo Variant: %OBK_VARIANT% +echo SDK Dir: %SDK_DIR% +echo Action: %ACTION% +echo ============================================== + +:: --- Check prerequisites --- + +:: 1. Git Bash +set GIT_BASH= +for %%P in ( + "C:\Program Files\Git\bin\bash.exe" + "C:\Program Files (x86)\Git\bin\bash.exe" +) do ( + if exist %%P ( + set "GIT_BASH=%%~P" + goto :found_bash + ) +) +echo [ERROR] Git Bash not found! Please install Git for Windows. +exit /b 1 + +:found_bash +echo [INFO] Using Git Bash: %GIT_BASH% + +:: 2. Check that SDK submodule is checked out +if not exist "%SDK_DIR%\build.sh" ( + echo [INFO] SDK submodule not found, checking out... + git submodule update --init --recursive --depth=1 %SDK_DIR% + if !errorlevel! neq 0 ( + echo [ERROR] Failed to checkout SDK submodule! + exit /b 1 + ) +) +echo [INFO] SDK submodule OK. + +:: 3. Check Windows ARM GCC toolchain in OpenBK7231N (borrowed) +if not exist "sdk\OpenBK7231N\platforms\BK7231N\toolchain\windows\gcc-arm-none-eabi-4_9-2015q1\bin\arm-none-eabi-gcc.exe" ( + echo [ERROR] Windows ARM GCC toolchain not found! + echo Needed from: sdk\OpenBK7231N\platforms\... + echo Run build_bk7231n.bat once to initialize it, or pull submodules. + exit /b 1 +) +echo [INFO] ARM GCC toolchain OK. + +:: 4. Ensure our app 'app' junction exists in SDK folder +if exist "%SDK_DIR%\app\" ( + echo [INFO] App junction exists. +) else ( + echo [INFO] Creating junction for app in SDK folder... + if exist "%SDK_DIR%\app" del /q /f "%SDK_DIR%\app" + mklink /J "%SDK_DIR%\app" "%CD%\src" + if !errorlevel! neq 0 ( + echo [ERROR] Failed to create junction. Try running as Administrator. + exit /b 1 + ) +) + +:: 5. Ensure output directory exists +if not exist "output\%APP_VERSION%" mkdir "output\%APP_VERSION%" + + +:: --- Berry prebuild --- +call build_scripts\berry_prebuild.bat + +echo [INFO] Starting %ACTION% via Git Bash... +echo. + +"%GIT_BASH%" --login -i "%CD%\build_scripts\build_bk72xx_freertos_inner.sh" "%APP_NAME%" "%APP_VERSION%" "%SDK_DIR%" "%OBK_VARIANT%" "%ACTION%" "bk7251" +set BUILD_RESULT=%errorlevel% + +if %BUILD_RESULT% neq 0 ( + echo. + echo [ERROR] BK7251 build failed with exit code %BUILD_RESULT%! + exit /b %BUILD_RESULT% +) + +:: --- Copy output --- +echo. +echo [INFO] Checking output files... +set GEN_DIR=%SDK_DIR%\out + +set COPIED_COUNT=0 +if exist "%GEN_DIR%\app.rbl" ( + copy /y "%GEN_DIR%\app.rbl" "output\%APP_VERSION%\%APP_NAME%_%APP_VERSION%.rbl" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_%APP_VERSION%.rbl + set /a COPIED_COUNT+=1 +) +if exist "%GEN_DIR%\bk7251_QIO.bin" ( + copy /y "%GEN_DIR%\bk7251_QIO.bin" "output\%APP_VERSION%\%APP_NAME%_QIO_%APP_VERSION%.bin" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_QIO_%APP_VERSION%.bin + set /a COPIED_COUNT+=1 +) +if exist "%GEN_DIR%\bk7251_UA.bin" ( + copy /y "%GEN_DIR%\bk7251_UA.bin" "output\%APP_VERSION%\%APP_NAME%_UA_%APP_VERSION%.bin" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_UA_%APP_VERSION%.bin + set /a COPIED_COUNT+=1 +) + +echo. +echo ============================================== +echo BUILD SUCCESSFUL! (%COPIED_COUNT% files copied) +echo ============================================== +echo. +echo Output directory: +echo %CD%\output\%APP_VERSION%\ +exit /b 0 + diff --git a/build_scripts/build_bk7252n.bat b/build_scripts/build_bk7252n.bat new file mode 100644 index 000000000..ea140058a --- /dev/null +++ b/build_scripts/build_bk7252n.bat @@ -0,0 +1,129 @@ +@echo off +setlocal EnableDelayedExpansion +pushd "%~dp0\.." + +:: ======================================================== +:: OpenBeken BK7252N Windows build script +:: Uses Git Bash + bundled ARM GCC toolchain from BK7231N +:: ======================================================== + +set APP_NAME=OpenBK7252N_App +set APP_VERSION=dev_bk7252n +set SDK_DIR=sdk\beken_freertos_sdk +set OBK_VARIANT=2 +set ACTION=build + +:: Allow overriding version from command line +if not "%~1"=="" set APP_VERSION=%~1 +if not "%~2"=="" set ACTION=%~2 + +echo ============================================== +echo Building OpenBeken for BK7252N on Windows +echo App Version: %APP_VERSION% +echo Variant: %OBK_VARIANT% +echo SDK Dir: %SDK_DIR% +echo Action: %ACTION% +echo ============================================== + +:: --- Check prerequisites --- + +:: 1. Git Bash +set GIT_BASH= +for %%P in ( + "C:\Program Files\Git\bin\bash.exe" + "C:\Program Files (x86)\Git\bin\bash.exe" +) do ( + if exist %%P ( + set "GIT_BASH=%%~P" + goto :found_bash + ) +) +echo [ERROR] Git Bash not found! Please install Git for Windows. +exit /b 1 + +:found_bash +echo [INFO] Using Git Bash: %GIT_BASH% + +:: 2. Check that SDK submodule is checked out +if not exist "%SDK_DIR%\build.sh" ( + echo [INFO] SDK submodule not found, checking out... + git submodule update --init --recursive --depth=1 %SDK_DIR% + if !errorlevel! neq 0 ( + echo [ERROR] Failed to checkout SDK submodule! + exit /b 1 + ) +) +echo [INFO] SDK submodule OK. + +:: 3. Check Windows ARM GCC toolchain in OpenBK7231N (borrowed) +if not exist "sdk\OpenBK7231N\platforms\BK7231N\toolchain\windows\gcc-arm-none-eabi-4_9-2015q1\bin\arm-none-eabi-gcc.exe" ( + echo [ERROR] Windows ARM GCC toolchain not found! + echo Needed from: sdk\OpenBK7231N\platforms\... + echo Run build_bk7231n.bat once to initialize it, or pull submodules. + exit /b 1 +) +echo [INFO] ARM GCC toolchain OK. + +:: 4. Ensure our app 'app' junction exists in SDK folder +if exist "%SDK_DIR%\app\" ( + echo [INFO] App junction exists. +) else ( + echo [INFO] Creating junction for app in SDK folder... + if exist "%SDK_DIR%\app" del /q /f "%SDK_DIR%\app" + mklink /J "%SDK_DIR%\app" "%CD%\src" + if !errorlevel! neq 0 ( + echo [ERROR] Failed to create junction. Try running as Administrator. + exit /b 1 + ) +) + +:: 5. Ensure output directory exists +if not exist "output\%APP_VERSION%" mkdir "output\%APP_VERSION%" + + +:: --- Berry prebuild --- +call build_scripts\berry_prebuild.bat + +echo [INFO] Starting %ACTION% via Git Bash... +echo. + +"%GIT_BASH%" --login -i "%CD%\build_scripts\build_bk72xx_freertos_inner.sh" "%APP_NAME%" "%APP_VERSION%" "%SDK_DIR%" "%OBK_VARIANT%" "%ACTION%" "bk7252n" +set BUILD_RESULT=%errorlevel% + +if %BUILD_RESULT% neq 0 ( + echo. + echo [ERROR] BK7252N build failed with exit code %BUILD_RESULT%! + exit /b %BUILD_RESULT% +) + +:: --- Copy output --- +echo. +echo [INFO] Checking output files... +set GEN_DIR=%SDK_DIR%\out + +set COPIED_COUNT=0 +if exist "%GEN_DIR%\app.rbl" ( + copy /y "%GEN_DIR%\app.rbl" "output\%APP_VERSION%\%APP_NAME%_%APP_VERSION%.rbl" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_%APP_VERSION%.rbl + set /a COPIED_COUNT+=1 +) +if exist "%GEN_DIR%\bk7252n_QIO.bin" ( + copy /y "%GEN_DIR%\bk7252n_QIO.bin" "output\%APP_VERSION%\%APP_NAME%_QIO_%APP_VERSION%.bin" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_QIO_%APP_VERSION%.bin + set /a COPIED_COUNT+=1 +) +if exist "%GEN_DIR%\bk7252n_UA.bin" ( + copy /y "%GEN_DIR%\bk7252n_UA.bin" "output\%APP_VERSION%\%APP_NAME%_UA_%APP_VERSION%.bin" >nul 2>nul + echo [INFO] Copied: %APP_NAME%_UA_%APP_VERSION%.bin + set /a COPIED_COUNT+=1 +) + +echo. +echo ============================================== +echo BUILD SUCCESSFUL! (%COPIED_COUNT% files copied) +echo ============================================== +echo. +echo Output directory: +echo %CD%\output\%APP_VERSION%\ +exit /b 0 + diff --git a/build_scripts/build_bk7252n_inner.sh b/build_scripts/build_bk7252n_inner.sh new file mode 100644 index 000000000..74ff51605 --- /dev/null +++ b/build_scripts/build_bk7252n_inner.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# Inner build script for BK7252N +# Arguments: APP_NAME APP_VERSION SDK_DIR OBK_VARIANT ACTION +set -e + +APP_NAME="$1" +APP_VERSION="$2" +SDK_DIR="$3" +export OBK_VARIANT="$4" +ACTION="$5" + +echo "[INFO] Inner build script started for BK7252N" + +SCRIPT_DIR="$(pwd)" + +# Export the borrowed ARM GCC toolchain to the environment for Beken FreeRTOS SDK Makefile to pick up +TOOLCHAIN_RAW="$(pwd)/sdk/OpenBK7231N/platforms/BK7231N/toolchain/windows/gcc-arm-none-eabi-4_9-2015q1/bin/" +export ARM_GCC_TOOLCHAIN="$(cygpath -u "$TOOLCHAIN_RAW")/" +export PATH="$ARM_GCC_TOOLCHAIN:$PATH" +echo "[INFO] Toolchain: $ARM_GCC_TOOLCHAIN" + +# Set a localized TEMP dir to avoid PyInstaller extraction permission errors (AntiVirus/Defender locking) +# beken_packager.exe is a PyInstaller bundle that needs to extract VCRUNTIME140.dll +# Use native Windows Temp directory where DLL drops are historically trusted by Defender +# We must double-escape backslashes so MSYS Make doesn't swallow them when passing to subshells! +LOCAL_TMP="$(cygpath -w "$USERPROFILE/AppData/Local/Temp/obk_p_$$" | sed 's/\\/\\\\/g')" +echo "[INFO] Setting local TEMP dir: $LOCAL_TMP" +mkdir -p "$USERPROFILE/AppData/Local/Temp/obk_p_$$" +export TEMP="$LOCAL_TMP" +export TMP="$LOCAL_TMP" +export TMPDIR="$LOCAL_TMP" + +# Navigate to the build system directory +cd "$SDK_DIR" + +# First, check if make is available +if type make > /dev/null 2>&1; then + echo "[INFO] GNU make is available." +else + echo "[INFO] GNU make not found in Git Bash. Attempting to get it..." + MAKE_FOUND=0 + for MAKE_PATH in /c/ProgramData/chocolatey/bin/make.exe /w/TOOLS/msys64/usr/bin/make.exe /c/msys64/usr/bin/make.exe; do + if [ -f "$MAKE_PATH" ]; then + export PATH="$(dirname "$MAKE_PATH"):$PATH" + MAKE_FOUND=1 + echo "[INFO] Found make at $MAKE_PATH" + break + fi + done + if [ $MAKE_FOUND -eq 0 ]; then + echo "[ERROR] GNU make not found!" + exit 1 + fi +fi + +if [ "$ACTION" = "clean" ]; then + echo "[INFO] Running BK7252N clean from $(pwd)..." + make clean -C ./ + exit 0 +fi + +echo "[INFO] Running BK7252N build from $(pwd)..." + +# Strip GCC 4.9 unsupported Wno-error flags from application.mk +sed -i 's/-Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types -Wno-error=return-mismatch -Wno-error=int-conversion -Wno-error=changes-meaning//g' application.mk +# Force encrypt.exe on Windows MSYS (which identifies as MINGW64, unlike MINGW32 tracked in application.mk) +sed -i 's/"\.\/tools\/crc_binary\/encrypt_n"/"\.\/tools\/crc_binary\/encrypt\.exe"/g' application.mk + +# Replace encrypt.exe with the compatible one from OpenBK7231T SDK that supports multi-key arguments +cp "$(cygpath -u "$SCRIPT_DIR/sdk/OpenBK7231T/platforms/bk7231t/bk7231t_os/tools/generate/package_tool/windows/encrypt.exe")" ./tools/crc_binary/encrypt.exe + +make TEMP="$LOCAL_TMP" TMP="$LOCAL_TMP" TMPDIR="$LOCAL_TMP" bk7252n -j8 USER_SW_VER="$APP_VERSION" OBK_DIR="../../src" +./tools/rtt_ota/rt_ota_packaging_tool_cli.exe -f ./out/bsp.bin -o ./out/app.rbl -p app -c gzip -s aes -k 0123456789ABCDEF0123456789ABCDEF -i 0123456789ABCDEF -v "$APP_VERSION" + +echo "[INFO] Build complete!" diff --git a/build_scripts/build_bk72xx_freertos_inner.sh b/build_scripts/build_bk72xx_freertos_inner.sh new file mode 100644 index 000000000..d0b1dc3c3 --- /dev/null +++ b/build_scripts/build_bk72xx_freertos_inner.sh @@ -0,0 +1,85 @@ +#!/bin/bash +# Shared inner build script for all beken_freertos_sdk targets (bk7231u, bk7238, bk7251, bk7252n, etc.) +# Arguments: APP_NAME APP_VERSION SDK_DIR OBK_VARIANT ACTION SOC_TARGET +set -e + +APP_NAME="$1" +APP_VERSION="$2" +SDK_DIR="$3" +export OBK_VARIANT="$4" +ACTION="$5" +SOC_TARGET="$6" + +if [ -z "$SOC_TARGET" ]; then + echo "[ERROR] SOC_TARGET (arg 6) is required! e.g. bk7231u, bk7238, bk7251, bk7252n" + exit 1 +fi + +echo "[INFO] Inner build script started for $SOC_TARGET" + +SCRIPT_DIR="$(pwd)" + +# Export the borrowed ARM GCC toolchain to the environment for Beken FreeRTOS SDK Makefile to pick up +TOOLCHAIN_RAW="$(pwd)/sdk/OpenBK7231N/platforms/BK7231N/toolchain/windows/gcc-arm-none-eabi-4_9-2015q1/bin/" +export ARM_GCC_TOOLCHAIN="$(cygpath -u "$TOOLCHAIN_RAW")/" +export PATH="$ARM_GCC_TOOLCHAIN:$PATH" +echo "[INFO] Toolchain: $ARM_GCC_TOOLCHAIN" + +# Set a localized TEMP dir to avoid PyInstaller extraction permission errors (AntiVirus/Defender locking) +# beken_packager.exe is a PyInstaller bundle that needs to extract VCRUNTIME140.dll +# Use native Windows Temp directory where DLL drops are historically trusted by Defender +# We must double-escape backslashes so MSYS Make doesn't swallow them when passing to subshells! +LOCAL_TMP="$(cygpath -w "$USERPROFILE/AppData/Local/Temp/obk_p_$$" | sed 's/\\/\\\\/g')" +echo "[INFO] Setting local TEMP dir: $LOCAL_TMP" +mkdir -p "$USERPROFILE/AppData/Local/Temp/obk_p_$$" +export TEMP="$LOCAL_TMP" +export TMP="$LOCAL_TMP" +export TMPDIR="$LOCAL_TMP" + +# Navigate to the build system directory +cd "$SDK_DIR" + +# First, check if make is available +if type make > /dev/null 2>&1; then + echo "[INFO] GNU make is available." +else + echo "[INFO] GNU make not found in Git Bash. Attempting to get it..." + MAKE_FOUND=0 + for MAKE_PATH in /c/ProgramData/chocolatey/bin/make.exe /w/TOOLS/msys64/usr/bin/make.exe /c/msys64/usr/bin/make.exe; do + if [ -f "$MAKE_PATH" ]; then + export PATH="$(dirname "$MAKE_PATH"):$PATH" + MAKE_FOUND=1 + echo "[INFO] Found make at $MAKE_PATH" + break + fi + done + if [ $MAKE_FOUND -eq 0 ]; then + echo "[ERROR] GNU make not found!" + exit 1 + fi +fi + +if [ "$ACTION" = "clean" ]; then + echo "[INFO] Running $SOC_TARGET clean from $(pwd)..." + make clean -C ./ + exit 0 +fi + +echo "[INFO] Running $SOC_TARGET build from $(pwd)..." + +# Strip GCC 4.9 unsupported Wno-error flags from application.mk +sed -i 's/-Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types -Wno-error=return-mismatch -Wno-error=int-conversion -Wno-error=changes-meaning//g' application.mk +# Force encrypt.exe on Windows MSYS (which identifies as MINGW64, unlike MINGW32 tracked in application.mk) +sed -i 's/"\.\/tools\/crc_binary\/encrypt_n"/"\.\/tools\/crc_binary\/encrypt\.exe"/g' application.mk + +# Replace encrypt.exe with the compatible one from OpenBK7231T SDK that supports multi-key arguments +cp "$(cygpath -u "$SCRIPT_DIR/sdk/OpenBK7231T/platforms/bk7231t/bk7231t_os/tools/generate/package_tool/windows/encrypt.exe")" ./tools/crc_binary/encrypt.exe + +make TEMP="$LOCAL_TMP" TMP="$LOCAL_TMP" TMPDIR="$LOCAL_TMP" "$SOC_TARGET" -j8 USER_SW_VER="$APP_VERSION" OBK_DIR="../../src" + +# Generate OTA RBL if bsp.bin exists +if [ -f ./out/bsp.bin ]; then + ./tools/rtt_ota/rt_ota_packaging_tool_cli.exe -f ./out/bsp.bin -o ./out/app.rbl -p app -c gzip -s aes -k 0123456789ABCDEF0123456789ABCDEF -i 0123456789ABCDEF -v "$APP_VERSION" +fi + +echo "[INFO] Build complete!" diff --git a/build_scripts/build_bl602.bat b/build_scripts/build_bl602.bat new file mode 100644 index 000000000..b0f28b73f --- /dev/null +++ b/build_scripts/build_bl602.bat @@ -0,0 +1,178 @@ +@echo off +setlocal EnableDelayedExpansion +pushd "%~dp0\.." + +:: ======================================================== +:: OpenBeken BL602 Windows build script +:: Uses Git Bash + Built-in SDK RISC-V toolchain +:: ======================================================== + +set APP_NAME=OpenBL602_App +set APP_VERSION=dev_bl602 +set SDK_DIR=sdk\OpenBL602 +set OBK_VARIANT=2 +set ACTION=build + +:: Allow overriding version from command line +if not "%~1"=="" set APP_VERSION=%~1 +if not "%~2"=="" set ACTION=%~2 + +echo ============================================== +echo Building OpenBeken for BL602 natively on Windows +echo App Name: %APP_NAME% +echo App Version: %APP_VERSION% +echo Variant: %OBK_VARIANT% +echo SDK Dir: %SDK_DIR% +echo Action: %ACTION% +echo ============================================== + +:: --- Check prerequisites --- + +:: 1. Git Bash +set GIT_BASH= +for %%P in ( + "C:\Program Files\Git\bin\bash.exe" + "C:\Program Files (x86)\Git\bin\bash.exe" +) do ( + if exist "%%~P" ( + set "GIT_BASH=%%~P" + goto :found_bash + ) +) +echo [ERROR] Git Bash not found! Please install Git for Windows. +exit /b 1 + +:found_bash +echo [INFO] Using Git Bash: %GIT_BASH% + +:: 2. Check for GNU make +set "MSYS_MAKE=" +for %%P in ( + "C:\msys64\usr\bin\make.exe" + "C:\ProgramData\chocolatey\bin\make.exe" + "W:\TOOLS\msys64\usr\bin\make.exe" +) do ( + if exist "%%~P" ( + set "MSYS_MAKE=%%~dpP" + goto :found_make + ) +) +echo [ERROR] GNU make not found. Please install GNU make (e.g. via pacman or choco). +exit /b 1 + +:found_make +:: Add make to path for this session so bash natively sees it +set PATH=%MSYS_MAKE%;%PATH% +echo [INFO] make found at %MSYS_MAKE% + +:: 3. Python prerequisites for packing BL602 images (they might already be in PATH) +python -c "import pkg_resources; pkg_resources.require(['fdt', 'toml', 'configobj', 'pycryptodomex', 'pycryptodome'])" >nul 2>nul +if !errorlevel! neq 0 ( + echo [INFO] Installing required Python dependencies... + python -m pip install fdt toml configobj pycryptodomex pycryptodome +) else ( + echo [INFO] Python dependencies OK. +) +:: Also ensure Git Bash python has them, because the Makefile uses bash python! +"%GIT_BASH%" --login -c "python -m pip install fdt toml configobj pycryptodome" >nul 2>nul + +:: 4. Check that SDK submodule is checked out +if not exist "%SDK_DIR%\customer_app\bl602_sharedApp\Makefile" ( + echo [INFO] SDK submodule not found, checking out... + git submodule update --init --recursive --depth=1 %SDK_DIR% + if !errorlevel! neq 0 ( + echo [ERROR] Failed to checkout SDK submodule! + exit /b 1 + ) +) +echo [INFO] SDK submodule OK. + +:: 5. Create symlink for Git Bash (MINGW64) to use MSYS toolchain +if not exist "%SDK_DIR%\toolchain\riscv\MINGW64" ( + mklink /J "%SDK_DIR%\toolchain\riscv\MINGW64" "%SDK_DIR%\toolchain\riscv\MSYS" >nul 2>nul +) + + +:: --- Berry prebuild --- +call build_scripts\berry_prebuild.bat + +:: Ensure output directory exists +if not exist "output\%APP_VERSION%" mkdir "output\%APP_VERSION%" + +:: --- Build via Git Bash --- +echo [INFO] Starting %ACTION% via Git Bash... +echo. + +:: Fix for GNU Assembler "Cannot create temporary file in C:\windows\" +set TEMP=%CD%\output\tmp +set TMP=%CD%\output\tmp +set TMPDIR=%CD%\output\tmp +if not exist "%TEMP%" mkdir "%TEMP%" + +if "%ACTION%"=="clean" goto do_clean + +:: Find native Windows python +for /f "delims=" %%I in ('where python') do ( + set "WIN_PYTHON_PATH=%%~fI" + goto found_win_python +) +:found_win_python +set "WIN_PYTHON_PATH_CYG=!WIN_PYTHON_PATH:\=/!" + +:: Create python3 wrapper to force MSYS to use native Windows Python +echo #!/bin/bash> "%TEMP%\python3" +echo "!WIN_PYTHON_PATH_CYG!" "$@">> "%TEMP%\python3" +"%GIT_BASH%" --login -c "chmod +x $(cygpath -u '%TEMP%\python3')" + +:: Run make via Git bash, explicitly injecting TMP vars as make arguments to appease the GNU assembler +"%GIT_BASH%" --login -c "export LOCAL_TMP=$(cygpath -m '%USERPROFILE%\AppData\Local\Temp'); make APP_VERSION=%APP_VERSION% OBK_VARIANT=%OBK_VARIANT% TEMP=\"$LOCAL_TMP\" TMP=\"$LOCAL_TMP\" TMPDIR=\"$LOCAL_TMP\" OpenBL602" +set BUILD_RESULT=!errorlevel! +:: Ignore exit code if the root .bin was generated successfully (indicating only the Python OTA step failed in bash) +if exist "%SDK_DIR%\customer_app\bl602_sharedApp\build_out\bl602_sharedApp.bin" ( + echo [INFO] Firmware compiled successfully. Running native Python OTA generation... + pushd "%SDK_DIR%\image_conf" + python flash_build.py OpenBL602_App BL602 + popd + + echo [INFO] Copying output files... + copy /y "%SDK_DIR%\customer_app\bl602_sharedApp\build_out\bl602_sharedApp.bin" "output\%APP_VERSION%\OpenBL602_%APP_VERSION%.bin" >nul + copy /y "%SDK_DIR%\customer_app\bl602_sharedApp\build_out\ota\dts40M_pt2M_boot2release_ef4015\FW_OTA.bin" "output\%APP_VERSION%\OpenBL602_%APP_VERSION%_OTA.bin" >nul + copy /y "%SDK_DIR%\customer_app\bl602_sharedApp\build_out\ota\dts40M_pt2M_boot2release_ef4015\FW_OTA.bin.xz" "output\%APP_VERSION%\OpenBL602_%APP_VERSION%_OTA.bin.xz" >nul 2>nul + + set BUILD_RESULT=0 +) +goto after_build + +:do_clean +"%GIT_BASH%" --login -c "make -C %SDK_DIR%/customer_app/bl602_sharedApp clean" +set BUILD_RESULT=!errorlevel! + +:after_build + +if !BUILD_RESULT! neq 0 ( + echo. + echo [ERROR] BL602 build failed with exit code !BUILD_RESULT!! + exit /b !BUILD_RESULT! +) + +if "%ACTION%"=="clean" ( + echo. + echo [INFO] Clean complete! + exit /b 0 +) + +echo. +echo ============================================== +echo BUILD SUCCESSFUL! +echo ============================================== +echo. +echo Output directory: +echo %CD%\output\%APP_VERSION%\ +echo. +echo Build files: +echo ---------------------------------------------- +for %%F in (output\%APP_VERSION%\OpenBL602_*) do ( + echo %%~nxF (%%~zF bytes) +) +echo ============================================== +exit /b 0 diff --git a/build_scripts/build_esp32.bat b/build_scripts/build_esp32.bat new file mode 100644 index 000000000..a258b314d --- /dev/null +++ b/build_scripts/build_esp32.bat @@ -0,0 +1,174 @@ +@echo off +setlocal EnableDelayedExpansion +pushd "%~dp0\.." + +:: Default settings +set APP_VERSION=dev_esp32 +set OBK_VARIANT=2 +set ESP_FSIZE=4MB +set TARGET=esp32 +set ACTION=build + +:: Check for target argument +if not "%~1"=="" set TARGET=%~1 +if not "%~2"=="" set ACTION=%~2 + +if "%TARGET%"=="esp32" ( + set BUILD_DIR=platforms\ESP-IDF\build-32 + set BOOTLOADER_ADDR=0x1000 +) else if "%TARGET%"=="esp32c3" ( + set BUILD_DIR=platforms\ESP-IDF\build-c3 + set BOOTLOADER_ADDR=0x0 +) else if "%TARGET%"=="esp32c2" ( + set BUILD_DIR=platforms\ESP-IDF\build-c2 + set BOOTLOADER_ADDR=0x0 +) else if "%TARGET%"=="esp32c5" ( + set BUILD_DIR=platforms\ESP-IDF\build-c5 + set BOOTLOADER_ADDR=0x2000 +) else if "%TARGET%"=="esp32c6" ( + set BUILD_DIR=platforms\ESP-IDF\build-c6 + set BOOTLOADER_ADDR=0x0 +) else if "%TARGET%"=="esp32c61" ( + set BUILD_DIR=platforms\ESP-IDF\build-c61 + set BOOTLOADER_ADDR=0x0 +) else if "%TARGET%"=="esp32s2" ( + set BUILD_DIR=platforms\ESP-IDF\build-s2 + set BOOTLOADER_ADDR=0x1000 +) else if "%TARGET%"=="esp32s3" ( + set BUILD_DIR=platforms\ESP-IDF\build-s3 + set BOOTLOADER_ADDR=0x0 +) else ( + echo [ERROR] Unknown target: %TARGET% + exit /b 1 +) + +echo ============================================== +echo Building OpenBeken ESP32 on Windows natively +echo Target: %TARGET% +echo Size: %ESP_FSIZE% +echo Variant (2=tuyaMCU/4MB): %OBK_VARIANT% +echo Bootloader Addr: %BOOTLOADER_ADDR% +echo Build Directory: %BUILD_DIR% +echo Action: %ACTION% +echo ============================================== + +:: Check if ESP-IDF environment is active +where idf.py >nul 2>nul +if %errorlevel% equ 0 goto :idf_ready + +echo [INFO] ESP-IDF 'idf.py' not found in PATH. +echo [INFO] Attempting to load from sdk\esp-idf... + +if not exist "sdk\esp-idf\export.bat" goto :no_idf + +:: Try export.bat first +call "sdk\esp-idf\export.bat" +where idf.py >nul 2>nul +if %errorlevel% equ 0 goto :idf_ready + +:: export.bat didn't give us idf.py - try install.bat then re-export +echo [INFO] export.bat did not set up environment. Running install.bat... +if not exist "sdk\esp-idf\install.bat" goto :no_idf + +call "sdk\esp-idf\install.bat" + +echo [INFO] Retrying export.bat... +call "sdk\esp-idf\export.bat" +where idf.py >nul 2>nul +if %errorlevel% equ 0 goto :idf_ready + +echo [ERROR] ESP-IDF environment still not available after install+export! +exit /b 1 + +:no_idf +echo [ERROR] ESP-IDF not found! +echo Please ensure sdk\esp-idf is checked out (git submodule update --init --recursive sdk/esp-idf) +exit /b 1 + +:idf_ready +echo [INFO] ESP-IDF environment is ready. + +:: If just cleaning +if "%ACTION%"=="clean" ( + echo [INFO] Cleaning %TARGET%... + if exist %BUILD_DIR% cmake --build %BUILD_DIR% --target clean + echo [INFO] Clean complete! + exit /b 0 +) + +:: Prepare partition tables based on OBK_VARIANT +if exist platforms\ESP-IDF\sdkconfig del platforms\ESP-IDF\sdkconfig +if exist platforms\ESP-IDF\partitions.csv del platforms\ESP-IDF\partitions.csv + +:: Defaulting to 4MB for variant 2 +copy /y platforms\ESP-IDF\partitions-4mb.csv platforms\ESP-IDF\partitions.csv >nul + +:: Set environment variables for IDF cmake +set IDF_TARGET=%TARGET% + + +:: --- Berry prebuild --- +call build_scripts\berry_prebuild.bat + +:: Configure CMake via ESP-IDF toolchain +echo [INFO] Running CMake configuration for %TARGET%... +cmake platforms\ESP-IDF -B %BUILD_DIR% -G "Ninja" +if !errorlevel! neq 0 ( + echo [ERROR] CMake configuration failed! + exit /b 1 +) + +:: Build using CMake +echo [INFO] Building with CMake/Ninja... +cmake --build %BUILD_DIR% -j +if !errorlevel! neq 0 ( + echo [ERROR] Build failed! + exit /b 1 +) + +:: Ensure output directory exists +echo [INFO] Creating output directory... +if not exist "output\%APP_VERSION%" mkdir output\%APP_VERSION% + +:: Determine output names +if "%TARGET%"=="esp32" ( + set OUT_NAME=OpenESP32 +) else if "%TARGET%"=="esp32c3" ( + set OUT_NAME=OpenESP32C3 +) else if "%TARGET%"=="esp32c2" ( + set OUT_NAME=OpenESP32C2 +) else if "%TARGET%"=="esp32c5" ( + set OUT_NAME=OpenESP32C5 +) else if "%TARGET%"=="esp32c6" ( + set OUT_NAME=OpenESP32C6 +) else if "%TARGET%"=="esp32c61" ( + set OUT_NAME=OpenESP32C61 +) else if "%TARGET%"=="esp32s2" ( + set OUT_NAME=OpenESP32S2 +) else if "%TARGET%"=="esp32s3" ( + set OUT_NAME=OpenESP32S3 +) else ( + set OUT_NAME=Open%TARGET% +) + +:: Package binaries using esptool +echo [INFO] Merging binaries with esptool... +set FACTORY_BIN=output\%APP_VERSION%\!OUT_NAME!_%APP_VERSION%.factory.bin +set IMG_BIN=output\%APP_VERSION%\!OUT_NAME!_%APP_VERSION%.img + +python -m esptool -c %TARGET% merge_bin -o !FACTORY_BIN! --flash_mode dio --flash_size %ESP_FSIZE% %BOOTLOADER_ADDR% %BUILD_DIR%\bootloader\bootloader.bin 0x8000 %BUILD_DIR%\partition_table\partition-table.bin 0x10000 %BUILD_DIR%\OpenBeken.bin +if !errorlevel! neq 0 ( + echo [ERROR] esptool merge failed! + exit /b 1 +) + +copy /y %BUILD_DIR%\OpenBeken.bin !IMG_BIN! >nul + +echo ============================================== +echo BUILD SUCCESSFUL! +echo Output files located in output\%APP_VERSION% +echo Factory Bin: !FACTORY_BIN! +echo OTA Bin: !IMG_BIN! +echo ============================================== +exit /b 0 + diff --git a/build_scripts/build_esp8266.bat b/build_scripts/build_esp8266.bat new file mode 100644 index 000000000..fae0fe01e --- /dev/null +++ b/build_scripts/build_esp8266.bat @@ -0,0 +1,203 @@ +@echo off +setlocal EnableDelayedExpansion +pushd "%~dp0\.." + +:: Default settings +set APP_VERSION=dev_esp8266 +set OBK_VARIANT=1 +set ESP_FSIZE=2MB +set ACTION=build +set BUILD_DIR=platforms\ESP8266\build +set BOOTLOADER_ADDR=0x0 + +:: Check for action argument +if not "%~1"=="" set ACTION=%~1 + +echo ============================================== +echo Building OpenBeken ESP8266 on Windows natively +echo Size: %ESP_FSIZE% +echo Variant: %OBK_VARIANT% +echo Bootloader Addr: %BOOTLOADER_ADDR% +echo Build Directory: %BUILD_DIR% +echo Action: %ACTION% +echo ============================================== + +:: The ESP8266 RTOS SDK uses its own idf.py from sdk\OpenESP8266 +:: We need to set IDF_PATH to this SDK, not the ESP-IDF one +set IDF_PATH=%CD%\sdk\OpenESP8266 + +if not exist "%IDF_PATH%\tools\idf.py" ( + echo [ERROR] ESP8266 RTOS SDK not found at %IDF_PATH% + echo Please ensure sdk\OpenESP8266 is checked out: + echo git submodule update --init --recursive sdk/OpenESP8266 + exit /b 1 +) + +:: Check that Berry submodule is checked out +if not exist "libraries\berry\src\be_api.c" ( + echo [INFO] Berry submodule not found, checking out... + git submodule update --init --depth=1 libraries\berry + if !errorlevel! neq 0 ( + echo [ERROR] Failed to checkout Berry submodule! + exit /b 1 + ) +) +echo [INFO] Berry submodule OK. + +:: Set environment variables for the build +set APP_VERSION=%APP_VERSION% +set OBK_VARIANT=%OBK_VARIANT% + +:: Try to set up the ESP8266 toolchain environment +:: First check if xtensa-lx106-elf-gcc is already available +where xtensa-lx106-elf-gcc >nul 2>nul +if %errorlevel% equ 0 goto :toolchain_ready + +echo [INFO] xtensa-lx106-elf toolchain not found in PATH. +echo [INFO] Attempting to install/export ESP8266 tools... + +:: Run idf_tools.py to install and export +python "%IDF_PATH%\tools\idf_tools.py" install +if !errorlevel! neq 0 ( + echo [ERROR] Failed to install ESP8266 tools! + exit /b 1 +) + +:: Get the export paths from idf_tools.py +for /f "usebackq delims=" %%i in (`python "%IDF_PATH%\tools\idf_tools.py" export --format key-value 2^>nul`) do ( + set "%%i" +) + +:: Also try to add the tool paths via the standard mechanism +for /f "usebackq delims=" %%i in (`python "%IDF_PATH%\tools\idf_tools.py" export 2^>nul`) do ( + set "TOOL_EXPORTS=%%i" +) +if defined TOOL_EXPORTS ( + :: The export command outputs something like: export PATH="..." + :: Parse and apply it + for /f "tokens=2 delims==" %%p in ("!TOOL_EXPORTS!") do ( + set "EXTRACTED_PATH=%%~p" + ) + if defined EXTRACTED_PATH ( + set "PATH=!EXTRACTED_PATH!;!PATH!" + ) +) + +:: Check again +where xtensa-lx106-elf-gcc >nul 2>nul +if %errorlevel% equ 0 goto :toolchain_ready + +:: Last resort: try to find it in the espressif tools directory +set ESPRESSIF_TOOLS=%USERPROFILE%\.espressif\tools +if exist "%ESPRESSIF_TOOLS%\xtensa-lx106-elf" ( + for /d %%d in ("%ESPRESSIF_TOOLS%\xtensa-lx106-elf\*") do ( + if exist "%%d\xtensa-lx106-elf\bin\xtensa-lx106-elf-gcc.exe" ( + set "PATH=%%d\xtensa-lx106-elf\bin;!PATH!" + echo [INFO] Found toolchain at %%d\xtensa-lx106-elf\bin + goto :toolchain_ready + ) + ) +) + +echo [WARNING] xtensa-lx106-elf toolchain may not be available. +echo [WARNING] Build may fail. Install with: python sdk\OpenESP8266\tools\idf_tools.py install + +:toolchain_ready +echo [INFO] Toolchain environment ready. + +:: Activate the ESP8266 RTOS SDK Python virtual environment +:: The SDK's check_python_dependencies.py requires packages installed in the venv +set ESPRESSIF_VENV= +for /d %%v in ("%USERPROFILE%\.espressif\python_env\rtos3.4_py*") do ( + if exist "%%v\Scripts\activate.bat" set "ESPRESSIF_VENV=%%v" +) +if defined ESPRESSIF_VENV ( + echo [INFO] Activating Python venv: !ESPRESSIF_VENV! + call "!ESPRESSIF_VENV!\Scripts\activate.bat" +) else ( + echo [INFO] No ESP8266 Python venv found, installing... + python "%IDF_PATH%\tools\idf_tools.py" install-python-env + if !errorlevel! neq 0 ( + echo [ERROR] Failed to install ESP8266 Python environment! + echo [INFO] You can try manually: python sdk\OpenESP8266\tools\idf_tools.py install-python-env + exit /b 1 + ) + :: Re-scan for the newly created venv + for /d %%v in ("%USERPROFILE%\.espressif\python_env\rtos3.4_py*") do ( + if exist "%%v\Scripts\activate.bat" set "ESPRESSIF_VENV=%%v" + ) + if defined ESPRESSIF_VENV ( + echo [INFO] Activating Python venv: !ESPRESSIF_VENV! + call "!ESPRESSIF_VENV!\Scripts\activate.bat" + ) else ( + echo [WARNING] Python venv was installed but could not be found. Using system Python. + ) +) + +:: If just cleaning +if "%ACTION%"=="clean" ( + echo [INFO] Cleaning ESP8266 build... + if exist %BUILD_DIR% cmake --build %BUILD_DIR% --target clean + echo [INFO] Clean complete! + exit /b 0 +) + +:: Set up partition table (2MB default) +if exist platforms\ESP8266\partitions.csv del platforms\ESP8266\partitions.csv +copy /y platforms\ESP8266\partitions-2mb.csv platforms\ESP8266\partitions.csv >nul + +:: Remove stale sdkconfig to allow defaults to regenerate +if exist platforms\ESP8266\sdkconfig del platforms\ESP8266\sdkconfig + + +:: --- Berry prebuild --- +call build_scripts\berry_prebuild.bat + +:: Configure CMake via the ESP8266 RTOS SDK +echo [INFO] Running CMake configuration for ESP8266... +cmake platforms\ESP8266 -B %BUILD_DIR% -G "Ninja" +if !errorlevel! neq 0 ( + echo [ERROR] CMake configuration failed! + exit /b 1 +) + +:: Build using CMake/Ninja +echo [INFO] Building with CMake/Ninja... +cmake --build %BUILD_DIR% -j +if !errorlevel! neq 0 ( + echo [ERROR] Build failed! + exit /b 1 +) + +:: Ensure output directory exists +echo [INFO] Creating output directory... +if not exist "output\%APP_VERSION%" mkdir output\%APP_VERSION% + +set OUT_NAME=OpenESP8266 + +:: Package binaries using esptool +echo [INFO] Merging binaries with esptool... +set FACTORY_BIN=output\%APP_VERSION%\!OUT_NAME!_%APP_VERSION%.factory.bin +set IMG_BIN=output\%APP_VERSION%\!OUT_NAME!_%APP_VERSION%.img + +python -m esptool --chip esp8266 merge_bin -o !FACTORY_BIN! --flash_mode dout --flash_size %ESP_FSIZE% %BOOTLOADER_ADDR% %BUILD_DIR%\bootloader\bootloader.bin 0x8000 %BUILD_DIR%\partition_table\partition-table.bin 0x10000 %BUILD_DIR%\OpenBeken.bin +if !errorlevel! neq 0 ( + :: Try with esptool.py directly from SDK + echo [INFO] Retrying with SDK esptool... + python "%IDF_PATH%\components\esptool_py\esptool\esptool.py" --chip esp8266 merge_bin -o !FACTORY_BIN! --flash_mode dout --flash_size %ESP_FSIZE% %BOOTLOADER_ADDR% %BUILD_DIR%\bootloader\bootloader.bin 0x8000 %BUILD_DIR%\partition_table\partition-table.bin 0x10000 %BUILD_DIR%\OpenBeken.bin + if !errorlevel! neq 0 ( + echo [ERROR] esptool merge failed! + exit /b 1 + ) +) + +copy /y %BUILD_DIR%\OpenBeken.bin !IMG_BIN! >nul + +echo ============================================== +echo BUILD SUCCESSFUL! +echo Output files located in output\%APP_VERSION% +echo Factory Bin: !FACTORY_BIN! +echo OTA Bin: !IMG_BIN! +echo ============================================== +exit /b 0 + diff --git a/build_scripts/build_ln882h.bat b/build_scripts/build_ln882h.bat new file mode 100644 index 000000000..a9fde43ee --- /dev/null +++ b/build_scripts/build_ln882h.bat @@ -0,0 +1,165 @@ +@echo off +setlocal EnableDelayedExpansion +pushd "%~dp0\.." + +:: Default settings +set APP_VERSION=dev_ln882h +set OBK_VARIANT=2 +set ACTION=build + +if not "%~1"=="" set APP_VERSION=%~1 +if not "%~2"=="" set OBK_VARIANT=%~2 +if not "%~3"=="" set ACTION=%~3 + +echo ============================================== +echo Building OpenBeken LN882H on Windows natively +echo App Version: %APP_VERSION% +echo Variant (2=tuyaMCU): %OBK_VARIANT% +echo Action: %ACTION% +echo ============================================== + +:: 1. Check prerequisites + +:: Git Bash +set GIT_BASH= +for %%P in ( + "C:\Program Files\Git\bin\bash.exe" + "C:\Program Files (x86)\Git\bin\bash.exe" +) do ( + if exist "%%~P" ( + set "GIT_BASH=%%~P" + goto :found_bash + ) +) +echo [ERROR] Git Bash not found! Please install Git for Windows. +exit /b 1 + +:found_bash +echo [INFO] Using Git Bash: %GIT_BASH% + +:: Check CMake +where cmake >nul 2>nul +if %errorlevel% neq 0 ( + echo [ERROR] 'cmake' not found in PATH! + echo [INFO] Please install CMake from cmake.org or via your package manager. + exit /b 1 +) + +:: Check Ninja +where ninja >nul 2>nul +if %errorlevel% neq 0 ( + echo [ERROR] 'ninja' not found in PATH! + echo [INFO] LN882H build uses Ninja generator. Please install Ninja and add it to your PATH. + exit /b 1 +) +echo [INFO] CMake and Ninja found. + +:: 2. Submodules +if not exist "sdk\OpenLN882H\CMakeLists.txt" ( + echo [INFO] OpenLN882H submodule not found, checking out... + git submodule update --init --recursive sdk\OpenLN882H + if !errorlevel! neq 0 ( + echo [ERROR] Failed to checkout OpenLN882H submodule! + exit /b 1 + ) +) +echo [INFO] LN882H submodule OK. + +if not exist "libraries\berry\src\be_api.c" ( + echo [INFO] Berry submodule not found, checking out... + git submodule update --init --depth=1 libraries\berry +) +echo [INFO] Berry submodule OK. + +:: 3. Toolchain +set "CROSS_TOOLCHAIN_ROOT=%CD%\sdk\OpenBK7231N\platforms\BK7231N\toolchain\windows\gcc-arm-none-eabi-4_9-2015q1" +if not exist "%CROSS_TOOLCHAIN_ROOT%\bin\arm-none-eabi-gcc.exe" ( + echo [ERROR] ARM GCC not found at !CROSS_TOOLCHAIN_ROOT! + echo [INFO] We reuse the BK7231N toolchain. Please ensure BK7231N SDK is updated. + git submodule update --init --depth=1 sdk/OpenBK7231N +) +echo [INFO] Toolchain set to: !CROSS_TOOLCHAIN_ROOT! + +:: Export APP_VERSION and OBK_VARIANT for Python and CMake +set APP_VERSION=%APP_VERSION% +set OBK_VARIANT=%OBK_VARIANT% + +:: 4. Python3 workaround for subprocess "python3" +echo [INFO] Resolving Python dependency... +for /f "delims=" %%I in ('where python') do ( + set "WIN_PYTHON_PATH=%%~fI" + goto found_win_python +) +:found_win_python +set PYTHON_TMP=%CD%\output\tmp_python +if not exist "%PYTHON_TMP%" mkdir "%PYTHON_TMP%" +if not exist "%PYTHON_TMP%\python3.exe" ( + copy /y "!WIN_PYTHON_PATH!" "%PYTHON_TMP%\python3.exe" >nul +) +set PATH=%PYTHON_TMP%;%PATH% + +:: --- Berry prebuild --- +call build_scripts\berry_prebuild.bat + +if "%ACTION%"=="clean" ( + pushd sdk\OpenLN882H + python start_build.py clean + popd + echo [INFO] Clean complete! + exit /b 0 +) + +:: 4. Pre-build script / App Symlink +if not exist "sdk\OpenLN882H\project\OpenBeken\app" ( + echo [INFO] Creating junction for app in LN882H OpenBeken project... + mklink /J "%CD%\sdk\OpenLN882H\project\OpenBeken\app" "%CD%" >nul 2>nul + if !errorlevel! neq 0 ( + echo [ERROR] Failed to create junction. Try running as Administrator. + exit /b 1 + ) +) + +if exist "platforms\LN882H\pre_build.sh" ( + echo [INFO] Running LN882H pre-build bash script... + "%GIT_BASH%" --login -c "cd '%CD:\=/%'; platforms/LN882H/pre_build.sh" +) + +:: 5. Compile +echo [INFO] Building LN882H... +pushd sdk\OpenLN882H +python start_build.py %ACTION% +set BUILD_RESULT=!errorlevel! +popd + +if !BUILD_RESULT! neq 0 ( + echo [ERROR] LN882H build failed with exit code !BUILD_RESULT! + exit /b !BUILD_RESULT! +) + +:: Ensure output directory exists +if not exist "output\%APP_VERSION%" mkdir "output\%APP_VERSION%" + +set OUT_NAME=OpenLN882H_%APP_VERSION% + +:: Package binaries (The python script writes to bin/flashimage.bin inside sdk/OpenLN882H/build) +echo [INFO] Copying binaries... + +set BLD_DIR=sdk\OpenLN882H\build-OpenBeken-release\bin +set FACTORY_BIN=output\%APP_VERSION%\%OUT_NAME%.factory.bin + +if exist "%BLD_DIR%\flashimage.bin" ( + copy /y "%BLD_DIR%\flashimage.bin" "!FACTORY_BIN!" >nul + echo [INFO] Factory binary created at: !FACTORY_BIN! +) else ( + echo [WARNING] Flash image not found at %BLD_DIR%\flashimage.bin! +) + +:: The OTA image in LN882H +if exist "%BLD_DIR%\OpenBeken.bin" ( + copy /y "%BLD_DIR%\OpenBeken.bin" "output\%APP_VERSION%\%OUT_NAME%_OTA.bin" >nul +) + +echo ============================================== +echo BUILD SUCCESSFUL! +echo ============================================== +exit /b 0 diff --git a/build_scripts/build_rtl8710b.bat b/build_scripts/build_rtl8710b.bat new file mode 100644 index 000000000..caf113285 --- /dev/null +++ b/build_scripts/build_rtl8710b.bat @@ -0,0 +1,105 @@ +@echo off +setlocal EnableDelayedExpansion + +set APP_VERSION=dev_rtl8710b +set APP_NAME=OpenBK7231T_App +set ACTION=all + +if not "%~1"=="" set APP_VERSION=%~1 +if not "%~2"=="" set OBK_VARIANT=%~2 +if not "%~3"=="" set ACTION=%~3 + +echo ============================================== +echo Building OpenBeken RTL8710B on Windows natively +echo App Version: %APP_VERSION% +echo Action: %ACTION% +echo ============================================== + +:: 1. Check for GNU make (requires MSYS2 or similar for Windows natively) +set "MSYS_MAKE=" +for %%P in ( + "C:\msys64\usr\bin\make.exe" + "C:\ProgramData\chocolatey\bin\make.exe" + "W:\TOOLS\msys64\usr\bin\make.exe" +) do ( + if exist "%%~P" ( + set "MSYS_MAKE=%%~dpP" + goto :found_make + ) +) +echo [ERROR] GNU make not found. Please install GNU make (e.g. MSYS2 or choco). +exit /b 1 + +:found_make +echo [INFO] GNU make found at %MSYS_MAKE% + +:: 2. Check for Git Bash bins (to provide cp, rm, bash for make natively) +set "GIT_USR_BIN=" +if exist "C:\Program Files\Git\usr\bin\sh.exe" set "GIT_USR_BIN=C:\Program Files\Git\usr\bin" +if exist "C:\Program Files\Git\bin\sh.exe" set "GIT_USR_BIN=C:\Program Files\Git\bin" +if not "%GIT_USR_BIN%"=="" ( + echo [INFO] Unix Utilities found at: %GIT_USR_BIN% +) + +:: 3. Check for toolchain +set "TOOLCHAIN_ROOT=%CD%\sdk\OpenBK7231N\platforms\BK7231N\toolchain\windows\gcc-arm-none-eabi-4_9-2015q1" +if not exist "%TOOLCHAIN_ROOT%\bin\arm-none-eabi-gcc.exe" ( + echo [ERROR] GCC 4.9 toolchain not found at %TOOLCHAIN_ROOT% + exit /b 1 +) +echo [INFO] Toolchain set to: %TOOLCHAIN_ROOT% + +:: 3. Submodule Sync Check (OpenRTL8710A_B and libraries/berry) +if not exist "sdk\OpenRTL8710A_B\project\obk_amebaz\GCC-RELEASE\Makefile" ( + echo [INFO] OpenRTL8710A_B submodule missing or empty. Initializing... + git submodule update --init sdk/OpenRTL8710A_B +) else ( + echo [INFO] RTL8710B submodule OK. +) + +if not exist "libraries\berry\src\be_api.c" ( + echo [INFO] Berry submodule missing or empty. Initializing... + git submodule update --init libraries/berry +) else ( + echo [INFO] Berry submodule OK. +) +echo [INFO] Resolving Berry paths... +call build_scripts\berry_prebuild.bat +if !errorlevel! neq 0 ( + echo [ERROR] Berry prebuild failed. + exit /b 1 +) + +:: 5. Compile RTL8710B +echo [INFO] Building RTL8710B using OS=CYGWIN to enable Native Windows .exe parsing... +echo [INFO] Entering compilation phase... + +:: Inject Make, SysUtils, and Toolchain into PATH just before make (to avoid MSYS python conflicts) +set "PATH=%MSYS_MAKE%;%GIT_USR_BIN%;%TOOLCHAIN_ROOT%\bin;%PATH%" + +pushd sdk\OpenRTL8710A_B\project\obk_amebaz\GCC-RELEASE +make OS=CYGWIN %ACTION% +set BUILD_RESULT=!errorlevel! +popd + +if %BUILD_RESULT% neq 0 ( + echo [ERROR] Build failed with code %BUILD_RESULT% + exit /b %BUILD_RESULT% +) + +:: 6. Copy Binaries +echo [INFO] Copying binaries... +if not exist "output\%APP_VERSION%" mkdir "output\%APP_VERSION%" + +set "BIN_DIR=sdk\OpenRTL8710A_B\project\obk_amebaz\GCC-RELEASE\application\Debug\bin" + +if exist "%BIN_DIR%\image2_all_ota1.bin" ( + copy /y "%BIN_DIR%\image2_all_ota1.bin" "output\%APP_VERSION%\%APP_VERSION%_RTL8710B_OTA.bin" >nul +) else ( + echo [WARNING] OTA image not found at %BIN_DIR%\image2_all_ota1.bin +) + +echo ============================================== +echo BUILD SUCCESSFUL +echo ============================================== +exit /b 0 diff --git a/build_scripts/obk_bk7231n_build.bat b/build_scripts/obk_bk7231n_build.bat new file mode 100644 index 000000000..784be10f1 --- /dev/null +++ b/build_scripts/obk_bk7231n_build.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_bk7231n.bat" dev_bk7231n build diff --git a/build_scripts/obk_bk7231n_clean.bat b/build_scripts/obk_bk7231n_clean.bat new file mode 100644 index 000000000..68f4f5f97 --- /dev/null +++ b/build_scripts/obk_bk7231n_clean.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_bk7231n.bat" dev_bk7231n clean diff --git a/build_scripts/obk_bk7231t_build.bat b/build_scripts/obk_bk7231t_build.bat new file mode 100644 index 000000000..3f5e1d2c3 --- /dev/null +++ b/build_scripts/obk_bk7231t_build.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_bk7231t.bat" dev_bk7231t build diff --git a/build_scripts/obk_bk7231t_clean.bat b/build_scripts/obk_bk7231t_clean.bat new file mode 100644 index 000000000..2d8b65397 --- /dev/null +++ b/build_scripts/obk_bk7231t_clean.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_bk7231t.bat" dev_bk7231t clean diff --git a/build_scripts/obk_bk7231u_build.bat b/build_scripts/obk_bk7231u_build.bat new file mode 100644 index 000000000..23ea73a96 --- /dev/null +++ b/build_scripts/obk_bk7231u_build.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_bk7231u.bat" dev_bk7231u build diff --git a/build_scripts/obk_bk7231u_clean.bat b/build_scripts/obk_bk7231u_clean.bat new file mode 100644 index 000000000..16ebd1632 --- /dev/null +++ b/build_scripts/obk_bk7231u_clean.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_bk7231u.bat" dev_bk7231u clean diff --git a/build_scripts/obk_bk7238_build.bat b/build_scripts/obk_bk7238_build.bat new file mode 100644 index 000000000..fe99e3e3f --- /dev/null +++ b/build_scripts/obk_bk7238_build.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_bk7238.bat" dev_bk7238 build diff --git a/build_scripts/obk_bk7238_clean.bat b/build_scripts/obk_bk7238_clean.bat new file mode 100644 index 000000000..c98f4654d --- /dev/null +++ b/build_scripts/obk_bk7238_clean.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_bk7238.bat" dev_bk7238 clean diff --git a/build_scripts/obk_bk7251_build.bat b/build_scripts/obk_bk7251_build.bat new file mode 100644 index 000000000..14d472d78 --- /dev/null +++ b/build_scripts/obk_bk7251_build.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_bk7251.bat" dev_bk7251 build diff --git a/build_scripts/obk_bk7251_clean.bat b/build_scripts/obk_bk7251_clean.bat new file mode 100644 index 000000000..8f7d09c6b --- /dev/null +++ b/build_scripts/obk_bk7251_clean.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_bk7251.bat" dev_bk7251 clean diff --git a/build_scripts/obk_bk7252n_build.bat b/build_scripts/obk_bk7252n_build.bat new file mode 100644 index 000000000..ac1db5557 --- /dev/null +++ b/build_scripts/obk_bk7252n_build.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_bk7252n.bat" dev_bk7252n build diff --git a/build_scripts/obk_bk7252n_clean.bat b/build_scripts/obk_bk7252n_clean.bat new file mode 100644 index 000000000..c1ae68107 --- /dev/null +++ b/build_scripts/obk_bk7252n_clean.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_bk7252n.bat" dev_bk7252n clean diff --git a/build_scripts/obk_bl602_build.bat b/build_scripts/obk_bl602_build.bat new file mode 100644 index 000000000..d9f359e5a --- /dev/null +++ b/build_scripts/obk_bl602_build.bat @@ -0,0 +1,4 @@ +@echo off +pushd "%~dp0\.." +call build_scripts\build_bl602.bat dev_bl602 build +popd diff --git a/build_scripts/obk_bl602_clean.bat b/build_scripts/obk_bl602_clean.bat new file mode 100644 index 000000000..325a5cd65 --- /dev/null +++ b/build_scripts/obk_bl602_clean.bat @@ -0,0 +1,4 @@ +@echo off +pushd "%~dp0\.." +call build_scripts\build_bl602.bat dev_bl602 clean +popd diff --git a/build_scripts/obk_esp32_build.bat b/build_scripts/obk_esp32_build.bat new file mode 100644 index 000000000..84786c852 --- /dev/null +++ b/build_scripts/obk_esp32_build.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_esp32.bat" esp32 build diff --git a/build_scripts/obk_esp32_clean.bat b/build_scripts/obk_esp32_clean.bat new file mode 100644 index 000000000..b527ac3d8 --- /dev/null +++ b/build_scripts/obk_esp32_clean.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_esp32.bat" esp32 clean diff --git a/build_scripts/obk_esp32c2_build.bat b/build_scripts/obk_esp32c2_build.bat new file mode 100644 index 000000000..584bbad87 --- /dev/null +++ b/build_scripts/obk_esp32c2_build.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_esp32.bat" esp32c2 build diff --git a/build_scripts/obk_esp32c2_clean.bat b/build_scripts/obk_esp32c2_clean.bat new file mode 100644 index 000000000..8f80d8c9d --- /dev/null +++ b/build_scripts/obk_esp32c2_clean.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_esp32.bat" esp32c2 clean diff --git a/build_scripts/obk_esp32c3_build.bat b/build_scripts/obk_esp32c3_build.bat new file mode 100644 index 000000000..112ede29b --- /dev/null +++ b/build_scripts/obk_esp32c3_build.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_esp32.bat" esp32c3 build diff --git a/build_scripts/obk_esp32c3_clean.bat b/build_scripts/obk_esp32c3_clean.bat new file mode 100644 index 000000000..165dcb25d --- /dev/null +++ b/build_scripts/obk_esp32c3_clean.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_esp32.bat" esp32c3 clean diff --git a/build_scripts/obk_esp32c5_build.bat b/build_scripts/obk_esp32c5_build.bat new file mode 100644 index 000000000..7a781df8f --- /dev/null +++ b/build_scripts/obk_esp32c5_build.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_esp32.bat" esp32c5 build diff --git a/build_scripts/obk_esp32c5_clean.bat b/build_scripts/obk_esp32c5_clean.bat new file mode 100644 index 000000000..bd5e376b0 --- /dev/null +++ b/build_scripts/obk_esp32c5_clean.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_esp32.bat" esp32c5 clean diff --git a/build_scripts/obk_esp32c61_build.bat b/build_scripts/obk_esp32c61_build.bat new file mode 100644 index 000000000..36972a14d --- /dev/null +++ b/build_scripts/obk_esp32c61_build.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_esp32.bat" esp32c61 build diff --git a/build_scripts/obk_esp32c61_clean.bat b/build_scripts/obk_esp32c61_clean.bat new file mode 100644 index 000000000..b0b63d4fb --- /dev/null +++ b/build_scripts/obk_esp32c61_clean.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_esp32.bat" esp32c61 clean diff --git a/build_scripts/obk_esp32c6_build.bat b/build_scripts/obk_esp32c6_build.bat new file mode 100644 index 000000000..701d63ce3 --- /dev/null +++ b/build_scripts/obk_esp32c6_build.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_esp32.bat" esp32c6 build diff --git a/build_scripts/obk_esp32c6_clean.bat b/build_scripts/obk_esp32c6_clean.bat new file mode 100644 index 000000000..012d51ff6 --- /dev/null +++ b/build_scripts/obk_esp32c6_clean.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_esp32.bat" esp32c6 clean diff --git a/build_scripts/obk_esp32s2_build.bat b/build_scripts/obk_esp32s2_build.bat new file mode 100644 index 000000000..457d0be5f --- /dev/null +++ b/build_scripts/obk_esp32s2_build.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_esp32.bat" esp32s2 build diff --git a/build_scripts/obk_esp32s2_clean.bat b/build_scripts/obk_esp32s2_clean.bat new file mode 100644 index 000000000..b1d4af277 --- /dev/null +++ b/build_scripts/obk_esp32s2_clean.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_esp32.bat" esp32s2 clean diff --git a/build_scripts/obk_esp32s3_build.bat b/build_scripts/obk_esp32s3_build.bat new file mode 100644 index 000000000..0b2b169aa --- /dev/null +++ b/build_scripts/obk_esp32s3_build.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_esp32.bat" esp32s3 build diff --git a/build_scripts/obk_esp32s3_clean.bat b/build_scripts/obk_esp32s3_clean.bat new file mode 100644 index 000000000..9cd3a8420 --- /dev/null +++ b/build_scripts/obk_esp32s3_clean.bat @@ -0,0 +1,2 @@ +@echo off +call "%~dp0build_esp32.bat" esp32s3 clean diff --git a/build_scripts/obk_esp8266_build.bat b/build_scripts/obk_esp8266_build.bat new file mode 100644 index 000000000..4cd50b315 --- /dev/null +++ b/build_scripts/obk_esp8266_build.bat @@ -0,0 +1 @@ +@call "%~dp0build_esp8266.bat" build diff --git a/build_scripts/obk_esp8266_clean.bat b/build_scripts/obk_esp8266_clean.bat new file mode 100644 index 000000000..b0e591cf5 --- /dev/null +++ b/build_scripts/obk_esp8266_clean.bat @@ -0,0 +1 @@ +@call "%~dp0build_esp8266.bat" clean diff --git a/obk_ln882h_build.bat b/obk_ln882h_build.bat new file mode 100644 index 000000000..4ccf2a306 --- /dev/null +++ b/obk_ln882h_build.bat @@ -0,0 +1,2 @@ +@echo off +call build_scripts\build_ln882h.bat %* diff --git a/obk_rtl8710b_build.bat b/obk_rtl8710b_build.bat new file mode 100644 index 000000000..c5fca5180 --- /dev/null +++ b/obk_rtl8710b_build.bat @@ -0,0 +1,2 @@ +@echo off +call build_scripts\build_rtl8710b.bat %*