This commit is contained in:
huangruiqiao 2025-04-10 17:31:33 +08:00
parent efcc424824
commit 2a3c14fd6a
5197 changed files with 3631022 additions and 3 deletions

View File

@ -1,3 +0,0 @@
# ec728
handcuff firmware

View File

@ -0,0 +1,49 @@
说明:
APP目录包含spi_ethernet功能以及mifi网络切换相关接口
以太网及mifi功能编译
1.将APP目录下内容拷贝到PLAT目录中
2.以太网功能编译:
方法一:
1)将project\ec7xx_0h00\ap\apps\bootloader文件夹拷贝到project\ec7xx_ref_1h00\ap\apps;
2)将project\ec7xx_ref_1h00\ap\apps\bootloader\GCC\ec7xx_0h00_flash.ld文件重命名为ec7xx_ref_1h00_flash.ld
3)修改project\ec7xx_ref_1h00\ap\apps\bootloader\GCC\Makefile中AVAILABLE_TARGETS变量
AVAILABLE_TARGETS = ec7xx_ref_1h00
4)编译ec716s_openbuild_ref_1h00.bat spi_ethernet
方法二:
将spi_ethernet工程拷贝到project\ec7xx_0h00\ap\apps中,再在需要编译的bat脚本中添加编译选项即可。
注意需要同步修改spi_ethernet工程Makefile中AVAILABLE_TARGET配置以及Makefile.rules路径
AVAILABLE_TARGETS = ec7xx_0h00
include $(TOP)/PLAT/tools/scripts/Makefile.rules
#include $(TOP)/PLAT/project/$(TARGET)/$(CORE)/apps/Makefile.rules
3.mifi项目编译
1)不包含mifi网络切换STA<<=====>>softAP功能直接使用默认配置编译即可GccBuild_ec716s.bat spi_2boards
2)包含mifi网络切换STA<<=====>>softAP功能请在tools\scripts\Makefile.rules添加subsys路径编译规则:
#-------------------------------------------------------------------------------
# Rules
#-------------------------------------------------------------------------------
.
.
.
include $(TOP)/PLAT/middleware/thirdparty/Makefile.inc
/*add build rools of subsys */
ifeq ($(SUBSYS_ENABLE),y)
include $(TOP)/PLAT/subsys/Makefile.inc
endif
3)然后使用默认配置编译即可GccBuild_ec716s.bat spi_2boards

View File

@ -0,0 +1,737 @@
@echo off && setlocal enabledelayedexpansion
@echo %PATH% | findstr /c:"%~dp0tools/msys64/usr/bin">nul
@if %errorlevel% equ 1 set PATH=%~dp0tools/msys64/usr/bin;%PATH%
rem @set PATH=%~dp0tools/msys64/usr/bin;%PATH%
cls
set PROJECT_NAME=spi_ethernet
set BOARD_NAME=ec7xx_ref_1h00
set CHIP_NAME=ec7xx
set CHIP_TYPE=ec716s
set CORE_NAME=ap
set EUTRAN_MODE=cat_mode
set BUILD_OPTION=merge
set UNILOG=false
set TOOLCHAIN_NAME=GCC
set CUST=common
set SDKREL=false
set OPENCPU=true
set LTO_ENABLE=true
set GCF_ENABLE=false
set RAM_ENBALE=false
set ROM_ENBALE=false
set LESS_LOG=false
set PWR_TEST=false
set BUILD_HEADBIN=false
set GCCLIB_PATH="C:\gcc"
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\oc"
set CPBIN_SUBPATH=oc
set PKG_MAPDEF=pkg_716s_mapdef
set PKG_PRODUCT="EC716S_PRD"
set OUTPUT_NAME=%BOARD_NAME%_%CHIP_TYPE%
set JOBNUMBER=j8
echo build.bat version 20180330
echo GCCLIB_PATH: %GCCLIB_PATH%
if not %GCCLIB_PATH% == "" (
if not exist %GCCLIB_PATH% (
echo ERROR: Please check GCCLIB_PATH setting, exit!!!
goto end
)
) else (
echo ERROR: Please set GCCLIB_PATH firstly, exit!!!
goto end
)
rem --------- copy APP board ------------------
xcopy /q /E /I /y .\driver\board\ec7xx_0h00 .\driver\board\%BOARD_NAME%
xcopy /q /E /I /y .\device\target\board\ec7xx_0h00 .\device\target\board\%BOARD_NAME%
move .\device\target\board\%BOARD_NAME%\ap\ec7xx_0h00_ap.mk .\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk
move .\device\target\board\%BOARD_NAME%\ap\gcc\ec7xx_0h00_flash.ld .\device\target\board\%BOARD_NAME%\ap\gcc\%BOARD_NAME%_flash.ld
rem --------- board/project parsing begain------------------
set PARAMETERS=%1
if xx%PARAMETERS%==xx (
echo no input paramter, use default build setting
) else (
echo build option is: %PARAMETERS%
)
set parameterStr=%PARAMETERS%
:parameterSplit
for /f "tokens=1,* delims=-" %%a in ("%parameterStr%") do (
set parameterStr=%%b
echo %%a | findstr /r "j[0-9]*[0-9]\>" > nul
if !errorlevel!==0 (
set JOBNUMBER=%%a
)
if "%%a"=="bootloader" (
set PROJECT_NAME=bootloader
set BUILD_OPTION=no_merge
)
if "%%a"=="spi_2boards" (
set PROJECT_NAME=spi_2boards
)
if "%%a"=="spi_ethernet" (
set PROJECT_NAME=spi_ethernet
)
if "%%a"=="merge" (
set BUILD_OPTION=merge
)
if "%%a"=="sdkrel" (
set SDKREL=true
)
if "%%a"=="lto" (
set LTO_ENABLE=true
)
if "%%a"=="open_cpu" (
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\oc"
set CPBIN_SUBPATH=oc
)
if "%%a"=="ram" (
set OPENCPU=true
set RAM_ENBALE=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\ram"
set CPBIN_SUBPATH=ram
)
if "%%a"=="basic" (
set GCF_ENABLE=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\gcf"
set CPBIN_SUBPATH=wifi
)
if "%%a"=="mid" (
set MID_ENABLE=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\mid"
set CPBIN_SUBPATH=wifi
)
if "%%a"=="rom" (
set ROM_ENABLE=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\rom"
set CPBIN_SUBPATH=oc
)
if "%%a"=="lesslog" (
set LESS_LOG=true
if "%ROM_ENABLE%"=="true" (
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\rom_lesslog"
set CPBIN_SUBPATH=rom_lesslog
) else (
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\oc_lesslog"
set CPBIN_SUBPATH=oc
)
)
if "%%a"=="verbose" (
set VERBOSE=1
) else (
set VERBOSE=0
)
)
if not "%parameterStr%"=="" goto parameterSplit
echo curr Board is: %BOARD_NAME%
echo curr Chip is: %CHIP_NAME%
echo curr Type is: %CHIP_TYPE%
echo curr Project is: %PROJECT_NAME%
echo curr core is: %CORE_NAME%
echo curr option is: %BUILD_OPTION%
echo cpbin subpath is: %CPBIN_SUBPATH%
echo comdblib path is: %COMDBLIB_PATH%
rem duplicate comdblib.txt from 'COMDBLIB_PATH' to '.\tools\'
if exist %COMDBLIB_PATH%\comdblib.txt (
xcopy /f /y %COMDBLIB_PATH%\comdblib.txt .\tools\
)
if "%CUST%"=="qcom" (
rem clear AT ref for qcom
for /f "tokens=1* delims=" %%a in ('type ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk"') do (
if "%%a" equ "PS_AT_REF=y" (
echo PS_AT_REF=n
) else if "%%a" equ "BUILD_AT_REF ?=n" (
echo BUILD_AT_REF=n
) else (
echo %%a
)
)>>temp.txt
type temp.txt | findstr /v ECHO >>temp1.txt
del temp.txt
move temp1.txt ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk" >nul
)
rem --------- if more board/project add here-------------
rem --------- board/project parsing end------------------
echo PARAMETERS: %PARAMETERS% | findstr "help"
if not errorlevel 1 (
echo "=============================================================================================="
echo " "
echo " >> HOW TO BUILD A PROJECT << "
echo " "
echo "==============================================================================================¡±
echo " "
echo " @FORMAT : Gccbuild.bat [<board>[-<core>[-<project>[-<option>]]]] "
echo " @CAUTION: All parameters (<board>/<core>/<project>/<option>) are optional, "
echo " and the default settings of the project will take effect if it occurs! "
echo " For <board>, only 'ec618_0h00' is supportted, and it should be omitted ! "
echo " "
echo "**********************************************************************************************"
echo " <options>: "
echo " >> Basic "
echo " merge compile bl, cp and ap images and merge them into a package. [default] "
echo " doc run doxygen to generate the documents. "
echo " clean clean the output files for a specific board and project. "
echo " clall clean all output files for every board and project. "
echo " allprojects trigger to compile all example projects of the default board "
echo " list list all supported boards and supported projects for every board "
echo " help display this help message. "
echo " "
echo " >> Advanced "
echo " NULL(mini) for open dev, more ram, AP lib: oc, CP image: oc "
echo " mid mini + wifi scan/sms AP lib: mid, CP image: wifi "
echo " basic support gcf test(test version), AP lib: gcf, CP image: wifi "
echo " ram open_dev + addtional 100K ram AP lib: ram, CP image: ram "
echo " rom mini + remove rndis/socket AP lib: rom, CP image: oc "
echo " rom-lesslog rom + log reducing AP lib: rom_lesslog, CP image: rom_lesslog "
echo " lesslog log reducing AP lib: rom_lesslog, CP image: oc "
echo "**********************************************************************************************"
echo " Examples: "
echo "----------------------- For Internal Full Source Build----------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader, cp, ap images and merge them into a package. "
echo " > Gccbuild.bat ap-at_command "
echo " build ap at_command project only. "
echo " > Gccbuild.bat ap-bootloader "
echo " build bootloader project only. "
echo " > Gccbuild.bat cp "
echo " build cp project only. "
echo " > Gccbuild.bat ap-driver_example-clean "
echo " clean all output files for ap driver_example project. "
echo " "
echo "----------------------- For Customer's SDK Build----------------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader,ap images, use prebuilt cp image, and merge them into a package. "
echo " > Gccbuild.bat project_name e.g. project_name = at_command/driver_example "
echo " build xxx(project_name) project "
echo " "
echo " @NOTE: SDK build always generates a package(project_name.bin + bootloader.bin + cp.bin). "
echo " "
echo "----------------------- For Universal Build---------------------------------------------------"
echo " > Gccbuild.bat clean "
echo " clean all output files for the default project. "
echo " > Gccbuild.bat clall "
echo " clean all output files for every board and project. "
echo " > Gccbuild.bat list "
echo " list all supported boards and supported projects for every board. "
echo " "
echo " > Gccbuild.bat open_cpu "
echo " build 'open cpu' mode images of the default project, and merge them into a package. "
echo " "
echo "**********************************************************************************************"
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "list"
if not errorlevel 1 (
echo ---------------Supported Board------------------------------------
for /d %%i in ("project\*") do (echo %%~nxi )
echo ------------------------------------------------------------------
for /d %%i in ("project\*") do (
set CURRENT_BOARD=%%~nxi
echo *********supported projects for board: !CURRENT_BOARD!*************
for /d %%i in ("project\!CURRENT_BOARD!\ap\apps\*") do (echo ----%%~nxi )
)
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "doc"
if not errorlevel 1 (
pushd doxygen
CALL genDoc.bat %CHIP_NAME%
popd
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clall"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean all done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clean"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gcc TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clobj"
if not errorlevel 1 (
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.o
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.a
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.elf
echo clean objs done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "allprojects"
if not errorlevel 1 (
if exist .\gccout\%OUTPUT_NAME% (
echo delete %OUTPUT_NAME% folder......
rd .\gccout\%OUTPUT_NAME% /s /q
)
rem step1 build cp if not SDK
if not exist .\tools\comdblib.txt (
echo start logprepass b11
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
)
rem step2 build bootloader no matter SDK or not
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=ap BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo *********supported projects for board: %BOARD_NAME%*************
for /d %%i in ("project\%BOARD_NAME%\ap\apps\*") do (
set CURRENT_PROJECT=%%~nxi
echo ----!CURRENT_PROJECT!
if "!CURRENT_PROJECT!"=="bootloader" (
echo ignore bootloader when loop all project
) else (
echo 111
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
if exist .\tools\comdblib.txt (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true SDK=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
) else (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if not exist .\tools\comdblib.txt (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
) else (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
)
goto complete
)
set starttime=%time%
echo Start time: %date% %starttime%
if "%BUILD_OPTION%"=="merge" (
if exist .\tools\comdblib.txt (
echo start logprepass
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% BUILD_UNILOG=false BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
) else (
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% SDK_REL=%SDKREL% BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo start logprepass b22
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.elf
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
)
)
if %PROJECT_NAME%==bootloader goto :buildimage
if %PROJECT_NAME%==driver_example goto :buildimage
set UNILOG=true
echo start logprepass b2
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% TOOLCHAIN_NAME=%TOOLCHAIN_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\debug_log_%CORE_NAME%.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo -----build image----
:buildimage
REM goto end
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=%UNILOG% BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem copy log database to output dir after compile successfully
REM cp .\tools\comdb_%CORE_NAME%.txt .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\comdb.txt
:complete
set endtime=%time%
echo .
echo End time: %date% %endtime%
set /a h1=%starttime:~0,2%
set /a m1=1%starttime:~3,2%-100
set /a s1=1%starttime:~6,2%-100
set /a h2=%endtime:~0,2%
set /a m2=1%endtime:~3,2%-100
set /a s2=1%endtime:~6,2%-100
if %h2% LSS %h1% set /a h2=%h2%+24
set /a ts1=%h1%*3600+%m1%*60+%s1%
set /a ts2=%h2%*3600+%m2%*60+%s2%
set /a ts=%ts2%-%ts1%
set /a h=%ts%/3600
set /a m=(%ts%-%h%*3600)/60
set /a s=%ts%%%60
echo Built took %h% hours %m% minutes %s% seconds
echo #######################################################################
echo ## ##
echo ## ######## ### ###### ###### ##
echo ## ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ## ##
echo ## ######## ## ## ###### ###### ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ###### ###### ##
echo ## ##
echo #######################################################################
echo build successfully
if %UNILOG%==true (
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
:end
goto:eof
:failHandle
echo fail
echo #######################################################################
echo ## ##
echo ## ######## ### #### ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ##
echo ## ###### ## ## ## ## ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## #### ######## ##
echo ## ##
echo #######################################################################
goto:eof

View File

@ -0,0 +1,356 @@
# default target
all::
include $(TOP)/PLAT/tools/scripts/Makefile.vars
OUTTARGET = $(OUTPUT_NAME)
ifeq ($(TOOLCHAIN),GCC)
BUILDDIR ?= $(TOP)/PLAT/gccout/$(OUTTARGET)/$(CORE)/$(PROJECT)
endif
ifeq ($(TOOLCHAIN),ARMCC)
BUILDDIR ?= $(TOP)/PLAT/out/$(OUTTARGET)/$(CORE)/$(PROJECT)
endif
LIBDIR ?= $(TOP)/PLAT/prebuild
#-------------------------------------------------------------------------------
# Rules
#-------------------------------------------------------------------------------
include $(TOP)/PLAT/device/target/Makefile.inc
include $(TOP)/PLAT/driver/Makefile.inc
include $(TOP)/PLAT/os/Makefile.inc
include $(TOP)/PLAT/middleware/developed/Makefile.inc
include $(TOP)/PLAT/middleware/thirdparty/Makefile.inc
ifeq ($(SUBSYS_ENABLE),y)
include $(TOP)/PLAT/subsys/Makefile.inc
endif
ifeq ($(BUILD_USE_PREBUILD_LIB), n)
PROJPRIV = $(TOP)/PLAT/project/$(TARGET)/$(CORE)/apps/$(PROJECT)/MakeProj.priv
ifeq ($(PROJPRIV), $(wildcard $(PROJPRIV)))
include $(PROJPRIV)
endif
endif
ifeq ($(BUILD_USE_PREBUILD_LIB),n)
ifeq ($(BUILD_FW),y)
include $(TOP)/FIRMWARE/Makefile.inc
include $(TOP)/PROTOCOL/SRC/psl1/Makefile.inc
endif
ifeq ($(BUILD_PS),y)
include $(TOP)/PROTOCOL/SRC/ps/Makefile.inc
include $(TOP)/PROTOCOL/SRC/tcpip/Makefile.inc
include $(TOP)/PROTOCOL/SRC/psl1/Makefile.inc
ifeq ($(BUILD_IMS),y)
include $(TOP)/PROTOCOL/SRC/ims/Makefile.inc
endif
endif
ifeq ($(BUILD_USE_USB_LIB),y)
include $(LIBDIR)/PLAT/Makefile.inc
endif
else
ifeq ($(BUILD_FW),y)
include $(LIBDIR)/FW/Makefile.inc
endif
ifeq ($(BUILD_PS),y)
include $(LIBDIR)/PS/Makefile.inc
endif
include $(LIBDIR)/PLAT/Makefile.inc
endif
vpath %.c $(TOP)
vpath %.s $(TOP)
vpath %.S $(TOP)
OBJS := $(addprefix $(BUILDDIR)/, $(obj-y))
LIBS := $(addprefix $(BUILDDIR)/lib/,$(lib-y))
LIBS_USBCUST := $(addprefix $(BUILDDIR)/lib/,$(lib-usbcust-y))
DISABLE_LTO_OBJS := $(addprefix $(BUILDDIR)/, $(disable-lto-objs))
$(DISABLE_LTO_OBJS) : DISABLE_LTO_FLAG=no-
PPFILES += $(patsubst %.o, %.pp, $(OBJS))
LD_PRECOMPILE_FILE ?= $(BUILDDIR)/PLAT/project/$(TARGET)/$(CORE)/apps/$(PROJECT)/$(TARGET)_flash.c
LD_COMPILED_FILE ?= $(BUILDDIR)/PLAT/project/$(TARGET)/$(CORE)/apps/$(PROJECT)/$(TARGET)_flash_output.ld
MEM_MAP_ORIGIN_FILE ?= $(TOP)/PLAT/device/target/board/$(BOARD_NAME)/common/inc/mem_map.h
ifneq ($(MAKECMDGOALS), unilog)
-include $(OBJS:.o=.d)
endif
-include $(OBJS:.o=.dd)
-include $(patsubst %.ld,%.d,$(LD_COMPILED_FILE))
.PHONY: all build clean size cleanall unilog cpp
ifeq ($(BIN_COMPRESS),y)
all:: build bincompress
else
all:: build
endif
ifeq ($(TOOLCHAIN),GCC)
ifeq ($(SDK),true)
build: $(BUILDDIR)/$(BINNAME).elf \
$(BUILDDIR)/$(BINNAME).bin \
$(BUILDDIR)/$(BINNAME).size
else
build: $(BUILDDIR)/$(BINNAME).elf \
$(BUILDDIR)/$(BINNAME).symbols \
$(BUILDDIR)/$(BINNAME).bin \
$(BUILDDIR)/$(BINNAME).size
endif
endif
ifeq ($(TOOLCHAIN),ARMCC)
build: $(BUILDDIR)/$(BINNAME).axf
endif
$(BUILDDIR):
@mkdir -p $(BUILDDIR)
$(LIBDIR):
@mkdir -p $(LIBDIR)
ifeq ($(BIN_COMPRESS),y)
ifeq ($(BUILD_ENV),linux)
define binCompress
@cp $(BUILDDIR)/$(BINNAME).bin $(BUILDDIR)/$(BINNAME)_unZip.bin
@$(TOP)/PLAT/tools/fcelf -C -bin $(BUILDDIR)/$(BINNAME)_unZip.bin -cfg $(TOP)/$(LINK_FILE_PATH)/sectionInfo_$(TYPE).json -map $(BUILDDIR)/$(BINNAME).map -out $(BUILDDIR)/$(BINNAME).bin;[ $$? -eq 0 ]
endef
else
define binCompress
@cp $(BUILDDIR)/$(BINNAME).bin $(BUILDDIR)/$(BINNAME)_unZip.bin
@$(TOP)/PLAT/tools/fcelf.exe -C -bin $(BUILDDIR)/$(BINNAME)_unZip.bin -cfg $(TOP)/$(LINK_FILE_PATH)/sectionInfo_$(TYPE).json -map $(BUILDDIR)/$(BINNAME).map -out $(BUILDDIR)/$(BINNAME).bin;[ $$? -eq 0 ]
endef
endif
endif
ifeq ($(TOOLCHAIN),GCC)
$(BUILDDIR)/%.sc: %.c
@mkdir -p $(dir $@)
@cp $< $@
ifeq ($(BUILD_ENV),linux)
@$(TOP)/PLAT/tools/coan/coan source $(filter -D%, $(CFLAGS)) -E --replace --implicit -ge $@; echo $$?
else
@$(TOP)/PLAT/tools/coan/coan-6.0.1-x86_64.exe source $(filter -D%, $(CFLAGS) $(CFLAGS_DEFS)) -E --replace --implicit -ge $@; [[ $$? -ne 4 ]] && [[ $$? -ne 8 ]]
endif
$(BUILDDIR)/%.pp: %.c
@mkdir -p $(dir $@)
$(Q)$(CC) $(CFLAGS) $(CFLAGS_CPU) $(CFLAGS_INC) $(CFLAGS_DEFS) -MM -MP $< -MT $(basename $@).pp -MF $(basename $@).dd
$(Q)$(CC) $(CFLAGS) $(CFLAGS_CPU) $(CFLAGS_INC) $(CFLAGS_DEFS) -E -P $< -o $@
ifeq ($(BUILD_ENV),linux)
$(Q)$(TOP)/PLAT/tools/LogPrePass -P $(BUILDDIR) $(PPFLAG) $@;[ $$? -eq 0 ]
else
$(Q)$(TOP)/PLAT/tools/LogPrePass.exe -P $(BUILDDIR) $(PPFLAG) $@;[ $$? -eq 0 ]
endif
$(BUILDDIR)/%.o: %.c
@mkdir -p $(dir $@)
$(ECHO) CC $<
$(Q)$(CC) $(CFLAGS) $(CFLAGS_CPU) $(CFLAGS_INC) $(CFLAGS_DEFS) $(DEPFLAGS) -c $< -o $@
#overwrite implicit rule
%.o: %.c
@mkdir -p $(dir $@)
$(ECHO) CC $<
$(Q)$(CC) $(CFLAGS) $(CFLAGS_CPU) $(CFLAGS_INC) $(CFLAGS_DEFS) $(DEPFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: %.s
@mkdir -p $(dir $@)
$(ECHO) ASM $<
$(Q)$(CC) $(CFLAGS_ASM) $(CFLAGS_CPU) $(CFLAGS_INC) $(CFLAGS_DEFS) $(DEPFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: %.S
@mkdir -p $(dir $@)
$(ECHO) ASM $<
$(Q)$(CC) $(CFLAGS) $(CFLAGS_CPU) $(CFLAGS_INC) $(CFLAGS_DEFS) $(DEPFLAGS) -c $< -o $@
$(LD_COMPILED_FILE): $(LD_FILE)
cp $< $(LD_PRECOMPILE_FILE)
$(ECHO) CC $<
$(Q) $(CC) $(CFLAGS_INC) -E -P $(CFLAGS_DEFS) $(filter -D%,$(CFLAGS)) -MMD -MP -MF $(basename $@).d -MT $(basename $@).ld $(LD_PRECOMPILE_FILE) > $@
$(BUILDDIR)/$(BINNAME).elf: $(OBJS) $(LIBS) $(LIBS_USBCUST) $(LD_COMPILED_FILE)
$(ECHO) LINK $@
$(Q)$(CC) $(LDFLAGS) $(CFLAGS_CPU) $(CFLAGS_DEFS) -T$(LD_COMPILED_FILE) -Wl,-Map,$(BUILDDIR)/$(BINNAME).map -o $@ $(OBJS) -Wl,--start-group -Wl,--whole-archive $(LIBS) $(PREBUILDLIBS) -Wl,--no-whole-archive -Wl,--end-group -Wl,--no-undefined -Wl,--no-print-map-discarded
$(BUILDDIR)/mem_map.txt: $(TOP)/PLAT/device/target/board/$(BOARD_NAME)/common/inc/mem_map.h
$(Q)$(CC) $(CFLAGS) $(CFLAGS_CPU) $(CFLAGS_INC) $(CFLAGS_DEFS) -E -P $< -o $@
ifeq ($(SDK),true)
$(BUILDDIR)/$(BINNAME).bin: $(BUILDDIR)/$(BINNAME).elf $(BUILDDIR)/mem_map.txt
$(ECHO) OBJCOPY $@
$(Q)$(OBJCOPY) -O binary $< $@
@$(OBJDUMP) -d -h $< > $(BUILDDIR)/$(BINNAME).txt
@$(SIZE) $(OBJECTS) $<
$(BUILDDIR)/$(BINNAME).size: $(BUILDDIR)/$(BINNAME).elf
@$(OBJDUMP) -h $< > $@
@$(SIZE) -G $< >> $@
@$(foreach lib, $(LIBS), $(SIZE) $(lib) -t -G >> $@;)
else
$(BUILDDIR)/$(BINNAME).symbols: $(BUILDDIR)/$(BINNAME).elf
$(Q)$(NM) --size-sort --print-size -r $< >$@
$(BUILDDIR)/$(BINNAME).bin: $(BUILDDIR)/$(BINNAME).elf $(BUILDDIR)/mem_map.txt
$(ECHO) OBJCOPY $@
$(Q)$(OBJCOPY) -O binary $< $@
$(Q)$(OBJCOPY) -O verilog $< $(@:.bin=.hex)
@$(OBJDUMP) -d -h $< > $(BUILDDIR)/$(BINNAME).txt
@$(SIZE) $(OBJECTS) $<
$(BUILDDIR)/$(BINNAME).size: $(BUILDDIR)/$(BINNAME).elf
@$(OBJDUMP) -h $< > $@
@$(SIZE) -G $< >> $@
@$(foreach lib, $(LIBS), $(SIZE) $(lib) -t -G >> $@;)
endif
ifeq ($(BIN_COMPRESS),y)
bincompress: $(BUILDDIR)/$(BINNAME).elf $(BUILDDIR)/$(BINNAME).bin $(BUILDDIR)/$(BINNAME).size $(BUILDDIR)/mem_map.txt
$(call binCompress)
endif
clean:
@rm -rf $(BUILDDIR)
cleanall:
@rm -rf $(TOP)/PLAT/gccout/$(OUTTARGET) $(TOP)/PLAT/middleware/developed/debug/inc/debug_log_*p.h
size: $(BUILDDIR)/$(BINNAME).elf
@$(SIZE) $(OBJECTS) $(BUILDDIR)/$(BINNAME).elf
ifeq ($(CORE),cp)
unilog: cpp
ifeq ($(BUILD_ENV),linux)
@$(TOP)/PLAT/tools/LogPrePass -l $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_$(CORE).h -d $(BUILDDIR)/comdb_$(CORE).txt; [ $$? -eq 0 ]
else
@$(TOP)/PLAT/tools/LogPrePass.exe -l $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_$(CORE).h -d $(BUILDDIR)/comdb_$(CORE).txt; [ $$? -eq 0 ]
endif
else
ifeq ($(SDK),true)
unilog: cpp
ifeq ($(BUILD_ENV),linux)
@$(TOP)/PLAT/tools/LogPrePass -I $(TOP)/PLAT/tools/comdblib.txt -l $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_cust_lib.h -d $(TOP)/PLAT/tools/comdb_cust_lib.txt; [ $$? -eq 0 ]
@$(TOP)/PLAT/tools/LogPrePass -I $(TOP)/PLAT/tools/comdblib.txt $(TOP)/PLAT/tools/comdb_cust_lib.txt -L $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_$(CORE).h -d $(BUILDDIR)/comdb.txt -v $(BUILDDIR)/dbversion.h; [ $$? -eq 0 ]
else
@$(TOP)/PLAT/tools/LogPrePass.exe -I $(TOP)/PLAT/tools/comdblib.txt -l $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_cust_lib.h -d $(TOP)/PLAT/tools/comdb_cust_lib.txt; [ $$? -eq 0 ]
@$(TOP)/PLAT/tools/LogPrePass.exe -I $(TOP)/PLAT/tools/comdblib.txt $(TOP)/PLAT/tools/comdb_cust_lib.txt -L $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_$(CORE).h -d $(BUILDDIR)/comdb.txt -v $(BUILDDIR)/dbversion.h; [ $$? -eq 0 ]
endif
else
unilog: cpp
ifeq ($(BUILD_ENV),linux)
@$(TOP)/PLAT/tools/LogPrePass -I $(TOP)/PLAT/gccout/$(OUTTARGET)/cp/cp_project/comdb_cp.txt -l $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_$(CORE)_lib.h -d $(BUILDDIR)/comdb_$(CORE)_lib.txt; [ $$? -eq 0 ]
@$(TOP)/PLAT/tools/LogPrePass -I $(BUILDDIR)/comdb_$(CORE)_lib.txt -L $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_$(CORE).h -d $(BUILDDIR)/comdb.txt -v $(BUILDDIR)/dbversion.h; [ $$? -eq 0 ]
else
@$(TOP)/PLAT/tools/LogPrePass.exe -I $(TOP)/PLAT/gccout/$(OUTTARGET)/cp/cp_project/comdb_cp.txt -l $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_$(CORE)_lib.h -d $(BUILDDIR)/comdb_$(CORE)_lib.txt; [ $$? -eq 0 ]
@$(TOP)/PLAT/tools/LogPrePass.exe -I $(BUILDDIR)/comdb_$(CORE)_lib.txt -L $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_$(CORE).h -d $(BUILDDIR)/comdb.txt -v $(BUILDDIR)/dbversion.h; [ $$? -eq 0 ]
endif
endif
endif
endif
ifeq ($(TOOLCHAIN),ARMCC)
$(BUILDDIR)/%.pp:%.c
@mkdir -p $(dir $@)
$(Q)$(CC) $(CFLAGS) $(CFLAGS_CPU) $(CFLAGS_INC) $(CFLAGS_DEFS) -M --depend_target $(basename $@).pp $< --depend $(basename $@).dd
$(Q)$(CC) $(CFLAGS) $(CFLAGS_CPU) $(CFLAGS_INC) $(CFLAGS_DEFS) -EP $< -o $@
ifeq ($(BUILD_ENV),linux)
$(Q)$(TOP)/PLAT/tools/LogPrePass -P $(BUILDDIR) $(PPFLAG) $@;[ $$? -eq 0 ]
else
$(Q)$(TOP)/PLAT/tools/LogPrePass.exe -P $(BUILDDIR) $(PPFLAG) $@;[ $$? -eq 0 ]
endif
$(BUILDDIR)/%.o %.d: %.c
@mkdir -p $(dir $@)
$(ECHO) CC $<
$(Q)$(CC) $(CFLAGS) $(CFLAGS_INC) $(CFLAGS_DEFS) $< --depend $(basename $@).d -o $@
$(BUILDDIR)/%.o %.d : %.s
@mkdir -p $(dir $@)
$(ECHO) AS $<
$(Q)$(AS) $(ASMFLAGS) $(CFLAGS_INC) $(CFLAGS_DEFS) $< --depend $(basename $@).d -o $@
$(BUILDDIR)/$(BINNAME).axf: $(OBJS) $(LIBS) $(linker-script-y)
$(ECHO) LINK $@
$(ECHO) $(LIBS)
$(Q)$(LD) $(LDFLAGS) --entry=Reset_Handler --scatter $(linker-script-y) -o $@ $(OBJS) $(LIBS) $(PREBUILDLIBS) --list $(BUILDDIR)/$(BINNAME).map --symdefs=$(BUILDDIR)/$(BINNAME).symbols
$(Q)$(ELF) --bin --output $(BUILDDIR)/$(BINNAME).bin $(BUILDDIR)/$(BINNAME).axf
$(Q)$(ELF) $(ELFFLAGS) --output $(BUILDDIR)/$(BINNAME).hex $(BUILDDIR)/$(BINNAME).axf
$(Q)$(ELF) -c $(BUILDDIR)/$(BINNAME).axf -o $(BUILDDIR)/$(BINNAME).txt
clean:
@rm -rf $(BUILDDIR)
cleanall:
@rm -rf $(TOP)/PLAT/out/* $(TOP)/PLAT/middleware/developed/debug/inc/debug_log_*p.h
ifeq ($(CORE),cp)
unilog: cpp
ifeq ($(BUILD_ENV),linux)
@$(TOP)/PLAT/tools/LogPrePass -l $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_$(CORE).h -d $(BUILDDIR)/comdb_$(CORE).txt; [ $$? -eq 0 ]
else
@$(TOP)/PLAT/tools/LogPrePass.exe -l $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_$(CORE).h -d $(BUILDDIR)/comdb_$(CORE).txt; [ $$? -eq 0 ]
endif
else
ifeq ($(SDK),true)
unilog: cpp
ifeq ($(BUILD_ENV),linux)
@$(TOP)/PLAT/tools/LogPrePass -I $(TOP)/PLAT/tools/comdblib.txt -l $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_cust_lib.h -d $(TOP)/PLAT/tools/comdb_cust_lib.txt; [ $$? -eq 0 ]
@$(TOP)/PLAT/tools/LogPrePass -I $(TOP)/PLAT/tools/comdblib.txt $(TOP)/PLAT/tools/comdb_cust_lib.txt -L $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_$(CORE).h -d $(BUILDDIR)/comdb.txt -v $(BUILDDIR)/dbversion.h; [ $$? -eq 0 ]
else
@$(TOP)/PLAT/tools/LogPrePass.exe -I $(TOP)/PLAT/tools/comdblib.txt -l $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_cust_lib.h -d $(TOP)/PLAT/tools/comdb_cust_lib.txt; [ $$? -eq 0 ]
@$(TOP)/PLAT/tools/LogPrePass.exe -I $(TOP)/PLAT/tools/comdblib.txt $(TOP)/PLAT/tools/comdb_cust_lib.txt -L $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_$(CORE).h -d $(BUILDDIR)/comdb.txt -v $(BUILDDIR)/dbversion.h; [ $$? -eq 0 ]
endif
else
unilog: cpp
ifeq ($(BUILD_ENV),linux)
@$(TOP)/PLAT/tools/LogPrePass -I $(TOP)/PLAT/out/$(OUTTARGET)/cp/cp_project/comdb_cp.txt -l $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_$(CORE)_lib.h -d $(BUILDDIR)/comdb_$(CORE)_lib.txt; [ $$? -eq 0 ]
@$(TOP)/PLAT/tools/LogPrePass -I $(BUILDDIR)/comdb_$(CORE)_lib.txt -L $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_$(CORE).h -d $(BUILDDIR)/comdb.txt -v $(BUILDDIR)/dbversion.h; [ $$? -eq 0 ]
else
@$(TOP)/PLAT/tools/LogPrePass.exe -I $(TOP)/PLAT/out/$(OUTTARGET)/cp/cp_project/comdb_cp.txt -l $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_$(CORE)_lib.h -d $(BUILDDIR)/comdb_$(CORE)_lib.txt; [ $$? -eq 0 ]
@$(TOP)/PLAT/tools/LogPrePass.exe -I $(BUILDDIR)/comdb_$(CORE)_lib.txt -L $(BUILDDIR)/ -h $(BUILDDIR)/debug_log_$(CORE).h -d $(BUILDDIR)/comdb.txt -v $(BUILDDIR)/dbversion.h; [ $$? -eq 0 ]
endif
endif
endif
endif
cpp: $(PPFILES) $(LIBPPFILES) $(LIBUSBPPFILES) $(CUSTLIBPPFILES)
$(LIBPPFILES):
$(LIBUSBPPFILES):
$(CUSTLIBPPFILES):
ifeq ($(CORE),ap)
ifeq ($(BUILD_CUST),qcom)
$(PPFILES): PPFLAG=-C
$(LIBPPFILES): PPFLAG=-C
$(LIBUSBPPFILES): PPFLAG=-c
$(CUSTLIBPPFILES): PPFLAG=-c
else
$(PPFILES): PPFLAG=-C
$(LIBPPFILES): PPFLAG=-c
$(LIBUSBPPFILES): PPFLAG=-c
$(CUSTLIBPPFILES): PPFLAG=-c
endif
else
$(PPFILES): PPFLAG=-c
$(LIBPPFILES): PPFLAG=-c
endif

View File

@ -0,0 +1,703 @@
#BIN_COMPRESS for post bin compress tool
#THIRDPARTY_LZMA_ENABLE LZMA feature compile en
#RAMCODE_COMPRESS_EN ramcode/RW decompress, used in code
#REL_COMPRESS_EN calibration back up compress en, used in code
CFLAGS_DEFS += -DRAMCODE_COMPRESS_EN
CFLAGS_DEFS += -DREL_COMPRESS_EN
THIRDPARTY_LZMA_ENABLE = y
BIN_COMPRESS = y
DRIVER_CPFLASH_ENABLE = n
DRIVER_VPU_ENABLE = n
DRIVER_EEPROM_ENABLE = n
DRIVER_SPI_ENABLE = n
DRIVER_I2C_ENABLE = n
DRIVER_PSRAM_ENABLE = n
DRIVER_PCACHE_ENABLE = n
DRIVER_EXSTORAGE_ENABLE = n
#DRIVER_LPUART_ENABLE = n
DRIVER_ONEWIRE_ENABLE = n
THIRDPARTY_PING_ENABLE = y
THIRDPARTY_YRCOMPRESS_ENABLE = y
MIDDLEWARE_USB_CCID_ENABLE = n
MIDDLEWARE_FOTAPAR_ENABLE = y
BUILD_EC_MW = n
AT_EXAMPLE_ENABLE = n
#Exception Flash Dump enable, default enable
EXCEPTION_FLASH_DUMP_ENABLE = y
ifneq ($(OPENCPU_MODE_ENABLE), y)
THIRDPARTY_IPERF_ENABLE = y
THIRDPARTY_LIBSNTP_ENABLE = y
THIRDPARTY_HTTPC_ENABLE = y
MBEDTLS_WITH_HTTP_TLS = y
THIRDPARTY_MQTT_ENABLE = y
MBEDTLS_WITH_MQTT_TLS = n
#cjson is refered by MQTT
THIRDPARTY_CJSON_ENABLE = y
THIRDPARTY_CTCC_DM_ENABLE = n
THIRDPARTY_CUCC_DM_ENABLE = n
THIRDPARTY_CMCC_DM_ENABLE = n
THIRDPARTY_CTWING_CERTI_ENABLE = n
BUILD_PS_TCPIP_API_ENABLE = y
BUILD_AT = y
BUILD_AT_DEBUG = y
BUILD_AT_REF = y
else
#>>>'OPENCPU_MODE_ENABLE' STARTING...
ifeq ($(IMS_SMSONLY_MODE_ENABLE), y)
BUILD_IMS = y
THIRDPARTY_CJSON_ENABLE = y
endif
THIRDPARTY_PPP_ENABLE = n
THIRDPARTY_IPERF_ENABLE = n
THIRDPARTY_LIBSNTP_ENABLE = y
THIRDPARTY_MBEDTLS_ENABLE = n
ifeq ($(IMS_SMSONLY_MODE_ENABLE), y)
THIRDPARTY_HTTPC_ENABLE = y
else
THIRDPARTY_HTTPC_ENABLE = n
endif
MBEDTLS_WITH_HTTP_TLS = n
THIRDPARTY_MQTT_ENABLE = n
MBEDTLS_WITH_MQTT_TLS = n
#cjson is refered by MQTT, cjson defult value: n, as IMS also need it, here remove it
#THIRDPARTY_CJSON_ENABLE = n
THIRDPARTY_CTCC_DM_ENABLE = n
THIRDPARTY_CUCC_DM_ENABLE = n
THIRDPARTY_CMCC_DM_ENABLE = n
THIRDPARTY_CTWING_CERTI_ENABLE = n
BUILD_PS_TCPIP_API_ENABLE = n
BUILD_AT = y
BUILD_AT_DEBUG = n
BUILD_AT_REF = y
##################################################################################################################
##Description:
##global option for RIL APIs
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT), y)
BUILD_RIL_AT_API_ENABLE = n
endif
##################################################################################################################
##Description:
##global option for Plat AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT), y)
BUILD_PLAT_CUST_AT_ENABLE = y
ifeq ($(PWR_TEST), y)
BUILD_PLAT_MEM_AT_ENABLE = y
else
BUILD_PLAT_MEM_AT_ENABLE = n
endif
BUILD_PLAT_PMU_AT_ENABLE = y
BUILD_PLAT_PER_AT_ENABLE = y
BUILD_PLAT_MISC_AT_ENABLE = y
BUILD_PLAT_PROD_AT_ENABLE = y
BUILD_PLAT_FOTA_AT_ENABLE = y
BUILD_PLAT_ECOTA_AT_ENABLE = n
BUILD_PLAT_CMUX_AT_ENABLE = n
BUILD_PLAT_HTTP_AT_ENABLE = n
BUILD_PLAT_MQTT_AT_ENABLE = n
BUILD_PLAT_SSL_AT_ENABLE = n
BUILD_PLAT_FS_AT_ENABLE = n
BUILD_PLAT_AUDIO_AT_ENABLE = n
BUILD_PLAT_ONENET_AT_ENABLE = n
BUILD_PLAT_CTLWM2M_AT_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_AUDIO_AT_ENABLE
##global option for Plat audio related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_AUDIO_AT_ENABLE), y)
#AT+ADCFG
BUILD_PLAT_AUDIO_ECADCFG_ENABLE = y
BUILD_FIXED_AUDIO_SOURCE_ENABLE = y
endif
##################################################################################################################
##Description: BUILD_PLAT_CUST_AT_ENABLE
##global option for Plat product related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_CUST_AT_ENABLE), y)
#AT+CGMI
BUILD_PLAT_CUST_CGMI_ENABLE = y
#AT+CGMM
BUILD_PLAT_CUST_CGMM_ENABLE = y
#AT+GMM
BUILD_PLAT_CUST_GMM_ENABLE = y
#AT+CGMR
BUILD_PLAT_CUST_CGMR_ENABLE = y
#AT+CGSN
BUILD_PLAT_CUST_CGSN_ENABLE = y
#ATI
BUILD_PLAT_CUST_ATI_ENABLE = y
#AT&W
BUILD_PLAT_CUST_ATnW_ENABLE = y
#AT&F
BUILD_PLAT_CUST_ATnF_ENABLE = y
#AT&V
BUILD_PLAT_CUST_ATnV_ENABLE = y
endif
##################################################################################################################
##Description: BUILD_PLAT_MEM_AT_ENABLE
##global option for Plat memory related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_MEM_AT_ENABLE), y)
#AT+ECSHOWMEM
BUILD_PLAT_MEM_ECSHOWMEM_ENABLE = y
#AT+ECHEAPINFO
BUILD_PLAT_MEM_ECHEAPINFO_ENABLE = y
#AT+ECMEM32
BUILD_PLAT_MEM_ECMEM32_ENABLE = y
#AT+ECDLFCMEM
BUILD_PLAT_MEM_ECDLFCMEM_ENABLE = y
#AT+ECFSINFO
BUILD_PLAT_MEM_ECFSINFO_ENABLE = y
#AT+RLCHK
BUILD_PLAT_MEM_RLCHK_ENABLE = y
#AT+ECFLASHMONITORINFO
BUILD_PLAT_MEM_ECFLASHMONITORINFO_ENABLE = y
endif
##################################################################################################################
##Description: BUILD_PLAT_PMU_AT_ENABLE
##global option for Plat pmu related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_PMU_AT_ENABLE), y)
#AT+ECPMUCFG
BUILD_PLAT_PMU_ECPMUCFG_ENABLE = y
#AT+ECSYSMONCFG
BUILD_PLAT_PMU_ECSYSMONCFG_ENABLE = y
#AT+ECVOTECHK
BUILD_PLAT_PMU_ECVOTECHK_ENABLE = y
#AT+ECPMUSTATUS
BUILD_PLAT_PMU_ECPMUSTATUS_ENABLE = n
#AT+ECPURC
BUILD_PLAT_PMU_ECPURC_ENABLE = y
#AT+ECSCLK
BUILD_PLAT_PMU_ECSCLK_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_PER_AT_ENABLE
##global option for Plat peripheral related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_PER_AT_ENABLE), y)
#AT+IPR
BUILD_PLAT_PER_IPR_ENABLE = y
#AT+ICF
BUILD_PLAT_PER_ICF_ENABLE = n
#AT+IFC
BUILD_PLAT_PER_IFC_ENABLE = n
#AT+ECUSBSYS
BUILD_PLAT_PER_ECUSBSYS_ENABLE = n
#AT+ECLEDMODE
BUILD_PLAT_PER_ECLEDMODE_ENABLE = n
#AT+ECPALARM
BUILD_PLAT_PER_ECPALARM_ENABLE = n
#AT+ECADC
BUILD_PLAT_PER_ECADC_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_MISC_AT_ENABLE
##global option for Plat miscellaneous AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_MISC_AT_ENABLE), y)
#AT+ECPCFG
BUILD_PLAT_MISC_ECPCFG_ENABLE = y
#AT+ECRST
BUILD_PLAT_MISC_ECRST_ENABLE = y
#AT+ECPOWD
BUILD_PLAT_MISC_ECPOWD_ENABLE = n
#AT^SYSTEST
BUILD_PLAT_MISC_SYSTEST_ENABLE = n
#AT+ECSYSTEST
BUILD_PLAT_MISC_ECSYSTEST_ENABLE = n
#AT+ECTASKINFO
BUILD_PLAT_MISC_ECTASKINFO_ENABLE = n
#AT+ECTASKHISTINFO
BUILD_PLAT_MISC_ECTASKHISTINFO_ENABLE = n
#AT+ECLOGDBVER
BUILD_PLAT_MISC_ECLOGDBVER_ENABLE = n
#AT+ECDUMPCHK
BUILD_PLAT_MISC_ECDUMPCHK_ENABLE = n
#AT+ECBTOFFSETDBG
BUILD_PLAT_MISC_ECBTOFFSETDBG_ENABLE = n
#AT+ECFUSEMR
BUILD_PLAT_MISC_ECFUSEMR_ENABLE = n
#AT+ECSIMO
BUILD_PLAT_MISC_ECSIMO_ENABLE = n
#AT+ECIDLEP
BUILD_PLAT_MISC_ECIDLEP_ENABLE = y
endif
##################################################################################################################
##Description: BUILD_PLAT_PROD_AT_ENABLE
##global option for Plat product related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_PROD_AT_ENABLE), y)
#AT+ECATE
BUILD_PLAT_PROD_ECATE_ENABLE = y
#AT+ECVERSION
BUILD_PLAT_PROD_ECVERSION_ENABLE = y
#AT+ECIPR
BUILD_PLAT_PROD_ECIPR_ENABLE = y
#AT+ECSLEEP
BUILD_PLAT_PROD_ECSLEEP_ENABLE = y
#AT+ECSAVEFAC
BUILD_PLAT_PROD_ECSAVEFAC_ENABLE = y
#AT+ECRFTEST
BUILD_PLAT_PROD_ECRFTEST_ENABLE = y
#AT+ECGMDATA
BUILD_PLAT_PROD_ECGMDATA_ENABLE = y
#AT+ECNPICFG
BUILD_PLAT_PROD_ECNPICFG_ENABLE = y
#AT+ECRFNST
BUILD_PLAT_PROD_ECRFNST_ENABLE = y
#AT+ECRFSTAT
BUILD_PLAT_PROD_ECRFSTAT_ENABLE = y
#AT+ECPRODMODE
BUILD_PLAT_PROD_ECPRODMODE_ENABLE = y
endif
##################################################################################################################
##Description:
##global option for PS AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT), y)
BUILD_PS_GEN_AT_ENABLE = y
BUILD_PS_DEV_AT_ENABLE = y
BUILD_PS_EMM_AT_ENABLE = y
BUILD_PS_EPS_AT_ENABLE = y
BUILD_PS_SIM_AT_ENABLE = y
BUILD_PS_SMS_AT_ENABLE = y
BUILD_PHY_CONFIG_AT_ENABLE = y
BUILD_PS_TCPIP_ECSOCK_AT_ENABLE = n
BUILD_PS_TCPIP_SKTSOCK_AT_ENABLE = n
BUILD_PS_TCPIP_NETCONFIG_AT_ENABLE = y
BUILD_PS_TCPIP_IPSEC_AT_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_GEN_AT_ENABLE
##Description:
##BUILD_PS_GEN_AT_ENABLE is to control whether include ps global AT commands as: AT/ATQ/ATE/ATT/ATV/ATL/ATM/...etc
##Use method: y is support;n is not support.
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_GEN_AT_ENABLE), y)
#AT via BUILD_PS_GEN_AT_ENABLE
#ATQ
BUILD_PS_GEN_AT_Q_ENABLE = n
#ATE
BUILD_PS_GEN_AT_E_ENABLE = y
#ATT
BUILD_PS_GEN_AT_T_ENABLE = n
#ATV
BUILD_PS_GEN_AT_V_ENABLE = y
#ATL
BUILD_PS_GEN_AT_L_ENABLE = n
#ATM
BUILD_PS_GEN_AT_M_ENABLE = n
#ATS0
BUILD_PS_GEN_AT_S0_ENABLE = n
#AT&C
BUILD_PS_GEN_AT_nC_ENABLE = n
#AT&D
BUILD_PS_GEN_AT_nD_ENABLE = y
#ATD
BUILD_PS_GEN_AT_D_ENABLE = y
#ATO
BUILD_PS_GEN_AT_O_ENABLE = y
#ATH
BUILD_PS_GEN_AT_H_ENABLE = y
#ATA
BUILD_PS_GEN_AT_A_ENABLE = y
#AT+CSCS
BUILD_PS_GEN_CSCS_ENABLE = y
#AT+CMEE
BUILD_PS_GEN_CMEE_ENABLE = n
#AT+ECURC
BUILD_PS_GEN_ECURC_ENABLE = y
#AT+ECURCCFG
BUILD_PS_GEN_ECURCCFG_ENABLE = n
#AT+ECPPPHUP
BUILD_PS_GEN_ECPPPHUP_ENABLE = y
#AT+CLCK
BUILD_PS_GEN_CLCK_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_DEV_AT_ENABLE
##Description:
##BUILD_PS_DEV_AT_ENABLE is to control whether include ps global AT commands as: AT+CFUN/ECBAND/ECCFG/ECSTATUS/...etc
##Use method: y is support;n is not support.
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_DEV_AT_ENABLE), y)
#AT+CFUN
BUILD_PS_DEV_CFUN_ENABLE = y
#AT+ECCGSN
BUILD_PS_DEV_ECCGSN_ENABLE = y
#AT+ECCGSNLOCK
BUILD_PS_DEV_ECCGSNLOCK_ENABLE = n
#AT+ECSTATUS
BUILD_PS_DEV_ECSTATUS_ENABLE = y
#AT+ECSTATIS
BUILD_PS_DEV_ECSTATIS_ENABLE = n
#AT+ECBAND
BUILD_PS_DEV_ECBAND_ENABLE = y
#AT+ECFREQ
BUILD_PS_DEV_ECFREQ_ENABLE = y
#AT+ECCFG
BUILD_PS_DEV_ECCFG_ENABLE = y
#AT+ECMEASCFG
BUILD_PS_DEV_ECMEASCFG_ENABLE = n
#AT+ECRMFPLMN
BUILD_PS_DEV_ECRMFPLMN_ENABLE = y
#AT+ECBCINFO
BUILD_PS_DEV_ECBCINFO_ENABLE = y
#AT+ECPSTEST
BUILD_PS_DEV_ECPSTEST_ENABLE = n
#AT+ECEVENTSTATIS
BUILD_PS_DEV_ECEVENTSTATIS_ENABLE = n
#AT+ECNASTCFG
BUILD_PS_DEV_ECNASTCFG_ENABLE = y
#AT+ECWIFISCAN
BUILD_PS_DEV_ECWIFISCAN_ENABLE = n
#AT+ECBARCELL
BUILD_PS_DEV_ECBARCELL_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PS_EMM_AT_ENABLE
##Description:
##BUILD_PS_EMM_AT_ENABLE is to control whether include ps mm AT commands as: AT+CESQ/COPS/CCIOTOPT/ECCESQS/...etc
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_EMM_AT_ENABLE), y)
#AT+CSQ
BUILD_PS_EMM_CSQ_ENABLE = y
#AT+CESQ
BUILD_PS_EMM_CESQ_ENABLE = n
#AT+CREG
BUILD_PS_EMM_CREG_ENABLE = y
#AT+COPS
BUILD_PS_EMM_COPS_ENABLE = y
#AT+CPSMS
BUILD_PS_EMM_CPSMS_ENABLE = y
#AT+CEDRXS
BUILD_PS_EMM_CEDRXS_ENABLE = n
#AT+CEDRXRDP
BUILD_PS_EMM_CEDRXRDP_ENABLE = n
#AT+CCIOTOPT
BUILD_PS_EMM_CCIOTOPT_ENABLE = y
#AT+CRCES
BUILD_PS_EMM_CRCES_ENABLE = n
#AT+CCLK
BUILD_PS_EMM_CCLK_ENABLE = y
#AT+CTZR
BUILD_PS_EMM_CTZR_ENABLE = n
#AT+CTZU
BUILD_PS_EMM_CTZU_ENABLE = n
#AT+ECPLMNS
BUILD_PS_EMM_ECPLMNS_ENABLE = n
#AT+ECCESQSn
BUILD_PS_EMM_ECCESQS_ENABLE = n
#AT+ECPSMR
BUILD_PS_EMM_ECPSMR_ENABLE = n
#AT+ECPTWEDRXS
BUILD_PS_EMM_ECPTWEDRXS_ENABLE = n
#AT+ECEMMTIME
BUILD_PS_EMM_ECEMMTIME_ENABLE = n
#AT+ECPLMNRESELECT
BUILD_PS_EMM_ECPLMNRESELECT_ENABLE = n
#AT+ECCONNREL
BUILD_PS_EMM_ECCONNREL_ENABLE = n
#AT+ECMMER
BUILD_PS_EMM_ECMMER_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PS_EPS_AT_ENABLE
##Description:
##BUILD_PS_EPS_AT_ENABLE is to control whether include ESP AT commands as: AT+CGATT/CGDCONT/CGACT/CGCONTRDP/CGAUTH..etc
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_EPS_AT_ENABLE), y)
#AT+CGATT
BUILD_PS_EPS_CGATT_ENABLE = y
#AT+ECEMCATT
BUILD_PS_EPS_ECEMCATT_ENABLE = n
#AT+CGDATA
BUILD_PS_EPS_CGDATA_ENABLE = n
#AT+CGTFT
BUILD_PS_EPS_CGTFT_ENABLE = n
#AT+CGCMOD
BUILD_PS_EPS_CGCMOD_ENABLE = n
#AT+CGEQOS
BUILD_PS_EPS_CGEQOS_ENABLE = n
#AT+CGDSCONT
BUILD_PS_EPS_CGDSCONT_ENABLE = n
#AT+CEMODE
BUILD_PS_EPS_CEMODE_ENABLE = y
#AT+CGDCONT
BUILD_PS_EPS_CGDCONT_ENABLE = y
#AT+CGACT
BUILD_PS_EPS_CGACT_ENABLE = y
#AT+CGEQOSRDP
BUILD_PS_EPS_CGEQOSRDP_ENABLE = n
#AT+CGCONTRDP
BUILD_PS_EPS_CGCONTRDP_ENABLE = n
#AT+CGSCONTRDP
BUILD_PS_EPS_CGSCONTRDP_ENABLE = n
#AT+CGTFTRDP
BUILD_PS_EPS_CGTFTRDP_ENABLE = n
#AT+CEREG
BUILD_PS_EPS_CEREG_ENABLE = y
#AT+CSCON
BUILD_PS_EPS_CSCON_ENABLE = n
#AT+CSODCP
BUILD_PS_EPS_CSODCP_ENABLE = n
#AT+CRTDCP
BUILD_PS_EPS_CRTDCP_ENABLE = n
#AT+CGAUTH
BUILD_PS_EPS_CGAUTH_ENABLE = n
#AT+CIPCA
BUILD_PS_EPS_CIPCA_ENABLE = n
#AT+CGAPNRC
BUILD_PS_EPS_CGAPNRC_ENABLE = n
#AT+CGEREP
BUILD_PS_EPS_CGEREP_ENABLE = n
#AT+CGPADDR
BUILD_PS_EPS_CGPADDR_ENABLE = y
#AT+CEER
BUILD_PS_EPS_CEER_ENABLE = n
#AT+CEVDP
BUILD_PS_EPS_CEVDP_ENABLE = n
#AT+CPSDO
BUILD_PS_EPS_CPSDO_ENABLE = n
#AT+ECCIOTPLANE
BUILD_PS_EPS_ECCIOTPLANE_ENABLE = n
#AT+ECSENDDATA
BUILD_PS_EPS_ECSENDDATA_ENABLE = n
#AT+ECGDCNT
BUILD_PS_EPS_ECGDCNT_ENABLE = n
#AT+ECAUGDCNT
BUILD_PS_EPS_ECAUGDCNT_ENABLE = n
#AT+ECSCLKEX
BUILD_PS_EPS_ECSCLKEX_ENABLE = n
#AT+ECSMER
BUILD_PS_EPS_ECSMER_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PS_SIM_AT_ENABLE
##Description:
##BUILD_PS_SIM_AT_ENABLE is to control whether include SIM AT commands as: AT+CIMI/CPIN/ECICCID/ECSIMCFG..etc
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_SIM_AT_ENABLE), y)
#AT+CIMI
BUILD_PS_SIM_AT_CIMI_ENABLE = y
#AT+CPIN
BUILD_PS_SIM_AT_CPIN_ENABLE = y
#AT+ECICCID
BUILD_PS_SIM_AT_ECICCID_ENABLE = y
#AT+ECSIMCFG
BUILD_PS_SIM_AT_ECSIMCFG_ENABLE = y
#AT+CPWD
BUILD_PS_SIM_AT_CPWD_ENABLE = n
#AT+CPINR
BUILD_PS_SIM_AT_CPINR_ENABLE = n
#AT+ECSIMSLEEP
BUILD_PS_SIM_AT_ECSIMSLEEP_ENABLE = n
#AT+CSIM
BUILD_PS_SIM_AT_CSIM_ENABLE = n
#AT+CRSM
BUILD_PS_SIM_AT_CRSM_ENABLE = n
#AT+CCHO
BUILD_PS_SIM_AT_CCHO_ENABLE = n
#AT+CGLA
BUILD_PS_SIM_AT_CGLA_ENABLE = n
#AT+CCHC
BUILD_PS_SIM_AT_CCHC_ENABLE = n
#AT+ECSWC
BUILD_PS_SIM_AT_ECSWC_ENABLE = n
#AT+ECSIMRM
BUILD_PS_SIM_AT_ECSIMRM_ENABLE = y
#AT+CNUM
BUILD_PS_SIM_AT_CNUM_ENABLE = n
#AT+ECUSATP
BUILD_PS_SIM_AT_ECUSATP_ENABLE = n
#AT+CPOL
BUILD_PS_SIM_AT_CPOL_ENABLE = n
#AT+CPLS
BUILD_PS_SIM_AT_CPLS_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_SMS_AT_ENABLE
##Description:
##BUILD_PS_SMS_AT_ENABLE is to control whether include ps SMS AT commands as: AT+CMGS/CMGR/CMGW/CNMI/...etc
##Use method: y is support; n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_SMS_AT_ENABLE), y)
#AT+CMGS
BUILD_PS_SMS_CMGS_ENABLE = y
#AT+CMGC
BUILD_PS_SMS_CMGC_ENABLE = n
#AT+CMGR
BUILD_PS_SMS_CMGR_ENABLE = y
#AT+CMGW
BUILD_PS_SMS_CMGW_ENABLE = y
#AT+CSCA
BUILD_PS_SMS_CSCA_ENABLE = y
#AT+CNMI
BUILD_PS_SMS_CNMI_ENABLE = y
#AT+CMMS
BUILD_PS_SMS_CMMS_ENABLE = y
#AT+CMGD
BUILD_PS_SMS_CMGD_ENABLE = y
#AT+CMGL
BUILD_PS_SMS_CMGL_ENABLE = y
#AT+CSMS
BUILD_PS_SMS_CSMS_ENABLE = y
#AT+CPMS
BUILD_PS_SMS_CPMS_ENABLE = y
#AT+CNMA
BUILD_PS_SMS_CNMA_ENABLE = y
#AT+CMGF
BUILD_PS_SMS_CMGF_ENABLE = y
#AT+CSMP
BUILD_PS_SMS_CSMP_ENABLE = y
#AT+CSCB
BUILD_PS_SMS_CSCB_ENABLE = y
#AT+CSDH
BUILD_PS_SMS_CSDH_ENABLE = y
#AT+CMSS
BUILD_PS_SMS_CMSS_ENABLE = y
#AT+ECSMSSEND
BUILD_PS_SMS_ECSMSSEND_ENABLE = y
#AT+ECCMGS
BUILD_PS_SMS_ECCMGS_ENABLE = y
#AT+ECCMGR
BUILD_PS_SMS_ECCMGR_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PHY_CONFIG_AT_ENABLE
##Description:
##BUILD_PHY_CONFIG_AT_ENABLE is to control whether include PHY CONFIG AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PHY_CONFIG_AT_ENABLE), y)
#AT+ECPHYCFG
BUILD_PHY_CONFIG_ECPHYCFG_ENABLE = y
#AT+ECEDRXSIMU
BUILD_PHY_CONFIG_ECEDRXSIMU_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_TCPIP_ECSOCK_AT_ENABLE
##Description:
##BUILD_PS_TCPIP_ECSOCK_AT_ENABLE is to control whether include TCPIP EC SOCKET AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_TCPIP_ECSOCK_AT_ENABLE), y)
# do nothing here
endif
##################################################################################################################
##name :BUILD_PS_TCPIP_SKTSOCK_AT_ENABLE
##Description:
##BUILD_PS_TCPIP_ECSOCK_AT_ENABLE is to control whether include TCPIP SKT SOCKET AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_TCPIP_SKTSOCK_AT_ENABLE), y)
# do nothing here
endif
##################################################################################################################
##name :BUILD_PS_TCPIP_API_ENABLE
##Description:
##BUILD_PS_TCPIP_API_ENABLE is to control whether include EC TCPIP API
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_TCPIP_API_ENABLE), y)
# do nothing here
endif
##################################################################################################################
##name :BUILD_AT_REF
##Description:
##BUILD_AT_REF is to control whether include REF AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT_REF), y)
#define QI sockets command AT+QIOPEN/QICLOSE/QIRD/QISDE/QIGETERROR/QISTATE/QISEND/QISENDEX/QISWTMD
BUILD_PS_REF_TCPIP_QSOCK_AT_ENABLE = y
#define QNETCONIG command AT+QIDNSCFG/QIDNSGIP/QNETDEVCTL
BUILD_PS_REF_TCPIP_QNETCONFIG_AT_ENABLE = n
#define QPING command AT+QPING
BUILD_PS_REF_TCPIP_QPING_SERVICE_ENABLE = n
#define QNTP command AT+QNTP
BUILD_PS_REF_TCPIP_QSNTP_SERVICE_ENABLE = n
#define QI socket command: AT+QCCID/QENG/QCELL/QWIFISCAN/QPOWD/QSPN/QIACT/QIDEACT/QIREGAPP/QICSGP/QGDCNT/QAUGDCNT
BUILD_PS_REF_EPS_AT_ENABLE = n
#define QI socket command: AT+QICFG/QCFG
BUILD_PS_REF_COMMON_AT_ENABLE = y
endif
#<<<'OPENCPU_MODE_ENABLE' ENDDING...
endif

View File

@ -0,0 +1,766 @@
#BIN_COMPRESS for post bin compress tool
#THIRDPARTY_LZMA_ENABLE LZMA feature compile en
#RAMCODE_COMPRESS_EN ramcode/RW decompress, used in code
#REL_COMPRESS_EN calibration back up compress en, used in code
CFLAGS_DEFS += -DRAMCODE_COMPRESS_EN
CFLAGS_DEFS += -DREL_COMPRESS_EN
THIRDPARTY_LZMA_ENABLE = y
BIN_COMPRESS = y
DRIVER_CPFLASH_ENABLE = n
DRIVER_VPU_ENABLE = n
DRIVER_EEPROM_ENABLE = n
DRIVER_SPI_ENABLE = y
ifeq ($(MID_FEATURE_ENABLE), y)
DRIVER_I2C_ENABLE = y
else
DRIVER_I2C_ENABLE = n
endif
DRIVER_PSRAM_ENABLE = n
DRIVER_PCACHE_ENABLE = n
DRIVER_EXSTORAGE_ENABLE = n
#DRIVER_LPUART_ENABLE = n
DRIVER_ONEWIRE_ENABLE = n
DRIVER_ACVOICE_ENABLE = n
DRIVER_EX_ETHERNET_ENABLE = y
ifeq ($(DRIVER_EX_ETHERNET_ENABLE), y)
DRIVER_WCH_CH390_ENABLE = y
endif
THIRDPARTY_PING_ENABLE = y
THIRDPARTY_YRCOMPRESS_ENABLE = y
MIDDLEWARE_USB_CCID_ENABLE = n
ifeq ($(GCF_FEATURE_ENABLE), y)
MIDDLEWARE_FOTAPAR_ENABLE = n
else
MIDDLEWARE_FOTAPAR_ENABLE = y
endif
BUILD_EC_MW = n
AT_EXAMPLE_ENABLE = n
BUILD_PS_ROHC_ENABLE = n
#Exception Flash Dump enable, default enable
EXCEPTION_FLASH_DUMP_ENABLE = y
ifneq ($(OPENCPU_MODE_ENABLE), y)
THIRDPARTY_IPERF_ENABLE = y
THIRDPARTY_LIBSNTP_ENABLE = y
THIRDPARTY_HTTPC_ENABLE = y
MBEDTLS_WITH_HTTP_TLS = y
THIRDPARTY_MQTT_ENABLE = y
MBEDTLS_WITH_MQTT_TLS = n
#cjson is refered by MQTT
THIRDPARTY_CJSON_ENABLE = y
THIRDPARTY_CTCC_DM_ENABLE = n
THIRDPARTY_CUCC_DM_ENABLE = n
THIRDPARTY_CMCC_DM_ENABLE = n
THIRDPARTY_CTWING_CERTI_ENABLE = n
BUILD_PS_TCPIP_API_ENABLE = y
BUILD_AT = y
BUILD_AT_DEBUG = y
BUILD_AT_REF = y
else
#>>>'OPENCPU_MODE_ENABLE' STARTING...
THIRDPARTY_PPP_ENABLE = n
THIRDPARTY_IPERF_ENABLE = n
THIRDPARTY_LIBSNTP_ENABLE = y
THIRDPARTY_MBEDTLS_ENABLE = n
ifeq ($(MID_FEATURE_ENABLE), y)
THIRDPARTY_HTTPC_ENABLE = n
else ifeq ($(MORE_ROM_ENABLE), y)
THIRDPARTY_HTTPC_ENABLE = n
else
THIRDPARTY_HTTPC_ENABLE = y
endif
MBEDTLS_WITH_HTTP_TLS = n
THIRDPARTY_MQTT_ENABLE = n
MBEDTLS_WITH_MQTT_TLS = n
#cjson is refered by MQTT
THIRDPARTY_CJSON_ENABLE = n
THIRDPARTY_CTCC_DM_ENABLE = n
THIRDPARTY_CUCC_DM_ENABLE = n
THIRDPARTY_CMCC_DM_ENABLE = n
THIRDPARTY_CTWING_CERTI_ENABLE = n
ifeq ($(MID_FEATURE_ENABLE), y)
THIRDPARTY_DHCPD_ENABLE = n
else ifeq ($(MORE_RAM_ENABLE), y)
THIRDPARTY_DHCPD_ENABLE = n
else ifeq ($(MORE_ROM_ENABLE), y)
THIRDPARTY_DHCPD_ENABLE = n
else
THIRDPARTY_DHCPD_ENABLE = y
endif
BUILD_PS_TCPIP_API_ENABLE = n
BUILD_AT = y
BUILD_AT_DEBUG = n
BUILD_AT_REF = y
##################################################################################################################
##Description:
##global option for RIL APIs
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT), y)
BUILD_RIL_AT_API_ENABLE = n
endif
##################################################################################################################
##Description:
##global option for Plat AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT), y)
BUILD_PLAT_CUST_AT_ENABLE = y
BUILD_PLAT_MEM_AT_ENABLE = n
BUILD_PLAT_PMU_AT_ENABLE = y
BUILD_PLAT_PER_AT_ENABLE = y
BUILD_PLAT_MISC_AT_ENABLE = y
BUILD_PLAT_PROD_AT_ENABLE = y
BUILD_PLAT_FOTA_AT_ENABLE = y
BUILD_PLAT_ECOTA_AT_ENABLE = n
BUILD_PLAT_CMUX_AT_ENABLE = n
BUILD_PLAT_HTTP_AT_ENABLE = y
BUILD_PLAT_MQTT_AT_ENABLE = n
BUILD_PLAT_SSL_AT_ENABLE = n
BUILD_PLAT_FS_AT_ENABLE = n
BUILD_PLAT_AUDIO_AT_ENABLE = n
BUILD_PLAT_ONENET_AT_ENABLE = n
BUILD_PLAT_CTLWM2M_AT_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_CUST_AT_ENABLE
##global option for Plat product related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_CUST_AT_ENABLE), y)
#AT+CGMI
BUILD_PLAT_CUST_CGMI_ENABLE = n
#AT+CGMM
BUILD_PLAT_CUST_CGMM_ENABLE = n
#AT+GMM
BUILD_PLAT_CUST_GMM_ENABLE = n
#AT+CGMR
BUILD_PLAT_CUST_CGMR_ENABLE = y
#AT+CGSN
BUILD_PLAT_CUST_CGSN_ENABLE = y
#ATI
BUILD_PLAT_CUST_ATI_ENABLE = y
#AT&W
BUILD_PLAT_CUST_ATnW_ENABLE = y
#AT&F
BUILD_PLAT_CUST_ATnF_ENABLE = n
#AT&V
BUILD_PLAT_CUST_ATnV_ENABLE = y
#AT+ECIDLEP
BUILD_PLAT_MISC_ECIDLEP_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_MEM_AT_ENABLE
##global option for Plat memory related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_MEM_AT_ENABLE), y)
#AT+ECSHOWMEM
BUILD_PLAT_MEM_ECSHOWMEM_ENABLE = y
#AT+ECHEAPINFO
BUILD_PLAT_MEM_ECHEAPINFO_ENABLE = y
#AT+ECMEM32
BUILD_PLAT_MEM_ECMEM32_ENABLE = y
#AT+ECDLFCMEM
BUILD_PLAT_MEM_ECDLFCMEM_ENABLE = y
#AT+ECFSINFO
BUILD_PLAT_MEM_ECFSINFO_ENABLE = y
#AT+RLCHK
BUILD_PLAT_MEM_RLCHK_ENABLE = y
#AT+ECFLASHMONITORINFO
BUILD_PLAT_MEM_ECFLASHMONITORINFO_ENABLE = y
endif
##################################################################################################################
##Description: BUILD_PLAT_PMU_AT_ENABLE
##global option for Plat pmu related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_PMU_AT_ENABLE), y)
#AT+ECPMUCFG
BUILD_PLAT_PMU_ECPMUCFG_ENABLE = y
#AT+ECSYSMONCFG
BUILD_PLAT_PMU_ECSYSMONCFG_ENABLE = y
#AT+ECVOTECHK
BUILD_PLAT_PMU_ECVOTECHK_ENABLE = y
#AT+ECPMUSTATUS
BUILD_PLAT_PMU_ECPMUSTATUS_ENABLE = y
#AT+ECPURC
BUILD_PLAT_PMU_ECPURC_ENABLE = y
#AT+ECSCLK
BUILD_PLAT_PMU_ECSCLK_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_PER_AT_ENABLE
##global option for Plat peripheral related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_PER_AT_ENABLE), y)
#AT+IPR
BUILD_PLAT_PER_IPR_ENABLE = y
#AT+ICF
BUILD_PLAT_PER_ICF_ENABLE = n
#AT+IFC
BUILD_PLAT_PER_IFC_ENABLE = y
#AT+ECUSBSYS
BUILD_PLAT_PER_ECUSBSYS_ENABLE = y
#AT+ECLEDMODE
BUILD_PLAT_PER_ECLEDMODE_ENABLE = n
#AT+ECPALARM
BUILD_PLAT_PER_ECPALARM_ENABLE = n
#AT+ECADC
BUILD_PLAT_PER_ECADC_ENABLE = y
endif
##################################################################################################################
##Description: BUILD_PLAT_MISC_AT_ENABLE
##global option for Plat miscellaneous AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_MISC_AT_ENABLE), y)
#AT+ECPCFG
BUILD_PLAT_MISC_ECPCFG_ENABLE = y
#AT+ECRST
BUILD_PLAT_MISC_ECRST_ENABLE = y
#AT+ECPOWD
BUILD_PLAT_MISC_ECPOWD_ENABLE = n
#AT^SYSTEST
BUILD_PLAT_MISC_SYSTEST_ENABLE = n
#AT+ECSYSTEST
BUILD_PLAT_MISC_ECSYSTEST_ENABLE = y
#AT+ECTASKINFO
BUILD_PLAT_MISC_ECTASKINFO_ENABLE = n
#AT+ECTASKHISTINFO
BUILD_PLAT_MISC_ECTASKHISTINFO_ENABLE = n
#AT+ECLOGDBVER
BUILD_PLAT_MISC_ECLOGDBVER_ENABLE = y
#AT+ECDUMPCHK
BUILD_PLAT_MISC_ECDUMPCHK_ENABLE = n
#AT+ECBTOFFSETDBG
BUILD_PLAT_MISC_ECBTOFFSETDBG_ENABLE = n
#AT+ECFUSEMR
BUILD_PLAT_MISC_ECFUSEMR_ENABLE = y
#AT+ECSIMO
BUILD_PLAT_MISC_ECSIMO_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_PROD_AT_ENABLE
##global option for Plat product related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_PROD_AT_ENABLE), y)
#AT+ECATE
BUILD_PLAT_PROD_ECATE_ENABLE = n
#AT+ECVERSION
BUILD_PLAT_PROD_ECVERSION_ENABLE = n
#AT+ECIPR
BUILD_PLAT_PROD_ECIPR_ENABLE = y
#AT+ECSLEEP
BUILD_PLAT_PROD_ECSLEEP_ENABLE = y
#AT+ECSAVEFAC
BUILD_PLAT_PROD_ECSAVEFAC_ENABLE = y
#AT+ECRFTEST
BUILD_PLAT_PROD_ECRFTEST_ENABLE = y
#AT+ECGMDATA
BUILD_PLAT_PROD_ECGMDATA_ENABLE = y
#AT+ECNPICFG
BUILD_PLAT_PROD_ECNPICFG_ENABLE = y
#AT+ECRFNST
BUILD_PLAT_PROD_ECRFNST_ENABLE = y
#AT+ECRFSTAT
BUILD_PLAT_PROD_ECRFSTAT_ENABLE = y
#AT+ECPRODMODE
BUILD_PLAT_PROD_ECPRODMODE_ENABLE = n
endif
##################################################################################################################
##Description:
##global option for PS AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT), y)
BUILD_PS_GEN_AT_ENABLE = y
BUILD_PS_DEV_AT_ENABLE = y
BUILD_PS_EMM_AT_ENABLE = y
BUILD_PS_EPS_AT_ENABLE = y
BUILD_PS_SIM_AT_ENABLE = y
ifeq ($(GCF_FEATURE_ENABLE), y)
BUILD_PS_SMS_AT_ENABLE = y
else ifeq ($(MID_FEATURE_ENABLE), y)
BUILD_PS_SMS_AT_ENABLE = y
else
BUILD_PS_SMS_AT_ENABLE = n
endif
BUILD_PHY_CONFIG_AT_ENABLE = y
BUILD_PS_TCPIP_ECSOCK_AT_ENABLE = n
BUILD_PS_TCPIP_SKTSOCK_AT_ENABLE = n
BUILD_PS_TCPIP_NETCONFIG_AT_ENABLE = y
BUILD_PS_TCPIP_IPSEC_AT_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_GEN_AT_ENABLE
##Description:
##BUILD_PS_GEN_AT_ENABLE is to control whether include ps global AT commands as: AT/ATQ/ATE/ATT/ATV/ATL/ATM/...etc
##Use method: y is support;n is not support.
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_GEN_AT_ENABLE), y)
#AT via BUILD_PS_GEN_AT_ENABLE
#ATQ
BUILD_PS_GEN_AT_Q_ENABLE = n
#ATE
BUILD_PS_GEN_AT_E_ENABLE = y
#ATT
BUILD_PS_GEN_AT_T_ENABLE = n
#ATV
BUILD_PS_GEN_AT_V_ENABLE = y
#ATL
BUILD_PS_GEN_AT_L_ENABLE = n
#ATM
BUILD_PS_GEN_AT_M_ENABLE = n
#ATS0
BUILD_PS_GEN_AT_S0_ENABLE = n
#AT&C
BUILD_PS_GEN_AT_nC_ENABLE = n
#AT&D
BUILD_PS_GEN_AT_nD_ENABLE = y
#ATD
BUILD_PS_GEN_AT_D_ENABLE = y
#ATO
BUILD_PS_GEN_AT_O_ENABLE = y
#ATH
BUILD_PS_GEN_AT_H_ENABLE = y
ifeq ($(BUILD_PS_SMS_AT_ENABLE), y)
#AT+CSCS
BUILD_PS_GEN_CSCS_ENABLE = y
else
#AT+CSCS
BUILD_PS_GEN_CSCS_ENABLE = n
endif
#AT+CMEE
BUILD_PS_GEN_CMEE_ENABLE = n
BUILD_CMEE_2_VERBOSE_ENABLE = n
#AT+ECURC
BUILD_PS_GEN_ECURC_ENABLE = y
#AT+ECURCCFG
BUILD_PS_GEN_ECURCCFG_ENABLE = n
#AT+ECPPPHUP
BUILD_PS_GEN_ECPPPHUP_ENABLE = y
#AT+CLCK
BUILD_PS_GEN_CLCK_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_DEV_AT_ENABLE
##Description:
##BUILD_PS_DEV_AT_ENABLE is to control whether include ps global AT commands as: AT+CFUN/ECBAND/ECCFG/ECSTATUS/...etc
##Use method: y is support;n is not support.
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_DEV_AT_ENABLE), y)
#AT+CFUN
BUILD_PS_DEV_CFUN_ENABLE = y
#AT+ECCGSN
BUILD_PS_DEV_ECCGSN_ENABLE = y
#AT+ECCGSNLOCK
BUILD_PS_DEV_ECCGSNLOCK_ENABLE = n
#AT+ECSTATUS
BUILD_PS_DEV_ECSTATUS_ENABLE = y
#AT+ECSTATIS
BUILD_PS_DEV_ECSTATIS_ENABLE = n
#AT+ECBAND
BUILD_PS_DEV_ECBAND_ENABLE = y
#AT+ECFREQ
BUILD_PS_DEV_ECFREQ_ENABLE = y
#AT+ECCFG
BUILD_PS_DEV_ECCFG_ENABLE = y
#AT+ECMEASCFG
BUILD_PS_DEV_ECMEASCFG_ENABLE = n
ifeq ($(GCF_FEATURE_ENABLE), y)
#AT+ECRMFPLMN
BUILD_PS_DEV_ECRMFPLMN_ENABLE = y
else
#AT+ECRMFPLMN
BUILD_PS_DEV_ECRMFPLMN_ENABLE = n
endif
#AT+ECBCINFO
BUILD_PS_DEV_ECBCINFO_ENABLE = y
#AT+ECPSTEST
BUILD_PS_DEV_ECPSTEST_ENABLE = n
#AT+ECEVENTSTATIS
BUILD_PS_DEV_ECEVENTSTATIS_ENABLE = n
#AT+ECNASTCFG
BUILD_PS_DEV_ECNASTCFG_ENABLE = y
ifeq ($(GCF_FEATURE_ENABLE), y)
#AT+ECWIFISCAN
BUILD_PS_DEV_ECWIFISCAN_ENABLE = y
else ifeq ($(MID_FEATURE_ENABLE), y)
#AT+ECWIFISCAN
BUILD_PS_DEV_ECWIFISCAN_ENABLE = y
else
#AT+ECWIFISCAN
BUILD_PS_DEV_ECWIFISCAN_ENABLE = n
endif
#AT+ECBARCELL
BUILD_PS_DEV_ECBARCELL_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PS_EMM_AT_ENABLE
##Description:
##BUILD_PS_EMM_AT_ENABLE is to control whether include ps mm AT commands as: AT+CESQ/COPS/CCIOTOPT/ECCESQS/...etc
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_EMM_AT_ENABLE), y)
#AT+CSQ
BUILD_PS_EMM_CSQ_ENABLE = y
#AT+CESQ
BUILD_PS_EMM_CESQ_ENABLE = n
#AT+CREG
BUILD_PS_EMM_CREG_ENABLE = y
#AT+COPS
BUILD_PS_EMM_COPS_ENABLE = y
#AT+CPSMS
BUILD_PS_EMM_CPSMS_ENABLE = y
#AT+CEDRXS
BUILD_PS_EMM_CEDRXS_ENABLE = n
#AT+CEDRXRDP
BUILD_PS_EMM_CEDRXRDP_ENABLE = n
#AT+CCIOTOPT
BUILD_PS_EMM_CCIOTOPT_ENABLE = y
#AT+CRCES
BUILD_PS_EMM_CRCES_ENABLE = n
#AT+CCLK
BUILD_PS_EMM_CCLK_ENABLE = y
#AT+CTZR
BUILD_PS_EMM_CTZR_ENABLE = n
#AT+CTZU
BUILD_PS_EMM_CTZU_ENABLE = n
#AT+ECPLMNS
BUILD_PS_EMM_ECPLMNS_ENABLE = n
#AT+ECCESQSn
BUILD_PS_EMM_ECCESQS_ENABLE = n
#AT+ECPSMR
BUILD_PS_EMM_ECPSMR_ENABLE = n
#AT+ECPTWEDRXS
BUILD_PS_EMM_ECPTWEDRXS_ENABLE = n
#AT+ECEMMTIME
BUILD_PS_EMM_ECEMMTIME_ENABLE = n
#AT+ECPLMNRESELECT
ifeq ($(GCF_FEATURE_ENABLE), y)
#AT+ECRMFPLMN
BUILD_PS_EMM_ECPLMNRESELECT_ENABLE = y
else
#AT+ECRMFPLMN
BUILD_PS_EMM_ECPLMNRESELECT_ENABLE = n
endif
#AT+ECCONNREL
BUILD_PS_EMM_ECCONNREL_ENABLE = n
#AT+ECMMER
BUILD_PS_EMM_ECMMER_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PS_EPS_AT_ENABLE
##Description:
##BUILD_PS_EPS_AT_ENABLE is to control whether include ESP AT commands as: AT+CGATT/CGDCONT/CGACT/CGCONTRDP/CGAUTH..etc
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_EPS_AT_ENABLE), y)
#AT+CGATT
BUILD_PS_EPS_CGATT_ENABLE = y
#AT+ECEMCATT
BUILD_PS_EPS_ECEMCATT_ENABLE = n
#AT+CGDATA
BUILD_PS_EPS_CGDATA_ENABLE = n
ifeq ($(GCF_FEATURE_ENABLE), y)
#AT+CGTFT
BUILD_PS_EPS_CGTFT_ENABLE = y
#AT+CGCMOD
BUILD_PS_EPS_CGCMOD_ENABLE = y
#AT+CGEQOS
BUILD_PS_EPS_CGEQOS_ENABLE = y
#AT+CGDSCONT
BUILD_PS_EPS_CGDSCONT_ENABLE = y
else
#AT+CGTFT
BUILD_PS_EPS_CGTFT_ENABLE = n
#AT+CGCMOD
BUILD_PS_EPS_CGCMOD_ENABLE = n
#AT+CGEQOS
BUILD_PS_EPS_CGEQOS_ENABLE = n
#AT+CGDSCONT
BUILD_PS_EPS_CGDSCONT_ENABLE = n
endif
#AT+CEMODE
BUILD_PS_EPS_CEMODE_ENABLE = y
#AT+CGDCONT
BUILD_PS_EPS_CGDCONT_ENABLE = y
#AT+CGACT
BUILD_PS_EPS_CGACT_ENABLE = y
#AT+CGEQOSRDP
BUILD_PS_EPS_CGEQOSRDP_ENABLE = n
#AT+CGCONTRDP
BUILD_PS_EPS_CGCONTRDP_ENABLE = n
#AT+CGSCONTRDP
BUILD_PS_EPS_CGSCONTRDP_ENABLE = n
#AT+CGTFTRDP
BUILD_PS_EPS_CGTFTRDP_ENABLE = n
#AT+CEREG
BUILD_PS_EPS_CEREG_ENABLE = y
#AT+CSCON
BUILD_PS_EPS_CSCON_ENABLE = n
#AT+CSODCP
BUILD_PS_EPS_CSODCP_ENABLE = n
#AT+CRTDCP
BUILD_PS_EPS_CRTDCP_ENABLE = n
#AT+CGAUTH
BUILD_PS_EPS_CGAUTH_ENABLE = n
#AT+CIPCA
BUILD_PS_EPS_CIPCA_ENABLE = n
#AT+CGAPNRC
BUILD_PS_EPS_CGAPNRC_ENABLE = n
#AT+CGEREP
BUILD_PS_EPS_CGEREP_ENABLE = n
#AT+CGPADDR
BUILD_PS_EPS_CGPADDR_ENABLE = y
#AT+CEER
BUILD_PS_EPS_CEER_ENABLE = n
#AT+CEVDP
BUILD_PS_EPS_CEVDP_ENABLE = n
#AT+CPSDO
BUILD_PS_EPS_CPSDO_ENABLE = n
#AT+ECCIOTPLANE
BUILD_PS_EPS_ECCIOTPLANE_ENABLE = n
#AT+ECSENDDATA
BUILD_PS_EPS_ECSENDDATA_ENABLE = n
#AT+ECGDCNT
BUILD_PS_EPS_ECGDCNT_ENABLE = n
#AT+ECAUGDCNT
BUILD_PS_EPS_ECAUGDCNT_ENABLE = n
#AT+ECSCLKEX
BUILD_PS_EPS_ECSCLKEX_ENABLE = n
#AT+ECSMER
BUILD_PS_EPS_ECSMER_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PS_SIM_AT_ENABLE
##Description:
##BUILD_PS_SIM_AT_ENABLE is to control whether include SIM AT commands as: AT+CIMI/CPIN/ECICCID/ECSIMCFG..etc
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_SIM_AT_ENABLE), y)
#AT+CIMI
BUILD_PS_SIM_AT_CIMI_ENABLE = y
#AT+CPIN
BUILD_PS_SIM_AT_CPIN_ENABLE = y
#AT+ECICCID
BUILD_PS_SIM_AT_ECICCID_ENABLE = y
#AT+ECSIMCFG
BUILD_PS_SIM_AT_ECSIMCFG_ENABLE = y
#AT+CPWD
BUILD_PS_SIM_AT_CPWD_ENABLE = n
#AT+CPINR
BUILD_PS_SIM_AT_CPINR_ENABLE = n
#AT+ECSIMSLEEP
BUILD_PS_SIM_AT_ECSIMSLEEP_ENABLE = n
#AT+CSIM
BUILD_PS_SIM_AT_CSIM_ENABLE = n
#AT+CRSM
BUILD_PS_SIM_AT_CRSM_ENABLE = n
#AT+CCHO
BUILD_PS_SIM_AT_CCHO_ENABLE = n
#AT+CGLA
BUILD_PS_SIM_AT_CGLA_ENABLE = n
#AT+CCHC
BUILD_PS_SIM_AT_CCHC_ENABLE = n
#AT+ECSWC
BUILD_PS_SIM_AT_ECSWC_ENABLE = n
ifeq ($(GCF_FEATURE_ENABLE), y)
#AT+ECSIMRM
BUILD_PS_SIM_AT_ECSIMRM_ENABLE = y
else
#AT+ECSIMRM
BUILD_PS_SIM_AT_ECSIMRM_ENABLE = n
endif
#AT+CNUM
BUILD_PS_SIM_AT_CNUM_ENABLE = n
#AT+ECUSATP
BUILD_PS_SIM_AT_ECUSATP_ENABLE = n
#AT+CPOL
BUILD_PS_SIM_AT_CPOL_ENABLE = n
#AT+CPLS
BUILD_PS_SIM_AT_CPLS_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_SMS_AT_ENABLE
##Description:
##BUILD_PS_SMS_AT_ENABLE is to control whether include ps SMS AT commands as: AT+CMGS/CMGR/CMGW/CNMI/...etc
##Use method: y is support; n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_SMS_AT_ENABLE), y)
#AT+CMGS
BUILD_PS_SMS_CMGS_ENABLE = y
#AT+CMGC
BUILD_PS_SMS_CMGC_ENABLE = n
#AT+CMGR
BUILD_PS_SMS_CMGR_ENABLE = y
#AT+CMGW
BUILD_PS_SMS_CMGW_ENABLE = y
#AT+CSCA
BUILD_PS_SMS_CSCA_ENABLE = y
#AT+CNMI
BUILD_PS_SMS_CNMI_ENABLE = y
#AT+CMMS
BUILD_PS_SMS_CMMS_ENABLE = y
#AT+CMGD
BUILD_PS_SMS_CMGD_ENABLE = y
#AT+CMGL
BUILD_PS_SMS_CMGL_ENABLE = n
#AT+CSMS
BUILD_PS_SMS_CSMS_ENABLE = y
#AT+CPMS
BUILD_PS_SMS_CPMS_ENABLE = y
#AT+CNMA
BUILD_PS_SMS_CNMA_ENABLE = n
#AT+CMGF
BUILD_PS_SMS_CMGF_ENABLE = y
#AT+CSMP
BUILD_PS_SMS_CSMP_ENABLE = y
#AT+CSCB
BUILD_PS_SMS_CSCB_ENABLE = n
#AT+CSDH
BUILD_PS_SMS_CSDH_ENABLE = n
#AT+CMSS
BUILD_PS_SMS_CMSS_ENABLE = y
#AT+ECSMSSEND
BUILD_PS_SMS_ECSMSSEND_ENABLE = n
#AT+ECCMGS
BUILD_PS_SMS_ECCMGS_ENABLE = n
#AT+ECCMGR
BUILD_PS_SMS_ECCMGR_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PHY_CONFIG_AT_ENABLE
##Description:
##BUILD_PHY_CONFIG_AT_ENABLE is to control whether include PHY CONFIG AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PHY_CONFIG_AT_ENABLE), y)
#AT+ECPHYCFG
BUILD_PHY_CONFIG_ECPHYCFG_ENABLE = y
#AT+ECEDRXSIMU
BUILD_PHY_CONFIG_ECEDRXSIMU_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_TCPIP_ECSOCK_AT_ENABLE
##Description:
##BUILD_PS_TCPIP_ECSOCK_AT_ENABLE is to control whether include TCPIP EC SOCKET AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_TCPIP_ECSOCK_AT_ENABLE), y)
# do nothing here
endif
##################################################################################################################
##name :BUILD_PS_TCPIP_SKTSOCK_AT_ENABLE
##Description:
##BUILD_PS_TCPIP_ECSOCK_AT_ENABLE is to control whether include TCPIP SKT SOCKET AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_TCPIP_SKTSOCK_AT_ENABLE), y)
# do nothing here
endif
##################################################################################################################
##name :BUILD_PS_TCPIP_API_ENABLE
##Description:
##BUILD_PS_TCPIP_API_ENABLE is to control whether include EC TCPIP API
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_TCPIP_API_ENABLE), y)
# do nothing here
endif
##################################################################################################################
##name :BUILD_AT_REF
##Description:
##BUILD_AT_REF is to control whether include REF AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT_REF), y)
#define QI sockets command AT+QIOPEN/QICLOSE/QIRD/QISDE/QIGETERROR/QISTATE/QISEND/QISENDEX/QISWTMD
ifeq ($(MORE_ROM_ENABLE), y)
BUILD_PS_REF_TCPIP_QSOCK_AT_ENABLE = n
else
BUILD_PS_REF_TCPIP_QSOCK_AT_ENABLE = y
endif
#define QNETCONIG command AT+QIDNSCFG/QIDNSGIP/QNETDEVCTL
BUILD_PS_REF_TCPIP_QNETCONFIG_AT_ENABLE = n
#define QPING command AT+QPING
BUILD_PS_REF_TCPIP_QPING_SERVICE_ENABLE = n
#define QNTP command AT+QNTP
BUILD_PS_REF_TCPIP_QSNTP_SERVICE_ENABLE = n
#define QI socket command: AT+QCCID/QENG/QCELL/QWIFISCAN/QPOWD/QSPN/QIACT/QIDEACT/QIREGAPP/QICSGP/QGDCNT/QAUGDCNT
BUILD_PS_REF_EPS_AT_ENABLE = n
#define QI socket command: AT+QICFG/QCFG
BUILD_PS_REF_COMMON_AT_ENABLE = y
endif
#<<<'OPENCPU_MODE_ENABLE' ENDDING...
endif

View File

@ -0,0 +1,745 @@
#BIN_COMPRESS for post bin compress tool
#THIRDPARTY_LZMA_ENABLE LZMA feature compile en
#RAMCODE_COMPRESS_EN ramcode/RW decompress, used in code
#REL_COMPRESS_EN calibration back up compress en, used in code
CFLAGS_DEFS += -DRAMCODE_COMPRESS_EN
CFLAGS_DEFS += -DREL_COMPRESS_EN
THIRDPARTY_LZMA_ENABLE = y
BIN_COMPRESS = y
DRIVER_CPFLASH_ENABLE = n
DRIVER_VPU_ENABLE = n
DRIVER_EEPROM_ENABLE = n
DRIVER_SPI_ENABLE = n
DRIVER_I2C_ENABLE = n
DRIVER_PSRAM_ENABLE = y
DRIVER_PCACHE_ENABLE = y
DRIVER_EXSTORAGE_ENABLE = n
#DRIVER_LPUART_ENABLE = n
DRIVER_ONEWIRE_ENABLE = n
DRIVER_EX_ETHERNET_ENABLE = n
ifeq ($(DRIVER_EX_ETHERNET_ENABLE), y)
DRIVER_WCH_CH390_ENABLE = y
endif
THIRDPARTY_PING_ENABLE = y
THIRDPARTY_YRCOMPRESS_ENABLE = y
THIRDPARTY_JPEGCOMP_ENABLE = n
MIDDLEWARE_USB_CCID_ENABLE = n
MIDDLEWARE_FOTAPAR_ENABLE = y
BUILD_EC_MW = n
AT_EXAMPLE_ENABLE = n
#should always enable, default compiled in lib
DRIVER_ACVOICE_ENG_ENABLE = y
#Exception Flash Dump enable, default enable
EXCEPTION_FLASH_DUMP_ENABLE = y
ifneq ($(OPENCPU_MODE_ENABLE), y)
THIRDPARTY_IPERF_ENABLE = y
THIRDPARTY_LIBSNTP_ENABLE = y
THIRDPARTY_HTTPC_ENABLE = y
MBEDTLS_WITH_HTTP_TLS = y
THIRDPARTY_MQTT_ENABLE = y
MBEDTLS_WITH_MQTT_TLS = n
#cjson is refered by MQTT
THIRDPARTY_CJSON_ENABLE = y
THIRDPARTY_CTCC_DM_ENABLE = n
THIRDPARTY_CUCC_DM_ENABLE = n
THIRDPARTY_CMCC_DM_ENABLE = n
THIRDPARTY_CTWING_CERTI_ENABLE = n
BUILD_PS_TCPIP_API_ENABLE = y
BUILD_AT = y
BUILD_AT_DEBUG = y
BUILD_AT_REF = y
else
#>>>'OPENCPU_MODE_ENABLE' STARTING...
ifeq ($(IMS_MODE_ENABLE), y)
BUILD_IMS = y
BUILD_PS_ROHC_ENABLE = y
THIRDPARTY_CJSON_ENABLE = y
endif
ifeq ($(IMS_SMSONLY_MODE_ENABLE), y)
BUILD_IMS = y
THIRDPARTY_CJSON_ENABLE = y
endif
ifeq ($(AUDIO_MODE_ENABLE), y)
MIDDLEWARE_AMR_ENABLE = y
MIDDLEWARE_VEM_ENABLE = y
DRIVER_VEM_CFG_ENABLE = y
DRIVER_I2C_ENABLE = y
DRIVER_CODEC_ENABLE = y
DRIVER_CODEC8311_ENABLE = y
DRIVER_CODEC8374_ENABLE = y
DRIVER_AUDIO_EX_STORGE_ENABLE = y
ifeq ($(DRIVER_AUDIO_EX_STORGE_ENABLE), y)
DRIVER_AUDIO_EX_SDCARD_ENABLE = y
DRIVER_AUDIO_EX_FLASH_ENABLE = y
CFLAGS += -DFEATURE_AUDIO_EX_STORAGE_ENABLE
endif
BUILD_SUPPORT_APP_PCM_MEM_POOL = n
endif
THIRDPARTY_PPP_ENABLE = n
THIRDPARTY_IPERF_ENABLE = n
THIRDPARTY_LIBSNTP_ENABLE = y
THIRDPARTY_MBEDTLS_ENABLE = n
THIRDPARTY_HTTPC_ENABLE = n
MBEDTLS_WITH_HTTP_TLS = n
THIRDPARTY_MQTT_ENABLE = n
MBEDTLS_WITH_MQTT_TLS = n
#cjson is refered by MQTT, cjson defult value: n, as IMS also need it, here remove it
#THIRDPARTY_CJSON_ENABLE = n
THIRDPARTY_CTCC_DM_ENABLE = n
THIRDPARTY_CUCC_DM_ENABLE = n
THIRDPARTY_CMCC_DM_ENABLE = n
THIRDPARTY_CTWING_CERTI_ENABLE = n
BUILD_PS_TCPIP_API_ENABLE = n
BUILD_AT = y
BUILD_AT_DEBUG = n
BUILD_AT_REF = y
##################################################################################################################
##Description:
##global option for RIL APIs
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT), y)
BUILD_RIL_AT_API_ENABLE = n
endif
##################################################################################################################
##Description:
##global option for Plat AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT), y)
BUILD_PLAT_CUST_AT_ENABLE = y
ifeq ($(PWR_TEST), y)
BUILD_PLAT_MEM_AT_ENABLE = y
else
BUILD_PLAT_MEM_AT_ENABLE = n
endif
BUILD_PLAT_PMU_AT_ENABLE = y
BUILD_PLAT_PER_AT_ENABLE = y
BUILD_PLAT_MISC_AT_ENABLE = y
ifeq ($(IMS_MODE_ENABLE), y)
BUILD_PLAT_PROD_AT_ENABLE = y
else ifeq ($(IMS_SMSONLY_MODE_ENABLE), y)
BUILD_PLAT_PROD_AT_ENABLE = y
else ifeq ($(AUDIO_MODE_ENABLE), y)
BUILD_PLAT_PROD_AT_ENABLE = y
else
BUILD_PLAT_PROD_AT_ENABLE = n
endif
BUILD_PLAT_FOTA_AT_ENABLE = y
BUILD_PLAT_ECOTA_AT_ENABLE = n
BUILD_PLAT_CMUX_AT_ENABLE = n
BUILD_PLAT_HTTP_AT_ENABLE = n
BUILD_PLAT_MQTT_AT_ENABLE = n
BUILD_PLAT_SSL_AT_ENABLE = n
BUILD_PLAT_FS_AT_ENABLE = n
ifeq ($(AUDIO_MODE_ENABLE), y)
BUILD_PLAT_AUDIO_AT_ENABLE = y
else
BUILD_PLAT_AUDIO_AT_ENABLE = n
endif
BUILD_PLAT_ONENET_AT_ENABLE = n
BUILD_PLAT_CTLWM2M_AT_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_AUDIO_AT_ENABLE
##global option for Plat audio related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_AUDIO_AT_ENABLE), y)
#AT+ADCFG
BUILD_PLAT_AUDIO_ECADCFG_ENABLE = y
ifeq ($(AUDIO_FIX_SRC_ENABLE), y)
BUILD_FIXED_AUDIO_SOURCE_ENABLE = y
else
BUILD_FIXED_AUDIO_SOURCE_ENABLE = n
endif
endif
##################################################################################################################
##Description: BUILD_PLAT_CUST_AT_ENABLE
##global option for Plat product related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_CUST_AT_ENABLE), y)
#AT+CGMI
BUILD_PLAT_CUST_CGMI_ENABLE = y
#AT+CGMM
BUILD_PLAT_CUST_CGMM_ENABLE = y
#AT+GMM
BUILD_PLAT_CUST_GMM_ENABLE = y
#AT+CGMR
BUILD_PLAT_CUST_CGMR_ENABLE = y
#AT+CGSN
BUILD_PLAT_CUST_CGSN_ENABLE = y
#ATI
BUILD_PLAT_CUST_ATI_ENABLE = y
#AT&W
BUILD_PLAT_CUST_ATnW_ENABLE = y
#AT&F
BUILD_PLAT_CUST_ATnF_ENABLE = y
#AT&V
BUILD_PLAT_CUST_ATnV_ENABLE = y
endif
##################################################################################################################
##Description: BUILD_PLAT_MEM_AT_ENABLE
##global option for Plat memory related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_MEM_AT_ENABLE), y)
#AT+ECSHOWMEM
BUILD_PLAT_MEM_ECSHOWMEM_ENABLE = y
#AT+ECHEAPINFO
BUILD_PLAT_MEM_ECHEAPINFO_ENABLE = y
#AT+ECMEM32
BUILD_PLAT_MEM_ECMEM32_ENABLE = y
#AT+ECDLFCMEM
BUILD_PLAT_MEM_ECDLFCMEM_ENABLE = y
#AT+ECFSINFO
BUILD_PLAT_MEM_ECFSINFO_ENABLE = y
#AT+RLCHK
BUILD_PLAT_MEM_RLCHK_ENABLE = y
#AT+ECFLASHMONITORINFO
BUILD_PLAT_MEM_ECFLASHMONITORINFO_ENABLE = y
endif
##################################################################################################################
##Description: BUILD_PLAT_PMU_AT_ENABLE
##global option for Plat pmu related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_PMU_AT_ENABLE), y)
#AT+ECPMUCFG
BUILD_PLAT_PMU_ECPMUCFG_ENABLE = y
#AT+ECSYSMONCFG
BUILD_PLAT_PMU_ECSYSMONCFG_ENABLE = y
#AT+ECVOTECHK
BUILD_PLAT_PMU_ECVOTECHK_ENABLE = y
#AT+ECPMUSTATUS
BUILD_PLAT_PMU_ECPMUSTATUS_ENABLE = n
#AT+ECPURC
BUILD_PLAT_PMU_ECPURC_ENABLE = y
#AT+ECSCLK
BUILD_PLAT_PMU_ECSCLK_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_PER_AT_ENABLE
##global option for Plat peripheral related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_PER_AT_ENABLE), y)
#AT+IPR
BUILD_PLAT_PER_IPR_ENABLE = y
#AT+ICF
BUILD_PLAT_PER_ICF_ENABLE = n
#AT+IFC
BUILD_PLAT_PER_IFC_ENABLE = n
#AT+ECUSBSYS
BUILD_PLAT_PER_ECUSBSYS_ENABLE = n
#AT+ECLEDMODE
BUILD_PLAT_PER_ECLEDMODE_ENABLE = n
#AT+ECPALARM
BUILD_PLAT_PER_ECPALARM_ENABLE = n
#AT+ECADC
BUILD_PLAT_PER_ECADC_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_MISC_AT_ENABLE
##global option for Plat miscellaneous AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_MISC_AT_ENABLE), y)
#AT+ECPCFG
BUILD_PLAT_MISC_ECPCFG_ENABLE = y
#AT+ECRST
BUILD_PLAT_MISC_ECRST_ENABLE = y
#AT+ECPOWD
BUILD_PLAT_MISC_ECPOWD_ENABLE = n
#AT^SYSTEST
BUILD_PLAT_MISC_SYSTEST_ENABLE = n
#AT+ECSYSTEST
BUILD_PLAT_MISC_ECSYSTEST_ENABLE = n
#AT+ECTASKINFO
BUILD_PLAT_MISC_ECTASKINFO_ENABLE = n
#AT+ECTASKHISTINFO
BUILD_PLAT_MISC_ECTASKHISTINFO_ENABLE = n
#AT+ECLOGDBVER
BUILD_PLAT_MISC_ECLOGDBVER_ENABLE = n
#AT+ECDUMPCHK
BUILD_PLAT_MISC_ECDUMPCHK_ENABLE = n
#AT+ECBTOFFSETDBG
BUILD_PLAT_MISC_ECBTOFFSETDBG_ENABLE = n
#AT+ECFUSEMR
BUILD_PLAT_MISC_ECFUSEMR_ENABLE = n
#AT+ECSIMO
BUILD_PLAT_MISC_ECSIMO_ENABLE = n
#AT+ECPRFINFO
BUILD_PLAT_MISC_ECPRFINFO_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_PROD_AT_ENABLE
##global option for Plat product related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_PROD_AT_ENABLE), y)
#AT+ECATE
BUILD_PLAT_PROD_ECATE_ENABLE = y
#AT+ECVERSION
BUILD_PLAT_PROD_ECVERSION_ENABLE = y
#AT+ECIPR
BUILD_PLAT_PROD_ECIPR_ENABLE = y
#AT+ECSLEEP
BUILD_PLAT_PROD_ECSLEEP_ENABLE = y
#AT+ECSAVEFAC
BUILD_PLAT_PROD_ECSAVEFAC_ENABLE = y
#AT+ECRFTEST
BUILD_PLAT_PROD_ECRFTEST_ENABLE = y
#AT+ECGMDATA
BUILD_PLAT_PROD_ECGMDATA_ENABLE = y
#AT+ECNPICFG
BUILD_PLAT_PROD_ECNPICFG_ENABLE = y
#AT+ECRFNST
BUILD_PLAT_PROD_ECRFNST_ENABLE = y
#AT+ECRFSTAT
BUILD_PLAT_PROD_ECRFSTAT_ENABLE = y
#AT+ECPRODMODE
BUILD_PLAT_PROD_ECPRODMODE_ENABLE = y
endif
##################################################################################################################
##Description:
##global option for PS AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT), y)
BUILD_PS_GEN_AT_ENABLE = y
BUILD_PS_DEV_AT_ENABLE = y
BUILD_PS_EMM_AT_ENABLE = y
BUILD_PS_EPS_AT_ENABLE = y
BUILD_PS_SIM_AT_ENABLE = y
BUILD_PS_SMS_AT_ENABLE = y
BUILD_PHY_CONFIG_AT_ENABLE = y
BUILD_PS_TCPIP_ECSOCK_AT_ENABLE = n
BUILD_PS_TCPIP_SKTSOCK_AT_ENABLE = n
BUILD_PS_TCPIP_NETCONFIG_AT_ENABLE = y
BUILD_PS_TCPIP_IPSEC_AT_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_GEN_AT_ENABLE
##Description:
##BUILD_PS_GEN_AT_ENABLE is to control whether include ps global AT commands as: AT/ATQ/ATE/ATT/ATV/ATL/ATM/...etc
##Use method: y is support;n is not support.
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_GEN_AT_ENABLE), y)
#AT via BUILD_PS_GEN_AT_ENABLE
#ATQ
BUILD_PS_GEN_AT_Q_ENABLE = n
#ATE
BUILD_PS_GEN_AT_E_ENABLE = y
#ATT
BUILD_PS_GEN_AT_T_ENABLE = n
#ATV
BUILD_PS_GEN_AT_V_ENABLE = y
#ATL
BUILD_PS_GEN_AT_L_ENABLE = n
#ATM
BUILD_PS_GEN_AT_M_ENABLE = n
#ATS0
BUILD_PS_GEN_AT_S0_ENABLE = n
#AT&C
BUILD_PS_GEN_AT_nC_ENABLE = n
#AT&D
BUILD_PS_GEN_AT_nD_ENABLE = y
#ATD
BUILD_PS_GEN_AT_D_ENABLE = y
#ATO
BUILD_PS_GEN_AT_O_ENABLE = y
#ATH
BUILD_PS_GEN_AT_H_ENABLE = y
#ATA
BUILD_PS_GEN_AT_A_ENABLE = y
#AT+CSCS
BUILD_PS_GEN_CSCS_ENABLE = y
#AT+CMEE
BUILD_PS_GEN_CMEE_ENABLE = n
#AT+ECURC
BUILD_PS_GEN_ECURC_ENABLE = y
#AT+ECURCCFG
BUILD_PS_GEN_ECURCCFG_ENABLE = n
#AT+ECPPPHUP
BUILD_PS_GEN_ECPPPHUP_ENABLE = y
#AT+CLCK
BUILD_PS_GEN_CLCK_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_DEV_AT_ENABLE
##Description:
##BUILD_PS_DEV_AT_ENABLE is to control whether include ps global AT commands as: AT+CFUN/ECBAND/ECCFG/ECSTATUS/...etc
##Use method: y is support;n is not support.
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_DEV_AT_ENABLE), y)
#AT+CFUN
BUILD_PS_DEV_CFUN_ENABLE = y
#AT+ECCGSN
BUILD_PS_DEV_ECCGSN_ENABLE = y
#AT+ECCGSNLOCK
BUILD_PS_DEV_ECCGSNLOCK_ENABLE = n
#AT+ECSTATUS
BUILD_PS_DEV_ECSTATUS_ENABLE = y
#AT+ECSTATIS
BUILD_PS_DEV_ECSTATIS_ENABLE = n
#AT+ECBAND
BUILD_PS_DEV_ECBAND_ENABLE = y
#AT+ECFREQ
BUILD_PS_DEV_ECFREQ_ENABLE = y
#AT+ECCFG
BUILD_PS_DEV_ECCFG_ENABLE = y
#AT+ECMEASCFG
BUILD_PS_DEV_ECMEASCFG_ENABLE = n
#AT+ECRMFPLMN
BUILD_PS_DEV_ECRMFPLMN_ENABLE = y
#AT+ECBCINFO
BUILD_PS_DEV_ECBCINFO_ENABLE = y
#AT+ECPSTEST
BUILD_PS_DEV_ECPSTEST_ENABLE = n
#AT+ECEVENTSTATIS
BUILD_PS_DEV_ECEVENTSTATIS_ENABLE = n
#AT+ECNASTCFG
BUILD_PS_DEV_ECNASTCFG_ENABLE = y
#AT+ECWIFISCAN
BUILD_PS_DEV_ECWIFISCAN_ENABLE = n
#AT+ECBARCELL
BUILD_PS_DEV_ECBARCELL_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PS_EMM_AT_ENABLE
##Description:
##BUILD_PS_EMM_AT_ENABLE is to control whether include ps mm AT commands as: AT+CESQ/COPS/CCIOTOPT/ECCESQS/...etc
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_EMM_AT_ENABLE), y)
#AT+CSQ
BUILD_PS_EMM_CSQ_ENABLE = y
#AT+CESQ
BUILD_PS_EMM_CESQ_ENABLE = n
#AT+CREG
BUILD_PS_EMM_CREG_ENABLE = y
#AT+COPS
BUILD_PS_EMM_COPS_ENABLE = y
#AT+CPSMS
BUILD_PS_EMM_CPSMS_ENABLE = y
#AT+CEDRXS
BUILD_PS_EMM_CEDRXS_ENABLE = n
#AT+CEDRXRDP
BUILD_PS_EMM_CEDRXRDP_ENABLE = n
#AT+CCIOTOPT
BUILD_PS_EMM_CCIOTOPT_ENABLE = y
#AT+CRCES
BUILD_PS_EMM_CRCES_ENABLE = n
#AT+CCLK
BUILD_PS_EMM_CCLK_ENABLE = y
#AT+CTZR
BUILD_PS_EMM_CTZR_ENABLE = n
#AT+CTZU
BUILD_PS_EMM_CTZU_ENABLE = n
#AT+ECPLMNS
BUILD_PS_EMM_ECPLMNS_ENABLE = n
#AT+ECCESQSn
BUILD_PS_EMM_ECCESQS_ENABLE = n
#AT+ECPSMR
BUILD_PS_EMM_ECPSMR_ENABLE = n
#AT+ECPTWEDRXS
BUILD_PS_EMM_ECPTWEDRXS_ENABLE = n
#AT+ECEMMTIME
BUILD_PS_EMM_ECEMMTIME_ENABLE = n
#AT+ECPLMNRESELECT
BUILD_PS_EMM_ECPLMNRESELECT_ENABLE = n
#AT+ECCONNREL
BUILD_PS_EMM_ECCONNREL_ENABLE = n
#AT+ECMMER
BUILD_PS_EMM_ECMMER_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PS_EPS_AT_ENABLE
##Description:
##BUILD_PS_EPS_AT_ENABLE is to control whether include ESP AT commands as: AT+CGATT/CGDCONT/CGACT/CGCONTRDP/CGAUTH..etc
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_EPS_AT_ENABLE), y)
#AT+CGATT
BUILD_PS_EPS_CGATT_ENABLE = y
#AT+ECEMCATT
BUILD_PS_EPS_ECEMCATT_ENABLE = n
#AT+CGDATA
BUILD_PS_EPS_CGDATA_ENABLE = n
#AT+CGTFT
BUILD_PS_EPS_CGTFT_ENABLE = n
#AT+CGCMOD
BUILD_PS_EPS_CGCMOD_ENABLE = n
#AT+CGEQOS
BUILD_PS_EPS_CGEQOS_ENABLE = n
#AT+CGDSCONT
BUILD_PS_EPS_CGDSCONT_ENABLE = n
#AT+CEMODE
BUILD_PS_EPS_CEMODE_ENABLE = y
#AT+CGDCONT
BUILD_PS_EPS_CGDCONT_ENABLE = y
#AT+CGACT
BUILD_PS_EPS_CGACT_ENABLE = y
#AT+CGEQOSRDP
BUILD_PS_EPS_CGEQOSRDP_ENABLE = n
#AT+CGCONTRDP
BUILD_PS_EPS_CGCONTRDP_ENABLE = n
#AT+CGSCONTRDP
BUILD_PS_EPS_CGSCONTRDP_ENABLE = n
#AT+CGTFTRDP
BUILD_PS_EPS_CGTFTRDP_ENABLE = n
#AT+CEREG
BUILD_PS_EPS_CEREG_ENABLE = y
#AT+CSCON
BUILD_PS_EPS_CSCON_ENABLE = n
#AT+CSODCP
BUILD_PS_EPS_CSODCP_ENABLE = n
#AT+CRTDCP
BUILD_PS_EPS_CRTDCP_ENABLE = n
#AT+CGAUTH
BUILD_PS_EPS_CGAUTH_ENABLE = n
#AT+CIPCA
BUILD_PS_EPS_CIPCA_ENABLE = n
#AT+CGAPNRC
BUILD_PS_EPS_CGAPNRC_ENABLE = n
#AT+CGEREP
BUILD_PS_EPS_CGEREP_ENABLE = n
#AT+CGPADDR
BUILD_PS_EPS_CGPADDR_ENABLE = y
#AT+CEER
BUILD_PS_EPS_CEER_ENABLE = n
#AT+CEVDP
BUILD_PS_EPS_CEVDP_ENABLE = n
#AT+CPSDO
BUILD_PS_EPS_CPSDO_ENABLE = n
#AT+ECCIOTPLANE
BUILD_PS_EPS_ECCIOTPLANE_ENABLE = n
#AT+ECSENDDATA
BUILD_PS_EPS_ECSENDDATA_ENABLE = n
#AT+ECGDCNT
BUILD_PS_EPS_ECGDCNT_ENABLE = n
#AT+ECAUGDCNT
BUILD_PS_EPS_ECAUGDCNT_ENABLE = n
#AT+ECSCLKEX
BUILD_PS_EPS_ECSCLKEX_ENABLE = n
#AT+ECSMER
BUILD_PS_EPS_ECSMER_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PS_SIM_AT_ENABLE
##Description:
##BUILD_PS_SIM_AT_ENABLE is to control whether include SIM AT commands as: AT+CIMI/CPIN/ECICCID/ECSIMCFG..etc
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_SIM_AT_ENABLE), y)
#AT+CIMI
BUILD_PS_SIM_AT_CIMI_ENABLE = y
#AT+CPIN
BUILD_PS_SIM_AT_CPIN_ENABLE = y
#AT+ECICCID
BUILD_PS_SIM_AT_ECICCID_ENABLE = y
#AT+ECSIMCFG
BUILD_PS_SIM_AT_ECSIMCFG_ENABLE = y
#AT+CPWD
BUILD_PS_SIM_AT_CPWD_ENABLE = n
#AT+CPINR
BUILD_PS_SIM_AT_CPINR_ENABLE = n
#AT+ECSIMSLEEP
BUILD_PS_SIM_AT_ECSIMSLEEP_ENABLE = n
#AT+CSIM
BUILD_PS_SIM_AT_CSIM_ENABLE = n
#AT+CRSM
BUILD_PS_SIM_AT_CRSM_ENABLE = n
#AT+CCHO
BUILD_PS_SIM_AT_CCHO_ENABLE = n
#AT+CGLA
BUILD_PS_SIM_AT_CGLA_ENABLE = n
#AT+CCHC
BUILD_PS_SIM_AT_CCHC_ENABLE = n
#AT+ECSWC
BUILD_PS_SIM_AT_ECSWC_ENABLE = n
#AT+ECSIMRM
BUILD_PS_SIM_AT_ECSIMRM_ENABLE = y
#AT+CNUM
BUILD_PS_SIM_AT_CNUM_ENABLE = n
#AT+ECUSATP
BUILD_PS_SIM_AT_ECUSATP_ENABLE = n
#AT+CPOL
BUILD_PS_SIM_AT_CPOL_ENABLE = n
#AT+CPLS
BUILD_PS_SIM_AT_CPLS_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_SMS_AT_ENABLE
##Description:
##BUILD_PS_SMS_AT_ENABLE is to control whether include ps SMS AT commands as: AT+CMGS/CMGR/CMGW/CNMI/...etc
##Use method: y is support; n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_SMS_AT_ENABLE), y)
#AT+CMGS
BUILD_PS_SMS_CMGS_ENABLE = y
#AT+CMGC
BUILD_PS_SMS_CMGC_ENABLE = n
#AT+CMGR
BUILD_PS_SMS_CMGR_ENABLE = y
#AT+CMGW
BUILD_PS_SMS_CMGW_ENABLE = y
#AT+CSCA
BUILD_PS_SMS_CSCA_ENABLE = y
#AT+CNMI
BUILD_PS_SMS_CNMI_ENABLE = y
#AT+CMMS
BUILD_PS_SMS_CMMS_ENABLE = y
#AT+CMGD
BUILD_PS_SMS_CMGD_ENABLE = y
#AT+CMGL
BUILD_PS_SMS_CMGL_ENABLE = y
#AT+CSMS
BUILD_PS_SMS_CSMS_ENABLE = y
#AT+CPMS
BUILD_PS_SMS_CPMS_ENABLE = y
#AT+CNMA
BUILD_PS_SMS_CNMA_ENABLE = y
#AT+CMGF
BUILD_PS_SMS_CMGF_ENABLE = y
#AT+CSMP
BUILD_PS_SMS_CSMP_ENABLE = y
#AT+CSCB
BUILD_PS_SMS_CSCB_ENABLE = y
#AT+CSDH
BUILD_PS_SMS_CSDH_ENABLE = y
#AT+CMSS
BUILD_PS_SMS_CMSS_ENABLE = y
#AT+ECSMSSEND
BUILD_PS_SMS_ECSMSSEND_ENABLE = y
#AT+ECCMGS
BUILD_PS_SMS_ECCMGS_ENABLE = y
#AT+ECCMGR
BUILD_PS_SMS_ECCMGR_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PHY_CONFIG_AT_ENABLE
##Description:
##BUILD_PHY_CONFIG_AT_ENABLE is to control whether include PHY CONFIG AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PHY_CONFIG_AT_ENABLE), y)
#AT+ECPHYCFG
BUILD_PHY_CONFIG_ECPHYCFG_ENABLE = y
#AT+ECEDRXSIMU
BUILD_PHY_CONFIG_ECEDRXSIMU_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_TCPIP_ECSOCK_AT_ENABLE
##Description:
##BUILD_PS_TCPIP_ECSOCK_AT_ENABLE is to control whether include TCPIP EC SOCKET AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_TCPIP_ECSOCK_AT_ENABLE), y)
# do nothing here
endif
##################################################################################################################
##name :BUILD_PS_TCPIP_SKTSOCK_AT_ENABLE
##Description:
##BUILD_PS_TCPIP_ECSOCK_AT_ENABLE is to control whether include TCPIP SKT SOCKET AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_TCPIP_SKTSOCK_AT_ENABLE), y)
# do nothing here
endif
##################################################################################################################
##name :BUILD_PS_TCPIP_API_ENABLE
##Description:
##BUILD_PS_TCPIP_API_ENABLE is to control whether include EC TCPIP API
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_TCPIP_API_ENABLE), y)
# do nothing here
endif
##################################################################################################################
##name :BUILD_AT_REF
##Description:
##BUILD_AT_REF is to control whether include REF AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT_REF), y)
#define QI sockets command AT+QIOPEN/QICLOSE/QIRD/QISDE/QIGETERROR/QISTATE/QISEND/QISENDEX/QISWTMD
BUILD_PS_REF_TCPIP_QSOCK_AT_ENABLE = y
#define QNETCONIG command AT+QIDNSCFG/QIDNSGIP/QNETDEVCTL
BUILD_PS_REF_TCPIP_QNETCONFIG_AT_ENABLE = n
#define QPING command AT+QPING
BUILD_PS_REF_TCPIP_QPING_SERVICE_ENABLE = n
#define QNTP command AT+QNTP
BUILD_PS_REF_TCPIP_QSNTP_SERVICE_ENABLE = n
#define QI socket command: AT+QCCID/QENG/QCELL/QWIFISCAN/QPOWD/QSPN/QIACT/QIDEACT/QIREGAPP/QICSGP/QGDCNT/QAUGDCNT
BUILD_PS_REF_EPS_AT_ENABLE = n
#define QI socket command: AT+QICFG/QCFG
BUILD_PS_REF_COMMON_AT_ENABLE = y
endif
#<<<'OPENCPU_MODE_ENABLE' ENDDING...
endif

View File

@ -0,0 +1,766 @@
#BIN_COMPRESS for post bin compress tool
#THIRDPARTY_LZMA_ENABLE LZMA feature compile en
#RAMCODE_COMPRESS_EN ramcode/RW decompress, used in code
#REL_COMPRESS_EN calibration back up compress en, used in code
CFLAGS_DEFS += -DRAMCODE_COMPRESS_EN
CFLAGS_DEFS += -DREL_COMPRESS_EN
THIRDPARTY_LZMA_ENABLE = y
BIN_COMPRESS = y
DRIVER_CPFLASH_ENABLE = n
DRIVER_VPU_ENABLE = n
DRIVER_EEPROM_ENABLE = n
DRIVER_SPI_ENABLE = n
ifeq ($(MID_FEATURE_ENABLE), y)
DRIVER_I2C_ENABLE = y
else
DRIVER_I2C_ENABLE = n
endif
DRIVER_PSRAM_ENABLE = n
DRIVER_PCACHE_ENABLE = n
DRIVER_EXSTORAGE_ENABLE = n
#DRIVER_LPUART_ENABLE = n
DRIVER_ONEWIRE_ENABLE = n
DRIVER_ACVOICE_ENABLE = n
THIRDPARTY_PING_ENABLE = y
THIRDPARTY_YRCOMPRESS_ENABLE = y
MIDDLEWARE_USB_CCID_ENABLE = n
ifeq ($(GCF_FEATURE_ENABLE), y)
MIDDLEWARE_FOTAPAR_ENABLE = n
else
MIDDLEWARE_FOTAPAR_ENABLE = y
endif
BUILD_EC_MW = n
AT_EXAMPLE_ENABLE = n
BUILD_PS_ROHC_ENABLE = n
ifneq ($(OPENCPU_MODE_ENABLE), y)
THIRDPARTY_IPERF_ENABLE = y
THIRDPARTY_LIBSNTP_ENABLE = y
THIRDPARTY_HTTPC_ENABLE = y
MBEDTLS_WITH_HTTP_TLS = y
THIRDPARTY_MQTT_ENABLE = y
MBEDTLS_WITH_MQTT_TLS = n
#cjson is refered by MQTT
THIRDPARTY_CJSON_ENABLE = y
THIRDPARTY_CTCC_DM_ENABLE = n
THIRDPARTY_CUCC_DM_ENABLE = n
THIRDPARTY_CMCC_DM_ENABLE = n
THIRDPARTY_CTWING_CERTI_ENABLE = n
BUILD_PS_TCPIP_API_ENABLE = y
BUILD_AT = y
BUILD_AT_DEBUG = y
BUILD_AT_REF = y
else
#>>>'OPENCPU_MODE_ENABLE' STARTING...
THIRDPARTY_PPP_ENABLE = n
THIRDPARTY_IPERF_ENABLE = n
THIRDPARTY_LIBSNTP_ENABLE = y
THIRDPARTY_MBEDTLS_ENABLE = n
ifeq ($(MID_FEATURE_ENABLE), y)
THIRDPARTY_HTTPC_ENABLE = n
else ifeq ($(MORE_ROM_ENABLE), y)
THIRDPARTY_HTTPC_ENABLE = n
else
THIRDPARTY_HTTPC_ENABLE = y
endif
MBEDTLS_WITH_HTTP_TLS = n
THIRDPARTY_MQTT_ENABLE = n
MBEDTLS_WITH_MQTT_TLS = n
#cjson is refered by MQTT
THIRDPARTY_CJSON_ENABLE = n
THIRDPARTY_CTCC_DM_ENABLE = n
THIRDPARTY_CUCC_DM_ENABLE = n
THIRDPARTY_CMCC_DM_ENABLE = n
THIRDPARTY_CTWING_CERTI_ENABLE = n
ifeq ($(MID_FEATURE_ENABLE), y)
THIRDPARTY_DHCPD_ENABLE = n
else ifeq ($(MORE_RAM_ENABLE), y)
THIRDPARTY_DHCPD_ENABLE = n
else ifeq ($(MORE_ROM_ENABLE), y)
THIRDPARTY_DHCPD_ENABLE = n
else
THIRDPARTY_DHCPD_ENABLE = y
endif
BUILD_PS_TCPIP_API_ENABLE = n
BUILD_AT = y
BUILD_AT_DEBUG = n
BUILD_AT_REF = y
##################################################################################################################
##Description:
##global option for RIL APIs
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT), y)
BUILD_RIL_AT_API_ENABLE = n
endif
##################################################################################################################
##Description:
##global option for Plat AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT), y)
BUILD_PLAT_CUST_AT_ENABLE = y
ifeq ($(PWR_TEST), y)
BUILD_PLAT_MEM_AT_ENABLE = y
else
BUILD_PLAT_MEM_AT_ENABLE = n
endif
BUILD_PLAT_PMU_AT_ENABLE = y
BUILD_PLAT_PER_AT_ENABLE = y
BUILD_PLAT_MISC_AT_ENABLE = y
BUILD_PLAT_PROD_AT_ENABLE = y
BUILD_PLAT_FOTA_AT_ENABLE = y
BUILD_PLAT_ECOTA_AT_ENABLE = n
BUILD_PLAT_CMUX_AT_ENABLE = n
BUILD_PLAT_HTTP_AT_ENABLE = y
BUILD_PLAT_MQTT_AT_ENABLE = n
BUILD_PLAT_SSL_AT_ENABLE = n
BUILD_PLAT_FS_AT_ENABLE = n
BUILD_PLAT_AUDIO_AT_ENABLE = n
BUILD_PLAT_ONENET_AT_ENABLE = n
BUILD_PLAT_CTLWM2M_AT_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_CUST_AT_ENABLE
##global option for Plat product related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_CUST_AT_ENABLE), y)
#AT+CGMI
BUILD_PLAT_CUST_CGMI_ENABLE = n
#AT+CGMM
BUILD_PLAT_CUST_CGMM_ENABLE = n
#AT+GMM
BUILD_PLAT_CUST_GMM_ENABLE = n
#AT+CGMR
BUILD_PLAT_CUST_CGMR_ENABLE = y
#AT+CGSN
BUILD_PLAT_CUST_CGSN_ENABLE = y
#ATI
BUILD_PLAT_CUST_ATI_ENABLE = y
#AT&W
BUILD_PLAT_CUST_ATnW_ENABLE = y
#AT&F
BUILD_PLAT_CUST_ATnF_ENABLE = n
#AT&V
BUILD_PLAT_CUST_ATnV_ENABLE = y
#AT+ECIDLEP
BUILD_PLAT_MISC_ECIDLEP_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_MEM_AT_ENABLE
##global option for Plat memory related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_MEM_AT_ENABLE), y)
#AT+ECSHOWMEM
BUILD_PLAT_MEM_ECSHOWMEM_ENABLE = y
#AT+ECHEAPINFO
BUILD_PLAT_MEM_ECHEAPINFO_ENABLE = y
#AT+ECMEM32
BUILD_PLAT_MEM_ECMEM32_ENABLE = y
#AT+ECDLFCMEM
BUILD_PLAT_MEM_ECDLFCMEM_ENABLE = y
#AT+ECFSINFO
BUILD_PLAT_MEM_ECFSINFO_ENABLE = y
#AT+RLCHK
BUILD_PLAT_MEM_RLCHK_ENABLE = y
#AT+ECFLASHMONITORINFO
BUILD_PLAT_MEM_ECFLASHMONITORINFO_ENABLE = y
endif
##################################################################################################################
##Description: BUILD_PLAT_PMU_AT_ENABLE
##global option for Plat pmu related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_PMU_AT_ENABLE), y)
#AT+ECPMUCFG
BUILD_PLAT_PMU_ECPMUCFG_ENABLE = y
#AT+ECSYSMONCFG
BUILD_PLAT_PMU_ECSYSMONCFG_ENABLE = y
#AT+ECVOTECHK
BUILD_PLAT_PMU_ECVOTECHK_ENABLE = y
#AT+ECPMUSTATUS
BUILD_PLAT_PMU_ECPMUSTATUS_ENABLE = y
#AT+ECPURC
BUILD_PLAT_PMU_ECPURC_ENABLE = y
#AT+ECSCLK
BUILD_PLAT_PMU_ECSCLK_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_PER_AT_ENABLE
##global option for Plat peripheral related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_PER_AT_ENABLE), y)
#AT+IPR
BUILD_PLAT_PER_IPR_ENABLE = y
#AT+ICF
BUILD_PLAT_PER_ICF_ENABLE = n
#AT+IFC
BUILD_PLAT_PER_IFC_ENABLE = y
#AT+ECUSBSYS
BUILD_PLAT_PER_ECUSBSYS_ENABLE = y
#AT+ECLEDMODE
BUILD_PLAT_PER_ECLEDMODE_ENABLE = n
#AT+ECPALARM
BUILD_PLAT_PER_ECPALARM_ENABLE = n
#AT+ECADC
BUILD_PLAT_PER_ECADC_ENABLE = y
endif
##################################################################################################################
##Description: BUILD_PLAT_MISC_AT_ENABLE
##global option for Plat miscellaneous AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_MISC_AT_ENABLE), y)
#AT+ECPCFG
BUILD_PLAT_MISC_ECPCFG_ENABLE = y
#AT+ECRST
BUILD_PLAT_MISC_ECRST_ENABLE = y
#AT+ECPOWD
BUILD_PLAT_MISC_ECPOWD_ENABLE = n
#AT^SYSTEST
BUILD_PLAT_MISC_SYSTEST_ENABLE = n
#AT+ECSYSTEST
BUILD_PLAT_MISC_ECSYSTEST_ENABLE = y
#AT+ECTASKINFO
BUILD_PLAT_MISC_ECTASKINFO_ENABLE = n
#AT+ECTASKHISTINFO
BUILD_PLAT_MISC_ECTASKHISTINFO_ENABLE = n
#AT+ECLOGDBVER
BUILD_PLAT_MISC_ECLOGDBVER_ENABLE = y
#AT+ECDUMPCHK
BUILD_PLAT_MISC_ECDUMPCHK_ENABLE = n
#AT+ECBTOFFSETDBG
BUILD_PLAT_MISC_ECBTOFFSETDBG_ENABLE = n
#AT+ECFUSEMR
BUILD_PLAT_MISC_ECFUSEMR_ENABLE = y
#AT+ECSIMO
BUILD_PLAT_MISC_ECSIMO_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_PROD_AT_ENABLE
##global option for Plat product related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_PROD_AT_ENABLE), y)
#AT+ECATE
BUILD_PLAT_PROD_ECATE_ENABLE = n
#AT+ECVERSION
BUILD_PLAT_PROD_ECVERSION_ENABLE = n
#AT+ECIPR
BUILD_PLAT_PROD_ECIPR_ENABLE = y
#AT+ECSLEEP
BUILD_PLAT_PROD_ECSLEEP_ENABLE = y
#AT+ECSAVEFAC
BUILD_PLAT_PROD_ECSAVEFAC_ENABLE = y
#AT+ECRFTEST
BUILD_PLAT_PROD_ECRFTEST_ENABLE = y
#AT+ECGMDATA
BUILD_PLAT_PROD_ECGMDATA_ENABLE = y
#AT+ECNPICFG
BUILD_PLAT_PROD_ECNPICFG_ENABLE = y
#AT+ECRFNST
BUILD_PLAT_PROD_ECRFNST_ENABLE = y
#AT+ECRFSTAT
BUILD_PLAT_PROD_ECRFSTAT_ENABLE = y
#AT+ECPRODMODE
BUILD_PLAT_PROD_ECPRODMODE_ENABLE = n
endif
##################################################################################################################
##Description:
##global option for PS AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT), y)
BUILD_PS_GEN_AT_ENABLE = y
BUILD_PS_DEV_AT_ENABLE = y
BUILD_PS_EMM_AT_ENABLE = y
BUILD_PS_EPS_AT_ENABLE = y
BUILD_PS_SIM_AT_ENABLE = y
ifeq ($(GCF_FEATURE_ENABLE), y)
BUILD_PS_SMS_AT_ENABLE = y
else ifeq ($(MID_FEATURE_ENABLE), y)
BUILD_PS_SMS_AT_ENABLE = y
else
BUILD_PS_SMS_AT_ENABLE = n
endif
BUILD_PHY_CONFIG_AT_ENABLE = y
BUILD_PS_TCPIP_ECSOCK_AT_ENABLE = n
BUILD_PS_TCPIP_SKTSOCK_AT_ENABLE = n
BUILD_PS_TCPIP_NETCONFIG_AT_ENABLE = y
BUILD_PS_TCPIP_IPSEC_AT_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_GEN_AT_ENABLE
##Description:
##BUILD_PS_GEN_AT_ENABLE is to control whether include ps global AT commands as: AT/ATQ/ATE/ATT/ATV/ATL/ATM/...etc
##Use method: y is support;n is not support.
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_GEN_AT_ENABLE), y)
#AT via BUILD_PS_GEN_AT_ENABLE
#ATQ
BUILD_PS_GEN_AT_Q_ENABLE = n
#ATE
BUILD_PS_GEN_AT_E_ENABLE = y
#ATT
BUILD_PS_GEN_AT_T_ENABLE = n
#ATV
BUILD_PS_GEN_AT_V_ENABLE = y
#ATL
BUILD_PS_GEN_AT_L_ENABLE = n
#ATM
BUILD_PS_GEN_AT_M_ENABLE = n
#ATS0
BUILD_PS_GEN_AT_S0_ENABLE = n
#AT&C
BUILD_PS_GEN_AT_nC_ENABLE = n
#AT&D
BUILD_PS_GEN_AT_nD_ENABLE = y
#ATD
BUILD_PS_GEN_AT_D_ENABLE = y
#ATO
BUILD_PS_GEN_AT_O_ENABLE = y
#ATH
BUILD_PS_GEN_AT_H_ENABLE = y
ifeq ($(BUILD_PS_SMS_AT_ENABLE), y)
#AT+CSCS
BUILD_PS_GEN_CSCS_ENABLE = y
else
#AT+CSCS
BUILD_PS_GEN_CSCS_ENABLE = n
endif
#AT+CMEE
BUILD_PS_GEN_CMEE_ENABLE = n
BUILD_CMEE_2_VERBOSE_ENABLE = n
#AT+ECURC
BUILD_PS_GEN_ECURC_ENABLE = y
#AT+ECURCCFG
BUILD_PS_GEN_ECURCCFG_ENABLE = n
#AT+ECPPPHUP
BUILD_PS_GEN_ECPPPHUP_ENABLE = y
#AT+CLCK
BUILD_PS_GEN_CLCK_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_DEV_AT_ENABLE
##Description:
##BUILD_PS_DEV_AT_ENABLE is to control whether include ps global AT commands as: AT+CFUN/ECBAND/ECCFG/ECSTATUS/...etc
##Use method: y is support;n is not support.
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_DEV_AT_ENABLE), y)
#AT+CFUN
BUILD_PS_DEV_CFUN_ENABLE = y
#AT+ECCGSN
BUILD_PS_DEV_ECCGSN_ENABLE = y
#AT+ECCGSNLOCK
BUILD_PS_DEV_ECCGSNLOCK_ENABLE = n
#AT+ECSTATUS
BUILD_PS_DEV_ECSTATUS_ENABLE = y
#AT+ECSTATIS
BUILD_PS_DEV_ECSTATIS_ENABLE = n
#AT+ECBAND
BUILD_PS_DEV_ECBAND_ENABLE = y
#AT+ECFREQ
BUILD_PS_DEV_ECFREQ_ENABLE = y
#AT+ECCFG
BUILD_PS_DEV_ECCFG_ENABLE = y
#AT+ECMEASCFG
BUILD_PS_DEV_ECMEASCFG_ENABLE = n
ifeq ($(GCF_FEATURE_ENABLE), y)
#AT+ECRMFPLMN
BUILD_PS_DEV_ECRMFPLMN_ENABLE = y
else
#AT+ECRMFPLMN
BUILD_PS_DEV_ECRMFPLMN_ENABLE = n
endif
#AT+ECBCINFO
BUILD_PS_DEV_ECBCINFO_ENABLE = y
#AT+ECPSTEST
BUILD_PS_DEV_ECPSTEST_ENABLE = n
#AT+ECEVENTSTATIS
BUILD_PS_DEV_ECEVENTSTATIS_ENABLE = n
#AT+ECNASTCFG
BUILD_PS_DEV_ECNASTCFG_ENABLE = y
ifeq ($(GCF_FEATURE_ENABLE), y)
#AT+ECWIFISCAN
BUILD_PS_DEV_ECWIFISCAN_ENABLE = y
else ifeq ($(MID_FEATURE_ENABLE), y)
#AT+ECWIFISCAN
BUILD_PS_DEV_ECWIFISCAN_ENABLE = y
else
#AT+ECWIFISCAN
BUILD_PS_DEV_ECWIFISCAN_ENABLE = n
endif
#AT+ECBARCELL
BUILD_PS_DEV_ECBARCELL_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PS_EMM_AT_ENABLE
##Description:
##BUILD_PS_EMM_AT_ENABLE is to control whether include ps mm AT commands as: AT+CESQ/COPS/CCIOTOPT/ECCESQS/...etc
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_EMM_AT_ENABLE), y)
#AT+CSQ
BUILD_PS_EMM_CSQ_ENABLE = y
#AT+CESQ
BUILD_PS_EMM_CESQ_ENABLE = n
#AT+CREG
BUILD_PS_EMM_CREG_ENABLE = y
#AT+COPS
BUILD_PS_EMM_COPS_ENABLE = y
#AT+CPSMS
BUILD_PS_EMM_CPSMS_ENABLE = y
#AT+CEDRXS
BUILD_PS_EMM_CEDRXS_ENABLE = n
#AT+CEDRXRDP
BUILD_PS_EMM_CEDRXRDP_ENABLE = n
#AT+CCIOTOPT
BUILD_PS_EMM_CCIOTOPT_ENABLE = y
#AT+CRCES
BUILD_PS_EMM_CRCES_ENABLE = n
#AT+CCLK
BUILD_PS_EMM_CCLK_ENABLE = y
#AT+CTZR
BUILD_PS_EMM_CTZR_ENABLE = n
#AT+CTZU
BUILD_PS_EMM_CTZU_ENABLE = n
#AT+ECPLMNS
BUILD_PS_EMM_ECPLMNS_ENABLE = n
#AT+ECCESQSn
BUILD_PS_EMM_ECCESQS_ENABLE = n
#AT+ECPSMR
BUILD_PS_EMM_ECPSMR_ENABLE = n
#AT+ECPTWEDRXS
BUILD_PS_EMM_ECPTWEDRXS_ENABLE = n
#AT+ECEMMTIME
BUILD_PS_EMM_ECEMMTIME_ENABLE = n
#AT+ECPLMNRESELECT
ifeq ($(GCF_FEATURE_ENABLE), y)
#AT+ECRMFPLMN
BUILD_PS_EMM_ECPLMNRESELECT_ENABLE = y
else
#AT+ECRMFPLMN
BUILD_PS_EMM_ECPLMNRESELECT_ENABLE = n
endif
#AT+ECCONNREL
BUILD_PS_EMM_ECCONNREL_ENABLE = n
#AT+ECMMER
BUILD_PS_EMM_ECMMER_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PS_EPS_AT_ENABLE
##Description:
##BUILD_PS_EPS_AT_ENABLE is to control whether include ESP AT commands as: AT+CGATT/CGDCONT/CGACT/CGCONTRDP/CGAUTH..etc
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_EPS_AT_ENABLE), y)
#AT+CGATT
BUILD_PS_EPS_CGATT_ENABLE = y
#AT+ECEMCATT
BUILD_PS_EPS_ECEMCATT_ENABLE = n
#AT+CGDATA
BUILD_PS_EPS_CGDATA_ENABLE = n
ifeq ($(GCF_FEATURE_ENABLE), y)
#AT+CGTFT
BUILD_PS_EPS_CGTFT_ENABLE = y
#AT+CGCMOD
BUILD_PS_EPS_CGCMOD_ENABLE = y
#AT+CGEQOS
BUILD_PS_EPS_CGEQOS_ENABLE = y
#AT+CGDSCONT
BUILD_PS_EPS_CGDSCONT_ENABLE = y
else
#AT+CGTFT
BUILD_PS_EPS_CGTFT_ENABLE = n
#AT+CGCMOD
BUILD_PS_EPS_CGCMOD_ENABLE = n
#AT+CGEQOS
BUILD_PS_EPS_CGEQOS_ENABLE = n
#AT+CGDSCONT
BUILD_PS_EPS_CGDSCONT_ENABLE = n
endif
#AT+CEMODE
BUILD_PS_EPS_CEMODE_ENABLE = y
#AT+CGDCONT
BUILD_PS_EPS_CGDCONT_ENABLE = y
#AT+CGACT
BUILD_PS_EPS_CGACT_ENABLE = y
#AT+CGEQOSRDP
BUILD_PS_EPS_CGEQOSRDP_ENABLE = n
#AT+CGCONTRDP
BUILD_PS_EPS_CGCONTRDP_ENABLE = n
#AT+CGSCONTRDP
BUILD_PS_EPS_CGSCONTRDP_ENABLE = n
#AT+CGTFTRDP
BUILD_PS_EPS_CGTFTRDP_ENABLE = n
#AT+CEREG
BUILD_PS_EPS_CEREG_ENABLE = y
#AT+CSCON
BUILD_PS_EPS_CSCON_ENABLE = n
#AT+CSODCP
BUILD_PS_EPS_CSODCP_ENABLE = n
#AT+CRTDCP
BUILD_PS_EPS_CRTDCP_ENABLE = n
#AT+CGAUTH
BUILD_PS_EPS_CGAUTH_ENABLE = n
#AT+CIPCA
BUILD_PS_EPS_CIPCA_ENABLE = n
#AT+CGAPNRC
BUILD_PS_EPS_CGAPNRC_ENABLE = n
#AT+CGEREP
BUILD_PS_EPS_CGEREP_ENABLE = n
#AT+CGPADDR
BUILD_PS_EPS_CGPADDR_ENABLE = y
#AT+CEER
BUILD_PS_EPS_CEER_ENABLE = n
#AT+CEVDP
BUILD_PS_EPS_CEVDP_ENABLE = n
#AT+CPSDO
BUILD_PS_EPS_CPSDO_ENABLE = n
#AT+ECCIOTPLANE
BUILD_PS_EPS_ECCIOTPLANE_ENABLE = n
#AT+ECSENDDATA
BUILD_PS_EPS_ECSENDDATA_ENABLE = n
#AT+ECGDCNT
BUILD_PS_EPS_ECGDCNT_ENABLE = n
#AT+ECAUGDCNT
BUILD_PS_EPS_ECAUGDCNT_ENABLE = n
#AT+ECSCLKEX
BUILD_PS_EPS_ECSCLKEX_ENABLE = n
#AT+ECSMER
BUILD_PS_EPS_ECSMER_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PS_SIM_AT_ENABLE
##Description:
##BUILD_PS_SIM_AT_ENABLE is to control whether include SIM AT commands as: AT+CIMI/CPIN/ECICCID/ECSIMCFG..etc
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_SIM_AT_ENABLE), y)
#AT+CIMI
BUILD_PS_SIM_AT_CIMI_ENABLE = y
#AT+CPIN
BUILD_PS_SIM_AT_CPIN_ENABLE = y
#AT+ECICCID
BUILD_PS_SIM_AT_ECICCID_ENABLE = y
#AT+ECSIMCFG
BUILD_PS_SIM_AT_ECSIMCFG_ENABLE = y
#AT+CPWD
BUILD_PS_SIM_AT_CPWD_ENABLE = n
#AT+CPINR
BUILD_PS_SIM_AT_CPINR_ENABLE = n
#AT+ECSIMSLEEP
BUILD_PS_SIM_AT_ECSIMSLEEP_ENABLE = n
#AT+CSIM
BUILD_PS_SIM_AT_CSIM_ENABLE = n
#AT+CRSM
BUILD_PS_SIM_AT_CRSM_ENABLE = n
#AT+CCHO
BUILD_PS_SIM_AT_CCHO_ENABLE = n
#AT+CGLA
BUILD_PS_SIM_AT_CGLA_ENABLE = n
#AT+CCHC
BUILD_PS_SIM_AT_CCHC_ENABLE = n
#AT+ECSWC
BUILD_PS_SIM_AT_ECSWC_ENABLE = n
ifeq ($(GCF_FEATURE_ENABLE), y)
#AT+ECSIMRM
BUILD_PS_SIM_AT_ECSIMRM_ENABLE = y
else
#AT+ECSIMRM
BUILD_PS_SIM_AT_ECSIMRM_ENABLE = n
endif
#AT+CNUM
BUILD_PS_SIM_AT_CNUM_ENABLE = n
#AT+ECUSATP
BUILD_PS_SIM_AT_ECUSATP_ENABLE = n
#AT+CPOL
BUILD_PS_SIM_AT_CPOL_ENABLE = n
#AT+CPLS
BUILD_PS_SIM_AT_CPLS_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_SMS_AT_ENABLE
##Description:
##BUILD_PS_SMS_AT_ENABLE is to control whether include ps SMS AT commands as: AT+CMGS/CMGR/CMGW/CNMI/...etc
##Use method: y is support; n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_SMS_AT_ENABLE), y)
#AT+CMGS
BUILD_PS_SMS_CMGS_ENABLE = y
#AT+CMGC
BUILD_PS_SMS_CMGC_ENABLE = n
#AT+CMGR
BUILD_PS_SMS_CMGR_ENABLE = y
#AT+CMGW
BUILD_PS_SMS_CMGW_ENABLE = y
#AT+CSCA
BUILD_PS_SMS_CSCA_ENABLE = y
#AT+CNMI
BUILD_PS_SMS_CNMI_ENABLE = y
#AT+CMMS
BUILD_PS_SMS_CMMS_ENABLE = y
#AT+CMGD
BUILD_PS_SMS_CMGD_ENABLE = y
#AT+CMGL
BUILD_PS_SMS_CMGL_ENABLE = n
#AT+CSMS
BUILD_PS_SMS_CSMS_ENABLE = y
#AT+CPMS
BUILD_PS_SMS_CPMS_ENABLE = y
#AT+CNMA
BUILD_PS_SMS_CNMA_ENABLE = n
#AT+CMGF
BUILD_PS_SMS_CMGF_ENABLE = y
#AT+CSMP
BUILD_PS_SMS_CSMP_ENABLE = y
#AT+CSCB
BUILD_PS_SMS_CSCB_ENABLE = n
#AT+CSDH
BUILD_PS_SMS_CSDH_ENABLE = n
#AT+CMSS
BUILD_PS_SMS_CMSS_ENABLE = y
#AT+ECSMSSEND
BUILD_PS_SMS_ECSMSSEND_ENABLE = n
#AT+ECCMGS
BUILD_PS_SMS_ECCMGS_ENABLE = n
#AT+ECCMGR
BUILD_PS_SMS_ECCMGR_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PHY_CONFIG_AT_ENABLE
##Description:
##BUILD_PHY_CONFIG_AT_ENABLE is to control whether include PHY CONFIG AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PHY_CONFIG_AT_ENABLE), y)
#AT+ECPHYCFG
BUILD_PHY_CONFIG_ECPHYCFG_ENABLE = y
#AT+ECEDRXSIMU
BUILD_PHY_CONFIG_ECEDRXSIMU_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_TCPIP_ECSOCK_AT_ENABLE
##Description:
##BUILD_PS_TCPIP_ECSOCK_AT_ENABLE is to control whether include TCPIP EC SOCKET AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_TCPIP_ECSOCK_AT_ENABLE), y)
# do nothing here
endif
##################################################################################################################
##name :BUILD_PS_TCPIP_SKTSOCK_AT_ENABLE
##Description:
##BUILD_PS_TCPIP_ECSOCK_AT_ENABLE is to control whether include TCPIP SKT SOCKET AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_TCPIP_SKTSOCK_AT_ENABLE), y)
# do nothing here
endif
##################################################################################################################
##name :BUILD_PS_TCPIP_API_ENABLE
##Description:
##BUILD_PS_TCPIP_API_ENABLE is to control whether include EC TCPIP API
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_TCPIP_API_ENABLE), y)
# do nothing here
endif
##################################################################################################################
##name :BUILD_AT_REF
##Description:
##BUILD_AT_REF is to control whether include REF AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT_REF), y)
#define QI sockets command AT+QIOPEN/QICLOSE/QIRD/QISDE/QIGETERROR/QISTATE/QISEND/QISENDEX/QISWTMD
ifeq ($(MORE_ROM_ENABLE), y)
BUILD_PS_REF_TCPIP_QSOCK_AT_ENABLE = n
else
BUILD_PS_REF_TCPIP_QSOCK_AT_ENABLE = y
endif
#define QNETCONIG command AT+QIDNSCFG/QIDNSGIP/QNETDEVCTL
BUILD_PS_REF_TCPIP_QNETCONFIG_AT_ENABLE = n
#define QPING command AT+QPING
BUILD_PS_REF_TCPIP_QPING_SERVICE_ENABLE = n
#define QNTP command AT+QNTP
BUILD_PS_REF_TCPIP_QSNTP_SERVICE_ENABLE = n
#define QI socket command: AT+QCCID/QENG/QCELL/QWIFISCAN/QPOWD/QSPN/QIACT/QIDEACT/QIREGAPP/QICSGP/QGDCNT/QAUGDCNT
BUILD_PS_REF_EPS_AT_ENABLE = n
#define QI socket command: AT+QICFG/QCFG
BUILD_PS_REF_COMMON_AT_ENABLE = y
endif
#<<<'OPENCPU_MODE_ENABLE' ENDDING...
endif

View File

@ -0,0 +1,736 @@
#BIN_COMPRESS for post bin compress tool
#THIRDPARTY_LZMA_ENABLE LZMA feature compile en
#RAMCODE_COMPRESS_EN ramcode/RW decompress, used in code
#REL_COMPRESS_EN calibration back up compress en, used in code
CFLAGS_DEFS += -DRAMCODE_COMPRESS_EN
CFLAGS_DEFS += -DREL_COMPRESS_EN
THIRDPARTY_LZMA_ENABLE = y
BIN_COMPRESS = y
DRIVER_CPFLASH_ENABLE = n
DRIVER_VPU_ENABLE = n
DRIVER_EEPROM_ENABLE = n
DRIVER_SPI_ENABLE = n
DRIVER_I2C_ENABLE = n
DRIVER_PSRAM_ENABLE = y
DRIVER_PCACHE_ENABLE = y
DRIVER_EXSTORAGE_ENABLE = n
#DRIVER_LPUART_ENABLE = n
DRIVER_ONEWIRE_ENABLE = n
THIRDPARTY_PING_ENABLE = y
THIRDPARTY_YRCOMPRESS_ENABLE = y
MIDDLEWARE_USB_CCID_ENABLE = n
MIDDLEWARE_FOTAPAR_ENABLE = y
BUILD_EC_MW = n
AT_EXAMPLE_ENABLE = n
#should always enable, default compiled in lib
DRIVER_ACVOICE_ENG_ENABLE = y
#Exception Flash Dump enable, default enable
EXCEPTION_FLASH_DUMP_ENABLE = y
ifneq ($(OPENCPU_MODE_ENABLE), y)
THIRDPARTY_IPERF_ENABLE = y
THIRDPARTY_LIBSNTP_ENABLE = y
THIRDPARTY_HTTPC_ENABLE = y
MBEDTLS_WITH_HTTP_TLS = y
THIRDPARTY_MQTT_ENABLE = y
MBEDTLS_WITH_MQTT_TLS = n
#cjson is refered by MQTT
THIRDPARTY_CJSON_ENABLE = y
THIRDPARTY_CTCC_DM_ENABLE = n
THIRDPARTY_CUCC_DM_ENABLE = n
THIRDPARTY_CMCC_DM_ENABLE = n
THIRDPARTY_CTWING_CERTI_ENABLE = n
BUILD_PS_TCPIP_API_ENABLE = y
BUILD_AT = y
BUILD_AT_DEBUG = y
BUILD_AT_REF = y
else
#>>>'OPENCPU_MODE_ENABLE' STARTING...
ifeq ($(IMS_MODE_ENABLE), y)
BUILD_IMS = y
BUILD_PS_ROHC_ENABLE = y
THIRDPARTY_CJSON_ENABLE = y
endif
ifeq ($(IMS_SMSONLY_MODE_ENABLE), y)
BUILD_IMS = y
THIRDPARTY_CJSON_ENABLE = y
endif
ifeq ($(AUDIO_MODE_ENABLE), y)
MIDDLEWARE_AMR_ENABLE = y
MIDDLEWARE_VEM_ENABLE = y
DRIVER_VEM_CFG_ENABLE = y
DRIVER_I2C_ENABLE = y
DRIVER_CODEC_ENABLE = y
DRIVER_CODEC8311_ENABLE = y
DRIVER_CODEC8374_ENABLE = y
DRIVER_AUDIO_EX_STORGE_ENABLE = y
ifeq ($(DRIVER_AUDIO_EX_STORGE_ENABLE), y)
DRIVER_AUDIO_EX_SDCARD_ENABLE = y
DRIVER_AUDIO_EX_FLASH_ENABLE = y
CFLAGS += -DFEATURE_AUDIO_EX_STORAGE_ENABLE
endif
BUILD_SUPPORT_APP_PCM_MEM_POOL = n
endif
THIRDPARTY_PPP_ENABLE = n
THIRDPARTY_IPERF_ENABLE = n
THIRDPARTY_LIBSNTP_ENABLE = y
THIRDPARTY_MBEDTLS_ENABLE = n
THIRDPARTY_HTTPC_ENABLE = n
MBEDTLS_WITH_HTTP_TLS = n
THIRDPARTY_MQTT_ENABLE = n
MBEDTLS_WITH_MQTT_TLS = n
#cjson is refered by MQTT, cjson defult value: n, as IMS also need it, here remove it
#THIRDPARTY_CJSON_ENABLE = n
THIRDPARTY_CTCC_DM_ENABLE = n
THIRDPARTY_CUCC_DM_ENABLE = n
THIRDPARTY_CMCC_DM_ENABLE = n
THIRDPARTY_CTWING_CERTI_ENABLE = n
BUILD_PS_TCPIP_API_ENABLE = n
BUILD_AT = y
BUILD_AT_DEBUG = n
BUILD_AT_REF = y
##################################################################################################################
##Description:
##global option for RIL APIs
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT), y)
BUILD_RIL_AT_API_ENABLE = n
endif
##################################################################################################################
##Description:
##global option for Plat AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT), y)
BUILD_PLAT_CUST_AT_ENABLE = y
ifeq ($(PWR_TEST), y)
BUILD_PLAT_MEM_AT_ENABLE = y
else
BUILD_PLAT_MEM_AT_ENABLE = n
endif
BUILD_PLAT_PMU_AT_ENABLE = y
BUILD_PLAT_PER_AT_ENABLE = y
BUILD_PLAT_MISC_AT_ENABLE = y
ifeq ($(IMS_MODE_ENABLE), y)
BUILD_PLAT_PROD_AT_ENABLE = y
else ifeq ($(IMS_SMSONLY_MODE_ENABLE), y)
BUILD_PLAT_PROD_AT_ENABLE = y
else ifeq ($(AUDIO_MODE_ENABLE), y)
BUILD_PLAT_PROD_AT_ENABLE = y
else
BUILD_PLAT_PROD_AT_ENABLE = n
endif
BUILD_PLAT_FOTA_AT_ENABLE = y
BUILD_PLAT_ECOTA_AT_ENABLE = n
BUILD_PLAT_CMUX_AT_ENABLE = n
BUILD_PLAT_HTTP_AT_ENABLE = n
BUILD_PLAT_MQTT_AT_ENABLE = n
BUILD_PLAT_SSL_AT_ENABLE = n
BUILD_PLAT_FS_AT_ENABLE = n
ifeq ($(AUDIO_MODE_ENABLE), y)
BUILD_PLAT_AUDIO_AT_ENABLE = y
else
BUILD_PLAT_AUDIO_AT_ENABLE = n
endif
BUILD_PLAT_ONENET_AT_ENABLE = n
BUILD_PLAT_CTLWM2M_AT_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_AUDIO_AT_ENABLE
##global option for Plat audio related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_AUDIO_AT_ENABLE), y)
#AT+ADCFG
BUILD_PLAT_AUDIO_ECADCFG_ENABLE = y
BUILD_FIXED_AUDIO_SOURCE_ENABLE = y
endif
##################################################################################################################
##Description: BUILD_PLAT_CUST_AT_ENABLE
##global option for Plat product related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_CUST_AT_ENABLE), y)
#AT+CGMI
BUILD_PLAT_CUST_CGMI_ENABLE = y
#AT+CGMM
BUILD_PLAT_CUST_CGMM_ENABLE = y
#AT+GMM
BUILD_PLAT_CUST_GMM_ENABLE = y
#AT+CGMR
BUILD_PLAT_CUST_CGMR_ENABLE = y
#AT+CGSN
BUILD_PLAT_CUST_CGSN_ENABLE = y
#ATI
BUILD_PLAT_CUST_ATI_ENABLE = y
#AT&W
BUILD_PLAT_CUST_ATnW_ENABLE = y
#AT&F
BUILD_PLAT_CUST_ATnF_ENABLE = y
#AT&V
BUILD_PLAT_CUST_ATnV_ENABLE = y
endif
##################################################################################################################
##Description: BUILD_PLAT_MEM_AT_ENABLE
##global option for Plat memory related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_MEM_AT_ENABLE), y)
#AT+ECSHOWMEM
BUILD_PLAT_MEM_ECSHOWMEM_ENABLE = y
#AT+ECHEAPINFO
BUILD_PLAT_MEM_ECHEAPINFO_ENABLE = y
#AT+ECMEM32
BUILD_PLAT_MEM_ECMEM32_ENABLE = y
#AT+ECDLFCMEM
BUILD_PLAT_MEM_ECDLFCMEM_ENABLE = y
#AT+ECFSINFO
BUILD_PLAT_MEM_ECFSINFO_ENABLE = y
#AT+RLCHK
BUILD_PLAT_MEM_RLCHK_ENABLE = y
#AT+ECFLASHMONITORINFO
BUILD_PLAT_MEM_ECFLASHMONITORINFO_ENABLE = y
endif
##################################################################################################################
##Description: BUILD_PLAT_PMU_AT_ENABLE
##global option for Plat pmu related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_PMU_AT_ENABLE), y)
#AT+ECPMUCFG
BUILD_PLAT_PMU_ECPMUCFG_ENABLE = y
#AT+ECSYSMONCFG
BUILD_PLAT_PMU_ECSYSMONCFG_ENABLE = y
#AT+ECVOTECHK
BUILD_PLAT_PMU_ECVOTECHK_ENABLE = y
#AT+ECPMUSTATUS
BUILD_PLAT_PMU_ECPMUSTATUS_ENABLE = n
#AT+ECPURC
BUILD_PLAT_PMU_ECPURC_ENABLE = y
#AT+ECSCLK
BUILD_PLAT_PMU_ECSCLK_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_PER_AT_ENABLE
##global option for Plat peripheral related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_PER_AT_ENABLE), y)
#AT+IPR
BUILD_PLAT_PER_IPR_ENABLE = y
#AT+ICF
BUILD_PLAT_PER_ICF_ENABLE = n
#AT+IFC
BUILD_PLAT_PER_IFC_ENABLE = n
#AT+ECUSBSYS
BUILD_PLAT_PER_ECUSBSYS_ENABLE = n
#AT+ECLEDMODE
BUILD_PLAT_PER_ECLEDMODE_ENABLE = n
#AT+ECPALARM
BUILD_PLAT_PER_ECPALARM_ENABLE = n
#AT+ECADC
BUILD_PLAT_PER_ECADC_ENABLE = n
endif
##################################################################################################################
##Description: BUILD_PLAT_MISC_AT_ENABLE
##global option for Plat miscellaneous AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_MISC_AT_ENABLE), y)
#AT+ECPCFG
BUILD_PLAT_MISC_ECPCFG_ENABLE = y
#AT+ECRST
BUILD_PLAT_MISC_ECRST_ENABLE = y
#AT+ECPOWD
BUILD_PLAT_MISC_ECPOWD_ENABLE = n
#AT^SYSTEST
BUILD_PLAT_MISC_SYSTEST_ENABLE = n
#AT+ECSYSTEST
BUILD_PLAT_MISC_ECSYSTEST_ENABLE = n
#AT+ECTASKINFO
BUILD_PLAT_MISC_ECTASKINFO_ENABLE = n
#AT+ECTASKHISTINFO
BUILD_PLAT_MISC_ECTASKHISTINFO_ENABLE = n
#AT+ECLOGDBVER
BUILD_PLAT_MISC_ECLOGDBVER_ENABLE = n
#AT+ECDUMPCHK
BUILD_PLAT_MISC_ECDUMPCHK_ENABLE = n
#AT+ECBTOFFSETDBG
BUILD_PLAT_MISC_ECBTOFFSETDBG_ENABLE = n
#AT+ECFUSEMR
BUILD_PLAT_MISC_ECFUSEMR_ENABLE = n
#AT+ECSIMO
BUILD_PLAT_MISC_ECSIMO_ENABLE = n
#AT+ECIDLEP
BUILD_PLAT_MISC_ECIDLEP_ENABLE = y
endif
##################################################################################################################
##Description: BUILD_PLAT_PROD_AT_ENABLE
##global option for Plat product related AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PLAT_PROD_AT_ENABLE), y)
#AT+ECATE
BUILD_PLAT_PROD_ECATE_ENABLE = y
#AT+ECVERSION
BUILD_PLAT_PROD_ECVERSION_ENABLE = y
#AT+ECIPR
BUILD_PLAT_PROD_ECIPR_ENABLE = y
#AT+ECSLEEP
BUILD_PLAT_PROD_ECSLEEP_ENABLE = y
#AT+ECSAVEFAC
BUILD_PLAT_PROD_ECSAVEFAC_ENABLE = y
#AT+ECRFTEST
BUILD_PLAT_PROD_ECRFTEST_ENABLE = y
#AT+ECGMDATA
BUILD_PLAT_PROD_ECGMDATA_ENABLE = y
#AT+ECNPICFG
BUILD_PLAT_PROD_ECNPICFG_ENABLE = y
#AT+ECRFNST
BUILD_PLAT_PROD_ECRFNST_ENABLE = y
#AT+ECRFSTAT
BUILD_PLAT_PROD_ECRFSTAT_ENABLE = y
#AT+ECPRODMODE
BUILD_PLAT_PROD_ECPRODMODE_ENABLE = y
endif
##################################################################################################################
##Description:
##global option for PS AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT), y)
BUILD_PS_GEN_AT_ENABLE = y
BUILD_PS_DEV_AT_ENABLE = y
BUILD_PS_EMM_AT_ENABLE = y
BUILD_PS_EPS_AT_ENABLE = y
BUILD_PS_SIM_AT_ENABLE = y
BUILD_PS_SMS_AT_ENABLE = y
BUILD_PHY_CONFIG_AT_ENABLE = y
BUILD_PS_TCPIP_ECSOCK_AT_ENABLE = n
BUILD_PS_TCPIP_SKTSOCK_AT_ENABLE = n
BUILD_PS_TCPIP_NETCONFIG_AT_ENABLE = y
BUILD_PS_TCPIP_IPSEC_AT_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_GEN_AT_ENABLE
##Description:
##BUILD_PS_GEN_AT_ENABLE is to control whether include ps global AT commands as: AT/ATQ/ATE/ATT/ATV/ATL/ATM/...etc
##Use method: y is support;n is not support.
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_GEN_AT_ENABLE), y)
#AT via BUILD_PS_GEN_AT_ENABLE
#ATQ
BUILD_PS_GEN_AT_Q_ENABLE = n
#ATE
BUILD_PS_GEN_AT_E_ENABLE = y
#ATT
BUILD_PS_GEN_AT_T_ENABLE = n
#ATV
BUILD_PS_GEN_AT_V_ENABLE = y
#ATL
BUILD_PS_GEN_AT_L_ENABLE = n
#ATM
BUILD_PS_GEN_AT_M_ENABLE = n
#ATS0
BUILD_PS_GEN_AT_S0_ENABLE = n
#AT&C
BUILD_PS_GEN_AT_nC_ENABLE = n
#AT&D
BUILD_PS_GEN_AT_nD_ENABLE = y
#ATD
BUILD_PS_GEN_AT_D_ENABLE = y
#ATO
BUILD_PS_GEN_AT_O_ENABLE = y
#ATH
BUILD_PS_GEN_AT_H_ENABLE = y
#ATA
BUILD_PS_GEN_AT_A_ENABLE = y
#AT+CSCS
BUILD_PS_GEN_CSCS_ENABLE = y
#AT+CMEE
BUILD_PS_GEN_CMEE_ENABLE = n
#AT+ECURC
BUILD_PS_GEN_ECURC_ENABLE = y
#AT+ECURCCFG
BUILD_PS_GEN_ECURCCFG_ENABLE = n
#AT+ECPPPHUP
BUILD_PS_GEN_ECPPPHUP_ENABLE = y
#AT+CLCK
BUILD_PS_GEN_CLCK_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_DEV_AT_ENABLE
##Description:
##BUILD_PS_DEV_AT_ENABLE is to control whether include ps global AT commands as: AT+CFUN/ECBAND/ECCFG/ECSTATUS/...etc
##Use method: y is support;n is not support.
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_DEV_AT_ENABLE), y)
#AT+CFUN
BUILD_PS_DEV_CFUN_ENABLE = y
#AT+ECCGSN
BUILD_PS_DEV_ECCGSN_ENABLE = y
#AT+ECCGSNLOCK
BUILD_PS_DEV_ECCGSNLOCK_ENABLE = n
#AT+ECSTATUS
BUILD_PS_DEV_ECSTATUS_ENABLE = y
#AT+ECSTATIS
BUILD_PS_DEV_ECSTATIS_ENABLE = n
#AT+ECBAND
BUILD_PS_DEV_ECBAND_ENABLE = y
#AT+ECFREQ
BUILD_PS_DEV_ECFREQ_ENABLE = y
#AT+ECCFG
BUILD_PS_DEV_ECCFG_ENABLE = y
#AT+ECMEASCFG
BUILD_PS_DEV_ECMEASCFG_ENABLE = n
#AT+ECRMFPLMN
BUILD_PS_DEV_ECRMFPLMN_ENABLE = y
#AT+ECBCINFO
BUILD_PS_DEV_ECBCINFO_ENABLE = y
#AT+ECPSTEST
BUILD_PS_DEV_ECPSTEST_ENABLE = n
#AT+ECEVENTSTATIS
BUILD_PS_DEV_ECEVENTSTATIS_ENABLE = n
#AT+ECNASTCFG
BUILD_PS_DEV_ECNASTCFG_ENABLE = y
#AT+ECWIFISCAN
BUILD_PS_DEV_ECWIFISCAN_ENABLE = n
#AT+ECBARCELL
BUILD_PS_DEV_ECBARCELL_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PS_EMM_AT_ENABLE
##Description:
##BUILD_PS_EMM_AT_ENABLE is to control whether include ps mm AT commands as: AT+CESQ/COPS/CCIOTOPT/ECCESQS/...etc
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_EMM_AT_ENABLE), y)
#AT+CSQ
BUILD_PS_EMM_CSQ_ENABLE = y
#AT+CESQ
BUILD_PS_EMM_CESQ_ENABLE = n
#AT+CREG
BUILD_PS_EMM_CREG_ENABLE = y
#AT+COPS
BUILD_PS_EMM_COPS_ENABLE = y
#AT+CPSMS
BUILD_PS_EMM_CPSMS_ENABLE = y
#AT+CEDRXS
BUILD_PS_EMM_CEDRXS_ENABLE = n
#AT+CEDRXRDP
BUILD_PS_EMM_CEDRXRDP_ENABLE = n
#AT+CCIOTOPT
BUILD_PS_EMM_CCIOTOPT_ENABLE = y
#AT+CRCES
BUILD_PS_EMM_CRCES_ENABLE = n
#AT+CCLK
BUILD_PS_EMM_CCLK_ENABLE = y
#AT+CTZR
BUILD_PS_EMM_CTZR_ENABLE = n
#AT+CTZU
BUILD_PS_EMM_CTZU_ENABLE = n
#AT+ECPLMNS
BUILD_PS_EMM_ECPLMNS_ENABLE = n
#AT+ECCESQSn
BUILD_PS_EMM_ECCESQS_ENABLE = n
#AT+ECPSMR
BUILD_PS_EMM_ECPSMR_ENABLE = n
#AT+ECPTWEDRXS
BUILD_PS_EMM_ECPTWEDRXS_ENABLE = n
#AT+ECEMMTIME
BUILD_PS_EMM_ECEMMTIME_ENABLE = n
#AT+ECPLMNRESELECT
BUILD_PS_EMM_ECPLMNRESELECT_ENABLE = n
#AT+ECCONNREL
BUILD_PS_EMM_ECCONNREL_ENABLE = n
#AT+ECMMER
BUILD_PS_EMM_ECMMER_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PS_EPS_AT_ENABLE
##Description:
##BUILD_PS_EPS_AT_ENABLE is to control whether include ESP AT commands as: AT+CGATT/CGDCONT/CGACT/CGCONTRDP/CGAUTH..etc
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_EPS_AT_ENABLE), y)
#AT+CGATT
BUILD_PS_EPS_CGATT_ENABLE = y
#AT+ECEMCATT
BUILD_PS_EPS_ECEMCATT_ENABLE = n
#AT+CGDATA
BUILD_PS_EPS_CGDATA_ENABLE = n
#AT+CGTFT
BUILD_PS_EPS_CGTFT_ENABLE = n
#AT+CGCMOD
BUILD_PS_EPS_CGCMOD_ENABLE = n
#AT+CGEQOS
BUILD_PS_EPS_CGEQOS_ENABLE = n
#AT+CGDSCONT
BUILD_PS_EPS_CGDSCONT_ENABLE = n
#AT+CEMODE
BUILD_PS_EPS_CEMODE_ENABLE = y
#AT+CGDCONT
BUILD_PS_EPS_CGDCONT_ENABLE = y
#AT+CGACT
BUILD_PS_EPS_CGACT_ENABLE = y
#AT+CGEQOSRDP
BUILD_PS_EPS_CGEQOSRDP_ENABLE = n
#AT+CGCONTRDP
BUILD_PS_EPS_CGCONTRDP_ENABLE = n
#AT+CGSCONTRDP
BUILD_PS_EPS_CGSCONTRDP_ENABLE = n
#AT+CGTFTRDP
BUILD_PS_EPS_CGTFTRDP_ENABLE = n
#AT+CEREG
BUILD_PS_EPS_CEREG_ENABLE = y
#AT+CSCON
BUILD_PS_EPS_CSCON_ENABLE = n
#AT+CSODCP
BUILD_PS_EPS_CSODCP_ENABLE = n
#AT+CRTDCP
BUILD_PS_EPS_CRTDCP_ENABLE = n
#AT+CGAUTH
BUILD_PS_EPS_CGAUTH_ENABLE = n
#AT+CIPCA
BUILD_PS_EPS_CIPCA_ENABLE = n
#AT+CGAPNRC
BUILD_PS_EPS_CGAPNRC_ENABLE = n
#AT+CGEREP
BUILD_PS_EPS_CGEREP_ENABLE = n
#AT+CGPADDR
BUILD_PS_EPS_CGPADDR_ENABLE = y
#AT+CEER
BUILD_PS_EPS_CEER_ENABLE = n
#AT+CEVDP
BUILD_PS_EPS_CEVDP_ENABLE = n
#AT+CPSDO
BUILD_PS_EPS_CPSDO_ENABLE = n
#AT+ECCIOTPLANE
BUILD_PS_EPS_ECCIOTPLANE_ENABLE = n
#AT+ECSENDDATA
BUILD_PS_EPS_ECSENDDATA_ENABLE = n
#AT+ECGDCNT
BUILD_PS_EPS_ECGDCNT_ENABLE = n
#AT+ECAUGDCNT
BUILD_PS_EPS_ECAUGDCNT_ENABLE = n
#AT+ECSCLKEX
BUILD_PS_EPS_ECSCLKEX_ENABLE = n
#AT+ECSMER
BUILD_PS_EPS_ECSMER_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PS_SIM_AT_ENABLE
##Description:
##BUILD_PS_SIM_AT_ENABLE is to control whether include SIM AT commands as: AT+CIMI/CPIN/ECICCID/ECSIMCFG..etc
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_SIM_AT_ENABLE), y)
#AT+CIMI
BUILD_PS_SIM_AT_CIMI_ENABLE = y
#AT+CPIN
BUILD_PS_SIM_AT_CPIN_ENABLE = y
#AT+ECICCID
BUILD_PS_SIM_AT_ECICCID_ENABLE = y
#AT+ECSIMCFG
BUILD_PS_SIM_AT_ECSIMCFG_ENABLE = y
#AT+CPWD
BUILD_PS_SIM_AT_CPWD_ENABLE = n
#AT+CPINR
BUILD_PS_SIM_AT_CPINR_ENABLE = n
#AT+ECSIMSLEEP
BUILD_PS_SIM_AT_ECSIMSLEEP_ENABLE = n
#AT+CSIM
BUILD_PS_SIM_AT_CSIM_ENABLE = n
#AT+CRSM
BUILD_PS_SIM_AT_CRSM_ENABLE = n
#AT+CCHO
BUILD_PS_SIM_AT_CCHO_ENABLE = n
#AT+CGLA
BUILD_PS_SIM_AT_CGLA_ENABLE = n
#AT+CCHC
BUILD_PS_SIM_AT_CCHC_ENABLE = n
#AT+ECSWC
BUILD_PS_SIM_AT_ECSWC_ENABLE = n
#AT+ECSIMRM
BUILD_PS_SIM_AT_ECSIMRM_ENABLE = y
#AT+CNUM
BUILD_PS_SIM_AT_CNUM_ENABLE = n
#AT+ECUSATP
BUILD_PS_SIM_AT_ECUSATP_ENABLE = n
#AT+CPOL
BUILD_PS_SIM_AT_CPOL_ENABLE = n
#AT+CPLS
BUILD_PS_SIM_AT_CPLS_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_SMS_AT_ENABLE
##Description:
##BUILD_PS_SMS_AT_ENABLE is to control whether include ps SMS AT commands as: AT+CMGS/CMGR/CMGW/CNMI/...etc
##Use method: y is support; n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_SMS_AT_ENABLE), y)
#AT+CMGS
BUILD_PS_SMS_CMGS_ENABLE = y
#AT+CMGC
BUILD_PS_SMS_CMGC_ENABLE = n
#AT+CMGR
BUILD_PS_SMS_CMGR_ENABLE = y
#AT+CMGW
BUILD_PS_SMS_CMGW_ENABLE = y
#AT+CSCA
BUILD_PS_SMS_CSCA_ENABLE = y
#AT+CNMI
BUILD_PS_SMS_CNMI_ENABLE = y
#AT+CMMS
BUILD_PS_SMS_CMMS_ENABLE = y
#AT+CMGD
BUILD_PS_SMS_CMGD_ENABLE = y
#AT+CMGL
BUILD_PS_SMS_CMGL_ENABLE = y
#AT+CSMS
BUILD_PS_SMS_CSMS_ENABLE = y
#AT+CPMS
BUILD_PS_SMS_CPMS_ENABLE = y
#AT+CNMA
BUILD_PS_SMS_CNMA_ENABLE = y
#AT+CMGF
BUILD_PS_SMS_CMGF_ENABLE = y
#AT+CSMP
BUILD_PS_SMS_CSMP_ENABLE = y
#AT+CSCB
BUILD_PS_SMS_CSCB_ENABLE = y
#AT+CSDH
BUILD_PS_SMS_CSDH_ENABLE = y
#AT+CMSS
BUILD_PS_SMS_CMSS_ENABLE = y
#AT+ECSMSSEND
BUILD_PS_SMS_ECSMSSEND_ENABLE = y
#AT+ECCMGS
BUILD_PS_SMS_ECCMGS_ENABLE = y
#AT+ECCMGR
BUILD_PS_SMS_ECCMGR_ENABLE = y
endif
##################################################################################################################
##name :BUILD_PHY_CONFIG_AT_ENABLE
##Description:
##BUILD_PHY_CONFIG_AT_ENABLE is to control whether include PHY CONFIG AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PHY_CONFIG_AT_ENABLE), y)
#AT+ECPHYCFG
BUILD_PHY_CONFIG_ECPHYCFG_ENABLE = y
#AT+ECEDRXSIMU
BUILD_PHY_CONFIG_ECEDRXSIMU_ENABLE = n
endif
##################################################################################################################
##name :BUILD_PS_TCPIP_ECSOCK_AT_ENABLE
##Description:
##BUILD_PS_TCPIP_ECSOCK_AT_ENABLE is to control whether include TCPIP EC SOCKET AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_TCPIP_ECSOCK_AT_ENABLE), y)
# do nothing here
endif
##################################################################################################################
##name :BUILD_PS_TCPIP_SKTSOCK_AT_ENABLE
##Description:
##BUILD_PS_TCPIP_ECSOCK_AT_ENABLE is to control whether include TCPIP SKT SOCKET AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_TCPIP_SKTSOCK_AT_ENABLE), y)
# do nothing here
endif
##################################################################################################################
##name :BUILD_PS_TCPIP_API_ENABLE
##Description:
##BUILD_PS_TCPIP_API_ENABLE is to control whether include EC TCPIP API
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_PS_TCPIP_API_ENABLE), y)
# do nothing here
endif
##################################################################################################################
##name :BUILD_AT_REF
##Description:
##BUILD_AT_REF is to control whether include REF AT commands
##Use method: y is support;n is not support
##default value is y to support
##################################################################################################################
ifeq ($(BUILD_AT_REF), y)
#define QI sockets command AT+QIOPEN/QICLOSE/QIRD/QISDE/QIGETERROR/QISTATE/QISEND/QISENDEX/QISWTMD
BUILD_PS_REF_TCPIP_QSOCK_AT_ENABLE = y
#define QNETCONIG command AT+QIDNSCFG/QIDNSGIP/QNETDEVCTL
BUILD_PS_REF_TCPIP_QNETCONFIG_AT_ENABLE = n
#define QPING command AT+QPING
BUILD_PS_REF_TCPIP_QPING_SERVICE_ENABLE = n
#define QNTP command AT+QNTP
BUILD_PS_REF_TCPIP_QSNTP_SERVICE_ENABLE = n
#define QI socket command: AT+QCCID/QENG/QCELL/QWIFISCAN/QPOWD/QSPN/QIACT/QIDEACT/QIREGAPP/QICSGP/QGDCNT/QAUGDCNT
BUILD_PS_REF_EPS_AT_ENABLE = n
#define QI socket command: AT+QICFG/QCFG
BUILD_PS_REF_COMMON_AT_ENABLE = y
endif
#<<<'OPENCPU_MODE_ENABLE' ENDDING...
endif

View File

@ -0,0 +1,27 @@
ifeq ($(CONFIG_PROJ_APP_SECURITY_BOOT), y)
BUILDDIR ?= $(TOP)/PLAT/out/$(TARGET)/$(PROJECT)
EC_SECURE_TOOL := $(TOP)/PLAT/tools/ECSecTools/ECSecTools.exe
EC_SECURE_TOOL_CFG ?= $(TOP)/PLAT/tools/ECSecTools/config_secure.ini
BIN_HEAD_NAME := $(BINNAME)_head
#$(BUILDDIR)/$(BIN_HEAD_NAME).bin: $(BUILDDIR)/$(BINNAME).bin
# $(EC_SECURE_TOOL) genimghd bootloader
#.PHONY: POST_SIGN_STEP
.PHONY: build
POST_SIGN_HEAD_FILE := $(BUILDDIR)/$(BIN_HEAD_NAME).bin
$(POST_SIGN_HEAD_FILE):$(BUILDDIR)/$(BINNAME).elf
$(EC_SECURE_TOOL) --cfgfile $(EC_SECURE_TOOL_CFG) genimghd system
build:$(POST_SIGN_HEAD_FILE)
endif

View File

@ -0,0 +1,179 @@
AVAILABLE_TARGETS = ec7xx_ref_1h00
TOOLCHAIN = GCC
BINNAME = ap_$(PROJECT)
TOP := ../../../../../../..
ifeq ($(EUTRAN_MODE), cat_mode)
EUTRAN_CAT_MODE = y
endif
SUBSYS_ENABLE = y
SUBSYS_OPENHAL_ENABLE = y
SUBSYS_OPENHAL_ETHERNET_ENABLE = y
#if need usb auto adapt support, set to y
#USBNET_AUTO_ADAPT_ENABLE=y
#enable below setting if OPENCPU_MODE is needed
ifeq ($(OPENCPU), true)
OPENCPU_MODE_ENABLE = y
endif
ifeq ($(GCF_ENABLE), true)
GCF_FEATURE_ENABLE = y
endif
ifeq ($(MID_ENABLE), true)
MID_FEATURE_ENABLE = y
endif
ifeq ($(IMS_ENABLE), true)
IMS_MODE_ENABLE = y
endif
ifeq ($(IMS_SMSONLY_ENABLE), true)
IMS_SMSONLY_MODE_ENABLE = y
endif
ifeq ($(AUDIO_ENABLE), true)
AUDIO_MODE_ENABLE = y
endif
ifeq ($(AUDIO_FIX_ENABLE), true)
AUDIO_FIX_SRC_ENABLE = y
endif
ifeq ($(TYPE), ec716s)
ifeq ($(RAM_ENBALE), true)
MORE_RAM_ENABLE = y
endif
endif
ifeq ($(ROM_ENABLE), true)
MORE_ROM_ENABLE = y
ifeq ($(LESS_LOG), true)
LESS_LOG_ENABLE = y
endif
endif
#features will be customized to whatever customers want!
include $(TOP)/PLAT/project/$(TARGET)/$(CORE)/apps/$(PROJECT)/GCC/FeatCustom_$(TYPE).inc
ifeq ($(EXCEPTION_FLASH_DUMP_ENABLE), y)
CFLAGS_DEFS += -DFEATURE_EXCEPTION_FLASH_DUMP_ENABLE
endif
ifeq ($(MIDDLEWARE_AMR_ENABLE), y)
CFLAGS_DEFS += -DFEATURE_AMR_CP_ENABLE
endif
ifeq ($(MIDDLEWARE_VEM_ENABLE), y)
CFLAGS_DEFS += -DFEATURE_VEM_CP_ENABLE
endif
ifeq ($(THIRDPARTY_JPEGCOMP_ENABLE),y)
CFLAGS_DEFS += -DFEATURE_JPEGCOMP_ENABLE
endif
ifeq ($(IMS_ENABLE), true)
CFLAGS_DEFS += -DFEATURE_IMS_ENABLE
CFLAGS_DEFS += -DFEATURE_IMS_CC_ENABLE
CFLAGS_DEFS += -DFEATURE_IMS_SMS_ENABLE
CFLAGS_DEFS += -DFEATURE_IMS_USE_PSRAM_ENABLE
CFLAGS_DEFS += -fno-strict-aliasing
endif
ifeq ($(IMS_UT_ENABLE), true)
CFLAGS_DEFS += -DFEATURE_IMS_UT_ENABLE
endif
ifeq ($(IMS_SMSONLY_ENABLE), true)
CFLAGS_DEFS += -DFEATURE_IMS_ENABLE
CFLAGS_DEFS += -DFEATURE_IMS_SMS_ENABLE
CFLAGS_DEFS += -fno-strict-aliasing
# NO FEATURE_IMS_CC_ENABLE
endif
ifeq ($(AUDIO_ENABLE), true)
ifeq ($(BUILD_SUPPORT_APP_PCM_MEM_POOL), y)
CFLAGS_DEFS += -DFEATURE_SUPPORT_APP_PCM_MEM_POOL
endif
CFLAGS_DEFS += -DFEATURE_AUDIO_ENABLE
endif
ifneq ($(findstring $(TYPE), ec716s ec716e),)
ifeq ($(RAM_ENBALE), true)
CFLAGS_DEFS += -DFEATURE_MORERAM_ENABLE
endif
endif
ifeq ($(ROM_ENABLE), true)
CFLAGS_DEFS += -DFEATURE_MOREROM_ENABLE
ifeq ($(LESS_LOG), true)
CFLAGS_DEFS += -DFEATURE_LESSLOG_ENABLE
endif
endif
ifeq ($(THIRDPARTY_CMCC_DM_ENABLE), y)
THIRDPARTY_CISONENET_ENABLE = y
THIRDPARTY_ERCOAP_ENABLE = y
endif
#ensure AT command to be consistent with protocol
#such as mqtt/...
ifeq ($(THIRDPARTY_MQTT_ENABLE), n)
BUILD_PLAT_MQTT_AT_ENABLE = n
endif
ifeq ($(THIRDPARTY_HTTPC_ENABLE), n)
BUILD_PLAT_HTTP_AT_ENABLE = n
endif
ifeq ($(THIRDPARTY_MBEDTLS_ENABLE), n)
BUILD_PLAT_SSL_AT_ENABLE = n
endif
ifeq ($(MIDDLEWARE_FOTAPAR_ENABLE), n)
BUILD_PLAT_FOTA_AT_ENABLE = n
BUILD_PLAT_ECOTA_AT_ENABLE = n
endif
CFLAGS_INC += -I ../inc \
-I $(TOP)/FIRMWARE/SRC/CAT1/Common/Inc \
-I $(TOP)/PLAT/driver/chip/$(CHIP)/ap/src/usb
obj-y += PLAT/project/$(TARGET)/$(CORE)/apps/$(PROJECT)/src/app.o \
PLAT/project/$(TARGET)/$(CORE)/apps/$(PROJECT)/src/rawData.o \
PLAT/project/$(TARGET)/$(CORE)/apps/$(PROJECT)/src/bsp_custom.o \
PLAT/project/$(TARGET)/$(CORE)/apps/$(PROJECT)/src/cecs_master.o
#CONFIG_PROJ_APP_SECURITY_BOOT = y
#include $(TOP)/PLAT/tools/scripts/Makefile.rules
include $(TOP)/PLAT/project/$(TARGET)/$(CORE)/apps/Makefile.rules
#configure USBNET_AUTO_ADAPT_ENABLE in ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk"'
ifeq ($(USBNET_AUTO_ADAPT_ENABLE), y)
CFLAGS_DEFS += -DFEATURE_USBNET_ATA_FOR_AP
CFLAGS_DEFS += -DFEATURE_FIX_REMOTE_WKUP_UNPAIRED_CASE
endif
#enable wdt
CFLAGS += -DWDT_FEATURE_ENABLE=1
CFLAGS += -DFEATURE_UART_HELP_DUMP_ENABLE
#Enable SIM hotswap feature with pad configration and jitter handle by required----don't remove it
#CFLAGS += -DSIM_HOT_SWAP_FEATURE
#Make all warnings into errors
CFLAGS += -Werror
CFLAGS += -DFEATURE_EX_ETHERNET_ENABLE
ifneq ($(OPENCPU_MODE_ENABLE),y)
ifneq ($(BUILD_AT),y)
$(error This example needs to modify "BUILD_AT" to "y" in device\target\board\$(TARGET)\$(CORE)\$(TARGET)_$(CORE).mk)
endif
endif

View File

@ -0,0 +1,519 @@
#ifndef __RTE_DEVICE_H
#define __RTE_DEVICE_H
#include "ec7xx.h"
/* Peripheral IO Mode Select, Must Configure First !!!
Note, when receiver works in DMA_MODE, interrupt is also enabled to transfer tailing bytes.
*/
#define POLLING_MODE 0x1
#define DMA_MODE 0x2
#define IRQ_MODE 0x3
#define UNILOG_MODE 0x4
#define RTE_UART0_TX_IO_MODE UNILOG_MODE
#define RTE_UART0_RX_IO_MODE DMA_MODE
#define USART0_RX_TRIG_LVL (30)
#define RTE_UART1_TX_IO_MODE DMA_MODE
#define RTE_UART1_RX_IO_MODE DMA_MODE
#define RTE_UART2_TX_IO_MODE POLLING_MODE
#define RTE_UART2_RX_IO_MODE DMA_MODE
#define RTE_SPI0_IO_MODE DMA_MODE
#define RTE_SPI1_IO_MODE POLLING_MODE
#define RTE_I2C0_IO_MODE POLLING_MODE
#define RTE_I2C1_IO_MODE POLLING_MODE
// I2C0 (Inter-integrated Circuit Interface) [Driver_I2C0]
// Configuration settings for Driver_I2C0 in component ::Drivers:I2C
#if (defined MID_FEATURE_MODE) || (defined FEATURE_AUDIO_ENABLE)
#define RTE_I2C0 1
#else
#define RTE_I2C0 0
#endif
// { PAD_PIN30}, // 0 : gpio15 / 2: I2C0_SCL
// { PAD_PIN29}, // 0 : gpio14 / 2: I2C0_SDA
#define RTE_I2C0_SCL_BIT 30
#define RTE_I2C0_SCL_FUNC PAD_MUX_ALT2
#define RTE_I2C0_SDA_BIT 29
#define RTE_I2C0_SDA_FUNC PAD_MUX_ALT2
// I2C1 (Inter-integrated Circuit Interface) [Driver_I2C1]
// Configuration settings for Driver_I2C1 in component ::Drivers:I2C
#if (defined MID_FEATURE_MODE)
#define RTE_I2C1 1
#else
#define RTE_I2C1 0
#endif
// { PAD_PIN20}, // 0 : gpio5 / 2 : I2C1 SCL
// { PAD_PIN19}, // 0 : gpio4 / 2 : I2C1 SDA
#define RTE_I2C1_SCL_BIT 20
#define RTE_I2C1_SCL_FUNC PAD_MUX_ALT2
#define RTE_I2C1_SDA_BIT 19
#define RTE_I2C1_SDA_FUNC PAD_MUX_ALT2
// UART0 (Universal asynchronous receiver transmitter) [Driver_USART0]
// Configuration settings for Driver_USART0 in component ::Drivers:USART
#define RTE_UART0 1
#define RTE_UART0_CTS_PIN_EN 0
#define RTE_UART0_RTS_PIN_EN 0
#if defined CHIP_EC718
// { PAD_PIN42}, // 0 : gpio36 / 3 : UART0 RTSn
// { PAD_PIN43}, // 0 : gpio37 / 3 : UART0 CTSn
// { PAD_PIN31}, // 0 : gpio16 / 1 : UART0 RXD
// { PAD_PIN32}, // 0 : gpio17 / 1 : UART0 TXD
#define RTE_UART0_RTS_BIT 42
#define RTE_UART0_RTS_FUNC PAD_MUX_ALT3
#define RTE_UART0_CTS_BIT 43
#define RTE_UART0_CTS_FUNC PAD_MUX_ALT3
#define RTE_UART0_RX_BIT 31
#define RTE_UART0_RX_FUNC PAD_MUX_ALT1
#define RTE_UART0_TX_BIT 32
#define RTE_UART0_TX_FUNC PAD_MUX_ALT1
#elif defined CHIP_EC716
// { PAD_PIN14}, // 0 : gpio2 / 5 : UART0 RTSn
// { PAD_PIN15}, // 0 : gpio3 / 5 : UART0 CTSn
// { PAD_PIN18}, // 0 : gpio6 / 1 : UART0 RXD
// { PAD_PIN19}, // 0 : gpio7 / 1 : UART0 TXD
#define RTE_UART0_RTS_BIT 14
#define RTE_UART0_RTS_FUNC PAD_MUX_ALT5
#define RTE_UART0_CTS_BIT 15
#define RTE_UART0_CTS_FUNC PAD_MUX_ALT5
#define RTE_UART0_RX_BIT 18
#define RTE_UART0_RX_FUNC PAD_MUX_ALT1
#define RTE_UART0_TX_BIT 19
#define RTE_UART0_TX_FUNC PAD_MUX_ALT1
#endif
// DMA
// Tx
// Channel <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
#define RTE_UART0_DMA_TX_REQID DMA_REQUEST_USART0_TX
// Rx
// Channel <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
#define RTE_UART0_DMA_RX_REQID DMA_REQUEST_USART0_RX
// UART1 (Universal asynchronous receiver transmitter) [Driver_USART1]
// Configuration settings for Driver_USART1 in component ::Drivers:USART
#define RTE_UART1 1
#if defined CHIP_EC718
#define RTE_UART1_CTS_PIN_EN 1
#define RTE_UART1_RTS_PIN_EN 1
#elif defined CHIP_EC716
/* uart1 gpio4/5 & spi0 gpio4/5 are conflicted! */
#define RTE_UART1_CTS_PIN_EN 0
#define RTE_UART1_RTS_PIN_EN 0
#endif
#if defined CHIP_EC718
// { PAD_PIN27}, // 0 : gpio12 / 2 : UART1 RTS
// { PAD_PIN28}, // 0 : gpio13 / 2 : UART1 CTS
// { PAD_PIN33}, // 0 : gpio18 / 1 : UART1 RXD
// { PAD_PIN34}, // 0 : gpio19 / 1 : UART1 TXD
#define RTE_UART1_RTS_BIT 27
#define RTE_UART1_RTS_FUNC PAD_MUX_ALT2
#define RTE_UART1_CTS_BIT 28
#define RTE_UART1_CTS_FUNC PAD_MUX_ALT2
#define RTE_UART1_RX_BIT 33
#define RTE_UART1_RX_FUNC PAD_MUX_ALT1
#define RTE_UART1_TX_BIT 34
#define RTE_UART1_TX_FUNC PAD_MUX_ALT1
#elif defined CHIP_EC716
// { PAD_PIN16}, // 0 : gpio4 / 5 : UART1 RTS
// { PAD_PIN17}, // 0 : gpio5 / 5 : UART1 CTS
// { PAD_PIN20}, // 0 : gpio8 / 1 : UART1 RXD
// { PAD_PIN21}, // 0 : gpio9 / 1 : UART1 TXD
#define RTE_UART1_RTS_BIT 16
#define RTE_UART1_RTS_FUNC PAD_MUX_ALT5
#define RTE_UART1_CTS_BIT 17
#define RTE_UART1_CTS_FUNC PAD_MUX_ALT5
#define RTE_UART1_RX_BIT 20
#define RTE_UART1_RX_FUNC PAD_MUX_ALT1
#define RTE_UART1_TX_BIT 21
#define RTE_UART1_TX_FUNC PAD_MUX_ALT1
#endif
// DMA
// Tx
// Channel <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
#define RTE_UART1_DMA_TX_REQID DMA_REQUEST_USART1_TX
// Rx
// Channel <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
#define RTE_UART1_DMA_RX_REQID DMA_REQUEST_USART1_RX
// UART2 (Universal asynchronous receiver transmitter) [Driver_USART2]
// Configuration settings for Driver_USART2 in component ::Drivers:USART
#define RTE_UART2 0
// { PAD_PIN25}, // 0 : gpio10 / 3 : UART2 RXD
// { PAD_PIN26}, // 0 : gpio11 / 3 : UART2 TXD
#define RTE_UART2_RX_BIT 25
#define RTE_UART2_RX_FUNC PAD_MUX_ALT3
#define RTE_UART2_TX_BIT 26
#define RTE_UART2_TX_FUNC PAD_MUX_ALT3
// DMA
// Tx
// Channel <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
#define RTE_UART2_DMA_TX_REQID DMA_REQUEST_USART2_TX
// Rx
// Channel <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
#define RTE_UART2_DMA_RX_REQID DMA_REQUEST_USART2_RX
// SPI0 (Serial Peripheral Interface) [Driver_SPI0]
// Configuration settings for Driver_SPI0 in component ::Drivers:SPI
#define RTE_SPI0 1
#if defined CHIP_EC718
// { PAD_PIN23}, // 0 : gpio8 / 1 : SPI0 SSn
// { PAD_PIN24}, // 0 : gpio9 / 1 : SPI0 MOSI
// { PAD_PIN25}, // 0 : gpio10 / 1 : SPI0 MISO
// { PAD_PIN26}, // 0 : gpio11 / 1 : SPI0 SCLK
#define RTE_SPI0_SSN_BIT 23
#define RTE_SPI0_SSN_FUNC PAD_MUX_ALT1
#define RTE_SPI0_MOSI_BIT 24
#define RTE_SPI0_MOSI_FUNC PAD_MUX_ALT1
#define RTE_SPI0_MISO_BIT 25
#define RTE_SPI0_MISO_FUNC PAD_MUX_ALT1
#define RTE_SPI0_SCLK_BIT 26
#define RTE_SPI0_SCLK_FUNC PAD_MUX_ALT1
#define RTE_SPI0_SSN_GPIO_INSTANCE 0
#define RTE_SPI0_SSN_GPIO_INDEX 8
#elif defined CHIP_EC716
// { PAD_PIN14}, // 0 : gpio2 / 1 : SPI0 SSn
// { PAD_PIN15}, // 0 : gpio3 / 1 : SPI0 MOSI
// { PAD_PIN16}, // 0 : gpio4 / 1 : SPI0 MISO
// { PAD_PIN17}, // 0 : gpio5 / 1 : SPI0 SCLK
#define RTE_SPI0_SSN_BIT 14
#define RTE_SPI0_SSN_FUNC PAD_MUX_ALT1
#define RTE_SPI0_MOSI_BIT 15
#define RTE_SPI0_MOSI_FUNC PAD_MUX_ALT1
#define RTE_SPI0_MISO_BIT 16
#define RTE_SPI0_MISO_FUNC PAD_MUX_ALT1
#define RTE_SPI0_SCLK_BIT 17
#define RTE_SPI0_SCLK_FUNC PAD_MUX_ALT1
#define RTE_SPI0_SSN_GPIO_INSTANCE 0
#define RTE_SPI0_SSN_GPIO_INDEX 2
#endif
// DMA
// Tx
// Channel <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
#define RTE_SPI0_DMA_TX_REQID DMA_REQUEST_SPI0_TX
// Rx
// Channel <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
#define RTE_SPI0_DMA_RX_REQID DMA_REQUEST_SPI0_RX
// SPI1 (Serial Peripheral Interface) [Driver_SPI1]
// Configuration settings for Driver_SPI1 in component ::Drivers:SPI
#define RTE_SPI1 0
// { PAD_PIN27}, // 0 : gpio12 / 1 : SPI1 SSn
// { PAD_PIN28}, // 0 : gpio13 / 1 : SPI1 MOSI
// { PAD_PIN29}, // 0 : gpio14 / 1 : SPI1 MISO
// { PAD_PIN30}, // 0 : gpio15 / 1 : SPI1 SCLK
// { PAD_PIN26}, // 0 : gpio11 / 2 : SPI1 SSn1
#define RTE_SPI1_SSN_BIT 27
#define RTE_SPI1_SSN_FUNC PAD_MUX_ALT1
#define RTE_SPI1_MOSI_BIT 28
#define RTE_SPI1_MOSI_FUNC PAD_MUX_ALT1
#define RTE_SPI1_MISO_BIT 29
#define RTE_SPI1_MISO_FUNC PAD_MUX_ALT1
#define RTE_SPI1_SCLK_BIT 30
#define RTE_SPI1_SCLK_FUNC PAD_MUX_ALT1
#define RTE_SPI1_SSN_GPIO_INSTANCE 0
#define RTE_SPI1_SSN_GPIO_INDEX 12
#define RTE_SPI1_SSN1_BIT 26
#define RTE_SPI1_SSN1_FUNC PAD_MUX_ALT2
// DMA
// Tx
// Channel <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
#define RTE_SPI1_DMA_TX_REQID DMA_REQUEST_SPI1_TX
// Rx
// Channel <0=>0 <1=>1 <2=>2 <3=>3 <4=>4 <5=>5 <6=>6 <7=>7
#define RTE_SPI1_DMA_RX_REQID DMA_REQUEST_SPI1_RX
// PWM0 Controller [Driver_PWM0]
// Configuration settings for Driver_PWM0 in component ::Drivers:PWM
#define RTE_PWM 1
#define EFUSE_INIT_MODE POLLING_MODE
#define L2CTLS_INIT_MODE POLLING_MODE
#define FLASH_BARE_RW_MODE 1
/*
static configuration for USB/UART relatded feature
RTE_USB_EN: whether init USB stack
RTE_ONE_UART_AT: enable one UART AT
RTE_ONE_UART_AT: enable two UART AT
RTE_ETHER_EN : whehter RNDIS/ECM feature is enabled
RTE_PPP_EN : whehter PPPOS feature is enabled
RTE_OPAQ_EN : whehter OPAQOS feature is enabled
*/
#if (defined OPEN_CPU_MODE)
/* device */
#define RTE_SPI_EN 1
#define RTE_USB_EN 1
#define RTE_ONE_UART_AT 1
#define RTE_TWO_UART_AT 0
/* feature */
#define RTE_MUX_EN 0
#define RTE_OPAQ_EN 0
#if ((defined MID_FEATURE_MODE) || (defined MORE_RAM_ENABLE))
#define RTE_ETHER_EN 0
#else
#define RTE_ETHER_EN 1
#endif
#else
/* device */
#define RTE_SPI_EN 0
#define RTE_USB_EN 1
#define RTE_ONE_UART_AT 1
#define RTE_TWO_UART_AT 0
/* feature */
#define RTE_MUX_EN 0
#define RTE_OPAQ_EN 0
#if (RTE_USB_EN == 1)
#define RTE_ETHER_EN 1 /* 0/1: to ctrl eth(rndis/ecm) independently! */
#ifdef FEATURE_USB_CCID_ENABLE
#define RTE_CCID_EN 1 /* 0/1: to ctrl ccid independently! */
#else
#define RTE_CCID_EN 0 /* 0/1: to ctrl ccid independently! */
#endif
#else
#define RTE_ETHER_EN RTE_USB_EN /* must be the same(disabled) */
#define RTE_CCID_EN RTE_USB_EN /* 0/1: to ctrl ccid independently! */
#endif
#endif
#ifdef FEATURE_PPP_ENABLE
#define RTE_PPP_EN 1
#else
#define RTE_PPP_EN 0
#endif
#if (RTE_SPI_EN == 1)
#define RTE_EOS_EN 1
#define RTE_IPOS_EN 0
#else
#define RTE_EOS_EN RTE_SPI_EN
#define RTE_IPOS_EN RTE_SPI_EN
#endif
#define RTE_ETH_LAN_EN (RTE_ETHER_EN || RTE_EOS_EN)
/* to be compatible with old style */
#define RTE_RNDIS_EN RTE_ETHER_EN
#if (defined FEATURE_AUDIO_ENABLE)
#define RTE_AUDIO_EN 1
#define VOLTE_EC_OWN_BOARD_SUPPORT 1
#else
#define RTE_AUDIO_EN 0
#endif
#if (RTE_IPOS_EN == 1)
#undef RTE_OPAQ_EN
//To Ensure the macro 'RTE_OPAQ_EN' is enabled!
#define RTE_OPAQ_EN 1
#endif
#if (RTE_ONE_UART_AT == 1)
#define RTE_UART0 1
#define RTE_UART1 1
#define RTE_UART2 0
#elif (RTE_TWO_UART_AT == 1)
#define RTE_UART0 1
#define RTE_UART1 1
#define RTE_UART2 1
#endif
/* to enable external thermal */
#define EXTERNAL_NTC_EXIST 0
#define RTE_LPUART_EN 1
#if (RTE_UART1 == 1)
#define UART1_DTR_PAD_INDEX 26 // GPIO11
#define UART1_DTR_GPIO_INSTANCE 0
#define UART1_DTR_GPIO_PIN 11
#define UART1_RI_PAD_INDEX 49 // AONIO 4 = GPIO24
#define UART1_RI_GPIO_INSTANCE 1
#define UART1_RI_GPIO_PIN 8
#define UART1_RI_PWM_INSTANCE 1
#define UART1_RI_PWM_CLK_ID FCLK_TIMER1
#define UART1_RI_PWM_CLK_SEL FCLK_TIMER1_SEL_26M
#define UART1_DCD_PAD_INDEX 50 // AONIO 5 = GPIO25
#define UART1_DCD_GPIO_INSTANCE 1
#define UART1_DCD_GPIO_PIN 9
#endif
#if (RTE_UART2 == 1)
#define UART2_DTR_PAD_INDEX 25 // GPIO10
#define UART2_DTR_GPIO_INSTANCE 0
#define UART2_DTR_GPIO_PIN 10
#define UART2_RI_PAD_INDEX 48 // AONIO 3 = GPIO23
#define UART2_RI_GPIO_INSTANCE 1
#define UART2_RI_GPIO_PIN 7
#define UART2_RI_PWM_INSTANCE 0
#define UART2_RI_PWM_CLK_ID FCLK_TIMER0
#define UART2_RI_PWM_CLK_SEL FCLK_TIMER0_SEL_26M
#define UART2_DCD_PAD_INDEX 52 // AONIO 7 = GPIO27
#define UART2_DCD_GPIO_INSTANCE 1
#define UART2_DCD_GPIO_PIN 11
#endif
#define NETLIGHT_PAD_INDEX 51 // AONIO 6 = GPIO26
#define NETLIGHT_PAD_ALT_FUNC PAD_MUX_ALT5
#define NETLIGHT_PWM_INSTANCE 3
//USIM1 OPTION1
#if defined CHIP_EC718
#define USIM1_URST_OP1_PAD_INDEX 19 // GPIO4
#define USIM1_URST_OP1_GPIO_INSTANCE 0
#define USIM1_URST_OP1_GPIO_PIN 4
#define USIM1_UCLK_OP1_PAD_INDEX 20 // GPIO5
#define USIM1_UCLK_OP1_GPIO_INSTANCE 0
#define USIM1_UCLK_OP1_GPIO_PIN 5
#define USIM1_UIO_OP1_PAD_INDEX 21 // GPIO6
#define USIM1_UIO_OP1_GPIO_INSTANCE 0
#define USIM1_UIO_OP1_GPIO_PIN 6
#elif defined CHIP_EC716
#define USIM1_URST_OP1_PAD_INDEX 13 // GPIO1
#define USIM1_URST_OP1_GPIO_INSTANCE 0
#define USIM1_URST_OP1_GPIO_PIN 1
#define USIM1_UCLK_OP1_PAD_INDEX 14 // GPIO2
#define USIM1_UCLK_OP1_GPIO_INSTANCE 0
#define USIM1_UCLK_OP1_GPIO_PIN 2
#define USIM1_UIO_OP1_PAD_INDEX 15 // GPIO3
#define USIM1_UIO_OP1_GPIO_INSTANCE 0
#define USIM1_UIO_OP1_GPIO_PIN 3
#endif
//USIM1 OPTION2
#define USIM1_UIO_OP2_PAD_INDEX 27 // GPIO12
#define USIM1_UIO_OP2_GPIO_INSTANCE 0
#define USIM1_UIO_OP2_GPIO_PIN 12
#define USIM1_URST_OP2_PAD_INDEX 28 // GPIO13
#define USIM1_URST_OP2_GPIO_INSTANCE 0
#define USIM1_URST_OP2_GPIO_PIN 13
#define USIM1_UCLK_OP2_PAD_INDEX 29 // GPIO14
#define USIM1_UCLK_OP2_GPIO_INSTANCE 0
#define USIM1_UCLK_OP2_GPIO_PIN 14
//USIM1 clock latched by AONIO, for example, use AONIO-6 test on EVB
#if defined CHIP_EC718
#define AONIO_6_PAD_INDEX 51 // AONIO 6 = GPIO26
#define AONIO_6_GPIO_INSTANCE 1
#define AONIO_6_GPIO_PIN 10
#elif defined CHIP_EC716
#define AONIO_6_PAD_INDEX 28 // AONIO 6 = GPIO16
#define AONIO_6_GPIO_INSTANCE 1
#define AONIO_6_GPIO_PIN 0 //GPIO16, (16 % 16)
#endif
#ifdef SIM_HOT_SWAP_FEATURE
#define TIMER_INSTANCE_4 4
#endif
//////////////////////////////////////////////////////////////////////////////////////////////
// I2S Setting field Start
// All the I2S's parameters that need user to set are all put here
//////////////////////////////////////////////////////////////////////////////////////////////
// I2S0 Configuration
#define RTE_I2S0 1
#define RTE_I2S0_MCLK_PAD_ADDR 39
#define RTE_I2S0_MCLK_FUNC PAD_MUX_ALT1
#define RTE_I2S0_BCLK_PAD_ADDR 35
#define RTE_I2S0_BCLK_FUNC PAD_MUX_ALT1
#define RTE_I2S0_LRCK_PAD_ADDR 36
#define RTE_I2S0_LRCK_FUNC PAD_MUX_ALT1
#define RTE_I2S0_DIN_PAD_ADDR 37
#define RTE_I2S0_DIN_FUNC PAD_MUX_ALT1
#define RTE_I2S0_DOUT_PAD_ADDR 38
#define RTE_I2S0_DOUT_FUNC PAD_MUX_ALT1
// I2S1 Configuration
#define RTE_I2S1 0
#define RTE_I2S1_IO_MODE DMA_MODE
#define RTE_I2S1_MCLK_PAD_ADDR 18
#define RTE_I2S1_MCLK_FUNC PAD_MUX_ALT1
#define RTE_I2S1_BCLK_PAD_ADDR 19
#define RTE_I2S1_BCLK_FUNC PAD_MUX_ALT1
#define RTE_I2S1_LRCK_PAD_ADDR 20
#define RTE_I2S1_LRCK_FUNC PAD_MUX_ALT1
#define RTE_I2S1_DIN_PAD_ADDR 21
#define RTE_I2S1_DIN_FUNC PAD_MUX_ALT1
#define RTE_I2S1_DOUT_PAD_ADDR 22
#define RTE_I2S1_DOUT_FUNC PAD_MUX_ALT1
//////////////////////////////////////////////////////////////////////////////////////////////
// I2S Setting field End
//////////////////////////////////////////////////////////////////////////////////////////////
#endif /* __RTE_DEVICE_H */

View File

@ -0,0 +1,10 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of EigenComm Ltd.
* File name: app.h
* Description: EC718 at command demo entry header file
* History: Rev1.0 2018-07-12
*
****************************************************************************/

View File

@ -0,0 +1,53 @@
#ifndef BSP_CUSTOM_H
#define BSP_CUSTOM_H
#ifdef __cplusplus
extern "C" {
#endif
#include "bsp.h"
/*
the following types define the scenarios of LdoFemVbat,
Scenario type1: LdoFemVbat does NOT reuse to RF FrontEnd (PA and switches) at all;
Scenario type2: LdoFemVbat is used for RF FrontEnd (PA or switches) at all, while also multiplexing other peripherals (such as cameras, vovice codecs, etc);
Scenario type3: LdoFemVbat is only used for RF FrontEnd (PA or switches) and is NOT reused for other peripherals (such as cameras, vovice codecs, etc);
The default setting is Scenario type3.
*/
enum
{
/*For this type1, the application needs to open or close LdoFemVbat on its own.
Please Note that LdoFemVbat will be turned off after entering sleep mode,
after exiting sleep, the application also needs to open LdoFemVbat and re-initialize the relevant peripherals under this power supply.
*/
LDOFEMVBAT_SCENARIO_TYPE1 = 0x0,
/*For this type2, the application needs to re-open LdoFemVbat before each use of peripherals under this power supply,
after use, LdoFemVbat can NOT be turned off (nor can it be turned off) because LdoFemVbat is also used for RF devices (PA or switches).
Meanwhile, due to the sleep mode, the logic implemented by the software will close LdoFemVbat before entering into sleep, and then open after exiting from sleep.
So, the application needs to re-open LdoFemVbat before use.
During the period when the application is using the peripheral, if need to keep LdoFemVbat in a powered state,
it can NOT enter any sleep mode.
*/
LDOFEMVBAT_SCENARIO_TYPE2,
/*For this type3, default mode, application does NOT use LdoFemVbat.*/
LDOFEMVBAT_SCENARIO_TYPE3
};
void BSP_CustomInit(void);
uint32_t BSP_UsbGetVBUSMode(void);
uint32_t BSP_UsbGetVBUSWkupPad(void);
void SimHotSwapInit(void);
#ifdef __cplusplus
}
#endif
#endif /* BSP_CUSTOM_H */

View File

@ -0,0 +1,118 @@
/******************************************************************************
*(C) Copyright 2024 EIGENCOMM International Ltd.
* All Rights Reserved
******************************************************************************
* Filename:
*
* Description:
*
* History: Rev1.0 2024-07-01
*
* Notes:
*
******************************************************************************/
#ifndef __CECS_H__
#define __CECS_H__
/*
CECS connection:
+----------------+ +----------------+
| | | |
| +-----------| |-----------+ |
| |SPI master | | SPI slave| |
| | | | | |
| | RST|----------------------------->|RST | |
| | | | | |
| | INT|<-----------------------------|INT | |
| | | | | |
| | CS|----------------------------->|CS | |
| | | | | |
| | CLK|----------------------------->|CLK | |
| | | | | |
| | MOSI|----------------------------->|MOSI | |
| | | | | |
| | MISO|<-----------------------------|MISO | |
| | | | | |
| +-----------| |-----------+ |
| | | |
| GND|<---------------------------->|GND |
| | | |
+----------------+ +----------------+
*/
/*----------------------------------------------------------------------------*
* INCLUDES *
*----------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif
#include "RTE_Device.h"
#include "ccio_misc.h"
/*----------------------------------------------------------------------------*
* MACROS *
*----------------------------------------------------------------------------*/
//master part
#define CECS_MASTER_INSTANCE 0
#define CECS_MASTER_INT_PAD WAKEUP_PAD_4
#define CECS_MASTER_INT_IRQ PadWakeup4_IRQn
#define CECS_MASTER_INT_IRQ_ISR void Pad4_WakeupIntHook(void) // override the weak function in bsp_custom.c
#if defined CHIP_EC718
#define CECS_MASTER_RST_PAD_INDEX 48 // AGPIO3 (GPIO23)
#define CECS_MASTER_RST_PAD_ALT_FUNC PAD_MUX_ALT0
#define CECS_MASTER_RST_GPIO_INSTANCE 1 // AGPIO3 (GPIO23)
#define CECS_MASTER_RST_GPIO_INDEX 7 // AGPIO3 (GPIO23)
#elif defined CHIP_EC716
#define CECS_MASTER_RST_PAD_INDEX 25 // AGPIO3 (GPIO13)
#define CECS_MASTER_RST_PAD_ALT_FUNC PAD_MUX_ALT0
#define CECS_MASTER_RST_GPIO_INSTANCE 0 // AGPIO3 (GPIO13)
#define CECS_MASTER_RST_GPIO_INDEX 13 // AGPIO3 (GPIO13)
#endif
#define CECS_SPI_FRAME_FORMAT ARM_SPI_CPOL1_CPHA1
#define CECS_BUS_SPEED 20000000 //25600000 //1000000
#define CECS_FRAME_MTU 1600
#define CECS_MIN_TRANSFER_DUMMY_BYTES 256
#define CECSTIMEOUT_AFTER_LINK_CHG (3000) //3000MS
#define CECS_masterSendTrigger SFDT_slaveSendTrigger
/*----------------------------------------------------------------------------*
* DATA TYPE DEFINITION *
*----------------------------------------------------------------------------*/
/** \brief List of CECS flow control options */
typedef enum
{
CECS_FLOW_CONTROL_XON, /**< permit to send */
CECS_FLOW_CONTROL_XOFF /**< shall not send */
} CECSFlowControl_e;
/*----------------------------------------------------------------------------*
* GLOBAL FUNCTIONS DECLEARATION *
*----------------------------------------------------------------------------*/
int32_t CECS_MasterInit(void);
void CECS_MasterGpioInit(void);
//void CECS_masterSendTrigger(void);
#ifdef __cplusplus
}
#endif
#endif/*__CECS_H__*/

View File

@ -0,0 +1,3 @@
#ifndef __EX_ETHERNET_H__
#define __EX_ETHERNET_H__
#endif/*__EX_ETHERNET_H__*/

View File

@ -0,0 +1,144 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of EigenComm Ltd.
* File name: app.c
* Description: EC718 at command demo entry source file
* History: Rev1.0 2018-07-12
*
****************************************************************************/
#include "string.h"
#include "bsp.h"
#include "bsp_custom.h"
#include "os_common.h"
#include "ostask.h"
#include DEBUG_LOG_HEADER_FILE
#include "plat_config.h"
#include "slpman.h"
#include "app.h"
#ifdef FEATURE_AT_ENABLE
#include "at_def.h"
#include "at_api.h"
#endif
#if defined(FEATURE_CTCC_DM_ENABLE) || defined(FEATURE_CUCC_DM_ENABLE) || defined(FEATURE_CMCC_DM_ENABLE)
#include "dm_task.h"
#endif
#ifdef FEATURE_APP_TLS_ENABLE
#include "at_ssl_task.h"
#endif
#ifdef FEATURE_PLAT_HTTP_AT_ENABLE
#include "at_http_task.h"
#endif
#ifdef FEATURE_CTWING_CERTI_ENABLE
#include "ctw_task.h"
#endif
#include "version.h"
#ifdef FEATURE_EX_ETHERNET_ENABLE
#include "cecs.h"
#endif
#define USRAPP_TASK_STACK_SIZE (1024)
#if defined FEATURE_FREERTOS_ENABLE
static StaticTask_t usrapp_task;
static uint8_t usrapp_task_stack[USRAPP_TASK_STACK_SIZE];
#endif
__attribute__((weak)) void SFDT_slaveFlowControl(uint32_t control) {}
//__attribute__((weak)) void SFDT_slaveSendTrigger(void) {}
void usb_portmon_task_init(void);
static void UserAppTask(void *arg)
{
uint32_t loopCnt = 0;
#ifdef FEATURE_EX_ETHERNET_ENABLE
//osDelay(2000);
CECS_MasterInit();
#endif
while(1)
{
ECPLAT_PRINTF(UNILOG_PLA_APP, ApUserAppTask_0, P_VALUE, "AP: Daemon task loop-%d", loopCnt++);
osDelay(2000);
}
}
void daemonTaskInit(void)
{
osThreadAttr_t task_attr;
memset(&task_attr,0,sizeof(task_attr));
task_attr.name = "usrapp";
#if defined FEATURE_FREERTOS_ENABLE
memset(usrapp_task_stack, 0xA5,USRAPP_TASK_STACK_SIZE);
task_attr.stack_mem = usrapp_task_stack;
task_attr.cb_mem = &usrapp_task;//task control block
task_attr.cb_size = sizeof(StaticTask_t);//size of task control block
task_attr.priority = osPriorityNormal;
#elif defined FEATURE_LITEOS_ENABLE
task_attr.priority = osPriorityNormal1;
#endif
task_attr.stack_size = USRAPP_TASK_STACK_SIZE;
osThreadNew(UserAppTask, NULL, &task_attr);
}
static void appInit(void *arg)
{
ECPLAT_PRINTF(UNILOG_PLA_APP, EC_CHIP_VERSION_1, P_INFO, "%s", EC_CHIP_VERSION);
#if defined(FEATURE_CTCC_DM_ENABLE) || defined(FEATURE_CUCC_DM_ENABLE) || defined(FEATURE_CMCC_DM_ENABLE)
ecAutoRegisterInit();
#endif
#ifdef FEATURE_CTWING_CERTI_ENABLE
ecCtwAutoRegisterInit();
#endif
#ifdef FEATURE_APP_TLS_ENABLE
sslEngineInit();
#endif
#ifdef FEATURE_PLAT_HTTP_AT_ENABLE
httpEngineInit();
#endif
#ifdef FEATURE_PLAT_CTLWM2M_AT_ENABLE
extern void ctiotEngineInit();
ctiotEngineInit();
#endif
#ifdef FEATURE_PLAT_ONENET_AT_ENABLE
extern void onenetEngineInit();
onenetEngineInit();
#endif
#if (RTE_USB_EN == 1)
if (BSP_UsbGetVBUSMode()==1)
{
usb_portmon_task_init() ;
}
#endif
#ifdef FEATURE_PLAT_MISC_ECIDLEP_ENABLE
extern void apPrintIdlePercent(void);
apPrintIdlePercent();
#endif
daemonTaskInit();
}
/**
\fn int main_entry(void)
\brief main entry function.
\return
*/
void main_entry(void)
{
BSP_CommonInit();
osKernelInitialize();
registerAppEntry(appInit, NULL);
if (osKernelGetState() == osKernelReady)
{
osKernelStart();
}
while(1);
}

View File

@ -0,0 +1,594 @@
/******************************************************************************
*(C) Copyright 2024 EIGENCOMM International Ltd.
* All Rights Reserved
******************************************************************************
* Filename:
*
* Description:
*
* History: Rev1.0 2024-07-01
*
* Notes:
*
******************************************************************************/
/*----------------------------------------------------------------------------*
* INCLUDES *
*----------------------------------------------------------------------------*/
#include "cecs.h"
#include DEBUG_LOG_HEADER_FILE
#if defined FEATURE_FREERTOS_ENABLE
#include "FreeRTOS.h"
#endif
#include "cmsis_os2.h"
#include "bsp_spi.h"
#include "slpman.h"
#include "spi_device.h"
#include "ccio_custom.h"
#include "CH390.h"
#include "psdial_net.h"
#define CECS_MASTER_LOG_ENABLE
/*----------------------------------------------------------------------------*
* MACROS *
*----------------------------------------------------------------------------*/
#define CECS_DEVICE_INDEX (0)
#define MASTER_TRANSFER_TASK_STACK_SIZE (1024)
#define MASTER_TRANSFER_TX_FLAG (0x1)
#define MASTER_TRANSFER_RX_FLAG (0x2)
#define MASTER_TRANSFER_TRIGGER_FLAG (MASTER_TRANSFER_TX_FLAG | MASTER_TRANSFER_RX_FLAG)
#define MASTER_TRANSFER_DONE_FLAG (0x1)
/*----------------------------------------------------------------------------*
* DATA TYPE DEFINITION *
*----------------------------------------------------------------------------*/
typedef struct
{
uint32_t magic; /* "SPIC" */
uint16_t type;
uint16_t len; /* including hdr size */
uint32_t rsvd;
}initMsgHdr_t;
typedef enum{
LINK_CHG_IDLE,
LINK_CHG_INITIALIZING,
LINK_CHG_LINK_UP,
LINK_CHG_RESET,
LINK_CHG_DE_INITIALIZING,
LINK_CHG_LINK_DOWN
}linkChgStaus_E;
/*----------------------------------------------------------------------------*
* PRIVATE FUNCTION DECLEARATION *
*----------------------------------------------------------------------------*/
static void rst(uint8_t level);
static void scs(uint8_t level);
static uint8_t spi_exchange_byte(uint8_t byte);
static uint32_t cecs_data_reveive(uint8_t *recvData);
static uint32_t cecs_data_send(uint8_t *sendData,uint16_t sendLen);
static void CECS_masterTransferTaskEntry(void *arg);
/*----------------------------------------------------------------------------*
* GLOBAL VARIABLES *
*----------------------------------------------------------------------------*/
#if CECS_MASTER_INSTANCE == 0
#if RTE_SPI0 == 0
#error SPI0 shall be enabled in rte
#endif
#define CECS_SPI_SSN_GPIO_INSTANCE RTE_SPI0_SSN_GPIO_INSTANCE
#define CECS_SPI_SSN_GPIO_INDEX RTE_SPI0_SSN_GPIO_INDEX
extern ARM_DRIVER_SPI Driver_SPI0;
static ARM_DRIVER_SPI *spiMasterDrv = &CREATE_SYMBOL(Driver_SPI, 0);
#elif CECS_MASTER_INSTANCE == 1
#if RTE_SPI1 == 0
#error SPI1 shall be enabled in rte
#endif
#define CECS_SPI_SSN_GPIO_INSTANCE RTE_SPI1_SSN_GPIO_INSTANCE
#define CECS_SPI_SSN_GPIO_INDEX RTE_SPI1_SSN_GPIO_INDEX
extern ARM_DRIVER_SPI Driver_SPI1;
static ARM_DRIVER_SPI *spiMasterDrv = &CREATE_SYMBOL(Driver_SPI, 1);
#else
#error unsupported spi instance
#endif
static StaticTask_t gMasterTransferTask;
static uint8_t gMasterTransferTaskStack[MASTER_TRANSFER_TASK_STACK_SIZE];
static osEventFlagsId_t gMasterTransferTriggerFlag = NULL;
static osEventFlagsId_t gMasterTransferDoneFlag = NULL;
ch390_interface_t ch390_interface = {
rst,
delay_us,
scs,
spi_exchange_byte,
};
/*----------------------------------------------------------------------------*
* PRIVATE FUNCTIONS *
*----------------------------------------------------------------------------*/
static void CECS_masterCallback(uint32_t event)
{
osEventFlagsSet(gMasterTransferDoneFlag, MASTER_TRANSFER_DONE_FLAG);
}
static void rst(uint8_t level)
{
ECPLAT_PRINTF(UNILOG_PLA_APP, CECS_rst, P_DEBUG, "level [%d]", level);
if(level)
GPIO_pinWrite(CECS_MASTER_RST_GPIO_INSTANCE, 1 << CECS_MASTER_RST_GPIO_INDEX, 1 << CECS_MASTER_RST_GPIO_INDEX);
else
GPIO_pinWrite(CECS_MASTER_RST_GPIO_INSTANCE, 1 << CECS_MASTER_RST_GPIO_INDEX, 0);
}
static void scs(uint8_t level)
{
if(level)
GPIO_pinWrite(CECS_SPI_SSN_GPIO_INSTANCE, 1 << CECS_SPI_SSN_GPIO_INDEX, 1 << CECS_SPI_SSN_GPIO_INDEX);
else
GPIO_pinWrite(CECS_SPI_SSN_GPIO_INSTANCE, 1 << CECS_SPI_SSN_GPIO_INDEX, 0);
}
static uint8_t spi_exchange_byte(uint8_t byte)
{
uint8_t u8Out = 0;
spiMasterDrv->Transfer(&byte, &u8Out, 1);
osEventFlagsWait(gMasterTransferDoneFlag, MASTER_TRANSFER_DONE_FLAG, osFlagsWaitAll, 5);
return u8Out;
}
static uint32_t cecs_data_reveive(uint8_t *recvData)
{
uint16_t rxLen;
uint8_t rx_ready;
uint8_t ReceiveData[4];
ch390_read_reg(CH390_MRCMDX);
rx_ready = ch390_read_reg(CH390_MRCMDX);
#ifdef CECS_MASTER_LOG_ENABLE
ECPLAT_PRINTF(UNILOG_PLA_APP, CECS_cecs_data_reveive, P_DEBUG, "rx_ready [0x%x]", rx_ready);
#endif
if (rx_ready & CH390_PKT_ERR)
{
// Reset RX FIFO pointer
ch390_write_reg(CH390_RCR, 0); //RX disable
ch390_write_reg(CH390_MPTRCR, 0x01); //Reset RX FIFO pointer
ch390_write_reg(CH390_MRRH, 0x0c);
osDelay(1);
ch390_write_reg(CH390_RCR, RCR_RXEN); //RX Enable
return 0;
}
if(!(rx_ready & CH390_PKT_RDY))
{
return 0;
}
//ch390_read_mem(ReceiveData, 4);
//rxLen = ReceiveData[2] | (ReceiveData[3] << 8);
scs(0);
spi_exchange_byte(OPC_MEM_READ);
spiMasterDrv->Receive(ReceiveData,4);
osEventFlagsWait(gMasterTransferDoneFlag, MASTER_TRANSFER_DONE_FLAG, osFlagsWaitAll, 5);
rxLen = ReceiveData[2] | (ReceiveData[3] << 8);
spiMasterDrv->Receive(recvData,rxLen);
osEventFlagsWait(gMasterTransferDoneFlag, MASTER_TRANSFER_DONE_FLAG, osFlagsWaitAll, 5);
scs(1);
return (uint32_t)rxLen;
}
static uint32_t cecs_data_send(uint8_t *sendData,uint16_t sendLen)
{
//ch390_write_mem(sendData, sendLen);
scs(0);
spi_exchange_byte(OPC_MEM_WRITE);
spiMasterDrv->Send(sendData,sendLen);
osEventFlagsWait(gMasterTransferDoneFlag, MASTER_TRANSFER_DONE_FLAG, osFlagsWaitAll, 5);
scs(1);
while(ch390_read_reg(CH390_TCR) & TCR_TXREQ){};
// Set current packet length
ch390_write_reg(CH390_TXPLL, sendLen & 0xff);
ch390_write_reg(CH390_TXPLH, (sendLen >> 8) & 0xff);
// Issue transmit request
ch390_send_request();
return 0;
}
static int32_t CECS_masterHwInit(void)
{
int32_t ret = ARM_DRIVER_OK;
#if CECS_BUS_SPEED > 4000000
apmuVoteToDozeState(PMU_DOZE_SPI_MOD, false);
CLOCK_clockEnable(CLK_HF102M);
CLOCK_setClockSrc(CLK_APB_MP, CLK_APB_MP_SEL_102M);
// Switch clock before spi init
CLOCK_clockEnable(CLK_HF612M);
CLOCK_setClockSrc(FCLK_SPI0, FCLK_SPI0_SEL_612M);
#endif
// Initialize master spi
ret = spiMasterDrv->Initialize(CECS_masterCallback);
#ifdef CECS_MASTER_LOG_ENABLE
ECPLAT_PRINTF(UNILOG_PLA_APP, CECS_masterHwInit_0, P_DEBUG, "CECS_masterHwInit, init retCode: %d", ret);
#endif
if(ret != ARM_DRIVER_OK)
return ret;
// Power on
ret = spiMasterDrv->PowerControl(ARM_POWER_FULL);
#ifdef CECS_MASTER_LOG_ENABLE
ECPLAT_PRINTF(UNILOG_PLA_APP, CECS_masterHwInit_1, P_DEBUG, "CECS_masterHwInit, powerctl retCode: %d", ret);
#endif
if(ret != ARM_DRIVER_OK)
return ret;
// Configure spi bus
ret = spiMasterDrv->Control(ARM_SPI_MODE_MASTER | CECS_SPI_FRAME_FORMAT | ARM_SPI_DATA_BITS(8) |
ARM_SPI_MSB_LSB | ARM_SPI_SS_MASTER_SW, CECS_BUS_SPEED);
#ifdef CECS_MASTER_LOG_ENABLE
ECPLAT_PRINTF(UNILOG_PLA_APP, CECS_masterHwInit, P_DEBUG, "CECS_masterHwInit, retCode: %d", ret);
#endif
if(ret != ARM_DRIVER_OK)
return ret;
//spiMasterDrv->Control(ARM_SPI_SET_DEFAULT_TX_VALUE, 0xF0F0);
// INT pin(input)
APmuWakeupPadSettings_t wakeupPadSetting;
if(slpManGetLastSlpState() == SLP_ACTIVE_STATE)
{
wakeupPadSetting.negEdgeEn = false;
wakeupPadSetting.posEdgeEn = true;
wakeupPadSetting.pullDownEn = true;
wakeupPadSetting.pullUpEn = false;
NVIC_DisableIRQ(CECS_MASTER_INT_IRQ);
NVIC_ClearPendingIRQ(CECS_MASTER_INT_IRQ);
slpManSetWakeupPadCfg(CECS_MASTER_INT_PAD, true, &wakeupPadSetting);
}
return ret;
}
static void CECS_createMasterTransferTask(void)
{
if(gMasterTransferTriggerFlag)
{
return;
}
osThreadId_t threadId;
osThreadAttr_t task_attr;
//slpManRet_t ret = RET_TRUE;
gMasterTransferTriggerFlag = osEventFlagsNew(NULL);
EC_ASSERT(gMasterTransferTriggerFlag, gMasterTransferTriggerFlag, 0, 0);
// Enable wakeup IRQ when we're ready
NVIC_EnableIRQ(CECS_MASTER_INT_IRQ);
gMasterTransferDoneFlag = osEventFlagsNew(NULL);
EC_ASSERT(gMasterTransferDoneFlag, gMasterTransferDoneFlag, 0, 0);
memset(&task_attr,0,sizeof(task_attr));
memset(gMasterTransferTaskStack, 0xA5, MASTER_TRANSFER_TASK_STACK_SIZE);
task_attr.name = "cecs master";
task_attr.stack_mem = gMasterTransferTaskStack;
task_attr.stack_size = MASTER_TRANSFER_TASK_STACK_SIZE;
task_attr.priority = osPriorityNormal2;
task_attr.cb_mem = &gMasterTransferTask;//task control block
task_attr.cb_size = sizeof(StaticTask_t);//size of task control block
threadId = osThreadNew(CECS_masterTransferTaskEntry, NULL, &task_attr);
EC_ASSERT(threadId, threadId, 0, 0);
}
PLAT_FM_RAMCODE static void CECS_masterTransferTaskEntry(void *arg)
{
SpiDevConf_t spiDevConf = {
#if (RTE_EOS_EN == 1)
.mainUsage = CSIO_DT_ETH,
.custFlags = CSIO_OCF_SPITEST,
#else
.mainUsage = CSIO_DT_AT,
.custFlags = CSIO_OCF_SPITEST,
#endif
.bmCreateFlag = CCIO_TASK_FLAG_RX | CCIO_TASK_FLAG_TX2,
.rbufFlags = CUST_RBUF_FOR_SPI
};
int32_t errCode = CCIO_EOK;
#ifdef CECS_MASTER_LOG_ENABLE
uint32_t loop = 0;
#endif
uint8_t int_status = 0;
uint32_t eventFlags = 0;
uint32_t txNum = 0;
uint32_t rxPayLoadLen = 0;
uint8_t linkChgStatus = LINK_CHG_IDLE;
uint32_t eventTimeout = osWaitForever;
uint8_t* rxBuffer = NULL, *rxNewBuffer = NULL, *txPtr = NULL;
initMsgHdr_t *spicInitPtr = NULL;
CcioBufDesc_t txBufDesc;
errCode = spiDevCreate(CECS_DEVICE_INDEX, &spiDevConf);
EC_ASSERT(errCode == CCIO_EOK, errCode, 0, 0);
// alloc rx buffer
rxBuffer = spiDevTryGetRxBuf(CECS_DEVICE_INDEX, 0);
EC_ASSERT(rxBuffer, rxBuffer, 0, 0);
uint8_t vidl = ch390_read_reg(CH390_VIDL);
uint8_t vidh = ch390_read_reg(CH390_VIDH);
uint8_t pidl = ch390_read_reg(CH390_PIDL);
uint8_t pidh = ch390_read_reg(CH390_PIDH);
ECPLAT_PRINTF(UNILOG_PLA_APP, CECS_masterTransferTaskEntry_003, P_WARNING, "CH390 vid[%x%x] pid[%x%x]", vidh,vidl,pidh,pidl);
while(1)
{
#ifdef CECS_MASTER_LOG_ENABLE
ECPLAT_PRINTF(UNILOG_PLA_APP, CECS_masterTransferTaskEntry_0, P_WARNING, "master transfer task loop: %d", loop++);
#endif
eventFlags = 0;
switch(linkChgStatus)
{
case LINK_CHG_IDLE:
{
spicInitPtr = (initMsgHdr_t*)(rxBuffer + CCIO_SPI_FRAME_HDR_SIZE);
spicInitPtr->magic = 0x43495053;/* 'C','I','P','S' */
spicInitPtr->type = 0x0402;/*SPIC_NET_INITIAL_MSG*/
spicInitPtr->len = sizeof(initMsgHdr_t);
spicInitPtr->rsvd = 0;
rxNewBuffer = spiDevTryGetRxBuf(CECS_DEVICE_INDEX, spicInitPtr->len);
if(rxNewBuffer)
{
spiDevInput(CECS_DEVICE_INDEX, spicInitPtr->len, 0);
rxBuffer = rxNewBuffer;
linkChgStatus = LINK_CHG_INITIALIZING;
}
}
break;
case LINK_CHG_RESET:
{
spicInitPtr = (initMsgHdr_t*)(rxBuffer + CCIO_SPI_FRAME_HDR_SIZE);
spicInitPtr->magic = 0x43495053;/* 'C','I','P','S' */
spicInitPtr->type = 0x0401;/*SPIC_NET_RESET_MSG*/
spicInitPtr->len = sizeof(initMsgHdr_t);
spicInitPtr->rsvd = 0;
rxNewBuffer = spiDevTryGetRxBuf(CECS_DEVICE_INDEX, spicInitPtr->len);
if(rxNewBuffer)
{
spiDevInput(CECS_DEVICE_INDEX, spicInitPtr->len, 0);
rxBuffer = rxNewBuffer;
linkChgStatus = LINK_CHG_DE_INITIALIZING;
}
}
break;
default:
break;
}
// Poll tx list to check if we have something to send
CHECK_TX:
errCode = spiDevPickTxBuf(CECS_DEVICE_INDEX, &txBufDesc);
if((errCode == CCIO_EFOUND) && (eventFlags == 0))
{
// tx list is empty, wait for tx or rx trigger
eventFlags = osEventFlagsWait(gMasterTransferTriggerFlag, MASTER_TRANSFER_TRIGGER_FLAG, osFlagsWaitAny, eventTimeout);
//EC_ASSERT((eventFlags & MASTER_TRANSFER_TRIGGER_FLAG) != 0, eventFlags, 0 , 0);
if(osErrorTimeout == eventFlags)
{
uint8_t gpr = ch390_read_reg(CH390_GPR);
ECPLAT_PRINTF(UNILOG_PLA_APP, CECS_masterTransferTaskEntry_001, P_WARNING, "CH390 REG GPR [0x%x]", gpr);
uint8_t imr = ch390_read_reg(CH390_IMR);
ECPLAT_PRINTF(UNILOG_PLA_APP, CECS_masterTransferTaskEntry_002, P_WARNING, "CH390 REG IMR [0x%x]", imr);
if(gpr == 0x01 && imr == 0x00)
{
ch390_default_config();
}
}
if(eventFlags & MASTER_TRANSFER_TX_FLAG)
{
goto CHECK_TX;
}
}
else if(errCode == CCIO_EOK)
{
// noise suppress
osEventFlagsClear(gMasterTransferTriggerFlag, MASTER_TRANSFER_TX_FLAG);
txPtr = (txBufDesc.buf + CCIO_SPI_FRAME_HDR_SIZE);
txNum = txBufDesc.len - CCIO_SPI_FRAME_HDR_SIZE;
spicInitPtr = (initMsgHdr_t*)txPtr;//(initMsgHdr_t*)txBufDesc.buf;
if(spicInitPtr->magic == 0x43495053/**/)
{
#ifdef CECS_MASTER_LOG_ENABLE
ECPLAT_PRINTF(UNILOG_PLA_APP, CECS_masterTransferTaskEntry_01, P_WARNING, "spic rsp type[0x%x]", spicInitPtr->type);
#endif
switch(spicInitPtr->type)
{
case 0x8402/*SPIC_NET_INITIAL_CMPLT*/:
linkChgStatus = LINK_CHG_LINK_UP;
break;
case 0x8401/*SPIC_NET_RESET_CMPLT*/:
linkChgStatus = LINK_CHG_LINK_DOWN;
break;
default:
break;
}
spiDevFreeTxBuf(CECS_DEVICE_INDEX, txBufDesc.buf);
txNum = 0;
goto CHECK_TX;
}
#ifdef CECS_MASTER_LOG_ENABLE
ECPLAT_DUMP(UNILOG_PLA_APP, CECS_masterTransferTaskEntry_2, P_WARNING, "master tx dump:", txNum, txPtr);
#endif
}
spiMasterDrv->Control(ARM_SPI_PURGE_COMM, 0);
if(txNum != 0)
{
cecs_data_send(txPtr, (uint16_t)txNum);
spiDevFreeTxBuf(CECS_DEVICE_INDEX, txBufDesc.buf);
txNum = 0;
}
int_status = ch390_get_int_status();
#ifdef CECS_MASTER_LOG_ENABLE
ECPLAT_PRINTF(UNILOG_PLA_APP, CECS_masterTransferTaskEntry_3, P_WARNING, "int_status [0x%x]", int_status);
#endif
if(int_status & ISR_LNKCHG)
{
osDelay(100);
ch390_write_phy(0x1f,0);
while(ch390_read_phy(0x1e));
if(ch390_get_link_status())
{
#ifdef CECS_MASTER_LOG_ENABLE
ECPLAT_PRINTF(UNILOG_PLA_APP, CECS_masterTransferTaskEntry_4, P_WARNING, "Link up");
#endif
linkChgStatus = (linkChgStatus >= LINK_CHG_RESET ? LINK_CHG_IDLE : linkChgStatus);
ch390_write_reg(CH390_ISR,ISR_LNKCHG);
eventTimeout = osWaitForever;
}
else
{
ECPLAT_PRINTF(UNILOG_PLA_APP, CECS_masterTransferTaskEntry_5, P_WARNING, "Link failed");
eventTimeout = CECSTIMEOUT_AFTER_LINK_CHG;
linkChgStatus = LINK_CHG_RESET;
}
}
if(int_status & ISR_ROS)
{
#ifdef CECS_MASTER_LOG_ENABLE
ECPLAT_PRINTF(UNILOG_PLA_APP, CECS_masterTransferTaskEntry_6, P_WARNING, "receive overflow");
#endif
}
if(int_status & ISR_ROO)
{
#ifdef CECS_MASTER_LOG_ENABLE
ECPLAT_PRINTF(UNILOG_PLA_APP, CECS_masterTransferTaskEntry_7, P_WARNING, "Overflow counter overflow");
#endif
}
if(int_status & ISR_PR)
{
do
{
rxPayLoadLen = cecs_data_reveive(rxBuffer + CCIO_SPI_FRAME_HDR_SIZE);
if(rxPayLoadLen)
{
#ifdef CECS_MASTER_LOG_ENABLE
ECPLAT_DUMP(UNILOG_PLA_APP, CECS_masterTransferTaskEntry_8, P_WARNING, "master rx dump:", rxPayLoadLen, rxBuffer + CCIO_SPI_FRAME_HDR_SIZE);
#endif
rxNewBuffer = spiDevTryGetRxBuf(CECS_DEVICE_INDEX, rxPayLoadLen);
if(rxNewBuffer)
{
spiDevInput(CECS_DEVICE_INDEX, rxPayLoadLen, 0);
rxBuffer = rxNewBuffer;
}
}
}while(rxPayLoadLen != 0);
}
}
}
/*----------------------------------------------------------------------------*
* GLOBAL FUNCTIONS *
*----------------------------------------------------------------------------*/
CECS_MASTER_INT_IRQ_ISR
{
#ifdef CECS_MASTER_LOG_ENABLE
ECPLAT_PRINTF(UNILOG_PLA_APP, CECS_masterIntIsr, P_WARNING, "master got INT");
#endif
if(gMasterTransferTriggerFlag)
{
osEventFlagsSet(gMasterTransferTriggerFlag, MASTER_TRANSFER_RX_FLAG);
}
}
void CECS_masterSendTrigger(void)
{
if(gMasterTransferTriggerFlag)
{
osEventFlagsSet(gMasterTransferTriggerFlag, MASTER_TRANSFER_TX_FLAG);
}
}
int32_t CECS_MasterInit(void)
{
int32_t ret = CECS_masterHwInit();
if(ret != ARM_DRIVER_OK)
return ret;
ch390_interface_register(ch390_interface);
ch390_hardware_reset();
ch390_default_config();
CECS_createMasterTransferTask();
return 0;
}
void CECS_MasterGpioInit(void)
{
slpManAONIOPowerOn();
PadConfig_t padConfig;
PAD_getDefaultConfig(&padConfig);
padConfig.mux = CECS_MASTER_RST_PAD_ALT_FUNC;
PAD_setPinConfig(CECS_MASTER_RST_PAD_INDEX, &padConfig);
GpioPinConfig_t config;
config.pinDirection = GPIO_DIRECTION_OUTPUT;
config.misc.initOutput = 1; // Pull down SRDY for init state
GPIO_pinConfig(CECS_MASTER_RST_GPIO_INSTANCE, CECS_MASTER_RST_GPIO_INDEX, &config);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
SUBSYS_HOST_DIRS := $(TOP)/PLAT/subsys
CFLAGS += -DARM_MATH_CM3
CFLAGS_INC += -I $(CROSS_COMPILE)/../../PACK/ARM/CMSIS/5.0.1/CMSIS/include
ifeq ($(SUBSYS_OPENHAL_ENABLE),y)
include $(TOP)/PLAT/subsys/openhal/Makefile.inc
endif

View File

@ -0,0 +1,10 @@
CFLAGS += -DFEATURE_SUBSYS_OPENHAL_ENABLE \
-DFEATURE_OPENHAL_RTOS_ENABLE
ifeq ($(SUBSYS_OPENHAL_ETHERNET_ENABLE),y)
include $(TOP)/PLAT/subsys/openhal/dev/ethernet/Makefile.inc
endif
ifeq ($(SUBSYS_OPENHAL_MIFI_ENABLE),y)
include $(TOP)/PLAT/subsys/openhal/dev/mifi/Makefile.inc
endif

View File

@ -0,0 +1,837 @@
/********************************** (C) COPYRIGHT *******************************
* File Name : CH390.c
* Author : WCH
* Version : V1.0
* Date : 2023/05/30
* Description : CH390 Ethernet controller source file
*******************************************************************************/
#include "CH390.h"
ch390_interface_t ch390_if;
void ch390_interface_register(ch390_interface_t interface)
{
ch390_if = interface;
}
#ifdef CH390_INTERFACE_SPI
#define ch390_spi_dummy_read() ch390_if.spi_exc_data(0)
/**
* @name ch390_read_reg
* @brief Read register
* @param reg - Target register address
* @return Register value
*/
uint8_t ch390_read_reg(uint8_t reg)
{
uint8_t spi_data;
ch390_if.scs(0); // CS = 0
ch390_if.spi_exc_data(reg | OPC_REG_R);
spi_data = ch390_spi_dummy_read();
ch390_if.scs(1); // CS = 1
return spi_data;
}
/**
* @name ch390_write_reg
* @brief Write register
* @param reg - Target register address
* @param value - Value to be written
*/
void ch390_write_reg(uint8_t reg, uint8_t value)
{
ch390_if.scs(0); // CS = 0
ch390_if.spi_exc_data(reg | OPC_REG_W);
ch390_if.spi_exc_data(value);
ch390_if.scs(1); // CS = 1
return;
}
/**
* @name ch390_read_mem
* @brief Read data from RX SRAM
* @param data - Data buffer
* @param length - Length to read
*/
void ch390_read_mem(uint8_t *data, int length)
{
int i;
ch390_if.scs(0);
ch390_if.spi_exc_data(OPC_MEM_READ);
for(i = 0; i < length; i++) {
data[i] = ch390_spi_dummy_read();
}
ch390_if.scs(1);
}
/**
* @name ch390_write_mem
* @brief Write data to TX SRAM
* @param data - Data buffer
* @param length - Length to write
*/
void ch390_write_mem(uint8_t *data, int length)
{
int i;
ch390_if.scs(0);
ch390_if.spi_exc_data(OPC_MEM_WRITE);
for(i = 0; i < length; i++) {
ch390_if.spi_exc_data(data[i]);
}
ch390_if.scs(1);
}
#else
/**
* @name ch390_read_reg
* @brief Read register
* @param reg - Target register address
* @return Register value
*/
uint8_t ch390_read_reg(uint8_t reg)
{
uint8_t data;
// Set index
ch390_if.cs(0);
ch390_if.cmd(0);
ch390_if.wrb(0);
ch390_if.ll_write(reg);
ch390_if.wrb(1);
ch390_if.cmd(1);
// Read data
ch390_if.ll_ioinput();
ch390_if.rdb(0);
data = (uint8_t)(ch390_if.ll_read());
ch390_if.rdb(1);
ch390_if.cs(1);
return data;
}
/**
* @name ch390_write_reg
* @brief Write register
* @param reg - Target register address
* @param value - Value to be written
*/
void ch390_write_reg(uint8_t reg, uint8_t value)
{
// Set index
ch390_if.cs(0);
ch390_if.cmd(0);
ch390_if.wrb(0);
ch390_if.ll_write(reg);
ch390_if.wrb(1);
ch390_if.cmd(1);
// Write data
ch390_if.wrb(0);
ch390_if.ll_write(value);
ch390_if.wrb(1);
ch390_if.cs(1);
}
void set_index(uint16_t reg)
{
ch390_if.cs(0);
ch390_if.cmd(0);
ch390_if.wrb(0);
ch390_if.ll_write(reg);
ch390_if.wrb(1);
ch390_if.cmd(1);
ch390_if.cs(1);
}
#ifdef CH390_INTERFACE_8_BIT
/**
* @name ch390_read_mem
* @brief Read data from RX SRAM
* @param data - Data buffer
* @param length - Length to read
*/
void ch390_read_mem(uint8_t *data, int length)
{
int i;
set_index(CH390_MRCMD);
ch390_if.ll_ioinput();
ch390_if.cs(0);
for(i = 0; i < length; i++) {
ch390_if.rdb(0);
data[i] = ch390_if.ll_read();
ch390_if.rdb(1);
}
ch390_if.cs(1);
}
/**
* @name ch390_write_mem
* @brief Write data to TX SRAM
* @param data - Data buffer
* @param length - Length to write
*/
void ch390_write_mem(uint8_t *data, int length)
{
int i;
set_index(CH390_MWCMD);
ch390_if.cs(0);
for(i = 0; i < length; i++) {
ch390_if.wrb(0);
ch390_if.ll_write(data[i]);
ch390_if.wrb(1);
}
ch390_if.cs(1);
}
#endif // CH390_INTERFACE_8_BIT
#ifdef CH390_INTERFACE_16_BIT
void ch390_read_mem(uint8_t *data, int length)
{
int i;
uint16_t *data_w = (uint16_t *)data;
length = (length + 1) / 2;
set_index(CH390_MRCMD);
ch390_if.ll_ioinput();
ch390_if.cs(0);
for(i = 0; i < length; i++) {
ch390_if.rdb(0);
data_w[i] = ch390_if.ll_read();
ch390_if.rdb(1);
}
ch390_if.cs(1);
}
void ch390_write_mem(uint8_t *data, int length)
{
int i;
uint16_t *data_w = (uint16_t *)data;
length = (length + 1) / 2;
set_index(CH390_MWCMD);
ch390_if.cs(0);
for(i = 0; i < length; i++) {
ch390_if.wrb(0);
ch390_if.ll_write(data_w[i]);
ch390_if.wrb(1);
}
ch390_if.cs(1);
}
#endif // CH390_INTERFACE_16_BIT
#endif // CH390_INTERFACE_SPI
/**
* @name ch390_receive_packet
* @brief Receive packet
* @param buff - Size equal to CH390_PKT_MAX
* @param rx_status - Output abnormal status while receiving packet.
* It has the same meaning as RSR(06h).
* @return Packet length
*/
uint32_t ch390_receive_packet(uint8_t *buff, uint8_t *rx_status)
{
uint8_t rx_ready;
uint16_t rx_len = 0;
uint8_t ReceiveData[4];
// Check packet ready or not
ch390_read_reg(CH390_MRCMDX);
rx_ready = ch390_read_reg(CH390_MRCMDX);
// if rxbyte != 1 or 0 reset device
if (rx_ready & CH390_PKT_ERR)
{
// Reset RX FIFO pointer
ch390_write_reg(CH390_RCR, 0); //RX disable
ch390_write_reg(CH390_MPTRCR, 0x01); //Reset RX FIFO pointer
ch390_write_reg(CH390_MRRH, 0x0c);
ch390_if.delay_us(1000);
ch390_write_reg(CH390_RCR, RCR_RXEN); //RX Enable
return 0;
}
if (!(rx_ready & CH390_PKT_RDY))
{
return 0;
}
ch390_read_mem(ReceiveData, 4);
*rx_status = ReceiveData[1];
rx_len = ReceiveData[2] | (ReceiveData[3] << 8);
if(rx_len <= CH390_PKT_MAX)
{
ch390_read_mem(buff, rx_len);
}
if ((*rx_status & 0x3f) || (rx_len > CH390_PKT_MAX))
{
return 0;
}
return rx_len;
}
/**
* @name ch390_send_packet
* @brief Send packet
* @param buff - Data to be sent
* @param length - Less than 3k bytes.
*/
void ch390_send_packet(uint8_t *buff, uint16_t length)
{
// Write data to SRAM
ch390_write_mem(buff, length);
// Wait until last transmit complete
while(ch390_read_reg(CH390_TCR) & TCR_TXREQ);
// Set current packet length
ch390_write_reg(CH390_TXPLL, length & 0xff);
ch390_write_reg(CH390_TXPLH, (length >> 8) & 0xff);
// Issue transmit request
ch390_send_request();
}
/**
* @name ch390_send_request
* @brief Issue transmit request
*/
void ch390_send_request()
{
uint8_t tcr = ch390_read_reg(CH390_TCR);
ch390_write_reg(CH390_TCR, tcr | TCR_TXREQ);
}
/**
* @name ch390_drop_packet
* @brief Drop packet in RX SRAM if don't want to read it. This function
* modify the memory data read pointer and skip specified length
* @param len - Skip length, length of the current packet.
*/
void ch390_drop_packet(uint16_t len)
{
uint16_t mdr = ch390_read_reg(CH390_MRRL) | (ch390_read_reg(CH390_MRRH) << 8);
#ifdef CH390_INTERFACE_16_BIT
mdr = mdr + (len + 1) / 2 * 2;
#else
mdr = mdr + len;
#endif
mdr = mdr < 0x4000 ? mdr : mdr - 0x3400;
ch390_write_reg(CH390_MRRL, mdr & 0xff);
ch390_write_reg(CH390_MRRH, (mdr >> 8) & 0xff);
}
/**
* @name ch390_read_phy
* @brief Read PHY register
* @param reg - PHY register address
*/
uint16_t ch390_read_phy(uint8_t reg)
{
ch390_write_reg(CH390_EPAR, CH390_PHY | reg);
// Chose PHY, send read command
ch390_write_reg(CH390_EPCR, EPCR_ERPRR | EPCR_EPOS);
ch390_if.delay_us(100);
// Clear read command
ch390_write_reg(CH390_EPCR, 0x00);
return (ch390_read_reg(CH390_EPDRH) << 8) |
(ch390_read_reg(CH390_EPDRL) & 0xFF);
}
/**
* @name ch390_write_phy
* @brief Write PHY register
* @param reg - PHY register address
* @param value - Value to be written
*/
void ch390_write_phy(uint8_t reg, uint16_t value)
{
ch390_write_reg(CH390_EPAR, CH390_PHY | reg);
ch390_write_reg(CH390_EPDRL, (value & 0xff)); // Low byte
ch390_write_reg(CH390_EPDRH, ((value >> 8) & 0xff)); // High byte
// Chose PHY, send write command
ch390_write_reg(CH390_EPCR, 0x0A);
ch390_if.delay_us(100);
// Clear write command
ch390_write_reg(CH390_EPCR, 0x00);
}
/**
* @name ch390_write_eeprom
* @brief Write EEPROM register
* @param reg - EEPROM register address
* @param value - Value to be written
*/
void ch390_write_eeprom(uint8_t reg, uint16_t value)
{
ch390_write_reg(CH390_EPAR, reg);
ch390_write_reg(CH390_EPDRL, (value & 0xff)); // Low byte
ch390_write_reg(CH390_EPDRH, ((value >> 8) & 0xff)); // High byte
// Chose EEPROM, send write command
ch390_write_reg(CH390_EPCR, EPCR_ERPRW);
// Clear write command
while(ch390_read_reg(CH390_EPCR) & 0x01);
// Clear write command
ch390_write_reg(CH390_EPCR, 0x00);
}
/**
* @name ch390_software_reset
* @brief Software reset CH390 by NCR
*/
void ch390_software_reset()
{
ch390_write_reg(CH390_NCR, NCR_RST);
ch390_if.delay_us(10);
ch390_write_reg(CH390_NCR, 0);
ch390_write_reg(CH390_NCR, NCR_RST);
ch390_if.delay_us(10);
}
/**
* @name ch390_hardware_reset
* @brief Hardware reset CH390 by pull down RSTB pin
*/
void ch390_hardware_reset()
{
ch390_if.rst(0);
ch390_if.delay_us(10);
ch390_if.rst(1);
ch390_if.delay_us(10000);
}
/**
* @name ch390_default_config
* @brief Config CH390 with default options:
* LED mode 1;
* Enable transmit check sum generation;
* Enable RX;
* Enable all interrupt and PAR
*/
void ch390_default_config()
{
// MAC address
// uint8_t mac_addr[6] = { 0x50, 0x54, 0x7B, 0x84, 0x00, 0x73 };
// Multicast address hash table
uint8_t multicase_addr[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
ch390_set_phy_mode(CH390_AUTO);
// Clear status
ch390_write_reg(CH390_NSR, NSR_WAKEST | NSR_TX2END | NSR_TX1END);
ch390_write_reg(CH390_ISR, 0xFF); // Clear interrupt status
ch390_write_reg(CH390_TCR2, 0x80); // LED mode 1
ch390_write_reg(CH390_TCSCR, TCSCR_ALL); // Enable check sum generation
// ch390_set_mac_address(mac_addr);
ch390_set_multicast(multicase_addr);
// Enable all interrupt and PAR
ch390_write_reg(CH390_IMR, IMR_ALL);
// Enable RX
ch390_write_reg(CH390_RCR, RCR_RXEN);
}
/**
* @name ch390_set_phy_mode
* @brief Set PHY mode and enable PHY.
* PHY mode: Auto-negotiation, 10M/100M, full-duplex/half-duplex
* @param mode - PHY mode
*/
void ch390_set_phy_mode(enum ch390_phy_mode mode)
{
uint16_t BMCR_value = 0;
uint16_t ANAR_value = 0;
switch (mode)
{
case CH390_10MHD:
BMCR_value = 0x1000;
ANAR_value = 0x21;
break;
case CH390_10MFD:
BMCR_value = 0x1100;
ANAR_value = 0x41;
break;
case CH390_100MHD:
BMCR_value = 0x3000;
ANAR_value = 0x81;
break;
case CH390_100MFD:
BMCR_value = 0x3100;
ANAR_value = 0x101;
break;
case CH390_AUTO:
BMCR_value = 0x1000;
ANAR_value = 0x01E1;
break;
}
ch390_write_phy(CH390_PHY_BMCR, BMCR_value);
ch390_write_phy(CH390_PHY_ANAR, ANAR_value);
ch390_write_reg(CH390_GPR, 0x00); // Enable PHY
}
/**
* @name ch390_set_mac_address
* @brief Set mac address
* @param mac_addr - 6-byte length mac address array
*/
void ch390_set_mac_address(uint8_t *mac_addr)
{
uint8_t i;
for (i = 0; i < 6; i++)
{
ch390_write_reg(CH390_PAR + i, mac_addr[i]);
}
}
/**
* @name ch390_set_multicast
* @brief Set multicast address hash table
* @param multicast_addr - 8-byte length multicast address hash table array
*/
void ch390_set_multicast(uint8_t *multicast_hash)
{
uint8_t i;
for (i = 0; i < 8; i++)
{
ch390_write_reg(CH390_MAR + i, multicast_hash[i]);
}
}
/**
* @brief reflect an 8bit value.
* Only for "ch390_compute_hash_bit"
*/
static uint8_t reflect_8(uint8_t val)
{
uint8_t resVal = 0;
for (int i = 0; i < 8; i++)
{
if ((val & (1 << i)) != 0)
{
resVal |= 1 << (7 - i);
}
}
return resVal;
}
/**
* @brief Calculate the corresponding hash bit of the MAC address.
* Only for "ch390_set_hash_bit"
* @param mac - Destination address
* @return Hash bit number
*/
static uint8_t ch390_compute_hash_bit(uint8_t *mac)
{
const uint32_t poly = 0x4C11DB7;
uint32_t crc = 0xffffffff;
int byte_i = 0;
for(byte_i = 0; byte_i < 6; byte_i++)
{
uint8_t cur_byte = reflect_8(mac[byte_i]);
crc ^= cur_byte << 24;
for (int i = 0; i < 8; i++)
{
if ((crc & 0x80000000) != 0)
{
crc = (crc << 1) ^ poly;
}
else
{
crc <<= 1;
}
}
}
return (crc ^ 0xffffffff) >> 26;
}
/**
* @brief Set MAR bit for a particular MAC address
* @param mac - Destination address
*/
void ch390_set_hash_bit(uint8_t *mac)
{
uint8_t bit = ch390_compute_hash_bit(mac);
uint8_t mar = CH390_MAR + bit / 8;
uint8_t mar_val = ch390_read_reg(mar);
mar_val |= 1 << (bit % 8);
ch390_write_reg(mar, mar_val);
}
/**
* @name ch390_get_mac
* @brief Get mac address
* @param mac_addr - 6-byte length mac address output
*/
void ch390_get_mac(uint8_t *mac_addr)
{
uint8_t i;
for (i = 0; i < 6; i++)
{
mac_addr[i] = ch390_read_reg(CH390_PAR + i);
}
}
/**
* @name ch390_get_multicast
* @brief Get multicast address hash table
* @param multicast_addr - 8-byte length multicast address hash table output
*/
void ch390_get_multicast(uint8_t *multicast_hash)
{
uint8_t i;
for (i = 0; i < 8; i++)
{
multicast_hash[i] = ch390_read_reg(CH390_MAR + i);
}
}
/**
* @name ch390_get_vendor_id
* @brief Get vendor ID
* @return Vendor ID
*/
uint16_t ch390_get_vendor_id()
{
uint16_t id;
id = (ch390_read_reg(CH390_VIDL) & 0xff);
id |= ch390_read_reg(CH390_VIDH) << 8;
return id;
}
/**
* @name ch390_get_product_id
* @brief Get product ID
* @return Product ID
*/
uint16_t ch390_get_product_id()
{
uint16_t id;
id = (ch390_read_reg(CH390_PIDL) & 0xff);
id |= ch390_read_reg(CH390_PIDH) << 8;
return id;
}
/**
* @name ch390_get_revision
* @brief Get chip revision
* @return Chip revision
*/
uint8_t ch390_get_revision()
{
return ch390_read_reg(CH390_CHIPR);
}
/**
* @name ch390_interrupt_config
* @brief Interrupt configuration
* @param mask - Interrupt to be enabled, see "CH390.h" IMR_xxx
*/
void ch390_interrupt_config(uint8_t mask)
{
ch390_write_reg(CH390_IMR, mask);
}
/**
* @name ch390_rx_enable
* @brief Enable or disable packet receive
* @param op - 0: disable 1: enable
*/
void ch390_rx_enable(int op)
{
uint8_t rcr = ch390_read_reg(CH390_RCR);
if(op == 0)
rcr &= ~RCR_RXEN;
else
rcr |= RCR_RXEN;
ch390_write_reg(CH390_RCR, rcr);
}
/**
* @name ch390_rx_filter_config
* @brief Configure receive filter.
* @param config - See "CH390.h" RCR_xxx
*/
void ch390_rx_filter_config(uint8_t config)
{
uint8_t rcr = ch390_read_reg(CH390_RCR) & RCR_RXEN;
ch390_write_reg(CH390_RCR, rcr | config);
}
/**
* @name ch390_wakeup_config
* @brief Enable or disable wakeup_function
* @param events - Events that trigger wakeup
* WCR_LINKEN - Link status change
* WCR_SAMPLEEN - Sample frame
* WCR_MAGICEN - Magic packet
* 0 - Disable wakeup function
*/
void ch390_wakeup_config(uint8_t events)
{
uint8_t ncr = ch390_read_reg(CH390_NCR);
if(events)
ncr |= NCR_WAKEEN;
else {
ncr &= ~NCR_WAKEEN;
}
ch390_write_reg(CH390_NCR, ncr);
ch390_write_reg(CH390_WCR, events);
}
/**
* @name ch390_wake_notify
* @brief Wait for Magic Packet or Sample Frame and discard all
* other packets.
* If the application needs to use Wake On LAN, call this
* function every time before MCU enters low power mode.
* An external interrupt signal is accessible on WOL pin
* when wake up event occurred.
*/
void ch390_wake_notify()
{
uint8_t ncr = ch390_read_reg(CH390_NCR);
ch390_write_reg(CH390_NCR, ncr ^ 0x10);
}
/**
* @name ch390_loop_back_enable
* @brief Enable loop back mode
* @param op - 0: disable 1: enable
*/
void ch390_loop_back_enable(int op)
{
uint8_t ncr = ch390_read_reg(CH390_NCR) & ~0x06;
if(op == 1) ncr |= NCR_LBK_MAC;
ch390_write_reg(CH390_NCR, ncr);
}
/**
* @name ch390_get_duplex_mode
* @brief Get current duplex mode of the internal PHY
* @return 0: Half-duplex 1: Full-duplex
*/
int ch390_get_duplex_mode()
{
return !!(ch390_read_reg(CH390_NCR) & NCR_FDX);
}
/**
* @name ch390_get_phy_speed
* @brief Get the speed of the internal PHY.
* Only valid after PHY linked
* @return 0: 100Mbps 1: 10Mbps
*/
int ch390_get_phy_speed()
{
return !!(ch390_read_reg(CH390_NSR) & NSR_SPEED);
}
/**
* @name ch390_get_link_status
* @brief Get link status of the internal PHY
* @return 0: Link failed 1: Link OK
*/
int ch390_get_link_status()
{
uint8_t nsr = ch390_read_reg(CH390_NSR);
return !!(nsr & NSR_LINKST);
}
/**
* @name ch390_sleep_control
* @brief Enter or exit sleep mode
* @param op - 0: Power up 1: Power down
*/
void ch390_sleep_control(int op)
{
if(op)
{
ch390_write_reg(CH390_SCCR, 0x01);
}
else
{
ch390_read_reg(CH390_RSCCR);
ch390_if.delay_us(100);
}
}
#ifndef CH390_INTERFACE_16_BIT
/**
* @name ch390_gpio_config
* @brief Config the input/output direction of GPIO1~3
* In 8-bit mode, GPIO4~6 are output only
* @param GPIOx - CH390_GPIO1 ~ CH390_GPIO3
* dir - 0: Input 1: Output
*/
void ch390_gpio_config(uint8_t GPIOx, uint8_t dir)
{
uint8_t gpcr = ch390_read_reg(CH390_GPCR);
if(dir)
{
gpcr |= GPIOx;
}
else {
gpcr &= ~GPIOx;
}
ch390_write_reg(CH390_GPCR, gpcr);
}
/**
* @name ch390_gpio_write_bit
* @brief Sets or clears the selected gpio bit.
* In SPI mode, only GPIO1~3 are available
* @param GPIOx - CH390_GPIO1 ~ CH390_GPIO6
* level - 0: Clear pin 1: Set pin
*/
void ch390_gpio_write_bit(uint8_t GPIOx, uint8_t level)
{
uint8_t gpr = ch390_read_reg(CH390_GPR);
if(level)
{
gpr |= GPIOx;
}
else {
gpr &= ~GPIOx;
}
ch390_write_reg(CH390_GPR, gpr);
}
/**
* @name ch390_gpio_read_bit
* @brief Read gpio input, only CH390_GPIO1 ~ 3 are available
* @param GPIOx - CH390_GPIO1 ~ CH390_GPIO3
* @return Input pin value
*/
uint8_t ch390_gpio_read_bit(uint8_t GPIOx)
{
uint8_t gpr = ch390_read_reg(CH390_GPR);
return !!(gpr & GPIOx);
}
#endif
/**
* @name ch390_int_pin_config
* @brief Configure INT pin output type and polarity
* @param type - INCR_TYPE_OD: Open drain output
* INCR_TYPE_PP: Push pull output
* pol - INCR_POL_L: Active low
* INCR_POL_H: Active high
*/
void ch390_int_pin_config(uint8_t type, uint8_t pol)
{
ch390_write_reg(CH390_INTCR, type | pol);
}
/**
* @name ch390_get_int_status
* @brief Get CH390 interrupt status and clear them
* @return Interrupt status
*/
uint8_t ch390_get_int_status()
{
uint8_t int_status = ch390_read_reg(CH390_ISR);
// Clear interrupt status by write 1
ch390_write_reg(CH390_ISR, int_status);
return int_status;
}

View File

@ -0,0 +1,704 @@
/********************************** (C) COPYRIGHT *******************************
* File Name : CH390.h
* Author : WCH
* Version : V1.0
* Date : 2023/05/23
* Description : CH390 Ethernet controller header file
*******************************************************************************/
#ifndef __CH390_H
#define __CH390_H
#include <stdint.h>
/********************************************************************
* Interface selection
*/
#define CH390_INTERFACE_SPI // CH390H
//#define CH390_INTERFACE_8_BIT // CH390L 8-bit mode
//#define CH390_INTERFACE_16_BIT // CH390L 16-bit mode
/********************************************************************
* Type definition
*/
/*
* Interface
* This structure defines CH390 operation interface (Parallel
* or SPI). User should implement one of them.
*/
#ifdef CH390_INTERFACE_SPI
typedef struct{
void (*rst)(uint8_t level); // RSTB pin
void (*delay_us)(uint32_t time); // Delay, unit: us
void (*scs)(uint8_t level); // SCS pin
// Exchange 1 byte data by write and read spi
uint8_t (*spi_exc_data)(uint8_t data);
}ch390_interface_t;
#else // CH390_INTERFACE_8_BIT
typedef struct{
void (*rst)(uint8_t level); // RSTB pin
void (*delay_us)(uint32_t time); // Delay, unit: us
void (*cs)(uint8_t level); // CS pin
void (*cmd)(uint8_t level); // CMD pin
void (*rdb)(uint8_t level); // RDB pin
void (*wrb)(uint8_t level); // WRB pin
void (*ll_ioinput)(); // Switch io to input mode
/* Both 8-bit and 16-bit mode share these two functions,
* just ignore the high byte in 8-bit mode */
uint16_t (*ll_read)(); // Read data
void (*ll_write)(uint16_t data); // Switch io to output mode and write data
}ch390_interface_t;
#endif
/* PHY mode definition */
enum ch390_phy_mode
{
CH390_10MHD, // 10M half-duplex
CH390_100MHD, // 100M half-duplex
CH390_10MFD, // 10M full-duplex
CH390_100MFD, // 100M full-duplex
CH390_AUTO, // Auto negotiation
};
/********************************************************************
* Register definition
*/
/**
* There are some differences between the register definitions of
* CH390H and CH390L
*/
#ifdef CH390_INTERFACE_SPI
#define CH390_NCR 0x00
#define NCR_WAKEEN (1<<6) // Enable wakeup function
#define NCR_FDX (1<<3) // Duplex mode of the internal PHY
#define NCR_LBK_MAC (1<<1) // MAC loop-back
#define NCR_RST (1<<0) // Softwate reset
#define CH390_NSR 0x01
#define NSR_SPEED (1<<7) // Speed of internal PHY
#define NSR_LINKST (1<<6) // Link status of internal PHY
#define NSR_WAKEST (1<<5) // Wakeup event status
#define NSR_TX2END (1<<3) // Tx packet B complete status
#define NSR_TX1END (1<<2) // Tx packet A complete status
#define NSR_RXOV (1<<1) // Rx fifo overflow
#define NSR_RXRDY (1<<0)
#define CH390_TCR 0x02
#define TCR_TJDIS (1<<6) // Transmit jabber timer
#define TCR_PAD_DIS2 (1<<4) // PAD appends for packet B
#define TCR_CRC_DIS2 (1<<3) // CRC appends for packet B
#define TCR_PAD_DIS1 (1<<2) // PAD appends for packet A
#define TCR_CRC_DIS1 (1<<1) // CRC appends for packet A
#define TCR_TXREQ (1<<0) // Tx request
#define CH390_TSRA 0x03
#define CH390_TSRB 0x04
#define TSR_TJTO (1<<7) // Transmit jabber time out
#define TSR_LC (1<<6) // Loss of carrier
#define TSR_NC (1<<5) // No carrier
#define TSR_LCOL (1<<4) // Late collision
#define TSR_COL (1<<3) // Collision packet
#define TSR_EC (1<<2) // Excessive collision
#define CH390_RCR 0x05
#define RCR_DEFAULT 0x00 // Default settings
#define RCR_WTDIS (1<<6) // Disable 2048 bytes watch dog
#define RCR_DIS_CRC (1<<4) // Discard CRC error packet
#define RCR_ALL (1<<3) // Pass all multicast
#define RCR_RUNT (1<<2) // Pass runt packet
#define RCR_PRMSC (1<<1) // Promiscuous mode
#define RCR_RXEN (1<<0) // Enable RX
#define CH390_RSR 0x06
#define RSR_RF (1<<7) // Rnt frame
#define RSR_MF (1<<6) // Multicast frame
#define RSR_LCS (1<<5) // Late collision seen
#define RSR_RWTO (1<<4) // Receive watchdog time-out
#define RSR_PLE (1<<3) // Physical layer error
#define RSR_AE (1<<2) // Alignment error
#define RSR_CE (1<<1) // CRC error
#define RSR_FOE (1<<0) // FIFO overflow error
#define CH390_ROCR 0x07
#define CH390_BPTR 0x08
#define CH390_FCTR 0x09
#define FCTR_HWOT(ot) (( ot & 0xf ) << 4)
#define FCTR_LWOT(ot) ( ot & 0xf )
#define CH390_FCR 0x0A
#define CH390_EPCR 0x0B
#define EPCR_REEP (1<<5) // Reload EEPROM
#define EPCR_WEP (1<<4) // Write EEPROM enable
#define EPCR_EPOS (1<<3) // EEPROM or PHY operation select
#define EPCR_ERPRR (1<<2) // EEPROM or PHY read command
#define EPCR_ERPRW (1<<1) // EEPROM or PHY write command
#define EPCR_ERRE (1<<0) // EEPROM or PHY access status
#define CH390_EPAR 0x0C
#define CH390_EPDRL 0x0D
#define CH390_EPDRH 0x0E
#define CH390_WCR 0x0F
#define WCR_LINKEN (1<<5) // Link status change wakeup
#define WCR_SAMPLEEN (1<<4) // Sample frame wakeup
#define WCR_MAGICEN (1<<3) // Magic packet wakeup
#define WCR_LINKST (1<<2) // Link status change event
#define WCR_SAMPLEST (1<<1) // Sample frame event
#define WCR_MAGICST (1<<0) // Magic packet event
#define CH390_PAR 0x10
#define CH390_MAR 0x16
#define CH390_GPCR 0x1E
#define CH390_GPR 0x1F
#define CH390_TRPAL 0x22
#define CH390_TRPAH 0x23
#define CH390_RWPAL 0x24
#define CH390_RWPAH 0x25
#define CH390_VIDL 0x28
#define CH390_VIDH 0x29
#define CH390_PIDL 0x2A
#define CH390_PIDH 0x2B
#define CH390_CHIPR 0x2C
#define CH390_TCR2 0x2D
#define CH390_ATCR 0x30
#define CH390_TCSCR 0x31
#define TCSCR_ALL 0x1F
#define TCSCR_IPv6TCPCSE (1<<4) // IPv6 TCP checksum generation
#define TCSCR_IPv6UDPCSE (1<<3) // IPv6 UDP checksum generation
#define TCSCR_UDPCSE (1<<2) // UDP checksum generation
#define TCSCR_TCPCSE (1<<1) // TCP checksum generation
#define TCSCR_IPCSE (1<<0) // IP checksum generation
#define CH390_RCSCSR 0x32
#define RCSCSR_UDPS (1<<7) // UDP checksum status
#define RCSCSR_TCPS (1<<6) // TCP checksum status
#define RCSCSR_IPS (1<<5) // IP checksum status
#define RCSCSR_UDPP (1<<4) // UDP packet of current received packet
#define RCSCSR_TCPP (1<<3) // TCP packet of current received packet
#define RCSCSR_IPP (1<<2) // IP packet of current received packet
#define RCSCSR_RCSEN (1<<1) // Receive checksum checking enable
#define RCSCSR_DCSE (1<<0) // Discard checksum error packet
#define CH390_MPAR 0x33
#define CH390_SBCR 0x38
#define CH390_INTCR 0x39
#define INCR_TYPE_OD 0x02
#define INCR_TYPE_PP 0x00
#define INCR_POL_L 0x01
#define INCR_POL_H 0x00
#define CH390_ALNCR 0x4A
#define CH390_SCCR 0x50
#define CH390_RSCCR 0x51
#define CH390_RLENCR 0x52
#define CH390_BCASTCR 0x53
#define CH390_INTCKCR 0x54
#define CH390_MPTRCR 0x55
#define CH390_MLEDCR 0x57
#define CH390_MRCMDX 0x70
#define CH390_MRCMDX1 0x71
#define CH390_MRCMD 0x72
#define CH390_MRRL 0x74
#define CH390_MRRH 0x75
#define CH390_MWCMDX 0x76
#define CH390_MWCMD 0x78
#define CH390_MWRL 0x7A
#define CH390_MWRH 0x7B
#define CH390_TXPLL 0x7C
#define CH390_TXPLH 0x7D
#define CH390_ISR 0x7E
#define ISR_LNKCHG (1<<5) // Link status change
#define ISR_ROO (1<<3) // Receive overflow counter overflow
#define ISR_ROS (1<<2) // Receive overflow
#define ISR_PT (1<<1) // Packet transmitted
#define ISR_PR (1<<0) // Packet received
#define CH390_IMR 0x7F
#define IMR_NONE 0x00 // Disable all interrupt
#define IMR_ALL 0xFF // Enable all interrupt
#define IMR_PAR (1<<7) // Pointer auto-return mode
#define IMR_LNKCHGI (1<<5) // Enable link status change interrupt
#define IMR_UDRUNI (1<<4) // Enable transmit under-run interrupt
#define IMR_ROOI (1<<3) // Enable receive overflow counter overflow interrupt
#define IMR_ROI (1<<2) // Enable receive overflow interrupt
#define IMR_PTI (1<<1) // Enable packet transmitted interrupt
#define IMR_PRI (1<<0) // Enable packet received interrupt
// SPI commands
#define OPC_REG_W 0x80 // Register Write
#define OPC_REG_R 0x00 // Register Read
#define OPC_MEM_DMY_R 0x70 // Memory Dummy Read
#define OPC_MEM_WRITE 0xF8 // Memory Write
#define OPC_MEM_READ 0x72 // Memory Read
// GPIO
#define CH390_GPIO1 0x02
#define CH390_GPIO2 0x04
#define CH390_GPIO3 0x08
#else
#define CH390_NCR 0x00
#define NCR_WAKEEN (1<<6) // Enable wakeup function
#define NCR_FDX (1<<3) // Duplex mode of the internal PHY
#define NCR_LBK_MAC (1<<1) // MAC loop-back
#define NCR_RST (1<<0) // Softwate reset
#define CH390_NSR 0x01
#define NSR_SPEED (1<<7) // Speed of internal PHY
#define NSR_LINKST (1<<6) // Link status of internal PHY
#define NSR_WAKEST (1<<5) // Wakeup event status
#define NSR_TX2END (1<<3) // Tx packet B complete status
#define NSR_TX1END (1<<2) // Tx packet A complete status
#define NSR_RXOV (1<<1) // Rx fifo overflow
#define CH390_TCR 0x02
#define TCR_TJDIS (1<<6) // Transmit jabber timer
#define TCR_PAD_DIS2 (1<<4) // PAD appends for packet B
#define TCR_CRC_DIS2 (1<<3) // CRC appends for packet B
#define TCR_PAD_DIS1 (1<<2) // PAD appends for packet A
#define TCR_CRC_DIS1 (1<<1) // CRC appends for packet A
#define TCR_TXREQ (1<<0) // Tx request
#define CH390_TSRA 0x03
#define CH390_TSRB 0x04
#define TSR_TJTO (1<<7) // Transmit jabber time out
#define TSR_LC (1<<6) // Loss of carrier
#define TSR_NC (1<<5) // No carrier
#define TSR_LCOL (1<<4) // Late collision
#define TSR_COL (1<<3) // Collision packet
#define TSR_EC (1<<2) // Excessive collision
#define CH390_RCR 0x05
#define RCR_DEFAULT 0x00 // Default settings
#define RCR_WTDIS (1<<6) // Disable 2048 bytes watch dog
#define RCR_DIS_CRC (1<<4) // Discard CRC error packet
#define RCR_ALL (1<<3) // Pass all multicast
#define RCR_RUNT (1<<2) // Pass runt packet
#define RCR_PRMSC (1<<1) // Promiscuous mode
#define RCR_RXEN (1<<0) // Enable RX
#define CH390_RSR 0x06
#define RSR_RF (1<<7) // Rnt frame
#define RSR_MF (1<<6) // Multicast frame
#define RSR_LCS (1<<5) // Late collision seen
#define RSR_RWTO (1<<4) // Receive watchdog time-out
#define RSR_PLE (1<<3) // Physical layer error
#define RSR_AE (1<<2) // Alignment error
#define RSR_CE (1<<1) // CRC error
#define RSR_FOE (1<<0) // FIFO overflow error
#define CH390_ROCR 0x07
#define CH390_BPTR 0x08
#define CH390_FCTR 0x09
#define FCTR_HWOT(ot) (( ot & 0xf ) << 4)
#define FCTR_LWOT(ot) ( ot & 0xf )
#define CH390_FCR 0x0A
#define CH390_EPCR 0x0B
#define EPCR_REEP (1<<5) // Reload EEPROM
#define EPCR_WEP (1<<4) // Write EEPROM enable
#define EPCR_EPOS (1<<3) // EEPROM or PHY operation select
#define EPCR_ERPRR (1<<2) // EEPROM or PHY read command
#define EPCR_ERPRW (1<<1) // EEPROM or PHY write command
#define EPCR_ERRE (1<<0) // EEPROM or PHY access status
#define CH390_EPAR 0x0C
#define CH390_EPDRL 0x0D
#define CH390_EPDRH 0x0E
#define CH390_WCR 0x0F
#define WCR_LINKEN (1<<5) // Link status change wakeup
#define WCR_SAMPLEEN (1<<4) // Sample frame wakeup
#define WCR_MAGICEN (1<<3) // Magic packet wakeup
#define WCR_LINKST (1<<2) // Link status change event
#define WCR_SAMPLEST (1<<1) // Sample frame event
#define WCR_MAGICST (1<<0) // Magic packet event
#define CH390_PAR 0x10
#define CH390_MAR 0x16
#define CH390_GPCR 0x1E
#define CH390_GPR 0x1F
#define CH390_TRPAL 0x22
#define CH390_TRPAH 0x23
#define CH390_RWPAL 0x24
#define CH390_RWPAH 0x25
#define CH390_VIDL 0x28
#define CH390_VIDH 0x29
#define CH390_PIDL 0x2A
#define CH390_PIDH 0x2B
#define CH390_CHIPR 0x2C
#define CH390_TCR2 0x2D
#define CH390_ETXCSR 0x30
#define CH390_TCSCR 0x31
#define TCSCR_ALL 0x1F
#define TCSCR_IPv6TCPCSE (1<<4) // IPv6 TCP checksum generation
#define TCSCR_IPv6UDPCSE (1<<3) // IPv6 UDP checksum generation
#define TCSCR_UDPCSE (1<<2) // UDP checksum generation
#define TCSCR_TCPCSE (1<<1) // TCP checksum generation
#define TCSCR_IPCSE (1<<0) // IP checksum generation
#define CH390_RCSCSR 0x32
#define RCSCSR_UDPS (1<<7) // UDP checksum status
#define RCSCSR_TCPS (1<<6) // TCP checksum status
#define RCSCSR_IPS (1<<5) // IP checksum status
#define RCSCSR_UDPP (1<<4) // UDP packet of current received packet
#define RCSCSR_TCPP (1<<3) // TCP packet of current received packet
#define RCSCSR_IPP (1<<2) // IP packet of current received packet
#define RCSCSR_RCSEN (1<<1) // Receive checksum checking enable
#define RCSCSR_DCSE (1<<0) // Discard checksum error packet
#define CH390_MPAR 0x33
#define CH390_LEDCR 0x34
#define CH390_INTCR 0x39
#define INCR_TYPE_OD 0x02
#define INCR_TYPE_PP 0x00
#define INCR_POL_L 0x01
#define INCR_POL_H 0x00
#define CH390_SCCR 0x50
#define CH390_RSCCR 0x51
#define CH390_RLENCR 0x52
#define CH390_BCASTCR 0x53
#define CH390_MPTRCR 0x55
#define CH390_MRCMDX 0xF0
#define CH390_MRCMDX1 0xF1
#define CH390_MRCMD 0xF2
#define CH390_MRRL 0xF4
#define CH390_MRRH 0xF5
#define CH390_MWCMDX 0xF6
#define CH390_MWCMD 0xF8
#define CH390_MWRL 0xFA
#define CH390_MWRH 0xFB
#define CH390_TXPLL 0xFC
#define CH390_TXPLH 0xFD
#define CH390_ISR 0xFE
#define ISR_IOMODE (1<<7) // Parallel interface mode
#define ISR_LNKCHG (1<<5) // Link status change
#define ISR_UDRUN (1<<4) // Transmit under-run
#define ISR_ROO (1<<3) // Receive overflow counter overflow
#define ISR_ROS (1<<2) // Receive overflow
#define ISR_PT (1<<1) // Packet transmitted
#define ISR_PR (1<<0) // Packet received
#define CH390_IMR 0xFF
#define IMR_NONE 0x00 // Disable all interrupt
#define IMR_ALL 0xFF // Enable all interrupt
#define IMR_PAR (1<<7) // Pointer auto-return mode
#define IMR_LNKCHGI (1<<5) // Enable link status change interrupt
#define IMR_UDRUNI (1<<4) // Enable transmit under-run interrupt
#define IMR_ROOI (1<<3) // Enable receive overflow counter overflow interrupt
#define IMR_ROI (1<<2) // Enable receive overflow interrupt
#define IMR_PTI (1<<1) // Enable packet transmitted interrupt
#define IMR_PRI (1<<0) // Enable packet received interrupt
// GPIO
#define CH390_GPIO1 0x02
#define CH390_GPIO2 0x04
#define CH390_GPIO3 0x08
#define CH390_GPIO4 0x10
#define CH390_GPIO5 0x20
#define CH390_GPIO6 0x40
#endif
// PHY registers
#define CH390_PHY 0x40
#define CH390_PHY_BMCR 0x00
#define CH390_PHY_BMSR 0x01
#define CH390_PHY_PHYID1 0x02
#define CH390_PHY_PHYID2 0x03
#define CH390_PHY_ANAR 0x04
#define CH390_PHY_ANLPAR 0x05
#define CH390_PHY_ANER 0x06
#define CH390_PHY_PAGE_SEL 0x1F
// Packet status
#define CH390_PKT_NONE 0x00 /* No packet received */
#define CH390_PKT_RDY 0x01 /* Packet ready to receive */
#define CH390_PKT_ERR 0xFE /* Un-stable states */
#define CH390_PKT_MAX 1536 /* Received packet max size */
#define CH390_PKT_MIN 64
/********************************************************************
* Functions
*/
/**
* @name ch390_interface_register
* @brief Register IO interface
* @param reg - The interface corresponding to the macro
* CH390_INTERFACE_xxx
*/
void ch390_interface_register(ch390_interface_t interface);
/**
* @name ch390_read_reg
* @brief Read register
* @param reg - Target register address
* @return Register value
*/
uint8_t ch390_read_reg(uint8_t reg);
/**
* @name ch390_write_reg
* @brief Write register
* @param reg - Target register address
* @param value - Value to be written
*/
void ch390_write_reg(uint8_t reg, uint8_t value);
/**
* @name ch390_read_mem
* @brief Read data from RX SRAM
* @param data - Data buffer
* @param length - Length to read
*/
void ch390_read_mem(uint8_t *data, int length);
/**
* @name ch390_write_mem
* @brief Write data to TX SRAM
* @param data - Data buffer
* @param length - Length to write
*/
void ch390_write_mem(uint8_t *data, int length);
/**
* @name ch390_receive_packet
* @brief Receive packet
* @param buff - Size equal to CH390_PKT_MAX
* @param rx_status - Output abnormal status while receiving packet.
* It has the same format as RSR(06h).
* @return Packet length
*/
uint32_t ch390_receive_packet(uint8_t *buff, uint8_t *rx_status);
/**
* @name ch390_send_packet
* @brief Send packet
* @param buff - Data to be sent
* @param length - Less than 3k bytes.
*/
void ch390_send_packet(uint8_t *buff, uint16_t length);
/**
* @name ch390_send_request
* @brief Issue transmit request
*/
void ch390_send_request(void);
/**
* @name ch390_drop_packet
* @brief Drop packet in RX SRAM if don't want to read it. This function
* modify the memory data read pointer and skip specified length
* @param len - Skip length, length of the current packet.
*/
void ch390_drop_packet(uint16_t len);
/**
* @name ch390_read_phy
* @brief Read PHY register
* @param reg - PHY register address
*/
uint16_t ch390_read_phy(uint8_t reg);
/**
* @name ch390_write_phy
* @brief Write PHY register
* @param reg - PHY register address
* @param value - Value to be written
*/
void ch390_write_phy(uint8_t reg, uint16_t value);
/**
* @name ch390_write_eeprom
* @brief Write EEPROM register
* @param reg - EEPROM register address
* @param value - Value to be written
*/
void ch390_write_eeprom(uint8_t reg, uint16_t value);
/**
* @name ch390_software_reset
* @brief Software reset CH390 by NCR
*/
void ch390_software_reset(void);
/**
* @name ch390_hardware_reset
* @brief Hardware reset CH390 by pull down RSTB pin
*/
void ch390_hardware_reset(void);
/**
* @name ch390_default_config
* @brief Config CH390 with default options:
* LED mode 1;
* Enable transmit check sum generation;
* Enable RX;
* Enable all interrupt and PAR
*/
void ch390_default_config(void);
/**
* @name ch390_set_phy_mode
* @brief Set PHY mode and enable PHY.
* PHY mode: Auto-negotiation, 10M/100M, full-duplex/half-duplex
* @param mode - PHY mode
*/
void ch390_set_phy_mode(enum ch390_phy_mode mode);
/**
* @name ch390_set_mac_address
* @brief Set mac address
* @param mac_addr - 6-byte length mac address array
*/
void ch390_set_mac_address(uint8_t *mac_addr);
/**
* @name ch390_set_multicast
* @brief Set multicast address hash table
* @param multicast_addr - 8-byte length multicast address hash table array
*/
void ch390_set_multicast(uint8_t *multicast_hash);
/**
* @brief Set MAR bit for a particular MAC address
* @param mac - Destination address
*/
void ch390_set_hash_bit(uint8_t *mac);
/**
* @name ch390_get_mac
* @brief Get mac address
* @param mac_addr - 6 bytes mac address output
*/
void ch390_get_mac(uint8_t *mac_addr);
/**
* @name ch390_get_multicast
* @brief Get multicast address hash table
* @param multicast_addr - 8-byte length multicast address hash table output
*/
void ch390_get_multicast(uint8_t *multicast_addr);
/**
* @name ch390_get_vendor_id
* @brief Get vendor ID
* @return Vendor ID
*/
uint16_t ch390_get_vendor_id(void);
/**
* @name ch390_get_product_id
* @brief Get product ID
* @return Product ID
*/
uint16_t ch390_get_product_id(void);
/**
* @name ch390_get_revision
* @brief Get chip revision
* @return Chip revision
*/
uint8_t ch390_get_revision(void);
/**
* @name ch390_interrupt_config
* @brief Interrupt configuration
* @param mask - Interrupt to be enabled, see "CH390.h" IMR_xxx
*/
void ch390_interrupt_config(uint8_t mask);
/**
* @name ch390_rx_enable
* @brief Enable or disable packet receive
* @param op - 0: disable 1: enable
*/
void ch390_rx_enable(int op);
/**
* @name ch390_rx_filter_config
* @brief Configure receive filter.
* @param config - See "CH390.h" RCR_xxx
*/
void ch390_rx_filter_config(uint8_t config);
/**
* @name ch390_wakeup_config
* @brief Enable or disable wakeup_function
* @param events - Events that trigger wakeup,
* WCR_LINKEN - Link status change
* WCR_SAMPLEEN - Sample frame
* WCR_MAGICEN - Magic packet
* 0 - Disable wakeup function
*/
void ch390_wakeup_config(uint8_t events);
/**
* @name ch390_wake_notify
* @brief Wait for Magic Packet or Sample Frame and discard all
* other packets.
* If the application needs to use Wake On LAN, call this
* function before MCU enters low power mode. An external
* interrupt signal is accessible on WOL pin when wake
* up event occurred.
*/
void ch390_wake_notify();
/**
* @name ch390_loop_back_enable
* @brief Enable loop back mode
* @param op - 0: disable 1: enable
*/
void ch390_loop_back_enable(int op);
/**
* @name ch390_get_duplex_mode
* @brief Get current duplex mode of the internal PHY
* @return 0: Half-duplex 1: Full-duplex
*/
int ch390_get_duplex_mode(void);
/**
* @name ch390_get_phy_speed
* @brief Get the speed of the internal PHY.
* Only valid after PHY linked
* @return 0: 100Mbps 1: 10Mbps
*/
int ch390_get_phy_speed(void);
/**
* @name ch390_get_link_status
* @brief Get link status of the internal PHY
* @return 0: Link failed 1: Link OK
*/
int ch390_get_link_status(void);
/**
* @name ch390_sleep_control
* @brief Enter or exit sleep mode
* @param op - 0: Power up 1: Power down
*/
void ch390_sleep_control(int op);
#ifndef CH390_INTERFACE_16_BIT
/**
* @name ch390_gpio_config
* @brief Config the input/output direction of GPIO1~3
* Only GPIO1~3 can be defined as input, GPIO4~6 are output only
* @param GPIOx - CH390_GPIO1 ~ CH390_GPIO3
* dir - 0: Input 1: Output
*/
void ch390_gpio_config(uint8_t GPIOx, uint8_t dir);
/**
* @name ch390_gpio_write_bit
* @brief Sets or clears the selected gpio bit.
* @param GPIOx - CH390_GPIO1 ~ CH390_GPIO6
* level - 0: Clear pin 1: Set pin
*/
void ch390_gpio_write_bit(uint8_t GPIOx, uint8_t level);
/**
* @name ch390_gpio_read_bit
* @brief Read gpio input, only CH390_GPIO1 ~ 3 are available
* @param GPIOx - CH390_GPIO1 ~ CH390_GPIO3
* @return Input pin value
*/
uint8_t ch390_gpio_read_bit(uint8_t GPIOx);
#endif
/**
* @name ch390_int_pin_config
* @brief Configure INT pin output type and polarity
* @param type - INCR_TYPE_OD: Open drain output
* INCR_TYPE_PP: Push pull output
* pol - INCR_POL_L: Active low
* INCR_POL_H: Active high
*/
void ch390_int_pin_config(uint8_t type, uint8_t pol);
/**
* @name ch390_get_int_status
* @brief Get CH390 interrupt status and clear them
* @return Interrupt status
*/
uint8_t ch390_get_int_status(void);
#endif /* __CH390_H */

View File

@ -0,0 +1,47 @@
SUBSYS_ETHERNET_DIR := $(TOP)/PLAT/subsys/openhal/dev/ethernet
CFLAGS_INC += -I $(SUBSYS_ETHERNET_DIR) \
SUBSYS_ETHERNET_SRC_DIRS += $(SUBSYS_ETHERNET_DIR)
SUBSYS_ETHERNET_EXCLUDE_FILES :=
SUBSYS_ETHERNET_CSRC = $(foreach dir, $(SUBSYS_ETHERNET_SRC_DIRS), $(wildcard $(dir)/*.c))
SUBSYS_ETHERNET_CFILES = $(filter-out $(SUBSYS_ETHERNET_EXCLUDE_FILES), $(SUBSYS_ETHERNET_CSRC))
SUBSYS_ETHERNET_COBJSTEMP := $(patsubst %.c, %.o, $(SUBSYS_ETHERNET_CFILES))
SUBSYS_ETHERNET_COBJSTEMP :=$(subst $(SUBSYS_ETHERNET_DIR),PLAT/subsys/openhal/dev/ethernet,$(SUBSYS_ETHERNET_COBJSTEMP))
SUBSYS_ETHERNET_COBJS := $(addprefix $(BUILDDIR)/, $(SUBSYS_ETHERNET_COBJSTEMP))
SUBSYS_ETHERNET_PPFILES := $(patsubst %.o, %.pp, $(SUBSYS_ETHERNET_COBJS))
PPFILES += $(SUBSYS_ETHERNET_PPFILES)
ifneq ($(MAKECMDGOALS), build-unilog)
-include $(SUBSYS_ETHERNET_COBJS:.o=.d)
endif
-include $(SUBSYS_ETHERNET_COBJS:.o=.dd)
ifeq ($(TOOLCHAIN),GCC)
CFLAGS_INC += -I $(TOP)/PLAT/os/freertos/portable/gcc
lib-y += libsubsys_ethernet.a
$(BUILDDIR)/lib/libsubsys_ethernet.a: $(SUBSYS_ETHERNET_COBJS)
@mkdir -p $(dir $@)
$(ECHO) AR $@
$(Q)$(AR) -cr $@ $^
endif
ifeq ($(TOOLCHAIN),ARMCC)
CFLAGS_INC += -I $(TOP)/PLAT/os/freertos/portable/keil
lib-y += libsubsys_ethernet.lib
$(BUILDDIR)/lib/libsubsys_ethernet.lib: $(SUBSYS_ETHERNET_COBJS)
@mkdir -p $(dir $@)
$(ECHO) AR $@
$(Q)$(AR) $(ARFLAGS) $@ $^
endif

View File

@ -0,0 +1,49 @@
SUBSYS_MIFI_DIR := $(TOP)/PLAT/subsys/openhal/dev/mifi
CFLAGS_INC += -I $(SUBSYS_MIFI_DIR) \
SUBSYS_MIFI_SRC_DIRS += $(SUBSYS_MIFI_DIR)
CFLAGS += -DFEATURE_WIFI_SWITCH_ENABLE
SUBSYS_MIFI_EXCLUDE_FILES :=
SUBSYS_MIFI_CSRC = $(foreach dir, $(SUBSYS_MIFI_SRC_DIRS), $(wildcard $(dir)/*.c))
SUBSYS_MIFI_CFILES = $(filter-out $(SUBSYS_MIFI_EXCLUDE_FILES), $(SUBSYS_MIFI_CSRC))
SUBSYS_MIFI_COBJSTEMP := $(patsubst %.c, %.o, $(SUBSYS_MIFI_CFILES))
SUBSYS_MIFI_COBJSTEMP :=$(subst $(SUBSYS_MIFI_DIR),PLAT/subsys/openhal/dev/mifi,$(SUBSYS_MIFI_COBJSTEMP))
SUBSYS_MIFI_COBJS := $(addprefix $(BUILDDIR)/, $(SUBSYS_MIFI_COBJSTEMP))
SUBSYS_MIFI_PPFILES := $(patsubst %.o, %.pp, $(SUBSYS_MIFI_COBJS))
PPFILES += $(SUBSYS_MIFI_PPFILES)
ifneq ($(MAKECMDGOALS), build-unilog)
-include $(SUBSYS_MIFI_COBJS:.o=.d)
endif
-include $(SUBSYS_MIFI_COBJS:.o=.dd)
ifeq ($(TOOLCHAIN),GCC)
CFLAGS_INC += -I $(TOP)/PLAT/os/freertos/portable/gcc
lib-y += libsubsys_mifi.a
$(BUILDDIR)/lib/libsubsys_mifi.a: $(SUBSYS_MIFI_COBJS)
@mkdir -p $(dir $@)
$(ECHO) AR $@
$(Q)$(AR) -cr $@ $^
endif
ifeq ($(TOOLCHAIN),ARMCC)
CFLAGS_INC += -I $(TOP)/PLAT/os/freertos/portable/keil
lib-y += libsubsys_mifi.lib
$(BUILDDIR)/lib/libsubsys_mifi.lib: $(SUBSYS_MIFI_COBJS)
@mkdir -p $(dir $@)
$(ECHO) AR $@
$(Q)$(AR) $(ARFLAGS) $@ $^
endif

View File

@ -0,0 +1,363 @@
/******************************************************************************
*(C) Copyright 2018 EIGENCOMM International Ltd.
* All Rights Reserved
******************************************************************************
* Filename: wifiCli.c
*
* Description:
*
* History:
*
* Notes:
*
******************************************************************************/
/*----------------------------------------------------------------------------*
* INCLUDES *
*----------------------------------------------------------------------------*/
#include "string.h"
#include "bsp.h"
#include "bsp_custom.h"
#include "os_common.h"
#include "ostask.h"
#include DEBUG_LOG_HEADER_FILE
#include "plat_config.h"
#include "slpman.h"
#include "networkmgr.h"
#include "sctdef.h"
#include "cms_api.h"
#include "sfdt.h"
#include "cmsis_os2.h"
#include "bsp_spi.h"
#include "slpman.h"
#ifdef FEATURE_CCIO_ENABLE
#include "spi_device.h"
#include "ccio_custom.h"
#endif
#include "switchWifi.h"
#include "wificliif.h"
#include "tcpipmgrutil.h"
#include "lwip/debug.h"
#include "lwip/err.h"
#ifdef FEATURE_WIFI_SWITCH_ENABLE
/*----------------------------------------------------------------------------*
* MACROS *
*----------------------------------------------------------------------------*/
#define SWITCH_WIFI_TASK_STACK_SIZE (1024)
#define SWITCH_WIFI_QUEUE_SIZE (4)
#define SWITCH_WIFI_NWMG_MODE_DEFAULT (0)
#define SWITCH_WIFI_NWMG_MODE_CAT1 (SWITCH_WIFI_NWMG_MODE_DEFAULT)
#define SWITCH_WIFI_NWMG_MODE_WIFI (1)
/*----------------------------------------------------------------------------*
* DATA TYPE DEFINITION *
*----------------------------------------------------------------------------*/
typedef struct _switchWifiObjectT{
uint8_t wanType; //<< refer to <NmWanNetType>
int32_t cid;
NmWifiCliConfiguration *cnf;
}switchWifiObjectT;
/*----------------------------------------------------------------------------*
* GLOBAL VARIABLES *
*----------------------------------------------------------------------------*/
static StaticTask_t gSwitchWifiTask;
static uint8_t gSwitchWifiTaskStack[SWITCH_WIFI_TASK_STACK_SIZE];
osMessageQueueId_t gSwitchWifiQueue = NULL;
static switchWifiObjectT gSwitchWfifiObj = {NM_WAN_NET_PS_CAT1, 0, NULL};
/*----------------------------------------------------------------------------*
* PRIVATE FUNCTION DECLEARATION *
*----------------------------------------------------------------------------*/
static void SFDT_switchWifiTaskEntry(void *arg);
static void SFDT_createSwitchWifiTask(void);
/*----------------------------------------------------------------------------*
* PRIVATE FUNCTIONS *
*----------------------------------------------------------------------------*/
static void SFDT_createSwitchWifiTask(void)
{
osThreadId_t threadId;
osThreadAttr_t thread_Attr;
gSwitchWifiQueue = osMessageQueueNew(SWITCH_WIFI_QUEUE_SIZE,sizeof(queueSwitchWifiT),NULL);
EC_ASSERT(gSwitchWifiQueue,gSwitchWifiQueue,0,0);
memset(&thread_Attr,0,sizeof(osThreadAttr_t));
memset(gSwitchWifiTaskStack,0xA5,SWITCH_WIFI_TASK_STACK_SIZE);
thread_Attr.name = "switch_wifi";
thread_Attr.stack_mem = gSwitchWifiTaskStack;
thread_Attr.stack_size = SWITCH_WIFI_TASK_STACK_SIZE;
thread_Attr.priority = osPriorityNormal;
thread_Attr.cb_mem = &gSwitchWifiTask;
thread_Attr.cb_size = sizeof(StaticTask_t);
threadId = osThreadNew(SFDT_switchWifiTaskEntry, NULL, &thread_Attr);
EC_ASSERT(threadId,threadId,0,0);
return;
}
/**
\fn static void SFDT_switchWifiTaskEntry(void *arg)
\brief
\return
*/
PLAT_FM_RAMCODE static void SFDT_switchWifiTaskEntry(void *arg)
{
NmResult ret;
queueSwitchWifiT queue = {0};
wanSwitchCnfCmdMsg_t cnfMsg = {0};
UINT8 routeCid = SWITCH_DEFAULT_ROUTE_CID;
int primSize = sizeof(cnfMsg);
while(1)
{
if(osMessageQueueGet(gSwitchWifiQueue,&queue,0,osWaitForever) == osOK)
{
ECPLAT_PRINTF(UNILOG_PLA_APP,SFDT_switchWifiTaskEntry_0, P_VALUE, "switchType %e<NmWanNetType>",queue.switchType);
if(queue.switchType == NM_WAN_NET_WIFI_CLI)
{
gSwitchWfifiObj.cnf = (NmWifiCliConfiguration *)queue.config.wifiCfg;
EC_ASSERT(gSwitchWfifiObj.cnf, gSwitchWfifiObj.cnf, 0, 0);
gSwitchWfifiObj.cid = 0xff;//clear cid
if(queue.switchType == gSwitchWfifiObj.wanType)
{
NetMgrWifiWanLinkDown();
}
ret = NetMgrWifiWanLinkUp(gSwitchWfifiObj.cnf);
EC_ASSERT(ret == NM_SUCCESS,ret, 0, 0);
}
else if(queue.switchType == NM_WAN_NET_PS_CAT1)
{
if(gSwitchWfifiObj.cid == queue.config.cid)
{
ECPLAT_PRINTF(UNILOG_PLA_APP,SFDT_switchWifiTaskEntry_1, P_WARNING, "same cid [%d]",queue.config.cid);
cnfMsg.ret = WSAT_ERR_SWITCH_FAIL;
applSendCmsCnf(queue.reqHandler, APPL_RET_FAIL, APPL_WIFI_SWITCH, APPL_SW_WAN_SWITCH_CNF, primSize, &cnfMsg);
continue;
}
gSwitchWfifiObj.cid = queue.config.cid;
if(queue.switchType != gSwitchWfifiObj.wanType)
{
NetMgrWifiWanLinkDown();
}
}
else
{
ECPLAT_PRINTF(UNILOG_PLA_APP,SFDT_switchWifiTaskEntry_2, P_ERROR, "invalid switchType[%d]",queue.switchType);
}
if(gSwitchWfifiObj.cid == SWITCH_DEFAULT_ROUTE_CID)
{
routeCid = CSIO_IPOS_CID_DFT;
}
ret = NetMgrWanDefaultRouteChange(queue.switchType, routeCid);
EC_ASSERT(ret == NM_SUCCESS,ret, 0, 0);
if(gSwitchWfifiObj.wanType != queue.switchType)
{
#ifdef FEATURE_CCIO_ENABLE
//osThreadId_t threadId = NULL;
uint8_t newType = CSIO_DT_OPAQ;
uint8_t newCustFlag = CSIO_OCF_IPOS;
uint8_t newCustExtras = 1 << CSIO_IPOS_CID_DFT;
if(queue.switchType == NM_WAN_NET_PS_CAT1)
{
newCustExtras = (1 << queue.config.cid);
}
else
{
newCustFlag = CSIO_OCF_IPOS_MIFI;
newCustExtras = 1 << CSIO_IPOS_ID_MIFI;
}
gSwitchWfifiObj.wanType = queue.switchType;
//threadId = (osThreadId_t)SFDT_getSlaveThreadId();
//EC_ASSERT(threadId != NULL,threadId,0,0);
//osThreadSuspend(threadId);
NVIC_DisableIRQ(SFDT_SLAVE_MRDY_IRQ);
NVIC_ClearPendingIRQ(SFDT_SLAVE_MRDY_IRQ);
spiDevTransform(0,newType,((newCustFlag & 0xf) << 16 | newCustExtras));
NVIC_EnableIRQ(SFDT_SLAVE_MRDY_IRQ);
//osThreadResume(threadId);
#endif
}
cnfMsg.ret = WSAT_OK;
applSendCmsCnf(queue.reqHandler, APPL_RET_SUCC, APPL_WIFI_SWITCH, APPL_SW_WAN_SWITCH_CNF, primSize, &cnfMsg);
}
}
osThreadExit();
}
/******************************************************************************
* NetMgrWifiWanLinkUpCallback
* Description: Link up one net (netif), called in LWIP task
* input: NetAdptWanDeRegCfg *pRegCfg
* output: err_t
* Comment:
******************************************************************************/
static err_t NetMgrWifiWanLinkUpCallback(void *pInput, UINT16 inputLen, void *pOutput, UINT16 outputLen)
{
NmWifiCliConfiguration *pWifiWanCfg = (NmWifiCliConfiguration *)pInput;
LWIP_UNUSED_ARG(inputLen);
LWIP_UNUSED_ARG(pOutput);
LWIP_UNUSED_ARG(outputLen);
OsaCheck(pWifiWanCfg != PNULL, pWifiWanCfg, 0, 0);
return wifi_client_wan_linkup_callback(pWifiWanCfg);
}
/******************************************************************************
* NetMgrWifiWanLinkDownCallback
* Description: Link down one net (netif), called in LWIP task
* input: NetAdptWanDeRegCfg *pRegCfg
* output: err_t
* Comment:
******************************************************************************/
static err_t NetMgrWifiWanLinkDownCallback(void *pInput, UINT16 inputLen, void *pOutput, UINT16 outputLen)
{
LWIP_UNUSED_ARG(pInput);
LWIP_UNUSED_ARG(inputLen);
LWIP_UNUSED_ARG(pOutput);
LWIP_UNUSED_ARG(outputLen);
return wifi_client_wan_linkdown_callback();
}
/******************************************************************************
* NetMgrWanDefaultRouteChangeCallback
* Description: Link up one net (netif), called in LWIP task
* input: NetAdptWanDeRegCfg *pRegCfg
* output: err_t
* Comment:
******************************************************************************/
static err_t NetMgrWanDefaultRouteChangeCallback(void *pInput, UINT16 inputLen, void *pOutput, UINT16 outputLen)
{
NmWanNetDefaultChangeInfo *pWanDefaultChangeInfo = (NmWanNetDefaultChangeInfo *)pInput;
LWIP_UNUSED_ARG(inputLen);
LWIP_UNUSED_ARG(pOutput);
LWIP_UNUSED_ARG(outputLen);
OsaCheck(pWanDefaultChangeInfo != PNULL, pWanDefaultChangeInfo, 0, 0);
return wifi_client_wan_default_route_change_callback(pWanDefaultChangeInfo);
}
/*----------------------------------------------------------------------------*
* GLOBAL FUNCTIONS *
*----------------------------------------------------------------------------*/
int32_t sfdt_switchWifiInit(void)
{
SFDT_createSwitchWifiTask();
return 0;
}
#ifdef FEATURE_WIFI_SWITCH_ENABLE
/******************************************************************************
* NetMgrWifiWanLinkUp
* Description: active wifi client as wan netif
* input: NmWifiCliConfiguration *pIfCfg
*
*
* output: NmResult
* Comment:
******************************************************************************/
NmResult NetMgrWifiWanLinkUp(NmWifiCliConfiguration *pIfCfg)
{
err_t err;
ECOMM_TRACE(UNILOG_TCPIP_NETMGR, NetMgrWifiWanLinkUp_1, P_SIG, 0,
"NETMANAGER link UP WIFI CLI WAN");
//send the tcpip call message to tcpip thread
err = TcpipMgrLwipCallbackBlockWithoutPsStatusCheck(NetMgrWifiWanLinkUpCallback, pIfCfg, sizeof(NmWifiCliConfiguration), PNULL, 0);
if (err == ERR_OK)
{
return NM_SUCCESS;
}
return NM_FAIL;
}
/******************************************************************************
* NetMgrWifiWanLinkDown
* Description: deactive wifi client as wan netif
* input:
*
*
* output: NmResult
* Comment:
******************************************************************************/
NmResult NetMgrWifiWanLinkDown(void)
{
err_t err;
ECOMM_TRACE(UNILOG_TCPIP_NETMGR, NetMgrWifiWanLinkDown_1, P_SIG, 0,
"NETMANAGER link DOWN WIFI CLI WAN");
//send the tcpip call message to tcpip thread
err = TcpipMgrLwipCallbackBlockWithoutPsStatusCheck(NetMgrWifiWanLinkDownCallback, PNULL, 0, PNULL, 0);
if (err == ERR_OK)
{
return NM_SUCCESS;
}
return NM_FAIL;
}
/******************************************************************************
* NetMgrWanDefaultRouteChange
* Description: deactive wifi client as wan netif
* input:UINT8 type(NmWanNetType),
* UINT8 cid(if the type is NM_WAN_NET_PS_CAT1, need input this parameter)
*
*
* output: NmResult
* Comment:
******************************************************************************/
NmResult NetMgrWanDefaultRouteChange(UINT8 type, UINT8 cid)
{
err_t err;
NmWanNetDefaultChangeInfo defaultChangeInfo;
ECOMM_TRACE(UNILOG_TCPIP_NETMGR, NetMgrWanDefaultRouteChange, P_SIG, 2,
"NETMANAGER WAN DEFAULT ROUTE CHANGE to type %u, cid %u", type, cid);
defaultChangeInfo.type = type;
defaultChangeInfo.cid = cid;
//send the tcpip call message to tcpip thread
err = TcpipMgrLwipCallbackBlockWithoutPsStatusCheck(NetMgrWanDefaultRouteChangeCallback, &defaultChangeInfo, sizeof(NmWanNetDefaultChangeInfo), PNULL, 0);
if (err == ERR_OK)
{
return NM_SUCCESS;
}
return NM_FAIL;
}
#endif
#endif/*FEATURE_WIFI_SWITCH_ENABLE*/

View File

@ -0,0 +1,138 @@
/******************************************************************************
*(C) Copyright 2018 EIGENCOMM International Ltd.
* All Rights Reserved
******************************************************************************
* Filename: wifiCli.h
*
* Description:
*
* History:
*
* Notes:
*
******************************************************************************/
#ifndef __SFDT_SWITCH_WIFI_H__
#define __SFDT_SWITCH_WIFI_H__
#include "lwip/opt.h"
#include "lwip/ip_addr.h"
#include "networkmgr.h"
#ifdef FEATURE_WIFI_SWITCH_ENABLE
#define SWITCH_DEFAULT_ROUTE_CID 2
typedef enum NmWanNetType_Tag{
NM_WAN_NET_INVALID = 0,
NM_WAN_NET_PS_CAT1 = 1,
NM_WAN_NET_WIFI_CLI = 2,
}NmWanNetType;
/******************************************************************************
* wifi client netif configuration info
* Use to link up one netif
******************************************************************************/
typedef struct NmWifiCliConfiguration_Tag
{
uint16_t dnsNum : 3;
uint16_t mtuPresent : 1; //if mtu is invalid ,this value will be zero
uint16_t ipv4NetMaskPresent : 1;
uint16_t ipType : 3; //NmNetIpType
uint16_t bDefault : 1; //whether default netif
uint16_t rsvd0 : 6;
uint16_t mtu; //default 1500
ip4_addr_t ipv4Addr;
ip4_addr_t ipv4NetMask;
ip6_addr_t ipv6LinkLocalAddr; //ipv6 link local address
ip6_addr_t ipv6GlobalAddr; //ipv6 global address
ip_addr_t dns[NM_MAX_DNS_NUM];// v4 max nume is 2; v6 max num is 2
}NmWifiCliConfiguration; //124 bytes
/******************************************************************************
* wifi client netif configuration info
* Use to link up one netif
******************************************************************************/
typedef struct NmWanNetDefaultChangeInfoTag
{
uint8_t type; //NmWanNetType
uint8_t cid;
uint16_t rsvd;
}NmWanNetDefaultChangeInfo; //124 bytes
typedef enum _AtWanSwitchErr_e{
WSAT_OK = 0,
WSAT_ERR_SWITCH_FAIL = 1,
WSAT_ERR_MAX = 0xff
}AtWanSwitchErr_e;
typedef enum _applSwitchWifiPrimId_Enum{
APPL_SW_PRIM_ID_BAISC = 0,
APPL_SW_WAN_SWITCH_CNF,
APPL_SW_CURR_WAN_SWITCH_IND,
APPL_SW_PRIM_ID_END = 0xff
}applSwitchWifiPrimId_Enum;
typedef struct _wanSwitchCnfCmdMsg_t
{
uint8_t ret;
uint8_t chanId;
char rspbuf[60];
} wanSwitchCnfCmdMsg_t;
typedef struct _queueSwitchWifiT
{
uint8_t switchType; //<< refer to <NmWanNetType>
uint32_t reqHandler;
union{
int32_t cid;
void *wifiCfg; //<< switch config info, refer to <NmWifiCliConfiguration>
}config;
uint8_t resv[4]; //<< reserve for cust
}queueSwitchWifiT;
int32_t sfdt_switchWifiInit(void);
/******************************************************************************
* NetMgrWifiWanLinkUp
* Description: active wifi client as wan netif
* input: NmWifiCliConfiguration *pIfCfg
*
*
* output: NmResult
* Comment:
******************************************************************************/
NmResult NetMgrWifiWanLinkUp(NmWifiCliConfiguration *pIfCfg);
/******************************************************************************
* NetMgrWifiWanLinkDown
* Description: deactive wifi client as wan netif
* input:
*
*
* output: NmResult
* Comment:
******************************************************************************/
NmResult NetMgrWifiWanLinkDown(void);
/******************************************************************************
* NetMgrWanDefaultRouteChange
* Description: deactive wifi client as wan netif
* input:UINT8 type(NmWanNetType),
* UINT8 cid(if the type is NM_WAN_NET_PS_CAT1, need input this parameter)
*
*
* output: NmResult
* Comment:
******************************************************************************/
NmResult NetMgrWanDefaultRouteChange(UINT8 type, UINT8 cid);
#endif
#endif/*__SFDT_SWITCH_WIFI_H__*/

View File

@ -0,0 +1,619 @@
#include "lwip/opt.h"
#include "lwip/netif.h"
#include "lwip/dns.h"
#include "lwip/tcpip.h"
#include "lwip/ip.h"
#include "lwip/priv/tcpip_priv.h"
#include "lwip/priv/api_msg.h"
#include "wificliif.h"
#include "psifapi.h"
#ifdef FEATURE_WIFI_SWITCH_ENABLE
extern UlPduBlock* NetifUlGetOnePkg(UlPduBlock *pUlHdr,
UlPduBlock **ppOnePkgHead,
UlPduBlock **ppOnePkgTail,
UINT16 *pPkgLen);
extern void* PsDlPkgAlloc(UINT32 wantedSize);
extern void PsifInitPsDlPkgPbuf(DlPduBlock *pDlPduBlk);
extern UINT16 NetifCopyDataFromUlPdu(UINT8 *payload, UlPduBlock *pUlPdu);
extern void NetifDumpDlPduPacket(DlPduBlock *dlData, UINT8 type);
WifiCliUlPkgPendingList gWifiCliUlpkgPendingList = {0};
wifiCliOutputFunc wifiOutPutCustFunc = NULL;
void UlPduAddList(UlPduBlock **ppHdr, UlPduBlock **ppTailer, UlPduBlock *pNewHdr, UlPduBlock *pNewTailer)
{
if ((*ppHdr) == PNULL)
{
OsaCheck((*ppTailer) == PNULL && (pNewHdr) != PNULL && ((pNewTailer)->pNext) == PNULL, (*ppTailer), ((pNewTailer)->pNext), 0x12345678);
(*ppHdr) = (pNewHdr);
(*ppTailer) = (pNewTailer);
}
else
{
OsaCheck((*ppTailer) != PNULL && (pNewHdr) != PNULL && ((pNewTailer)->pNext) == PNULL, (*ppTailer), ((pNewTailer)->pNext), 0x87654321);
(*ppTailer)->pNext = (pNewHdr);
(*ppTailer) = (pNewTailer);
}
}
/******************************************************************************
* wifi_cli_ulPkg_ListGet
* Description: Get all UL PDU list from "gWifiCliUlpkgPendingList"
* input:
* ppHead //in & out
* output:
* Comment: this called in LWIP task
******************************************************************************/
static void wifi_cli_ulPkg_ListGet(UlPduBlock **ppHead)
{
WifiCliUlPkgPendingList *pPendingList = PNULL;
UINT32 mask = 0;
OsaCheck(ppHead != PNULL, ppHead, 0, 0);
*ppHead = PNULL;
mask = SaveAndSetIRQMask();
pPendingList = &gWifiCliUlpkgPendingList;
if (pPendingList != PNULL)
{
if (pPendingList->pHead != PNULL)
{
OsaCheck(pPendingList->pTail != PNULL && pPendingList->pTail->pNext == PNULL,
pPendingList->pTail, 0, 0);
*ppHead = pPendingList->pHead;
}
pPendingList->pHead = pPendingList->pTail = PNULL;
pPendingList->pkgNum = 0;
}
RestoreIRQMask(mask);
return;
}
/******************************************************************************
* wifi_cli_ul_output
* Description: Just pass UL raw IP pkg to wifi client
* input: struct netif *netif,
* struct pbuf *p,
* output:
* Comment:
* Current only support pass ether PKG one by one
******************************************************************************/
err_t wifi_cli_ul_output(struct netif *netif, struct pbuf *p)
{
DlPduBlock *pDlPdu = PNULL;
UINT16 totalLen = 0;
UINT8 *pBuf = PNULL;
//check PPP link state
if(!netif_is_link_up(netif))
{
ECOMM_TRACE(UNILOG_TCPIP_NETADPT, wifi_cli_ul_output_if_down, P_WARNING, 0,
"wifi cli if is not link up");
return ERR_IF;
}
if (p->tot_len > netif->mtu)
{
ECOMM_TRACE(UNILOG_TCPIP_NETADPT, wifi_cli_ul_output_1, P_WARNING, 3,
"UL pkg Len: %d > MTU: %d, ignore this pkg", p->tot_len, netif->mtu);
return ERR_ARG;
}
totalLen = LLLNK_DLPDU_CONSUMED_SIZE(LWIP_PBUF_STRUCT_LEN + sizeof(DlPduBlock) + p->tot_len);
pBuf = (UINT8 *)PsDlPkgAlloc(totalLen);
if (pBuf == PNULL)
{
return ERR_MEM;
}
pDlPdu = (DlPduBlock *)(pBuf + LWIP_PBUF_STRUCT_LEN);
memset(pDlPdu, 0x00, sizeof(DlPduBlock));
DL_PDU_BLOCK_SET_MAGIC_WORD(pDlPdu);
pDlPdu->length = p->tot_len;
pDlPdu->pPdu = pBuf + LWIP_PBUF_STRUCT_LEN + sizeof(DlPduBlock) + LLLNK_DLPDU_RSVD_HDR_SIZE;
pDlPdu->dlMemType = DL_PS_PKG_MEM;
pDlPdu->pbufBefore = TRUE;
pDlPdu->bNetHdrRsvd = FALSE;
/* init pbuf struct */
PsifInitPsDlPkgPbuf(pDlPdu);
/* copy this ip pkg */
pbuf_copy_partial(p, (void *)pDlPdu->pPdu, p->tot_len, 0);
//dump pkg for debug
NetifDumpDlPduPacket(pDlPdu, LWIP_NETIF_TYPE_WAN_INTERNET);
//need add send the dlpdu to wifi client
// and wifi client process this dlpdu, must call PsifFreeDlIpPkgBlockList(pDlPdu);
if(wifiOutPutCustFunc)
{
wifiOutPutCustFunc(0, pDlPdu);
}
else
{
OsaFreeDlPduBlockList(&pDlPdu);
}
return ERR_OK;
}
/******************************************************************************
* wifi_cli_ip4_output
* Description: Just pass UL raw IPv4 pkg to wifi client
* input: struct netif *netif,
* struct pbuf *p,
* output:
* Comment:
* Current only support pass ether PKG one by one
******************************************************************************/
static err_t wifi_cli_ip4_output(struct netif *netif, struct pbuf *p, const ip4_addr_t *ipaddr)
{
// todo:you can add some check function
return wifi_cli_ul_output(netif, p);
}
/******************************************************************************
* wifi_cli_ip6_output
* Description: Just pass UL raw IPv6 pkg to wifi client
* input: struct netif *netif,
* struct pbuf *p,
* output:
* Comment:
* Current only support pass ether PKG one by one
******************************************************************************/
static err_t wifi_cli_ip6_output(struct netif *netif, struct pbuf *p, const ip6_addr_t *ipaddr)
{
// todo:you can add some check function
return wifi_cli_ul_output(netif, p);
}
/******************************************************************************
* wifi_cli_netif_init
* Description: wifi client netif init
* input: struct netif *netif,
* output:
* Comment:
*
******************************************************************************/
err_t wifi_cli_netif_init(struct netif *netif)
{
if(!netif)
return ERR_ARG;
//init netif name
netif->name[0] = WIFI_CLI_NETIF_PREFIX_NAME;
netif->name[1] = WIFI_CLI_NETIF_NAME;
//init ipv4 & ipv6 output function
netif->output = wifi_cli_ip4_output;
netif->primary_ipv4_cid = LWIP_PS_INVALID_CID;
#if LWIP_IPV6
netif->output_ip6 = wifi_cli_ip6_output;
netif->primary_ipv6_cid = LWIP_PS_INVALID_CID;
#endif /* LWIP_IPV6 */
netif->linkoutput = wifi_cli_ul_output;
#if LWIP_IGMP
netif->flags &= NETIF_FLAG_IGMP;
#endif
#if LWIP_IPV6_MLD
netif->flags &= NETIF_FLAG_MLD6;
#endif
return ERR_OK;
}
/******************************************************************************
* wifi_client_wan_linkup_callback
* Description: wifi client wan linkup call back
* input: NmWifiCliConfiguration *conf
* output:
* Comment:
*
******************************************************************************/
err_t wifi_client_wan_linkup_callback(NmWifiCliConfiguration *conf)
{
struct netif *wifi_cli_netif = NULL;
ip4_addr_t wifi_netif_netmask;
u8_t i;
if(conf == NULL)
{
ECOMM_TRACE(UNILOG_TCPIP_NETADPT, wifi_client_wan_linkup_callback_1, P_WARNING, 0, "invalid argument");
}
//check whether wifi wan has linkup
wifi_cli_netif = netif_get_adpt_netif(LWIP_NETIF_TYPE_WAN_WIFI);
if(wifi_cli_netif != NULL)
{
ECOMM_TRACE(UNILOG_TCPIP_NETADPT, wifi_client_wan_linkup_callback_2, P_INFO, 0, "wifi wan has linkup");
return ERR_OK;
}
// alloc netif structure
wifi_cli_netif = mem_malloc(sizeof(struct netif));
if (wifi_cli_netif == NULL)
{
ECOMM_TRACE(UNILOG_TCPIP_NETADPT, wifi_client_wan_linkup_callback_mem_1, P_WARNING, 0,
"LAN link type %u, can't alloc mem for netif");
return ERR_MEM;
}
memset(wifi_cli_netif, 0, sizeof(struct netif));
wifi_cli_netif->primary_ipv4_cid = LWIP_PS_INVALID_CID;
wifi_cli_netif->primary_ipv6_cid = LWIP_PS_INVALID_CID;
/* init netif mtu, MTU size suggest could config by AT - TBD */
wifi_cli_netif->mtu = (conf->mtu == 0)?LAN_NETIF_DEFAULT_MTU : conf->mtu;
if(conf->ipv4NetMaskPresent)
{
ip4_addr_copy(wifi_netif_netmask, conf->ipv4NetMask);
}
else
{
IP4_ADDR(&wifi_netif_netmask, 255, 255, 255, 255);
}
//register LAN netif to tcpip stack
netif_add(wifi_cli_netif, IP4_ADDR_ANY4, &wifi_netif_netmask, IP4_ADDR_ANY4, NULL, wifi_cli_netif_init, NULL);
/* set the wan type */
netif_set_netif_type(wifi_cli_netif, LWIP_NETIF_TYPE_WAN_WIFI);
netif_set_link_up(wifi_cli_netif);
//ipv4
if(conf->ipType == NM_NET_TYPE_IPV4 || conf->ipType == NM_NET_TYPE_IPV4V6)
{
//set ipv4 address
netif_set_ipaddr(wifi_cli_netif, &conf->ipv4Addr);
//set ipv4 dns server
if(conf->dnsNum > 0)
{
for (i = 0; i < conf->dnsNum; i++)
{
if(IP_IS_V4_VAL(conf->dns[i]) &&
(!ip_addr_isany(&conf->dns[i])))
{
dns_setserver(wifi_cli_netif, &conf->dns[i]);
}
}
}
netif_set_type_up(wifi_cli_netif, NETIF_REPORT_TYPE_IPV4);
}
//ipv6
if(conf->ipType == NM_NET_TYPE_IPV6 || conf->ipType == NM_NET_TYPE_IPV4V6)
{
//set ipv6 linklocal address
netif_ip6_addr_set(wifi_cli_netif, 0, &conf->ipv6LinkLocalAddr);
netif_ip6_addr_set_state(wifi_cli_netif, 0, IP6_ADDR_VALID);
//set ipv6 global address
netif_ip6_addr_set(wifi_cli_netif, 1, &conf->ipv6GlobalAddr);
/* Set address state. */
#if LWIP_IPV6_DUP_DETECT_ATTEMPTS
/* Will perform duplicate address detection (DAD). */
netif_ip6_addr_set_state(wifi_cli_netif, 1, IP6_ADDR_TENTATIVE);
#else
/* Consider address valid. */
netif_ip6_addr_set_state(wifi_cli_netif, 1, IP6_ADDR_PREFERRED);
#endif
//set ipv6 dns server
if(conf->dnsNum > 0)
{
for (i = 0; i < conf->dnsNum; i++)
{
if(IP_IS_V6_VAL(conf->dns[i]) &&
(!ip_addr_isany(&conf->dns[i])))
{
dns_setserver(wifi_cli_netif, &conf->dns[i]);
}
}
}
netif_set_type_up(wifi_cli_netif, NETIF_REPORT_TYPE_IPV6);
}
//set default
if(conf->bDefault)
{
netif_set_default(wifi_cli_netif);
}
ECOMM_TRACE(UNILOG_TCPIP_NETADPT, wifi_client_wan_linkup_callback_3, P_INFO, 0, "wifi cli wan linkup");
return ERR_OK;
}
/******************************************************************************
* wifi_client_wan_linkdown_callback
* Description: wifi client wan linkdown call back
* input:
* output:
* Comment:
*
******************************************************************************/
err_t wifi_client_wan_linkdown_callback(void)
{
struct netif *wifi_cli_netif = NULL;
//check whether wifi wan has linkup
wifi_cli_netif = netif_get_adpt_netif(LWIP_NETIF_TYPE_WAN_WIFI);
if(wifi_cli_netif == NULL)
{
ECOMM_TRACE(UNILOG_TCPIP_NETADPT, wifi_client_wan_linkdown_callback_1, P_INFO, 0, "wifi cli wan has linkdown");
return ERR_OK;
}
dns_clearserver(wifi_cli_netif, IPADDR_TYPE_V4);
dns_clearserver(wifi_cli_netif ,IPADDR_TYPE_V6);
#if LINK_DOWN_NEED_CLEAR_DNS_CACHE
dns_clear_cache(IPADDR_TYPE_V4);
dns_clear_cache(IPADDR_TYPE_V6);
#endif
netif_remove(wifi_cli_netif);
mem_free(wifi_cli_netif);
ECOMM_TRACE(UNILOG_TCPIP_NETADPT, wifi_client_wan_linkdown_callback_2, P_INFO, 0, "wifi cli wan linkdown");
return ERR_OK;
}
/******************************************************************************
* wifi_client_wan_default_route_change_callback
* Description: wifi client wan default route change call back
* input:
* output:
* Comment:
*
******************************************************************************/
err_t wifi_client_wan_default_route_change_callback(NmWanNetDefaultChangeInfo *pInfo)
{
struct netif *netif = NULL;
if(pInfo == NULL)
{
ECOMM_TRACE(UNILOG_TCPIP_NETADPT, wifi_client_wan_default_route_change_callback_1, P_ERROR, 0, "invalid argu");
return ERR_ARG;
}
else if(pInfo->type != NM_WAN_NET_PS_CAT1 && pInfo->type != NM_WAN_NET_WIFI_CLI)
{
ECOMM_TRACE(UNILOG_TCPIP_NETADPT, wifi_client_wan_default_route_change_callback_type_1, P_ERROR, 1, "invalid type %u", pInfo->type);
return ERR_ARG;
}
if(pInfo->type == NM_WAN_NET_PS_CAT1)
{
if(LWIP_CHECK_CID_VALID(pInfo->cid))
{
netif = netif_find_by_cid(pInfo->cid);
if(netif == NULL)
{
ECOMM_TRACE(UNILOG_TCPIP_NETADPT, wifi_client_wan_default_route_change_callback_2, P_ERROR, 1, "can not find netif by cid %u", pInfo->cid);
return ERR_ARG;
}
else
{
netif_set_default(netif);
}
}
else
{
ECOMM_TRACE(UNILOG_TCPIP_NETADPT, wifi_client_wan_default_route_change_callback_3, P_ERROR, 1, "invalid cid %u", pInfo->cid);
return ERR_ARG;
}
}
else if(pInfo->type == NM_WAN_NET_WIFI_CLI)
{
netif = netif_get_adpt_netif(LWIP_NETIF_TYPE_WAN_WIFI);
if(netif == NULL)
{
ECOMM_TRACE(UNILOG_TCPIP_NETADPT, wifi_client_wan_default_route_change_callback_4, P_ERROR, 0, "can not find wifi client netif");
return ERR_ARG;
}
else
{
netif_set_default(netif);
}
}
ECOMM_TRACE(UNILOG_TCPIP_NETADPT, wifi_client_wan_default_route_change_callback_5, P_INFO, 2, "wifi wan default change to type %u ,cid &u", pInfo->type, pInfo->cid);
return ERR_OK;
}
/******************************************************************************
* wifi_cli_wan_tcpip_input
* Description:
* input: u8_t wanType, UlPduBlock *pPduHdr
* output:UINT8
* Comment:
******************************************************************************/
err_t wifi_cli_wan_tcpip_input(u8_t wanType)
{
struct netif *inp = PNULL;
struct pbuf *p = PNULL;
UlPduBlock *pUlPduTmp = PNULL, *pUlPduTmpNext = PNULL;
UlPduBlock *pOnePkgHead = PNULL, *pOnePkgTail = PNULL;
UINT16 pduTotalLen = 0;
UlPduBlock *pPduHdr = PNULL;
OsaDebugBegin(wanType == LWIP_NETIF_TYPE_WAN_WIFI, 0, wanType, 0);
return ERR_ARG;
OsaDebugEnd();
wifi_cli_ulPkg_ListGet(&pPduHdr);
inp = netif_get_adpt_netif(LWIP_NETIF_TYPE_WAN_WIFI);
if (inp == PNULL)
{
ECOMM_TRACE_I(UNILOG_TCPIP_NETADPT, wifi_cli_wan_tcpip_input_1, P_ERROR, 0,
"wifi cli netif recv wan pkg, but can not find adpt netif, type %u", wanType);
if(pPduHdr != PNULL)
{
OsaFreeUlPduBlockList(&pPduHdr);
}
return ERR_ARG;
}
for (pUlPduTmp = pPduHdr; pUlPduTmp != PNULL;)
{
pUlPduTmpNext = NetifUlGetOnePkg(pUlPduTmp, &pOnePkgHead, &pOnePkgTail, &pduTotalLen);
//ToDo:could improve(zero copy)
p = pbuf_alloc(PBUF_RAW, pduTotalLen, PBUF_RAM);
if (p == PNULL)
{
ECOMM_TRACE_I(UNILOG_TCPIP_NETADPT, wifi_cli_wan_tcpip_input_2, P_ERROR, 1,
"wifi cli recv wan pkg, but allocate pbuf free, dicard the pkglen: %d", pduTotalLen);
OsaFreeUlPduBlockList(&pUlPduTmp);
pUlPduTmp = pUlPduTmpNext;
continue;
}
else
{
p->tot_len = NetifCopyDataFromUlPdu(p->payload, pUlPduTmp);
OsaFreeUlPduBlockList(&pUlPduTmp);
}
//dump pkg for debug
netif_dump_dl_packet(p->payload, p->tot_len, LWIP_NETIF_TYPE_WAN_INTERNET);
ps_ip_input(p, inp);
pUlPduTmp = pUlPduTmpNext;
}
return ERR_OK;
}
/******************************************************************************
* wifi_cli_wan_recv_ul_pkg
* Description: wifi client wan netif low level input function
* input: void
* output:
* Comment:
******************************************************************************/
err_t wifi_cli_wan_pkg_notify(void)
{
err_t ret;
ret = TcpipWanInpkt(LWIP_NETIF_TYPE_WAN_WIFI, wifi_cli_wan_tcpip_input);
if (ret != ERR_OK)
{
ECOMM_TRACE(UNILOG_TCPIP_NETADPT, wifi_cli_wan_pkg_notify_1, P_ERROR, 1,
"wifi_cli_wan_pkg_notify fail");
return ret; //msg memory alloc fail or can not find netif by lcid
}
return ERR_OK;
}
/******************************************************************************
* wifi_cli_ul_listinput
* Description:
* input:
* output:
* Comment:
*
******************************************************************************/
void wifi_cli_ul_listinput(UINT16 pkgNum, UlPduBlock *pHead, UlPduBlock *pTail)
{
UINT32 mask = 0, inIsr = osIsInISRContext(), needNotify = 0;
WifiCliUlPkgPendingList *pPendingList = PNULL;
OsaCheck(pHead != PNULL && pTail != PNULL && pTail->pNext == PNULL && pkgNum > 0,
pHead, pTail, pkgNum);
if (!inIsr)
{
mask = SaveAndSetIRQMask();
}
pPendingList = &gWifiCliUlpkgPendingList;
//OsaCheck(pPendingList != PNULL, cid, 0, 0);
if(pPendingList->pHead == PNULL)
{
needNotify = 1;
}
/* Link */
UlPduAddList(&pPendingList->pHead, &pPendingList->pTail, pHead, pTail);
pPendingList->pkgNum += pkgNum;
if (!inIsr)
{
RestoreIRQMask(mask);
}
if (needNotify)
{
wifi_cli_wan_pkg_notify();
}
return;
}
void wifi_cli_output_set_cust_func(BOOL isRegister, wifiCliOutputFunc custOutputFunc)
{
if(isRegister)
wifiOutPutCustFunc = custOutputFunc;
else
wifiOutPutCustFunc = NULL;
}
#endif

View File

@ -0,0 +1,74 @@
#ifndef LWIP_HDR_NETIF_WIFICLI_H
#define LWIP_HDR_NETIF_WIFICLI_H
#include "lwip/opt.h"
#include "lwip/netif.h"
#include "networkmgr.h"
#include "switchWifi.h"
#define WIFI_CLI_NETIF_PREFIX_NAME 'w'
#define WIFI_CLI_NETIF_NAME 0
typedef UINT32 (* wifiCliOutputFunc)(uint8_t, DlPduBlock *);
typedef struct WifiCliUlPkgPendingList_Tag
{
UINT16 pkgNum; // the total pkg num of the pending list
UINT16 rsvd;
UlPduBlock *pHead;
UlPduBlock *pTail;
}WifiCliUlPkgPendingList;
/******************************************************************************
* wifi_client_wan_linkup_callback
* Description: wifi client wan linkup call back
* input: NmWifiCliConfiguration *conf
* output:
* Comment:
*
******************************************************************************/
err_t wifi_client_wan_linkup_callback(NmWifiCliConfiguration *conf);
/******************************************************************************
* wifi_client_wan_linkdown_callback
* Description: wifi client wan linkdown call back
* input:
* output:
* Comment:
*
******************************************************************************/
err_t wifi_client_wan_linkdown_callback(void);
/******************************************************************************
* wifi_client_wan_default_route_change_callback
* Description: wifi client wan default route change call back
* input:
* output:
* Comment:
*
******************************************************************************/
err_t wifi_client_wan_default_route_change_callback(NmWanNetDefaultChangeInfo *pInfo);
/******************************************************************************
* wifi_cli_ul_listinput
* Description: wifi cli send pkg to lwip
* input:
* output:
* Comment:
*
******************************************************************************/
void wifi_cli_ul_listinput(UINT16 pkgNum, UlPduBlock *pHead, UlPduBlock *pTail);
/******************************************************************************
* wifi_cli_output_set_cust_func
* Description: wifi cli output func set by cust
* input:
* output:
* Comment:
*
******************************************************************************/
void wifi_cli_output_set_cust_func(BOOL isRegister, wifiCliOutputFunc custOutPutFunc);
#endif

View File

@ -0,0 +1,828 @@
@echo off && setlocal enabledelayedexpansion
@echo %PATH% | findstr /c:"%~dp0tools/msys64/usr/bin">nul
@if %errorlevel% equ 1 set PATH=%~dp0tools/msys64/usr/bin;%PATH%
rem @set PATH=%~dp0tools/msys64/usr/bin;%PATH%
cls
set PROJECT_NAME=at_command
set BOARD_NAME=ec7xx_0h00
set CHIP_NAME=ec7xx
set CHIP_TYPE=ec716e
set CORE_NAME=ap
set EUTRAN_MODE=cat_mode
set BUILD_OPTION=merge
set UNILOG=false
set TOOLCHAIN_NAME=GCC
set CUST=common
set SDKREL=false
set OPENCPU=true
set LTO_ENABLE=false
set GCF_ENABLE=false
set RAM_ENBALE=true
set ROM_ENBALE=false
set LESS_LOG=false
set PWR_TEST=false
set BUILD_HEADBIN=false
set GCCLIB_PATH="C:\gcc"
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\ram"
set CPBIN_SUBPATH=ram
set PKG_MAPDEF=pkg_716e_mapdef
set PKG_PRODUCT="EC716E_PRD"
set OUTPUT_NAME=%BOARD_NAME%_%CHIP_TYPE%
set JOBNUMBER=j8
echo build.bat version 20180330
echo GCCLIB_PATH: %GCCLIB_PATH%
if not %GCCLIB_PATH% == "" (
if not exist %GCCLIB_PATH% (
echo ERROR: Please check GCCLIB_PATH setting, exit!!!
goto end
)
) else (
echo ERROR: Please set GCCLIB_PATH firstly, exit!!!
goto end
)
rem --------- board/project parsing begain------------------
set PARAMETERS=%1
if xx%PARAMETERS%==xx (
echo no input paramter, use default build setting
) else (
echo build option is: %PARAMETERS%
)
set parameterStr=%PARAMETERS%
:parameterSplit
for /f "tokens=1,* delims=-" %%a in ("%parameterStr%") do (
set parameterStr=%%b
echo %%a | findstr /r "j[0-9]*[0-9]\>" > nul
if !errorlevel!==0 (
set JOBNUMBER=%%a
)
if "%%a"=="qcom" (
set CUST=qcom
)
if "%%a"=="ec716e_0h00" (
set BOARD_NAME=ec7xx_0h00
set CHIP_NAME=ec7xx
set OUTPUT_NAME=ec7xx_0h00_%CHIP_TYPE%
)
if "%%a"=="bootloader" (
set PROJECT_NAME=bootloader
set BUILD_OPTION=no_merge
)
if "%%a"=="ap" (
set CORE_NAME=ap
set BUILD_OPTION=no_merge
)
if "%%a"=="cp" (
set CORE_NAME=cp
set PROJECT_NAME=cp_project
set BUILD_OPTION=no_merge
)
if "%%a"=="pwrTest" (
set PWR_TEST=true
)
if "%%a"=="nb_mode" (
set EUTRAN_MODE=nb_mode
)
if "%%a"=="at_command" (
set PROJECT_NAME=at_command
)
if "%%a"=="socket_example" (
set PROJECT_NAME=socket_example
)
if "%%a"=="mqtt_example" (
set PROJECT_NAME=mqtt_example
)
if "%%a"=="https_example" (
set PROJECT_NAME=https_example
)
if "%%a"=="ssl_example" (
set PROJECT_NAME=ssl_example
)
if "%%a"=="libapi_example" (
set PROJECT_NAME=libapi_example
)
if "%%a"=="pos_example" (
set PROJECT_NAME=pos_example
)
if "%%a"=="tts_example" (
set PROJECT_NAME=tts_example
)
if "%%a"=="audio_example" (
set PROJECT_NAME=audio_example
)
if "%%a"=="lpuart_test" (
set PROJECT_NAME=lpuart_test
)
if "%%a"=="driver_example" (
set PROJECT_NAME=driver_example
set BUILD_OPTION=no_merge
)
if "%%a"=="dhrystone" (
set PROJECT_NAME=dhrystone
)
if "%%a"=="coremark" (
set PROJECT_NAME=coremark
)
if "%%a"=="slpman_example" (
set PROJECT_NAME=slpman_example
)
if "%%a"=="sleep_example" (
set PROJECT_NAME=sleep_example
)
if "%%a"=="slpPressure_test" (
set PROJECT_NAME=slpPressure_test
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="AonDigPressure_test" (
set PROJECT_NAME=AonDigPressure_test
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="ModemSlpPressure" (
set CORE_NAME=cp
set PROJECT_NAME=ModemSlpPressure
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="mcu_example" (
set PROJECT_NAME=mcu_example
)
if "%%a"=="soc_simple" (
set PROJECT_NAME=soc_simple
)
if "%%a"=="soc_bist" (
set PROJECT_NAME=soc_bist
)
if "%%a"=="simo_test" (
set PROJECT_NAME=simo_test
)
if "%%a"=="clk_verify" (
set PROJECT_NAME=clk_verify
set LTO_ENABLE=false
set BUILD_OPTION=merge
)
if "%%a"=="qspi_test" (
set PROJECT_NAME=qspi_test
set LTO_ENABLE=false
)
if "%%a"=="fpga_sct_utfw" (
set PROJECT_NAME=fpga_sct_utfw
)
if "%%a"=="merge" (
set BUILD_OPTION=merge
)
if "%%a"=="sdkrel" (
set SDKREL=true
)
if "%%a"=="lto" (
set LTO_ENABLE=true
)
if "%%a"=="ram" (
set OPENCPU=true
set RAM_ENBALE=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\ram"
set CPBIN_SUBPATH=ram
)
if "%%a"=="isms" (
set IMS_SMSONLY_ENABLE=true
set OPENCPU=true
set RAM_ENBALE=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\isms"
set CPBIN_SUBPATH=ram
)
if "%%a"=="verbose" (
set VERBOSE=1
) else (
set VERBOSE=0
)
)
if not "%parameterStr%"=="" goto parameterSplit
echo curr Board is: %BOARD_NAME%
echo curr Chip is: %CHIP_NAME%
echo curr Type is: %CHIP_TYPE%
echo curr Project is: %PROJECT_NAME%
echo curr core is: %CORE_NAME%
echo curr option is: %BUILD_OPTION%
echo cp bin subpath: %CPBIN_SUBPATH%
rem duplicate comdblib.txt from 'COMDBLIB_PATH' to '.\tools\'
if exist %COMDBLIB_PATH%\comdblib.txt (
xcopy /f /y %COMDBLIB_PATH%\comdblib.txt .\tools\
)
if "%CUST%"=="qcom" (
rem clear AT ref for qcom
for /f "tokens=1* delims=" %%a in ('type ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk"') do (
if "%%a" equ "PS_AT_REF=y" (
echo PS_AT_REF=n
) else if "%%a" equ "BUILD_AT_REF ?=n" (
echo BUILD_AT_REF=n
) else (
echo %%a
)
)>>temp.txt
type temp.txt | findstr /v ECHO >>temp1.txt
del temp.txt
move temp1.txt ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk" >nul
)
rem --------- if more board/project add here-------------
rem --------- board/project parsing end------------------
echo PARAMETERS: %PARAMETERS% | findstr "help"
if not errorlevel 1 (
echo "=============================================================================================="
echo " "
echo " >> HOW TO BUILD A PROJECT << "
echo " "
echo "==============================================================================================¡±
echo " "
echo " @FORMAT : Gccbuild.bat [<board>[-<core>[-<project>[-<option>]]]] "
echo " @CAUTION: All parameters (<board>/<core>/<project>/<option>) are optional, "
echo " and the default settings of the project will take effect if it occurs! "
echo " For <board>, only 'ec618_0h00' is supportted, and it should be omitted ! "
echo " "
echo "**********************************************************************************************"
echo " <options>: "
echo " >> Basic "
echo " merge compile bl, cp and ap images and merge them into a package. [default] "
echo " doc run doxygen to generate the documents. "
echo " clean clean the output files for a specific board and project. "
echo " clall clean all output files for every board and project. "
echo " allprojects trigger to compile all example projects of the default board "
echo " list list all supported boards and supported projects for every board "
echo " help display this help message. "
echo " "
echo " >> Advanced "
echo " NULL(ram) open dev, more ram, AP lib: ram, CP image£ºram "
echo " ram open_dev + addtional 100K ram AP lib: ram, CP image£ºram "
echo " isms open_cpu + ims sms, AP lib: isms, CP image£ºram "
echo "**********************************************************************************************"
echo " Examples: "
echo "----------------------- For Internal Full Source Build----------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader, cp, ap images and merge them into a package. "
echo " > Gccbuild.bat ap-at_command "
echo " build ap at_command project only. "
echo " > Gccbuild.bat ap-bootloader "
echo " build bootloader project only. "
echo " > Gccbuild.bat cp "
echo " build cp project only. "
echo " > Gccbuild.bat ap-driver_example-clean "
echo " clean all output files for ap driver_example project. "
echo " "
echo "----------------------- For Customer's SDK Build----------------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader,ap images, use prebuilt cp image, and merge them into a package. "
echo " > Gccbuild.bat project_name e.g. project_name = at_command/driver_example "
echo " build xxx(project_name) project "
echo " "
echo " @NOTE: SDK build always generates a package(project_name.bin + bootloader.bin + cp.bin). "
echo " "
echo "----------------------- For Universal Build---------------------------------------------------"
echo " > Gccbuild.bat clean "
echo " clean all output files for the default project. "
echo " > Gccbuild.bat clall "
echo " clean all output files for every board and project. "
echo " > Gccbuild.bat list "
echo " list all supported boards and supported projects for every board. "
echo " "
echo " > Gccbuild.bat open_cpu "
echo " build 'open cpu' mode images of the default project, and merge them into a package. "
echo " "
echo "**********************************************************************************************"
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "list"
if not errorlevel 1 (
echo ---------------Supported Board------------------------------------
for /d %%i in ("project\*") do (echo %%~nxi )
echo ------------------------------------------------------------------
for /d %%i in ("project\*") do (
set CURRENT_BOARD=%%~nxi
echo *********supported projects for board: !CURRENT_BOARD!*************
for /d %%i in ("project\!CURRENT_BOARD!\ap\apps\*") do (echo ----%%~nxi )
)
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "doc"
if not errorlevel 1 (
pushd doxygen
CALL genDoc.bat %CHIP_NAME%
popd
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clall"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean all done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clean"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gcc TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clobj"
if not errorlevel 1 (
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.o
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.a
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.elf
echo clean objs done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "allprojects"
if not errorlevel 1 (
if exist .\gccout\%OUTPUT_NAME% (
echo delete %OUTPUT_NAME% folder......
rd .\gccout\%OUTPUT_NAME% /s /q
)
rem step1 build cp if not SDK
if not exist .\tools\comdblib.txt (
echo start logprepass b11
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
)
rem step2 build bootloader no matter SDK or not
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=ap BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo *********supported projects for board: %BOARD_NAME%*************
for /d %%i in ("project\%BOARD_NAME%\ap\apps\*") do (
set CURRENT_PROJECT=%%~nxi
echo ----!CURRENT_PROJECT!
if "!CURRENT_PROJECT!"=="bootloader" (
echo ignore bootloader when loop all project
) else (
echo 111
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
if exist .\tools\comdblib.txt (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true SDK=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
) else (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if not exist .\tools\comdblib.txt (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
) else (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
)
goto complete
)
set starttime=%time%
echo Start time: %date% %starttime%
if "%BUILD_OPTION%"=="merge" (
if exist .\tools\comdblib.txt (
echo start logprepass
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% BUILD_UNILOG=false BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
) else (
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% SDK_REL=%SDKREL% BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo start logprepass b22
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.elf
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
)
)
if %PROJECT_NAME%==bootloader goto :buildimage
if %PROJECT_NAME%==driver_example goto :buildimage
set UNILOG=true
echo start logprepass b2
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% TOOLCHAIN_NAME=%TOOLCHAIN_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\debug_log_%CORE_NAME%.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo -----build image----
:buildimage
REM goto end
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=%UNILOG% BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem copy log database to output dir after compile successfully
REM cp .\tools\comdb_%CORE_NAME%.txt .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\comdb.txt
:complete
set endtime=%time%
echo .
echo End time: %date% %endtime%
set /a h1=%starttime:~0,2%
set /a m1=1%starttime:~3,2%-100
set /a s1=1%starttime:~6,2%-100
set /a h2=%endtime:~0,2%
set /a m2=1%endtime:~3,2%-100
set /a s2=1%endtime:~6,2%-100
if %h2% LSS %h1% set /a h2=%h2%+24
set /a ts1=%h1%*3600+%m1%*60+%s1%
set /a ts2=%h2%*3600+%m2%*60+%s2%
set /a ts=%ts2%-%ts1%
set /a h=%ts%/3600
set /a m=(%ts%-%h%*3600)/60
set /a s=%ts%%%60
echo Built took %h% hours %m% minutes %s% seconds
echo #######################################################################
echo ## ##
echo ## ######## ### ###### ###### ##
echo ## ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ## ##
echo ## ######## ## ## ###### ###### ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ###### ###### ##
echo ## ##
echo #######################################################################
echo build successfully
if %UNILOG%==true (
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
:end
goto:eof
:failHandle
echo fail
echo #######################################################################
echo ## ##
echo ## ######## ### #### ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ##
echo ## ###### ## ## ## ## ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## #### ######## ##
echo ## ##
echo #######################################################################
goto:eof

View File

@ -0,0 +1,838 @@
#!/bin/bash
echo $PATH
clear
export BUILD_ENV=linux
export PROJECT_NAME=at_command
export BOARD_NAME=ec7xx_0h00
export CHIP_NAME=ec7xx
export CHIP_TYPE=ec716e
export CORE_NAME=ap
export EUTRAN_MODE=cat_mode
export BUILD_OPTION=merge
export UNILOG=false
export TOOLCHAIN_NAME=GCC
export CUST=common
export SDKREL=false
export OPENCPU=true
export LTO_ENABLE=false
export GCF_ENABLE=false
export RAM_ENBALE=true
export ROM_ENABLE=false
export LESS_LOG=false
export PWR_TEST=false
export BUILD_HEADBIN=false
export GCCLIB_PATH="$HOME/gcc"
export COMDBLIB_PATH="./prebuild/PLAT/lib/gcc/$CHIP_TYPE/ram"
export CPBIN_SUBPATH=ram
export PKG_MAPDEF=pkg_716e_mapdef
export PKG_PRODUCT="EC716E_PRD"
export OUTPUT_NAME=$BOARD_NAME"_"$CHIP_TYPE
export JOBNUMBER=j8
export CUR_PATH=$('pwd')
echo $0 version $(date "+%Y%m%d")
echo GCCLIB_PATH: $GCCLIB_PATH
echo Chip Type: $CHIP_TYPE
if [ ! -e $GCCLIB_PATH ]
then
echo ERROR:Please check GCCLIB_PATH setting,exit!!!
exit 1
fi
if [ ! -e "gccout" ]; then
mkdir gccout
fi
echo CUR_PATH:$CUR_PATH
#touch -d $(date "+%Y%m%d%H%M%S") ./fibocom/fibo-framework/module/ffw_verno/verno.c
PARAMETERS=$1
OLD_IFS="$IFS"
IFS="-"
PARAMARRY=($*)
IFS="$OLD_IFS"
check_param(){
for param in ${PARAMARRY[@]}
do
if [ -n "$(echo $param|grep -w 'qcom')" ]
then
export CUST=qcom
fi
if [ -n "$(echo $param|grep -w 'ec716e_0h00')" ]
then
export BOARD_NAME=ec7xx_0h00
export CHIP_NAME=ec7xx
export OUTPUT_NAME=ec7xx_0h00_$CHIP_TYPE
fi
if [ -n "$(echo $param|grep -w 'bootloader')" ]
then
export PROJECT_NAME=bootloader
export BUILD_OPTION=no_merge
fi
if [ -n "$(echo $param|grep -w 'ap')" ]
then
export CORE_NAME=ap
export BUILD_OPTION=no_merge
fi
if [ -n "$(echo $param|grep -w 'cp')" ]
then
export CORE_NAME=cp
export PROJECT_NAME=cp_project
export BUILD_OPTION=no_merge
fi
if [ -n "$(echo $param|grep -w 'pwrTest')" ]
then
export PWR_TEST=true
fi
if [ -n "$(echo $param|grep -w 'nb_mode')" ]
then
export EUTRAN_MODE=nb_mode
fi
if [ -n "$(echo $param|grep -w 'at_command')" ]
then
export PROJECT_NAME=at_command
fi
if [ -n "$(echo $param|grep -w 'socket_command')" ]
then
export PROJECT_NAME=socket_command
fi
if [ -n "$(echo $param|grep -w 'mqtt_example')" ]
then
export PROJECT_NAME=mqtt_example
fi
if [ -n "$(echo $param|grep -w 'https_example')" ]
then
export PROJECT_NAME=https_example
fi
if [ -n "$(echo $param|grep -w 'ssl_example')" ]
then
export PROJECT_NAME=ssl_example
fi
if [ -n "$(echo $param|grep -w 'libapi_example')" ]
then
export PROJECT_NAME=libapi_example
fi
if [ -n "$(echo $param|grep -w 'pos_example')" ]
then
export PROJECT_NAME=pos_example
fi
if [ -n "$(echo $param|grep -w 'tts_example')" ]
then
export PROJECT_NAME=tts_example
fi
if [ -n "$(echo $param|grep -w 'audio_example')" ]
then
export PROJECT_NAME=audio_example
fi
if [ -n "$(echo $param|grep -w 'lpuart_test')" ]
then
export PROJECT_NAME=lpuart_test
fi
if [ -n "$(echo $param|grep -w 'driver_example')" ]
then
export PROJECT_NAME=driver_example
export BUILD_OPTION=no_merge
fi
if [ -n "$(echo $param|grep -w 'dhrystone')" ]
then
export PROJECT_NAME=dhrystone
fi
if [ -n "$(echo $param|grep -w 'coremark')" ]
then
export PROJECT_NAME=coremark
fi
if [ -n "$(echo $param|grep -w 'slpman_example')" ]
then
export PROJECT_NAME=slpman_example
fi
if [ -n "$(echo $param|grep -w 'sleep_example')" ]
then
export PROJECT_NAME=sleep_example
fi
if [ -n "$(echo $param|grep -w 'slpPressure_test')" ]
then
export PROJECT_NAME=slpPressure_test
export BUILD_OPTION=no_merge
export LTO_ENABLE=false
fi
if [ -n "$(echo $param|grep -w 'AonDigPressure_test')" ]
then
export PROJECT_NAME=AonDigPressure_test
export BUILD_OPTION=no_merge
export LTO_ENABLE=false
fi
if [ -n "$(echo $param|grep -w 'ModemSlpPressure')" ]
then
export CORE_NAME=cp
export PROJECT_NAME=ModemSlpPressure
export BUILD_OPTION=no_merge
export LTO_ENABLE=false
fi
if [ -n "$(echo $param|grep -w 'mcu_example')" ]
then
export PROJECT_NAME=mcu_example
fi
if [ -n "$(echo $param|grep -w 'soc_simple')" ]
then
export PROJECT_NAME=soc_simple
fi
if [ -n "$(echo $param|grep -w 'soc_bist')" ]
then
export PROJECT_NAME=soc_bist
fi
if [ -n "$(echo $param|grep -w 'simo_test')" ]
then
export PROJECT_NAME=simo_test
fi
if [ -n "$(echo $param|grep -w 'clk_verify')" ]
then
export PROJECT_NAME=clk_verify
export LTO_ENABLE=true
export BUILD_OPTION=merge
fi
if [ -n "$(echo $param|grep -w 'qspi_test')" ]
then
export PROJECT_NAME=qspi_test
export LTO_ENABLE=false
fi
if [ -n "$(echo $param|grep -w 'fpga_sct_utfw')" ]
then
export PROJECT_NAME=fpga_sct_utfw
fi
if [ -n "$(echo $param|grep -w 'merge')" ]
then
export BUILD_OPTION=merge
fi
if [ -n "$(echo $param|grep -w 'sdkrel')" ]
then
export SDKREL=true
fi
if [ -n "$(echo $param|grep -w 'lto')" ]
then
export LTO_ENABLE=true
fi
if [ -n "$(echo $param|grep -w 'ram')" ]
then
export OPENCPU=true
export RAM_ENBALE=true
export COMDBLIB_PATH="./prebuild/PLAT/lib/gcc/$CHIP_TYPE/ram"
export CPBIN_SUBPATH=ram
fi
if [ -n "$(echo $param|grep -w 'basic')" ]
then
export IMS_SMSONLY_ENABLE=true
export RAM_ENBALE=true
export COMDBLIB_PATH="./prebuild/PLAT/lib/gcc/$CHIP_TYPE/isms"
export CPBIN_SUBPATH=ram
fi
if [ -n "$(echo $param|grep -w 'verbose')" ]
then
export VERBOSE=1
else
export VERBOSE=0
fi
done
}
if [ $# -eq 0 ];then
echo no input paramter, use default build setting
echo default Board is: $BOARD_NAME
echo default Chip is: $CHIP_NAME
echo default ChipType is: $CHIP_TYPE
echo default Project is: $PROJECT_NAME
echo default core is: $CORE_NAME
echo default option is: $BUILD_OPTION
else
check_param
fi
if [ -n "$(echo $LITE|grep 'true')" ]
then
export COMDBLIB_PATH="./prebuild/PLAT/lib/gcc/lite"
fi
if [ -f '$COMDBLIB_PATH/comdblib.txt' ]
then
echo cp '$COMDBLIB_PATH/comdblib.txt' './tools/'
cp '$COMDBLIB_PATH/comdblib.txt' './tools/'
fi
echo curr Board is: $BOARD_NAME
echo curr Chip is: $CHIP_NAME
echo curr Type is: $CHIP_TYPE
echo curr Project is: $PROJECT_NAME
echo curr core is: $CORE_NAME
echo curr option is: $BUILD_OPTION
echo cp bin subpath: $CPBIN_SUBPATH
if [ -f "$COMDBLIB_PATH/comdblib.txt" ]
then
cp -f $COMDBLIB_PATH/comdblib.txt ./tools/
fi
if [ -n "$(echo $PARAMETERS|grep 'help')" ]
then
echo "=============================================================================================="
echo " "
echo " >> HOW TO BUILD A PROJECT << "
echo " "
echo "=============================================================================================="
echo " "
echo " @FORMAT : Gccbuild.sh [<board>[-<core>[-<project>[-<option>]]]] "
echo " @CAUTION: All parameters (<board>/<core>/<project>/<option>) are optional, "
echo " and the default settings of the project will take effect if it occurs! "
echo " For <board>, only 'ec718_0h00' is supportted, and it should be omitted ! "
echo " "
echo "**********************************************************************************************"
echo " <options>: "
echo " >> Basic "
echo " merge compile bl, cp and ap images and merge them into a package. [default] "
echo " clean clean the output files for a specific board and project. "
echo " clall clean all output files for every board and project. "
echo " allprojects trigger to compile all example projects of the default board "
echo " list list all supported boards and supported projects for every board "
echo " help display this help message. "
echo " "
echo " >> Advanced "
echo " NULL(ram) for open dev, more ram, AP lib: oc, CP image: oc "
echo " ram open_dev + addtional 100K ram AP lib: ram, CP image: ram "
echo " isms open_cpu + ims sms, AP lib: isms, CP image: oc "
echo "**********************************************************************************************"
echo " Examples: "
echo "----------------------- For Internal Full Source Build----------------------------------------"
echo " > Gccbuild.sh "
echo " build bootloader, ap images and merge them into a package. "
echo " > Gccbuild.sh ap-at_command "
echo " build ap at_command project only. "
echo " > Gccbuild.sh ap-bootloader "
echo " build bootloader project only. "
echo " > Gccbuild.bat cp "
echo " build cp project only. "
echo " > Gccbuild.sh ap-driver_example-clean "
echo " clean all output files for ap driver_example project. "
echo " "
echo "----------------------- For Customer's SDK Build----------------------------------------------"
echo " > Gccbuild.sh "
echo " build bootloader,ap images, use prebuilt cp image, and merge them into a package. "
echo " > Gccbuild.sh project_name e.g. project_name = at_command/driver_example "
echo " build xxx(project_name) project "
echo " "
echo " @NOTE: SDK build always generates a package(project_name.bin + bootloader.bin + cp.bin). "
echo " "
echo "----------------------- For Universal Build---------------------------------------------------"
echo " > Gccbuild.sh clean "
echo " clean all output files for the default project. "
echo " > Gccbuild.sh clall "
echo " clean all output files for every board and project. "
echo " > Gccbuild.sh list "
echo " list all supported boards and supported projects for every board. "
echo " "
echo " > Gccbuild.sh open_cpu "
echo " build 'open cpu' mode images of the default project, and merge them into a package. "
echo " "
echo "**********************************************************************************************"
exit 1
fi
if [ -n "$(echo $PARAMETERS|grep 'list')" ]
then
echo ---------------Supported Board------------------------------------
for Board in $(ls $CUR_PATH/project/)
do
echo $Board
done
echo ------------------------------------------------------------------
for Board in $(ls $CUR_PATH/project/)
do
Board_path=$CUR_PATH/project/$Board
CURRENT_PROJECTS=$Board_path/ap/apps
#echo $CURRENT_BOARD/*
if [ -e $CURRENT_PROJECTS ]
then
echo *********supported projects for board: $Board*************
for projects in $(ls $CURRENT_PROJECTS/)
do
echo ----$projects
done
fi
done
exit 1
fi
end()
{
echo "--end--"
exit 1
}
if [ -n "$(echo $PARAMETERS|grep 'clall')" ]
then
make -$JOBNUMBER clean-gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME PROJECT=$PROJECT_NAME CORE=$CORE_NAME
rm -rf ./gccout/*
echo "clean all done ok..."
end
fi
if [ -n "$(echo $PARAMETERS|grep 'clean')" ]
then
make -$JOBNUMBER clean-gcc TYPE=$CHIP_TYPE TARGET=$BOARD_NAME PROJECT=$PROJECT_NAME CORE=$CORE_NAME
echo "clean done ok..."
end
fi
if [ -n "$(echo $PARAMETERS|grep 'clobj')" ]
then
rm -rf ./gccout/$OUTPUT_NAME/$CORE_NAME/$PROJECT_NAME/*.o
rm -rf ./gccout/$OUTPUT_NAME/$CORE_NAME/$PROJECT_NAME/*.a
rm -rf ./gccout/$OUTPUT_NAME/$CORE_NAME/$PROJECT_NAME/*.elf
echo "clean objs done ok..."
end
fi
completeHandle()
{
endtime=$(date "+%Y/%m/%d %H:%M:%S")
echo "Start time:" $starttime
echo "End time:" $endtime
echo "#######################################################################"
echo "## ##"
echo "## ######## ### ###### ###### ##"
echo "## ## ## ## ## ## ## ## ## ##"
echo "## ## ## ## ## ## ## ##"
echo "## ######## ## ## ###### ###### ##"
echo "## ## ######### ## ## ##"
echo "## ## ## ## ## ## ## ## ##"
echo "## ## ## ## ###### ###### ##"
echo "## ##"
echo "#######################################################################"
echo build successfully
exit 1
}
failHandle()
{
echo fail
echo "#######################################################################"
echo "## ##"
echo "## ######## ### #### ## ##"
echo "## ## ## ## ## ## ##"
echo "## ## ## ## ## ## ##"
echo "## ###### ## ## ## ## ##"
echo "## ## ######### ## ## ##"
echo "## ## ## ## ## ## ##"
echo "## ## ## ## #### ######## ##"
echo "## ##"
echo "#######################################################################"
exit 1
}
starttime=$(date "+%Y/%m/%d %H:%M:%S")
echo "Start time:" $starttime
if [ -n "$(echo $PARAMETERS|grep 'allobjects')" ]
then
if [ -e ./gccout/$OUTPUT_NAME ]
then
echo delete $OUTPUT_NAME folder......
rm -rf ./gccout/$OUTPUT_NAME
fi
#step1 build cp if not SDK
if [ ! -f "./tools/comdblib.txt" ]
then
echo start logprepass b11
if [ -f "./tools/UpdateDBPattern.txt" ]
then
rm -f ./tools/UpdateDBPattern.txt
fi
make -$JOBNUMBER build-unilog TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/cp/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
#this header file will compile with device code
cp -f ./gccout/$OUTPUT_NAME/cp/cp_project/debug_log_cp.h ./middleware/developed/debug/inc/
make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/cp/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
fi
#step2 build bootloader no matter SDK or not
make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=bootloader CORE=ap BUILD_UNILOG=false BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/ap/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
echo *********supported projects for board: $BOARD_NAME*************
for projects in $(ls $CUR_PATH/project/$BOARD_NAME/ap/apps/)
do
echo ----$projects
if [ "$projects" == "bootloader" ]
then
echo ignore bootloader when loop all project
else
#this header file will compile with device code
if [ "$projects" == "at_command" ]
then
cp -p ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/debug_log_ap.h ./middleware/developed/debug/inc/
if [ -e "./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/dbversion.h" ]; then
cp -p -rf ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/dbversion.h ./middleware/developed/debug/inc/
fi
fi
if [ -f "./tools/UpdateDBPattern.txt" ]
then
rm -f ./tools/UpdateDBPattern.txt
fi
if [ -f "./tools/comdblib.txt" ]
then
make -$JOBNUMBER build-unilog TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE PROJECT=$projects CORE=ap BUILD_UNILOG=true SDK=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/ap/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
else
make -$JOBNUMBER build-unilog TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE PROJECT=$projects CORE=ap BUILD_UNILOG=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/ap/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
fi
make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=$projects CORE=ap BUILD_UNILOG=true BUILD_CUST=$CUST SDK=true | tee ./gccout/$OUTPUT_NAME/ap/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
#718p: SYSBNADR=7e000 718s: SYSBNADR=72000
if [ ! -f ./tools/comdblib.txt ]
then
./tools/fcelf -T -bin ./gccout/$OUTPUT_NAME/ap/$projects/ap_$projects.bin -size AP_PKGIMG_LIMIT_SIZE \
-bin ./gccout/$OUTPUT_NAME/cp/cp_project/cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE \
-bin ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE \
-h ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt
if [ $? -ne 0 ]
then
failHandle
fi
./tools/fcelf -M -input ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE \
-input ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/ap_$PROJECT_NAME.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE \
-input ./prebuild/FW/lib/gcc/$CHIP_TYPE/$CPBIN_SUBPATH/cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE \
-pkgmode 1 \
-banoldtool 1 \
-productname $PKG_PRODUCT \
-def ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt \
-outfile ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/$PROJECT_NAME.binpkg
if [ $? -ne 0 ]
then
failHandle
fi
./tools/fcelf -m -input ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE \
-input ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/ap_$PROJECT_NAME.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE \
-input ./prebuild/FW/lib/gcc/$CHIP_TYPE/$CPBIN_SUBPATH/cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE \
-pkgmode 1 \
-banoldtool 1 \
-productname $PKG_PRODUCT \
-def ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt \
-outfile ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/$PROJECT_NAME.elf
if [ $? -ne 0 ]
then
failHandle
fi
else
./tools/fcelf -T -bin ./gccout/$OUTPUT_NAME/ap/$projects/ap_$projects.bin -size AP_PKGIMG_LIMIT_SIZE \
-bin ./prebuild\FW/lib/gcc/$CHIP_TYPE/$CPBIN_SUBPATH/cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE \
-bin ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE \
-h ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt
if [ $? -ne 0 ]
then
failHandle
fi
./tools/fcelf -M -input ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE \
-input ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/ap_$PROJECT_NAME.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE \
-input ./prebuild/FW/lib/gcc/$CHIP_TYPE/$CPBIN_SUBPATH/cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE \
-pkgmode 1 \
-banoldtool 1 \
-productname $PKG_PRODUCT \
-def ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt \
-outfile ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/$PROJECT_NAME.binpkg
if [ $? -ne 0 ]
then
failHandle
fi
fi
if [ -f "./tools/UpdateDBPattern.txt" ]
then
cat ./tools/UpdateDBPattern.txt
fi
fi
done
completeHandle
fi
if [ "$BUILD_OPTION" == "merge" ]
then
if [ -f './tools/comdblib.txt' ]
then
echo start loggpress
make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=bootloader CORE=$CORE_NAME BUILD_UNILOG=false BUILD_CUST=$CUST SDK=true | tee ./gccout/$OUTPUT_NAME/$CORE_NAME/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
#failHandle
if [ -e './tools/UpdateDBPattern.txt' ]
then
rm -f ./tools/UpdateDBPattern.txt
fi
make -$JOBNUMBER build-unilog TYPE=$CHIP_TYPE TARGET=$BOARD_NAME PROJECT=$PROJECT_NAME CORE=$CORE_NAME BUILD_UNILOG=true BUILD_CUST=$CUST SDK=true
# copy log file
cp -p ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/debug_log_ap.h ./middleware/developed/debug/inc/
if [ -e "./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/dbversion.h" ]; then
cp -p -rf ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/dbversion.h ./middleware/developed/debug/inc/
fi
# build ap
make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=$PROJECT_NAME CORE=ap BUILD_UNILOG=true BUILD_CUST=$CUST SDK=true MANUFACTURER=$MANUFACTURER | tee ./gccout/$OUTPUT_NAME/ap/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
./tools/fcelf -T -bin ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/ap_$PROJECT_NAME.bin -size AP_PKGIMG_LIMIT_SIZE \
-bin ./prebuild/FW/lib/gcc/$CHIP_TYPE/$CPBIN_SUBPATH/cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE \
-bin ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE \
-h ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt
if [ $? -ne 0 ]
then
failHandle
fi
./tools/fcelf -M -input ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE \
-input ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/ap_$PROJECT_NAME.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE \
-input ./prebuild/FW/lib/gcc/$CHIP_TYPE/$CPBIN_SUBPATH/cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE \
-pkgmode 1 \
-banoldtool 1 \
-productname $PKG_PRODUCT \
-def ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt \
-outfile ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/$PROJECT_NAME.binpkg
if [ $? -ne 0 ]
then
failHandle
fi
if [ "$FIBOCOM_PKG_OPENSDK" == "true" ];
then
if [ -e "opensdk.py" ]; then
python3 opensdk.py $PROJECT_NAME $CHIP_TYPE
./opensrc.sh
fi
fi
if [ -f ./tools/UpdateDBPattern.txt ]
then
rm -f ./tools/UpdateDBPattern.txt
fi
completeHandle
else
make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=bootloader CORE=$CORE_NAME SDK_REL=$SDKREL BUILD_UNILOG=false BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/$CORE_NAME/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
echo start logprepass b22
if [ -e './tools/UpdateDBPattern.txt' ]
then
rm -f ./tools/UpdateDBPattern.txt
fi
make -$JOBNUMBER build-unilog TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE PROJECT=cp_project CORE=cp SDK_REL=$SDKREL BUILD_UNILOG=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/cp/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=cp_project CORE=cp SDK_REL=$SDKREL BUILD_UNILOG=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/cp/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
make -$JOBNUMBER build-unilog TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE PROJECT=$PROJECT_NAME CORE=ap SDK_REL=$SDKREL BUILD_UNILOG=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/ap/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
# copy log file
cp -p ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/debug_log_ap.h ./middleware/developed/debug/inc/
if [ -e "./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/dbversion.h" ]; then
cp -p -rf ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/dbversion.h ./middleware/developed/debug/inc/
fi
# build ap
make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=$PROJECT_NAME CORE=ap SED_REL=$SDKREL BUILD_UNILOG=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/ap/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
./tools/fcelf -T -bin ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/ap_$PROJECT_NAME.bin -size AP_PKGIMG_LIMIT_SIZE \
-bin ./gccout/$OUTPUT_NAME/cp/cp_project/cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE \
-bin ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE \
-h ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt
if [ $? -ne 0 ]
then
failHandle
fi
./tools/fcelf -M -input ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE \
-input ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/ap_$PROJECT_NAME.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE \
-input ./prebuild/FW/lib/gcc/$CHIP_TYPE/$CPBIN_SUBPATH/cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE \
-pkgmode 1 \
-banoldtool 1 \
-productname $PKG_PRODUCT \
-def ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt \
-outfile ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/$PROJECT_NAME.binpkg
if [ $? -ne 0 ]
then
failHandle
fi
./tools/fcelf -m -input ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE \
-input ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/ap_$PROJECT_NAME.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE \
-input ./gccout/$OUTPUT_NAME/cp/cp_project/cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE \
-pkgmode 1 \
-banoldtool 1 \
-productname $PKG_PRODUCT \
-def ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt \
-outfile ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/$PROJECT_NAME.elf
if [ $? -ne 0 ]
then
failHandle
fi
if [ -f ./tools/UpdateDBPattern.txt ]
then
rm -f ./tools/UpdateDBPattern.txt
fi
completeHandle
fi
fi
buildimage()
{
echo "buildimage"
( make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=$PROJECT_NAME CORE=$CORE_NAME BUILD_UNILOG=$UNILOG BUILD_CUST=$CUST ) | tee ./gccout/$OUTPUT_NAME/$CORE_NAME/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
else
completeHandle
fi
}
if [ -n "$(echo $PROJECT_NAME|grep 'bootloader')" ]
then
buildimage
fi
if [ -n "$(echo $PROJECT_NAME|grep 'driver_example')" ]
then
buildimage
fi
export UNILOG=true
echo "start logprepass b2"
if [ -f ./tools/UpdateDBPattern.txt ]
then
rm -f ./tools/UpdateDBPattern.txt
fi
make -$JOBNUMBER build-unilog TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE PROJECT=$PROJECT_NAME CORE=$CORE_NAME TOOLCHAIN_NAME=$TOOLCHAIN_NAME BUILD_UNILOG=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/$CORE_NAME/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
#this header file will compile with device code
cp -f ./gccout/$OUTPUT_NAME/$CORE_NAME/$PROJECT_NAME/debug_log_$CORE_NAME.h ./middleware/developed/debug/inc/
if [ $? -ne 0 ]
then
failHandle
fi
if [ -f ./gccout/$OUTPUT_NAME/$CORE_NAME/$PROJECT_NAME/dbversion.h ]
then
cp -f ./gccout/$OUTPUT_NAME/$CORE_NAME/$PROJECT_NAME/dbversion.h ./middleware/developed/debug/inc/
if [ $? -ne 0 ]
then
failHandle
fi
fi
buildimage

View File

@ -0,0 +1,871 @@
@echo off && setlocal enabledelayedexpansion
@echo %PATH% | findstr /c:"%~dp0tools/msys64/usr/bin">nul
@if %errorlevel% equ 1 set PATH=%~dp0tools/msys64/usr/bin;%PATH%
rem @set PATH=%~dp0tools/msys64/usr/bin;%PATH%
cls
set PROJECT_NAME=at_command
set BOARD_NAME=ec7xx_0h00
set CHIP_NAME=ec7xx
set CHIP_TYPE=ec716s
set CORE_NAME=ap
set EUTRAN_MODE=cat_mode
set BUILD_OPTION=merge
set UNILOG=false
set TOOLCHAIN_NAME=GCC
set CUST=common
set SDKREL=false
set OPENCPU=true
set LTO_ENABLE=true
set GCF_ENABLE=false
set RAM_ENBALE=false
set ROM_ENBALE=false
set LESS_LOG=false
set PWR_TEST=false
set BUILD_HEADBIN=false
set GCCLIB_PATH="C:\gcc"
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\oc"
set CPBIN_SUBPATH=oc
set PKG_MAPDEF=pkg_716s_mapdef
set PKG_PRODUCT="EC716S_PRD"
set OUTPUT_NAME=%BOARD_NAME%_%CHIP_TYPE%
set JOBNUMBER=j8
set FOTA_SIGN=no_sign
echo build.bat version 20180330
echo GCCLIB_PATH: %GCCLIB_PATH%
if not %GCCLIB_PATH% == "" (
if not exist %GCCLIB_PATH% (
echo ERROR: Please check GCCLIB_PATH setting, exit!!!
goto end
)
) else (
echo ERROR: Please set GCCLIB_PATH firstly, exit!!!
goto end
)
rem --------- board/project parsing begain------------------
set PARAMETERS=%1
if xx%PARAMETERS%==xx (
echo no input paramter, use default build setting
) else (
echo build option is: %PARAMETERS%
)
set parameterStr=%PARAMETERS%
:parameterSplit
for /f "tokens=1,* delims=-" %%a in ("%parameterStr%") do (
set parameterStr=%%b
echo %%a | findstr /r "j[0-9]*[0-9]\>" > nul
if !errorlevel!==0 (
set JOBNUMBER=%%a
)
if "%%a"=="qcom" (
set CUST=qcom
)
if "%%a"=="ec716s_0h00" (
set BOARD_NAME=ec7xx_0h00
set CHIP_NAME=ec7xx
set OUTPUT_NAME=ec7xx_0h00_%CHIP_TYPE%
)
if "%%a"=="bootloader" (
set PROJECT_NAME=bootloader
set BUILD_OPTION=no_merge
)
if "%%a"=="ap" (
set CORE_NAME=ap
set BUILD_OPTION=no_merge
)
if "%%a"=="cp" (
set CORE_NAME=cp
set PROJECT_NAME=cp_project
set BUILD_OPTION=no_merge
)
if "%%a"=="pwrTest" (
set PWR_TEST=true
)
if "%%a"=="nb_mode" (
set EUTRAN_MODE=nb_mode
)
if "%%a"=="at_command" (
set PROJECT_NAME=at_command
)
if "%%a"=="socket_example" (
set PROJECT_NAME=socket_example
)
if "%%a"=="mqtt_example" (
set PROJECT_NAME=mqtt_example
)
if "%%a"=="https_example" (
set PROJECT_NAME=https_example
)
if "%%a"=="ssl_example" (
set PROJECT_NAME=ssl_example
)
if "%%a"=="libapi_example" (
set PROJECT_NAME=libapi_example
)
if "%%a"=="pos_example" (
set PROJECT_NAME=pos_example
)
if "%%a"=="tts_example" (
set PROJECT_NAME=tts_example
)
if "%%a"=="audio_example" (
set PROJECT_NAME=audio_example
)
if "%%a"=="lpuart_test" (
set PROJECT_NAME=lpuart_test
set LTO_ENABLE=false
)
if "%%a"=="driver_example" (
set PROJECT_NAME=driver_example
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="dhrystone" (
set PROJECT_NAME=dhrystone
)
if "%%a"=="coremark" (
set PROJECT_NAME=coremark
)
if "%%a"=="slpman_example" (
set PROJECT_NAME=slpman_example
)
if "%%a"=="sleep_example" (
set PROJECT_NAME=sleep_example
)
if "%%a"=="slpPressure_test" (
set PROJECT_NAME=slpPressure_test
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="AonDigPressure_test" (
set PROJECT_NAME=AonDigPressure_test
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="ModemSlpPressure" (
set CORE_NAME=cp
set PROJECT_NAME=ModemSlpPressure
set BUILD_OPTION=no_merge
set LTO_ENABLE=true
)
if "%%a"=="mcu_example" (
set PROJECT_NAME=mcu_example
)
if "%%a"=="soc_simple" (
set PROJECT_NAME=soc_simple
)
if "%%a"=="soc_bist" (
set PROJECT_NAME=soc_bist
)
if "%%a"=="simo_test" (
set PROJECT_NAME=simo_test
)
if "%%a"=="clk_verify" (
set PROJECT_NAME=clk_verify
set LTO_ENABLE=true
set BUILD_OPTION=merge
)
if "%%a"=="qspi_test" (
set PROJECT_NAME=qspi_test
set LTO_ENABLE=false
)
if "%%a"=="fpga_sct_utfw" (
set PROJECT_NAME=fpga_sct_utfw
)
if "%%a"=="spi_2boards" (
set PROJECT_NAME=spi_2boards
)
if "%%a"=="merge" (
set BUILD_OPTION=merge
)
if "%%a"=="sdkrel" (
set SDKREL=true
)
if "%%a"=="lto" (
set LTO_ENABLE=true
)
if "%%a"=="open_cpu" (
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\oc"
set CPBIN_SUBPATH=oc
)
if "%%a"=="ram" (
set OPENCPU=true
set RAM_ENBALE=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\ram"
set CPBIN_SUBPATH=ram
)
if "%%a"=="basic" (
set GCF_ENABLE=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\gcf"
set CPBIN_SUBPATH=wifi
)
if "%%a"=="mid" (
set MID_ENABLE=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\mid"
set CPBIN_SUBPATH=wifi
)
if "%%a"=="rom" (
set ROM_ENABLE=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\rom"
set CPBIN_SUBPATH=oc
)
if "%%a"=="lesslog" (
set LESS_LOG=true
if "%ROM_ENABLE%"=="true" (
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\rom_lesslog"
set CPBIN_SUBPATH=rom_lesslog
) else (
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\oc_lesslog"
set CPBIN_SUBPATH=oc
)
)
if "%%a"=="verbose" (
set VERBOSE=1
) else (
set VERBOSE=0
)
if "%%a"=="fota_sign" (
set FOTA_SIGN=fota_sign
)
)
if not "%parameterStr%"=="" goto parameterSplit
echo curr Board is: %BOARD_NAME%
echo curr Chip is: %CHIP_NAME%
echo curr Type is: %CHIP_TYPE%
echo curr Project is: %PROJECT_NAME%
echo curr core is: %CORE_NAME%
echo curr option is: %BUILD_OPTION%
echo cpbin subpath is: %CPBIN_SUBPATH%
echo comdblib path is: %COMDBLIB_PATH%
rem duplicate comdblib.txt from 'COMDBLIB_PATH' to '.\tools\'
if exist %COMDBLIB_PATH%\comdblib.txt (
xcopy /f /y %COMDBLIB_PATH%\comdblib.txt .\tools\
)
if "%CUST%"=="qcom" (
rem clear AT ref for qcom
for /f "tokens=1* delims=" %%a in ('type ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk"') do (
if "%%a" equ "PS_AT_REF=y" (
echo PS_AT_REF=n
) else if "%%a" equ "BUILD_AT_REF ?=n" (
echo BUILD_AT_REF=n
) else (
echo %%a
)
)>>temp.txt
type temp.txt | findstr /v ECHO >>temp1.txt
del temp.txt
move temp1.txt ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk" >nul
)
rem --------- if more board/project add here-------------
rem --------- board/project parsing end------------------
echo PARAMETERS: %PARAMETERS% | findstr "help"
if not errorlevel 1 (
echo "=============================================================================================="
echo " "
echo " >> HOW TO BUILD A PROJECT << "
echo " "
echo "==============================================================================================¡±
echo " "
echo " @FORMAT : Gccbuild.bat [<board>[-<core>[-<project>[-<option>]]]] "
echo " @CAUTION: All parameters (<board>/<core>/<project>/<option>) are optional, "
echo " and the default settings of the project will take effect if it occurs! "
echo " For <board>, only 'ec618_0h00' is supportted, and it should be omitted ! "
echo " "
echo "**********************************************************************************************"
echo " <options>: "
echo " >> Basic "
echo " merge compile bl, cp and ap images and merge them into a package. [default] "
echo " doc run doxygen to generate the documents. "
echo " clean clean the output files for a specific board and project. "
echo " clall clean all output files for every board and project. "
echo " allprojects trigger to compile all example projects of the default board "
echo " list list all supported boards and supported projects for every board "
echo " help display this help message. "
echo " "
echo " >> Advanced "
echo " NULL(mini) for open dev, more ram, AP lib: oc, CP image: oc "
echo " mid mini + wifi scan/sms AP lib: mid, CP image: wifi "
echo " basic support gcf test(test version), AP lib: gcf, CP image: wifi "
echo " ram open_dev + addtional 100K ram AP lib: ram, CP image: ram "
echo " rom mini + remove rndis/socket AP lib: rom, CP image: oc "
echo " rom-lesslog rom + log reducing AP lib: rom_lesslog, CP image: rom_lesslog "
echo " lesslog log reducing AP lib: rom_lesslog, CP image: oc "
echo "**********************************************************************************************"
echo " Examples: "
echo "----------------------- For Internal Full Source Build----------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader, cp, ap images and merge them into a package. "
echo " > Gccbuild.bat ap-at_command "
echo " build ap at_command project only. "
echo " > Gccbuild.bat ap-bootloader "
echo " build bootloader project only. "
echo " > Gccbuild.bat cp "
echo " build cp project only. "
echo " > Gccbuild.bat ap-driver_example-clean "
echo " clean all output files for ap driver_example project. "
echo " "
echo "----------------------- For Customer's SDK Build----------------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader,ap images, use prebuilt cp image, and merge them into a package. "
echo " > Gccbuild.bat project_name e.g. project_name = at_command/driver_example "
echo " build xxx(project_name) project "
echo " "
echo " @NOTE: SDK build always generates a package(project_name.bin + bootloader.bin + cp.bin). "
echo " "
echo "----------------------- For Universal Build---------------------------------------------------"
echo " > Gccbuild.bat clean "
echo " clean all output files for the default project. "
echo " > Gccbuild.bat clall "
echo " clean all output files for every board and project. "
echo " > Gccbuild.bat list "
echo " list all supported boards and supported projects for every board. "
echo " "
echo " > Gccbuild.bat open_cpu "
echo " build 'open cpu' mode images of the default project, and merge them into a package. "
echo " "
echo "**********************************************************************************************"
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "list"
if not errorlevel 1 (
echo ---------------Supported Board------------------------------------
for /d %%i in ("project\*") do (echo %%~nxi )
echo ------------------------------------------------------------------
for /d %%i in ("project\*") do (
set CURRENT_BOARD=%%~nxi
echo *********supported projects for board: !CURRENT_BOARD!*************
for /d %%i in ("project\!CURRENT_BOARD!\ap\apps\*") do (echo ----%%~nxi )
)
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "doc"
if not errorlevel 1 (
pushd doxygen
CALL genDoc.bat %CHIP_NAME%
popd
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clall"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean all done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clean"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gcc TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clobj"
if not errorlevel 1 (
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.o
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.a
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.elf
echo clean objs done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "allprojects"
if not errorlevel 1 (
if exist .\gccout\%OUTPUT_NAME% (
echo delete %OUTPUT_NAME% folder......
rd .\gccout\%OUTPUT_NAME% /s /q
)
rem step1 build cp if not SDK
if not exist .\tools\comdblib.txt (
echo start logprepass b11
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
)
rem step2 build bootloader no matter SDK or not
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=ap BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo *********supported projects for board: %BOARD_NAME%*************
for /d %%i in ("project\%BOARD_NAME%\ap\apps\*") do (
set CURRENT_PROJECT=%%~nxi
echo ----!CURRENT_PROJECT!
if "!CURRENT_PROJECT!"=="bootloader" (
echo ignore bootloader when loop all project
) else (
echo 111
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
if exist .\tools\comdblib.txt (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true SDK=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
) else (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if not exist .\tools\comdblib.txt (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
) else (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
)
goto complete
)
set starttime=%time%
echo Start time: %date% %starttime%
if "%BUILD_OPTION%"=="merge" (
if exist .\tools\comdblib.txt (
echo start logprepass
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% BUILD_UNILOG=false BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
) else (
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% SDK_REL=%SDKREL% BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo start logprepass b22
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.elf
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
)
)
if %PROJECT_NAME%==bootloader goto :buildimage
if %PROJECT_NAME%==driver_example goto :buildimage
set UNILOG=true
echo start logprepass b2
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% TOOLCHAIN_NAME=%TOOLCHAIN_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\debug_log_%CORE_NAME%.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo -----build image----
:buildimage
REM goto end
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=%UNILOG% BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem copy log database to output dir after compile successfully
REM cp .\tools\comdb_%CORE_NAME%.txt .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\comdb.txt
:complete
set endtime=%time%
echo .
echo End time: %date% %endtime%
set /a h1=%starttime:~0,2%
set /a m1=1%starttime:~3,2%-100
set /a s1=1%starttime:~6,2%-100
set /a h2=%endtime:~0,2%
set /a m2=1%endtime:~3,2%-100
set /a s2=1%endtime:~6,2%-100
if %h2% LSS %h1% set /a h2=%h2%+24
set /a ts1=%h1%*3600+%m1%*60+%s1%
set /a ts2=%h2%*3600+%m2%*60+%s2%
set /a ts=%ts2%-%ts1%
set /a h=%ts%/3600
set /a m=(%ts%-%h%*3600)/60
set /a s=%ts%%%60
echo Built took %h% hours %m% minutes %s% seconds
echo #######################################################################
echo ## ##
echo ## ######## ### ###### ###### ##
echo ## ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ## ##
echo ## ######## ## ## ###### ###### ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ###### ###### ##
echo ## ##
echo #######################################################################
echo build successfully
if %UNILOG%==true (
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
:end
goto:eof
:failHandle
echo fail
echo #######################################################################
echo ## ##
echo ## ######## ### #### ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ##
echo ## ###### ## ## ## ## ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## #### ######## ##
echo ## ##
echo #######################################################################
goto:eof

View File

@ -0,0 +1,882 @@
#!/bin/bash
echo $PATH
clear
export BUILD_ENV=linux
export PROJECT_NAME=at_command
export BOARD_NAME=ec7xx_0h00
export CHIP_NAME=ec7xx
export CHIP_TYPE=ec716s
export CORE_NAME=ap
export EUTRAN_MODE=cat_mode
export BUILD_OPTION=merge
export UNILOG=false
export TOOLCHAIN_NAME=GCC
export CUST=common
export SDKREL=false
export OPENCPU=true
export LTO_ENABLE=true
export GCF_ENABLE=false
export RAM_ENBALE=false
export ROM_ENABLE=false
export LESS_LOG=false
export PWR_TEST=false
export BUILD_HEADBIN=false
export GCCLIB_PATH="$HOME/gcc"
export COMDBLIB_PATH="./prebuild/PLAT/lib/gcc/$CHIP_TYPE/oc"
export CPBIN_SUBPATH=oc
export PKG_MAPDEF=pkg_716s_mapdef
export PKG_PRODUCT="EC716S_PRD"
export OUTPUT_NAME=$BOARD_NAME"_"$CHIP_TYPE
export JOBNUMBER=j8
export CUR_PATH=$('pwd')
echo $0 version $(date "+%Y%m%d")
echo GCCLIB_PATH: $GCCLIB_PATH
echo Chip Type: $CHIP_TYPE
if [ ! -e $GCCLIB_PATH ]
then
echo ERROR:Please check GCCLIB_PATH setting,exit!!!
exit 1
fi
if [ ! -e "gccout" ]; then
mkdir gccout
fi
echo CUR_PATH:$CUR_PATH
#touch -d $(date "+%Y%m%d%H%M%S") ./fibocom/fibo-framework/module/ffw_verno/verno.c
PARAMETERS=$1
OLD_IFS="$IFS"
IFS="-"
PARAMARRY=($*)
IFS="$OLD_IFS"
check_param(){
for param in ${PARAMARRY[@]}
do
if [ -n "$(echo $param|grep -w 'qcom')" ]
then
export CUST=qcom
fi
if [ -n "$(echo $param|grep -w 'ec716s_0h00')" ]
then
export BOARD_NAME=ec7xx_0h00
export CHIP_NAME=ec7xx
export OUTPUT_NAME=ec7xx_0h00_$CHIP_TYPE
fi
if [ -n "$(echo $param|grep -w 'bootloader')" ]
then
export PROJECT_NAME=bootloader
export BUILD_OPTION=no_merge
fi
if [ -n "$(echo $param|grep -w 'ap')" ]
then
export CORE_NAME=ap
export BUILD_OPTION=no_merge
fi
if [ -n "$(echo $param|grep -w 'cp')" ]
then
export CORE_NAME=cp
export PROJECT_NAME=cp_project
export BUILD_OPTION=no_merge
fi
if [ -n "$(echo $param|grep -w 'pwrTest')" ]
then
export PWR_TEST=true
fi
if [ -n "$(echo $param|grep -w 'nb_mode')" ]
then
export EUTRAN_MODE=nb_mode
fi
if [ -n "$(echo $param|grep -w 'at_command')" ]
then
export PROJECT_NAME=at_command
fi
if [ -n "$(echo $param|grep -w 'socket_command')" ]
then
export PROJECT_NAME=socket_command
fi
if [ -n "$(echo $param|grep -w 'mqtt_example')" ]
then
export PROJECT_NAME=mqtt_example
fi
if [ -n "$(echo $param|grep -w 'https_example')" ]
then
export PROJECT_NAME=https_example
fi
if [ -n "$(echo $param|grep -w 'ssl_example')" ]
then
export PROJECT_NAME=ssl_example
fi
if [ -n "$(echo $param|grep -w 'libapi_example')" ]
then
export PROJECT_NAME=libapi_example
fi
if [ -n "$(echo $param|grep -w 'pos_example')" ]
then
export PROJECT_NAME=pos_example
fi
if [ -n "$(echo $param|grep -w 'tts_example')" ]
then
export PROJECT_NAME=tts_example
fi
if [ -n "$(echo $param|grep -w 'audio_example')" ]
then
export PROJECT_NAME=audio_example
fi
if [ -n "$(echo $param|grep -w 'lpuart_test')" ]
then
export PROJECT_NAME=lpuart_test
export LTO_ENABLE=false
fi
if [ -n "$(echo $param|grep -w 'driver_example')" ]
then
export PROJECT_NAME=driver_example
export BUILD_OPTION=no_merge
export LTO_ENABLE=false
fi
if [ -n "$(echo $param|grep -w 'dhrystone')" ]
then
export PROJECT_NAME=dhrystone
fi
if [ -n "$(echo $param|grep -w 'coremark')" ]
then
export PROJECT_NAME=coremark
fi
if [ -n "$(echo $param|grep -w 'slpman_example')" ]
then
export PROJECT_NAME=slpman_example
fi
if [ -n "$(echo $param|grep -w 'sleep_example')" ]
then
export PROJECT_NAME=sleep_example
fi
if [ -n "$(echo $param|grep -w 'slpPressure_test')" ]
then
export PROJECT_NAME=slpPressure_test
export BUILD_OPTION=no_merge
export LTO_ENABLE=false
fi
if [ -n "$(echo $param|grep -w 'AonDigPressure_test')" ]
then
export PROJECT_NAME=AonDigPressure_test
export BUILD_OPTION=no_merge
export LTO_ENABLE=false
fi
if [ -n "$(echo $param|grep -w 'ModemSlpPressure')" ]
then
export CORE_NAME=cp
export PROJECT_NAME=ModemSlpPressure
export BUILD_OPTION=no_merge
export LTO_ENABLE=true
fi
if [ -n "$(echo $param|grep -w 'mcu_example')" ]
then
export PROJECT_NAME=mcu_example
fi
if [ -n "$(echo $param|grep -w 'soc_simple')" ]
then
export PROJECT_NAME=soc_simple
fi
if [ -n "$(echo $param|grep -w 'soc_bist')" ]
then
export PROJECT_NAME=soc_bist
fi
if [ -n "$(echo $param|grep -w 'simo_test')" ]
then
export PROJECT_NAME=simo_test
fi
if [ -n "$(echo $param|grep -w 'clk_verify')" ]
then
export PROJECT_NAME=clk_verify
export LTO_ENABLE=true
export BUILD_OPTION=merge
fi
if [ -n "$(echo $param|grep -w 'qspi_test')" ]
then
export PROJECT_NAME=qspi_test
export LTO_ENABLE=false
fi
if [ -n "$(echo $param|grep -w 'fpga_sct_utfw')" ]
then
export PROJECT_NAME=fpga_sct_utfw
fi
if [ -n "$(echo $param|grep -w 'spi_2boards')" ]
then
export PROJECT_NAME=spi_2boards
fi
if [ -n "$(echo $param|grep -w 'merge')" ]
then
export BUILD_OPTION=merge
fi
if [ -n "$(echo $param|grep -w 'sdkrel')" ]
then
export SDKREL=true
fi
if [ -n "$(echo $param|grep -w 'lto')" ]
then
export LTO_ENABLE=true
fi
if [ -n "$(echo $param|grep -w 'open_cpu')" ]
then
export OPENCPU=true
export COMDBLIB_PATH="./prebuild/PLAT/lib/gcc/$CHIP_TYPE/oc"
export CPBIN_SUBPATH=oc
fi
if [ -n "$(echo $param|grep -w 'ram')" ]
then
export OPENCPU=true
export RAM_ENBALE=true
export COMDBLIB_PATH="./prebuild/PLAT/lib/gcc/$CHIP_TYPE/ram"
export CPBIN_SUBPATH=ram
fi
if [ -n "$(echo $param|grep -w 'basic')" ]
then
export GCF_ENABLE=true
export COMDBLIB_PATH="./prebuild/PLAT/lib/gcc/$CHIP_TYPE/gcf"
export CPBIN_SUBPATH=wifi
fi
if [ -n "$(echo $param|grep -w 'mid')" ]
then
export MID_ENABLE=true
export COMDBLIB_PATH="./prebuild/PLAT/lib/gcc/$CHIP_TYPE/mid"
export CPBIN_SUBPATH=wifi
fi
if [ -n "$(echo $param|grep -w 'rom')" ]
then
export ROM_ENABLE=true
export COMDBLIB_PATH="./prebuild/PLAT/lib/gcc/$CHIP_TYPE/rom"
export CPBIN_SUBPATH=oc
fi
if [ -n "$(echo $param|grep -w 'lesslog')" ]
then
export LESS_LOG=true
if [ "$ROM_ENABLE" == "true" ]
then
export COMDBLIB_PATH="./prebuild/PLAT/lib/gcc/$CHIP_TYPE/rom_lesslog"
export CPBIN_SUBPATH=rom_lesslog
else
export COMDBLIB_PATH="./prebuild/PLAT/lib/gcc/$CHIP_TYPE/oc_lesslog"
export CPBIN_SUBPATH=oc
fi
fi
if [ -n "$(echo $param|grep -w 'verbose')" ]
then
export VERBOSE=1
else
export VERBOSE=0
fi
done
}
if [ $# -eq 0 ];then
echo no input paramter, use default build setting
echo default Board is: $BOARD_NAME
echo default Chip is: $CHIP_NAME
echo default ChipType is: $CHIP_TYPE
echo default Project is: $PROJECT_NAME
echo default core is: $CORE_NAME
echo default option is: $BUILD_OPTION
else
check_param
fi
if [ -n "$(echo $LITE|grep 'true')" ]
then
export COMDBLIB_PATH="./prebuild/PLAT/lib/gcc/lite"
fi
if [ -f '$COMDBLIB_PATH/comdblib.txt' ]
then
echo cp '$COMDBLIB_PATH/comdblib.txt' './tools/'
cp '$COMDBLIB_PATH/comdblib.txt' './tools/'
fi
echo curr Board is: $BOARD_NAME
echo curr Chip is: $CHIP_NAME
echo curr Type is: $CHIP_TYPE
echo curr Project is: $PROJECT_NAME
echo curr core is: $CORE_NAME
echo curr option is: $BUILD_OPTION
echo cp bin subpath is: $CPBIN_SUBPATH
echo comdblib path is: $COMDBLIB_PATH
if [ -f "$COMDBLIB_PATH/comdblib.txt" ]
then
cp -f $COMDBLIB_PATH/comdblib.txt ./tools/
fi
if [ -n "$(echo $PARAMETERS|grep 'help')" ]
then
echo "=============================================================================================="
echo " "
echo " >> HOW TO BUILD A PROJECT << "
echo " "
echo "=============================================================================================="
echo " "
echo " @FORMAT : Gccbuild.sh [<board>[-<core>[-<project>[-<option>]]]] "
echo " @CAUTION: All parameters (<board>/<core>/<project>/<option>) are optional, "
echo " and the default settings of the project will take effect if it occurs! "
echo " For <board>, only 'ec718_0h00' is supportted, and it should be omitted ! "
echo " "
echo "**********************************************************************************************"
echo " <options>: "
echo " >> Basic "
echo " merge compile bl, cp and ap images and merge them into a package. [default] "
echo " clean clean the output files for a specific board and project. "
echo " clall clean all output files for every board and project. "
echo " allprojects trigger to compile all example projects of the default board "
echo " list list all supported boards and supported projects for every board "
echo " help display this help message. "
echo " "
echo " >> Advanced "
echo " NULL(mini) for open dev, more ram, AP lib: oc, CP image: oc "
echo " mid mini + wifi scan/sms AP lib: mid, CP image: wifi "
echo " basic support gcf test(test version), AP lib: gcf, CP image: wifi "
echo " ram open_dev + addtional 100K ram AP lib: ram, CP image: ram "
echo " rom mini + remove rndis/socket AP lib: rom, CP image: oc "
echo " rom-lesslog rom + log reducing AP lib: rom_lesslog, CP image:rom_lesslog "
echo " lesslog log reducing AP lib: rom_lesslog, CP image: oc "
echo "**********************************************************************************************"
echo " Examples: "
echo "----------------------- For Internal Full Source Build----------------------------------------"
echo " > Gccbuild.sh "
echo " build bootloader, ap images and merge them into a package. "
echo " > Gccbuild.sh ap-at_command "
echo " build ap at_command project only. "
echo " > Gccbuild.sh ap-bootloader "
echo " build bootloader project only. "
echo " > Gccbuild.bat cp "
echo " build cp project only. "
echo " > Gccbuild.sh ap-driver_example-clean "
echo " clean all output files for ap driver_example project. "
echo " "
echo "----------------------- For Customer's SDK Build----------------------------------------------"
echo " > Gccbuild.sh "
echo " build bootloader,ap images, use prebuilt cp image, and merge them into a package. "
echo " > Gccbuild.sh project_name e.g. project_name = at_command/driver_example "
echo " build xxx(project_name) project "
echo " "
echo " @NOTE: SDK build always generates a package(project_name.bin + bootloader.bin + cp.bin). "
echo " "
echo "----------------------- For Universal Build---------------------------------------------------"
echo " > Gccbuild.sh clean "
echo " clean all output files for the default project. "
echo " > Gccbuild.sh clall "
echo " clean all output files for every board and project. "
echo " > Gccbuild.sh list "
echo " list all supported boards and supported projects for every board. "
echo " "
echo " > Gccbuild.sh open_cpu "
echo " build 'open cpu' mode images of the default project, and merge them into a package. "
echo " "
echo "**********************************************************************************************"
exit 1
fi
if [ -n "$(echo $PARAMETERS|grep 'list')" ]
then
echo ---------------Supported Board------------------------------------
for Board in $(ls $CUR_PATH/project/)
do
echo $Board
done
echo ------------------------------------------------------------------
for Board in $(ls $CUR_PATH/project/)
do
Board_path=$CUR_PATH/project/$Board
CURRENT_PROJECTS=$Board_path/ap/apps
#echo $CURRENT_BOARD/*
if [ -e $CURRENT_PROJECTS ]
then
echo *********supported projects for board: $Board*************
for projects in $(ls $CURRENT_PROJECTS/)
do
echo ----$projects
done
fi
done
exit 1
fi
end()
{
echo "--end--"
exit 1
}
if [ -n "$(echo $PARAMETERS|grep 'clall')" ]
then
make -$JOBNUMBER clean-gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME PROJECT=$PROJECT_NAME CORE=$CORE_NAME
rm -rf ./gccout/*
echo "clean all done ok..."
end
fi
if [ -n "$(echo $PARAMETERS|grep 'clean')" ]
then
make -$JOBNUMBER clean-gcc TYPE=$CHIP_TYPE TARGET=$BOARD_NAME PROJECT=$PROJECT_NAME CORE=$CORE_NAME
echo "clean done ok..."
end
fi
if [ -n "$(echo $PARAMETERS|grep 'clobj')" ]
then
rm -rf ./gccout/$OUTPUT_NAME/$CORE_NAME/$PROJECT_NAME/*.o
rm -rf ./gccout/$OUTPUT_NAME/$CORE_NAME/$PROJECT_NAME/*.a
rm -rf ./gccout/$OUTPUT_NAME/$CORE_NAME/$PROJECT_NAME/*.elf
echo "clean objs done ok..."
end
fi
completeHandle()
{
endtime=$(date "+%Y/%m/%d %H:%M:%S")
echo "Start time:" $starttime
echo "End time:" $endtime
echo "#######################################################################"
echo "## ##"
echo "## ######## ### ###### ###### ##"
echo "## ## ## ## ## ## ## ## ## ##"
echo "## ## ## ## ## ## ## ##"
echo "## ######## ## ## ###### ###### ##"
echo "## ## ######### ## ## ##"
echo "## ## ## ## ## ## ## ## ##"
echo "## ## ## ## ###### ###### ##"
echo "## ##"
echo "#######################################################################"
echo build successfully
exit 1
}
failHandle()
{
echo fail
echo "#######################################################################"
echo "## ##"
echo "## ######## ### #### ## ##"
echo "## ## ## ## ## ## ##"
echo "## ## ## ## ## ## ##"
echo "## ###### ## ## ## ## ##"
echo "## ## ######### ## ## ##"
echo "## ## ## ## ## ## ##"
echo "## ## ## ## #### ######## ##"
echo "## ##"
echo "#######################################################################"
exit 1
}
starttime=$(date "+%Y/%m/%d %H:%M:%S")
echo "Start time:" $starttime
if [ -n "$(echo $PARAMETERS|grep 'allobjects')" ]
then
if [ -e ./gccout/$OUTPUT_NAME ]
then
echo delete $OUTPUT_NAME folder......
rm -rf ./gccout/$OUTPUT_NAME
fi
#step1 build cp if not SDK
if [ ! -f "./tools/comdblib.txt" ]
then
echo start logprepass b11
if [ -f "./tools/UpdateDBPattern.txt" ]
then
rm -f ./tools/UpdateDBPattern.txt
fi
make -$JOBNUMBER build-unilog TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/cp/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
#this header file will compile with device code
cp -f ./gccout/$OUTPUT_NAME/cp/cp_project/debug_log_cp.h ./middleware/developed/debug/inc/
make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/cp/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
fi
#step2 build bootloader no matter SDK or not
make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=bootloader CORE=ap BUILD_UNILOG=false BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/ap/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
echo *********supported projects for board: $BOARD_NAME*************
for projects in $(ls $CUR_PATH/project/$BOARD_NAME/ap/apps/)
do
echo ----$projects
if [ "$projects" == "bootloader" ]
then
echo ignore bootloader when loop all project
else
#this header file will compile with device code
if [ "$projects" == "at_command" ]
then
cp -p ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/debug_log_ap.h ./middleware/developed/debug/inc/
if [ -e "./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/dbversion.h" ]; then
cp -p -rf ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/dbversion.h ./middleware/developed/debug/inc/
fi
fi
if [ -f "./tools/UpdateDBPattern.txt" ]
then
rm -f ./tools/UpdateDBPattern.txt
fi
if [ -f "./tools/comdblib.txt" ]
then
make -$JOBNUMBER build-unilog TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE PROJECT=$projects CORE=ap BUILD_UNILOG=true SDK=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/ap/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
else
make -$JOBNUMBER build-unilog TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE PROJECT=$projects CORE=ap BUILD_UNILOG=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/ap/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
fi
make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=$projects CORE=ap BUILD_UNILOG=true BUILD_CUST=$CUST SDK=true | tee ./gccout/$OUTPUT_NAME/ap/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
#718p: SYSBNADR=7e000 718s: SYSBNADR=72000
if [ ! -f ./tools/comdblib.txt ]
then
./tools/fcelf -T -bin ./gccout/$OUTPUT_NAME/ap/$projects/ap_$projects.bin -size AP_PKGIMG_LIMIT_SIZE \
-bin ./gccout/$OUTPUT_NAME/cp/cp_project/cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE \
-bin ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE \
-h ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt
if [ $? -ne 0 ]
then
failHandle
fi
./tools/fcelf -M -input ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE \
-input ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/ap_$PROJECT_NAME.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE \
-input ./prebuild/FW/lib/gcc/$CHIP_TYPE/$CPBIN_SUBPATH/cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE \
-pkgmode 1 \
-banoldtool 1 \
-productname $PKG_PRODUCT \
-def ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt \
-outfile ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/$PROJECT_NAME.binpkg
if [ $? -ne 0 ]
then
failHandle
fi
./tools/fcelf -m -input ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE \
-input ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/ap_$PROJECT_NAME.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE \
-input ./prebuild/FW/lib/gcc/$CHIP_TYPE/$CPBIN_SUBPATH/cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE \
-pkgmode 1 \
-banoldtool 1 \
-productname $PKG_PRODUCT \
-def ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt \
-outfile ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/$PROJECT_NAME.elf
if [ $? -ne 0 ]
then
failHandle
fi
else
./tools/fcelf -T -bin ./gccout/$OUTPUT_NAME/ap/$projects/ap_$projects.bin -size AP_PKGIMG_LIMIT_SIZE \
-bin ./prebuild\FW/lib/gcc/$CHIP_TYPE/$CPBIN_SUBPATH/cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE \
-bin ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE \
-h ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt
if [ $? -ne 0 ]
then
failHandle
fi
./tools/fcelf -M -input ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE \
-input ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/ap_$PROJECT_NAME.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE \
-input ./prebuild/FW/lib/gcc/$CHIP_TYPE/$CPBIN_SUBPATH/cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE \
-pkgmode 1 \
-banoldtool 1 \
-productname $PKG_PRODUCT \
-def ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt \
-outfile ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/$PROJECT_NAME.binpkg
if [ $? -ne 0 ]
then
failHandle
fi
fi
if [ -f "./tools/UpdateDBPattern.txt" ]
then
cat ./tools/UpdateDBPattern.txt
fi
fi
done
completeHandle
fi
if [ "$BUILD_OPTION" == "merge" ]
then
if [ -f './tools/comdblib.txt' ]
then
echo start loggpress
make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=bootloader CORE=$CORE_NAME BUILD_UNILOG=false BUILD_CUST=$CUST SDK=true | tee ./gccout/$OUTPUT_NAME/$CORE_NAME/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
#failHandle
if [ -e './tools/UpdateDBPattern.txt' ]
then
rm -f ./tools/UpdateDBPattern.txt
fi
make -$JOBNUMBER build-unilog TYPE=$CHIP_TYPE TARGET=$BOARD_NAME PROJECT=$PROJECT_NAME CORE=$CORE_NAME BUILD_UNILOG=true BUILD_CUST=$CUST SDK=true
# copy log file
cp -p ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/debug_log_ap.h ./middleware/developed/debug/inc/
if [ -e "./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/dbversion.h" ]; then
cp -p -rf ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/dbversion.h ./middleware/developed/debug/inc/
fi
# build ap
make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=$PROJECT_NAME CORE=ap BUILD_UNILOG=true BUILD_CUST=$CUST SDK=true MANUFACTURER=$MANUFACTURER | tee ./gccout/$OUTPUT_NAME/ap/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
./tools/fcelf -T -bin ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/ap_$PROJECT_NAME.bin -size AP_PKGIMG_LIMIT_SIZE \
-bin ./prebuild/FW/lib/gcc/$CHIP_TYPE/$CPBIN_SUBPATH/cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE \
-bin ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE \
-h ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt
if [ $? -ne 0 ]
then
failHandle
fi
./tools/fcelf -M -input ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE \
-input ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/ap_$PROJECT_NAME.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE \
-input ./prebuild/FW/lib/gcc/$CHIP_TYPE/$CPBIN_SUBPATH/cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE \
-pkgmode 1 \
-banoldtool 1 \
-productname $PKG_PRODUCT \
-def ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt \
-outfile ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/$PROJECT_NAME.binpkg
if [ $? -ne 0 ]
then
failHandle
fi
if [ "$FIBOCOM_PKG_OPENSDK" == "true" ];
then
if [ -e "opensdk.py" ]; then
python3 opensdk.py $PROJECT_NAME $CHIP_TYPE
./opensrc.sh
fi
fi
if [ -f ./tools/UpdateDBPattern.txt ]
then
rm -f ./tools/UpdateDBPattern.txt
fi
completeHandle
else
make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=bootloader CORE=$CORE_NAME SDK_REL=$SDKREL BUILD_UNILOG=false BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/$CORE_NAME/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
echo start logprepass b22
if [ -e './tools/UpdateDBPattern.txt' ]
then
rm -f ./tools/UpdateDBPattern.txt
fi
make -$JOBNUMBER build-unilog TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE PROJECT=cp_project CORE=cp SDK_REL=$SDKREL BUILD_UNILOG=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/cp/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=cp_project CORE=cp SDK_REL=$SDKREL BUILD_UNILOG=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/cp/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
make -$JOBNUMBER build-unilog TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE PROJECT=$PROJECT_NAME CORE=ap SDK_REL=$SDKREL BUILD_UNILOG=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/ap/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
# copy log file
cp -p ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/debug_log_ap.h ./middleware/developed/debug/inc/
if [ -e "./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/dbversion.h" ]; then
cp -p -rf ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/dbversion.h ./middleware/developed/debug/inc/
fi
# build ap
make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=$PROJECT_NAME CORE=ap SED_REL=$SDKREL BUILD_UNILOG=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/ap/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
./tools/fcelf -T -bin ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/ap_$PROJECT_NAME.bin -size AP_PKGIMG_LIMIT_SIZE \
-bin ./gccout/$OUTPUT_NAME/cp/cp_project/cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE \
-bin ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE \
-h ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt
if [ $? -ne 0 ]
then
failHandle
fi
./tools/fcelf -M -input ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE \
-input ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/ap_$PROJECT_NAME.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE \
-input ./prebuild/FW/lib/gcc/$CHIP_TYPE/$CPBIN_SUBPATH/cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE \
-pkgmode 1 \
-banoldtool 1 \
-productname $PKG_PRODUCT \
-def ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt \
-outfile ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/$PROJECT_NAME.binpkg
if [ $? -ne 0 ]
then
failHandle
fi
./tools/fcelf -m -input ./gccout/$OUTPUT_NAME/ap/bootloader/ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE \
-input ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/ap_$PROJECT_NAME.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE \
-input ./gccout/$OUTPUT_NAME/cp/cp_project/cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE \
-pkgmode 1 \
-banoldtool 1 \
-productname $PKG_PRODUCT \
-def ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/mem_map.txt \
-outfile ./gccout/$OUTPUT_NAME/ap/$PROJECT_NAME/$PROJECT_NAME.elf
if [ $? -ne 0 ]
then
failHandle
fi
if [ -f ./tools/UpdateDBPattern.txt ]
then
rm -f ./tools/UpdateDBPattern.txt
fi
completeHandle
fi
fi
buildimage()
{
echo "buildimage"
( make -$JOBNUMBER gccall TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE EUTRAN_MODE=$EUTRAN_MODE PROJECT=$PROJECT_NAME CORE=$CORE_NAME BUILD_UNILOG=$UNILOG BUILD_CUST=$CUST ) | tee ./gccout/$OUTPUT_NAME/$CORE_NAME/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
else
completeHandle
fi
}
if [ -n "$(echo $PROJECT_NAME|grep 'bootloader')" ]
then
buildimage
fi
if [ -n "$(echo $PROJECT_NAME|grep 'driver_example')" ]
then
buildimage
fi
export UNILOG=true
echo "start logprepass b2"
if [ -f ./tools/UpdateDBPattern.txt ]
then
rm -f ./tools/UpdateDBPattern.txt
fi
make -$JOBNUMBER build-unilog TYPE=$CHIP_TYPE TARGET=$BOARD_NAME V=$VERBOSE PROJECT=$PROJECT_NAME CORE=$CORE_NAME TOOLCHAIN_NAME=$TOOLCHAIN_NAME BUILD_UNILOG=true BUILD_CUST=$CUST | tee ./gccout/$OUTPUT_NAME/$CORE_NAME/outbuildlog.txt
if [ ${PIPESTATUS[0]} -gt 0 ]
then
failHandle
fi
#this header file will compile with device code
cp -f ./gccout/$OUTPUT_NAME/$CORE_NAME/$PROJECT_NAME/debug_log_$CORE_NAME.h ./middleware/developed/debug/inc/
if [ $? -ne 0 ]
then
failHandle
fi
if [ -f ./gccout/$OUTPUT_NAME/$CORE_NAME/$PROJECT_NAME/dbversion.h ]
then
cp -f ./gccout/$OUTPUT_NAME/$CORE_NAME/$PROJECT_NAME/dbversion.h ./middleware/developed/debug/inc/
if [ $? -ne 0 ]
then
failHandle
fi
fi
buildimage

View File

@ -0,0 +1,923 @@
@echo off && setlocal enabledelayedexpansion
@echo %PATH% | findstr /c:"%~dp0tools/msys64/usr/bin">nul
@if %errorlevel% equ 1 set PATH=%~dp0tools/msys64/usr/bin;%PATH%
rem @set PATH=%~dp0tools/msys64/usr/bin;%PATH%
cls
set PROJECT_NAME=at_command
set BOARD_NAME=ec7xx_0h00
set CHIP_NAME=ec7xx
set CHIP_TYPE=ec718hm
set CORE_NAME=ap
set EUTRAN_MODE=cat_mode
set BUILD_OPTION=merge
set UNILOG=false
set TOOLCHAIN_NAME=GCC
set CUST=common
set SDKREL=false
set OPENCPU=false
set RAM_ENBALE=false
set ROM_ENBALE=false
set LESS_LOG=false
set LTO_ENABLE=false
set PWR_TEST=false
set BUILD_HEADBIN=false
set GCCLIB_PATH="C:\gcc"
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\full"
set CPBIN_SUBPATH=oc
set PKG_MAPDEF=pkg_718hm_mapdef
set PKG_PRODUCT="EC718HM_PRD"
set OUTPUT_NAME=%BOARD_NAME%_%CHIP_TYPE%
set JOBNUMBER=j4
echo build.bat version 20180330
echo GCCLIB_PATH: %GCCLIB_PATH%
if not %GCCLIB_PATH% == "" (
if not exist %GCCLIB_PATH% (
echo ERROR: Please check GCCLIB_PATH setting, exit!!!
goto end
)
) else (
echo ERROR: Please set GCCLIB_PATH firstly, exit!!!
goto end
)
rem --------- board/project parsing begain------------------
set PARAMETERS=%1
if xx%PARAMETERS%==xx (
echo no input paramter, use default build setting
) else (
echo build option is: %PARAMETERS%
)
set parameterStr=%PARAMETERS%
:parameterSplit
for /f "tokens=1,* delims=-" %%a in ("%parameterStr%") do (
set parameterStr=%%b
echo %%a | findstr /r "j[0-9]*[0-9]\>" > nul
if !errorlevel!==0 (
set JOBNUMBER=%%a
)
if "%%a"=="qcom" (
set CUST=qcom
)
if "%%a"=="ec718_0h00" (
set BOARD_NAME=ec718_0h00
set CHIP_NAME=ec7xx
set OUTPUT_NAME=ec718_0h00_%CHIP_TYPE%
)
if "%%a"=="bootloader" (
set PROJECT_NAME=bootloader
set BUILD_OPTION=no_merge
)
if "%%a"=="ap" (
set CORE_NAME=ap
set BUILD_OPTION=no_merge
)
if "%%a"=="cp" (
set CORE_NAME=cp
set PROJECT_NAME=cp_project
set BUILD_OPTION=no_merge
)
if "%%a"=="pwrTest" (
set PWR_TEST=true
)
if "%%a"=="nb_mode" (
set EUTRAN_MODE=nb_mode
)
if "%%a"=="at_command" (
set PROJECT_NAME=at_command
)
if "%%a"=="socket_example" (
set PROJECT_NAME=socket_example
)
if "%%a"=="mqtt_example" (
set PROJECT_NAME=mqtt_example
)
if "%%a"=="https_example" (
set PROJECT_NAME=https_example
)
if "%%a"=="ssl_example" (
set PROJECT_NAME=ssl_example
)
if "%%a"=="libapi_example" (
set PROJECT_NAME=libapi_example
)
if "%%a"=="pos_example" (
set PROJECT_NAME=pos_example
)
if "%%a"=="tts_example" (
set PROJECT_NAME=tts_example
)
if "%%a"=="audio_example" (
set PROJECT_NAME=audio_example
)
if "%%a"=="lpuart_test" (
set PROJECT_NAME=lpuart_test
)
if "%%a"=="driver_example" (
set PROJECT_NAME=driver_example
set BUILD_OPTION=no_merge
)
if "%%a"=="dhrystone" (
set PROJECT_NAME=dhrystone
)
if "%%a"=="coremark" (
set PROJECT_NAME=coremark
)
if "%%a"=="slpman_example" (
set PROJECT_NAME=slpman_example
)
if "%%a"=="sleep_example" (
set PROJECT_NAME=sleep_example
)
if "%%a"=="slpPressure_test" (
set PROJECT_NAME=slpPressure_test
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="ChipIpTest" (
set PROJECT_NAME=ChipIpTest
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="ModemSlpPressure" (
set CORE_NAME=cp
set PROJECT_NAME=ModemSlpPressure
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="mcu_example" (
set PROJECT_NAME=mcu_example
)
if "%%a"=="soc_simple" (
set PROJECT_NAME=soc_simple
)
if "%%a"=="soc_bist" (
set PROJECT_NAME=soc_bist
)
if "%%a"=="simo_test" (
set PROJECT_NAME=simo_test
)
if "%%a"=="clk_verify" (
set PROJECT_NAME=clk_verify
)
if "%%a"=="qspi_test" (
set PROJECT_NAME=qspi_test
)
if "%%a"=="fpga_sct_utfw" (
set PROJECT_NAME=fpga_sct_utfw
)
if "%%a"=="spi_2boards" (
set PROJECT_NAME=spi_2boards
)
if "%%a"=="merge" (
set BUILD_OPTION=merge
)
if "%%a"=="sdkrel" (
set SDKREL=true
)
if "%%a"=="lto" (
set LTO_ENABLE=true
)
if "%%a"=="open_cpu" (
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\oc"
)
if "%%a"=="audio" (
set AUDIO_ENABLE=true
set OPENCPU=true
set CPBIN_SUBPATH=audio
)
if "%%a"=="ims" (
set IMS_ENABLE=true
set AUDIO_ENABLE=true
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\ims"
set CPBIN_SUBPATH=audio
)
if "%%a"=="imsfix" (
set IMS_ENABLE=true
set AUDIO_ENABLE=true
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\ims"
set CPBIN_SUBPATH=audio
set AUDIO_FIX_ENABLE=true
)
if "%%a"=="isms" (
set IMS_SMSONLY_ENABLE=true
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\isms"
)
if "%%a"=="verbose" (
set VERBOSE=1
) else (
set VERBOSE=0
)
if "%%a"=="secboot" (
set BUILD_HEADBIN=true
for /f "tokens=1* delims=" %%a in ('type ".\project\%BOARD_NAME%\ap\apps\bootloader\GCC\Makefile"') do (
if "%%a" equ "CONFIG_PROJ_APP_SECURITY_BOOT = n" (
echo CONFIG_PROJ_APP_SECURITY_BOOT=y
) else (
echo %%a
)
)>>temp.txt
type temp.txt | findstr /v ECHO >>temp1.txt
del temp.txt
move temp1.txt ".\project\%BOARD_NAME%\ap\apps\bootloader\GCC\Makefile" >nul
)
)
if not "%parameterStr%"=="" goto parameterSplit
echo curr Board is: %BOARD_NAME%
echo curr Chip is: %CHIP_NAME%
echo curr Type is: %CHIP_TYPE%
echo curr Project is: %PROJECT_NAME%
echo curr core is: %CORE_NAME%
echo curr option is: %BUILD_OPTION%
echo cp bin subpath: %CPBIN_SUBPATH%
rem duplicate comdblib.txt from 'COMDBLIB_PATH' to '.\tools\'
if exist %COMDBLIB_PATH%\comdblib.txt (
xcopy /f /y %COMDBLIB_PATH%\comdblib.txt .\tools\
)
if "%CUST%"=="qcom" (
rem clear AT ref for qcom
for /f "tokens=1* delims=" %%a in ('type ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk"') do (
if "%%a" equ "PS_AT_REF=y" (
echo PS_AT_REF=n
) else if "%%a" equ "BUILD_AT_REF ?=n" (
echo BUILD_AT_REF=n
) else (
echo %%a
)
)>>temp.txt
type temp.txt | findstr /v ECHO >>temp1.txt
del temp.txt
move temp1.txt ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk" >nul
)
rem --------- if more board/project add here-------------
rem --------- board/project parsing end------------------
echo PARAMETERS: %PARAMETERS% | findstr "help"
if not errorlevel 1 (
echo "=============================================================================================="
echo " "
echo " >> HOW TO BUILD A PROJECT << "
echo " "
echo "==============================================================================================¡±
echo " "
echo " @FORMAT : Gccbuild.bat [<board>[-<core>[-<project>[-<option>]]]] "
echo " @CAUTION: All parameters (<board>/<core>/<project>/<option>) are optional, "
echo " and the default settings of the project will take effect if it occurs! "
echo " For <board>, only 'ec618_0h00' is supportted, and it should be omitted ! "
echo " "
echo "**********************************************************************************************"
echo " <options>: "
echo " >> Basic "
echo " merge compile bl, cp and ap images and merge them into a package. [default] "
echo " doc run doxygen to generate the documents. "
echo " clean clean the output files for a specific board and project. "
echo " clall clean all output files for every board and project. "
echo " allprojects trigger to compile all example projects of the default board "
echo " list list all supported boards and supported projects for every board "
echo " help display this help message. "
echo " "
echo " >> Advanced "
echo " NULL(default) full feature support£¨no ims£©, AP lib: full, CP image£ºoc "
echo " open_cpu for open dev, more ram, AP lib: oc, CP image£ºoc "
echo " isms open_cpu + ims sms, AP lib: isms, CP image£ºoc "
echo " ims volte feature support, AP lib: ims, CP image£ºaudio "
echo " audio audio support(e.g. local MP3 play), AP lib: oc, CP image£ºaudio "
echo "**********************************************************************************************"
echo " Examples: "
echo "----------------------- For Internal Full Source Build----------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader, cp, ap images and merge them into a package. "
echo " > Gccbuild.bat ap-at_command "
echo " build ap at_command project only. "
echo " > Gccbuild.bat ap-bootloader "
echo " build bootloader project only. "
echo " > Gccbuild.bat cp "
echo " build cp project only. "
echo " > Gccbuild.bat ap-driver_example-clean "
echo " clean all output files for ap driver_example project. "
echo " "
echo "----------------------- For Customer's SDK Build----------------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader,ap images, use prebuilt cp image, and merge them into a package. "
echo " > Gccbuild.bat project_name e.g. project_name = at_command/driver_example "
echo " build xxx(project_name) project "
echo " "
echo " @NOTE: SDK build always generates a package(project_name.bin + bootloader.bin + cp.bin). "
echo " "
echo "----------------------- For Universal Build---------------------------------------------------"
echo " > Gccbuild.bat clean "
echo " clean all output files for the default project. "
echo " > Gccbuild.bat clall "
echo " clean all output files for every board and project. "
echo " > Gccbuild.bat list "
echo " list all supported boards and supported projects for every board. "
echo " "
echo " > Gccbuild.bat open_cpu "
echo " build 'open cpu' mode images of the default project, and merge them into a package. "
echo " "
echo "**********************************************************************************************"
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "list"
if not errorlevel 1 (
echo ---------------Supported Board------------------------------------
for /d %%i in ("project\*") do (echo %%~nxi )
echo ------------------------------------------------------------------
for /d %%i in ("project\*") do (
set CURRENT_BOARD=%%~nxi
echo *********supported projects for board: !CURRENT_BOARD!*************
for /d %%i in ("project\!CURRENT_BOARD!\ap\apps\*") do (echo ----%%~nxi )
)
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "doc"
if not errorlevel 1 (
pushd doxygen
CALL genDoc.bat %CHIP_NAME%
popd
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clall"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean all done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clean"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gcc TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clobj"
if not errorlevel 1 (
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.o
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.a
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.elf
echo clean objs done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "allprojects"
if not errorlevel 1 (
if exist .\gccout\%OUTPUT_NAME% (
echo delete %OUTPUT_NAME% folder......
rd .\gccout\%OUTPUT_NAME% /s /q
)
rem step1 build cp if not SDK
if not exist .\tools\comdblib.txt (
echo start logprepass b11
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
)
rem step2 build bootloader no matter SDK or not
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=ap BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo *********supported projects for board: %BOARD_NAME%*************
for /d %%i in ("project\%BOARD_NAME%\ap\apps\*") do (
set CURRENT_PROJECT=%%~nxi
echo ----!CURRENT_PROJECT!
if "!CURRENT_PROJECT!"=="bootloader" (
echo ignore bootloader when loop all project
) else (
echo 111
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
if exist .\tools\comdblib.txt (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true SDK=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
) else (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if not exist .\tools\comdblib.txt (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
) else (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
)
goto complete
)
set starttime=%time%
echo Start time: %date% %starttime%
if "%BUILD_OPTION%"=="merge" (
if exist .\tools\comdblib.txt (
echo start logprepass
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% BUILD_UNILOG=false BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
if "%BUILD_HEADBIN%"=="true" (
echo general headers 1
.\tools\ecsecure.exe APIMAGE=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin ^
CPIMAGE=.\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin ^
BLIMAGE=.\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin ^
BLHASH=1 SYSHASH=1 ^
HEAD1=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin ^
HEAD2=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin ^
BLPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_bl.pem ^
SYSPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_sys.pem ^
ADRBASE=AP_FLASH_XIP_ADDR ^
APADR=AP_FLASH_LOAD_ADDR ^
CFGDEF=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin -addrname XPKGDBLSH_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin -addrname XPKGDSYSH_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_PrMgrCfg_json.bin -addrname XPKGDPRM_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_format_json.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_uart_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_usb_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT%_SEC ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
) else (
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
)
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
) else (
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% SDK_REL=%SDKREL% BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo start logprepass b22
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
if "%BUILD_HEADBIN%"=="true" (
echo general headers 2
.\tools\ecsecure.exe APIMAGE=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin ^
CPIMAGE=.\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin ^
BLIMAGE=.\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin ^
BLHASH=1 SYSHASH=1^
HEAD1=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin ^
HEAD2=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin ^
BLPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_bl.pem ^
SYSPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_sys.pem ^
ADRBASE=AP_FLASH_XIP_ADDR ^
APADR=AP_FLASH_LOAD_ADDR ^
CFGDEF=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin -addrname XPKGDBLSH_VIRTIMG_MERGE_LNA -flashsize BLS_FLASH_LOAD_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin -addrname XPKGDSYSH_VIRTIMG_MERGE_LNA -flashsize SYS_FLASH_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_PrMgrCfg_json.bin -addrname XPKGDPRM_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_format_json.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_uart_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_usb_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT%_SEC ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
) else (
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
)
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.elf
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
)
)
if %PROJECT_NAME%==bootloader goto :buildimage
if %PROJECT_NAME%==driver_example goto :buildimage
set UNILOG=true
echo start logprepass b2
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% TOOLCHAIN_NAME=%TOOLCHAIN_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\debug_log_%CORE_NAME%.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo -----build image----
:buildimage
REM goto end
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=%UNILOG% BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem copy log database to output dir after compile successfully
REM cp .\tools\comdb_%CORE_NAME%.txt .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\comdb.txt
:complete
set endtime=%time%
echo .
echo End time: %date% %endtime%
set /a h1=%starttime:~0,2%
set /a m1=1%starttime:~3,2%-100
set /a s1=1%starttime:~6,2%-100
set /a h2=%endtime:~0,2%
set /a m2=1%endtime:~3,2%-100
set /a s2=1%endtime:~6,2%-100
if %h2% LSS %h1% set /a h2=%h2%+24
set /a ts1=%h1%*3600+%m1%*60+%s1%
set /a ts2=%h2%*3600+%m2%*60+%s2%
set /a ts=%ts2%-%ts1%
set /a h=%ts%/3600
set /a m=(%ts%-%h%*3600)/60
set /a s=%ts%%%60
echo Built took %h% hours %m% minutes %s% seconds
echo #######################################################################
echo ## ##
echo ## ######## ### ###### ###### ##
echo ## ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ## ##
echo ## ######## ## ## ###### ###### ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ###### ###### ##
echo ## ##
echo #######################################################################
echo build successfully
if %UNILOG%==true (
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
:end
goto:eof
:failHandle
echo fail
echo #######################################################################
echo ## ##
echo ## ######## ### #### ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ##
echo ## ###### ## ## ## ## ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## #### ######## ##
echo ## ##
echo #######################################################################
goto:eof

View File

@ -0,0 +1,923 @@
@echo off && setlocal enabledelayedexpansion
@echo %PATH% | findstr /c:"%~dp0tools/msys64/usr/bin">nul
@if %errorlevel% equ 1 set PATH=%~dp0tools/msys64/usr/bin;%PATH%
rem @set PATH=%~dp0tools/msys64/usr/bin;%PATH%
cls
set PROJECT_NAME=at_command
set BOARD_NAME=ec7xx_0h00
set CHIP_NAME=ec7xx
set CHIP_TYPE=ec718p
set CORE_NAME=ap
set EUTRAN_MODE=cat_mode
set BUILD_OPTION=merge
set UNILOG=false
set TOOLCHAIN_NAME=GCC
set CUST=common
set SDKREL=false
set OPENCPU=false
set RAM_ENBALE=false
set ROM_ENBALE=false
set LESS_LOG=false
set LTO_ENABLE=false
set PWR_TEST=false
set BUILD_HEADBIN=false
set GCCLIB_PATH="C:\gcc"
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\full"
set CPBIN_SUBPATH=oc
set PKG_MAPDEF=pkg_718p_mapdef
set PKG_PRODUCT="EC718P_PRD"
set OUTPUT_NAME=%BOARD_NAME%_%CHIP_TYPE%
set JOBNUMBER=j4
echo build.bat version 20180330
echo GCCLIB_PATH: %GCCLIB_PATH%
if not %GCCLIB_PATH% == "" (
if not exist %GCCLIB_PATH% (
echo ERROR: Please check GCCLIB_PATH setting, exit!!!
goto end
)
) else (
echo ERROR: Please set GCCLIB_PATH firstly, exit!!!
goto end
)
rem --------- board/project parsing begain------------------
set PARAMETERS=%1
if xx%PARAMETERS%==xx (
echo no input paramter, use default build setting
) else (
echo build option is: %PARAMETERS%
)
set parameterStr=%PARAMETERS%
:parameterSplit
for /f "tokens=1,* delims=-" %%a in ("%parameterStr%") do (
set parameterStr=%%b
echo %%a | findstr /r "j[0-9]*[0-9]\>" > nul
if !errorlevel!==0 (
set JOBNUMBER=%%a
)
if "%%a"=="qcom" (
set CUST=qcom
)
if "%%a"=="ec718_0h00" (
set BOARD_NAME=ec718_0h00
set CHIP_NAME=ec7xx
set OUTPUT_NAME=ec718_0h00_%CHIP_TYPE%
)
if "%%a"=="bootloader" (
set PROJECT_NAME=bootloader
set BUILD_OPTION=no_merge
)
if "%%a"=="ap" (
set CORE_NAME=ap
set BUILD_OPTION=no_merge
)
if "%%a"=="cp" (
set CORE_NAME=cp
set PROJECT_NAME=cp_project
set BUILD_OPTION=no_merge
)
if "%%a"=="pwrTest" (
set PWR_TEST=true
)
if "%%a"=="nb_mode" (
set EUTRAN_MODE=nb_mode
)
if "%%a"=="at_command" (
set PROJECT_NAME=at_command
)
if "%%a"=="socket_example" (
set PROJECT_NAME=socket_example
)
if "%%a"=="mqtt_example" (
set PROJECT_NAME=mqtt_example
)
if "%%a"=="https_example" (
set PROJECT_NAME=https_example
)
if "%%a"=="ssl_example" (
set PROJECT_NAME=ssl_example
)
if "%%a"=="libapi_example" (
set PROJECT_NAME=libapi_example
)
if "%%a"=="pos_example" (
set PROJECT_NAME=pos_example
)
if "%%a"=="tts_example" (
set PROJECT_NAME=tts_example
)
if "%%a"=="audio_example" (
set PROJECT_NAME=audio_example
)
if "%%a"=="lpuart_test" (
set PROJECT_NAME=lpuart_test
)
if "%%a"=="driver_example" (
set PROJECT_NAME=driver_example
set BUILD_OPTION=merge
)
if "%%a"=="dhrystone" (
set PROJECT_NAME=dhrystone
)
if "%%a"=="coremark" (
set PROJECT_NAME=coremark
)
if "%%a"=="slpman_example" (
set PROJECT_NAME=slpman_example
)
if "%%a"=="sleep_example" (
set PROJECT_NAME=sleep_example
)
if "%%a"=="slpPressure_test" (
set PROJECT_NAME=slpPressure_test
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="ChipIpTest" (
set PROJECT_NAME=ChipIpTest
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="ModemSlpPressure" (
set CORE_NAME=cp
set PROJECT_NAME=ModemSlpPressure
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="mcu_example" (
set PROJECT_NAME=mcu_example
)
if "%%a"=="soc_simple" (
set PROJECT_NAME=soc_simple
)
if "%%a"=="soc_bist" (
set PROJECT_NAME=soc_bist
)
if "%%a"=="simo_test" (
set PROJECT_NAME=simo_test
)
if "%%a"=="clk_verify" (
set PROJECT_NAME=clk_verify
)
if "%%a"=="qspi_test" (
set PROJECT_NAME=qspi_test
)
if "%%a"=="fpga_sct_utfw" (
set PROJECT_NAME=fpga_sct_utfw
)
if "%%a"=="spi_2boards" (
set PROJECT_NAME=spi_2boards
)
if "%%a"=="merge" (
set BUILD_OPTION=merge
)
if "%%a"=="sdkrel" (
set SDKREL=true
)
if "%%a"=="lto" (
set LTO_ENABLE=true
)
if "%%a"=="open_cpu" (
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\oc"
)
if "%%a"=="audio" (
set AUDIO_ENABLE=true
set OPENCPU=true
set CPBIN_SUBPATH=audio
)
if "%%a"=="ims" (
set IMS_ENABLE=true
set AUDIO_ENABLE=true
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\ims"
set CPBIN_SUBPATH=audio
)
if "%%a"=="imsfix" (
set IMS_ENABLE=true
set AUDIO_ENABLE=true
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\ims"
set CPBIN_SUBPATH=audio
set AUDIO_FIX_ENABLE=true
)
if "%%a"=="isms" (
set IMS_SMSONLY_ENABLE=true
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\isms"
)
if "%%a"=="verbose" (
set VERBOSE=1
) else (
set VERBOSE=0
)
if "%%a"=="secboot" (
set BUILD_HEADBIN=true
for /f "tokens=1* delims=" %%a in ('type ".\project\%BOARD_NAME%\ap\apps\bootloader\GCC\Makefile"') do (
if "%%a" equ "CONFIG_PROJ_APP_SECURITY_BOOT = n" (
echo CONFIG_PROJ_APP_SECURITY_BOOT=y
) else (
echo %%a
)
)>>temp.txt
type temp.txt | findstr /v ECHO >>temp1.txt
del temp.txt
move temp1.txt ".\project\%BOARD_NAME%\ap\apps\bootloader\GCC\Makefile" >nul
)
)
if not "%parameterStr%"=="" goto parameterSplit
echo curr Board is: %BOARD_NAME%
echo curr Chip is: %CHIP_NAME%
echo curr Type is: %CHIP_TYPE%
echo curr Project is: %PROJECT_NAME%
echo curr core is: %CORE_NAME%
echo curr option is: %BUILD_OPTION%
echo cp bin subpath: %CPBIN_SUBPATH%
rem duplicate comdblib.txt from 'COMDBLIB_PATH' to '.\tools\'
if exist %COMDBLIB_PATH%\comdblib.txt (
xcopy /f /y %COMDBLIB_PATH%\comdblib.txt .\tools\
)
if "%CUST%"=="qcom" (
rem clear AT ref for qcom
for /f "tokens=1* delims=" %%a in ('type ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk"') do (
if "%%a" equ "PS_AT_REF=y" (
echo PS_AT_REF=n
) else if "%%a" equ "BUILD_AT_REF ?=n" (
echo BUILD_AT_REF=n
) else (
echo %%a
)
)>>temp.txt
type temp.txt | findstr /v ECHO >>temp1.txt
del temp.txt
move temp1.txt ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk" >nul
)
rem --------- if more board/project add here-------------
rem --------- board/project parsing end------------------
echo PARAMETERS: %PARAMETERS% | findstr "help"
if not errorlevel 1 (
echo "=============================================================================================="
echo " "
echo " >> HOW TO BUILD A PROJECT << "
echo " "
echo "==============================================================================================¡±
echo " "
echo " @FORMAT : Gccbuild.bat [<board>[-<core>[-<project>[-<option>]]]] "
echo " @CAUTION: All parameters (<board>/<core>/<project>/<option>) are optional, "
echo " and the default settings of the project will take effect if it occurs! "
echo " For <board>, only 'ec618_0h00' is supportted, and it should be omitted ! "
echo " "
echo "**********************************************************************************************"
echo " <options>: "
echo " >> Basic "
echo " merge compile bl, cp and ap images and merge them into a package. [default] "
echo " doc run doxygen to generate the documents. "
echo " clean clean the output files for a specific board and project. "
echo " clall clean all output files for every board and project. "
echo " allprojects trigger to compile all example projects of the default board "
echo " list list all supported boards and supported projects for every board "
echo " help display this help message. "
echo " "
echo " >> Advanced "
echo " NULL(default) full feature support£¨no ims£©, AP lib: full, CP image£ºoc "
echo " open_cpu for open dev, more ram, AP lib: oc, CP image£ºoc "
echo " isms open_cpu + ims sms, AP lib: isms, CP image£ºoc "
echo " ims volte feature support, AP lib: ims, CP image£ºaudio "
echo " audio audio support(e.g. local MP3 play), AP lib: oc, CP image£ºaudio "
echo "**********************************************************************************************"
echo " Examples: "
echo "----------------------- For Internal Full Source Build----------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader, cp, ap images and merge them into a package. "
echo " > Gccbuild.bat ap-at_command "
echo " build ap at_command project only. "
echo " > Gccbuild.bat ap-bootloader "
echo " build bootloader project only. "
echo " > Gccbuild.bat cp "
echo " build cp project only. "
echo " > Gccbuild.bat ap-driver_example-clean "
echo " clean all output files for ap driver_example project. "
echo " "
echo "----------------------- For Customer's SDK Build----------------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader,ap images, use prebuilt cp image, and merge them into a package. "
echo " > Gccbuild.bat project_name e.g. project_name = at_command/driver_example "
echo " build xxx(project_name) project "
echo " "
echo " @NOTE: SDK build always generates a package(project_name.bin + bootloader.bin + cp.bin). "
echo " "
echo "----------------------- For Universal Build---------------------------------------------------"
echo " > Gccbuild.bat clean "
echo " clean all output files for the default project. "
echo " > Gccbuild.bat clall "
echo " clean all output files for every board and project. "
echo " > Gccbuild.bat list "
echo " list all supported boards and supported projects for every board. "
echo " "
echo " > Gccbuild.bat open_cpu "
echo " build 'open cpu' mode images of the default project, and merge them into a package. "
echo " "
echo "**********************************************************************************************"
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "list"
if not errorlevel 1 (
echo ---------------Supported Board------------------------------------
for /d %%i in ("project\*") do (echo %%~nxi )
echo ------------------------------------------------------------------
for /d %%i in ("project\*") do (
set CURRENT_BOARD=%%~nxi
echo *********supported projects for board: !CURRENT_BOARD!*************
for /d %%i in ("project\!CURRENT_BOARD!\ap\apps\*") do (echo ----%%~nxi )
)
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "doc"
if not errorlevel 1 (
pushd doxygen
CALL genDoc.bat %CHIP_NAME%
popd
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clall"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean all done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clean"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gcc TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clobj"
if not errorlevel 1 (
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.o
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.a
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.elf
echo clean objs done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "allprojects"
if not errorlevel 1 (
if exist .\gccout\%OUTPUT_NAME% (
echo delete %OUTPUT_NAME% folder......
rd .\gccout\%OUTPUT_NAME% /s /q
)
rem step1 build cp if not SDK
if not exist .\tools\comdblib.txt (
echo start logprepass b11
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
)
rem step2 build bootloader no matter SDK or not
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=ap BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo *********supported projects for board: %BOARD_NAME%*************
for /d %%i in ("project\%BOARD_NAME%\ap\apps\*") do (
set CURRENT_PROJECT=%%~nxi
echo ----!CURRENT_PROJECT!
if "!CURRENT_PROJECT!"=="bootloader" (
echo ignore bootloader when loop all project
) else (
echo 111
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
if exist .\tools\comdblib.txt (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true SDK=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
) else (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if not exist .\tools\comdblib.txt (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
) else (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
)
goto complete
)
set starttime=%time%
echo Start time: %date% %starttime%
if "%BUILD_OPTION%"=="merge" (
if exist .\tools\comdblib.txt (
echo start logprepass
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% BUILD_UNILOG=false BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
if "%BUILD_HEADBIN%"=="true" (
echo general headers 1
.\tools\ecsecure.exe APIMAGE=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin ^
CPIMAGE=.\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin ^
BLIMAGE=.\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin ^
BLHASH=1 SYSHASH=1 ^
HEAD1=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin ^
HEAD2=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin ^
BLPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_bl.pem ^
SYSPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_sys.pem ^
ADRBASE=AP_FLASH_XIP_ADDR ^
APADR=AP_FLASH_LOAD_ADDR ^
CFGDEF=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin -addrname XPKGDBLSH_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin -addrname XPKGDSYSH_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_PrMgrCfg_json.bin -addrname XPKGDPRM_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_format_json.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_uart_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_usb_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT%_SEC ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
) else (
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
)
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
) else (
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% SDK_REL=%SDKREL% BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo start logprepass b22
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
if "%BUILD_HEADBIN%"=="true" (
echo general headers 2
.\tools\ecsecure.exe APIMAGE=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin ^
CPIMAGE=.\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin ^
BLIMAGE=.\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin ^
BLHASH=1 SYSHASH=1^
HEAD1=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin ^
HEAD2=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin ^
BLPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_bl.pem ^
SYSPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_sys.pem ^
ADRBASE=AP_FLASH_XIP_ADDR ^
APADR=AP_FLASH_LOAD_ADDR ^
CFGDEF=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin -addrname XPKGDBLSH_VIRTIMG_MERGE_LNA -flashsize BLS_FLASH_LOAD_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin -addrname XPKGDSYSH_VIRTIMG_MERGE_LNA -flashsize SYS_FLASH_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_PrMgrCfg_json.bin -addrname XPKGDPRM_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_format_json.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_uart_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_usb_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT%_SEC ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
) else (
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
)
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.elf
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
)
)
if %PROJECT_NAME%==bootloader goto :buildimage
if %PROJECT_NAME%==driver_example goto :buildimage
set UNILOG=true
echo start logprepass b2
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% TOOLCHAIN_NAME=%TOOLCHAIN_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\debug_log_%CORE_NAME%.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo -----build image----
:buildimage
REM goto end
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=%UNILOG% BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem copy log database to output dir after compile successfully
REM cp .\tools\comdb_%CORE_NAME%.txt .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\comdb.txt
:complete
set endtime=%time%
echo .
echo End time: %date% %endtime%
set /a h1=%starttime:~0,2%
set /a m1=1%starttime:~3,2%-100
set /a s1=1%starttime:~6,2%-100
set /a h2=%endtime:~0,2%
set /a m2=1%endtime:~3,2%-100
set /a s2=1%endtime:~6,2%-100
if %h2% LSS %h1% set /a h2=%h2%+24
set /a ts1=%h1%*3600+%m1%*60+%s1%
set /a ts2=%h2%*3600+%m2%*60+%s2%
set /a ts=%ts2%-%ts1%
set /a h=%ts%/3600
set /a m=(%ts%-%h%*3600)/60
set /a s=%ts%%%60
echo Built took %h% hours %m% minutes %s% seconds
echo #######################################################################
echo ## ##
echo ## ######## ### ###### ###### ##
echo ## ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ## ##
echo ## ######## ## ## ###### ###### ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ###### ###### ##
echo ## ##
echo #######################################################################
echo build successfully
if %UNILOG%==true (
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
:end
goto:eof
:failHandle
echo fail
echo #######################################################################
echo ## ##
echo ## ######## ### #### ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ##
echo ## ###### ## ## ## ## ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## #### ######## ##
echo ## ##
echo #######################################################################
goto:eof

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,923 @@
@echo off && setlocal enabledelayedexpansion
@echo %PATH% | findstr /c:"%~dp0tools/msys64/usr/bin">nul
@if %errorlevel% equ 1 set PATH=%~dp0tools/msys64/usr/bin;%PATH%
rem @set PATH=%~dp0tools/msys64/usr/bin;%PATH%
cls
set PROJECT_NAME=at_command
set BOARD_NAME=ec7xx_0h00
set CHIP_NAME=ec7xx
set CHIP_TYPE=ec718pm
set CORE_NAME=ap
set EUTRAN_MODE=cat_mode
set BUILD_OPTION=merge
set UNILOG=false
set TOOLCHAIN_NAME=GCC
set CUST=common
set SDKREL=false
set OPENCPU=false
set RAM_ENBALE=false
set ROM_ENBALE=false
set LESS_LOG=false
set LTO_ENABLE=false
set PWR_TEST=false
set BUILD_HEADBIN=false
set GCCLIB_PATH="C:\gcc"
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\full"
set CPBIN_SUBPATH=oc
set PKG_MAPDEF=pkg_718pm_mapdef
set PKG_PRODUCT="EC718PM_PRD"
set OUTPUT_NAME=%BOARD_NAME%_%CHIP_TYPE%
set JOBNUMBER=j4
echo build.bat version 20180330
echo GCCLIB_PATH: %GCCLIB_PATH%
if not %GCCLIB_PATH% == "" (
if not exist %GCCLIB_PATH% (
echo ERROR: Please check GCCLIB_PATH setting, exit!!!
goto end
)
) else (
echo ERROR: Please set GCCLIB_PATH firstly, exit!!!
goto end
)
rem --------- board/project parsing begain------------------
set PARAMETERS=%1
if xx%PARAMETERS%==xx (
echo no input paramter, use default build setting
) else (
echo build option is: %PARAMETERS%
)
set parameterStr=%PARAMETERS%
:parameterSplit
for /f "tokens=1,* delims=-" %%a in ("%parameterStr%") do (
set parameterStr=%%b
echo %%a | findstr /r "j[0-9]*[0-9]\>" > nul
if !errorlevel!==0 (
set JOBNUMBER=%%a
)
if "%%a"=="qcom" (
set CUST=qcom
)
if "%%a"=="ec718_0h00" (
set BOARD_NAME=ec718_0h00
set CHIP_NAME=ec7xx
set OUTPUT_NAME=ec718_0h00_%CHIP_TYPE%
)
if "%%a"=="bootloader" (
set PROJECT_NAME=bootloader
set BUILD_OPTION=no_merge
)
if "%%a"=="ap" (
set CORE_NAME=ap
set BUILD_OPTION=no_merge
)
if "%%a"=="cp" (
set CORE_NAME=cp
set PROJECT_NAME=cp_project
set BUILD_OPTION=no_merge
)
if "%%a"=="pwrTest" (
set PWR_TEST=true
)
if "%%a"=="nb_mode" (
set EUTRAN_MODE=nb_mode
)
if "%%a"=="at_command" (
set PROJECT_NAME=at_command
)
if "%%a"=="socket_example" (
set PROJECT_NAME=socket_example
)
if "%%a"=="mqtt_example" (
set PROJECT_NAME=mqtt_example
)
if "%%a"=="https_example" (
set PROJECT_NAME=https_example
)
if "%%a"=="ssl_example" (
set PROJECT_NAME=ssl_example
)
if "%%a"=="libapi_example" (
set PROJECT_NAME=libapi_example
)
if "%%a"=="pos_example" (
set PROJECT_NAME=pos_example
)
if "%%a"=="tts_example" (
set PROJECT_NAME=tts_example
)
if "%%a"=="audio_example" (
set PROJECT_NAME=audio_example
)
if "%%a"=="lpuart_test" (
set PROJECT_NAME=lpuart_test
)
if "%%a"=="driver_example" (
set PROJECT_NAME=driver_example
set BUILD_OPTION=no_merge
)
if "%%a"=="dhrystone" (
set PROJECT_NAME=dhrystone
)
if "%%a"=="coremark" (
set PROJECT_NAME=coremark
)
if "%%a"=="slpman_example" (
set PROJECT_NAME=slpman_example
)
if "%%a"=="sleep_example" (
set PROJECT_NAME=sleep_example
)
if "%%a"=="slpPressure_test" (
set PROJECT_NAME=slpPressure_test
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="ChipIpTest" (
set PROJECT_NAME=ChipIpTest
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="ModemSlpPressure" (
set CORE_NAME=cp
set PROJECT_NAME=ModemSlpPressure
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="mcu_example" (
set PROJECT_NAME=mcu_example
)
if "%%a"=="soc_simple" (
set PROJECT_NAME=soc_simple
)
if "%%a"=="soc_bist" (
set PROJECT_NAME=soc_bist
)
if "%%a"=="simo_test" (
set PROJECT_NAME=simo_test
)
if "%%a"=="clk_verify" (
set PROJECT_NAME=clk_verify
)
if "%%a"=="qspi_test" (
set PROJECT_NAME=qspi_test
)
if "%%a"=="fpga_sct_utfw" (
set PROJECT_NAME=fpga_sct_utfw
)
if "%%a"=="spi_2boards" (
set PROJECT_NAME=spi_2boards
)
if "%%a"=="merge" (
set BUILD_OPTION=merge
)
if "%%a"=="sdkrel" (
set SDKREL=true
)
if "%%a"=="lto" (
set LTO_ENABLE=true
)
if "%%a"=="open_cpu" (
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\oc"
)
if "%%a"=="audio" (
set AUDIO_ENABLE=true
set OPENCPU=true
set CPBIN_SUBPATH=audio
)
if "%%a"=="ims" (
set IMS_ENABLE=true
set AUDIO_ENABLE=true
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\ims"
set CPBIN_SUBPATH=audio
)
if "%%a"=="imsfix" (
set IMS_ENABLE=true
set AUDIO_ENABLE=true
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\ims"
set CPBIN_SUBPATH=audio
set AUDIO_FIX_ENABLE=true
)
if "%%a"=="isms" (
set IMS_SMSONLY_ENABLE=true
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\isms"
)
if "%%a"=="verbose" (
set VERBOSE=1
) else (
set VERBOSE=0
)
if "%%a"=="secboot" (
set BUILD_HEADBIN=true
for /f "tokens=1* delims=" %%a in ('type ".\project\%BOARD_NAME%\ap\apps\bootloader\GCC\Makefile"') do (
if "%%a" equ "CONFIG_PROJ_APP_SECURITY_BOOT = n" (
echo CONFIG_PROJ_APP_SECURITY_BOOT=y
) else (
echo %%a
)
)>>temp.txt
type temp.txt | findstr /v ECHO >>temp1.txt
del temp.txt
move temp1.txt ".\project\%BOARD_NAME%\ap\apps\bootloader\GCC\Makefile" >nul
)
)
if not "%parameterStr%"=="" goto parameterSplit
echo curr Board is: %BOARD_NAME%
echo curr Chip is: %CHIP_NAME%
echo curr Type is: %CHIP_TYPE%
echo curr Project is: %PROJECT_NAME%
echo curr core is: %CORE_NAME%
echo curr option is: %BUILD_OPTION%
echo cp bin subpath: %CPBIN_SUBPATH%
rem duplicate comdblib.txt from 'COMDBLIB_PATH' to '.\tools\'
if exist %COMDBLIB_PATH%\comdblib.txt (
xcopy /f /y %COMDBLIB_PATH%\comdblib.txt .\tools\
)
if "%CUST%"=="qcom" (
rem clear AT ref for qcom
for /f "tokens=1* delims=" %%a in ('type ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk"') do (
if "%%a" equ "PS_AT_REF=y" (
echo PS_AT_REF=n
) else if "%%a" equ "BUILD_AT_REF ?=n" (
echo BUILD_AT_REF=n
) else (
echo %%a
)
)>>temp.txt
type temp.txt | findstr /v ECHO >>temp1.txt
del temp.txt
move temp1.txt ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk" >nul
)
rem --------- if more board/project add here-------------
rem --------- board/project parsing end------------------
echo PARAMETERS: %PARAMETERS% | findstr "help"
if not errorlevel 1 (
echo "=============================================================================================="
echo " "
echo " >> HOW TO BUILD A PROJECT << "
echo " "
echo "==============================================================================================¡±
echo " "
echo " @FORMAT : Gccbuild.bat [<board>[-<core>[-<project>[-<option>]]]] "
echo " @CAUTION: All parameters (<board>/<core>/<project>/<option>) are optional, "
echo " and the default settings of the project will take effect if it occurs! "
echo " For <board>, only 'ec618_0h00' is supportted, and it should be omitted ! "
echo " "
echo "**********************************************************************************************"
echo " <options>: "
echo " >> Basic "
echo " merge compile bl, cp and ap images and merge them into a package. [default] "
echo " doc run doxygen to generate the documents. "
echo " clean clean the output files for a specific board and project. "
echo " clall clean all output files for every board and project. "
echo " allprojects trigger to compile all example projects of the default board "
echo " list list all supported boards and supported projects for every board "
echo " help display this help message. "
echo " "
echo " >> Advanced "
echo " NULL(default) full feature support£¨no ims£©, AP lib: full, CP image£ºoc "
echo " open_cpu for open dev, more ram, AP lib: oc, CP image£ºoc "
echo " isms open_cpu + ims sms, AP lib: isms, CP image£ºoc "
echo " ims volte feature support, AP lib: ims, CP image£ºaudio "
echo " audio audio support(e.g. local MP3 play), AP lib: oc, CP image£ºaudio "
echo "**********************************************************************************************"
echo " Examples: "
echo "----------------------- For Internal Full Source Build----------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader, cp, ap images and merge them into a package. "
echo " > Gccbuild.bat ap-at_command "
echo " build ap at_command project only. "
echo " > Gccbuild.bat ap-bootloader "
echo " build bootloader project only. "
echo " > Gccbuild.bat cp "
echo " build cp project only. "
echo " > Gccbuild.bat ap-driver_example-clean "
echo " clean all output files for ap driver_example project. "
echo " "
echo "----------------------- For Customer's SDK Build----------------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader,ap images, use prebuilt cp image, and merge them into a package. "
echo " > Gccbuild.bat project_name e.g. project_name = at_command/driver_example "
echo " build xxx(project_name) project "
echo " "
echo " @NOTE: SDK build always generates a package(project_name.bin + bootloader.bin + cp.bin). "
echo " "
echo "----------------------- For Universal Build---------------------------------------------------"
echo " > Gccbuild.bat clean "
echo " clean all output files for the default project. "
echo " > Gccbuild.bat clall "
echo " clean all output files for every board and project. "
echo " > Gccbuild.bat list "
echo " list all supported boards and supported projects for every board. "
echo " "
echo " > Gccbuild.bat open_cpu "
echo " build 'open cpu' mode images of the default project, and merge them into a package. "
echo " "
echo "**********************************************************************************************"
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "list"
if not errorlevel 1 (
echo ---------------Supported Board------------------------------------
for /d %%i in ("project\*") do (echo %%~nxi )
echo ------------------------------------------------------------------
for /d %%i in ("project\*") do (
set CURRENT_BOARD=%%~nxi
echo *********supported projects for board: !CURRENT_BOARD!*************
for /d %%i in ("project\!CURRENT_BOARD!\ap\apps\*") do (echo ----%%~nxi )
)
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "doc"
if not errorlevel 1 (
pushd doxygen
CALL genDoc.bat %CHIP_NAME%
popd
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clall"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean all done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clean"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gcc TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clobj"
if not errorlevel 1 (
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.o
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.a
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.elf
echo clean objs done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "allprojects"
if not errorlevel 1 (
if exist .\gccout\%OUTPUT_NAME% (
echo delete %OUTPUT_NAME% folder......
rd .\gccout\%OUTPUT_NAME% /s /q
)
rem step1 build cp if not SDK
if not exist .\tools\comdblib.txt (
echo start logprepass b11
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
)
rem step2 build bootloader no matter SDK or not
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=ap BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo *********supported projects for board: %BOARD_NAME%*************
for /d %%i in ("project\%BOARD_NAME%\ap\apps\*") do (
set CURRENT_PROJECT=%%~nxi
echo ----!CURRENT_PROJECT!
if "!CURRENT_PROJECT!"=="bootloader" (
echo ignore bootloader when loop all project
) else (
echo 111
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
if exist .\tools\comdblib.txt (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true SDK=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
) else (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if not exist .\tools\comdblib.txt (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
) else (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
)
goto complete
)
set starttime=%time%
echo Start time: %date% %starttime%
if "%BUILD_OPTION%"=="merge" (
if exist .\tools\comdblib.txt (
echo start logprepass
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% BUILD_UNILOG=false BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
if "%BUILD_HEADBIN%"=="true" (
echo general headers 1
.\tools\ecsecure.exe APIMAGE=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin ^
CPIMAGE=.\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin ^
BLIMAGE=.\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin ^
BLHASH=1 SYSHASH=1 ^
HEAD1=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin ^
HEAD2=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin ^
BLPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_bl.pem ^
SYSPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_sys.pem ^
ADRBASE=AP_FLASH_XIP_ADDR ^
APADR=AP_FLASH_LOAD_ADDR ^
CFGDEF=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin -addrname XPKGDBLSH_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin -addrname XPKGDSYSH_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_PrMgrCfg_json.bin -addrname XPKGDPRM_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_format_json.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_uart_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_usb_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT%_SEC ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
) else (
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
)
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
) else (
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% SDK_REL=%SDKREL% BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo start logprepass b22
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
if "%BUILD_HEADBIN%"=="true" (
echo general headers 2
.\tools\ecsecure.exe APIMAGE=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin ^
CPIMAGE=.\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin ^
BLIMAGE=.\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin ^
BLHASH=1 SYSHASH=1^
HEAD1=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin ^
HEAD2=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin ^
BLPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_bl.pem ^
SYSPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_sys.pem ^
ADRBASE=AP_FLASH_XIP_ADDR ^
APADR=AP_FLASH_LOAD_ADDR ^
CFGDEF=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin -addrname XPKGDBLSH_VIRTIMG_MERGE_LNA -flashsize BLS_FLASH_LOAD_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin -addrname XPKGDSYSH_VIRTIMG_MERGE_LNA -flashsize SYS_FLASH_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_PrMgrCfg_json.bin -addrname XPKGDPRM_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_format_json.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_uart_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_usb_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT%_SEC ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
) else (
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
)
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.elf
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
)
)
if %PROJECT_NAME%==bootloader goto :buildimage
if %PROJECT_NAME%==driver_example goto :buildimage
set UNILOG=true
echo start logprepass b2
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% TOOLCHAIN_NAME=%TOOLCHAIN_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\debug_log_%CORE_NAME%.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo -----build image----
:buildimage
REM goto end
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=%UNILOG% BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem copy log database to output dir after compile successfully
REM cp .\tools\comdb_%CORE_NAME%.txt .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\comdb.txt
:complete
set endtime=%time%
echo .
echo End time: %date% %endtime%
set /a h1=%starttime:~0,2%
set /a m1=1%starttime:~3,2%-100
set /a s1=1%starttime:~6,2%-100
set /a h2=%endtime:~0,2%
set /a m2=1%endtime:~3,2%-100
set /a s2=1%endtime:~6,2%-100
if %h2% LSS %h1% set /a h2=%h2%+24
set /a ts1=%h1%*3600+%m1%*60+%s1%
set /a ts2=%h2%*3600+%m2%*60+%s2%
set /a ts=%ts2%-%ts1%
set /a h=%ts%/3600
set /a m=(%ts%-%h%*3600)/60
set /a s=%ts%%%60
echo Built took %h% hours %m% minutes %s% seconds
echo #######################################################################
echo ## ##
echo ## ######## ### ###### ###### ##
echo ## ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ## ##
echo ## ######## ## ## ###### ###### ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ###### ###### ##
echo ## ##
echo #######################################################################
echo build successfully
if %UNILOG%==true (
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
:end
goto:eof
:failHandle
echo fail
echo #######################################################################
echo ## ##
echo ## ######## ### #### ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ##
echo ## ###### ## ## ## ## ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## #### ######## ##
echo ## ##
echo #######################################################################
goto:eof

View File

@ -0,0 +1,934 @@
@echo off && setlocal enabledelayedexpansion
@echo %PATH% | findstr /c:"%~dp0tools/msys64/usr/bin">nul
@if %errorlevel% equ 1 set PATH=%~dp0tools/msys64/usr/bin;%PATH%
rem @set PATH=%~dp0tools/msys64/usr/bin;%PATH%
cls
set PROJECT_NAME=at_command
set BOARD_NAME=ec7xx_0h00
set CHIP_NAME=ec7xx
set CHIP_TYPE=ec718s
set CORE_NAME=ap
set EUTRAN_MODE=cat_mode
set BUILD_OPTION=merge
set UNILOG=false
set TOOLCHAIN_NAME=GCC
set CUST=common
set SDKREL=false
set OPENCPU=true
set RAM_ENBALE=false
set ROM_ENBALE=false
set LESS_LOG=false
set LTO_ENABLE=true
set PWR_TEST=false
set GCF_ENABLE=false
set BUILD_HEADBIN=false
set GCCLIB_PATH="C:\gcc"
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\oc"
set CPBIN_SUBPATH=oc
set PKG_MAPDEF=pkg_718s_mapdef
set PKG_PRODUCT="EC718S_PRD"
set OUTPUT_NAME=%BOARD_NAME%_%CHIP_TYPE%
set JOBNUMBER=j8
echo build.bat version 20180330
echo GCCLIB_PATH: %GCCLIB_PATH%
if not %GCCLIB_PATH% == "" (
if not exist %GCCLIB_PATH% (
echo ERROR: Please check GCCLIB_PATH setting, exit!!!
goto end
)
) else (
echo ERROR: Please set GCCLIB_PATH firstly, exit!!!
goto end
)
rem --------- board/project parsing begain------------------
set PARAMETERS=%1
if xx%PARAMETERS%==xx (
echo no input paramter, use default build setting
) else (
echo build option is: %PARAMETERS%
)
set parameterStr=%PARAMETERS%
:parameterSplit
for /f "tokens=1,* delims=-" %%a in ("%parameterStr%") do (
set parameterStr=%%b
echo %%a | findstr /r "j[0-9]*[0-9]\>" > nul
if !errorlevel!==0 (
set JOBNUMBER=%%a
)
if "%%a"=="qcom" (
set CUST=qcom
)
if "%%a"=="ec718_0h00" (
set BOARD_NAME=ec718_0h00
set CHIP_NAME=ec7xx
set OUTPUT_NAME=ec718_0h00_%CHIP_TYPE%
)
if "%%a"=="bootloader" (
set PROJECT_NAME=bootloader
set BUILD_OPTION=no_merge
)
if "%%a"=="ap" (
set CORE_NAME=ap
set BUILD_OPTION=no_merge
)
if "%%a"=="cp" (
set CORE_NAME=cp
set PROJECT_NAME=cp_project
set BUILD_OPTION=no_merge
)
if "%%a"=="pwrTest" (
set PWR_TEST=true
)
if "%%a"=="nb_mode" (
set EUTRAN_MODE=nb_mode
)
if "%%a"=="at_command" (
set PROJECT_NAME=at_command
)
if "%%a"=="socket_example" (
set PROJECT_NAME=socket_example
)
if "%%a"=="mqtt_example" (
set PROJECT_NAME=mqtt_example
)
if "%%a"=="https_example" (
set PROJECT_NAME=https_example
)
if "%%a"=="ssl_example" (
set PROJECT_NAME=ssl_example
)
if "%%a"=="libapi_example" (
set PROJECT_NAME=libapi_example
)
if "%%a"=="pos_example" (
set PROJECT_NAME=pos_example
)
if "%%a"=="tts_example" (
set PROJECT_NAME=tts_example
)
if "%%a"=="audio_example" (
set PROJECT_NAME=audio_example
)
if "%%a"=="lpuart_test" (
set PROJECT_NAME=lpuart_test
set LTO_ENABLE=false
)
if "%%a"=="driver_example" (
set PROJECT_NAME=driver_example
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="dhrystone" (
set PROJECT_NAME=dhrystone
)
if "%%a"=="coremark" (
set PROJECT_NAME=coremark
)
if "%%a"=="slpman_example" (
set PROJECT_NAME=slpman_example
)
if "%%a"=="sleep_example" (
set PROJECT_NAME=sleep_example
)
if "%%a"=="slpPressure_test" (
set PROJECT_NAME=slpPressure_test
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="ChipIpTest" (
set PROJECT_NAME=ChipIpTest
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="ModemSlpPressure" (
set CORE_NAME=cp
set PROJECT_NAME=ModemSlpPressure
set BUILD_OPTION=no_merge
set LTO_ENABLE=true
)
if "%%a"=="mcu_example" (
set PROJECT_NAME=mcu_example
)
if "%%a"=="soc_simple" (
set PROJECT_NAME=soc_simple
)
if "%%a"=="soc_bist" (
set PROJECT_NAME=soc_bist
)
if "%%a"=="simo_test" (
set PROJECT_NAME=simo_test
)
if "%%a"=="clk_verify" (
set PROJECT_NAME=clk_verify
set LTO_ENABLE=false
)
if "%%a"=="qspi_test" (
set PROJECT_NAME=qspi_test
set LTO_ENABLE=false
)
if "%%a"=="fpga_sct_utfw" (
set PROJECT_NAME=fpga_sct_utfw
)
if "%%a"=="spi_2boards" (
set PROJECT_NAME=spi_2boards
)
if "%%a"=="merge" (
set BUILD_OPTION=merge
)
if "%%a"=="sdkrel" (
set SDKREL=true
)
if "%%a"=="lto" (
set LTO_ENABLE=true
)
if "%%a"=="open_cpu" (
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\oc"
set CPBIN_SUBPATH=oc
)
if "%%a"=="basic" (
set GCF_ENABLE=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\gcf"
set CPBIN_SUBPATH=wifi
)
if "%%a"=="mid" (
set MID_ENABLE=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\mid"
set CPBIN_SUBPATH=wifi
)
if "%%a"=="rom" (
set ROM_ENABLE=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\rom"
set CPBIN_SUBPATH=oc
)
if "%%a"=="lesslog" (
set LESS_LOG=true
if "%ROM_ENABLE%"=="true" (
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\rom_lesslog"
set CPBIN_SUBPATH=rom_lesslog
) else (
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\oc_lesslog"
set CPBIN_SUBPATH=oc
)
)
if "%%a"=="verbose" (
set VERBOSE=1
) else (
set VERBOSE=0
)
if "%%a"=="secboot" (
set BUILD_HEADBIN=true
for /f "tokens=1* delims=" %%a in ('type ".\project\%BOARD_NAME%\ap\apps\bootloader\GCC\Makefile"') do (
if "%%a" equ "CONFIG_PROJ_APP_SECURITY_BOOT = n" (
echo CONFIG_PROJ_APP_SECURITY_BOOT=y
) else (
echo %%a
)
)>>temp.txt
type temp.txt | findstr /v ECHO >>temp1.txt
del temp.txt
move temp1.txt ".\project\%BOARD_NAME%\ap\apps\bootloader\GCC\Makefile" >nul
)
)
if not "%parameterStr%"=="" goto parameterSplit
echo curr Board is: %BOARD_NAME%
echo curr Chip is: %CHIP_NAME%
echo curr Type is: %CHIP_TYPE%
echo curr Project is: %PROJECT_NAME%
echo curr core is: %CORE_NAME%
echo curr option is: %BUILD_OPTION%
echo cpbin subpath is: %CPBIN_SUBPATH%
echo comdblib path is: %COMDBLIB_PATH%
rem duplicate comdblib.txt from 'COMDBLIB_PATH' to '.\tools\'
if exist %COMDBLIB_PATH%\comdblib.txt (
xcopy /f /y %COMDBLIB_PATH%\comdblib.txt .\tools\
)
if "%CUST%"=="qcom" (
rem clear AT ref for qcom
for /f "tokens=1* delims=" %%a in ('type ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk"') do (
if "%%a" equ "PS_AT_REF=y" (
echo PS_AT_REF=n
) else if "%%a" equ "BUILD_AT_REF ?=n" (
echo BUILD_AT_REF=n
) else (
echo %%a
)
)>>temp.txt
type temp.txt | findstr /v ECHO >>temp1.txt
del temp.txt
move temp1.txt ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk" >nul
)
rem --------- if more board/project add here-------------
rem --------- board/project parsing end------------------
echo PARAMETERS: %PARAMETERS% | findstr "help"
if not errorlevel 1 (
echo "=============================================================================================="
echo " "
echo " >> HOW TO BUILD A PROJECT << "
echo " "
echo "==============================================================================================¡±
echo " "
echo " @FORMAT : Gccbuild.bat [<board>[-<core>[-<project>[-<option>]]]] "
echo " @CAUTION: All parameters (<board>/<core>/<project>/<option>) are optional, "
echo " and the default settings of the project will take effect if it occurs! "
echo " For <board>, only 'ec618_0h00' is supportted, and it should be omitted ! "
echo " "
echo "**********************************************************************************************"
echo " <options>: "
echo " >> Basic "
echo " merge compile bl, cp and ap images and merge them into a package. [default] "
echo " doc run doxygen to generate the documents. "
echo " clean clean the output files for a specific board and project. "
echo " clall clean all output files for every board and project. "
echo " allprojects trigger to compile all example projects of the default board "
echo " list list all supported boards and supported projects for every board "
echo " help display this help message. "
echo " "
echo " >> Advanced "
echo " NULL(mini) for open dev, more ram, AP lib: oc, CP image: oc "
echo " mid mini + wifi scan/sms AP lib: mid, CP image: wifi "
echo " basic support gcf test(test version), AP lib: gcf, CP image: wifi "
echo " ram open_dev + addtional 100K ram AP lib: ram, CP image: ram "
echo " rom mini + remove rndis/socket AP lib: rom, CP image: oc "
echo " rom-lesslog rom + log reducing AP lib: rom_lesslog, CP image: rom_lesslog "
echo " lesslog log reducing AP lib: rom_lesslog, CP image: oc "
echo "**********************************************************************************************"
echo " Examples: "
echo "----------------------- For Internal Full Source Build----------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader, cp, ap images and merge them into a package. "
echo " > Gccbuild.bat ap-at_command "
echo " build ap at_command project only. "
echo " > Gccbuild.bat ap-bootloader "
echo " build bootloader project only. "
echo " > Gccbuild.bat cp "
echo " build cp project only. "
echo " > Gccbuild.bat ap-driver_example-clean "
echo " clean all output files for ap driver_example project. "
echo " "
echo "----------------------- For Customer's SDK Build----------------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader,ap images, use prebuilt cp image, and merge them into a package. "
echo " > Gccbuild.bat project_name e.g. project_name = at_command/driver_example "
echo " build xxx(project_name) project "
echo " "
echo " @NOTE: SDK build always generates a package(project_name.bin + bootloader.bin + cp.bin). "
echo " "
echo "----------------------- For Universal Build---------------------------------------------------"
echo " > Gccbuild.bat clean "
echo " clean all output files for the default project. "
echo " > Gccbuild.bat clall "
echo " clean all output files for every board and project. "
echo " > Gccbuild.bat list "
echo " list all supported boards and supported projects for every board. "
echo " "
echo " > Gccbuild.bat open_cpu "
echo " build 'open cpu' mode images of the default project, and merge them into a package. "
echo " "
echo "**********************************************************************************************"
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "list"
if not errorlevel 1 (
echo ---------------Supported Board------------------------------------
for /d %%i in ("project\*") do (echo %%~nxi )
echo ------------------------------------------------------------------
for /d %%i in ("project\*") do (
set CURRENT_BOARD=%%~nxi
echo *********supported projects for board: !CURRENT_BOARD!*************
for /d %%i in ("project\!CURRENT_BOARD!\ap\apps\*") do (echo ----%%~nxi )
)
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "doc"
if not errorlevel 1 (
pushd doxygen
CALL genDoc.bat %CHIP_NAME%
popd
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clall"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean all done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clean"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gcc TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clobj"
if not errorlevel 1 (
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.o
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.a
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.elf
echo clean objs done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "allprojects"
if not errorlevel 1 (
if exist .\gccout\%OUTPUT_NAME% (
echo delete %OUTPUT_NAME% folder......
rd .\gccout\%OUTPUT_NAME% /s /q
)
rem step1 build cp if not SDK
if not exist .\tools\comdblib.txt (
echo start logprepass b11
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
)
rem step2 build bootloader no matter SDK or not
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=ap BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo *********supported projects for board: %BOARD_NAME%*************
for /d %%i in ("project\%BOARD_NAME%\ap\apps\*") do (
set CURRENT_PROJECT=%%~nxi
echo ----!CURRENT_PROJECT!
if "!CURRENT_PROJECT!"=="bootloader" (
echo ignore bootloader when loop all project
) else (
echo 111
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
if exist .\tools\comdblib.txt (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true SDK=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
) else (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if not exist .\tools\comdblib.txt (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
) else (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
)
goto complete
)
set starttime=%time%
echo Start time: %date% %starttime%
if "%BUILD_OPTION%"=="merge" (
if exist .\tools\comdblib.txt (
echo start logprepass
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% BUILD_UNILOG=false BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
if "%BUILD_HEADBIN%"=="true" (
echo general headers 1
.\tools\ecsecure.exe APIMAGE=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin ^
CPIMAGE=.\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin ^
BLIMAGE=.\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin ^
BLHASH=1 SYSHASH=1 ^
HEAD1=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin ^
HEAD2=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin ^
BLPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_bl.pem ^
SYSPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_sys.pem ^
ADRBASE=AP_FLASH_XIP_ADDR ^
APADR=AP_FLASH_LOAD_ADDR ^
CFGDEF=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin -addrname XPKGDBLSH_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin -addrname XPKGDSYSH_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_PrMgrCfg_json.bin -addrname XPKGDPRM_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_format_json.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_uart_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_usb_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT%_SEC ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
) else (
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
)
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
) else (
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% SDK_REL=%SDKREL% BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo start logprepass b22
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
if "%BUILD_HEADBIN%"=="true" (
echo general headers 2
.\tools\ecsecure.exe APIMAGE=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin ^
CPIMAGE=.\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin ^
BLIMAGE=.\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin ^
BLHASH=1 SYSHASH=1^
HEAD1=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin ^
HEAD2=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin ^
BLPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_bl.pem ^
SYSPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_sys.pem ^
ADRBASE=AP_FLASH_XIP_ADDR ^
APADR=AP_FLASH_LOAD_ADDR ^
CFGDEF=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin -addrname XPKGDBLSH_VIRTIMG_MERGE_LNA -flashsize BLS_FLASH_LOAD_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin -addrname XPKGDSYSH_VIRTIMG_MERGE_LNA -flashsize SYS_FLASH_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_PrMgrCfg_json.bin -addrname XPKGDPRM_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_format_json.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_uart_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_usb_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT%_SEC ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
) else (
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
)
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.elf
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
)
)
if %PROJECT_NAME%==bootloader goto :buildimage
if %PROJECT_NAME%==driver_example goto :buildimage
set UNILOG=true
echo start logprepass b2
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% TOOLCHAIN_NAME=%TOOLCHAIN_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\debug_log_%CORE_NAME%.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo -----build image----
:buildimage
REM goto end
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=%UNILOG% BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem copy log database to output dir after compile successfully
REM cp .\tools\comdb_%CORE_NAME%.txt .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\comdb.txt
:complete
set endtime=%time%
echo .
echo End time: %date% %endtime%
set /a h1=%starttime:~0,2%
set /a m1=1%starttime:~3,2%-100
set /a s1=1%starttime:~6,2%-100
set /a h2=%endtime:~0,2%
set /a m2=1%endtime:~3,2%-100
set /a s2=1%endtime:~6,2%-100
if %h2% LSS %h1% set /a h2=%h2%+24
set /a ts1=%h1%*3600+%m1%*60+%s1%
set /a ts2=%h2%*3600+%m2%*60+%s2%
set /a ts=%ts2%-%ts1%
set /a h=%ts%/3600
set /a m=(%ts%-%h%*3600)/60
set /a s=%ts%%%60
echo Built took %h% hours %m% minutes %s% seconds
echo #######################################################################
echo ## ##
echo ## ######## ### ###### ###### ##
echo ## ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ## ##
echo ## ######## ## ## ###### ###### ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ###### ###### ##
echo ## ##
echo #######################################################################
echo build successfully
if %UNILOG%==true (
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
:end
goto:eof
:failHandle
echo fail
echo #######################################################################
echo ## ##
echo ## ######## ### #### ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ##
echo ## ###### ## ## ## ## ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## #### ######## ##
echo ## ##
echo #######################################################################
goto:eof

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,934 @@
@echo off && setlocal enabledelayedexpansion
@echo %PATH% | findstr /c:"%~dp0tools/msys64/usr/bin">nul
@if %errorlevel% equ 1 set PATH=%~dp0tools/msys64/usr/bin;%PATH%
rem @set PATH=%~dp0tools/msys64/usr/bin;%PATH%
cls
set PROJECT_NAME=at_command
set BOARD_NAME=ec7xx_0h00
set CHIP_NAME=ec7xx
set CHIP_TYPE=ec718sm
set CORE_NAME=ap
set EUTRAN_MODE=cat_mode
set BUILD_OPTION=merge
set UNILOG=false
set TOOLCHAIN_NAME=GCC
set CUST=common
set SDKREL=false
set OPENCPU=true
set RAM_ENBALE=false
set ROM_ENBALE=false
set LESS_LOG=false
set LTO_ENABLE=true
set PWR_TEST=false
set GCF_ENABLE=false
set BUILD_HEADBIN=false
set GCCLIB_PATH="C:\gcc"
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\oc"
set CPBIN_SUBPATH=oc
set PKG_MAPDEF=pkg_718sm_mapdef
set PKG_PRODUCT="EC718SM_PRD"
set OUTPUT_NAME=%BOARD_NAME%_%CHIP_TYPE%
set JOBNUMBER=j8
echo build.bat version 20180330
echo GCCLIB_PATH: %GCCLIB_PATH%
if not %GCCLIB_PATH% == "" (
if not exist %GCCLIB_PATH% (
echo ERROR: Please check GCCLIB_PATH setting, exit!!!
goto end
)
) else (
echo ERROR: Please set GCCLIB_PATH firstly, exit!!!
goto end
)
rem --------- board/project parsing begain------------------
set PARAMETERS=%1
if xx%PARAMETERS%==xx (
echo no input paramter, use default build setting
) else (
echo build option is: %PARAMETERS%
)
set parameterStr=%PARAMETERS%
:parameterSplit
for /f "tokens=1,* delims=-" %%a in ("%parameterStr%") do (
set parameterStr=%%b
echo %%a | findstr /r "j[0-9]*[0-9]\>" > nul
if !errorlevel!==0 (
set JOBNUMBER=%%a
)
if "%%a"=="qcom" (
set CUST=qcom
)
if "%%a"=="ec718_0h00" (
set BOARD_NAME=ec718_0h00
set CHIP_NAME=ec7xx
set OUTPUT_NAME=ec718_0h00_%CHIP_TYPE%
)
if "%%a"=="bootloader" (
set PROJECT_NAME=bootloader
set BUILD_OPTION=no_merge
)
if "%%a"=="ap" (
set CORE_NAME=ap
set BUILD_OPTION=no_merge
)
if "%%a"=="cp" (
set CORE_NAME=cp
set PROJECT_NAME=cp_project
set BUILD_OPTION=no_merge
)
if "%%a"=="pwrTest" (
set PWR_TEST=true
)
if "%%a"=="nb_mode" (
set EUTRAN_MODE=nb_mode
)
if "%%a"=="at_command" (
set PROJECT_NAME=at_command
)
if "%%a"=="socket_example" (
set PROJECT_NAME=socket_example
)
if "%%a"=="mqtt_example" (
set PROJECT_NAME=mqtt_example
)
if "%%a"=="https_example" (
set PROJECT_NAME=https_example
)
if "%%a"=="ssl_example" (
set PROJECT_NAME=ssl_example
)
if "%%a"=="libapi_example" (
set PROJECT_NAME=libapi_example
)
if "%%a"=="pos_example" (
set PROJECT_NAME=pos_example
)
if "%%a"=="tts_example" (
set PROJECT_NAME=tts_example
)
if "%%a"=="audio_example" (
set PROJECT_NAME=audio_example
)
if "%%a"=="lpuart_test" (
set PROJECT_NAME=lpuart_test
set LTO_ENABLE=false
)
if "%%a"=="driver_example" (
set PROJECT_NAME=driver_example
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="dhrystone" (
set PROJECT_NAME=dhrystone
)
if "%%a"=="coremark" (
set PROJECT_NAME=coremark
)
if "%%a"=="slpman_example" (
set PROJECT_NAME=slpman_example
)
if "%%a"=="sleep_example" (
set PROJECT_NAME=sleep_example
)
if "%%a"=="slpPressure_test" (
set PROJECT_NAME=slpPressure_test
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="ChipIpTest" (
set PROJECT_NAME=ChipIpTest
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="ModemSlpPressure" (
set CORE_NAME=cp
set PROJECT_NAME=ModemSlpPressure
set BUILD_OPTION=no_merge
set LTO_ENABLE=true
)
if "%%a"=="mcu_example" (
set PROJECT_NAME=mcu_example
)
if "%%a"=="soc_simple" (
set PROJECT_NAME=soc_simple
)
if "%%a"=="soc_bist" (
set PROJECT_NAME=soc_bist
)
if "%%a"=="simo_test" (
set PROJECT_NAME=simo_test
)
if "%%a"=="clk_verify" (
set PROJECT_NAME=clk_verify
set LTO_ENABLE=false
)
if "%%a"=="qspi_test" (
set PROJECT_NAME=qspi_test
set LTO_ENABLE=false
)
if "%%a"=="fpga_sct_utfw" (
set PROJECT_NAME=fpga_sct_utfw
)
if "%%a"=="spi_2boards" (
set PROJECT_NAME=spi_2boards
)
if "%%a"=="merge" (
set BUILD_OPTION=merge
)
if "%%a"=="sdkrel" (
set SDKREL=true
)
if "%%a"=="lto" (
set LTO_ENABLE=true
)
if "%%a"=="open_cpu" (
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\oc"
set CPBIN_SUBPATH=oc
)
if "%%a"=="basic" (
set GCF_ENABLE=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\gcf"
set CPBIN_SUBPATH=wifi
)
if "%%a"=="mid" (
set MID_ENABLE=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\mid"
set CPBIN_SUBPATH=wifi
)
if "%%a"=="rom" (
set ROM_ENABLE=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\rom"
set CPBIN_SUBPATH=oc
)
if "%%a"=="lesslog" (
set LESS_LOG=true
if "%ROM_ENABLE%"=="true" (
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\rom_lesslog"
set CPBIN_SUBPATH=rom_lesslog
) else (
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\oc_lesslog"
set CPBIN_SUBPATH=oc
)
)
if "%%a"=="verbose" (
set VERBOSE=1
) else (
set VERBOSE=0
)
if "%%a"=="secboot" (
set BUILD_HEADBIN=true
for /f "tokens=1* delims=" %%a in ('type ".\project\%BOARD_NAME%\ap\apps\bootloader\GCC\Makefile"') do (
if "%%a" equ "CONFIG_PROJ_APP_SECURITY_BOOT = n" (
echo CONFIG_PROJ_APP_SECURITY_BOOT=y
) else (
echo %%a
)
)>>temp.txt
type temp.txt | findstr /v ECHO >>temp1.txt
del temp.txt
move temp1.txt ".\project\%BOARD_NAME%\ap\apps\bootloader\GCC\Makefile" >nul
)
)
if not "%parameterStr%"=="" goto parameterSplit
echo curr Board is: %BOARD_NAME%
echo curr Chip is: %CHIP_NAME%
echo curr Type is: %CHIP_TYPE%
echo curr Project is: %PROJECT_NAME%
echo curr core is: %CORE_NAME%
echo curr option is: %BUILD_OPTION%
echo cpbin subpath is: %CPBIN_SUBPATH%
echo comdblib path is: %COMDBLIB_PATH%
rem duplicate comdblib.txt from 'COMDBLIB_PATH' to '.\tools\'
if exist %COMDBLIB_PATH%\comdblib.txt (
xcopy /f /y %COMDBLIB_PATH%\comdblib.txt .\tools\
)
if "%CUST%"=="qcom" (
rem clear AT ref for qcom
for /f "tokens=1* delims=" %%a in ('type ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk"') do (
if "%%a" equ "PS_AT_REF=y" (
echo PS_AT_REF=n
) else if "%%a" equ "BUILD_AT_REF ?=n" (
echo BUILD_AT_REF=n
) else (
echo %%a
)
)>>temp.txt
type temp.txt | findstr /v ECHO >>temp1.txt
del temp.txt
move temp1.txt ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk" >nul
)
rem --------- if more board/project add here-------------
rem --------- board/project parsing end------------------
echo PARAMETERS: %PARAMETERS% | findstr "help"
if not errorlevel 1 (
echo "=============================================================================================="
echo " "
echo " >> HOW TO BUILD A PROJECT << "
echo " "
echo "==============================================================================================¡±
echo " "
echo " @FORMAT : Gccbuild.bat [<board>[-<core>[-<project>[-<option>]]]] "
echo " @CAUTION: All parameters (<board>/<core>/<project>/<option>) are optional, "
echo " and the default settings of the project will take effect if it occurs! "
echo " For <board>, only 'ec618_0h00' is supportted, and it should be omitted ! "
echo " "
echo "**********************************************************************************************"
echo " <options>: "
echo " >> Basic "
echo " merge compile bl, cp and ap images and merge them into a package. [default] "
echo " doc run doxygen to generate the documents. "
echo " clean clean the output files for a specific board and project. "
echo " clall clean all output files for every board and project. "
echo " allprojects trigger to compile all example projects of the default board "
echo " list list all supported boards and supported projects for every board "
echo " help display this help message. "
echo " "
echo " >> Advanced "
echo " NULL(mini) for open dev, more ram, AP lib: oc, CP image: oc "
echo " mid mini + wifi scan/sms AP lib: mid, CP image: wifi "
echo " basic support gcf test(test version), AP lib: gcf, CP image: wifi "
echo " ram open_dev + addtional 100K ram AP lib: ram, CP image: ram "
echo " rom mini + remove rndis/socket AP lib: rom, CP image: oc "
echo " rom-lesslog rom + log reducing AP lib: rom_lesslog, CP image: rom_lesslog "
echo " lesslog log reducing AP lib: rom_lesslog, CP image: oc "
echo "**********************************************************************************************"
echo " Examples: "
echo "----------------------- For Internal Full Source Build----------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader, cp, ap images and merge them into a package. "
echo " > Gccbuild.bat ap-at_command "
echo " build ap at_command project only. "
echo " > Gccbuild.bat ap-bootloader "
echo " build bootloader project only. "
echo " > Gccbuild.bat cp "
echo " build cp project only. "
echo " > Gccbuild.bat ap-driver_example-clean "
echo " clean all output files for ap driver_example project. "
echo " "
echo "----------------------- For Customer's SDK Build----------------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader,ap images, use prebuilt cp image, and merge them into a package. "
echo " > Gccbuild.bat project_name e.g. project_name = at_command/driver_example "
echo " build xxx(project_name) project "
echo " "
echo " @NOTE: SDK build always generates a package(project_name.bin + bootloader.bin + cp.bin). "
echo " "
echo "----------------------- For Universal Build---------------------------------------------------"
echo " > Gccbuild.bat clean "
echo " clean all output files for the default project. "
echo " > Gccbuild.bat clall "
echo " clean all output files for every board and project. "
echo " > Gccbuild.bat list "
echo " list all supported boards and supported projects for every board. "
echo " "
echo " > Gccbuild.bat open_cpu "
echo " build 'open cpu' mode images of the default project, and merge them into a package. "
echo " "
echo "**********************************************************************************************"
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "list"
if not errorlevel 1 (
echo ---------------Supported Board------------------------------------
for /d %%i in ("project\*") do (echo %%~nxi )
echo ------------------------------------------------------------------
for /d %%i in ("project\*") do (
set CURRENT_BOARD=%%~nxi
echo *********supported projects for board: !CURRENT_BOARD!*************
for /d %%i in ("project\!CURRENT_BOARD!\ap\apps\*") do (echo ----%%~nxi )
)
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "doc"
if not errorlevel 1 (
pushd doxygen
CALL genDoc.bat %CHIP_NAME%
popd
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clall"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean all done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clean"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gcc TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clobj"
if not errorlevel 1 (
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.o
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.a
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.elf
echo clean objs done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "allprojects"
if not errorlevel 1 (
if exist .\gccout\%OUTPUT_NAME% (
echo delete %OUTPUT_NAME% folder......
rd .\gccout\%OUTPUT_NAME% /s /q
)
rem step1 build cp if not SDK
if not exist .\tools\comdblib.txt (
echo start logprepass b11
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
)
rem step2 build bootloader no matter SDK or not
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=ap BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo *********supported projects for board: %BOARD_NAME%*************
for /d %%i in ("project\%BOARD_NAME%\ap\apps\*") do (
set CURRENT_PROJECT=%%~nxi
echo ----!CURRENT_PROJECT!
if "!CURRENT_PROJECT!"=="bootloader" (
echo ignore bootloader when loop all project
) else (
echo 111
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
if exist .\tools\comdblib.txt (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true SDK=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
) else (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if not exist .\tools\comdblib.txt (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
) else (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
)
goto complete
)
set starttime=%time%
echo Start time: %date% %starttime%
if "%BUILD_OPTION%"=="merge" (
if exist .\tools\comdblib.txt (
echo start logprepass
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% BUILD_UNILOG=false BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
if "%BUILD_HEADBIN%"=="true" (
echo general headers 1
.\tools\ecsecure.exe APIMAGE=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin ^
CPIMAGE=.\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin ^
BLIMAGE=.\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin ^
BLHASH=1 SYSHASH=1 ^
HEAD1=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin ^
HEAD2=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin ^
BLPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_bl.pem ^
SYSPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_sys.pem ^
ADRBASE=AP_FLASH_XIP_ADDR ^
APADR=AP_FLASH_LOAD_ADDR ^
CFGDEF=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin -addrname XPKGDBLSH_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin -addrname XPKGDSYSH_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_PrMgrCfg_json.bin -addrname XPKGDPRM_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_format_json.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_uart_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_usb_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT%_SEC ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
) else (
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
)
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
) else (
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% SDK_REL=%SDKREL% BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo start logprepass b22
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
if "%BUILD_HEADBIN%"=="true" (
echo general headers 2
.\tools\ecsecure.exe APIMAGE=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin ^
CPIMAGE=.\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin ^
BLIMAGE=.\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin ^
BLHASH=1 SYSHASH=1^
HEAD1=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin ^
HEAD2=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin ^
BLPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_bl.pem ^
SYSPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_sys.pem ^
ADRBASE=AP_FLASH_XIP_ADDR ^
APADR=AP_FLASH_LOAD_ADDR ^
CFGDEF=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin -addrname XPKGDBLSH_VIRTIMG_MERGE_LNA -flashsize BLS_FLASH_LOAD_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin -addrname XPKGDSYSH_VIRTIMG_MERGE_LNA -flashsize SYS_FLASH_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_PrMgrCfg_json.bin -addrname XPKGDPRM_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_format_json.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_uart_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_usb_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT%_SEC ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
) else (
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
)
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.elf
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
)
)
if %PROJECT_NAME%==bootloader goto :buildimage
if %PROJECT_NAME%==driver_example goto :buildimage
set UNILOG=true
echo start logprepass b2
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% TOOLCHAIN_NAME=%TOOLCHAIN_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\debug_log_%CORE_NAME%.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo -----build image----
:buildimage
REM goto end
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=%UNILOG% BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem copy log database to output dir after compile successfully
REM cp .\tools\comdb_%CORE_NAME%.txt .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\comdb.txt
:complete
set endtime=%time%
echo .
echo End time: %date% %endtime%
set /a h1=%starttime:~0,2%
set /a m1=1%starttime:~3,2%-100
set /a s1=1%starttime:~6,2%-100
set /a h2=%endtime:~0,2%
set /a m2=1%endtime:~3,2%-100
set /a s2=1%endtime:~6,2%-100
if %h2% LSS %h1% set /a h2=%h2%+24
set /a ts1=%h1%*3600+%m1%*60+%s1%
set /a ts2=%h2%*3600+%m2%*60+%s2%
set /a ts=%ts2%-%ts1%
set /a h=%ts%/3600
set /a m=(%ts%-%h%*3600)/60
set /a s=%ts%%%60
echo Built took %h% hours %m% minutes %s% seconds
echo #######################################################################
echo ## ##
echo ## ######## ### ###### ###### ##
echo ## ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ## ##
echo ## ######## ## ## ###### ###### ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ###### ###### ##
echo ## ##
echo #######################################################################
echo build successfully
if %UNILOG%==true (
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
:end
goto:eof
:failHandle
echo fail
echo #######################################################################
echo ## ##
echo ## ######## ### #### ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ##
echo ## ###### ## ## ## ## ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## #### ######## ##
echo ## ##
echo #######################################################################
goto:eof

View File

@ -0,0 +1,923 @@
@echo off && setlocal enabledelayedexpansion
@echo %PATH% | findstr /c:"%~dp0tools/msys64/usr/bin">nul
@if %errorlevel% equ 1 set PATH=%~dp0tools/msys64/usr/bin;%PATH%
rem @set PATH=%~dp0tools/msys64/usr/bin;%PATH%
cls
set PROJECT_NAME=at_command
set BOARD_NAME=ec7xx_0h00
set CHIP_NAME=ec7xx
set CHIP_TYPE=ec718u
set CORE_NAME=ap
set EUTRAN_MODE=cat_mode
set BUILD_OPTION=merge
set UNILOG=false
set TOOLCHAIN_NAME=GCC
set CUST=common
set SDKREL=false
set OPENCPU=false
set RAM_ENBALE=false
set ROM_ENBALE=false
set LESS_LOG=false
set LTO_ENABLE=false
set PWR_TEST=false
set BUILD_HEADBIN=false
set GCCLIB_PATH="C:\gcc"
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\full"
set CPBIN_SUBPATH=oc
set PKG_MAPDEF=pkg_718u_mapdef
set PKG_PRODUCT="EC718U_PRD"
set OUTPUT_NAME=%BOARD_NAME%_%CHIP_TYPE%
set JOBNUMBER=j4
echo build.bat version 20180330
echo GCCLIB_PATH: %GCCLIB_PATH%
if not %GCCLIB_PATH% == "" (
if not exist %GCCLIB_PATH% (
echo ERROR: Please check GCCLIB_PATH setting, exit!!!
goto end
)
) else (
echo ERROR: Please set GCCLIB_PATH firstly, exit!!!
goto end
)
rem --------- board/project parsing begain------------------
set PARAMETERS=%1
if xx%PARAMETERS%==xx (
echo no input paramter, use default build setting
) else (
echo build option is: %PARAMETERS%
)
set parameterStr=%PARAMETERS%
:parameterSplit
for /f "tokens=1,* delims=-" %%a in ("%parameterStr%") do (
set parameterStr=%%b
echo %%a | findstr /r "j[0-9]*[0-9]\>" > nul
if !errorlevel!==0 (
set JOBNUMBER=%%a
)
if "%%a"=="qcom" (
set CUST=qcom
)
if "%%a"=="ec718_0h00" (
set BOARD_NAME=ec718_0h00
set CHIP_NAME=ec7xx
set OUTPUT_NAME=ec718_0h00_%CHIP_TYPE%
)
if "%%a"=="bootloader" (
set PROJECT_NAME=bootloader
set BUILD_OPTION=no_merge
)
if "%%a"=="ap" (
set CORE_NAME=ap
set BUILD_OPTION=no_merge
)
if "%%a"=="cp" (
set CORE_NAME=cp
set PROJECT_NAME=cp_project
set BUILD_OPTION=no_merge
)
if "%%a"=="pwrTest" (
set PWR_TEST=true
)
if "%%a"=="nb_mode" (
set EUTRAN_MODE=nb_mode
)
if "%%a"=="at_command" (
set PROJECT_NAME=at_command
)
if "%%a"=="socket_example" (
set PROJECT_NAME=socket_example
)
if "%%a"=="mqtt_example" (
set PROJECT_NAME=mqtt_example
)
if "%%a"=="https_example" (
set PROJECT_NAME=https_example
)
if "%%a"=="ssl_example" (
set PROJECT_NAME=ssl_example
)
if "%%a"=="libapi_example" (
set PROJECT_NAME=libapi_example
)
if "%%a"=="pos_example" (
set PROJECT_NAME=pos_example
)
if "%%a"=="tts_example" (
set PROJECT_NAME=tts_example
)
if "%%a"=="audio_example" (
set PROJECT_NAME=audio_example
)
if "%%a"=="lpuart_test" (
set PROJECT_NAME=lpuart_test
)
if "%%a"=="driver_example" (
set PROJECT_NAME=driver_example
set BUILD_OPTION=no_merge
)
if "%%a"=="dhrystone" (
set PROJECT_NAME=dhrystone
)
if "%%a"=="coremark" (
set PROJECT_NAME=coremark
)
if "%%a"=="slpman_example" (
set PROJECT_NAME=slpman_example
)
if "%%a"=="sleep_example" (
set PROJECT_NAME=sleep_example
)
if "%%a"=="slpPressure_test" (
set PROJECT_NAME=slpPressure_test
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="ChipIpTest" (
set PROJECT_NAME=ChipIpTest
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="ModemSlpPressure" (
set CORE_NAME=cp
set PROJECT_NAME=ModemSlpPressure
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="mcu_example" (
set PROJECT_NAME=mcu_example
)
if "%%a"=="soc_simple" (
set PROJECT_NAME=soc_simple
)
if "%%a"=="soc_bist" (
set PROJECT_NAME=soc_bist
)
if "%%a"=="simo_test" (
set PROJECT_NAME=simo_test
)
if "%%a"=="clk_verify" (
set PROJECT_NAME=clk_verify
)
if "%%a"=="qspi_test" (
set PROJECT_NAME=qspi_test
)
if "%%a"=="fpga_sct_utfw" (
set PROJECT_NAME=fpga_sct_utfw
)
if "%%a"=="spi_2boards" (
set PROJECT_NAME=spi_2boards
)
if "%%a"=="merge" (
set BUILD_OPTION=merge
)
if "%%a"=="sdkrel" (
set SDKREL=true
)
if "%%a"=="lto" (
set LTO_ENABLE=true
)
if "%%a"=="open_cpu" (
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\oc"
)
if "%%a"=="audio" (
set AUDIO_ENABLE=true
set OPENCPU=true
set CPBIN_SUBPATH=audio
)
if "%%a"=="ims" (
set IMS_ENABLE=true
set AUDIO_ENABLE=true
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\ims"
set CPBIN_SUBPATH=audio
)
if "%%a"=="imsfix" (
set IMS_ENABLE=true
set AUDIO_ENABLE=true
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\ims"
set CPBIN_SUBPATH=audio
set AUDIO_FIX_ENABLE=true
)
if "%%a"=="isms" (
set IMS_SMSONLY_ENABLE=true
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\isms"
)
if "%%a"=="verbose" (
set VERBOSE=1
) else (
set VERBOSE=0
)
if "%%a"=="secboot" (
set BUILD_HEADBIN=true
for /f "tokens=1* delims=" %%a in ('type ".\project\%BOARD_NAME%\ap\apps\bootloader\GCC\Makefile"') do (
if "%%a" equ "CONFIG_PROJ_APP_SECURITY_BOOT = n" (
echo CONFIG_PROJ_APP_SECURITY_BOOT=y
) else (
echo %%a
)
)>>temp.txt
type temp.txt | findstr /v ECHO >>temp1.txt
del temp.txt
move temp1.txt ".\project\%BOARD_NAME%\ap\apps\bootloader\GCC\Makefile" >nul
)
)
if not "%parameterStr%"=="" goto parameterSplit
echo curr Board is: %BOARD_NAME%
echo curr Chip is: %CHIP_NAME%
echo curr Type is: %CHIP_TYPE%
echo curr Project is: %PROJECT_NAME%
echo curr core is: %CORE_NAME%
echo curr option is: %BUILD_OPTION%
echo cp bin subpath: %CPBIN_SUBPATH%
rem duplicate comdblib.txt from 'COMDBLIB_PATH' to '.\tools\'
if exist %COMDBLIB_PATH%\comdblib.txt (
xcopy /f /y %COMDBLIB_PATH%\comdblib.txt .\tools\
)
if "%CUST%"=="qcom" (
rem clear AT ref for qcom
for /f "tokens=1* delims=" %%a in ('type ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk"') do (
if "%%a" equ "PS_AT_REF=y" (
echo PS_AT_REF=n
) else if "%%a" equ "BUILD_AT_REF ?=n" (
echo BUILD_AT_REF=n
) else (
echo %%a
)
)>>temp.txt
type temp.txt | findstr /v ECHO >>temp1.txt
del temp.txt
move temp1.txt ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk" >nul
)
rem --------- if more board/project add here-------------
rem --------- board/project parsing end------------------
echo PARAMETERS: %PARAMETERS% | findstr "help"
if not errorlevel 1 (
echo "=============================================================================================="
echo " "
echo " >> HOW TO BUILD A PROJECT << "
echo " "
echo "==============================================================================================¡±
echo " "
echo " @FORMAT : Gccbuild.bat [<board>[-<core>[-<project>[-<option>]]]] "
echo " @CAUTION: All parameters (<board>/<core>/<project>/<option>) are optional, "
echo " and the default settings of the project will take effect if it occurs! "
echo " For <board>, only 'ec618_0h00' is supportted, and it should be omitted ! "
echo " "
echo "**********************************************************************************************"
echo " <options>: "
echo " >> Basic "
echo " merge compile bl, cp and ap images and merge them into a package. [default] "
echo " doc run doxygen to generate the documents. "
echo " clean clean the output files for a specific board and project. "
echo " clall clean all output files for every board and project. "
echo " allprojects trigger to compile all example projects of the default board "
echo " list list all supported boards and supported projects for every board "
echo " help display this help message. "
echo " "
echo " >> Advanced "
echo " NULL(default) full feature support£¨no ims£©, AP lib: full, CP image£ºoc "
echo " open_cpu for open dev, more ram, AP lib: oc, CP image£ºoc "
echo " isms open_cpu + ims sms, AP lib: isms, CP image£ºoc "
echo " ims volte feature support, AP lib: ims, CP image£ºaudio "
echo " audio audio support(e.g. local MP3 play), AP lib: oc, CP image£ºaudio "
echo "**********************************************************************************************"
echo " Examples: "
echo "----------------------- For Internal Full Source Build----------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader, cp, ap images and merge them into a package. "
echo " > Gccbuild.bat ap-at_command "
echo " build ap at_command project only. "
echo " > Gccbuild.bat ap-bootloader "
echo " build bootloader project only. "
echo " > Gccbuild.bat cp "
echo " build cp project only. "
echo " > Gccbuild.bat ap-driver_example-clean "
echo " clean all output files for ap driver_example project. "
echo " "
echo "----------------------- For Customer's SDK Build----------------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader,ap images, use prebuilt cp image, and merge them into a package. "
echo " > Gccbuild.bat project_name e.g. project_name = at_command/driver_example "
echo " build xxx(project_name) project "
echo " "
echo " @NOTE: SDK build always generates a package(project_name.bin + bootloader.bin + cp.bin). "
echo " "
echo "----------------------- For Universal Build---------------------------------------------------"
echo " > Gccbuild.bat clean "
echo " clean all output files for the default project. "
echo " > Gccbuild.bat clall "
echo " clean all output files for every board and project. "
echo " > Gccbuild.bat list "
echo " list all supported boards and supported projects for every board. "
echo " "
echo " > Gccbuild.bat open_cpu "
echo " build 'open cpu' mode images of the default project, and merge them into a package. "
echo " "
echo "**********************************************************************************************"
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "list"
if not errorlevel 1 (
echo ---------------Supported Board------------------------------------
for /d %%i in ("project\*") do (echo %%~nxi )
echo ------------------------------------------------------------------
for /d %%i in ("project\*") do (
set CURRENT_BOARD=%%~nxi
echo *********supported projects for board: !CURRENT_BOARD!*************
for /d %%i in ("project\!CURRENT_BOARD!\ap\apps\*") do (echo ----%%~nxi )
)
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "doc"
if not errorlevel 1 (
pushd doxygen
CALL genDoc.bat %CHIP_NAME%
popd
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clall"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean all done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clean"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gcc TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clobj"
if not errorlevel 1 (
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.o
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.a
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.elf
echo clean objs done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "allprojects"
if not errorlevel 1 (
if exist .\gccout\%OUTPUT_NAME% (
echo delete %OUTPUT_NAME% folder......
rd .\gccout\%OUTPUT_NAME% /s /q
)
rem step1 build cp if not SDK
if not exist .\tools\comdblib.txt (
echo start logprepass b11
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
)
rem step2 build bootloader no matter SDK or not
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=ap BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo *********supported projects for board: %BOARD_NAME%*************
for /d %%i in ("project\%BOARD_NAME%\ap\apps\*") do (
set CURRENT_PROJECT=%%~nxi
echo ----!CURRENT_PROJECT!
if "!CURRENT_PROJECT!"=="bootloader" (
echo ignore bootloader when loop all project
) else (
echo 111
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
if exist .\tools\comdblib.txt (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true SDK=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
) else (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if not exist .\tools\comdblib.txt (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
) else (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
)
goto complete
)
set starttime=%time%
echo Start time: %date% %starttime%
if "%BUILD_OPTION%"=="merge" (
if exist .\tools\comdblib.txt (
echo start logprepass
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% BUILD_UNILOG=false BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
if "%BUILD_HEADBIN%"=="true" (
echo general headers 1
.\tools\ecsecure.exe APIMAGE=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin ^
CPIMAGE=.\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin ^
BLIMAGE=.\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin ^
BLHASH=1 SYSHASH=1 ^
HEAD1=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin ^
HEAD2=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin ^
BLPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_bl.pem ^
SYSPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_sys.pem ^
ADRBASE=AP_FLASH_XIP_ADDR ^
APADR=AP_FLASH_LOAD_ADDR ^
CFGDEF=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin -addrname XPKGDBLSH_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin -addrname XPKGDSYSH_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_PrMgrCfg_json.bin -addrname XPKGDPRM_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_format_json.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_uart_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_usb_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT%_SEC ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
) else (
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
)
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
) else (
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% SDK_REL=%SDKREL% BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo start logprepass b22
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
if "%BUILD_HEADBIN%"=="true" (
echo general headers 2
.\tools\ecsecure.exe APIMAGE=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin ^
CPIMAGE=.\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin ^
BLIMAGE=.\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin ^
BLHASH=1 SYSHASH=1^
HEAD1=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin ^
HEAD2=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin ^
BLPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_bl.pem ^
SYSPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_sys.pem ^
ADRBASE=AP_FLASH_XIP_ADDR ^
APADR=AP_FLASH_LOAD_ADDR ^
CFGDEF=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin -addrname XPKGDBLSH_VIRTIMG_MERGE_LNA -flashsize BLS_FLASH_LOAD_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin -addrname XPKGDSYSH_VIRTIMG_MERGE_LNA -flashsize SYS_FLASH_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_PrMgrCfg_json.bin -addrname XPKGDPRM_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_format_json.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_uart_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_usb_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT%_SEC ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
) else (
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
)
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.elf
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
)
)
if %PROJECT_NAME%==bootloader goto :buildimage
if %PROJECT_NAME%==driver_example goto :buildimage
set UNILOG=true
echo start logprepass b2
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% TOOLCHAIN_NAME=%TOOLCHAIN_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\debug_log_%CORE_NAME%.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo -----build image----
:buildimage
REM goto end
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=%UNILOG% BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem copy log database to output dir after compile successfully
REM cp .\tools\comdb_%CORE_NAME%.txt .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\comdb.txt
:complete
set endtime=%time%
echo .
echo End time: %date% %endtime%
set /a h1=%starttime:~0,2%
set /a m1=1%starttime:~3,2%-100
set /a s1=1%starttime:~6,2%-100
set /a h2=%endtime:~0,2%
set /a m2=1%endtime:~3,2%-100
set /a s2=1%endtime:~6,2%-100
if %h2% LSS %h1% set /a h2=%h2%+24
set /a ts1=%h1%*3600+%m1%*60+%s1%
set /a ts2=%h2%*3600+%m2%*60+%s2%
set /a ts=%ts2%-%ts1%
set /a h=%ts%/3600
set /a m=(%ts%-%h%*3600)/60
set /a s=%ts%%%60
echo Built took %h% hours %m% minutes %s% seconds
echo #######################################################################
echo ## ##
echo ## ######## ### ###### ###### ##
echo ## ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ## ##
echo ## ######## ## ## ###### ###### ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ###### ###### ##
echo ## ##
echo #######################################################################
echo build successfully
if %UNILOG%==true (
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
:end
goto:eof
:failHandle
echo fail
echo #######################################################################
echo ## ##
echo ## ######## ### #### ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ##
echo ## ###### ## ## ## ## ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## #### ######## ##
echo ## ##
echo #######################################################################
goto:eof

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,923 @@
@echo off && setlocal enabledelayedexpansion
@echo %PATH% | findstr /c:"%~dp0tools/msys64/usr/bin">nul
@if %errorlevel% equ 1 set PATH=%~dp0tools/msys64/usr/bin;%PATH%
rem @set PATH=%~dp0tools/msys64/usr/bin;%PATH%
cls
set PROJECT_NAME=at_command
set BOARD_NAME=ec7xx_0h00
set CHIP_NAME=ec7xx
set CHIP_TYPE=ec718um
set CORE_NAME=ap
set EUTRAN_MODE=cat_mode
set BUILD_OPTION=merge
set UNILOG=false
set TOOLCHAIN_NAME=GCC
set CUST=common
set SDKREL=false
set OPENCPU=false
set RAM_ENBALE=false
set ROM_ENBALE=false
set LESS_LOG=false
set LTO_ENABLE=false
set PWR_TEST=false
set BUILD_HEADBIN=false
set GCCLIB_PATH="C:\gcc"
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\full"
set CPBIN_SUBPATH=oc
set PKG_MAPDEF=pkg_718um_mapdef
set PKG_PRODUCT="EC718UM_PRD"
set OUTPUT_NAME=%BOARD_NAME%_%CHIP_TYPE%
set JOBNUMBER=j4
echo build.bat version 20180330
echo GCCLIB_PATH: %GCCLIB_PATH%
if not %GCCLIB_PATH% == "" (
if not exist %GCCLIB_PATH% (
echo ERROR: Please check GCCLIB_PATH setting, exit!!!
goto end
)
) else (
echo ERROR: Please set GCCLIB_PATH firstly, exit!!!
goto end
)
rem --------- board/project parsing begain------------------
set PARAMETERS=%1
if xx%PARAMETERS%==xx (
echo no input paramter, use default build setting
) else (
echo build option is: %PARAMETERS%
)
set parameterStr=%PARAMETERS%
:parameterSplit
for /f "tokens=1,* delims=-" %%a in ("%parameterStr%") do (
set parameterStr=%%b
echo %%a | findstr /r "j[0-9]*[0-9]\>" > nul
if !errorlevel!==0 (
set JOBNUMBER=%%a
)
if "%%a"=="qcom" (
set CUST=qcom
)
if "%%a"=="ec718_0h00" (
set BOARD_NAME=ec718_0h00
set CHIP_NAME=ec7xx
set OUTPUT_NAME=ec718_0h00_%CHIP_TYPE%
)
if "%%a"=="bootloader" (
set PROJECT_NAME=bootloader
set BUILD_OPTION=no_merge
)
if "%%a"=="ap" (
set CORE_NAME=ap
set BUILD_OPTION=no_merge
)
if "%%a"=="cp" (
set CORE_NAME=cp
set PROJECT_NAME=cp_project
set BUILD_OPTION=no_merge
)
if "%%a"=="pwrTest" (
set PWR_TEST=true
)
if "%%a"=="nb_mode" (
set EUTRAN_MODE=nb_mode
)
if "%%a"=="at_command" (
set PROJECT_NAME=at_command
)
if "%%a"=="socket_example" (
set PROJECT_NAME=socket_example
)
if "%%a"=="mqtt_example" (
set PROJECT_NAME=mqtt_example
)
if "%%a"=="https_example" (
set PROJECT_NAME=https_example
)
if "%%a"=="ssl_example" (
set PROJECT_NAME=ssl_example
)
if "%%a"=="libapi_example" (
set PROJECT_NAME=libapi_example
)
if "%%a"=="pos_example" (
set PROJECT_NAME=pos_example
)
if "%%a"=="tts_example" (
set PROJECT_NAME=tts_example
)
if "%%a"=="audio_example" (
set PROJECT_NAME=audio_example
)
if "%%a"=="lpuart_test" (
set PROJECT_NAME=lpuart_test
)
if "%%a"=="driver_example" (
set PROJECT_NAME=driver_example
set BUILD_OPTION=no_merge
)
if "%%a"=="dhrystone" (
set PROJECT_NAME=dhrystone
)
if "%%a"=="coremark" (
set PROJECT_NAME=coremark
)
if "%%a"=="slpman_example" (
set PROJECT_NAME=slpman_example
)
if "%%a"=="sleep_example" (
set PROJECT_NAME=sleep_example
)
if "%%a"=="slpPressure_test" (
set PROJECT_NAME=slpPressure_test
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="ChipIpTest" (
set PROJECT_NAME=ChipIpTest
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="ModemSlpPressure" (
set CORE_NAME=cp
set PROJECT_NAME=ModemSlpPressure
set BUILD_OPTION=no_merge
set LTO_ENABLE=false
)
if "%%a"=="mcu_example" (
set PROJECT_NAME=mcu_example
)
if "%%a"=="soc_simple" (
set PROJECT_NAME=soc_simple
)
if "%%a"=="soc_bist" (
set PROJECT_NAME=soc_bist
)
if "%%a"=="simo_test" (
set PROJECT_NAME=simo_test
)
if "%%a"=="clk_verify" (
set PROJECT_NAME=clk_verify
)
if "%%a"=="qspi_test" (
set PROJECT_NAME=qspi_test
)
if "%%a"=="fpga_sct_utfw" (
set PROJECT_NAME=fpga_sct_utfw
)
if "%%a"=="spi_2boards" (
set PROJECT_NAME=spi_2boards
)
if "%%a"=="merge" (
set BUILD_OPTION=merge
)
if "%%a"=="sdkrel" (
set SDKREL=true
)
if "%%a"=="lto" (
set LTO_ENABLE=true
)
if "%%a"=="open_cpu" (
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\oc"
)
if "%%a"=="audio" (
set AUDIO_ENABLE=true
set OPENCPU=true
set CPBIN_SUBPATH=audio
)
if "%%a"=="ims" (
set IMS_ENABLE=true
set AUDIO_ENABLE=true
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\ims"
set CPBIN_SUBPATH=audio
)
if "%%a"=="imsfix" (
set IMS_ENABLE=true
set AUDIO_ENABLE=true
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\ims"
set CPBIN_SUBPATH=audio
set AUDIO_FIX_ENABLE=true
)
if "%%a"=="isms" (
set IMS_SMSONLY_ENABLE=true
set OPENCPU=true
set COMDBLIB_PATH=".\prebuild\PLAT\lib\gcc\%CHIP_TYPE%\isms"
)
if "%%a"=="verbose" (
set VERBOSE=1
) else (
set VERBOSE=0
)
if "%%a"=="secboot" (
set BUILD_HEADBIN=true
for /f "tokens=1* delims=" %%a in ('type ".\project\%BOARD_NAME%\ap\apps\bootloader\GCC\Makefile"') do (
if "%%a" equ "CONFIG_PROJ_APP_SECURITY_BOOT = n" (
echo CONFIG_PROJ_APP_SECURITY_BOOT=y
) else (
echo %%a
)
)>>temp.txt
type temp.txt | findstr /v ECHO >>temp1.txt
del temp.txt
move temp1.txt ".\project\%BOARD_NAME%\ap\apps\bootloader\GCC\Makefile" >nul
)
)
if not "%parameterStr%"=="" goto parameterSplit
echo curr Board is: %BOARD_NAME%
echo curr Chip is: %CHIP_NAME%
echo curr Type is: %CHIP_TYPE%
echo curr Project is: %PROJECT_NAME%
echo curr core is: %CORE_NAME%
echo curr option is: %BUILD_OPTION%
echo cp bin subpath: %CPBIN_SUBPATH%
rem duplicate comdblib.txt from 'COMDBLIB_PATH' to '.\tools\'
if exist %COMDBLIB_PATH%\comdblib.txt (
xcopy /f /y %COMDBLIB_PATH%\comdblib.txt .\tools\
)
if "%CUST%"=="qcom" (
rem clear AT ref for qcom
for /f "tokens=1* delims=" %%a in ('type ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk"') do (
if "%%a" equ "PS_AT_REF=y" (
echo PS_AT_REF=n
) else if "%%a" equ "BUILD_AT_REF ?=n" (
echo BUILD_AT_REF=n
) else (
echo %%a
)
)>>temp.txt
type temp.txt | findstr /v ECHO >>temp1.txt
del temp.txt
move temp1.txt ".\device\target\board\%BOARD_NAME%\ap\%BOARD_NAME%_ap.mk" >nul
)
rem --------- if more board/project add here-------------
rem --------- board/project parsing end------------------
echo PARAMETERS: %PARAMETERS% | findstr "help"
if not errorlevel 1 (
echo "=============================================================================================="
echo " "
echo " >> HOW TO BUILD A PROJECT << "
echo " "
echo "==============================================================================================¡±
echo " "
echo " @FORMAT : Gccbuild.bat [<board>[-<core>[-<project>[-<option>]]]] "
echo " @CAUTION: All parameters (<board>/<core>/<project>/<option>) are optional, "
echo " and the default settings of the project will take effect if it occurs! "
echo " For <board>, only 'ec618_0h00' is supportted, and it should be omitted ! "
echo " "
echo "**********************************************************************************************"
echo " <options>: "
echo " >> Basic "
echo " merge compile bl, cp and ap images and merge them into a package. [default] "
echo " doc run doxygen to generate the documents. "
echo " clean clean the output files for a specific board and project. "
echo " clall clean all output files for every board and project. "
echo " allprojects trigger to compile all example projects of the default board "
echo " list list all supported boards and supported projects for every board "
echo " help display this help message. "
echo " "
echo " >> Advanced "
echo " NULL(default) full feature support£¨no ims£©, AP lib: full, CP image£ºoc "
echo " open_cpu for open dev, more ram, AP lib: oc, CP image£ºoc "
echo " isms open_cpu + ims sms, AP lib: isms, CP image£ºoc "
echo " ims volte feature support, AP lib: ims, CP image£ºaudio "
echo " audio audio support(e.g. local MP3 play), AP lib: oc, CP image£ºaudio "
echo "**********************************************************************************************"
echo " Examples: "
echo "----------------------- For Internal Full Source Build----------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader, cp, ap images and merge them into a package. "
echo " > Gccbuild.bat ap-at_command "
echo " build ap at_command project only. "
echo " > Gccbuild.bat ap-bootloader "
echo " build bootloader project only. "
echo " > Gccbuild.bat cp "
echo " build cp project only. "
echo " > Gccbuild.bat ap-driver_example-clean "
echo " clean all output files for ap driver_example project. "
echo " "
echo "----------------------- For Customer's SDK Build----------------------------------------------"
echo " > Gccbuild.bat "
echo " build bootloader,ap images, use prebuilt cp image, and merge them into a package. "
echo " > Gccbuild.bat project_name e.g. project_name = at_command/driver_example "
echo " build xxx(project_name) project "
echo " "
echo " @NOTE: SDK build always generates a package(project_name.bin + bootloader.bin + cp.bin). "
echo " "
echo "----------------------- For Universal Build---------------------------------------------------"
echo " > Gccbuild.bat clean "
echo " clean all output files for the default project. "
echo " > Gccbuild.bat clall "
echo " clean all output files for every board and project. "
echo " > Gccbuild.bat list "
echo " list all supported boards and supported projects for every board. "
echo " "
echo " > Gccbuild.bat open_cpu "
echo " build 'open cpu' mode images of the default project, and merge them into a package. "
echo " "
echo "**********************************************************************************************"
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "list"
if not errorlevel 1 (
echo ---------------Supported Board------------------------------------
for /d %%i in ("project\*") do (echo %%~nxi )
echo ------------------------------------------------------------------
for /d %%i in ("project\*") do (
set CURRENT_BOARD=%%~nxi
echo *********supported projects for board: !CURRENT_BOARD!*************
for /d %%i in ("project\!CURRENT_BOARD!\ap\apps\*") do (echo ----%%~nxi )
)
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "doc"
if not errorlevel 1 (
pushd doxygen
CALL genDoc.bat %CHIP_NAME%
popd
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clall"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean all done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clean"
if not errorlevel 1 (
make.exe -%JOBNUMBER% clean-gcc TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME%
echo clean done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "clobj"
if not errorlevel 1 (
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.o
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.a
@del /s /q .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\*.elf
echo clean objs done ok...
goto end
)
echo PARAMETERS: %PARAMETERS% | findstr "allprojects"
if not errorlevel 1 (
if exist .\gccout\%OUTPUT_NAME% (
echo delete %OUTPUT_NAME% folder......
rd .\gccout\%OUTPUT_NAME% /s /q
)
rem step1 build cp if not SDK
if not exist .\tools\comdblib.txt (
echo start logprepass b11
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
)
rem step2 build bootloader no matter SDK or not
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=ap BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo *********supported projects for board: %BOARD_NAME%*************
for /d %%i in ("project\%BOARD_NAME%\ap\apps\*") do (
set CURRENT_PROJECT=%%~nxi
echo ----!CURRENT_PROJECT!
if "!CURRENT_PROJECT!"=="bootloader" (
echo ignore bootloader when loop all project
) else (
echo 111
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
if exist .\tools\comdblib.txt (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true SDK=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
) else (
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%%~nxi\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%%~nxi CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if not exist .\tools\comdblib.txt (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
) else (
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.binpkg
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%%~nxi\ap_%%~nxi.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%%~nxi\%%~nxi.elf
if not errorlevel 0 (
goto failHandle
)
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
)
goto complete
)
set starttime=%time%
echo Start time: %date% %starttime%
if "%BUILD_OPTION%"=="merge" (
if exist .\tools\comdblib.txt (
echo start logprepass
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% BUILD_UNILOG=false BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap BUILD_UNILOG=true BUILD_CUST=%CUST% SDK=true 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
if "%BUILD_HEADBIN%"=="true" (
echo general headers 1
.\tools\ecsecure.exe APIMAGE=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin ^
CPIMAGE=.\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin ^
BLIMAGE=.\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin ^
BLHASH=1 SYSHASH=1 ^
HEAD1=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin ^
HEAD2=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin ^
BLPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_bl.pem ^
SYSPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_sys.pem ^
ADRBASE=AP_FLASH_XIP_ADDR ^
APADR=AP_FLASH_LOAD_ADDR ^
CFGDEF=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin -addrname XPKGDBLSH_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin -addrname XPKGDSYSH_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_PrMgrCfg_json.bin -addrname XPKGDPRM_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_format_json.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_uart_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_usb_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT%_SEC ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
) else (
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\prebuild\FW\lib\gcc\%CHIP_TYPE%\%CPBIN_SUBPATH%\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
)
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
) else (
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=bootloader CORE=%CORE_NAME% SDK_REL=%SDKREL% BUILD_UNILOG=false BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo start logprepass b22
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\cp\cp_project\debug_log_cp.h .\middleware\developed\debug\inc\ || (goto:failHandle)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=cp_project CORE=cp SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\cp\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\debug_log_ap.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=ap SDK_REL=%SDKREL% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\ap\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
.\tools\fcelf.exe -T -bin .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -size AP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -size CP_PKGIMG_LIMIT_SIZE ^
-bin .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -size BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-h .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
if not errorlevel 0 (
goto failHandle
)
if "%BUILD_HEADBIN%"=="true" (
echo general headers 2
.\tools\ecsecure.exe APIMAGE=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin ^
CPIMAGE=.\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin ^
BLIMAGE=.\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin ^
BLHASH=1 SYSHASH=1^
HEAD1=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin ^
HEAD2=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin ^
BLPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_bl.pem ^
SYSPEM=.\project\%BOARD_NAME%\ap\apps\bootloader\code\main\pub_key_sys.pem ^
ADRBASE=AP_FLASH_XIP_ADDR ^
APADR=AP_FLASH_LOAD_ADDR ^
CFGDEF=.\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\bl_sec_header.bin -addrname XPKGDBLSH_VIRTIMG_MERGE_LNA -flashsize BLS_FLASH_LOAD_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\sys_sec_header.bin -addrname XPKGDSYSH_VIRTIMG_MERGE_LNA -flashsize SYS_FLASH_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_PrMgrCfg_json.bin -addrname XPKGDPRM_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\xpk_format_json.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_uart_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-input .\tools\pkgdata\%CHIP_TYPE%\config_xpk_usb_baseini.bin -addrname XPKGDCMN_VIRTIMG_MERGE_LNA -flashsize XPKG_VIRTIMG_LOAD_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT%_SEC ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
) else (
.\tools\fcelf.exe -M -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.bin -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.bin -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.bin -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.binpkg
)
if not errorlevel 0 (
goto failHandle
)
.\tools\fcelf.exe -m -input .\gccout\%OUTPUT_NAME%\ap\bootloader\ap_bootloader.elf -addrname BL_PKGIMG_LNA -flashsize BOOTLOADER_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\ap_%PROJECT_NAME%.elf -addrname AP_PKGIMG_LNA -flashsize AP_PKGIMG_LIMIT_SIZE ^
-input .\gccout\%OUTPUT_NAME%\cp\cp_project\cp-demo-flash.elf -addrname CP_PKGIMG_LNA -flashsize CP_PKGIMG_LIMIT_SIZE ^
-pkgmode 1 ^
-banoldtool 1 ^
-productname %PKG_PRODUCT% ^
-def .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\mem_map.txt ^
-outfile .\gccout\%OUTPUT_NAME%\ap\%PROJECT_NAME%\%PROJECT_NAME%.elf
if not errorlevel 0 (
goto failHandle
)
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
goto complete
)
)
if %PROJECT_NAME%==bootloader goto :buildimage
if %PROJECT_NAME%==driver_example goto :buildimage
set UNILOG=true
echo start logprepass b2
if exist .\tools\UpdateDBPattern.txt (
del /q .\tools\UpdateDBPattern.txt
)
echo > .failed.tmp
(make.exe -%JOBNUMBER% build-unilog TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% TOOLCHAIN_NAME=%TOOLCHAIN_NAME% BUILD_UNILOG=true BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem this header file will compile with device code
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\debug_log_%CORE_NAME%.h .\middleware\developed\debug\inc\ || (goto:failHandle)
if exist .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h (
copy .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\dbversion.h .\middleware\developed\debug\inc\ || (goto:failHandle)
)
echo -----build image----
:buildimage
REM goto end
echo > .failed.tmp
(make.exe -%JOBNUMBER% gccall TYPE=%CHIP_TYPE% TARGET=%BOARD_NAME% V=%VERBOSE% EUTRAN_MODE=%EUTRAN_MODE% PROJECT=%PROJECT_NAME% CORE=%CORE_NAME% BUILD_UNILOG=%UNILOG% BUILD_CUST=%CUST% 2>&1 && del .failed.tmp) | tee.exe .\gccout\%OUTPUT_NAME%\%CORE_NAME%\outbuildlog.txt
if exist .failed.tmp (
del .failed.tmp
goto failHandle
)
rem copy log database to output dir after compile successfully
REM cp .\tools\comdb_%CORE_NAME%.txt .\gccout\%OUTPUT_NAME%\%CORE_NAME%\%PROJECT_NAME%\comdb.txt
:complete
set endtime=%time%
echo .
echo End time: %date% %endtime%
set /a h1=%starttime:~0,2%
set /a m1=1%starttime:~3,2%-100
set /a s1=1%starttime:~6,2%-100
set /a h2=%endtime:~0,2%
set /a m2=1%endtime:~3,2%-100
set /a s2=1%endtime:~6,2%-100
if %h2% LSS %h1% set /a h2=%h2%+24
set /a ts1=%h1%*3600+%m1%*60+%s1%
set /a ts2=%h2%*3600+%m2%*60+%s2%
set /a ts=%ts2%-%ts1%
set /a h=%ts%/3600
set /a m=(%ts%-%h%*3600)/60
set /a s=%ts%%%60
echo Built took %h% hours %m% minutes %s% seconds
echo #######################################################################
echo ## ##
echo ## ######## ### ###### ###### ##
echo ## ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ## ##
echo ## ######## ## ## ###### ###### ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ## ## ##
echo ## ## ## ## ###### ###### ##
echo ## ##
echo #######################################################################
echo build successfully
if %UNILOG%==true (
if exist .\tools\UpdateDBPattern.txt (
type .\tools\UpdateDBPattern.txt
)
)
:end
goto:eof
:failHandle
echo fail
echo #######################################################################
echo ## ##
echo ## ######## ### #### ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## ## ## ##
echo ## ###### ## ## ## ## ##
echo ## ## ######### ## ## ##
echo ## ## ## ## ## ## ##
echo ## ## ## ## #### ######## ##
echo ## ##
echo #######################################################################
goto:eof

View File

@ -0,0 +1,31 @@
.PHONY:gccall
gccall:
(cd project/$(TARGET)/$(CORE)/apps/$(PROJECT)/GCC && $(MAKE) V=$(V) -f Makefile all)
.PHONY:clean-gccall
clean-gccall:
(cd project/$(TARGET)/$(CORE)/apps/$(PROJECT)/GCC && $(MAKE) -f Makefile cleanall)
.PHONY:clean-gcc
clean-gcc:
(cd project/$(TARGET)/$(CORE)/apps/$(PROJECT)/GCC && $(MAKE) -f Makefile clean)
.PHONY:keilall
keilall:
(cd project/$(TARGET)/$(CORE)/apps/$(PROJECT)/ARMCC && $(MAKE) V=$(V) -f Makefile all)
.PHONY:clean-keilall
clean-keilall:
(cd project/$(TARGET)/$(CORE)/apps/$(PROJECT)/ARMCC && $(MAKE) -f Makefile cleanall)
.PHONY:clean-keil
clean-keil:
(cd project/$(TARGET)/$(CORE)/apps/$(PROJECT)/ARMCC && $(MAKE) -f Makefile clean)
.PHONY:size
size:
(cd project/$(TARGET)/$(CORE)/apps/$(PROJECT)/$(TOOLCHAIN_NAME) && $(MAKE) -f Makefile size)
.PHONY: build-unilog
build-unilog:
(cd project/$(TARGET)/$(CORE)/apps/$(PROJECT)/$(TOOLCHAIN_NAME) && $(MAKE) -f Makefile unilog)

View File

@ -0,0 +1,3 @@
.PHONY:build
build:
(cd apps/$(PROJECT) && $(MAKE) V=$(V) -f Makefile all)

View File

@ -0,0 +1,24 @@
TOP := ../..
TOOLCHAIN = GCC
BINNAME = $(PROJECT)
CFLAGS_INC += -I ../../inc \
-I ./inc
CFLAGS_DEFS += -DUSE_PSRAM=0
ifeq ($(CHIP_TYPE), ec718pm)
CFLAGS_DEFS += -DEC718PM=1
CFLAGS_DEFS += -DTYPE_EC718M
endif
APP_LIB1_SUPPORT = y
obj-y += src/main.o
obj-y += src/syscalls.o
LD_FILE := $(TOP)/apps/$(PROJECT)/$(PROJECT).ld
include $(TOP)/script/Makefile.rules

View File

@ -0,0 +1,51 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0x00B81050, LENGTH = 0x07FB0 /* (ORIGIN = PKGFLXAPP_APP0_LNA + APP_HEAD_LENGTH) (LENGTH <= PKGFLXAPP_APP0_SIZE - APP_HEAD_LENGTH) */
#if (EC718PM == 1)
RAM (rwx) : ORIGIN = 0x0A0CC000, LENGTH = 0x08000 /* (ORIGIN = up_buf_start - APPSDK_DATA_SIZE) (LENGTH <= APPSDK_DATA_SIZE) */
#else
#if (USE_PSRAM == 1)
RAM (rwx) : ORIGIN = 0x08100000, LENGTH = 0x08000 /* (ORIGIN = PSRAM_START_ADDR + 0x00100000) (LENGTH <= PSRAM_TOTAL_LENGTH - 0x00100000) */
#else
RAM (rwx) : ORIGIN = 0x004AB000, LENGTH = 0x08000 /* (ORIGIN = up_buf_start - APPSDK_DATA_SIZE) (LENGTH <= APPSDK_DATA_SIZE) */
#endif
#endif
}
SECTIONS
{
.text :
{
*(.text.startup.main)
*(.text*)
*(.rodata*)
} > FLASH
.data : ALIGN(4)
{
. = ALIGN(4);
Load$$LOAD_DRAM_SHARED$$Base = LOADADDR(.data);
Image$$LOAD_DRAM_SHARED$$Base = .;
*(.data*)
. = ALIGN(4);
} >RAM AT>FLASH
Image$$LOAD_DRAM_SHARED$$Length = SIZEOF(.data);
.load_dram_shared_zi (NOLOAD):
{
. = ALIGN(4);
Image$$LOAD_DRAM_SHARED$$ZI$$Base = .;
__bss_start__ = .;
*(.bss*)
*(.sect_*_bss* .bss*)
*(COMMON)
*(.sect_decompress_bss.*)
. = ALIGN(4);
*(.stack*) /* stack should be 4 byte align */
__bss_end__ = .;
Image$$LOAD_DRAM_SHARED$$ZI$$Limit = .;
*(.USB_NOINIT_DATA_BUF)
} >RAM
}

View File

@ -0,0 +1,386 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include "lfs.h"
#include "slpman.h"
#include "charge.h"
#include "status.h"
#include "audio.h"
#include "app.h"
#include "storage.h"
#include "cmsis_os2.h"
#include "opensdk_api.h"
#define TEST_API 0
#define THREAD_STACK_SIZE_API_TEST (10 * 1024)
#ifdef EXTERNAL_TTS_LFS_ENABLE
#define DEFAULT_INFO "D:/default.info"
#else
#define DEFAULT_INFO "C:/default.info"
#endif
extern uint32_t Image$$LOAD_DRAM_SHARED$$ZI$$Base;
extern uint32_t Image$$LOAD_DRAM_SHARED$$ZI$$Limit;
extern uint32_t Load$$LOAD_DRAM_SHARED$$Base;
extern uint32_t Image$$LOAD_DRAM_SHARED$$Base;
extern uint32_t Image$$LOAD_DRAM_SHARED$$Length;
extern AppT gSpeakerApp;
uint32_t gSyscallTable = 0;
uint8_t gVote = 0xFF;
char* buf[64];
char* ftoa(double f)
{
int precision = 6;
long long intPart = (long long)f; // 整数部分
double decimalPart = f - (double)intPart; // 小数部分
char* p = buf;
// 转换整数部分
if (intPart < 0) {
*p++ = '-';
intPart = -intPart; // 取正数部分
decimalPart =-decimalPart;
}
// 转换整数部分为字符串
int i = 0;
char temp[20];
while (intPart > 0) {
temp[i++] = '0' + (intPart % 10);
intPart /= 10;
}
// 反转整数部分的字符串
while (i > 0) {
*p++ = temp[--i];
}
// 如果需要小数部分
if (precision > 0) {
*p++ = '.';
// 处理小数部分
for (int i = 0; i < precision; i++) {
decimalPart *= 10.0;
int digit = (int)decimalPart;
*p++ = '0' + digit;
decimalPart -= digit;
}
}
// 字符串结束符
*p = '\0';
return buf;
}
void float_print_test()
{
double hi = 3.14;
double hi0 = -3.14;
printf("hi:%s\r\n",ftoa(hi));
printf("hi0:%s\r\n",ftoa(hi0));
printf("hi+hi0:%s\r\n",ftoa(hi+hi0));
printf("hi-hi0:%s\r\n",ftoa(hi-hi0));
printf("hi/hi0:%s\r\n",ftoa(hi/hi0));
printf("hi*hi0:%s\r\n",ftoa(hi*hi0));
}
int32_t speakerAppInit(AppInfoT *appInfo, uint32_t reserved1, uint32_t reserved2, uint32_t syscallTable)
{
printf("speakerAppInit\r\n");
appInfo->initStatus = 1;
return 0;
}
int32_t speakerAppPreDraw()
{
return 0;
}
int32_t speakerAppMsgProc(AppInfoT *appInfo, AppMsgT *msg, uint32_t reserved2, uint32_t syscallTable)
{
#ifdef FEATURE_SUBSYS_AUDIO_ENABLE
static uint8_t batteryLevel = 0;
static uint8_t batteryCharge = 0;
static bool batteryLow = false;
static uint8_t simStatus = SIM_UNKNOWN;
static bool nwReady = false;
static bool serverReady = false;
StatusT status = {0};
switch(msg->msgType)
{
case APP_KEY_MSG:
switch(msg->param1)
{
case ACTION_VOLUME_MINUS_SHORT:
audioAdjustVolume(ACTION_VOLUME_MINUS_SHORT);
break;
case ACTION_VOLUME_PLUS_SHORT:
audioAdjustVolume(ACTION_VOLUME_PLUS_SHORT);
break;
case ACTION_VOLUME_MINUS_LONG:
audioAdjustVolume(ACTION_VOLUME_MINUS_LONG);
break;
case ACTION_VOLUME_PLUS_LONG:
audioAdjustVolume(ACTION_VOLUME_PLUS_LONG);
break;
case ACTION_MENU_SHORT:
if (batteryLevel == 100) {audioPlayMp3(BATTRY_SOUND_100, NULL, true, true);}
else if (batteryLevel == 75) {audioPlayMp3(BATTRY_SOUND_75, NULL, true, true);}
else if (batteryLevel == 50) {audioPlayMp3(BATTRY_SOUND_50, NULL, true, true);}
else if (batteryLevel == 25) {audioPlayMp3(BATTRY_SOUND_25, NULL, true, true);}
else if (batteryLevel == 0) {audioPlayMp3(BATTRY_SOUND_LOW, NULL, true, true);}
if (nwReady == true)
{
audioPlayMp3(NW_SOUND_READY, NULL, true, true);
if (serverReady == true)
{
audioPlayMp3(SERVER_SOUND_READY, NULL, true, true);
}
else
{
audioPlayMp3(SERVER_SOUND_UNREADY, NULL, true, true);
}
}
else if (simStatus == SIM_REMOVED)
{
audioPlayMp3(SIM_SOUND_UNREADY, NULL, true, true);
}
else
{
audioPlayMp3(NW_SOUND_UNREADY, NULL, true, true);
}
break;
case ACTION_MENU_LONG:
#ifdef FEATURE_SUBSYS_PCM_RECORD_ENABLE
audioRecordAdpcm(RECORD_SOUND);
#endif
break;
}
break;
case APP_STAT_MSG:
if (msg != NULL)
{
((uint32_t *)(&status))[0] = msg->param1;
((uint32_t *)(&status))[1] = msg->param2;
}
batteryLevel = status.batteryLevel;
simStatus = status.simStatus;
nwReady = status.nwReady;
serverReady = status.serverReady;
if ((batteryCharge == CHARGE_STATUS_DISCONNECT) && (status.batteryCharge == CHARGE_STATUS_CHARGING))
{
batteryCharge = status.batteryCharge;
audioPlayMp3(CHARGE_SOUND_BEGIN, NULL, true, true);
}
else if ((batteryCharge != CHARGE_STATUS_DISCONNECT) && (status.batteryCharge == CHARGE_STATUS_DISCONNECT))
{
batteryLow = false;
batteryCharge = status.batteryCharge;
audioPlayMp3(CHARGE_SOUND_END, NULL, true, true);
}
else if ((batteryCharge == CHARGE_STATUS_CHARGING) && (status.batteryCharge == CHARGE_STATUS_FINISH))
{
batteryCharge = status.batteryCharge;
audioPlayMp3(BATTRY_SOUND_100, NULL, true, true);
}
if ((status.batteryLevel == 0) && (status.batteryCharge == CHARGE_STATUS_DISCONNECT) && (batteryLow == false))
{
batteryLow = true;
audioPlayMp3(BATTRY_SOUND_LOW, NULL, true, true);
audioPlayMp3(POWER_SOUND_OFF, pwrKeyStartPowerOff, true, true);
}
break;
default:
break;
}
#endif
return 0;
}
int32_t speakerAppAfterDraw()
{
return 0;
}
int32_t speakerAppDestory()
{
return 0;
}
void storageTest(void)
{
FILE *file = NULL;
struct stat buf = {0};
char buffer[32] = {0};
printf("storageTest\r\n");
file = file_fopen(DEFAULT_INFO, "r");
if (file == NULL)
{
printf("Failed to open the file %s.\r\n", DEFAULT_INFO);
return;
}
file_fstat((int)file, &buf);
if (buf.st_size == 0)
{
printf("File is empty.\r\n");
goto labelEnd;
}
if (buf.st_size > (sizeof(buffer) - 1))
{
printf("Buffer is too small.\r\n");
goto labelEnd;
}
file_fread((void *)buffer, buf.st_size, 1, file);
buffer[buf.st_size] = 0;
printf("Below is the content of the file "DEFAULT_INFO".\r\n%s\r\n", buffer);
labelEnd:
file_fclose(file);
}
void semaphoreTest(void)
{
osSemaphoreId_t semaphoreId;
printf("semaphoreTest\r\n");
semaphoreId = osSemaphoreNew(1, 0, NULL);
printf("Release semaphore.\r\n");
osSemaphoreRelease(semaphoreId);
printf("Wait semaphore.\r\n");
osSemaphoreAcquire(semaphoreId, osWaitForever);
printf("Received semaphore.\r\n\r\n");
}
void messageQueueTest(void)
{
osMessageQueueId_t messageQueueId;
uint32_t testData = 0x12;
uint32_t testData2 = 0;
printf("messageQueueTest\r\n");
messageQueueId = osMessageQueueNew(1, 4, NULL);
printf("Put queue: 0x%X\r\n", testData);
osMessageQueuePut(messageQueueId, &testData, 0, 0);
printf("Wait queue.\r\n");
osMessageQueueGet(messageQueueId, &testData2, 0, osWaitForever);
printf("Received queue: 0x%X\r\n\r\n", testData2);
}
void ThreadApiTest(void *argument)
{
uint32_t count = 0;
osDelay(2000);
storageTest();
semaphoreTest();
messageQueueTest();
while (1)
{
printf("osDelay %ds\r\n", count++);
osDelay(1000 * count);
}
}
void apiTestInit(void)
{
osThreadAttr_t threadAttr;
threadAttr.name = "ThreadApiTest";
threadAttr.stack_mem = NULL;
threadAttr.stack_size = THREAD_STACK_SIZE_API_TEST;
threadAttr.priority = osPriorityNormal;
osThreadNew(ThreadApiTest, NULL, &threadAttr);
}
void setZiDataToZero(void)
{
uint32_t *start_addr = &(Image$$LOAD_DRAM_SHARED$$ZI$$Base);
uint32_t *end_addr = &(Image$$LOAD_DRAM_SHARED$$ZI$$Limit);
uint32_t length = (uint32_t)end_addr - (uint32_t)start_addr;
while (length > 0)
{
start_addr[length - 1] = 0;
length--;
}
}
void copyRwDataFromBin(void)
{
uint32_t *src = &(Load$$LOAD_DRAM_SHARED$$Base);
uint32_t *dst = &(Image$$LOAD_DRAM_SHARED$$Base);
uint32_t length = (uint32_t)(&(Image$$LOAD_DRAM_SHARED$$Length)) / sizeof(uint32_t);
if (dst != src)
{
while (length > 0)
{
dst[length - 1] = src[length - 1];
length--;
}
}
}
void main(uint32_t syscallTable, uint32_t appImageLocation, uint32_t reserved2, uint32_t reserved3)
{
copyRwDataFromBin();
setZiDataToZero();
gSyscallTable = syscallTable;
slpManApplyPlatVoteHandle("speaker_app", &gVote);
#if (USE_PSRAM == 1)
slpManPlatVoteDisableSleep(gVote, SLP_SLP1_STATE);
#endif
char version[5] = {0};
*((uint32_t *)version) = *apiVersion;
printf("OpenSDK API Version: %s\r\n", version);
mountApp(&gSpeakerApp, 5);
setActiveApp(5);
#if (TEST_API == 1)
apiTestInit();
#endif
}
AppInfoT gSpeakerAppInfo = {0};
uint32_t *gSpeakerAppWnd = NULL;
AppT gSpeakerApp =
{
&gSpeakerAppInfo,
&gSpeakerAppWnd,
speakerAppInit,
speakerAppPreDraw,
speakerAppMsgProc,
speakerAppAfterDraw,
speakerAppDestory
};

View File

@ -0,0 +1,126 @@
#include <sys/stat.h>
// #include "sctdef.h"
// #ifdef FEATURE_BOOTLOADER_PROJECT_ENABLE
// #include "bl_link_mem_map.h"
// #else
// #define HEAP_EXIST 1
// #endif
extern int io_putc(int ch) __attribute__((weak));
extern int io_getc(void) __attribute__((weak));
extern int _close(int file) __attribute__((used));
extern int _fstat(int file, struct stat *st) __attribute__((used));
extern int _isatty(int file) __attribute__((used));
extern int _lseek(int file, int ptr, int dir) __attribute__((used));
extern int _open(const char *name, int flags, int mode) __attribute__((used));
extern int _read(int file, char *ptr, int len) __attribute__((used));
extern int _write(int file, char *ptr, int len) __attribute__((used));
int _close(int file)
{
return 0;
}
int _fstat(int file, struct stat *st)
{
return 0;
}
int _isatty(int file)
{
return 1;
}
int _lseek(int file, int ptr, int dir)
{
return 0;
}
int _open(const char *name, int flags, int mode)
{
return -1;
}
int _read(int file, char *ptr, int len)
{
return 0;
int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++) {
*ptr++ = io_getc();
}
return len;
}
#define __MYPID 1
int _getpid()
{
return __MYPID;
}
int _kill(int pid, int sig)
{
return -1;
}
void _exit(int val)
{
while(1);
}
caddr_t _sbrk(int incr)
{
#if HEAP_EXIST
extern char _heap_memory_start, _heap_memory_end; /* Defined by the linker */
static char *heap_end;
char *prev_heap_end;
if (heap_end == NULL) {
heap_end = (char *)&_heap_memory_start;
}
prev_heap_end = heap_end;
if (heap_end + incr >= (char *)&_heap_memory_end) {
return (caddr_t) - 1;
}
heap_end += incr;
return (caddr_t) prev_heap_end;
#else
// extern int EC_Printf(const char * pFormat, ...);
// extern void delay_us(uint32_t us);
// do
// {
// EC_Printf("heap not exist err, malloc unsupported!");
// delay_us(1000000);
// }while(1);
return NULL;
#endif
}
int _write(int file, char *ptr, int len)
{
// extern int io_putchar(int ch);
// int DataIdx;
// for (DataIdx = 0; DataIdx < len; DataIdx++) {
// io_putchar(*ptr++);
// }
return len;
}

View File

@ -0,0 +1,22 @@
@echo off && setlocal enabledelayedexpansion
@echo %PATH%
set PATH=%~dp0/script/bin;%PATH%
rmdir /s /q gccout\speaker
cls
set PROJECT_NAME=speaker
set JOBNUMBER=j4
echo build.bat version 20240327
echo GCCLIB_PATH: %GCCLIB_PATH%
echo curr Project is: %PROJECT_NAME%
if exist .\gccout\%PROJECT_NAME% (
echo delete %PROJECT_NAME% folder......
rd .\gccout\%PROJECT_NAME% /s /q
)
make.exe -%JOBNUMBER% PROJECT=%PROJECT_NAME% build
python script/pack_app.py

View File

@ -0,0 +1,70 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of EigenComm Ltd.
* File name: app.h
* Description: EC718 at command demo entry header file
* History: Rev1.0 2018-07-12
*
****************************************************************************/
#ifndef SUBSYS_APP_H
#define SUBSYS_APP_H
#ifdef __cplusplus
extern "C" {
#endif
typedef enum
{
APP_TP_MSG = 10,
APP_KEY_MSG = 20,
APP_STAT_MSG = 30,
APP_USER_MSG = 40,
} AppMsgTypeT;
typedef struct __App_Point_t
{
int32_t appActived;
int32_t appStatus;
int32_t initStatus;
} AppPointT;
typedef struct __App_Msg_t
{
uint32_t* wndh;
AppMsgTypeT msgType;
int32_t param1;
int32_t param2;
uint32_t *param3;
int32_t time;
AppPointT pt;
} AppMsgT;
typedef struct __App_Info_t
{
int32_t id;
int32_t appActived;
int32_t appStatus;
int32_t initStatus;
} AppInfoT;
typedef struct __App_t
{
AppInfoT* info;
uint32_t* wndh;
int32_t (*init)(AppInfoT *appInfo, uint32_t reserved1, uint32_t reserved2, uint32_t syscallTable);
int32_t (*preDraw)();
int32_t (*msgProc)(AppInfoT *appInfo,AppMsgT *msg, uint32_t reserved2, uint32_t syscallTable);
int32_t (*afterDraw)();
int32_t (*destory)();
} AppT;
int32_t mountApp(AppT* appPtr,int32_t slot);
int32_t setActiveApp(int32_t slot);
#ifdef __cplusplus
}
#endif
#endif /* SUBSYS_APP_H */

View File

@ -0,0 +1,81 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of EigenComm Ltd.
* File name: audio.h
* Description: EC618 mqtt demo entry header file
* History: Rev1.0 2018-07-12
*
****************************************************************************/
#ifndef __AUDIO_H__
#define __AUDIO_H__
#include <stdint.h>
#include <stdbool.h>
#define FEATURE_SUBSYS_AUDIO_ENABLE
#define FEATURE_SUBSYS_MP3_ENABLE
#define FEATURE_SUBSYS_PCM_RECORD_ENABLE
#define EXTERNAL_TTS_LFS_ENABLE
#ifdef EXTERNAL_TTS_LFS_ENABLE
#define WELCOME_SOUND "D:/Welcome.mp3"
#define POWER_SOUND_OFF "D:/PowerOff.mp3"
#define SIM_SOUND_UNREADY "D:/SimUnready.mp3"
#define NW_SOUND_READY "D:/NwReady.mp3"
#define NW_SOUND_UNREADY "D:/NwUnready.mp3"
#define SERVER_SOUND_READY "D:/ServerReady.mp3"
#define SERVER_SOUND_UNREADY "D:/ServerUnready.mp3"
#define VOLUME_SOUND_MIN "D:/VolumeMin.mp3"
#define VOLUME_SOUND_MAX "D:/VolumeMax.mp3"
#define VOLUME_SOUND_MINUS "D:/VolumeMinus.mp3"
#define VOLUME_SOUND_PLUS "D:/VolumePlus.mp3"
#define BATTRY_SOUND_100 "D:/Battery100.mp3"
#define BATTRY_SOUND_75 "D:/Battery75.mp3"
#define BATTRY_SOUND_50 "D:/Battery50.mp3"
#define BATTRY_SOUND_25 "D:/Battery25.mp3"
#define BATTRY_SOUND_LOW "D:/BatteryLow.mp3"
#define CHARGE_SOUND_BEGIN "D:/ChargeBegin.mp3"
#define CHARGE_SOUND_END "D:/ChargeEnd.mp3"
#else
#define WELCOME_SOUND "C:/Welcome.mp3"
#define POWER_SOUND_OFF "C:/PowerOff.mp3"
#define SIM_SOUND_UNREADY "C:/SimUnready.mp3"
#define NW_SOUND_READY "C:/NwReady.mp3"
#define NW_SOUND_UNREADY "C:/NwUnready.mp3"
#define SERVER_SOUND_READY "C:/ServerReady.mp3"
#define SERVER_SOUND_UNREADY "C:/ServerUnready.mp3"
#define VOLUME_SOUND_MIN "C:/VolumeMin.mp3"
#define VOLUME_SOUND_MAX "C:/VolumeMax.mp3"
#define VOLUME_SOUND_MINUS "C:/VolumeMinus.mp3"
#define VOLUME_SOUND_PLUS "C:/VolumePlus.mp3"
#define BATTRY_SOUND_100 "C:/Battery100.mp3"
#define BATTRY_SOUND_75 "C:/Battery75.mp3"
#define BATTRY_SOUND_50 "C:/Battery50.mp3"
#define BATTRY_SOUND_25 "C:/Battery25.mp3"
#define BATTRY_SOUND_LOW "C:/BatteryLow.mp3"
#define CHARGE_SOUND_BEGIN "C:/ChargeBegin.mp3"
#define CHARGE_SOUND_END "C:/ChargeEnd.mp3"
#endif
#ifdef FEATURE_SUBSYS_PCM_RECORD_ENABLE
#define RECORD_SOUND "D:/Record.wav"
#endif
typedef void (*AudioCallbackT)(void);
typedef enum
{
ACTION_VOLUME_PLUS_SHORT = 0,
ACTION_VOLUME_PLUS_LONG = 1,
ACTION_VOLUME_MINUS_SHORT = 2,
ACTION_VOLUME_MINUS_LONG = 3,
ACTION_MENU_SHORT = 4,
ACTION_MENU_LONG = 5,
ACTION_INVALID
} ActionT;
#endif

View File

@ -0,0 +1,57 @@
/******************************************************************************
*(C) Copyright 2018 EIGENCOMM International Ltd.
* All Rights Reserved
******************************************************************************
* Filename: charge.h
*
* Description: header of charge.c. api for charge status detect
*
* History: 2021.05.07 initiated by Zhao Weiqi
*
* Notes:
*
******************************************************************************/
#ifndef CHARGE_H
#define CHARGE_H
/*----------------------------------------------------------------------------*
* INCLUDES *
*----------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif
/*----------------------------------------------------------------------------*
* MACROS *
*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*
* DATA TYPE DEFINITION *
*----------------------------------------------------------------------------*/
typedef enum
{
CHARGE_STATUS_DISCONNECT = 0,
CHARGE_STATUS_CHARGING = 1,
CHARGE_STATUS_FINISH = 2,
}chargeStatus_e;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,817 @@
/*
* Copyright (c) 2013-2017 ARM Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ----------------------------------------------------------------------
*
* $Date: 9. June 2017
* $Revision: V2.1.1
*
* Project: CMSIS-RTOS2 API
* Title: cmsis_os2.h header file
*
* Version 2.1.1
* Additional functions allowed to be called from Interrupt Service Routines:
* - osKernelGetTickCount, osKernelGetTickFreq
* Changed Kernel Tick type to uint32_t:
* - updated: osKernelGetTickCount, osDelayUntil
* Version 2.1.0
* Support for critical and uncritical sections (nesting safe):
* - updated: osKernelLock, osKernelUnlock
* - added: osKernelRestoreLock
* Updated Thread and Event Flags:
* - changed flags parameter and return type from int32_t to uint32_t
* Version 2.0.0
* Initial Release
*---------------------------------------------------------------------------*/
#ifndef CMSIS_OS2_H_
#define CMSIS_OS2_H_
#ifndef __NO_RETURN
#if defined(__CC_ARM)
#define __NO_RETURN __declspec(noreturn)
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#define __NO_RETURN __attribute__((noreturn))
#elif defined(__GNUC__)
#define __NO_RETURN __attribute__((noreturn))
#elif defined(__ICCARM__)
#define __NO_RETURN __noreturn
#else
#define __NO_RETURN
#endif
#endif
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C"
{
#endif
// ==== Enumerations, structures, defines ====
/// Version information.
typedef struct {
uint32_t api; ///< API version (major.minor.rev: mmnnnrrrr dec).
uint32_t kernel; ///< Kernel version (major.minor.rev: mmnnnrrrr dec).
} osVersion_t;
/// Kernel state.
typedef enum {
osKernelInactive = 0, ///< Inactive.
osKernelReady = 1, ///< Ready.
osKernelRunning = 2, ///< Running.
osKernelLocked = 3, ///< Locked.
osKernelSuspended = 4, ///< Suspended.
osKernelError = -1, ///< Error.
osKernelReserved = 0x7FFFFFFFU ///< Prevents enum down-size compiler optimization.
} osKernelState_t;
/// Thread state.
typedef enum {
osThreadInactive = 0, ///< Inactive.
osThreadReady = 1, ///< Ready.
osThreadRunning = 2, ///< Running.
osThreadBlocked = 3, ///< Blocked.
osThreadTerminated = 4, ///< Terminated.
osThreadError = -1, ///< Error.
osThreadReserved = 0x7FFFFFFF ///< Prevents enum down-size compiler optimization.
} osThreadState_t;
/// Priority values.
typedef enum {
osPriorityNone = 0, ///< No priority (not initialized).
osPriorityIdle = 1, ///< Reserved for Idle thread.
osPriorityLow = 8, ///< Priority: low
osPriorityLow1 = 8+1, ///< Priority: low + 1
osPriorityLow2 = 8+2, ///< Priority: low + 2
osPriorityLow3 = 8+3, ///< Priority: low + 3
osPriorityLow4 = 8+4, ///< Priority: low + 4
osPriorityLow5 = 8+5, ///< Priority: low + 5
osPriorityLow6 = 8+6, ///< Priority: low + 6
osPriorityLow7 = 8+7, ///< Priority: low + 7
osPriorityBelowNormal = 16, ///< Priority: below normal
osPriorityBelowNormal1 = 16+1, ///< Priority: below normal + 1
osPriorityBelowNormal2 = 16+2, ///< Priority: below normal + 2
osPriorityBelowNormal3 = 16+3, ///< Priority: below normal + 3
osPriorityBelowNormal4 = 16+4, ///< Priority: below normal + 4
osPriorityBelowNormal5 = 16+5, ///< Priority: below normal + 5
osPriorityBelowNormal6 = 16+6, ///< Priority: below normal + 6
osPriorityBelowNormal7 = 16+7, ///< Priority: below normal + 7
osPriorityNormal = 24, ///< Priority: normal
osPriorityNormal1 = 24+1, ///< Priority: normal + 1
osPriorityNormal2 = 24+2, ///< Priority: normal + 2
osPriorityNormal3 = 24+3, ///< Priority: normal + 3
osPriorityNormal4 = 24+4, ///< Priority: normal + 4
osPriorityNormal5 = 24+5, ///< Priority: normal + 5
osPriorityNormal6 = 24+6, ///< Priority: normal + 6
osPriorityNormal7 = 24+7, ///< Priority: normal + 7
osPriorityAboveNormal = 32, ///< Priority: above normal
osPriorityAboveNormal1 = 32+1, ///< Priority: above normal + 1
osPriorityAboveNormal2 = 32+2, ///< Priority: above normal + 2
osPriorityAboveNormal3 = 32+3, ///< Priority: above normal + 3
osPriorityAboveNormal4 = 32+4, ///< Priority: above normal + 4
osPriorityAboveNormal5 = 32+5, ///< Priority: above normal + 5
osPriorityAboveNormal6 = 32+6, ///< Priority: above normal + 6
osPriorityAboveNormal7 = 32+7, ///< Priority: above normal + 7
osPriorityHigh = 40, ///< Priority: high
osPriorityHigh1 = 40+1, ///< Priority: high + 1
osPriorityHigh2 = 40+2, ///< Priority: high + 2
osPriorityHigh3 = 40+3, ///< Priority: high + 3
osPriorityHigh4 = 40+4, ///< Priority: high + 4
osPriorityHigh5 = 40+5, ///< Priority: high + 5
osPriorityHigh6 = 40+6, ///< Priority: high + 6
osPriorityHigh7 = 40+7, ///< Priority: high + 7
osPriorityRealtime = 48, ///< Priority: realtime
osPriorityRealtime1 = 48+1, ///< Priority: realtime + 1
osPriorityRealtime2 = 48+2, ///< Priority: realtime + 2
osPriorityRealtime3 = 48+3, ///< Priority: realtime + 3
osPriorityRealtime4 = 48+4, ///< Priority: realtime + 4
osPriorityRealtime5 = 48+5, ///< Priority: realtime + 5
osPriorityRealtime6 = 48+6, ///< Priority: realtime + 6
osPriorityRealtime7 = 48+7, ///< Priority: realtime + 7
osPriorityISR = 56, ///< Reserved for ISR deferred thread.
osPriorityError = -1, ///< System cannot determine priority or illegal priority.
osPriorityReserved = 0x7FFFFFFF ///< Prevents enum down-size compiler optimization.
} osPriority_t;
/// Entry point of a thread.
typedef void (*osThreadFunc_t) (void *argument);
/// Timer callback function.
typedef void (*osTimerFunc_t) (void *argument);
/// Timer type.
typedef enum {
osTimerOnce = 0, ///< One-shot timer.
osTimerPeriodic = 1 ///< Repeating timer.
} osTimerType_t;
// Timeout value.
#define osWaitForever 0xFFFFFFFFU ///< Wait forever timeout value.
// Flags options (\ref osThreadFlagsWait and \ref osEventFlagsWait).
#define osFlagsWaitAny 0x00000000U ///< Wait for any flag (default).
#define osFlagsWaitAll 0x00000001U ///< Wait for all flags.
#define osFlagsNoClear 0x00000002U ///< Do not clear flags which have been specified to wait for.
// Flags errors (returned by osThreadFlagsXxxx and osEventFlagsXxxx).
#define osFlagsError 0x80000000U ///< Error indicator.
#define osFlagsErrorUnknown 0xFFFFFFFFU ///< osError (-1).
#define osFlagsErrorTimeout 0xFFFFFFFEU ///< osErrorTimeout (-2).
#define osFlagsErrorResource 0xFFFFFFFDU ///< osErrorResource (-3).
#define osFlagsErrorParameter 0xFFFFFFFCU ///< osErrorParameter (-4).
#define osFlagsErrorISR 0xFFFFFFFAU ///< osErrorISR (-6).
// Thread attributes (attr_bits in \ref osThreadAttr_t).
#define osThreadDetached 0x00000000U ///< Thread created in detached mode (default)
#define osThreadJoinable 0x00000001U ///< Thread created in joinable mode
// Mutex attributes (attr_bits in \ref osMutexAttr_t).
#define osMutexRecursive 0x00000001U ///< Recursive mutex.
#define osMutexPrioInherit 0x00000002U ///< Priority inherit protocol.
#define osMutexRobust 0x00000008U ///< Robust mutex.
/// Status code values returned by CMSIS-RTOS functions.
typedef enum {
osOK = 0, ///< Operation completed successfully.
osError = -1, ///< Unspecified RTOS error: run-time error but no other error message fits.
osErrorTimeout = -2, ///< Operation not completed within the timeout period.
osErrorResource = -3, ///< Resource not available.
osErrorParameter = -4, ///< Parameter error.
osErrorNoMemory = -5, ///< System is out of memory: it was impossible to allocate or reserve memory for the operation.
osErrorISR = -6, ///< Not allowed in ISR context: the function cannot be called from interrupt service routines.
osStatusReserved = 0x7FFFFFFF ///< Prevents enum down-size compiler optimization.
} osStatus_t;
/// \details Thread ID identifies the thread.
typedef void *osThreadId_t;
/// \details Timer ID identifies the timer.
typedef void *osTimerId_t;
/// \details Event Flags ID identifies the event flags.
typedef void *osEventFlagsId_t;
/// \details Mutex ID identifies the mutex.
typedef void *osMutexId_t;
/// \details Semaphore ID identifies the semaphore.
typedef void *osSemaphoreId_t;
/// \details Memory Pool ID identifies the memory pool.
typedef void *osMemoryPoolId_t;
/// \details Message Queue ID identifies the message queue.
typedef void *osMessageQueueId_t;
#ifndef TZ_MODULEID_T
#define TZ_MODULEID_T
/// \details Data type that identifies secure software modules called by a process.
typedef uint32_t TZ_ModuleId_t;
#endif
/// Attributes structure for thread.
typedef struct {
const char *name; ///< name of the thread
uint32_t attr_bits; ///< attribute bits
void *cb_mem; ///< memory for control block
uint32_t cb_size; ///< size of provided memory for control block
void *stack_mem; ///< memory for stack
uint32_t stack_size; ///< size of stack
osPriority_t priority; ///< initial thread priority (default: osPriorityNormal)
TZ_ModuleId_t tz_module; ///< TrustZone module identifier
uint32_t reserved; ///< reserved (must be 0)
} osThreadAttr_t;
/// Attributes structure for timer.
typedef struct {
const char *name; ///< name of the timer
uint32_t attr_bits; ///< attribute bits
void *cb_mem; ///< memory for control block
uint32_t cb_size; ///< size of provided memory for control block
} osTimerAttr_t;
/// Attributes structure for event flags.
typedef struct {
const char *name; ///< name of the event flags
uint32_t attr_bits; ///< attribute bits
void *cb_mem; ///< memory for control block
uint32_t cb_size; ///< size of provided memory for control block
} osEventFlagsAttr_t;
/// Attributes structure for mutex.
typedef struct {
const char *name; ///< name of the mutex
uint32_t attr_bits; ///< attribute bits
void *cb_mem; ///< memory for control block
uint32_t cb_size; ///< size of provided memory for control block
} osMutexAttr_t;
/// Attributes structure for semaphore.
typedef struct {
const char *name; ///< name of the semaphore
uint32_t attr_bits; ///< attribute bits
void *cb_mem; ///< memory for control block
uint32_t cb_size; ///< size of provided memory for control block
} osSemaphoreAttr_t;
/// Attributes structure for memory pool.
typedef struct {
const char *name; ///< name of the memory pool
uint32_t attr_bits; ///< attribute bits
void *cb_mem; ///< memory for control block
uint32_t cb_size; ///< size of provided memory for control block
void *mp_mem; ///< memory for data storage
uint32_t mp_size; ///< size of provided memory for data storage
} osMemoryPoolAttr_t;
/// Attributes structure for message queue.
typedef struct {
const char *name; ///< name of the message queue
uint32_t attr_bits; ///< attribute bits
void *cb_mem; ///< memory for control block
uint32_t cb_size; ///< size of provided memory for control block
void *mq_mem; ///< memory for data storage
uint32_t mq_size; ///< size of provided memory for data storage
} osMessageQueueAttr_t;
// ==== Kernel Management Functions ====
/// Initialize the RTOS Kernel.
/// \return status code that indicates the execution status of the function.
osStatus_t osKernelInitialize (void);
/// Get RTOS Kernel Information.
/// \param[out] version pointer to buffer for retrieving version information.
/// \param[out] id_buf pointer to buffer for retrieving kernel identification string.
/// \param[in] id_size size of buffer for kernel identification string.
/// \return status code that indicates the execution status of the function.
osStatus_t osKernelGetInfo (osVersion_t *version, char *id_buf, uint32_t id_size);
/// Get the current RTOS Kernel state.
/// \return current RTOS Kernel state.
osKernelState_t osKernelGetState (void);
/// Start the RTOS Kernel scheduler.
/// \return status code that indicates the execution status of the function.
osStatus_t osKernelStart (void);
/// Lock the RTOS Kernel scheduler.
/// \return previous lock state (1 - locked, 0 - not locked, error code if negative).
int32_t osKernelLock (void);
/// Unlock the RTOS Kernel scheduler.
/// \return previous lock state (1 - locked, 0 - not locked, error code if negative).
int32_t osKernelUnlock (void);
/// Restore the RTOS Kernel scheduler lock state.
/// \param[in] lock lock state obtained by \ref osKernelLock or \ref osKernelUnlock.
/// \return new lock state (1 - locked, 0 - not locked, error code if negative).
int32_t osKernelRestoreLock (int32_t lock);
/// Suspend the RTOS Kernel scheduler.
/// \return time in ticks, for how long the system can sleep or power-down.
uint32_t osKernelSuspend (void);
/// Resume the RTOS Kernel scheduler.
/// \param[in] sleep_ticks time in ticks for how long the system was in sleep or power-down mode.
void osKernelResume (uint32_t sleep_ticks);
/// Get the RTOS kernel tick count.
/// \return RTOS kernel current tick count.
uint32_t osKernelGetTickCount (void);
/// Get the timer expiry time.
/// \return the timer expiry time.
uint32_t osTimerGetExpiryTime (osTimerId_t timer_id);
/// Get the RTOS kernel tick frequency.
/// \return frequency of the kernel tick in hertz, i.e. kernel ticks per second.
uint32_t osKernelGetTickFreq (void);
/// Get the RTOS kernel system timer count.
/// \return RTOS kernel current system timer count as 32-bit value.
uint32_t osKernelGetSysTimerCount (void);
/// Get the RTOS kernel system timer frequency.
/// \return frequency of the system timer in hertz, i.e. timer ticks per second.
uint32_t osKernelGetSysTimerFreq (void);
// ==== Thread Management Functions ====
/// Create a thread and add it to Active Threads.
/// \param[in] func thread function.
/// \param[in] argument pointer that is passed to the thread function as start argument.
/// \param[in] attr thread attributes; NULL: default values.
/// \return thread ID for reference by other functions or NULL in case of error.
osThreadId_t osThreadNew (osThreadFunc_t func, void *argument, const osThreadAttr_t *attr);
/// Get Number of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
///
uint32_t osThreadGetNumber (osThreadId_t thread_id);
/// Get name of a thread under critical section.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return name as NULL terminated string.
const char *osThreadGetName_CriSec (osThreadId_t thread_id);
/// Return the thread ID of the current running thread under critical section.
/// \return thread ID for reference by other functions or NULL in case of error.
osThreadId_t osThreadGetId_CriSec (void);
/// Get name of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return name as NULL terminated string.
const char *osThreadGetName (osThreadId_t thread_id);
/// Return the thread ID of the current running thread.
/// \return thread ID for reference by other functions or NULL in case of error.
osThreadId_t osThreadGetId (void);
/// Get current thread state of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return current thread state of the specified thread.
osThreadState_t osThreadGetState (osThreadId_t thread_id);
/// Get stack size of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return stack size in bytes.
uint32_t osThreadGetStackSize (osThreadId_t thread_id);
/// Get available stack space of a thread based on stack watermark recording during execution.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return remaining stack space in bytes.
uint32_t osThreadGetStackSpace (osThreadId_t thread_id);
/// Change priority of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \param[in] priority new priority value for the thread function.
/// \return status code that indicates the execution status of the function.
osStatus_t osThreadSetPriority (osThreadId_t thread_id, osPriority_t priority);
/// Get current priority of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return current priority value of the specified thread.
osPriority_t osThreadGetPriority (osThreadId_t thread_id);
/// Pass control to next thread that is in state \b READY.
/// \return status code that indicates the execution status of the function.
osStatus_t osThreadYield (void);
/// Suspend execution of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return status code that indicates the execution status of the function.
osStatus_t osThreadSuspend (osThreadId_t thread_id);
uint8_t osThreadIsSuspendAll (void);
/// Resume execution of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return status code that indicates the execution status of the function.
osStatus_t osThreadResume (osThreadId_t thread_id);
/// Suspend task switch
osStatus_t osThreadSuspendAll (void);
/// Resume task switch
osStatus_t osThreadResumeAll (void);
/// Detach a thread (thread storage can be reclaimed when thread terminates).
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return status code that indicates the execution status of the function.
osStatus_t osThreadDetach (osThreadId_t thread_id);
/// Wait for specified thread to terminate.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return status code that indicates the execution status of the function.
osStatus_t osThreadJoin (osThreadId_t thread_id);
/// Terminate execution of current running thread.
__NO_RETURN void osThreadExit (void);
/// Terminate execution of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return status code that indicates the execution status of the function.
osStatus_t osThreadTerminate (osThreadId_t thread_id);
/// Get number of active threads.
/// \return number of active threads.
uint32_t osThreadGetCount (void);
/// Enumerate active threads.
/// \param[out] thread_array pointer to array for retrieving thread IDs.
/// \param[in] array_items maximum number of items in array for retrieving thread IDs.
/// \return number of enumerated threads.
uint32_t osThreadEnumerate (osThreadId_t *thread_array, uint32_t array_items);
// ==== Thread Flags Functions ====
/// Set the specified Thread Flags of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \param[in] flags specifies the flags of the thread that shall be set.
/// \return thread flags after setting or error code if highest bit set.
uint32_t osThreadFlagsSet (osThreadId_t thread_id, uint32_t flags);
/// Clear the specified Thread Flags of current running thread.
/// \param[in] flags specifies the flags of the thread that shall be cleared.
/// \return thread flags before clearing or error code if highest bit set.
uint32_t osThreadFlagsClear (uint32_t flags);
/// Get the current Thread Flags of current running thread.
/// \return current thread flags.
uint32_t osThreadFlagsGet (void);
/// Wait for one or more Thread Flags of the current running thread to become signaled.
/// \param[in] flags specifies the flags to wait for.
/// \param[in] options specifies flags options (osFlagsXxxx).
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
/// \return thread flags before clearing or error code if highest bit set.
uint32_t osThreadFlagsWait (uint32_t flags, uint32_t options, uint32_t timeout);
// ==== Generic Wait Functions ====
/// Wait for Timeout (Time Delay).
/// \param[in] ticks \ref CMSIS_RTOS_TimeOutValue "time ticks" value
/// \return status code that indicates the execution status of the function.
osStatus_t osDelay (uint32_t ticks);
/// Wait until specified time.
/// \param[in] ticks absolute time in ticks
/// \return status code that indicates the execution status of the function.
osStatus_t osDelayUntil (uint32_t ticks);
// ==== Timer Management Functions ====
/// Create and Initialize a timer.
/// \param[in] func function pointer to callback function.
/// \param[in] type \ref osTimerOnce for one-shot or \ref osTimerPeriodic for periodic behavior.
/// \param[in] argument argument to the timer callback function.
/// \param[in] attr timer attributes; NULL: default values.
/// \return timer ID for reference by other functions or NULL in case of error.
osTimerId_t osTimerNew (osTimerFunc_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr);
/// Get name of a timer.
/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
/// \return name as NULL terminated string.
const char *osTimerGetName (osTimerId_t timer_id);
/// Start or restart a timer.
/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
/// \param[in] ticks \ref CMSIS_RTOS_TimeOutValue "time ticks" value of the timer.
/// \return status code that indicates the execution status of the function.
osStatus_t osTimerStart (osTimerId_t timer_id, uint32_t ticks);
/// Stop a timer.
/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osTimerStop (osTimerId_t timer_id);
/// Check if a timer is running.
/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
/// \return 0 not running, 1 running.
uint32_t osTimerIsRunning (osTimerId_t timer_id);
/// Delete a timer.
/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osTimerDelete (osTimerId_t timer_id);
// ==== Event Flags Management Functions ====
/// Create and Initialize an Event Flags object.
/// \param[in] attr event flags attributes; NULL: default values.
/// \return event flags ID for reference by other functions or NULL in case of error.
osEventFlagsId_t osEventFlagsNew (const osEventFlagsAttr_t *attr);
/// Get name of an Event Flags object.
/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
/// \return name as NULL terminated string.
const char *osEventFlagsGetName (osEventFlagsId_t ef_id);
/// Set the specified Event Flags.
/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
/// \param[in] flags specifies the flags that shall be set.
/// \return event flags after setting or error code if highest bit set.
uint32_t osEventFlagsSet (osEventFlagsId_t ef_id, uint32_t flags);
/// Clear the specified Event Flags.
/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
/// \param[in] flags specifies the flags that shall be cleared.
/// \return event flags before clearing or error code if highest bit set.
uint32_t osEventFlagsClear (osEventFlagsId_t ef_id, uint32_t flags);
/// Get the current Event Flags.
/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
/// \return current event flags.
uint32_t osEventFlagsGet (osEventFlagsId_t ef_id);
/// Wait for one or more Event Flags to become signaled.
/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
/// \param[in] flags specifies the flags to wait for.
/// \param[in] options specifies flags options (osFlagsXxxx).
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
/// \return event flags before clearing or error code if highest bit set.
uint32_t osEventFlagsWait (osEventFlagsId_t ef_id, uint32_t flags, uint32_t options, uint32_t timeout);
/// Delete an Event Flags object.
/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osEventFlagsDelete (osEventFlagsId_t ef_id);
// ==== Mutex Management Functions ====
/// Create and Initialize a Mutex object.
/// \param[in] attr mutex attributes; NULL: default values.
/// \return mutex ID for reference by other functions or NULL in case of error.
osMutexId_t osMutexNew (const osMutexAttr_t *attr);
/// Get name of a Mutex object.
/// \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
/// \return name as NULL terminated string.
const char *osMutexGetName (osMutexId_t mutex_id);
/// Acquire a Mutex or timeout if it is locked.
/// \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
/// \return status code that indicates the execution status of the function.
osStatus_t osMutexAcquire (osMutexId_t mutex_id, uint32_t timeout);
/// Release a Mutex that was acquired by \ref osMutexAcquire.
/// \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osMutexRelease (osMutexId_t mutex_id);
/// Get Thread which owns a Mutex object.
/// \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
/// \return thread ID of owner thread or NULL when mutex was not acquired.
osThreadId_t osMutexGetOwner (osMutexId_t mutex_id);
/// Delete a Mutex object.
/// \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osMutexDelete (osMutexId_t mutex_id);
// ==== Semaphore Management Functions ====
/// Create and Initialize a Semaphore object.
/// \param[in] max_count maximum number of available tokens.
/// \param[in] initial_count initial number of available tokens.
/// \param[in] attr semaphore attributes; NULL: default values.
/// \return semaphore ID for reference by other functions or NULL in case of error.
osSemaphoreId_t osSemaphoreNew (uint32_t max_count, uint32_t initial_count, const osSemaphoreAttr_t *attr);
/// Get name of a Semaphore object.
/// \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
/// \return name as NULL terminated string.
const char *osSemaphoreGetName (osSemaphoreId_t semaphore_id);
/// Acquire a Semaphore token or timeout if no tokens are available.
/// \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
/// \return status code that indicates the execution status of the function.
osStatus_t osSemaphoreAcquire (osSemaphoreId_t semaphore_id, uint32_t timeout);
/// Release a Semaphore token up to the initial maximum count.
/// \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osSemaphoreRelease (osSemaphoreId_t semaphore_id);
/// Get current Semaphore token count.
/// \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
/// \return number of tokens available.
uint32_t osSemaphoreGetCount (osSemaphoreId_t semaphore_id);
/// Delete a Semaphore object.
/// \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osSemaphoreDelete (osSemaphoreId_t semaphore_id);
// ==== Memory Pool Management Functions ====
/// Create and Initialize a Memory Pool object.
/// \param[in] block_count maximum number of memory blocks in memory pool.
/// \param[in] block_size memory block size in bytes.
/// \param[in] attr memory pool attributes; NULL: default values.
/// \return memory pool ID for reference by other functions or NULL in case of error.
osMemoryPoolId_t osMemoryPoolNew (uint32_t block_count, uint32_t block_size, const osMemoryPoolAttr_t *attr);
/// Get name of a Memory Pool object.
/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
/// \return name as NULL terminated string.
const char *osMemoryPoolGetName (osMemoryPoolId_t mp_id);
/// Allocate a memory block from a Memory Pool.
/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
/// \return address of the allocated memory block or NULL in case of no memory is available.
void *osMemoryPoolAlloc (osMemoryPoolId_t mp_id, uint32_t timeout);
/// Return an allocated memory block back to a Memory Pool.
/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
/// \param[in] block address of the allocated memory block to be returned to the memory pool.
/// \return status code that indicates the execution status of the function.
osStatus_t osMemoryPoolFree (osMemoryPoolId_t mp_id, void *block);
/// Get maximum number of memory blocks in a Memory Pool.
/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
/// \return maximum number of memory blocks.
uint32_t osMemoryPoolGetCapacity (osMemoryPoolId_t mp_id);
/// Get memory block size in a Memory Pool.
/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
/// \return memory block size in bytes.
uint32_t osMemoryPoolGetBlockSize (osMemoryPoolId_t mp_id);
/// Get number of memory blocks used in a Memory Pool.
/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
/// \return number of memory blocks used.
uint32_t osMemoryPoolGetCount (osMemoryPoolId_t mp_id);
/// Get number of memory blocks available in a Memory Pool.
/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
/// \return number of memory blocks available.
uint32_t osMemoryPoolGetSpace (osMemoryPoolId_t mp_id);
/// Delete a Memory Pool object.
/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osMemoryPoolDelete (osMemoryPoolId_t mp_id);
// ==== Message Queue Management Functions ====
/// Create and Initialize a Message Queue object.
/// \param[in] msg_count maximum number of messages in queue.
/// \param[in] msg_size maximum message size in bytes.
/// \param[in] attr message queue attributes; NULL: default values.
/// \return message queue ID for reference by other functions or NULL in case of error.
osMessageQueueId_t osMessageQueueNew (uint32_t msg_count, uint32_t msg_size, const osMessageQueueAttr_t *attr);
/// Get name of a Message Queue object.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \return name as NULL terminated string.
const char *osMessageQueueGetName (osMessageQueueId_t mq_id);
/// Put a Message into a Queue or timeout if Queue is full.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \param[in] msg_ptr pointer to buffer with message to put into a queue.
/// \param[in] msg_prio message priority.
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
/// \return status code that indicates the execution status of the function.
osStatus_t osMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout);
/// Put a Message into a Queue's front header or timeout if Queue is full.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \param[in] msg_ptr pointer to buffer with message to put into a queue.
/// \param[in] msg_prio message priority.
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
/// \return status code that indicates the execution status of the function.
osStatus_t osMessageQueuePutToFront (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout);
/// Get a Message from a Queue or timeout if Queue is empty.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \param[out] msg_ptr pointer to buffer for message to get from a queue.
/// \param[out] msg_prio pointer to buffer for message priority or NULL.
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
/// \return status code that indicates the execution status of the function.
osStatus_t osMessageQueueGet (osMessageQueueId_t mq_id, void *msg_ptr, uint8_t *msg_prio, uint32_t timeout);
/// Get maximum number of messages in a Message Queue.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \return maximum number of messages.
uint32_t osMessageQueueGetCapacity (osMessageQueueId_t mq_id);
/// Get maximum message size in a Memory Pool.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \return maximum message size in bytes.
uint32_t osMessageQueueGetMsgSize (osMessageQueueId_t mq_id);
/// Get number of queued messages in a Message Queue.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \return number of queued messages.
uint32_t osMessageQueueGetCount (osMessageQueueId_t mq_id);
/// Get number of available slots for messages in a Message Queue.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \return number of available slots for messages.
uint32_t osMessageQueueGetSpace (osMessageQueueId_t mq_id);
/// Reset a Message Queue to initial empty state.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osMessageQueueReset (osMessageQueueId_t mq_id);
/// Delete a Message Queue object.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osMessageQueueDelete (osMessageQueueId_t mq_id);
//add stdio malloc/free function
void *malloc( size_t Size );
void free( void *p );
void *calloc(size_t n,size_t Size );
//add stdio malloc/free function
// protect critical region in task context
void ostaskENTER_CRITICAL(void);
void ostaskEXIT_CRITICAL(void);
// protect critical region in ISR context
uint32_t ostaskENTER_CRITICAL_ISR(void);
void ostaskEXIT_CRITICAL_ISR(uint32_t isrm);
uint32_t osIsInISRContext(void);
#if( configUSE_16_BIT_TICKS == 1 )
typedef uint16_t TickType_t;
#define cmsisMAX_DELAY ( TickType_t ) 0xffff
#else
typedef uint32_t TickType_t;
#define cmsisMAX_DELAY ( TickType_t ) 0xffffffffUL
/* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
not need to be guarded with a critical section. */
#define portTICK_TYPE_IS_ATOMIC 1
#endif
uint32_t osTaskSetTimeOutState(uint32_t *curTimeTick);
uint32_t osTaskCheckForTimeOut(uint32_t *curTimeTick, uint32_t *timeOutTick);
uint32_t osTaskGetFreeHeapSize( void );
#ifdef __cplusplus
}
#endif
#endif // CMSIS_OS2_H_

View File

@ -0,0 +1,201 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of EigenComm Ltd.
* File name: gpio.h
* Description: EC718 gpio driver header file
* History:
*
****************************************************************************/
#ifndef _GPIO_EC718_H
#define _GPIO_EC718_H
#include "ec718.h"
#include "Driver_Common.h"
/**
\addtogroup gpio_interface_gr
\{
*/
/*******************************************************************************
* Definitions
******************************************************************************/
/** \brief GPIO pin direction */
typedef enum
{
GPIO_DIRECTION_INPUT = 0U, /**< Set pin as input */
GPIO_DIRECTION_OUTPUT = 1U, /**< Set pin as output */
} GpioPinDirection_e;
/** \brief GPIO pin interrupt configuration */
typedef enum
{
GPIO_INTERRUPT_DISABLED = 0U, /**< Disable interrupt */
GPIO_INTERRUPT_LOW_LEVEL = 1U, /**< Low-level interrupt */
GPIO_INTERRUPT_HIGH_LEVEL = 2U, /**< High-level interrupt */
GPIO_INTERRUPT_FALLING_EDGE = 3U, /**< Falling edge interrupt */
GPIO_INTERRUPT_RISING_EDGE = 4U, /**< Rising edge interrupt */
GPIO_INTERRUPT_BOTH_EDGE = 5U /**< Falling and rising edge interrupt */
} GpioInterruptConfig_e;
/** \brief GPIO pin configuration structure */
typedef struct
{
GpioPinDirection_e pinDirection; /**< GPIO direction, input or output */
union
{
GpioInterruptConfig_e interruptConfig; /**< Pin's interrupt configuration, valid when pinDirection is input */
uint32_t initOutput; /**< Initial pin output value, valid when pinDirection is output*/
} misc;
} GpioPinConfig_t;
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
/** \name GPIO Driver Initialization */
/** \{ */
/**
\fn void GPIO_driverInit(void);
\brief Intialize GPIO driver internal data
\note It is not necessarty to call this function before using GPIO driver since it has been
called in \ref GPIO_pinConfig() api.
*/
void GPIO_driverInit(void);
/**
\fn void GPIO_driverDeInit(void);
\brief De-Intialize GPIO driver, disable GPIO clock and perform some clearups
*/
void GPIO_driverDeInit(void);
/** \} */
/** \name GPIO Configuration */
/** \{ */
/**
\fn void GPIO_pinConfig(uint32_t port, uint16_t pin, const GpioPinConfig_t *config);
\brief Configure a GPIO pin
\param[in] port GPIO number (0, 1, ...)
\param[in] pin GPIO pin number
\param[in] config Pointer to GPIO pin configuration
*/
void GPIO_pinConfig(uint32_t port, uint16_t pin, const GpioPinConfig_t *config);
/**
\fn void GPIO_interruptConfig(uint32_t port, uint16_t pin, GpioInterruptConfig_e config);
\brief Configure a GPIO pin's interrupt type(valid when this pin has been set as input)
\param[in] port GPIO number (0, 1, ...)
\param[in] pin GPIO pin number
\param[in] config GPIO interrupt configuration
*/
void GPIO_interruptConfig(uint32_t port, uint16_t pin, GpioInterruptConfig_e config);
/** \} */
/** \name GPIO Output Operations */
/** \{ */
/**
\fn void GPIO_pinWrite(uint32_t port, uint16_t pinMask, uint16_t output);
\brief Sets output level of multiple GPIO pins to logic 1 or 0
\code
Example to set bits[15,1:0] to 1 and clear bits[12:11, 7:6]
// pinMask shall be b10011000 11000011 = 0x98C3
// output shall be b10000000 00000011 = 0x8003
GPIO_pinWrite(0, 0x98C3, 0x8003);
// To set a single pin, let's say, pin 12 of GPIO0
GPIO_pinWrite(0, 1 << 12, 1 << 12);
// To clear a single pin, let's say, pin 12 of GPIO0
GPIO_pinWrite(0, 1 << 12, 0);
\endcode
\param[in] port GPIO number (0, 1, ...)
\param[in] pinMask GPIO pin mask to set
\param[in] output GPIO pin output logic level.
- 0: corresponding pin output low-logic level.
- 1: corresponding pin output high-logic level.
*/
void GPIO_pinWrite(uint32_t port, uint16_t pinMask, uint16_t output);
/** \} */
/** \name GPIO Input Operations */
/** \{ */
/**
\fn uint32_t GPIO_pinRead(uint32_t port, uint16_t pin)
\brief Reads current input value of GPIO specific pin
\param[in] port GPIO number (0, 1, ...)
\param[in] pin GPIO pin number
\return GPIO corresponding pin input value
*/
uint32_t GPIO_pinRead(uint32_t port, uint16_t pin);
/** \} */
/** \name GPIO Interrupt */
/** \{ */
/**
\fn uint16_t GPIO_getInterruptFlags(uint32_t port)
\brief Reads GPIO port interrupt status flags
\param[in] port GPIO number (0, 1, ...)
\return current GPIO interrupt status flag
*/
uint16_t GPIO_getInterruptFlags(uint32_t port);
/**
\fn void GPIO_clearInterruptFlags(uint32_t port, uint16_t mask)
\brief Clears multiple GPIO pin interrupt status flags
\param[in] port GPIO number (0, 1, ...)
\param[in] mask GPIO pin number macro
*/
void GPIO_clearInterruptFlags(uint32_t port, uint16_t mask);
/**
\fn uint16_t GPIO_saveAndSetIrqMask(uint32_t port)
\brief Reads GPIO port interrupt enable mask and diables whole port interrupts
\param[in] port GPIO number (0, 1, ...)
\return current GPIO port interrupt enable mask
\note Used in GPIO ISR to disable GPIO interrupts temporarily
*/
uint16_t GPIO_saveAndSetIrqMask(uint32_t port);
/**
\fn void GPIO_restoreIrqMask(uint32_t port, uint16_t mask)
\brief Restore GPIO port interrupt enable setting
\param[in] port GPIO number (0, 1, ...)
\param[in] mask GPIO interrupt enable mask
\note Used in GPIO ISR to restore GPIO enable setting upon exit
*/
void GPIO_restoreIrqMask(uint32_t port, uint16_t mask);
/**
\fn void GPIO_pinSetDirectionOnly(uint32_t port, uint16_t pin, GpioPinDirection_e dir);
\brief set pin direction only
\param[in] port GPIO number (0, 1, ...)
\param[in] pin GPIO pin number
\param[in] dir set pin direction
*/
void GPIO_pinSetDirectionOnly(uint32_t port, uint16_t pin, GpioPinDirection_e dir);
/** \} */
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* _GPIO_EC718_H */

View File

@ -0,0 +1,699 @@
/*
* The little filesystem
*
* Copyright (c) 2017, Arm Limited. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef LFS_H
#define LFS_H
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C"
{
#endif
/// Version info ///
// Software library version
// Major (top-nibble), incremented on backwards incompatible changes
// Minor (bottom-nibble), incremented on feature additions
#define LFS_VERSION 0x00020004
#define LFS_VERSION_MAJOR (0xffff & (LFS_VERSION >> 16))
#define LFS_VERSION_MINOR (0xffff & (LFS_VERSION >> 0))
// Version of On-disk data structures
// Major (top-nibble), incremented on backwards incompatible changes
// Minor (bottom-nibble), incremented on feature additions
#define LFS_DISK_VERSION 0x00020000
#define LFS_DISK_VERSION_MAJOR (0xffff & (LFS_DISK_VERSION >> 16))
#define LFS_DISK_VERSION_MINOR (0xffff & (LFS_DISK_VERSION >> 0))
/// Definitions ///
// Type definitions
typedef uint32_t lfs_size_t;
typedef uint32_t lfs_off_t;
typedef int32_t lfs_ssize_t;
typedef int32_t lfs_soff_t;
typedef uint32_t lfs_block_t;
// Maximum name size in bytes, may be redefined to reduce the size of the
// info struct. Limited to <= 1022. Stored in superblock and must be
// respected by other littlefs drivers.
#ifndef LFS_NAME_MAX
#define LFS_NAME_MAX 255 /* Note: 1. Change this value in Makefile.inc located in the same directory with this file. 2. Need to FORMAT the whole FS area to take effect */
#endif
// Maximum size of a file in bytes, may be redefined to limit to support other
// drivers. Limited on disk to <= 4294967296. However, above 2147483647 the
// functions lfs_file_seek, lfs_file_size, and lfs_file_tell will return
// incorrect values due to using signed integers. Stored in superblock and
// must be respected by other littlefs drivers.
#ifndef LFS_FILE_MAX
#define LFS_FILE_MAX 2147483647
#endif
// Maximum size of custom attributes in bytes, may be redefined, but there is
// no real benefit to using a smaller LFS_ATTR_MAX. Limited to <= 1022.
#ifndef LFS_ATTR_MAX
#define LFS_ATTR_MAX 1022
#endif
// Possible error codes, these are negative to allow
// valid positive return values
enum lfs_error {
LFS_ERR_OK = 0, // No error
LFS_ERR_IO = -5, // Error during device operation
LFS_ERR_CORRUPT = -84, // Corrupted
LFS_ERR_NOENT = -2, // No directory entry
LFS_ERR_EXIST = -17, // Entry already exists
LFS_ERR_NOTDIR = -20, // Entry is not a dir
LFS_ERR_ISDIR = -21, // Entry is a dir
LFS_ERR_NOTEMPTY = -39, // Dir is not empty
LFS_ERR_BADF = -9, // Bad file number
LFS_ERR_FBIG = -27, // File too large
LFS_ERR_INVAL = -22, // Invalid parameter
LFS_ERR_NOSPC = -28, // No space left on device
LFS_ERR_NOMEM = -12, // No more memory available
LFS_ERR_NOATTR = -61, // No data/attr available
LFS_ERR_NAMETOOLONG = -36, // File name too long
};
// File types
enum lfs_type {
// file types
LFS_TYPE_REG = 0x001,
LFS_TYPE_DIR = 0x002,
// internally used types
LFS_TYPE_SPLICE = 0x400,
LFS_TYPE_NAME = 0x000,
LFS_TYPE_STRUCT = 0x200,
LFS_TYPE_USERATTR = 0x300,
LFS_TYPE_FROM = 0x100,
LFS_TYPE_TAIL = 0x600,
LFS_TYPE_GLOBALS = 0x700,
LFS_TYPE_CRC = 0x500,
// internally used type specializations
LFS_TYPE_CREATE = 0x401,
LFS_TYPE_DELETE = 0x4ff,
LFS_TYPE_SUPERBLOCK = 0x0ff,
LFS_TYPE_DIRSTRUCT = 0x200,
LFS_TYPE_CTZSTRUCT = 0x202,
LFS_TYPE_INLINESTRUCT = 0x201,
LFS_TYPE_SOFTTAIL = 0x600,
LFS_TYPE_HARDTAIL = 0x601,
LFS_TYPE_MOVESTATE = 0x7ff,
// internal chip sources
LFS_FROM_NOOP = 0x000,
LFS_FROM_MOVE = 0x101,
LFS_FROM_USERATTRS = 0x102,
};
// File open flags
enum lfs_open_flags {
// open flags
LFS_O_RDONLY = 1, // Open a file as read only
#ifndef LFS_READONLY
LFS_O_WRONLY = 2, // Open a file as write only
LFS_O_RDWR = 3, // Open a file as read and write
LFS_O_CREAT = 0x0100, // Create a file if it does not exist
LFS_O_EXCL = 0x0200, // Fail if a file already exists
LFS_O_TRUNC = 0x0400, // Truncate the existing file to zero size
LFS_O_APPEND = 0x0800, // Move to end of file on every write
#endif
// internally used flags
#ifndef LFS_READONLY
LFS_F_DIRTY = 0x010000, // File does not match storage
LFS_F_WRITING = 0x020000, // File has been written since last flush
#endif
LFS_F_READING = 0x040000, // File has been read since last flush
#ifndef LFS_READONLY
LFS_F_ERRED = 0x080000, // An error occured during write
#endif
LFS_F_INLINE = 0x100000, // Currently inlined in directory entry
LFS_F_OPENED = 0x200000, // File has been opened, stay un-updated for stack cost(EC)
};
// File seek flags
enum lfs_whence_flags {
LFS_SEEK_SET = 0, // Seek relative to an absolute position
LFS_SEEK_CUR = 1, // Seek relative to the current file position
LFS_SEEK_END = 2, // Seek relative to the end of the file
};
// Configuration provided during initialization of the littlefs
struct lfs_config {
// Opaque user provided context that can be used to pass
// information to the block device operations
void *context;
// Read a region in a block. Negative error codes are propogated
// to the user.
int (*read)(const struct lfs_config *c, lfs_block_t block,
lfs_off_t off, void *buffer, lfs_size_t size);
// Program a region in a block. The block must have previously
// been erased. Negative error codes are propogated to the user.
// May return LFS_ERR_CORRUPT if the block should be considered bad.
int (*prog)(const struct lfs_config *c, lfs_block_t block,
lfs_off_t off, const void *buffer, lfs_size_t size);
// Erase a block. A block must be erased before being programmed.
// The state of an erased block is undefined. Negative error codes
// are propogated to the user.
// May return LFS_ERR_CORRUPT if the block should be considered bad.
int (*erase)(const struct lfs_config *c, lfs_block_t block);
// Sync the state of the underlying block device. Negative error codes
// are propogated to the user.
int (*sync)(const struct lfs_config *c);
#ifdef LFS_THREADSAFE
int (*lock)(const struct lfs_config *c);
int (*unlock)(const struct lfs_config *c);
#endif
// Minimum size of a block read. All read operations will be a
// multiple of this value.
lfs_size_t read_size;
// Minimum size of a block program. All program operations will be a
// multiple of this value.
lfs_size_t prog_size;
// Size of an erasable block. This does not impact ram consumption and
// may be larger than the physical erase size. However, non-inlined files
// take up at minimum one block. Must be a multiple of the read
// and program sizes.
lfs_size_t block_size;
// Number of erasable blocks on the device.
lfs_size_t block_count;
// Number of erase cycles before littlefs evicts metadata logs and moves
// the metadata to another block. Suggested values are in the
// range 100-1000, with large values having better performance at the cost
// of less consistent wear distribution.
//
// Set to -1 to disable block-level wear-leveling.
int32_t block_cycles;
// Size of block caches. Each cache buffers a portion of a block in RAM.
// The littlefs needs a read cache, a program cache, and one additional
// cache per file. Larger caches can improve performance by storing more
// data and reducing the number of disk accesses. Must be a multiple of
// the read and program sizes, and a factor of the block size.
lfs_size_t cache_size;
// Size of the lookahead buffer in bytes. A larger lookahead buffer
// increases the number of blocks found during an allocation pass. The
// lookahead buffer is stored as a compact bitmap, so each byte of RAM
// can track 8 blocks. Must be a multiple of 8.
lfs_size_t lookahead_size;
// Optional statically allocated read buffer. Must be cache_size.
// By default lfs_malloc is used to allocate this buffer.
void *read_buffer;
// Optional statically allocated program buffer. Must be cache_size.
// By default lfs_malloc is used to allocate this buffer.
void *prog_buffer;
// Optional statically allocated lookahead buffer. Must be lookahead_size
// and aligned to a 32-bit boundary. By default lfs_malloc is used to
// allocate this buffer.
void *lookahead_buffer;
// Optional upper limit on length of file names in bytes. No downside for
// larger names except the size of the info struct which is controlled by
// the LFS_NAME_MAX define. Defaults to LFS_NAME_MAX when zero. Stored in
// superblock and must be respected by other littlefs drivers.
lfs_size_t name_max;
// Optional upper limit on files in bytes. No downside for larger files
// but must be <= LFS_FILE_MAX. Defaults to LFS_FILE_MAX when zero. Stored
// in superblock and must be respected by other littlefs drivers.
lfs_size_t file_max;
// Optional upper limit on custom attributes in bytes. No downside for
// larger attributes size but must be <= LFS_ATTR_MAX. Defaults to
// LFS_ATTR_MAX when zero.
lfs_size_t attr_max;
// Optional upper limit on total space given to metadata pairs in bytes. On
// devices with large blocks (e.g. 128kB) setting this to a low size (2-8kB)
// can help bound the metadata compaction time. Must be <= block_size.
// Defaults to block_size when zero.
lfs_size_t metadata_max;
};
// File info structure
struct lfs_info {
// Type of the file, either LFS_TYPE_REG or LFS_TYPE_DIR
uint8_t type;
// Size of the file, only valid for REG files. Limited to 32-bits.
lfs_size_t size;
// Name of the file stored as a null-terminated string. Limited to
// LFS_NAME_MAX+1, which can be changed by redefining LFS_NAME_MAX to
// reduce RAM. LFS_NAME_MAX is stored in superblock and must be
// respected by other littlefs drivers.
char name[LFS_NAME_MAX+1];
};
// Custom attribute structure, used to describe custom attributes
// committed atomically during file writes.
struct lfs_attr {
// 8-bit type of attribute, provided by user and used to
// identify the attribute
uint8_t type;
// Pointer to buffer containing the attribute
void *buffer;
// Size of attribute in bytes, limited to LFS_ATTR_MAX
lfs_size_t size;
};
// Optional configuration provided during lfs_file_opencfg
struct lfs_file_config {
// Optional statically allocated file buffer. Must be cache_size.
// By default lfs_malloc is used to allocate this buffer.
void *buffer;
// Optional list of custom attributes related to the file. If the file
// is opened with read access, these attributes will be read from disk
// during the open call. If the file is opened with write access, the
// attributes will be written to disk every file sync or close. This
// write occurs atomically with update to the file's contents.
//
// Custom attributes are uniquely identified by an 8-bit type and limited
// to LFS_ATTR_MAX bytes. When read, if the stored attribute is smaller
// than the buffer, it will be padded with zeros. If the stored attribute
// is larger, then it will be silently truncated. If the attribute is not
// found, it will be created implicitly.
struct lfs_attr *attrs;
// Number of custom attributes in the list
lfs_size_t attr_count;
};
/// internal littlefs data structures ///
typedef struct lfs_cache {
lfs_block_t block;
lfs_off_t off;
lfs_size_t size;
uint8_t *buffer;
} lfs_cache_t;
typedef struct lfs_mdir {
lfs_block_t pair[2];
uint32_t rev;
lfs_off_t off;
uint32_t etag;
uint16_t count;
bool erased;
bool split;
lfs_block_t tail[2];
} lfs_mdir_t;
// littlefs directory type
typedef struct lfs_dir {
struct lfs_dir *next;
uint16_t id;
uint8_t type;
lfs_mdir_t m;
lfs_off_t pos;
lfs_block_t head[2];
#ifdef FEATURE_SUBSYS_STORAGE_PARTITION_ENABLE
uint8_t partition;
#endif
} lfs_dir_t;
// littlefs file type
typedef struct lfs_file {
struct lfs_file *next;
uint16_t id;
uint8_t type;
lfs_mdir_t m;
struct lfs_ctz {
lfs_block_t head;
lfs_size_t size;
} ctz;
#if 1
char* name; // Add to support to show name rapidly
#endif
uint32_t flags;
lfs_off_t pos;
lfs_block_t block;
lfs_off_t off;
lfs_cache_t cache;
const struct lfs_file_config *cfg;
#ifdef FEATURE_SUBSYS_STORAGE_PARTITION_ENABLE
uint8_t partition;
#endif
} lfs_file_t;
typedef struct lfs_superblock {
uint32_t version;
lfs_size_t block_size;
lfs_size_t block_count;
lfs_size_t name_max;
lfs_size_t file_max;
lfs_size_t attr_max;
} lfs_superblock_t;
typedef struct lfs_gstate {
uint32_t tag;
lfs_block_t pair[2];
} lfs_gstate_t;
// The littlefs filesystem type
typedef struct lfs {
lfs_cache_t rcache;
lfs_cache_t pcache;
lfs_block_t root[2];
struct lfs_mlist {
struct lfs_mlist *next;
uint16_t id;
uint8_t type;
lfs_mdir_t m;
} *mlist;
uint32_t seed;
lfs_gstate_t gstate;
lfs_gstate_t gdisk;
lfs_gstate_t gdelta;
struct lfs_free {
lfs_block_t off;
lfs_block_t size;
lfs_block_t i;
lfs_block_t ack;
uint32_t *buffer;
} free;
const struct lfs_config *cfg;
lfs_size_t name_max;
lfs_size_t file_max;
lfs_size_t attr_max;
#ifdef LFS_MIGRATE
struct lfs1 *lfs1;
#endif
} lfs_t;
/// Filesystem functions ///
#ifndef LFS_READONLY
// Format a block device with the littlefs
//
// Requires a littlefs object and config struct. This clobbers the littlefs
// object, and does not leave the filesystem mounted. The config struct must
// be zeroed for defaults and backwards compatibility.
//
// Returns a negative error code on failure.
int lfs_format(lfs_t *lfs, const struct lfs_config *config);
#endif
// Mounts a littlefs
//
// Requires a littlefs object and config struct. Multiple filesystems
// may be mounted simultaneously with multiple littlefs objects. Both
// lfs and config must be allocated while mounted. The config struct must
// be zeroed for defaults and backwards compatibility.
//
// Returns a negative error code on failure.
int lfs_mount(lfs_t *lfs, const struct lfs_config *config);
// Unmounts a littlefs
//
// Does nothing besides releasing any allocated resources.
// Returns a negative error code on failure.
int lfs_unmount(lfs_t *lfs);
/// General operations ///
#ifndef LFS_READONLY
// Removes a file or directory
//
// If removing a directory, the directory must be empty.
// Returns a negative error code on failure.
int lfs_remove(lfs_t *lfs, const char *path);
#endif
#ifndef LFS_READONLY
// Rename or move a file or directory
//
// If the destination exists, it must match the source in type.
// If the destination is a directory, the directory must be empty.
//
// Returns a negative error code on failure.
int lfs_rename(lfs_t *lfs, const char *oldpath, const char *newpath);
#endif
// Find info about a file or directory
//
// Fills out the info structure, based on the specified file or directory.
// Returns a negative error code on failure.
int lfs_stat(lfs_t *lfs, const char *path, struct lfs_info *info);
// Get a custom attribute
//
// Custom attributes are uniquely identified by an 8-bit type and limited
// to LFS_ATTR_MAX bytes. When read, if the stored attribute is smaller than
// the buffer, it will be padded with zeros. If the stored attribute is larger,
// then it will be silently truncated. If no attribute is found, the error
// LFS_ERR_NOATTR is returned and the buffer is filled with zeros.
//
// Returns the size of the attribute, or a negative error code on failure.
// Note, the returned size is the size of the attribute on disk, irrespective
// of the size of the buffer. This can be used to dynamically allocate a buffer
// or check for existance.
lfs_ssize_t lfs_getattr(lfs_t *lfs, const char *path,
uint8_t type, void *buffer, lfs_size_t size);
#ifndef LFS_READONLY
// Set custom attributes
//
// Custom attributes are uniquely identified by an 8-bit type and limited
// to LFS_ATTR_MAX bytes. If an attribute is not found, it will be
// implicitly created.
//
// Returns a negative error code on failure.
int lfs_setattr(lfs_t *lfs, const char *path,
uint8_t type, const void *buffer, lfs_size_t size);
#endif
#ifndef LFS_READONLY
// Removes a custom attribute
//
// If an attribute is not found, nothing happens.
//
// Returns a negative error code on failure.
int lfs_removeattr(lfs_t *lfs, const char *path, uint8_t type);
#endif
/// File operations ///
// Open a file
//
// The mode that the file is opened in is determined by the flags, which
// are values from the enum lfs_open_flags that are bitwise-ored together.
//
// Returns a negative error code on failure.
int lfs_file_open(lfs_t *lfs, lfs_file_t *file,
const char *path, int flags);
// Open a file with extra configuration
//
// The mode that the file is opened in is determined by the flags, which
// are values from the enum lfs_open_flags that are bitwise-ored together.
//
// The config struct provides additional config options per file as described
// above. The config struct must be allocated while the file is open, and the
// config struct must be zeroed for defaults and backwards compatibility.
//
// Returns a negative error code on failure.
int lfs_file_opencfg(lfs_t *lfs, lfs_file_t *file,
const char *path, int flags,
const struct lfs_file_config *config);
// Close a file
//
// Any pending writes are written out to storage as though
// sync had been called and releases any allocated resources.
//
// Returns a negative error code on failure.
int lfs_file_close(lfs_t *lfs, lfs_file_t *file);
// Synchronize a file on storage
//
// Any pending writes are written out to storage.
// Returns a negative error code on failure.
int lfs_file_sync(lfs_t *lfs, lfs_file_t *file);
// Read data from file
//
// Takes a buffer and size indicating where to store the read data.
// Returns the number of bytes read, or a negative error code on failure.
lfs_ssize_t lfs_file_read(lfs_t *lfs, lfs_file_t *file,
void *buffer, lfs_size_t size);
#ifndef LFS_READONLY
// Write data to file
//
// Takes a buffer and size indicating the data to write. The file will not
// actually be updated on the storage until either sync or close is called.
//
// Returns the number of bytes written, or a negative error code on failure.
lfs_ssize_t lfs_file_write(lfs_t *lfs, lfs_file_t *file,
const void *buffer, lfs_size_t size);
#endif
// Change the position of the file
//
// The change in position is determined by the offset and whence flag.
// Returns the new position of the file, or a negative error code on failure.
lfs_soff_t lfs_file_seek(lfs_t *lfs, lfs_file_t *file,
lfs_soff_t off, int whence);
#ifndef LFS_READONLY
// Truncates the size of the file to the specified size
//
// Returns a negative error code on failure.
int lfs_file_truncate(lfs_t *lfs, lfs_file_t *file, lfs_off_t size);
#endif
// Return the position of the file
//
// Equivalent to lfs_file_seek(lfs, file, 0, LFS_SEEK_CUR)
// Returns the position of the file, or a negative error code on failure.
lfs_soff_t lfs_file_tell(lfs_t *lfs, lfs_file_t *file);
// Change the position of the file to the beginning of the file
//
// Equivalent to lfs_file_seek(lfs, file, 0, LFS_SEEK_SET)
// Returns a negative error code on failure.
int lfs_file_rewind(lfs_t *lfs, lfs_file_t *file);
// Return the size of the file
//
// Similar to lfs_file_seek(lfs, file, 0, LFS_SEEK_END)
// Returns the size of the file, or a negative error code on failure.
lfs_soff_t lfs_file_size(lfs_t *lfs, lfs_file_t *file);
/// Directory operations ///
#ifndef LFS_READONLY
// Create a directory
//
// Returns a negative error code on failure.
int lfs_mkdir(lfs_t *lfs, const char *path);
#endif
// Open a directory
//
// Once open a directory can be used with read to iterate over files.
// Returns a negative error code on failure.
int lfs_dir_open(lfs_t *lfs, lfs_dir_t *dir, const char *path);
// Close a directory
//
// Releases any allocated resources.
// Returns a negative error code on failure.
int lfs_dir_close(lfs_t *lfs, lfs_dir_t *dir);
// Read an entry in the directory
//
// Fills out the info structure, based on the specified file or directory.
// Returns a positive value on success, 0 at the end of directory,
// or a negative error code on failure.
int lfs_dir_read(lfs_t *lfs, lfs_dir_t *dir, struct lfs_info *info);
// Change the position of the directory
//
// The new off must be a value previous returned from tell and specifies
// an absolute offset in the directory seek.
//
// Returns a negative error code on failure.
int lfs_dir_seek(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off);
// Return the position of the directory
//
// The returned offset is only meant to be consumed by seek and may not make
// sense, but does indicate the current position in the directory iteration.
//
// Returns the position of the directory, or a negative error code on failure.
lfs_soff_t lfs_dir_tell(lfs_t *lfs, lfs_dir_t *dir);
// Change the position of the directory to the beginning of the directory
//
// Returns a negative error code on failure.
int lfs_dir_rewind(lfs_t *lfs, lfs_dir_t *dir);
/// Filesystem-level filesystem operations
// Finds the current size of the filesystem
//
// Note: Result is best effort. If files share COW structures, the returned
// size may be larger than the filesystem actually is.
//
// Returns the number of allocated blocks, or a negative error code on failure.
lfs_ssize_t lfs_fs_size(lfs_t *lfs);
// Traverse through all blocks in use by the filesystem
//
// The provided callback will be called with each block address that is
// currently in use by the filesystem. This can be used to determine which
// blocks are in use or how much of the storage is available.
//
// Returns a negative error code on failure.
int lfs_fs_traverse(lfs_t *lfs, int (*cb)(void*, lfs_block_t), void *data);
#ifndef LFS_READONLY
#ifdef LFS_MIGRATE
// Attempts to migrate a previous version of littlefs
//
// Behaves similarly to the lfs_format function. Attempts to mount
// the previous version of littlefs and update the filesystem so it can be
// mounted with the current version of littlefs.
//
// Requires a littlefs object and config struct. This clobbers the littlefs
// object, and does not leave the filesystem mounted. The config struct must
// be zeroed for defaults and backwards compatibility.
//
// Returns a negative error code on failure.
int lfs_migrate(lfs_t *lfs, const struct lfs_config *cfg);
#endif
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -0,0 +1,9 @@
#ifndef __OPENSDK_H__
#define __OPENSDK_H__
#define EXPORT_FUNC(fun)
#endif

View File

@ -0,0 +1,144 @@
#ifndef __OPENSDK_API_H__
#define __OPENSDK_API_H__
typedef uint32_t (*func0)(void);
typedef uint32_t (*func1)(uint32_t p1);
typedef uint32_t (*func2)(uint32_t p1, uint32_t p2);
typedef uint32_t (*func3)(uint32_t p1, uint32_t p2, uint32_t p3);
typedef uint32_t (*func4)(uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4);
typedef uint32_t (*funcx)(char *format, ...);
extern uint32_t gSyscallTable;
#ifdef FEATURE_SUBSYS_PCM_RECORD_ENABLE
#define audioRecordAdpcm ((func1)(*((uint32_t *)gSyscallTable + 659)))
#define audioRecordG726 ((func1)(*((uint32_t *)gSyscallTable + 658)))
#endif
#define audioPlayMp3 ((func4)(*((uint32_t *)gSyscallTable + 657)))
#define audioPlayWav ((func2)(*((uint32_t *)gSyscallTable + 656)))
#define audioPlayPcm ((func3)(*((uint32_t *)gSyscallTable + 655)))
#define audioPlayTts ((func2)(*((uint32_t *)gSyscallTable + 654)))
#define audioAdjustVolume ((func1)(*((uint32_t *)gSyscallTable + 653)))
#define audioIsReady ((func0)(*((uint32_t *)gSyscallTable + 652)))
#define audioIsBusy ((func0)(*((uint32_t *)gSyscallTable + 651)))
#define audioGetVolume ((func0)(*((uint32_t *)gSyscallTable + 650)))
#define mountApp ((func2)(*((uint32_t *)gSyscallTable + 641)))
#define setActiveApp ((func1)(*((uint32_t *)gSyscallTable + 640)))
#define file_remove ((func1)(*((uint32_t *)gSyscallTable + 623)))
#define file_fopen ((func2)(*((uint32_t *)gSyscallTable + 622)))
#define file_fclose ((func1)(*((uint32_t *)gSyscallTable + 621)))
#define file_fread ((func4)(*((uint32_t *)gSyscallTable + 620)))
#define file_fwrite ((func4)(*((uint32_t *)gSyscallTable + 619)))
#define file_fseek ((func3)(*((uint32_t *)gSyscallTable + 618)))
#define file_ftell ((func1)(*((uint32_t *)gSyscallTable + 617)))
#define file_rewind ((func1)(*((uint32_t *)gSyscallTable + 616)))
#define file_fstat ((func2)(*((uint32_t *)gSyscallTable + 615)))
#define file_truncate ((func2)(*((uint32_t *)gSyscallTable + 614)))
#define fsDirOpen ((func2)(*((uint32_t *)gSyscallTable + 613)))
#define fsDirClose ((func1)(*((uint32_t *)gSyscallTable + 612)))
#define fsDirRead ((func2)(*((uint32_t *)gSyscallTable + 611)))
#define fsStatFs ((func1)(*((uint32_t *)gSyscallTable + 610)))
#define globalmapInit ((func3)(*((uint32_t *)gSyscallTable + 602)))
#define globalItemSet ((func2)(*((uint32_t *)gSyscallTable + 601)))
#define globalItemGet ((func1)(*((uint32_t *)gSyscallTable + 600)))
#define slpManPlatVoteDisableSleep ((func2)(*((uint32_t *)gSyscallTable + 309)))
#define slpManPlatVoteEnableSleep ((func2)(*((uint32_t *)gSyscallTable + 308)))
#define slpManApplyPlatVoteHandle ((func2)(*((uint32_t *)gSyscallTable + 307)))
#define GPIO_pinRead ((func2)(*((uint32_t *)gSyscallTable + 306)))
#define GPIO_pinWrite ((func3)(*((uint32_t *)gSyscallTable + 305)))
#define GPIO_pinConfig ((func3)(*((uint32_t *)gSyscallTable + 304)))
#define PAD_setPinPullConfig ((func2)(*((uint32_t *)gSyscallTable + 303)))
#define PAD_setPinConfig ((func2)(*((uint32_t *)gSyscallTable + 302)))
#define PAD_getDefaultConfig ((func1)(*((uint32_t *)gSyscallTable + 301)))
#define pwrKeyStartPowerOff ((func0)(*((uint32_t *)gSyscallTable + 300)))
#define osKernelInitialize ((func0)(*((uint32_t *)gSyscallTable + 275)))
#define osKernelGetInfo ((func3)(*((uint32_t *)gSyscallTable + 274)))
#define osKernelGetState ((func0)(*((uint32_t *)gSyscallTable + 273)))
#define osKernelStart ((func0)(*((uint32_t *)gSyscallTable + 272)))
#define osKernelLock ((func0)(*((uint32_t *)gSyscallTable + 271)))
#define osKernelUnlock ((func0)(*((uint32_t *)gSyscallTable + 270)))
#define osKernelRestoreLock ((func1)(*((uint32_t *)gSyscallTable + 269)))
#define osKernelGetTickCount ((func0)(*((uint32_t *)gSyscallTable + 268)))
#define osTimerGetExpiryTime ((func1)(*((uint32_t *)gSyscallTable + 267)))
#define osKernelGetTickFreq ((func0)(*((uint32_t *)gSyscallTable + 266)))
#define osKernelGetSysTimerCount ((func0)(*((uint32_t *)gSyscallTable + 265)))
#define osKernelGetSysTimerFreq ((func0)(*((uint32_t *)gSyscallTable + 264)))
#define osThreadNew ((func3)(*((uint32_t *)gSyscallTable + 263)))
#define osThreadGetNumber ((func1)(*((uint32_t *)gSyscallTable + 262)))
#define osThreadGetName ((func1)(*((uint32_t *)gSyscallTable + 261)))
#define osThreadGetId ((func0)(*((uint32_t *)gSyscallTable + 260)))
#define osThreadGetState ((func1)(*((uint32_t *)gSyscallTable + 259)))
#define osThreadGetStackSpace ((func1)(*((uint32_t *)gSyscallTable + 258)))
#define osThreadSetPriority ((func2)(*((uint32_t *)gSyscallTable + 257)))
#define osThreadGetPriority ((func1)(*((uint32_t *)gSyscallTable + 256)))
#define osThreadYield ((func0)(*((uint32_t *)gSyscallTable + 255)))
#define osThreadSuspend ((func1)(*((uint32_t *)gSyscallTable + 254)))
#define osThreadIsSuspendAll ((func0)(*((uint32_t *)gSyscallTable + 253)))
#define osThreadResume ((func1)(*((uint32_t *)gSyscallTable + 252)))
#define osThreadSuspendAll ((func0)(*((uint32_t *)gSyscallTable + 251)))
#define osThreadResumeAll ((func0)(*((uint32_t *)gSyscallTable + 250)))
#define osThreadExit ((func0)(*((uint32_t *)gSyscallTable + 249)))
#define osThreadTerminate ((func1)(*((uint32_t *)gSyscallTable + 248)))
#define osThreadGetCount ((func0)(*((uint32_t *)gSyscallTable + 247)))
#define osThreadEnumerate ((func2)(*((uint32_t *)gSyscallTable + 246)))
#define osThreadFlagsSet ((func2)(*((uint32_t *)gSyscallTable + 245)))
#define osThreadFlagsClear ((func1)(*((uint32_t *)gSyscallTable + 244)))
#define osThreadFlagsGet ((func0)(*((uint32_t *)gSyscallTable + 243)))
#define osThreadFlagsWait ((func3)(*((uint32_t *)gSyscallTable + 242)))
#define osDelay ((func1)(*((uint32_t *)gSyscallTable + 241)))
#define osDelayUntil ((func1)(*((uint32_t *)gSyscallTable + 240)))
#define osTimerNew ((func4)(*((uint32_t *)gSyscallTable + 239)))
#define osTimerGetName ((func1)(*((uint32_t *)gSyscallTable + 238)))
#define osTimerStart ((func2)(*((uint32_t *)gSyscallTable + 237)))
#define osTimerStop ((func1)(*((uint32_t *)gSyscallTable + 236)))
#define osTimerIsRunning ((func1)(*((uint32_t *)gSyscallTable + 235)))
#define osTimerDelete ((func1)(*((uint32_t *)gSyscallTable + 234)))
#define osEventFlagsNew ((func1)(*((uint32_t *)gSyscallTable + 233)))
#define osEventFlagsSet ((func2)(*((uint32_t *)gSyscallTable + 232)))
#define osEventFlagsClear ((func2)(*((uint32_t *)gSyscallTable + 231)))
#define osEventFlagsGet ((func1)(*((uint32_t *)gSyscallTable + 230)))
#define osEventFlagsWait ((func4)(*((uint32_t *)gSyscallTable + 229)))
#define osEventFlagsDelete ((func1)(*((uint32_t *)gSyscallTable + 228)))
#define osMutexNew ((func1)(*((uint32_t *)gSyscallTable + 227)))
#define osMutexAcquire ((func2)(*((uint32_t *)gSyscallTable + 226)))
#define osMutexRelease ((func1)(*((uint32_t *)gSyscallTable + 225)))
#define osMutexGetOwner ((func1)(*((uint32_t *)gSyscallTable + 224)))
#define osMutexDelete ((func1)(*((uint32_t *)gSyscallTable + 223)))
#define osSemaphoreNew ((func3)(*((uint32_t *)gSyscallTable + 222)))
#define osSemaphoreAcquire ((func2)(*((uint32_t *)gSyscallTable + 221)))
#define osSemaphoreRelease ((func1)(*((uint32_t *)gSyscallTable + 220)))
#define osSemaphoreGetCount ((func1)(*((uint32_t *)gSyscallTable + 219)))
#define osSemaphoreDelete ((func1)(*((uint32_t *)gSyscallTable + 218)))
#define osMessageQueueNew ((func3)(*((uint32_t *)gSyscallTable + 217)))
#define osMessageQueuePut ((func4)(*((uint32_t *)gSyscallTable + 216)))
#define osMessageQueuePutToFront ((func4)(*((uint32_t *)gSyscallTable + 215)))
#define osMessageQueueGet ((func4)(*((uint32_t *)gSyscallTable + 214)))
#define osMessageQueueGetCapacity ((func1)(*((uint32_t *)gSyscallTable + 213)))
#define osMessageQueueGetMsgSize ((func1)(*((uint32_t *)gSyscallTable + 212)))
#define osMessageQueueGetCount ((func1)(*((uint32_t *)gSyscallTable + 211)))
#define osMessageQueueGetSpace ((func1)(*((uint32_t *)gSyscallTable + 210)))
#define osMessageQueueReset ((func1)(*((uint32_t *)gSyscallTable + 209)))
#define osMessageQueueDelete ((func1)(*((uint32_t *)gSyscallTable + 208)))
#define ostaskENTER_CRITICAL ((func0)(*((uint32_t *)gSyscallTable + 207)))
#define ostaskEXIT_CRITICAL ((func0)(*((uint32_t *)gSyscallTable + 206)))
#define ostaskENTER_CRITICAL_ISR ((func0)(*((uint32_t *)gSyscallTable + 205)))
#define ostaskEXIT_CRITICAL_ISR ((func1)(*((uint32_t *)gSyscallTable + 204)))
#define osIsInISRContext ((func0)(*((uint32_t *)gSyscallTable + 203)))
#define osTaskSetTimeOutState ((func1)(*((uint32_t *)gSyscallTable + 202)))
#define osTaskCheckForTimeOut ((func2)(*((uint32_t *)gSyscallTable + 201)))
#define osTaskGetFreeHeapSize ((func0)(*((uint32_t *)gSyscallTable + 200)))
#define printf ((funcx)(*((uint32_t *)gSyscallTable + 1)))
#define apiVersion ((uint32_t *)gSyscallTable)
#endif

View File

@ -0,0 +1,191 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of EigenComm Ltd.
* File name: pad.h
* Description: EC718 pad driver header file
* History:
*
****************************************************************************/
#ifndef _PAD_EC718_H_
#define _PAD_EC718_H_
#include "ec718.h"
#include "Driver_Common.h"
/**
\addtogroup pad_interface_gr
\{
*/
/*******************************************************************************
* Definitions
******************************************************************************/
/** \brief PAD pin mux selection */
typedef enum
{
PAD_MUX_ALT0 = 0U, /**< Chip-specific */
PAD_MUX_ALT1 = 1U, /**< Chip-specific */
PAD_MUX_ALT2 = 2U, /**< Chip-specific */
PAD_MUX_ALT3 = 3U, /**< Chip-specific */
PAD_MUX_ALT4 = 4U, /**< Chip-specific */
PAD_MUX_ALT5 = 5U, /**< Chip-specific */
PAD_MUX_ALT6 = 6U, /**< Chip-specific */
PAD_MUX_ALT7 = 7U, /**< Chip-specific */
} PadMux_e;
/** \brief Internal pull-up resistor configuration */
typedef enum
{
PAD_PULL_UP_DISABLE = 0U, /**< Internal pull-up resistor is disabled */
PAD_PULL_UP_ENABLE = 1U, /**< Internal pull-up resistor is enabled */
} PadPullUp_e;
/** \brief Internal pull-down resistor configuration */
typedef enum
{
PAD_PULL_DOWN_DISABLE = 0U, /**< Internal pull-down resistor is disabled */
PAD_PULL_DOWN_ENABLE = 1U, /**< Internal pull-down resistor is enabled */
} PadPullDown_e;
/** \brief Pull feature selection */
typedef enum
{
PAD_PULL_AUTO = 0U, /**< Pull up/down is controlled by muxed alt function signal, i.e. I2C SCL */
PAD_PULL_INTERNAL = 1U, /**< Use internal pull-up/down resistor */
} PadPullSel_e;
/** \brief Input buffer enable/disable */
typedef enum
{
PAD_INPUT_CONTROL_AUTO = 0U, /**< Input is controlled by muxed alt function signal, i.e. I2C SCL */
PAD_INPUT_CONTROL_SW_ON = 1U, /**< Input is forced enable */
} PadInputControl_e;
/** \brief Output enable/disable */
typedef enum
{
PAD_OUTPUT_CONTROL_AUTO = 0U, /**< Output is controlled by muxed alt function signal, i.e. I2C SCL */
PAD_OUTPUT_CONTROL_SW_ON = 1U, /**< Output is forced enable */
} PadOutputControl_e;
/** \brief Configures pull feature */
typedef enum
{
PAD_INTERNAL_PULL_UP = 0U, /**< select internal pull up */
PAD_INTERNAL_PULL_DOWN = 1U, /**< select internal pull down */
PAD_AUTO_PULL = 2U, /**< Pull up/down is controlled by muxed alt function signal, i.e. I2C SCL */
} PadPullConfig_e;
/** \brief Drive strength configuration */
typedef enum
{
PAD_DRIVE_STRENGTH_LOW = 0U, /**< Drive strength is low */
PAD_DRIVE_STRENGTH_HIGH = 1U, /**< Drive strength is high */
} PadDriveStrength_e;
/** \brief PAD configuration structure */
typedef struct
{
uint32_t : 4;
uint32_t mux : 3; /**< Pad mux configuration */
uint32_t : 1;
uint32_t pullUpEnable : 1; /**< Enable pull-up */
uint32_t pullDownEnable : 1; /**< Enable pull-down */
uint32_t pullSelect : 1; /**< Pull select, external or internal control */
uint32_t inputForceDisable : 1; /**< Force to disable input or not, if true, input path is cut off, otherwise, it's controlled by inputControl bit */
uint32_t : 1;
uint32_t inputControl : 1; /**< Input enable, 'force' on or controlled by muxed alt function signal, i.e. I2C SCL */
uint32_t outputControl : 1; /**< Output enable, 'force' on or controlled by muxed alt function signal, i.e. I2C SCL */
uint32_t outputForceDisable : 1; /**< Force to disable output or not, if true, output path is cut off, otherwise, it's controlled by outputControl bit */
uint32_t : 1;
uint32_t driveStrength : 1;
uint32_t : 12;
uint32_t swOutputValue : 1;
uint32_t swOutputEnable : 1; /** Control to overwrite function signal's output or not, if set to ture, the pad's output is determined by swOutputValue bit */
} PadConfig_t;
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
/** \name PAD Driver Initialization */
/** \{ */
/**
\fn void PAD_driverInit(void);
\brief Intialize PAD driver internal data, must be called before any other APIs
*/
void PAD_driverInit(void);
/**
\fn void PAD_driverInit(void);
\brief De-Intialize PAD driver, disable PAD clock and perform some clearups
*/
void PAD_driverDeInit(void);
/** \} */
/** \name Configuration */
/* \{ */
/**
\fn void PAD_getDefaultConfig(PadConfig_t *config)
\brief Gets the PAD default configuartion
This function sets the configuration structure to default values as below:
\code
config->mux = PAD_MUX_ALT0;
config->inputControl = PAD_INPUT_CONTROL_AUTO;
config->inputForceDisable = 0;
config->outputForceDisable = 0;
config->outputControl = PAD_OUTPUT_CONTROL_AUTO;
config->swOutputEnable = 0;
config->swOutputValue = 0;
config->pullSelect = PAD_PULL_AUTO;
config->pullUpEnable = PAD_PULL_UP_DISABLE;
config->pullDownEnable = PAD_PULL_DOWN_DISABLE;
config->driveStrength = PAD_DRIVE_STRENGTH_HIGH;
\endcode
\param config Pointer to PAD configuration structure
*/
void PAD_getDefaultConfig(PadConfig_t *config);
/**
\fn void PAD_setPinConfig(uint32_t pin, const PadConfig_t *config)
\brief Sets the pad PCR register
\param pin PAD pin number
\param config Pointer to PAD configuration structure
*/
void PAD_setPinConfig(uint32_t paddr, const PadConfig_t *config);
/**
\fn void PAD_setPinMux(uint32_t pin, PadMux_e mux)
\brief Configures pin mux
\param pin PAD pin number
\param mux pin signal source selection
*/
void PAD_setPinMux(uint32_t paddr, PadMux_e mux);
/**
\fn void PAD_setPinPullConfig(uint32_t pin, PadPullConfig_e config)
\brief Configures pin's pull feature
\param pin PAD pin number
\param config PAD pin pull configuration
*/
void PAD_setPinPullConfig(uint32_t paddr, PadPullConfig_e config);
/** \} */
/** \}*/
#if defined(__cplusplus)
}
#endif
#endif /* _PAD_EC718_H_ */

View File

@ -0,0 +1,32 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of EigenComm Ltd.
* File name: slp_manager.h
* Description: EC718 platform sleep management header file
* History: 09/28/2018 Originated by wqzhao
*
****************************************************************************/
#ifndef SLP_MANAGER_H
#define SLP_MANAGER_H
/**
\brief enum of sleep status for voting. we should always try to vote a higher status for power saving.
*/
typedef enum
{
SLP_ACTIVE_STATE = 0, /**< active state */
SLP_IDLE_STATE, /**< idle state */
SLP_SLP1_STATE, /**< sleep1 state */
SLP_SLP2_STATE, /**< sleep2 state */
SLP_HIB_STATE, /**< hibernate state */
SLP_STATE_MAX
}slpManSlpState_t;
#endif

View File

@ -0,0 +1,41 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of EigenComm Ltd.
* File name: status.h
* Description: EC718 at command demo entry header file
* History: Rev1.0 2018-07-12
*
****************************************************************************/
#ifndef SUBSYS_STATUS_H
#define SUBSYS_STATUS_H
#ifdef __cplusplus
extern "C" {
#endif
#define SIM_UNKNOWN 0
#define SIM_READY 1
#define SIM_REMOVED 2
typedef struct
{
uint32_t batteryVoltage : 23;
uint32_t batteryLevel : 7;
uint32_t batteryCharge : 2;
uint32_t simStatus : 2;
uint32_t nwReady : 1;
uint32_t serverReady : 1;
uint32_t reserved : 4;
uint32_t csqLevel : 8;
uint32_t rssi : 16;
char time[6];
} StatusT;
#ifdef __cplusplus
}
#endif
#endif /* SUBSYS_STATUS_H */

View File

@ -0,0 +1,30 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of EigenComm Ltd.
* File name: storage.h
* Description: EC718 at command demo entry header file
* History: Rev1.0 2018-07-12
*
****************************************************************************/
#ifndef SUBSYS_STORAGE_H
#define SUBSYS_STORAGE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#ifdef __cplusplus
}
#endif
#endif /* SUBSYS_STORAGE_H */

View File

@ -0,0 +1,23 @@
LIB1_DIR := $(TOP)/libs/lib1
CFLAGS_INC += -I $(LIB1_DIR)/inc
LIB1_SRC_DIRS += $(LIB1_DIR)/src
LIB1_EXCLUDE_FILES :=
LIB1_CSRC = $(foreach dir, $(LIB1_SRC_DIRS), $(wildcard $(dir)/*.c))
LIB1_CFILES = $(filter-out $(LIB1_EXCLUDE_FILES), $(LIB1_CSRC))
LIB1_COBJSTEMP := $(patsubst %.c, %.o, $(LIB1_CFILES))
LIB1_COBJSTEMP :=$(subst $(LIB1_DIR),libs/lib1,$(LIB1_COBJSTEMP))
LIB1_COBJS := $(addprefix $(BUILDDIR)/, $(LIB1_COBJSTEMP))
ifeq ($(TOOLCHAIN),GCC)
lib-y += lib1.a
$(BUILDDIR)/lib/lib1.a: $(LIB1_COBJS)
@mkdir.exe -p $(dir $@)
$(ECHO) AR $@
$(Q)$(AR) -cr $@ $^
endif

View File

@ -0,0 +1,15 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
void ttt()
{
char *endptr;
char a[] = "12345.6789";
char b[] = "1234.567qwer";
char c[] = "-232.23e4";
printf( "a=%lf\n", strtod(a,NULL) );
printf( "b=%lf\n", strtod(b,&endptr) );
printf( "endptr=%s\n", endptr );
printf( "c=%lf\n", strtod(c,NULL) );
}

View File

@ -0,0 +1,93 @@
# default target
all::
include $(TOP)/script/Makefile.vars
BUILDDIR ?= $(TOP)/gccout/$(PROJECT)
LIBDIR ?= $(TOP)/libs
#-------------------------------------------------------------------------------
# Rules
#-------------------------------------------------------------------------------
ifeq ($(APP_LIB1_SUPPORT),y)
include $(LIBDIR)/lib1/Makefile.inc
endif
vpath %.c $(TOP)
vpath %.s $(TOP)
vpath %.S $(TOP)
OBJS := $(addprefix $(BUILDDIR)/, $(obj-y))
LIBS := $(addprefix $(BUILDDIR)/lib/,$(lib-y))
.PHONY: all build clean size cleanall
all:: build
ifeq ($(TOOLCHAIN),GCC)
build: $(BUILDDIR)/$(BINNAME).elf \
$(BUILDDIR)/$(BINNAME).symbols \
$(BUILDDIR)/$(BINNAME).bin \
$(BUILDDIR)/$(BINNAME).size
$(BUILDDIR):
@mkdir -p $(BUILDDIR)
$(LIBDIR):
@mkdir -p $(LIBDIR)
$(BUILDDIR)/%.sc: %.c
@mkdir -p $(dir $@)
@cp $< $@
$(BUILDDIR)/%.o: %.c
$(ECHO) CC $<
@mkdir.exe -p $(dir $@)
$(Q)$(CC) $(CFLAGS) $(CFLAGS_CPU) $(CFLAGS_INC) $(CFLAGS_DEFS) $(DEPFLAGS) -c $< -o $@
#overwrite implicit rule
%.o: %.c
@mkdir -p $(dir $@)
$(ECHO) CC $<
$(Q)$(CC) $(CFLAGS) $(CFLAGS_CPU) $(CFLAGS_INC) $(CFLAGS_DEFS) $(DEPFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: %.s
@mkdir -p $(dir $@)
$(ECHO) ASM $<
$(Q)$(CC) $(CFLAGS_ASM) $(CFLAGS_CPU) $(CFLAGS_INC) $(CFLAGS_DEFS) $(DEPFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: %.S
@mkdir -p $(dir $@)
$(ECHO) ASM $<
$(Q)$(CC) $(CFLAGS) $(CFLAGS_CPU) $(CFLAGS_INC) $(CFLAGS_DEFS) $(DEPFLAGS) -c $< -o $@
$(BUILDDIR)/$(BINNAME).elf: $(OBJS) $(LIBS)
$(ECHO) LINK $@
$(Q)$(CC) $(CFLAGS_CPU) $(CFLAGS_DEFS) -E -P - <$(LD_FILE) -o $(BUILDDIR)/$(PROJECT).lds
$(Q)$(LD) -u _scanf_float -u _printf_float -T $(BUILDDIR)/$(PROJECT).lds -o $(BUILDDIR)/$(PROJECT).elf $(OBJS) $(LIBS) $(GCCLIB1_PATH)/libgcc.a $(GCCLIB2_PATH)/libc_nano.a $(GCCLIB2_PATH)/libm.a -Wl,-Map=$(BUILDDIR)/$(PROJECT).map
$(BUILDDIR)/$(BINNAME).symbols: $(BUILDDIR)/$(BINNAME).elf
$(Q)$(NM) --size-sort --print-size -r $< >$@
$(BUILDDIR)/$(BINNAME).bin: $(BUILDDIR)/$(BINNAME).elf
$(ECHO) OBJCOPY $@
$(Q)$(OBJCOPY) -O binary $< $@
$(Q)$(OBJCOPY) -O verilog $< $(@:.bin=.hex)
@$(OBJDUMP) -d -h $< > $(BUILDDIR)/$(BINNAME).txt
@$(SIZE) $(OBJECTS) $<
$(BUILDDIR)/$(BINNAME).size: $(BUILDDIR)/$(BINNAME).elf
@$(OBJDUMP) -h $< > $@
@$(SIZE) -G $< >> $@
@$(foreach lib, $(LIBS), $(SIZE) $(lib) -t -G >> $@;)
clean:
@rm -rf $(BUILDDIR)
cleanall:
@rm -rf $(TOP)/PLAT/gccout/$(OUTTARGET) $(TOP)/PLAT/middleware/developed/debug/inc/debug_log_*p.h
size: $(BUILDDIR)/$(BINNAME).elf
@$(SIZE) $(OBJECTS) $(BUILDDIR)/$(BINNAME).elf
endif

View File

@ -0,0 +1,44 @@
# Tool suffix when cross-compiling
GCC_PATH ?= C:/gcc
GCCLIB1_PATH ?=$(GCC_PATH)/lib/gcc/arm-none-eabi/10.2.1/thumb/v7-m/nofp
GCCLIB2_PATH ?= $(GCC_PATH)/arm-none-eabi/lib/thumb/v7-m/nofp
CROSS_COMPILE := $(GCC_PATH)/bin/arm-none-eabi-
# Compilation tools
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)gcc
SIZE = $(CROSS_COMPILE)size
STRIP = $(CROSS_COMPILE)strip
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
GDB = $(CROSS_COMPILE)gdb
NM = $(CROSS_COMPILE)gcc-nm
AR = $(CROSS_COMPILE)gcc-ar
Q :=
ECHO := @echo
# Setup compilation params
CFLAGS_CPU ?= -mcpu=cortex-m3 -mthumb
CFLAGS_OPTION ?= -std=gnu99 -nostartfiles -mapcs-frame -specs=nano.specs
CFLAGS_OPTIMIZE ?= -Os -ffunction-sections -fdata-sections -fno-isolate-erroneous-paths-dereference -freorder-blocks-algorithm=stc
CFLAGS_ANALYSIS ?= #-fanalyzer
CFLAGS_WARNING ?= -Wall -Wno-format
# compiler flags
CFLAGS += $(CFLAGS_CPU) $(CFLAGS_OPTION) $(CFLAGS_OPTIMIZE) $(CFLAGS_WARNING) $(CFLAGS_ANALYSIS) -D__CURRENT_FILE_NAME__=$(basename $(@F))
CFLAGS_ASM = -Wall -D__ASSEMBLY__ -mthumb -gdwarf-2 #-mthumb-interwork
CFLAGS_DEFS += -DSOFTPACK_VERSION="\"$(SOFTPACK_VERSION)\"" -DHAVE_STRUCT_TIMESPEC
DEPFLAGS = -MMD -MP -MT $(basename $@).o -MF $(basename $@).d
# linker flags
LDFLAGS = --print-memory-usage
LDFLAGS += -L $(TOP)/apps/$(PROJECT)

View File

@ -0,0 +1,56 @@
import os
import sys
import shutil
import struct
def update_file(path, list_value):
content = bytes()
for value in list_value:
content = content + value
if os.path.exists(path):
file = open(path, mode='rb')
content = content + file.read()
file.close()
file = open(os.path.dirname(path) + '/pack.app', mode='wb')
file.write(content)
file.close()
else:
print('Error: ' + path + ' is not exists.')
def main():
root = os.path.dirname(os.path.realpath(__file__)) + '/../../..'
path = root + '/PLAT/appsdk/gccout/speaker/speaker.bin'
appAddress = 0x00B81000
headLength = 80
name = b'app0' + bytes(4)
size = struct.pack('I', os.path.getsize(path))
reserved0 = bytes(4)
reserved1 = bytes(16)
textOffset = struct.pack('I', headLength)
textSize = struct.pack('I', os.path.getsize(path))
textRelocation = struct.pack('I', appAddress + headLength)
dataOffset = bytes(4)
dataSize = bytes(4)
dataRelocation = bytes(4)
resourceOffset = bytes(4)
resourceSize = bytes(4)
resourceRelocation = bytes(4)
reserved3 = bytes(12)
list_value = [name, size, reserved0, reserved1, textOffset, textSize, textRelocation, dataOffset, dataSize, dataRelocation, resourceOffset, resourceSize, resourceRelocation, reserved3]
update_file(path, list_value)
if __name__ == '__main__':
file_name = os.path.basename(__file__)
print(file_name, 'begin')
main()
print(file_name, 'end')

View File

@ -0,0 +1,32 @@
del *.o
del *.elf
del *.bin
del *.map
del *.txt
del pack.app
set GCCLIB_PATH=C:/gcc
set CROSS_COMPILE=%GCCLIB_PATH%/bin/arm-none-eabi-
set CC=%CROSS_COMPILE%gcc
set LD=%CROSS_COMPILE%ld
set SIZE=%CROSS_COMPILE%size
set OBJCOPY=%CROSS_COMPILE%objcopy
set OBJDUMP=%CROSS_COMPILE%objdump
set READELF=%CROSS_COMPILE%readelf
set LIB1_PATH=%GCCLIB_PATH%/lib/gcc/arm-none-eabi/10.2.1
set LIB2_PATH=%GCCLIB_PATH%/arm-none-eabi/lib
set SCRIPT_PATH=script
%CC% -fPIC -g -Wl,--gc-sections -gstabs+ -c -Os -ffunction-sections -fdata-sections -mcpu=cortex-m3 -mthumb -D__thumb2__ -I inc -I build\incs -D__ARMGCC --specs=nano.specs -c main.c
%LD% -print-memory-usage -T test.ld -o test.elf main.o %LIB1_PATH%/libgcc.a %LIB2_PATH%/libc_nano.a %LIB2_PATH%/libm.a -Map test.map
python %SCRIPT_PATH%/elfpy.py
%CC% -fno-builtin -fPIC -g -Wl,--gc-sections -gstabs+ -c -Os -ffunction-sections -fdata-sections -mcpu=cortex-m3 -mthumb -D__thumb2__ -I inc -I build\incs -D__ARMGCC --specs=nano.specs -c main.c
%LD% -print-memory-usage -T test.ld -o test.elf main.o %LIB1_PATH%/libgcc.a %LIB2_PATH%/libc_nano.a %LIB2_PATH%/libm.a -Map test.map
%SIZE% test.elf
%OBJCOPY% -O binary -S test.elf main.bin
%READELF% -s test.elf test.info
%OBJDUMP% -d -h test.elf > test.txt
python %SCRIPT_PATH%/elfpy.py
python %SCRIPT_PATH%/pack_app.py
pause

View File

@ -0,0 +1,70 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of EigenComm Ltd.
* File name: app.h
* Description: EC718 at command demo entry header file
* History: Rev1.0 2018-07-12
*
****************************************************************************/
#ifndef SUBSYS_APP_H
#define SUBSYS_APP_H
#ifdef __cplusplus
extern "C" {
#endif
typedef enum
{
APP_TP_MSG = 10,
APP_KEY_MSG = 20,
APP_STAT_MSG = 30,
APP_USER_MSG = 40,
} AppMsgTypeT;
typedef struct __App_Point_t
{
int32_t appActived;
int32_t appStatus;
int32_t initStatus;
} AppPointT;
typedef struct __App_Msg_t
{
uint32_t* wndh;
AppMsgTypeT msgType;
int32_t param1;
int32_t param2;
uint32_t *param3;
int32_t time;
AppPointT pt;
} AppMsgT;
typedef struct __App_Info_t
{
int32_t id;
int32_t appActived;
int32_t appStatus;
int32_t initStatus;
} AppInfoT;
typedef struct __App_t
{
AppInfoT* info;
uint32_t* wndh;
int32_t (*init)(AppInfoT *appInfo, uint32_t reserved1, uint32_t reserved2, uint32_t syscallTable);
int32_t (*preDraw)();
int32_t (*msgProc)(AppInfoT *appInfo,AppMsgT *msg, uint32_t reserved2, uint32_t syscallTable);
int32_t (*afterDraw)();
int32_t (*destory)();
} AppT;
int32_t mountApp(AppT* appPtr,int32_t slot);
int32_t setActiveApp(int32_t slot);
#ifdef __cplusplus
}
#endif
#endif /* SUBSYS_APP_H */

View File

@ -0,0 +1,59 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of EigenComm Ltd.
* File name: audio.h
* Description: EC618 mqtt demo entry header file
* History: Rev1.0 2018-07-12
*
****************************************************************************/
#ifndef __AUDIO_H__
#define __AUDIO_H__
#include <stdint.h>
#include <stdbool.h>
#define FEATURE_SUBSYS_AUDIO_ENABLE
#define FEATURE_SUBSYS_MP3_ENABLE
#define WELCOME_SOUND "D:/Welcome.mp3"
#define POWER_SOUND_OFF "D:/PowerOff.mp3"
#define SIM_SOUND_UNREADY "D:/SimUnready.mp3"
#define NW_SOUND_READY "D:/NwReady.mp3"
#define NW_SOUND_UNREADY "D:/NwUnready.mp3"
#define SERVER_SOUND_READY "D:/ServerReady.mp3"
#define SERVER_SOUND_UNREADY "D:/ServerUnready.mp3"
#define VOLUME_SOUND_MIN "D:/VolumeMin.mp3"
#define VOLUME_SOUND_MAX "D:/VolumeMax.mp3"
#define VOLUME_SOUND_MINUS "D:/VolumeMinus.mp3"
#define VOLUME_SOUND_PLUS "D:/VolumePlus.mp3"
#define BATTRY_SOUND_100 "D:/Battery100.mp3"
#define BATTRY_SOUND_75 "D:/Battery75.mp3"
#define BATTRY_SOUND_50 "D:/Battery50.mp3"
#define BATTRY_SOUND_25 "D:/Battery25.mp3"
#define BATTRY_SOUND_LOW "D:/BatteryLow.mp3"
#define CHARGE_SOUND_BEGIN "D:/ChargeBegin.mp3"
#define CHARGE_SOUND_END "D:/ChargeEnd.mp3"
#ifdef FEATURE_SUBSYS_PCM_RECORD_ENABLE
#define RECORD_SOUND "D:/Record.wav"
#endif
typedef void (*AudioCallbackT)(void);
typedef enum
{
ACTION_VOLUME_PLUS_SHORT = 0,
ACTION_VOLUME_PLUS_LONG = 1,
ACTION_VOLUME_MINUS_SHORT = 2,
ACTION_VOLUME_MINUS_LONG = 3,
ACTION_MENU_SHORT = 4,
ACTION_MENU_LONG = 5,
ACTION_INVALID
} ActionT;
#endif

View File

@ -0,0 +1,57 @@
/******************************************************************************
*(C) Copyright 2018 EIGENCOMM International Ltd.
* All Rights Reserved
******************************************************************************
* Filename: charge.h
*
* Description: header of charge.c. api for charge status detect
*
* History: 2021.05.07 initiated by Zhao Weiqi
*
* Notes:
*
******************************************************************************/
#ifndef CHARGE_H
#define CHARGE_H
/*----------------------------------------------------------------------------*
* INCLUDES *
*----------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif
/*----------------------------------------------------------------------------*
* MACROS *
*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*
* DATA TYPE DEFINITION *
*----------------------------------------------------------------------------*/
typedef enum
{
CHARGE_STATUS_DISCONNECT = 0,
CHARGE_STATUS_CHARGING = 1,
CHARGE_STATUS_FINISH = 2,
}chargeStatus_e;
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,808 @@
/*
* Copyright (c) 2013-2017 ARM Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ----------------------------------------------------------------------
*
* $Date: 9. June 2017
* $Revision: V2.1.1
*
* Project: CMSIS-RTOS2 API
* Title: cmsis_os2.h header file
*
* Version 2.1.1
* Additional functions allowed to be called from Interrupt Service Routines:
* - osKernelGetTickCount, osKernelGetTickFreq
* Changed Kernel Tick type to uint32_t:
* - updated: osKernelGetTickCount, osDelayUntil
* Version 2.1.0
* Support for critical and uncritical sections (nesting safe):
* - updated: osKernelLock, osKernelUnlock
* - added: osKernelRestoreLock
* Updated Thread and Event Flags:
* - changed flags parameter and return type from int32_t to uint32_t
* Version 2.0.0
* Initial Release
*---------------------------------------------------------------------------*/
#ifndef CMSIS_OS2_H_
#define CMSIS_OS2_H_
#ifndef __NO_RETURN
#if defined(__CC_ARM)
#define __NO_RETURN __declspec(noreturn)
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#define __NO_RETURN __attribute__((noreturn))
#elif defined(__GNUC__)
#define __NO_RETURN __attribute__((noreturn))
#elif defined(__ICCARM__)
#define __NO_RETURN __noreturn
#else
#define __NO_RETURN
#endif
#endif
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C"
{
#endif
// ==== Enumerations, structures, defines ====
/// Version information.
typedef struct {
uint32_t api; ///< API version (major.minor.rev: mmnnnrrrr dec).
uint32_t kernel; ///< Kernel version (major.minor.rev: mmnnnrrrr dec).
} osVersion_t;
/// Kernel state.
typedef enum {
osKernelInactive = 0, ///< Inactive.
osKernelReady = 1, ///< Ready.
osKernelRunning = 2, ///< Running.
osKernelLocked = 3, ///< Locked.
osKernelSuspended = 4, ///< Suspended.
osKernelError = -1, ///< Error.
osKernelReserved = 0x7FFFFFFFU ///< Prevents enum down-size compiler optimization.
} osKernelState_t;
/// Thread state.
typedef enum {
osThreadInactive = 0, ///< Inactive.
osThreadReady = 1, ///< Ready.
osThreadRunning = 2, ///< Running.
osThreadBlocked = 3, ///< Blocked.
osThreadTerminated = 4, ///< Terminated.
osThreadError = -1, ///< Error.
osThreadReserved = 0x7FFFFFFF ///< Prevents enum down-size compiler optimization.
} osThreadState_t;
/// Priority values.
typedef enum {
osPriorityNone = 0, ///< No priority (not initialized).
osPriorityIdle = 1, ///< Reserved for Idle thread.
osPriorityLow = 8, ///< Priority: low
osPriorityLow1 = 8+1, ///< Priority: low + 1
osPriorityLow2 = 8+2, ///< Priority: low + 2
osPriorityLow3 = 8+3, ///< Priority: low + 3
osPriorityLow4 = 8+4, ///< Priority: low + 4
osPriorityLow5 = 8+5, ///< Priority: low + 5
osPriorityLow6 = 8+6, ///< Priority: low + 6
osPriorityLow7 = 8+7, ///< Priority: low + 7
osPriorityBelowNormal = 16, ///< Priority: below normal
osPriorityBelowNormal1 = 16+1, ///< Priority: below normal + 1
osPriorityBelowNormal2 = 16+2, ///< Priority: below normal + 2
osPriorityBelowNormal3 = 16+3, ///< Priority: below normal + 3
osPriorityBelowNormal4 = 16+4, ///< Priority: below normal + 4
osPriorityBelowNormal5 = 16+5, ///< Priority: below normal + 5
osPriorityBelowNormal6 = 16+6, ///< Priority: below normal + 6
osPriorityBelowNormal7 = 16+7, ///< Priority: below normal + 7
osPriorityNormal = 24, ///< Priority: normal
osPriorityNormal1 = 24+1, ///< Priority: normal + 1
osPriorityNormal2 = 24+2, ///< Priority: normal + 2
osPriorityNormal3 = 24+3, ///< Priority: normal + 3
osPriorityNormal4 = 24+4, ///< Priority: normal + 4
osPriorityNormal5 = 24+5, ///< Priority: normal + 5
osPriorityNormal6 = 24+6, ///< Priority: normal + 6
osPriorityNormal7 = 24+7, ///< Priority: normal + 7
osPriorityAboveNormal = 32, ///< Priority: above normal
osPriorityAboveNormal1 = 32+1, ///< Priority: above normal + 1
osPriorityAboveNormal2 = 32+2, ///< Priority: above normal + 2
osPriorityAboveNormal3 = 32+3, ///< Priority: above normal + 3
osPriorityAboveNormal4 = 32+4, ///< Priority: above normal + 4
osPriorityAboveNormal5 = 32+5, ///< Priority: above normal + 5
osPriorityAboveNormal6 = 32+6, ///< Priority: above normal + 6
osPriorityAboveNormal7 = 32+7, ///< Priority: above normal + 7
osPriorityHigh = 40, ///< Priority: high
osPriorityHigh1 = 40+1, ///< Priority: high + 1
osPriorityHigh2 = 40+2, ///< Priority: high + 2
osPriorityHigh3 = 40+3, ///< Priority: high + 3
osPriorityHigh4 = 40+4, ///< Priority: high + 4
osPriorityHigh5 = 40+5, ///< Priority: high + 5
osPriorityHigh6 = 40+6, ///< Priority: high + 6
osPriorityHigh7 = 40+7, ///< Priority: high + 7
osPriorityRealtime = 48, ///< Priority: realtime
osPriorityRealtime1 = 48+1, ///< Priority: realtime + 1
osPriorityRealtime2 = 48+2, ///< Priority: realtime + 2
osPriorityRealtime3 = 48+3, ///< Priority: realtime + 3
osPriorityRealtime4 = 48+4, ///< Priority: realtime + 4
osPriorityRealtime5 = 48+5, ///< Priority: realtime + 5
osPriorityRealtime6 = 48+6, ///< Priority: realtime + 6
osPriorityRealtime7 = 48+7, ///< Priority: realtime + 7
osPriorityISR = 56, ///< Reserved for ISR deferred thread.
osPriorityError = -1, ///< System cannot determine priority or illegal priority.
osPriorityReserved = 0x7FFFFFFF ///< Prevents enum down-size compiler optimization.
} osPriority_t;
/// Entry point of a thread.
typedef void (*osThreadFunc_t) (void *argument);
/// Timer callback function.
typedef void (*osTimerFunc_t) (void *argument);
/// Timer type.
typedef enum {
osTimerOnce = 0, ///< One-shot timer.
osTimerPeriodic = 1 ///< Repeating timer.
} osTimerType_t;
// Timeout value.
#define osWaitForever 0xFFFFFFFFU ///< Wait forever timeout value.
// Flags options (\ref osThreadFlagsWait and \ref osEventFlagsWait).
#define osFlagsWaitAny 0x00000000U ///< Wait for any flag (default).
#define osFlagsWaitAll 0x00000001U ///< Wait for all flags.
#define osFlagsNoClear 0x00000002U ///< Do not clear flags which have been specified to wait for.
// Flags errors (returned by osThreadFlagsXxxx and osEventFlagsXxxx).
#define osFlagsError 0x80000000U ///< Error indicator.
#define osFlagsErrorUnknown 0xFFFFFFFFU ///< osError (-1).
#define osFlagsErrorTimeout 0xFFFFFFFEU ///< osErrorTimeout (-2).
#define osFlagsErrorResource 0xFFFFFFFDU ///< osErrorResource (-3).
#define osFlagsErrorParameter 0xFFFFFFFCU ///< osErrorParameter (-4).
#define osFlagsErrorISR 0xFFFFFFFAU ///< osErrorISR (-6).
// Thread attributes (attr_bits in \ref osThreadAttr_t).
#define osThreadDetached 0x00000000U ///< Thread created in detached mode (default)
#define osThreadJoinable 0x00000001U ///< Thread created in joinable mode
// Mutex attributes (attr_bits in \ref osMutexAttr_t).
#define osMutexRecursive 0x00000001U ///< Recursive mutex.
#define osMutexPrioInherit 0x00000002U ///< Priority inherit protocol.
#define osMutexRobust 0x00000008U ///< Robust mutex.
/// Status code values returned by CMSIS-RTOS functions.
typedef enum {
osOK = 0, ///< Operation completed successfully.
osError = -1, ///< Unspecified RTOS error: run-time error but no other error message fits.
osErrorTimeout = -2, ///< Operation not completed within the timeout period.
osErrorResource = -3, ///< Resource not available.
osErrorParameter = -4, ///< Parameter error.
osErrorNoMemory = -5, ///< System is out of memory: it was impossible to allocate or reserve memory for the operation.
osErrorISR = -6, ///< Not allowed in ISR context: the function cannot be called from interrupt service routines.
osStatusReserved = 0x7FFFFFFF ///< Prevents enum down-size compiler optimization.
} osStatus_t;
/// \details Thread ID identifies the thread.
typedef void *osThreadId_t;
/// \details Timer ID identifies the timer.
typedef void *osTimerId_t;
/// \details Event Flags ID identifies the event flags.
typedef void *osEventFlagsId_t;
/// \details Mutex ID identifies the mutex.
typedef void *osMutexId_t;
/// \details Semaphore ID identifies the semaphore.
typedef void *osSemaphoreId_t;
/// \details Memory Pool ID identifies the memory pool.
typedef void *osMemoryPoolId_t;
/// \details Message Queue ID identifies the message queue.
typedef void *osMessageQueueId_t;
#ifndef TZ_MODULEID_T
#define TZ_MODULEID_T
/// \details Data type that identifies secure software modules called by a process.
typedef uint32_t TZ_ModuleId_t;
#endif
/// Attributes structure for thread.
typedef struct {
const char *name; ///< name of the thread
uint32_t attr_bits; ///< attribute bits
void *cb_mem; ///< memory for control block
uint32_t cb_size; ///< size of provided memory for control block
void *stack_mem; ///< memory for stack
uint32_t stack_size; ///< size of stack
osPriority_t priority; ///< initial thread priority (default: osPriorityNormal)
TZ_ModuleId_t tz_module; ///< TrustZone module identifier
uint32_t reserved; ///< reserved (must be 0)
} osThreadAttr_t;
/// Attributes structure for timer.
typedef struct {
const char *name; ///< name of the timer
uint32_t attr_bits; ///< attribute bits
void *cb_mem; ///< memory for control block
uint32_t cb_size; ///< size of provided memory for control block
} osTimerAttr_t;
/// Attributes structure for event flags.
typedef struct {
const char *name; ///< name of the event flags
uint32_t attr_bits; ///< attribute bits
void *cb_mem; ///< memory for control block
uint32_t cb_size; ///< size of provided memory for control block
} osEventFlagsAttr_t;
/// Attributes structure for mutex.
typedef struct {
const char *name; ///< name of the mutex
uint32_t attr_bits; ///< attribute bits
void *cb_mem; ///< memory for control block
uint32_t cb_size; ///< size of provided memory for control block
} osMutexAttr_t;
/// Attributes structure for semaphore.
typedef struct {
const char *name; ///< name of the semaphore
uint32_t attr_bits; ///< attribute bits
void *cb_mem; ///< memory for control block
uint32_t cb_size; ///< size of provided memory for control block
} osSemaphoreAttr_t;
/// Attributes structure for memory pool.
typedef struct {
const char *name; ///< name of the memory pool
uint32_t attr_bits; ///< attribute bits
void *cb_mem; ///< memory for control block
uint32_t cb_size; ///< size of provided memory for control block
void *mp_mem; ///< memory for data storage
uint32_t mp_size; ///< size of provided memory for data storage
} osMemoryPoolAttr_t;
/// Attributes structure for message queue.
typedef struct {
const char *name; ///< name of the message queue
uint32_t attr_bits; ///< attribute bits
void *cb_mem; ///< memory for control block
uint32_t cb_size; ///< size of provided memory for control block
void *mq_mem; ///< memory for data storage
uint32_t mq_size; ///< size of provided memory for data storage
} osMessageQueueAttr_t;
// ==== Kernel Management Functions ====
/// Initialize the RTOS Kernel.
/// \return status code that indicates the execution status of the function.
osStatus_t osKernelInitialize (void);
/// Get RTOS Kernel Information.
/// \param[out] version pointer to buffer for retrieving version information.
/// \param[out] id_buf pointer to buffer for retrieving kernel identification string.
/// \param[in] id_size size of buffer for kernel identification string.
/// \return status code that indicates the execution status of the function.
osStatus_t osKernelGetInfo (osVersion_t *version, char *id_buf, uint32_t id_size);
/// Get the current RTOS Kernel state.
/// \return current RTOS Kernel state.
osKernelState_t osKernelGetState (void);
/// Start the RTOS Kernel scheduler.
/// \return status code that indicates the execution status of the function.
osStatus_t osKernelStart (void);
/// Lock the RTOS Kernel scheduler.
/// \return previous lock state (1 - locked, 0 - not locked, error code if negative).
int32_t osKernelLock (void);
/// Unlock the RTOS Kernel scheduler.
/// \return previous lock state (1 - locked, 0 - not locked, error code if negative).
int32_t osKernelUnlock (void);
/// Restore the RTOS Kernel scheduler lock state.
/// \param[in] lock lock state obtained by \ref osKernelLock or \ref osKernelUnlock.
/// \return new lock state (1 - locked, 0 - not locked, error code if negative).
int32_t osKernelRestoreLock (int32_t lock);
/// Suspend the RTOS Kernel scheduler.
/// \return time in ticks, for how long the system can sleep or power-down.
uint32_t osKernelSuspend (void);
/// Resume the RTOS Kernel scheduler.
/// \param[in] sleep_ticks time in ticks for how long the system was in sleep or power-down mode.
void osKernelResume (uint32_t sleep_ticks);
/// Get the RTOS kernel tick count.
/// \return RTOS kernel current tick count.
uint32_t osKernelGetTickCount (void);
/// Get the timer expiry time.
/// \return the timer expiry time.
uint32_t osTimerGetExpiryTime (osTimerId_t timer_id);
/// Get the RTOS kernel tick frequency.
/// \return frequency of the kernel tick in hertz, i.e. kernel ticks per second.
uint32_t osKernelGetTickFreq (void);
/// Get the RTOS kernel system timer count.
/// \return RTOS kernel current system timer count as 32-bit value.
uint32_t osKernelGetSysTimerCount (void);
/// Get the RTOS kernel system timer frequency.
/// \return frequency of the system timer in hertz, i.e. timer ticks per second.
uint32_t osKernelGetSysTimerFreq (void);
// ==== Thread Management Functions ====
/// Create a thread and add it to Active Threads.
/// \param[in] func thread function.
/// \param[in] argument pointer that is passed to the thread function as start argument.
/// \param[in] attr thread attributes; NULL: default values.
/// \return thread ID for reference by other functions or NULL in case of error.
osThreadId_t osThreadNew (osThreadFunc_t func, void *argument, const osThreadAttr_t *attr);
/// Get Number of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
///
uint32_t osThreadGetNumber (osThreadId_t thread_id);
/// Get name of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return name as NULL terminated string.
const char *osThreadGetName (osThreadId_t thread_id);
/// Return the thread ID of the current running thread.
/// \return thread ID for reference by other functions or NULL in case of error.
osThreadId_t osThreadGetId (void);
/// Get current thread state of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return current thread state of the specified thread.
osThreadState_t osThreadGetState (osThreadId_t thread_id);
/// Get stack size of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return stack size in bytes.
uint32_t osThreadGetStackSize (osThreadId_t thread_id);
/// Get available stack space of a thread based on stack watermark recording during execution.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return remaining stack space in bytes.
uint32_t osThreadGetStackSpace (osThreadId_t thread_id);
/// Change priority of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \param[in] priority new priority value for the thread function.
/// \return status code that indicates the execution status of the function.
osStatus_t osThreadSetPriority (osThreadId_t thread_id, osPriority_t priority);
/// Get current priority of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return current priority value of the specified thread.
osPriority_t osThreadGetPriority (osThreadId_t thread_id);
/// Pass control to next thread that is in state \b READY.
/// \return status code that indicates the execution status of the function.
osStatus_t osThreadYield (void);
/// Suspend execution of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return status code that indicates the execution status of the function.
osStatus_t osThreadSuspend (osThreadId_t thread_id);
uint8_t osThreadIsSuspendAll (void);
/// Resume execution of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return status code that indicates the execution status of the function.
osStatus_t osThreadResume (osThreadId_t thread_id);
/// Suspend task switch
osStatus_t osThreadSuspendAll (void);
/// Resume task switch
osStatus_t osThreadResumeAll (void);
/// Detach a thread (thread storage can be reclaimed when thread terminates).
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return status code that indicates the execution status of the function.
osStatus_t osThreadDetach (osThreadId_t thread_id);
/// Wait for specified thread to terminate.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return status code that indicates the execution status of the function.
osStatus_t osThreadJoin (osThreadId_t thread_id);
/// Terminate execution of current running thread.
__NO_RETURN void osThreadExit (void);
/// Terminate execution of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \return status code that indicates the execution status of the function.
osStatus_t osThreadTerminate (osThreadId_t thread_id);
/// Get number of active threads.
/// \return number of active threads.
uint32_t osThreadGetCount (void);
/// Enumerate active threads.
/// \param[out] thread_array pointer to array for retrieving thread IDs.
/// \param[in] array_items maximum number of items in array for retrieving thread IDs.
/// \return number of enumerated threads.
uint32_t osThreadEnumerate (osThreadId_t *thread_array, uint32_t array_items);
// ==== Thread Flags Functions ====
/// Set the specified Thread Flags of a thread.
/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
/// \param[in] flags specifies the flags of the thread that shall be set.
/// \return thread flags after setting or error code if highest bit set.
uint32_t osThreadFlagsSet (osThreadId_t thread_id, uint32_t flags);
/// Clear the specified Thread Flags of current running thread.
/// \param[in] flags specifies the flags of the thread that shall be cleared.
/// \return thread flags before clearing or error code if highest bit set.
uint32_t osThreadFlagsClear (uint32_t flags);
/// Get the current Thread Flags of current running thread.
/// \return current thread flags.
uint32_t osThreadFlagsGet (void);
/// Wait for one or more Thread Flags of the current running thread to become signaled.
/// \param[in] flags specifies the flags to wait for.
/// \param[in] options specifies flags options (osFlagsXxxx).
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
/// \return thread flags before clearing or error code if highest bit set.
uint32_t osThreadFlagsWait (uint32_t flags, uint32_t options, uint32_t timeout);
// ==== Generic Wait Functions ====
/// Wait for Timeout (Time Delay).
/// \param[in] ticks \ref CMSIS_RTOS_TimeOutValue "time ticks" value
/// \return status code that indicates the execution status of the function.
osStatus_t osDelay (uint32_t ticks);
/// Wait until specified time.
/// \param[in] ticks absolute time in ticks
/// \return status code that indicates the execution status of the function.
osStatus_t osDelayUntil (uint32_t ticks);
// ==== Timer Management Functions ====
/// Create and Initialize a timer.
/// \param[in] func function pointer to callback function.
/// \param[in] type \ref osTimerOnce for one-shot or \ref osTimerPeriodic for periodic behavior.
/// \param[in] argument argument to the timer callback function.
/// \param[in] attr timer attributes; NULL: default values.
/// \return timer ID for reference by other functions or NULL in case of error.
osTimerId_t osTimerNew (osTimerFunc_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr);
/// Get name of a timer.
/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
/// \return name as NULL terminated string.
const char *osTimerGetName (osTimerId_t timer_id);
/// Start or restart a timer.
/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
/// \param[in] ticks \ref CMSIS_RTOS_TimeOutValue "time ticks" value of the timer.
/// \return status code that indicates the execution status of the function.
osStatus_t osTimerStart (osTimerId_t timer_id, uint32_t ticks);
/// Stop a timer.
/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osTimerStop (osTimerId_t timer_id);
/// Check if a timer is running.
/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
/// \return 0 not running, 1 running.
uint32_t osTimerIsRunning (osTimerId_t timer_id);
/// Delete a timer.
/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osTimerDelete (osTimerId_t timer_id);
// ==== Event Flags Management Functions ====
/// Create and Initialize an Event Flags object.
/// \param[in] attr event flags attributes; NULL: default values.
/// \return event flags ID for reference by other functions or NULL in case of error.
osEventFlagsId_t osEventFlagsNew (const osEventFlagsAttr_t *attr);
/// Get name of an Event Flags object.
/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
/// \return name as NULL terminated string.
const char *osEventFlagsGetName (osEventFlagsId_t ef_id);
/// Set the specified Event Flags.
/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
/// \param[in] flags specifies the flags that shall be set.
/// \return event flags after setting or error code if highest bit set.
uint32_t osEventFlagsSet (osEventFlagsId_t ef_id, uint32_t flags);
/// Clear the specified Event Flags.
/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
/// \param[in] flags specifies the flags that shall be cleared.
/// \return event flags before clearing or error code if highest bit set.
uint32_t osEventFlagsClear (osEventFlagsId_t ef_id, uint32_t flags);
/// Get the current Event Flags.
/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
/// \return current event flags.
uint32_t osEventFlagsGet (osEventFlagsId_t ef_id);
/// Wait for one or more Event Flags to become signaled.
/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
/// \param[in] flags specifies the flags to wait for.
/// \param[in] options specifies flags options (osFlagsXxxx).
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
/// \return event flags before clearing or error code if highest bit set.
uint32_t osEventFlagsWait (osEventFlagsId_t ef_id, uint32_t flags, uint32_t options, uint32_t timeout);
/// Delete an Event Flags object.
/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osEventFlagsDelete (osEventFlagsId_t ef_id);
// ==== Mutex Management Functions ====
/// Create and Initialize a Mutex object.
/// \param[in] attr mutex attributes; NULL: default values.
/// \return mutex ID for reference by other functions or NULL in case of error.
osMutexId_t osMutexNew (const osMutexAttr_t *attr);
/// Get name of a Mutex object.
/// \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
/// \return name as NULL terminated string.
const char *osMutexGetName (osMutexId_t mutex_id);
/// Acquire a Mutex or timeout if it is locked.
/// \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
/// \return status code that indicates the execution status of the function.
osStatus_t osMutexAcquire (osMutexId_t mutex_id, uint32_t timeout);
/// Release a Mutex that was acquired by \ref osMutexAcquire.
/// \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osMutexRelease (osMutexId_t mutex_id);
/// Get Thread which owns a Mutex object.
/// \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
/// \return thread ID of owner thread or NULL when mutex was not acquired.
osThreadId_t osMutexGetOwner (osMutexId_t mutex_id);
/// Delete a Mutex object.
/// \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osMutexDelete (osMutexId_t mutex_id);
// ==== Semaphore Management Functions ====
/// Create and Initialize a Semaphore object.
/// \param[in] max_count maximum number of available tokens.
/// \param[in] initial_count initial number of available tokens.
/// \param[in] attr semaphore attributes; NULL: default values.
/// \return semaphore ID for reference by other functions or NULL in case of error.
osSemaphoreId_t osSemaphoreNew (uint32_t max_count, uint32_t initial_count, const osSemaphoreAttr_t *attr);
/// Get name of a Semaphore object.
/// \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
/// \return name as NULL terminated string.
const char *osSemaphoreGetName (osSemaphoreId_t semaphore_id);
/// Acquire a Semaphore token or timeout if no tokens are available.
/// \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
/// \return status code that indicates the execution status of the function.
osStatus_t osSemaphoreAcquire (osSemaphoreId_t semaphore_id, uint32_t timeout);
/// Release a Semaphore token up to the initial maximum count.
/// \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osSemaphoreRelease (osSemaphoreId_t semaphore_id);
/// Get current Semaphore token count.
/// \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
/// \return number of tokens available.
uint32_t osSemaphoreGetCount (osSemaphoreId_t semaphore_id);
/// Delete a Semaphore object.
/// \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osSemaphoreDelete (osSemaphoreId_t semaphore_id);
// ==== Memory Pool Management Functions ====
/// Create and Initialize a Memory Pool object.
/// \param[in] block_count maximum number of memory blocks in memory pool.
/// \param[in] block_size memory block size in bytes.
/// \param[in] attr memory pool attributes; NULL: default values.
/// \return memory pool ID for reference by other functions or NULL in case of error.
osMemoryPoolId_t osMemoryPoolNew (uint32_t block_count, uint32_t block_size, const osMemoryPoolAttr_t *attr);
/// Get name of a Memory Pool object.
/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
/// \return name as NULL terminated string.
const char *osMemoryPoolGetName (osMemoryPoolId_t mp_id);
/// Allocate a memory block from a Memory Pool.
/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
/// \return address of the allocated memory block or NULL in case of no memory is available.
void *osMemoryPoolAlloc (osMemoryPoolId_t mp_id, uint32_t timeout);
/// Return an allocated memory block back to a Memory Pool.
/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
/// \param[in] block address of the allocated memory block to be returned to the memory pool.
/// \return status code that indicates the execution status of the function.
osStatus_t osMemoryPoolFree (osMemoryPoolId_t mp_id, void *block);
/// Get maximum number of memory blocks in a Memory Pool.
/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
/// \return maximum number of memory blocks.
uint32_t osMemoryPoolGetCapacity (osMemoryPoolId_t mp_id);
/// Get memory block size in a Memory Pool.
/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
/// \return memory block size in bytes.
uint32_t osMemoryPoolGetBlockSize (osMemoryPoolId_t mp_id);
/// Get number of memory blocks used in a Memory Pool.
/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
/// \return number of memory blocks used.
uint32_t osMemoryPoolGetCount (osMemoryPoolId_t mp_id);
/// Get number of memory blocks available in a Memory Pool.
/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
/// \return number of memory blocks available.
uint32_t osMemoryPoolGetSpace (osMemoryPoolId_t mp_id);
/// Delete a Memory Pool object.
/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osMemoryPoolDelete (osMemoryPoolId_t mp_id);
// ==== Message Queue Management Functions ====
/// Create and Initialize a Message Queue object.
/// \param[in] msg_count maximum number of messages in queue.
/// \param[in] msg_size maximum message size in bytes.
/// \param[in] attr message queue attributes; NULL: default values.
/// \return message queue ID for reference by other functions or NULL in case of error.
osMessageQueueId_t osMessageQueueNew (uint32_t msg_count, uint32_t msg_size, const osMessageQueueAttr_t *attr);
/// Get name of a Message Queue object.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \return name as NULL terminated string.
const char *osMessageQueueGetName (osMessageQueueId_t mq_id);
/// Put a Message into a Queue or timeout if Queue is full.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \param[in] msg_ptr pointer to buffer with message to put into a queue.
/// \param[in] msg_prio message priority.
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
/// \return status code that indicates the execution status of the function.
osStatus_t osMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout);
/// Put a Message into a Queue's front header or timeout if Queue is full.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \param[in] msg_ptr pointer to buffer with message to put into a queue.
/// \param[in] msg_prio message priority.
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
/// \return status code that indicates the execution status of the function.
osStatus_t osMessageQueuePutToFront (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout);
/// Get a Message from a Queue or timeout if Queue is empty.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \param[out] msg_ptr pointer to buffer for message to get from a queue.
/// \param[out] msg_prio pointer to buffer for message priority or NULL.
/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
/// \return status code that indicates the execution status of the function.
osStatus_t osMessageQueueGet (osMessageQueueId_t mq_id, void *msg_ptr, uint8_t *msg_prio, uint32_t timeout);
/// Get maximum number of messages in a Message Queue.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \return maximum number of messages.
uint32_t osMessageQueueGetCapacity (osMessageQueueId_t mq_id);
/// Get maximum message size in a Memory Pool.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \return maximum message size in bytes.
uint32_t osMessageQueueGetMsgSize (osMessageQueueId_t mq_id);
/// Get number of queued messages in a Message Queue.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \return number of queued messages.
uint32_t osMessageQueueGetCount (osMessageQueueId_t mq_id);
/// Get number of available slots for messages in a Message Queue.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \return number of available slots for messages.
uint32_t osMessageQueueGetSpace (osMessageQueueId_t mq_id);
/// Reset a Message Queue to initial empty state.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osMessageQueueReset (osMessageQueueId_t mq_id);
/// Delete a Message Queue object.
/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
/// \return status code that indicates the execution status of the function.
osStatus_t osMessageQueueDelete (osMessageQueueId_t mq_id);
//add stdio malloc/free function
void *malloc( size_t Size );
void free( void *p );
void *calloc(size_t n,size_t Size );
//add stdio malloc/free function
// protect critical region in task context
void ostaskENTER_CRITICAL(void);
void ostaskEXIT_CRITICAL(void);
// protect critical region in ISR context
uint32_t ostaskENTER_CRITICAL_ISR(void);
void ostaskEXIT_CRITICAL_ISR(uint32_t isrm);
uint32_t osIsInISRContext(void);
#if( configUSE_16_BIT_TICKS == 1 )
typedef uint16_t TickType_t;
#define cmsisMAX_DELAY ( TickType_t ) 0xffff
#else
typedef uint32_t TickType_t;
#define cmsisMAX_DELAY ( TickType_t ) 0xffffffffUL
/* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
not need to be guarded with a critical section. */
#define portTICK_TYPE_IS_ATOMIC 1
#endif
uint32_t osTaskSetTimeOutState(uint32_t *curTimeTick);
uint32_t osTaskCheckForTimeOut(uint32_t *curTimeTick, uint32_t *timeOutTick);
uint32_t osTaskGetFreeHeapSize( void );
#ifdef __cplusplus
}
#endif
#endif // CMSIS_OS2_H_

View File

@ -0,0 +1,19 @@
#include "opensdk.h"
EXPORT_FUNC(main)
EXPORT_FUNC(test)
EXPORT_FUNC(__flash_data_table_begin)
EXPORT_FUNC(speakerAppInit)
EXPORT_FUNC(speakerAppPreDraw)
EXPORT_FUNC(speakerAppMsgProc)
EXPORT_FUNC(speakerAppAfterDraw)
EXPORT_FUNC(speakerAppDestory)
EXPORT_FUNC(ThreadApiTest)
#define app_speakerAppDestory_addr 0x405
#define app_speakerAppMsgProc_addr 0x129
#define app_speakerAppInit_addr 0x10d
#define app_speakerAppPreDraw_addr 0x125
#define app_speakerAppAfterDraw_addr 0x401
#define app_main_addr 0x1
#define app_ThreadApiTest_addr 0x569

View File

@ -0,0 +1,201 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of EigenComm Ltd.
* File name: gpio.h
* Description: EC718 gpio driver header file
* History:
*
****************************************************************************/
#ifndef _GPIO_EC718_H
#define _GPIO_EC718_H
#include "ec718.h"
#include "Driver_Common.h"
/**
\addtogroup gpio_interface_gr
\{
*/
/*******************************************************************************
* Definitions
******************************************************************************/
/** \brief GPIO pin direction */
typedef enum
{
GPIO_DIRECTION_INPUT = 0U, /**< Set pin as input */
GPIO_DIRECTION_OUTPUT = 1U, /**< Set pin as output */
} GpioPinDirection_e;
/** \brief GPIO pin interrupt configuration */
typedef enum
{
GPIO_INTERRUPT_DISABLED = 0U, /**< Disable interrupt */
GPIO_INTERRUPT_LOW_LEVEL = 1U, /**< Low-level interrupt */
GPIO_INTERRUPT_HIGH_LEVEL = 2U, /**< High-level interrupt */
GPIO_INTERRUPT_FALLING_EDGE = 3U, /**< Falling edge interrupt */
GPIO_INTERRUPT_RISING_EDGE = 4U, /**< Rising edge interrupt */
GPIO_INTERRUPT_BOTH_EDGE = 5U /**< Falling and rising edge interrupt */
} GpioInterruptConfig_e;
/** \brief GPIO pin configuration structure */
typedef struct
{
GpioPinDirection_e pinDirection; /**< GPIO direction, input or output */
union
{
GpioInterruptConfig_e interruptConfig; /**< Pin's interrupt configuration, valid when pinDirection is input */
uint32_t initOutput; /**< Initial pin output value, valid when pinDirection is output*/
} misc;
} GpioPinConfig_t;
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
/** \name GPIO Driver Initialization */
/** \{ */
/**
\fn void GPIO_driverInit(void);
\brief Intialize GPIO driver internal data
\note It is not necessarty to call this function before using GPIO driver since it has been
called in \ref GPIO_pinConfig() api.
*/
void GPIO_driverInit(void);
/**
\fn void GPIO_driverDeInit(void);
\brief De-Intialize GPIO driver, disable GPIO clock and perform some clearups
*/
void GPIO_driverDeInit(void);
/** \} */
/** \name GPIO Configuration */
/** \{ */
/**
\fn void GPIO_pinConfig(uint32_t port, uint16_t pin, const GpioPinConfig_t *config);
\brief Configure a GPIO pin
\param[in] port GPIO number (0, 1, ...)
\param[in] pin GPIO pin number
\param[in] config Pointer to GPIO pin configuration
*/
void GPIO_pinConfig(uint32_t port, uint16_t pin, const GpioPinConfig_t *config);
/**
\fn void GPIO_interruptConfig(uint32_t port, uint16_t pin, GpioInterruptConfig_e config);
\brief Configure a GPIO pin's interrupt type(valid when this pin has been set as input)
\param[in] port GPIO number (0, 1, ...)
\param[in] pin GPIO pin number
\param[in] config GPIO interrupt configuration
*/
void GPIO_interruptConfig(uint32_t port, uint16_t pin, GpioInterruptConfig_e config);
/** \} */
/** \name GPIO Output Operations */
/** \{ */
/**
\fn void GPIO_pinWrite(uint32_t port, uint16_t pinMask, uint16_t output);
\brief Sets output level of multiple GPIO pins to logic 1 or 0
\code
Example to set bits[15,1:0] to 1 and clear bits[12:11, 7:6]
// pinMask shall be b10011000 11000011 = 0x98C3
// output shall be b10000000 00000011 = 0x8003
GPIO_pinWrite(0, 0x98C3, 0x8003);
// To set a single pin, let's say, pin 12 of GPIO0
GPIO_pinWrite(0, 1 << 12, 1 << 12);
// To clear a single pin, let's say, pin 12 of GPIO0
GPIO_pinWrite(0, 1 << 12, 0);
\endcode
\param[in] port GPIO number (0, 1, ...)
\param[in] pinMask GPIO pin mask to set
\param[in] output GPIO pin output logic level.
- 0: corresponding pin output low-logic level.
- 1: corresponding pin output high-logic level.
*/
void GPIO_pinWrite(uint32_t port, uint16_t pinMask, uint16_t output);
/** \} */
/** \name GPIO Input Operations */
/** \{ */
/**
\fn uint32_t GPIO_pinRead(uint32_t port, uint16_t pin)
\brief Reads current input value of GPIO specific pin
\param[in] port GPIO number (0, 1, ...)
\param[in] pin GPIO pin number
\return GPIO corresponding pin input value
*/
uint32_t GPIO_pinRead(uint32_t port, uint16_t pin);
/** \} */
/** \name GPIO Interrupt */
/** \{ */
/**
\fn uint16_t GPIO_getInterruptFlags(uint32_t port)
\brief Reads GPIO port interrupt status flags
\param[in] port GPIO number (0, 1, ...)
\return current GPIO interrupt status flag
*/
uint16_t GPIO_getInterruptFlags(uint32_t port);
/**
\fn void GPIO_clearInterruptFlags(uint32_t port, uint16_t mask)
\brief Clears multiple GPIO pin interrupt status flags
\param[in] port GPIO number (0, 1, ...)
\param[in] mask GPIO pin number macro
*/
void GPIO_clearInterruptFlags(uint32_t port, uint16_t mask);
/**
\fn uint16_t GPIO_saveAndSetIrqMask(uint32_t port)
\brief Reads GPIO port interrupt enable mask and diables whole port interrupts
\param[in] port GPIO number (0, 1, ...)
\return current GPIO port interrupt enable mask
\note Used in GPIO ISR to disable GPIO interrupts temporarily
*/
uint16_t GPIO_saveAndSetIrqMask(uint32_t port);
/**
\fn void GPIO_restoreIrqMask(uint32_t port, uint16_t mask)
\brief Restore GPIO port interrupt enable setting
\param[in] port GPIO number (0, 1, ...)
\param[in] mask GPIO interrupt enable mask
\note Used in GPIO ISR to restore GPIO enable setting upon exit
*/
void GPIO_restoreIrqMask(uint32_t port, uint16_t mask);
/**
\fn void GPIO_pinSetDirectionOnly(uint32_t port, uint16_t pin, GpioPinDirection_e dir);
\brief set pin direction only
\param[in] port GPIO number (0, 1, ...)
\param[in] pin GPIO pin number
\param[in] dir set pin direction
*/
void GPIO_pinSetDirectionOnly(uint32_t port, uint16_t pin, GpioPinDirection_e dir);
/** \} */
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* _GPIO_EC718_H */

View File

@ -0,0 +1,699 @@
/*
* The little filesystem
*
* Copyright (c) 2017, Arm Limited. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef LFS_H
#define LFS_H
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C"
{
#endif
/// Version info ///
// Software library version
// Major (top-nibble), incremented on backwards incompatible changes
// Minor (bottom-nibble), incremented on feature additions
#define LFS_VERSION 0x00020004
#define LFS_VERSION_MAJOR (0xffff & (LFS_VERSION >> 16))
#define LFS_VERSION_MINOR (0xffff & (LFS_VERSION >> 0))
// Version of On-disk data structures
// Major (top-nibble), incremented on backwards incompatible changes
// Minor (bottom-nibble), incremented on feature additions
#define LFS_DISK_VERSION 0x00020000
#define LFS_DISK_VERSION_MAJOR (0xffff & (LFS_DISK_VERSION >> 16))
#define LFS_DISK_VERSION_MINOR (0xffff & (LFS_DISK_VERSION >> 0))
/// Definitions ///
// Type definitions
typedef uint32_t lfs_size_t;
typedef uint32_t lfs_off_t;
typedef int32_t lfs_ssize_t;
typedef int32_t lfs_soff_t;
typedef uint32_t lfs_block_t;
// Maximum name size in bytes, may be redefined to reduce the size of the
// info struct. Limited to <= 1022. Stored in superblock and must be
// respected by other littlefs drivers.
#ifndef LFS_NAME_MAX
#define LFS_NAME_MAX 255 /* Note: 1. Change this value in Makefile.inc located in the same directory with this file. 2. Need to FORMAT the whole FS area to take effect */
#endif
// Maximum size of a file in bytes, may be redefined to limit to support other
// drivers. Limited on disk to <= 4294967296. However, above 2147483647 the
// functions lfs_file_seek, lfs_file_size, and lfs_file_tell will return
// incorrect values due to using signed integers. Stored in superblock and
// must be respected by other littlefs drivers.
#ifndef LFS_FILE_MAX
#define LFS_FILE_MAX 2147483647
#endif
// Maximum size of custom attributes in bytes, may be redefined, but there is
// no real benefit to using a smaller LFS_ATTR_MAX. Limited to <= 1022.
#ifndef LFS_ATTR_MAX
#define LFS_ATTR_MAX 1022
#endif
// Possible error codes, these are negative to allow
// valid positive return values
enum lfs_error {
LFS_ERR_OK = 0, // No error
LFS_ERR_IO = -5, // Error during device operation
LFS_ERR_CORRUPT = -84, // Corrupted
LFS_ERR_NOENT = -2, // No directory entry
LFS_ERR_EXIST = -17, // Entry already exists
LFS_ERR_NOTDIR = -20, // Entry is not a dir
LFS_ERR_ISDIR = -21, // Entry is a dir
LFS_ERR_NOTEMPTY = -39, // Dir is not empty
LFS_ERR_BADF = -9, // Bad file number
LFS_ERR_FBIG = -27, // File too large
LFS_ERR_INVAL = -22, // Invalid parameter
LFS_ERR_NOSPC = -28, // No space left on device
LFS_ERR_NOMEM = -12, // No more memory available
LFS_ERR_NOATTR = -61, // No data/attr available
LFS_ERR_NAMETOOLONG = -36, // File name too long
};
// File types
enum lfs_type {
// file types
LFS_TYPE_REG = 0x001,
LFS_TYPE_DIR = 0x002,
// internally used types
LFS_TYPE_SPLICE = 0x400,
LFS_TYPE_NAME = 0x000,
LFS_TYPE_STRUCT = 0x200,
LFS_TYPE_USERATTR = 0x300,
LFS_TYPE_FROM = 0x100,
LFS_TYPE_TAIL = 0x600,
LFS_TYPE_GLOBALS = 0x700,
LFS_TYPE_CRC = 0x500,
// internally used type specializations
LFS_TYPE_CREATE = 0x401,
LFS_TYPE_DELETE = 0x4ff,
LFS_TYPE_SUPERBLOCK = 0x0ff,
LFS_TYPE_DIRSTRUCT = 0x200,
LFS_TYPE_CTZSTRUCT = 0x202,
LFS_TYPE_INLINESTRUCT = 0x201,
LFS_TYPE_SOFTTAIL = 0x600,
LFS_TYPE_HARDTAIL = 0x601,
LFS_TYPE_MOVESTATE = 0x7ff,
// internal chip sources
LFS_FROM_NOOP = 0x000,
LFS_FROM_MOVE = 0x101,
LFS_FROM_USERATTRS = 0x102,
};
// File open flags
enum lfs_open_flags {
// open flags
LFS_O_RDONLY = 1, // Open a file as read only
#ifndef LFS_READONLY
LFS_O_WRONLY = 2, // Open a file as write only
LFS_O_RDWR = 3, // Open a file as read and write
LFS_O_CREAT = 0x0100, // Create a file if it does not exist
LFS_O_EXCL = 0x0200, // Fail if a file already exists
LFS_O_TRUNC = 0x0400, // Truncate the existing file to zero size
LFS_O_APPEND = 0x0800, // Move to end of file on every write
#endif
// internally used flags
#ifndef LFS_READONLY
LFS_F_DIRTY = 0x010000, // File does not match storage
LFS_F_WRITING = 0x020000, // File has been written since last flush
#endif
LFS_F_READING = 0x040000, // File has been read since last flush
#ifndef LFS_READONLY
LFS_F_ERRED = 0x080000, // An error occured during write
#endif
LFS_F_INLINE = 0x100000, // Currently inlined in directory entry
LFS_F_OPENED = 0x200000, // File has been opened, stay un-updated for stack cost(EC)
};
// File seek flags
enum lfs_whence_flags {
LFS_SEEK_SET = 0, // Seek relative to an absolute position
LFS_SEEK_CUR = 1, // Seek relative to the current file position
LFS_SEEK_END = 2, // Seek relative to the end of the file
};
// Configuration provided during initialization of the littlefs
struct lfs_config {
// Opaque user provided context that can be used to pass
// information to the block device operations
void *context;
// Read a region in a block. Negative error codes are propogated
// to the user.
int (*read)(const struct lfs_config *c, lfs_block_t block,
lfs_off_t off, void *buffer, lfs_size_t size);
// Program a region in a block. The block must have previously
// been erased. Negative error codes are propogated to the user.
// May return LFS_ERR_CORRUPT if the block should be considered bad.
int (*prog)(const struct lfs_config *c, lfs_block_t block,
lfs_off_t off, const void *buffer, lfs_size_t size);
// Erase a block. A block must be erased before being programmed.
// The state of an erased block is undefined. Negative error codes
// are propogated to the user.
// May return LFS_ERR_CORRUPT if the block should be considered bad.
int (*erase)(const struct lfs_config *c, lfs_block_t block);
// Sync the state of the underlying block device. Negative error codes
// are propogated to the user.
int (*sync)(const struct lfs_config *c);
#ifdef LFS_THREADSAFE
int (*lock)(const struct lfs_config *c);
int (*unlock)(const struct lfs_config *c);
#endif
// Minimum size of a block read. All read operations will be a
// multiple of this value.
lfs_size_t read_size;
// Minimum size of a block program. All program operations will be a
// multiple of this value.
lfs_size_t prog_size;
// Size of an erasable block. This does not impact ram consumption and
// may be larger than the physical erase size. However, non-inlined files
// take up at minimum one block. Must be a multiple of the read
// and program sizes.
lfs_size_t block_size;
// Number of erasable blocks on the device.
lfs_size_t block_count;
// Number of erase cycles before littlefs evicts metadata logs and moves
// the metadata to another block. Suggested values are in the
// range 100-1000, with large values having better performance at the cost
// of less consistent wear distribution.
//
// Set to -1 to disable block-level wear-leveling.
int32_t block_cycles;
// Size of block caches. Each cache buffers a portion of a block in RAM.
// The littlefs needs a read cache, a program cache, and one additional
// cache per file. Larger caches can improve performance by storing more
// data and reducing the number of disk accesses. Must be a multiple of
// the read and program sizes, and a factor of the block size.
lfs_size_t cache_size;
// Size of the lookahead buffer in bytes. A larger lookahead buffer
// increases the number of blocks found during an allocation pass. The
// lookahead buffer is stored as a compact bitmap, so each byte of RAM
// can track 8 blocks. Must be a multiple of 8.
lfs_size_t lookahead_size;
// Optional statically allocated read buffer. Must be cache_size.
// By default lfs_malloc is used to allocate this buffer.
void *read_buffer;
// Optional statically allocated program buffer. Must be cache_size.
// By default lfs_malloc is used to allocate this buffer.
void *prog_buffer;
// Optional statically allocated lookahead buffer. Must be lookahead_size
// and aligned to a 32-bit boundary. By default lfs_malloc is used to
// allocate this buffer.
void *lookahead_buffer;
// Optional upper limit on length of file names in bytes. No downside for
// larger names except the size of the info struct which is controlled by
// the LFS_NAME_MAX define. Defaults to LFS_NAME_MAX when zero. Stored in
// superblock and must be respected by other littlefs drivers.
lfs_size_t name_max;
// Optional upper limit on files in bytes. No downside for larger files
// but must be <= LFS_FILE_MAX. Defaults to LFS_FILE_MAX when zero. Stored
// in superblock and must be respected by other littlefs drivers.
lfs_size_t file_max;
// Optional upper limit on custom attributes in bytes. No downside for
// larger attributes size but must be <= LFS_ATTR_MAX. Defaults to
// LFS_ATTR_MAX when zero.
lfs_size_t attr_max;
// Optional upper limit on total space given to metadata pairs in bytes. On
// devices with large blocks (e.g. 128kB) setting this to a low size (2-8kB)
// can help bound the metadata compaction time. Must be <= block_size.
// Defaults to block_size when zero.
lfs_size_t metadata_max;
};
// File info structure
struct lfs_info {
// Type of the file, either LFS_TYPE_REG or LFS_TYPE_DIR
uint8_t type;
// Size of the file, only valid for REG files. Limited to 32-bits.
lfs_size_t size;
// Name of the file stored as a null-terminated string. Limited to
// LFS_NAME_MAX+1, which can be changed by redefining LFS_NAME_MAX to
// reduce RAM. LFS_NAME_MAX is stored in superblock and must be
// respected by other littlefs drivers.
char name[LFS_NAME_MAX+1];
};
// Custom attribute structure, used to describe custom attributes
// committed atomically during file writes.
struct lfs_attr {
// 8-bit type of attribute, provided by user and used to
// identify the attribute
uint8_t type;
// Pointer to buffer containing the attribute
void *buffer;
// Size of attribute in bytes, limited to LFS_ATTR_MAX
lfs_size_t size;
};
// Optional configuration provided during lfs_file_opencfg
struct lfs_file_config {
// Optional statically allocated file buffer. Must be cache_size.
// By default lfs_malloc is used to allocate this buffer.
void *buffer;
// Optional list of custom attributes related to the file. If the file
// is opened with read access, these attributes will be read from disk
// during the open call. If the file is opened with write access, the
// attributes will be written to disk every file sync or close. This
// write occurs atomically with update to the file's contents.
//
// Custom attributes are uniquely identified by an 8-bit type and limited
// to LFS_ATTR_MAX bytes. When read, if the stored attribute is smaller
// than the buffer, it will be padded with zeros. If the stored attribute
// is larger, then it will be silently truncated. If the attribute is not
// found, it will be created implicitly.
struct lfs_attr *attrs;
// Number of custom attributes in the list
lfs_size_t attr_count;
};
/// internal littlefs data structures ///
typedef struct lfs_cache {
lfs_block_t block;
lfs_off_t off;
lfs_size_t size;
uint8_t *buffer;
} lfs_cache_t;
typedef struct lfs_mdir {
lfs_block_t pair[2];
uint32_t rev;
lfs_off_t off;
uint32_t etag;
uint16_t count;
bool erased;
bool split;
lfs_block_t tail[2];
} lfs_mdir_t;
// littlefs directory type
typedef struct lfs_dir {
struct lfs_dir *next;
uint16_t id;
uint8_t type;
lfs_mdir_t m;
lfs_off_t pos;
lfs_block_t head[2];
#ifdef FEATURE_SUBSYS_STORAGE_PARTITION_ENABLE
uint8_t partition;
#endif
} lfs_dir_t;
// littlefs file type
typedef struct lfs_file {
struct lfs_file *next;
uint16_t id;
uint8_t type;
lfs_mdir_t m;
struct lfs_ctz {
lfs_block_t head;
lfs_size_t size;
} ctz;
#if 1
char* name; // Add to support to show name rapidly
#endif
uint32_t flags;
lfs_off_t pos;
lfs_block_t block;
lfs_off_t off;
lfs_cache_t cache;
const struct lfs_file_config *cfg;
#ifdef FEATURE_SUBSYS_STORAGE_PARTITION_ENABLE
uint8_t partition;
#endif
} lfs_file_t;
typedef struct lfs_superblock {
uint32_t version;
lfs_size_t block_size;
lfs_size_t block_count;
lfs_size_t name_max;
lfs_size_t file_max;
lfs_size_t attr_max;
} lfs_superblock_t;
typedef struct lfs_gstate {
uint32_t tag;
lfs_block_t pair[2];
} lfs_gstate_t;
// The littlefs filesystem type
typedef struct lfs {
lfs_cache_t rcache;
lfs_cache_t pcache;
lfs_block_t root[2];
struct lfs_mlist {
struct lfs_mlist *next;
uint16_t id;
uint8_t type;
lfs_mdir_t m;
} *mlist;
uint32_t seed;
lfs_gstate_t gstate;
lfs_gstate_t gdisk;
lfs_gstate_t gdelta;
struct lfs_free {
lfs_block_t off;
lfs_block_t size;
lfs_block_t i;
lfs_block_t ack;
uint32_t *buffer;
} free;
const struct lfs_config *cfg;
lfs_size_t name_max;
lfs_size_t file_max;
lfs_size_t attr_max;
#ifdef LFS_MIGRATE
struct lfs1 *lfs1;
#endif
} lfs_t;
/// Filesystem functions ///
#ifndef LFS_READONLY
// Format a block device with the littlefs
//
// Requires a littlefs object and config struct. This clobbers the littlefs
// object, and does not leave the filesystem mounted. The config struct must
// be zeroed for defaults and backwards compatibility.
//
// Returns a negative error code on failure.
int lfs_format(lfs_t *lfs, const struct lfs_config *config);
#endif
// Mounts a littlefs
//
// Requires a littlefs object and config struct. Multiple filesystems
// may be mounted simultaneously with multiple littlefs objects. Both
// lfs and config must be allocated while mounted. The config struct must
// be zeroed for defaults and backwards compatibility.
//
// Returns a negative error code on failure.
int lfs_mount(lfs_t *lfs, const struct lfs_config *config);
// Unmounts a littlefs
//
// Does nothing besides releasing any allocated resources.
// Returns a negative error code on failure.
int lfs_unmount(lfs_t *lfs);
/// General operations ///
#ifndef LFS_READONLY
// Removes a file or directory
//
// If removing a directory, the directory must be empty.
// Returns a negative error code on failure.
int lfs_remove(lfs_t *lfs, const char *path);
#endif
#ifndef LFS_READONLY
// Rename or move a file or directory
//
// If the destination exists, it must match the source in type.
// If the destination is a directory, the directory must be empty.
//
// Returns a negative error code on failure.
int lfs_rename(lfs_t *lfs, const char *oldpath, const char *newpath);
#endif
// Find info about a file or directory
//
// Fills out the info structure, based on the specified file or directory.
// Returns a negative error code on failure.
int lfs_stat(lfs_t *lfs, const char *path, struct lfs_info *info);
// Get a custom attribute
//
// Custom attributes are uniquely identified by an 8-bit type and limited
// to LFS_ATTR_MAX bytes. When read, if the stored attribute is smaller than
// the buffer, it will be padded with zeros. If the stored attribute is larger,
// then it will be silently truncated. If no attribute is found, the error
// LFS_ERR_NOATTR is returned and the buffer is filled with zeros.
//
// Returns the size of the attribute, or a negative error code on failure.
// Note, the returned size is the size of the attribute on disk, irrespective
// of the size of the buffer. This can be used to dynamically allocate a buffer
// or check for existance.
lfs_ssize_t lfs_getattr(lfs_t *lfs, const char *path,
uint8_t type, void *buffer, lfs_size_t size);
#ifndef LFS_READONLY
// Set custom attributes
//
// Custom attributes are uniquely identified by an 8-bit type and limited
// to LFS_ATTR_MAX bytes. If an attribute is not found, it will be
// implicitly created.
//
// Returns a negative error code on failure.
int lfs_setattr(lfs_t *lfs, const char *path,
uint8_t type, const void *buffer, lfs_size_t size);
#endif
#ifndef LFS_READONLY
// Removes a custom attribute
//
// If an attribute is not found, nothing happens.
//
// Returns a negative error code on failure.
int lfs_removeattr(lfs_t *lfs, const char *path, uint8_t type);
#endif
/// File operations ///
// Open a file
//
// The mode that the file is opened in is determined by the flags, which
// are values from the enum lfs_open_flags that are bitwise-ored together.
//
// Returns a negative error code on failure.
int lfs_file_open(lfs_t *lfs, lfs_file_t *file,
const char *path, int flags);
// Open a file with extra configuration
//
// The mode that the file is opened in is determined by the flags, which
// are values from the enum lfs_open_flags that are bitwise-ored together.
//
// The config struct provides additional config options per file as described
// above. The config struct must be allocated while the file is open, and the
// config struct must be zeroed for defaults and backwards compatibility.
//
// Returns a negative error code on failure.
int lfs_file_opencfg(lfs_t *lfs, lfs_file_t *file,
const char *path, int flags,
const struct lfs_file_config *config);
// Close a file
//
// Any pending writes are written out to storage as though
// sync had been called and releases any allocated resources.
//
// Returns a negative error code on failure.
int lfs_file_close(lfs_t *lfs, lfs_file_t *file);
// Synchronize a file on storage
//
// Any pending writes are written out to storage.
// Returns a negative error code on failure.
int lfs_file_sync(lfs_t *lfs, lfs_file_t *file);
// Read data from file
//
// Takes a buffer and size indicating where to store the read data.
// Returns the number of bytes read, or a negative error code on failure.
lfs_ssize_t lfs_file_read(lfs_t *lfs, lfs_file_t *file,
void *buffer, lfs_size_t size);
#ifndef LFS_READONLY
// Write data to file
//
// Takes a buffer and size indicating the data to write. The file will not
// actually be updated on the storage until either sync or close is called.
//
// Returns the number of bytes written, or a negative error code on failure.
lfs_ssize_t lfs_file_write(lfs_t *lfs, lfs_file_t *file,
const void *buffer, lfs_size_t size);
#endif
// Change the position of the file
//
// The change in position is determined by the offset and whence flag.
// Returns the new position of the file, or a negative error code on failure.
lfs_soff_t lfs_file_seek(lfs_t *lfs, lfs_file_t *file,
lfs_soff_t off, int whence);
#ifndef LFS_READONLY
// Truncates the size of the file to the specified size
//
// Returns a negative error code on failure.
int lfs_file_truncate(lfs_t *lfs, lfs_file_t *file, lfs_off_t size);
#endif
// Return the position of the file
//
// Equivalent to lfs_file_seek(lfs, file, 0, LFS_SEEK_CUR)
// Returns the position of the file, or a negative error code on failure.
lfs_soff_t lfs_file_tell(lfs_t *lfs, lfs_file_t *file);
// Change the position of the file to the beginning of the file
//
// Equivalent to lfs_file_seek(lfs, file, 0, LFS_SEEK_SET)
// Returns a negative error code on failure.
int lfs_file_rewind(lfs_t *lfs, lfs_file_t *file);
// Return the size of the file
//
// Similar to lfs_file_seek(lfs, file, 0, LFS_SEEK_END)
// Returns the size of the file, or a negative error code on failure.
lfs_soff_t lfs_file_size(lfs_t *lfs, lfs_file_t *file);
/// Directory operations ///
#ifndef LFS_READONLY
// Create a directory
//
// Returns a negative error code on failure.
int lfs_mkdir(lfs_t *lfs, const char *path);
#endif
// Open a directory
//
// Once open a directory can be used with read to iterate over files.
// Returns a negative error code on failure.
int lfs_dir_open(lfs_t *lfs, lfs_dir_t *dir, const char *path);
// Close a directory
//
// Releases any allocated resources.
// Returns a negative error code on failure.
int lfs_dir_close(lfs_t *lfs, lfs_dir_t *dir);
// Read an entry in the directory
//
// Fills out the info structure, based on the specified file or directory.
// Returns a positive value on success, 0 at the end of directory,
// or a negative error code on failure.
int lfs_dir_read(lfs_t *lfs, lfs_dir_t *dir, struct lfs_info *info);
// Change the position of the directory
//
// The new off must be a value previous returned from tell and specifies
// an absolute offset in the directory seek.
//
// Returns a negative error code on failure.
int lfs_dir_seek(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off);
// Return the position of the directory
//
// The returned offset is only meant to be consumed by seek and may not make
// sense, but does indicate the current position in the directory iteration.
//
// Returns the position of the directory, or a negative error code on failure.
lfs_soff_t lfs_dir_tell(lfs_t *lfs, lfs_dir_t *dir);
// Change the position of the directory to the beginning of the directory
//
// Returns a negative error code on failure.
int lfs_dir_rewind(lfs_t *lfs, lfs_dir_t *dir);
/// Filesystem-level filesystem operations
// Finds the current size of the filesystem
//
// Note: Result is best effort. If files share COW structures, the returned
// size may be larger than the filesystem actually is.
//
// Returns the number of allocated blocks, or a negative error code on failure.
lfs_ssize_t lfs_fs_size(lfs_t *lfs);
// Traverse through all blocks in use by the filesystem
//
// The provided callback will be called with each block address that is
// currently in use by the filesystem. This can be used to determine which
// blocks are in use or how much of the storage is available.
//
// Returns a negative error code on failure.
int lfs_fs_traverse(lfs_t *lfs, int (*cb)(void*, lfs_block_t), void *data);
#ifndef LFS_READONLY
#ifdef LFS_MIGRATE
// Attempts to migrate a previous version of littlefs
//
// Behaves similarly to the lfs_format function. Attempts to mount
// the previous version of littlefs and update the filesystem so it can be
// mounted with the current version of littlefs.
//
// Requires a littlefs object and config struct. This clobbers the littlefs
// object, and does not leave the filesystem mounted. The config struct must
// be zeroed for defaults and backwards compatibility.
//
// Returns a negative error code on failure.
int lfs_migrate(lfs_t *lfs, const struct lfs_config *cfg);
#endif
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -0,0 +1,9 @@
#ifndef __OPENSDK_H__
#define __OPENSDK_H__
#define EXPORT_FUNC(fun)
#endif

View File

@ -0,0 +1,141 @@
#ifndef __OPENSDK_API_H__
#define __OPENSDK_API_H__
typedef uint32_t (*func0)(void);
typedef uint32_t (*func1)(uint32_t p1);
typedef uint32_t (*func2)(uint32_t p1, uint32_t p2);
typedef uint32_t (*func3)(uint32_t p1, uint32_t p2, uint32_t p3);
typedef uint32_t (*func4)(uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4);
typedef uint32_t (*funcx)(char *format, ...);
#ifdef FEATURE_SUBSYS_PCM_RECORD_ENABLE
#define audioRecordAdpcm ((func1)(*((uint32_t *)syscallTable + 659)))
#define audioRecordG726 ((func1)(*((uint32_t *)syscallTable + 658)))
#endif
#define audioPlayMp3 ((func4)(*((uint32_t *)syscallTable + 657)))
#define audioPlayWav ((func2)(*((uint32_t *)syscallTable + 656)))
#define audioPlayPcm ((func3)(*((uint32_t *)syscallTable + 655)))
#define audioPlayTts ((func2)(*((uint32_t *)syscallTable + 654)))
#define audioAdjustVolume ((func1)(*((uint32_t *)syscallTable + 653)))
#define audioIsReady ((func0)(*((uint32_t *)syscallTable + 652)))
#define audioIsBusy ((func0)(*((uint32_t *)syscallTable + 651)))
#define audioGetVolume ((func0)(*((uint32_t *)syscallTable + 650)))
#define mountApp ((func2)(*((uint32_t *)syscallTable + 641)))
#define setActiveApp ((func1)(*((uint32_t *)syscallTable + 640)))
#define file_remove ((func1)(*((uint32_t *)syscallTable + 623)))
#define file_fopen ((func2)(*((uint32_t *)syscallTable + 622)))
#define file_fclose ((func1)(*((uint32_t *)syscallTable + 621)))
#define file_fread ((func4)(*((uint32_t *)syscallTable + 620)))
#define file_fwrite ((func4)(*((uint32_t *)syscallTable + 619)))
#define file_fseek ((func3)(*((uint32_t *)syscallTable + 618)))
#define file_ftell ((func1)(*((uint32_t *)syscallTable + 617)))
#define file_rewind ((func1)(*((uint32_t *)syscallTable + 616)))
#define file_fstat ((func2)(*((uint32_t *)syscallTable + 615)))
#define file_truncate ((func2)(*((uint32_t *)syscallTable + 614)))
#define fsDirOpen ((func2)(*((uint32_t *)syscallTable + 613)))
#define fsDirClose ((func1)(*((uint32_t *)syscallTable + 612)))
#define fsDirRead ((func2)(*((uint32_t *)syscallTable + 611)))
#define fsStatFs ((func1)(*((uint32_t *)syscallTable + 610)))
#define globalmapInit ((func3)(*((uint32_t *)syscallTable + 602)))
#define globalItemSet ((func2)(*((uint32_t *)syscallTable + 601)))
#define globalItemGet ((func1)(*((uint32_t *)syscallTable + 600)))
#define slpManPlatVoteDisableSleep ((func2)(*((uint32_t *)syscallTable + 309)))
#define slpManPlatVoteEnableSleep ((func2)(*((uint32_t *)syscallTable + 308)))
#define slpManApplyPlatVoteHandle ((func2)(*((uint32_t *)syscallTable + 307)))
#define GPIO_pinRead ((func2)(*((uint32_t *)syscallTable + 306)))
#define GPIO_pinWrite ((func3)(*((uint32_t *)syscallTable + 305)))
#define GPIO_pinConfig ((func3)(*((uint32_t *)syscallTable + 304)))
#define PAD_setPinPullConfig ((func2)(*((uint32_t *)syscallTable + 303)))
#define PAD_setPinConfig ((func2)(*((uint32_t *)syscallTable + 302)))
#define PAD_getDefaultConfig ((func1)(*((uint32_t *)syscallTable + 301)))
#define pwrKeyStartPowerOff ((func0)(*((uint32_t *)syscallTable + 300)))
#define osKernelInitialize ((func0)(*((uint32_t *)syscallTable + 275)))
#define osKernelGetInfo ((func3)(*((uint32_t *)syscallTable + 274)))
#define osKernelGetState ((func0)(*((uint32_t *)syscallTable + 273)))
#define osKernelStart ((func0)(*((uint32_t *)syscallTable + 272)))
#define osKernelLock ((func0)(*((uint32_t *)syscallTable + 271)))
#define osKernelUnlock ((func0)(*((uint32_t *)syscallTable + 270)))
#define osKernelRestoreLock ((func1)(*((uint32_t *)syscallTable + 269)))
#define osKernelGetTickCount ((func0)(*((uint32_t *)syscallTable + 268)))
#define osTimerGetExpiryTime ((func1)(*((uint32_t *)syscallTable + 267)))
#define osKernelGetTickFreq ((func0)(*((uint32_t *)syscallTable + 266)))
#define osKernelGetSysTimerCount ((func0)(*((uint32_t *)syscallTable + 265)))
#define osKernelGetSysTimerFreq ((func0)(*((uint32_t *)syscallTable + 264)))
#define osThreadNew ((func3)(*((uint32_t *)syscallTable + 263)))
#define osThreadGetNumber ((func1)(*((uint32_t *)syscallTable + 262)))
#define osThreadGetName ((func1)(*((uint32_t *)syscallTable + 261)))
#define osThreadGetId ((func0)(*((uint32_t *)syscallTable + 260)))
#define osThreadGetState ((func1)(*((uint32_t *)syscallTable + 259)))
#define osThreadGetStackSpace ((func1)(*((uint32_t *)syscallTable + 258)))
#define osThreadSetPriority ((func2)(*((uint32_t *)syscallTable + 257)))
#define osThreadGetPriority ((func1)(*((uint32_t *)syscallTable + 256)))
#define osThreadYield ((func0)(*((uint32_t *)syscallTable + 255)))
#define osThreadSuspend ((func1)(*((uint32_t *)syscallTable + 254)))
#define osThreadIsSuspendAll ((func0)(*((uint32_t *)syscallTable + 253)))
#define osThreadResume ((func1)(*((uint32_t *)syscallTable + 252)))
#define osThreadSuspendAll ((func0)(*((uint32_t *)syscallTable + 251)))
#define osThreadResumeAll ((func0)(*((uint32_t *)syscallTable + 250)))
#define osThreadExit ((func0)(*((uint32_t *)syscallTable + 249)))
#define osThreadTerminate ((func1)(*((uint32_t *)syscallTable + 248)))
#define osThreadGetCount ((func0)(*((uint32_t *)syscallTable + 247)))
#define osThreadEnumerate ((func2)(*((uint32_t *)syscallTable + 246)))
#define osThreadFlagsSet ((func2)(*((uint32_t *)syscallTable + 245)))
#define osThreadFlagsClear ((func1)(*((uint32_t *)syscallTable + 244)))
#define osThreadFlagsGet ((func0)(*((uint32_t *)syscallTable + 243)))
#define osThreadFlagsWait ((func3)(*((uint32_t *)syscallTable + 242)))
#define osDelay ((func1)(*((uint32_t *)syscallTable + 241)))
#define osDelayUntil ((func1)(*((uint32_t *)syscallTable + 240)))
#define osTimerNew ((func4)(*((uint32_t *)syscallTable + 239)))
#define osTimerGetName ((func1)(*((uint32_t *)syscallTable + 238)))
#define osTimerStart ((func2)(*((uint32_t *)syscallTable + 237)))
#define osTimerStop ((func1)(*((uint32_t *)syscallTable + 236)))
#define osTimerIsRunning ((func1)(*((uint32_t *)syscallTable + 235)))
#define osTimerDelete ((func1)(*((uint32_t *)syscallTable + 234)))
#define osEventFlagsNew ((func1)(*((uint32_t *)syscallTable + 233)))
#define osEventFlagsSet ((func2)(*((uint32_t *)syscallTable + 232)))
#define osEventFlagsClear ((func2)(*((uint32_t *)syscallTable + 231)))
#define osEventFlagsGet ((func1)(*((uint32_t *)syscallTable + 230)))
#define osEventFlagsWait ((func4)(*((uint32_t *)syscallTable + 229)))
#define osEventFlagsDelete ((func1)(*((uint32_t *)syscallTable + 228)))
#define osMutexNew ((func1)(*((uint32_t *)syscallTable + 227)))
#define osMutexAcquire ((func2)(*((uint32_t *)syscallTable + 226)))
#define osMutexRelease ((func1)(*((uint32_t *)syscallTable + 225)))
#define osMutexGetOwner ((func1)(*((uint32_t *)syscallTable + 224)))
#define osMutexDelete ((func1)(*((uint32_t *)syscallTable + 223)))
#define osSemaphoreNew ((func3)(*((uint32_t *)syscallTable + 222)))
#define osSemaphoreAcquire ((func2)(*((uint32_t *)syscallTable + 221)))
#define osSemaphoreRelease ((func1)(*((uint32_t *)syscallTable + 220)))
#define osSemaphoreGetCount ((func1)(*((uint32_t *)syscallTable + 219)))
#define osSemaphoreDelete ((func1)(*((uint32_t *)syscallTable + 218)))
#define osMessageQueueNew ((func3)(*((uint32_t *)syscallTable + 217)))
#define osMessageQueuePut ((func4)(*((uint32_t *)syscallTable + 216)))
#define osMessageQueuePutToFront ((func4)(*((uint32_t *)syscallTable + 215)))
#define osMessageQueueGet ((func4)(*((uint32_t *)syscallTable + 214)))
#define osMessageQueueGetCapacity ((func1)(*((uint32_t *)syscallTable + 213)))
#define osMessageQueueGetMsgSize ((func1)(*((uint32_t *)syscallTable + 212)))
#define osMessageQueueGetCount ((func1)(*((uint32_t *)syscallTable + 211)))
#define osMessageQueueGetSpace ((func1)(*((uint32_t *)syscallTable + 210)))
#define osMessageQueueReset ((func1)(*((uint32_t *)syscallTable + 209)))
#define osMessageQueueDelete ((func1)(*((uint32_t *)syscallTable + 208)))
#define ostaskENTER_CRITICAL ((func0)(*((uint32_t *)syscallTable + 207)))
#define ostaskEXIT_CRITICAL ((func0)(*((uint32_t *)syscallTable + 206)))
#define ostaskENTER_CRITICAL_ISR ((func0)(*((uint32_t *)syscallTable + 205)))
#define ostaskEXIT_CRITICAL_ISR ((func1)(*((uint32_t *)syscallTable + 204)))
#define osIsInISRContext ((func0)(*((uint32_t *)syscallTable + 203)))
#define osTaskSetTimeOutState ((func1)(*((uint32_t *)syscallTable + 202)))
#define osTaskCheckForTimeOut ((func2)(*((uint32_t *)syscallTable + 201)))
#define osTaskGetFreeHeapSize ((func0)(*((uint32_t *)syscallTable + 200)))
#define printf ((funcx)(*((uint32_t *)syscallTable + 1)))
#define apiVersion ((uint32_t *)syscallTable)
#endif

View File

@ -0,0 +1,191 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of EigenComm Ltd.
* File name: pad.h
* Description: EC718 pad driver header file
* History:
*
****************************************************************************/
#ifndef _PAD_EC718_H_
#define _PAD_EC718_H_
#include "ec718.h"
#include "Driver_Common.h"
/**
\addtogroup pad_interface_gr
\{
*/
/*******************************************************************************
* Definitions
******************************************************************************/
/** \brief PAD pin mux selection */
typedef enum
{
PAD_MUX_ALT0 = 0U, /**< Chip-specific */
PAD_MUX_ALT1 = 1U, /**< Chip-specific */
PAD_MUX_ALT2 = 2U, /**< Chip-specific */
PAD_MUX_ALT3 = 3U, /**< Chip-specific */
PAD_MUX_ALT4 = 4U, /**< Chip-specific */
PAD_MUX_ALT5 = 5U, /**< Chip-specific */
PAD_MUX_ALT6 = 6U, /**< Chip-specific */
PAD_MUX_ALT7 = 7U, /**< Chip-specific */
} PadMux_e;
/** \brief Internal pull-up resistor configuration */
typedef enum
{
PAD_PULL_UP_DISABLE = 0U, /**< Internal pull-up resistor is disabled */
PAD_PULL_UP_ENABLE = 1U, /**< Internal pull-up resistor is enabled */
} PadPullUp_e;
/** \brief Internal pull-down resistor configuration */
typedef enum
{
PAD_PULL_DOWN_DISABLE = 0U, /**< Internal pull-down resistor is disabled */
PAD_PULL_DOWN_ENABLE = 1U, /**< Internal pull-down resistor is enabled */
} PadPullDown_e;
/** \brief Pull feature selection */
typedef enum
{
PAD_PULL_AUTO = 0U, /**< Pull up/down is controlled by muxed alt function signal, i.e. I2C SCL */
PAD_PULL_INTERNAL = 1U, /**< Use internal pull-up/down resistor */
} PadPullSel_e;
/** \brief Input buffer enable/disable */
typedef enum
{
PAD_INPUT_CONTROL_AUTO = 0U, /**< Input is controlled by muxed alt function signal, i.e. I2C SCL */
PAD_INPUT_CONTROL_SW_ON = 1U, /**< Input is forced enable */
} PadInputControl_e;
/** \brief Output enable/disable */
typedef enum
{
PAD_OUTPUT_CONTROL_AUTO = 0U, /**< Output is controlled by muxed alt function signal, i.e. I2C SCL */
PAD_OUTPUT_CONTROL_SW_ON = 1U, /**< Output is forced enable */
} PadOutputControl_e;
/** \brief Configures pull feature */
typedef enum
{
PAD_INTERNAL_PULL_UP = 0U, /**< select internal pull up */
PAD_INTERNAL_PULL_DOWN = 1U, /**< select internal pull down */
PAD_AUTO_PULL = 2U, /**< Pull up/down is controlled by muxed alt function signal, i.e. I2C SCL */
} PadPullConfig_e;
/** \brief Drive strength configuration */
typedef enum
{
PAD_DRIVE_STRENGTH_LOW = 0U, /**< Drive strength is low */
PAD_DRIVE_STRENGTH_HIGH = 1U, /**< Drive strength is high */
} PadDriveStrength_e;
/** \brief PAD configuration structure */
typedef struct
{
uint32_t : 4;
uint32_t mux : 3; /**< Pad mux configuration */
uint32_t : 1;
uint32_t pullUpEnable : 1; /**< Enable pull-up */
uint32_t pullDownEnable : 1; /**< Enable pull-down */
uint32_t pullSelect : 1; /**< Pull select, external or internal control */
uint32_t inputForceDisable : 1; /**< Force to disable input or not, if true, input path is cut off, otherwise, it's controlled by inputControl bit */
uint32_t : 1;
uint32_t inputControl : 1; /**< Input enable, 'force' on or controlled by muxed alt function signal, i.e. I2C SCL */
uint32_t outputControl : 1; /**< Output enable, 'force' on or controlled by muxed alt function signal, i.e. I2C SCL */
uint32_t outputForceDisable : 1; /**< Force to disable output or not, if true, output path is cut off, otherwise, it's controlled by outputControl bit */
uint32_t : 1;
uint32_t driveStrength : 1;
uint32_t : 12;
uint32_t swOutputValue : 1;
uint32_t swOutputEnable : 1; /** Control to overwrite function signal's output or not, if set to ture, the pad's output is determined by swOutputValue bit */
} PadConfig_t;
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
/** \name PAD Driver Initialization */
/** \{ */
/**
\fn void PAD_driverInit(void);
\brief Intialize PAD driver internal data, must be called before any other APIs
*/
void PAD_driverInit(void);
/**
\fn void PAD_driverInit(void);
\brief De-Intialize PAD driver, disable PAD clock and perform some clearups
*/
void PAD_driverDeInit(void);
/** \} */
/** \name Configuration */
/* \{ */
/**
\fn void PAD_getDefaultConfig(PadConfig_t *config)
\brief Gets the PAD default configuartion
This function sets the configuration structure to default values as below:
\code
config->mux = PAD_MUX_ALT0;
config->inputControl = PAD_INPUT_CONTROL_AUTO;
config->inputForceDisable = 0;
config->outputForceDisable = 0;
config->outputControl = PAD_OUTPUT_CONTROL_AUTO;
config->swOutputEnable = 0;
config->swOutputValue = 0;
config->pullSelect = PAD_PULL_AUTO;
config->pullUpEnable = PAD_PULL_UP_DISABLE;
config->pullDownEnable = PAD_PULL_DOWN_DISABLE;
config->driveStrength = PAD_DRIVE_STRENGTH_HIGH;
\endcode
\param config Pointer to PAD configuration structure
*/
void PAD_getDefaultConfig(PadConfig_t *config);
/**
\fn void PAD_setPinConfig(uint32_t pin, const PadConfig_t *config)
\brief Sets the pad PCR register
\param pin PAD pin number
\param config Pointer to PAD configuration structure
*/
void PAD_setPinConfig(uint32_t paddr, const PadConfig_t *config);
/**
\fn void PAD_setPinMux(uint32_t pin, PadMux_e mux)
\brief Configures pin mux
\param pin PAD pin number
\param mux pin signal source selection
*/
void PAD_setPinMux(uint32_t paddr, PadMux_e mux);
/**
\fn void PAD_setPinPullConfig(uint32_t pin, PadPullConfig_e config)
\brief Configures pin's pull feature
\param pin PAD pin number
\param config PAD pin pull configuration
*/
void PAD_setPinPullConfig(uint32_t paddr, PadPullConfig_e config);
/** \} */
/** \}*/
#if defined(__cplusplus)
}
#endif
#endif /* _PAD_EC718_H_ */

View File

@ -0,0 +1,41 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of EigenComm Ltd.
* File name: status.h
* Description: EC718 at command demo entry header file
* History: Rev1.0 2018-07-12
*
****************************************************************************/
#ifndef SUBSYS_STATUS_H
#define SUBSYS_STATUS_H
#ifdef __cplusplus
extern "C" {
#endif
#define SIM_UNKNOWN 0
#define SIM_READY 1
#define SIM_REMOVED 2
typedef struct
{
uint32_t batteryVoltage : 23;
uint32_t batteryLevel : 7;
uint32_t batteryCharge : 2;
uint32_t simStatus : 2;
uint32_t nwReady : 1;
uint32_t serverReady : 1;
uint32_t reserved : 4;
uint32_t csqLevel : 8;
uint32_t rssi : 16;
char time[6];
} StatusT;
#ifdef __cplusplus
}
#endif
#endif /* SUBSYS_STATUS_H */

View File

@ -0,0 +1,30 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of EigenComm Ltd.
* File name: storage.h
* Description: EC718 at command demo entry header file
* History: Rev1.0 2018-07-12
*
****************************************************************************/
#ifndef SUBSYS_STORAGE_H
#define SUBSYS_STORAGE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#ifdef __cplusplus
}
#endif
#endif /* SUBSYS_STORAGE_H */

View File

@ -0,0 +1,312 @@
#include <stdio.h>
#include <stdint.h>
#include "lfs.h"
#include "charge.h"
#include "status.h"
#include "audio.h"
#include "app.h"
#include "storage.h"
#include "cmsis_os2.h"
#include "opensdk_api.h"
#include "export.h"
#define TEST_API 0
#define THREAD_STACK_SIZE_API_TEST (10 * 1024)
#define DEFAULT_INFO "C:/default.info"
enum GlobalmapNameT
{
GLOBALMAP_SYSCALL_TABLE = 0,
GLOBALMAP_SPEAKER_APP_INFO,
GLOBALMAP_SPEAKER_APP_WND,
GLOBALMAP_SPEAKER_APP,
GLOBALMAP_BATTERY_CHARGE,
GLOBALMAP_BATTERY_LEVEL,
GLOBALMAP_BATTERY_LOW,
GLOBALMAP_SIM_STATUS,
GLOBALMAP_NW_READY,
GLOBALMAP_SERVER_READY,
GOBALMAP_MAX,
};
int32_t speakerAppInit(AppInfoT *appInfo, uint32_t reserved1, uint32_t reserved2, uint32_t syscallTable)
{
printf("speakerAppInit\r\n");
appInfo->initStatus = 1;
return 0;
}
int32_t speakerAppPreDraw()
{
return 0;
}
int32_t speakerAppMsgProc(AppInfoT *appInfo, AppMsgT *msg, uint32_t reserved2, uint32_t syscallTable)
{
#ifdef FEATURE_SUBSYS_AUDIO_ENABLE
uint8_t batteryLevel = *((uint8_t *)(globalItemGet(GLOBALMAP_BATTERY_LEVEL)));
uint8_t batteryCharge = *((uint8_t *)(globalItemGet(GLOBALMAP_BATTERY_CHARGE)));
bool batteryLow = *((bool *)(globalItemGet(GLOBALMAP_BATTERY_LOW)));
uint8_t simStatus = *((uint8_t *)(globalItemGet(GLOBALMAP_SIM_STATUS)));
bool nwReady = *((bool *)(globalItemGet(GLOBALMAP_NW_READY)));
bool serverReady = *((bool *)(globalItemGet(GLOBALMAP_SERVER_READY)));
StatusT status = {0};
switch(msg->msgType)
{
case APP_KEY_MSG:
switch(msg->param1)
{
case ACTION_VOLUME_MINUS_SHORT:
audioAdjustVolume(ACTION_VOLUME_MINUS_SHORT);
break;
case ACTION_VOLUME_PLUS_SHORT:
audioAdjustVolume(ACTION_VOLUME_PLUS_SHORT);
break;
case ACTION_VOLUME_MINUS_LONG:
audioAdjustVolume(ACTION_VOLUME_MINUS_LONG);
break;
case ACTION_VOLUME_PLUS_LONG:
audioAdjustVolume(ACTION_VOLUME_PLUS_LONG);
break;
case ACTION_MENU_SHORT:
if (batteryLevel == 100) {audioPlayMp3(BATTRY_SOUND_100, NULL, true, true);}
else if (batteryLevel == 75) {audioPlayMp3(BATTRY_SOUND_75, NULL, true, true);}
else if (batteryLevel == 50) {audioPlayMp3(BATTRY_SOUND_50, NULL, true, true);}
else if (batteryLevel == 25) {audioPlayMp3(BATTRY_SOUND_25, NULL, true, true);}
else if (batteryLevel == 0) {audioPlayMp3(BATTRY_SOUND_LOW, NULL, true, true);}
if (nwReady == true)
{
audioPlayMp3(NW_SOUND_READY, NULL, true, true);
if (serverReady == true)
{
audioPlayMp3(SERVER_SOUND_READY, NULL, true, true);
}
else
{
audioPlayMp3(SERVER_SOUND_UNREADY, NULL, true, true);
}
}
else if (simStatus == SIM_REMOVED)
{
audioPlayMp3(SIM_SOUND_UNREADY, NULL, true, true);
}
else
{
audioPlayMp3(NW_SOUND_UNREADY, NULL, true, true);
}
break;
case ACTION_MENU_LONG:
#ifdef FEATURE_SUBSYS_PCM_RECORD_ENABLE
audioRecordG726(RECORD_SOUND);
#endif
break;
}
break;
case APP_STAT_MSG:
if (msg != NULL)
{
((uint32_t *)(&status))[0] = msg->param1;
((uint32_t *)(&status))[1] = msg->param2;
}
batteryLevel = status.batteryLevel;
simStatus = status.simStatus;
nwReady = status.nwReady;
serverReady = status.serverReady;
globalItemSet(GLOBALMAP_BATTERY_LEVEL, &batteryLevel);
globalItemSet(GLOBALMAP_SIM_STATUS, &simStatus);
globalItemSet(GLOBALMAP_NW_READY, &nwReady);
globalItemSet(GLOBALMAP_SERVER_READY, &serverReady);
if ((batteryCharge == CHARGE_STATUS_DISCONNECT) && (status.batteryCharge == CHARGE_STATUS_CHARGING))
{
batteryCharge = status.batteryCharge;
globalItemSet(GLOBALMAP_BATTERY_CHARGE, &batteryCharge);
audioPlayMp3(CHARGE_SOUND_BEGIN, NULL, true, true);
}
else if ((batteryCharge != CHARGE_STATUS_DISCONNECT) && (status.batteryCharge == CHARGE_STATUS_DISCONNECT))
{
batteryLow = false;
batteryCharge = status.batteryCharge;
globalItemSet(GLOBALMAP_BATTERY_CHARGE, &batteryCharge);
globalItemSet(GLOBALMAP_BATTERY_LEVEL, &batteryLow);
audioPlayMp3(CHARGE_SOUND_END, NULL, true, true);
}
else if ((batteryCharge == CHARGE_STATUS_CHARGING) && (status.batteryCharge == CHARGE_STATUS_FINISH))
{
batteryCharge = status.batteryCharge;
globalItemSet(GLOBALMAP_BATTERY_CHARGE, &batteryCharge);
audioPlayMp3(BATTRY_SOUND_100, NULL, true, true);
}
if ((status.batteryLevel == 0) && (status.batteryCharge == CHARGE_STATUS_DISCONNECT) && (batteryLow == false))
{
batteryLow = true;
globalItemSet(GLOBALMAP_BATTERY_LEVEL, &batteryLow);
audioPlayMp3(BATTRY_SOUND_LOW, NULL, true, true);
audioPlayMp3(POWER_SOUND_OFF, pwrKeyStartPowerOff, true, true);
}
break;
default:
break;
}
#endif
return 0;
}
int32_t speakerAppAfterDraw()
{
return 0;
}
int32_t speakerAppDestory()
{
return 0;
}
void storageTest(uint32_t syscallTable)
{
FILE *file = NULL;
struct stat buf = {0};
char buffer[32] = {0};
printf("storageTest\r\n");
file = file_fopen(DEFAULT_INFO, "r");
if (file == NULL)
{
printf("Failed to open the file %s.\r\n", DEFAULT_INFO);
return;
}
file_fstat((int)file, &buf);
if (buf.st_size == 0)
{
printf("File is empty.\r\n");
goto labelEnd;
}
if (buf.st_size > (sizeof(buffer) - 1))
{
printf("Buffer is too small.\r\n");
goto labelEnd;
}
file_fread((void *)buffer, buf.st_size, 1, file);
buffer[buf.st_size] = 0;
printf("Below is the content of the file "DEFAULT_INFO".\r\n%s\r\n", buffer);
labelEnd:
file_fclose(file);
}
void semaphoreTest(uint32_t syscallTable)
{
osSemaphoreId_t semaphoreId;
printf("semaphoreTest\r\n");
semaphoreId = osSemaphoreNew(1, 0, NULL);
printf("Release semaphore.\r\n");
osSemaphoreRelease(semaphoreId);
printf("Wait semaphore.\r\n");
osSemaphoreAcquire(semaphoreId, osWaitForever);
printf("Received semaphore.\r\n\r\n");
}
void messageQueueTest(uint32_t syscallTable)
{
osMessageQueueId_t messageQueueId;
uint32_t testData = 0x12;
uint32_t testData2 = 0;
printf("messageQueueTest\r\n");
messageQueueId = osMessageQueueNew(1, 4, NULL);
printf("Put queue: 0x%X\r\n", testData);
osMessageQueuePut(messageQueueId, &testData, 0, 0);
printf("Wait queue.\r\n");
osMessageQueueGet(messageQueueId, &testData2, 0, osWaitForever);
printf("Received queue: 0x%X\r\n\r\n", testData2);
}
void ThreadApiTest(void *argument)
{
uint32_t syscallTable = *((uint32_t *)argument);
#if (TEST_API == 1)
uint32_t count = 0;
osDelay(2000);
storageTest(syscallTable);
semaphoreTest(syscallTable);
messageQueueTest(syscallTable);
while (1)
{
printf("osDelay %ds\r\n", count++);
osDelay(1000 * count);
}
#else
osThreadExit();
#endif
}
void apiTestInit(uint32_t syscallTable, uint32_t appImageLocation)
{
osThreadAttr_t threadAttr;
threadAttr.name = "ThreadApiTest";
threadAttr.stack_mem = NULL;
threadAttr.stack_size = THREAD_STACK_SIZE_API_TEST;
threadAttr.priority = osPriorityNormal;
osThreadNew(appImageLocation + app_ThreadApiTest_addr, globalItemGet(GLOBALMAP_SYSCALL_TABLE), &threadAttr);
}
void main(uint32_t syscallTable, uint32_t appImageLocation, uint32_t reserved2, uint32_t reserved3)
{
char version[5];
*((uint32_t *)version) = *apiVersion;
version[4] = 0;
printf("OpenSDK API Version: %s\r\n", version);
printf("A:Hello world\r\n");
globalmapInit(GLOBALMAP_SYSCALL_TABLE, &syscallTable, sizeof(syscallTable));
globalmapInit(GLOBALMAP_SPEAKER_APP_INFO, NULL, sizeof(AppInfoT));
globalmapInit(GLOBALMAP_SPEAKER_APP_WND, NULL, sizeof(uint32_t *));
AppT speakerApp =
{
globalItemGet(GLOBALMAP_SPEAKER_APP_INFO),
globalItemGet(GLOBALMAP_SPEAKER_APP_WND),
appImageLocation + app_speakerAppInit_addr, //speakerAppInit
appImageLocation + app_speakerAppPreDraw_addr, //speakerAppPreDraw
appImageLocation + app_speakerAppMsgProc_addr, //speakerAppMsgProc
appImageLocation + app_speakerAppAfterDraw_addr, //speakerAppAfterDraw
appImageLocation + app_speakerAppDestory_addr, //speakerAppDestory
};
globalmapInit(GLOBALMAP_SPEAKER_APP, &speakerApp, sizeof(speakerApp));
mountApp(globalItemGet(GLOBALMAP_SPEAKER_APP), 5);
setActiveApp(5);
globalmapInit(GLOBALMAP_BATTERY_LEVEL, NULL, sizeof(uint8_t));
globalmapInit(GLOBALMAP_BATTERY_CHARGE, NULL, sizeof(bool));
globalmapInit(GLOBALMAP_BATTERY_LOW, NULL, sizeof(bool));
globalmapInit(GLOBALMAP_SIM_STATUS, NULL, sizeof(uint8_t));
globalmapInit(GLOBALMAP_NW_READY, NULL, sizeof(bool));
globalmapInit(GLOBALMAP_SERVER_READY, NULL, sizeof(bool));
apiTestInit(syscallTable, appImageLocation);
}

View File

@ -0,0 +1,112 @@
from elftools.elf.elffile import ELFFile
import re,os
hdr_str=["#include \"opensdk.h\"\n"]
symbol_table_org=[]
symbol_table = []
gen_table=[]
def get_export_func(f):
file = open(f, 'r')
try:
while True:
line = file.readline()
if line:
# print ("line=",line)
tmp = re.findall(r"EXPORT_FUNC\((.+)\)",line)
if tmp:
print(tmp[0])
symbol_table_org.append(line)
symbol_table.append(tmp[0])
print("#define app_"+tmp[0]+"_addr ")
else:
break
finally:
file.close()
print(symbol_table)
print("get_export_func")
def get_info_from_elf(e_file): # e_file为需要读取的elf文件
tmp_dict = {} # 这个字典用于存放变量名和变量地址的对应关系
file = open(e_file, 'rb')
elf_file_obj = ELFFile(file)
data_section = elf_file_obj.get_section_by_name('.data')
data_address = data_section.header["sh_addr"]
print(data_section.data())
print("data addr:0x%X"%data_address)
dfile = open("test.data.bin", 'wb')
dfile.write(data_section.data());
dfile.close()
text_section = elf_file_obj.get_section_by_name(".text")
base_address = text_section.header["sh_addr"]
print(text_section.data())
print("text addr:0x%X"%base_address)
tfile = open("test.text.bin", 'wb')
tfile.write(text_section.data());
tfile.close()
# got_section = elf_file_obj.get_section_by_name('.got')
# got_address = got_section.header["sh_addr"]
# print(got_section.data())
# print("got addr:0x%X"%got_address)
# gfile = open("test.got.bin", 'wb')
# gfile.write(got_section.data());
# gfile.close()
# plt_section = elf_file_obj.get_section_by_name('.got.plt')
# plt_address = plt_section.header["sh_addr"]
# print(plt_section.data())
# print("plt addr:0x%X"%plt_address)
# pfile = open("test.plt.bin", 'wb')
# pfile.write(plt_section.data());
# pfile.close()
for section in elf_file_obj.iter_sections():
# 此处把地址以16进制的字符串形式存入字典可选择自己需要的格式。
print(section)
# tmp_dict[s.name] = str(hex(s.entry["st_value"]))section
file.close()
return tmp_dict
def gen_hdr(e_file):
print("gen header file")
tmp_dict = {}
file = open(e_file, 'rb')
elf_file_obj = ELFFile(file)
symbol_table_name = elf_file_obj.get_section_by_name(".symtab")
for sym in symbol_table_name.iter_symbols():
print(sym.name)
print(sym['st_value'])
if sym.name in symbol_table:
gen_table.append("#define app_"+sym.name+"_addr "+str(hex(sym['st_value']))+"\n")
print("insert one sym")
print(gen_table)
f = open("export_new.h", 'w')
for line in hdr_str:
f.writelines(line)
f.writelines("\n")
for line in symbol_table_org:
f.writelines(line)
f.writelines("\n")
for line in gen_table:
f.writelines(line)
f.close()
try:
os.remove("inc/export.h")
except:
print("no inc/export.h")
os.rename("export_new.h","inc/export.h")
get_info_from_elf("test.elf")
get_export_func("inc/export.h")
gen_hdr("test.elf")

View File

@ -0,0 +1,49 @@
import os
import sys
import shutil
import struct
def update_file(path, list_value):
content = bytes()
for value in list_value:
content = content + value
if os.path.exists(path):
file = open(path, mode='rb')
content = content + file.read()
file.close()
file = open(os.path.dirname(path) + '/pack.app', mode='wb')
file.write(content)
file.close()
else:
print('Error: ' + path + ' is not exists.')
if __name__ == '__main__':
root = os.path.dirname(os.path.realpath(__file__)) + '/../../../'
path = root + 'PLAT/appsdk_dyn/main.bin'
name = b'app0' + bytes(4)
size = struct.pack('I', os.path.getsize(path))
reserved_0 = bytes(4)
reserved_1 = bytes(16)
list_value = [name, size, reserved_0, reserved_1]
textOffset = bytes(4)
textSize = bytes(4)
textRelocation = bytes(4)
dataOffset = bytes(4)
dataSize = bytes(4)
dataRelocation = bytes(4)
resourceOffset = bytes(4)
resourceSize = bytes(4)
resourceRelocation = bytes(4)
reserved3 = bytes(12)
list_value = [name, size, reserved_0, reserved_1, textOffset, textSize, textRelocation, dataOffset, dataSize, dataRelocation, resourceOffset, resourceSize, resourceRelocation, reserved3]
update_file(path, list_value)
print('End')

View File

@ -0,0 +1,39 @@
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000, LENGTH = 0x40000 /* 256K */
RAM (rwx) : ORIGIN = 0x40000, LENGTH = 0x40000 /* 256K */
}
SECTIONS
{
.text :
{
*(.text.startup.main)
*(.text*)
*(.rodata*)
. = ALIGN(4);
LONG (__data_start__)
*(.data*)
LONG (__data_end__ - __data_start__)
. = ALIGN(4);
LONG (__bss_start__)
*(.bss*)
LONG (__bss_end__ - __bss_start__)
} > FLASH
.data :
{
. = ALIGN(4);
__data_start__ = .;
*(.data*)
__data_end__ = .;
. = ALIGN(4);
__bss_start__ = .;
*(.bss*)
*(COMMON)
. = ALIGN(4);
__bss_end__ = .;
} > RAM
}

Binary file not shown.

View File

@ -0,0 +1,99 @@
ifeq ($(TOOLCHAIN),GCC)
PRECINIT_FILE_PATH ?= PLAT/device/target/board/$(TARGET)/$(CORE)/gcc
SYSCALLS_FILE_PATH ?= PLAT/device/target/board/$(TARGET)/$(CORE)/gcc
SYSTEM_FILE_PATH ?= PLAT/device/target/board/$(TARGET)/$(CORE)/src
STARTUP_FILE_PATH ?= PLAT/device/target/board/$(TARGET)/$(CORE)/gcc
LINK_FILE_PATH ?= PLAT/device/target/board/$(TARGET)/$(CORE)/gcc
endif
ifeq ($(TOOLCHAIN),ARMCC)
PRECINIT_FILE_PATH ?= PLAT/device/target/board/$(TARGET)/$(CORE)/keil
SYSTEM_FILE_PATH ?= PLAT/device/target/board/$(TARGET)/$(CORE)/src
STARTUP_FILE_PATH ?= PLAT/device/target/board/$(TARGET)/$(CORE)/keil
LINK_FILE_PATH ?= PLAT/device/target/board/$(TARGET)/$(CORE)/keil
endif
##$(error "error $(MAIN_FILE_PATH)")
CFLAGS_INC += -I$(TOP)/PLAT/device/target/board/common/ARMCM3/inc \
-I$(TOP)/PLAT/device/target/board/$(TARGET)/common/inc \
-I$(TOP)/PLAT/device/target/board/$(TARGET)/common/pkginc
ifeq ($(TOOLCHAIN),GCC)
ifeq ($(EC718XM_LD_AND_PREC), y)
libstartup-y := $(PRECINIT_FILE_PATH)/ec718xm/prec_init.o \
$(SYSCALLS_FILE_PATH)/syscalls.o \
$(SYSTEM_FILE_PATH)/system_$(CHIP).o \
$(STARTUP_FILE_PATH)/startup_$(CHIP)_gcc.o
else
libstartup-y := $(PRECINIT_FILE_PATH)/prec_init.o \
$(SYSCALLS_FILE_PATH)/syscalls.o \
$(SYSTEM_FILE_PATH)/system_$(CHIP).o \
$(STARTUP_FILE_PATH)/startup_$(CHIP)_gcc.o
endif
STARTUP_OBJS := $(addprefix $(BUILDDIR)/,$(libstartup-y))
ifneq ($(MAKECMDGOALS), unilog)
-include $(STARTUP_OBJS:.o=.d)
endif
CFLAGS_INC += -I$(TOP)/PLAT/device/target/board/$(TARGET)/$(CORE)/gcc \
-I$(TOP)/PLAT/device/target/board/$(TARGET)/$(CORE)/inc
lib-y += libstartup.a
$(BUILDDIR)/lib/libstartup.a: $(STARTUP_OBJS)
@mkdir -p $(dir $@)
$(ECHO) AR $@
$(Q)$(AR) -cr $@ $^
ifeq ($(SOC_DEBUG), y)
LD_FILE ?= $(TOP)/PLAT/device/target/board/$(TARGET)/$(CORE)/gcc/ec718xm/$(TARGET)_soc.ld
else
ifeq ($(EC718XM_LD_AND_PREC), y)
LD_FILE ?= $(TOP)/PLAT/device/target/board/$(TARGET)/$(CORE)/gcc/ec718xm/$(TARGET)_flash.ld
else
LD_FILE ?= $(TOP)/PLAT/device/target/board/$(TARGET)/$(CORE)/gcc/$(TARGET)_flash.ld
endif
endif
endif
ifeq ($(TOOLCHAIN),ARMCC)
libstartup-y += $(PRECINIT_FILE_PATH)/prec_init.o \
$(SYSTEM_FILE_PATH)/system_$(CHIP).o \
$(STARTUP_FILE_PATH)/startup_$(CHIP).o
STARTUP_OBJS := $(addprefix $(BUILDDIR)/,$(libstartup-y))
ifneq ($(MAKECMDGOALS), unilog)
-include $(STARTUP_OBJS:.o=.d)
endif
##obj-y += $(STARTUP_FILE_PATH)/startup_$(CHIP).o
CFLAGS_INC += -I$(TOP)/PLAT/device/target/board/$(TARGET)/$(CORE)/keil \
-I$(TOP)/PLAT/device/target/board/$(TARGET)/$(CORE)/inc
lib-y += libstartup.lib
ifeq ($(FPGA_DEBUG),y)
linker-script-y := $(TOP)/$(LINK_FILE_PATH)/$(TARGET)_flash_fpga.sct
else
linker-script-y := $(TOP)/$(LINK_FILE_PATH)/$(TARGET)_flash.sct
endif
$(BUILDDIR)/lib/libstartup.lib: $(STARTUP_OBJS)
@mkdir -p $(dir $@)
$(ECHO) AR $@
$(Q)$(AR) $(ARFLAGS) $@ $^
endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,816 @@
/**************************************************************************//**
* @file cmsis_armcc.h
* @brief CMSIS compiler ARMCC (ARM compiler V5) header file
* @version V5.0.2
* @date 13. February 2017
******************************************************************************/
/*
* Copyright (c) 2009-2017 ARM Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __CMSIS_ARMCC_H
#define __CMSIS_ARMCC_H
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 400677)
#error "Please use ARM Compiler Toolchain V4.0.677 or later!"
#endif
/* CMSIS compiler control architecture macros */
#if ((defined (__TARGET_ARCH_6_M ) && (__TARGET_ARCH_6_M == 1)) || \
(defined (__TARGET_ARCH_6S_M ) && (__TARGET_ARCH_6S_M == 1)) )
#define __ARM_ARCH_6M__ 1
#endif
#if (defined (__TARGET_ARCH_7_M ) && (__TARGET_ARCH_7_M == 1))
#define __ARM_ARCH_7M__ 1
#endif
#if (defined (__TARGET_ARCH_7E_M) && (__TARGET_ARCH_7E_M == 1))
#define __ARM_ARCH_7EM__ 1
#endif
/* __ARM_ARCH_8M_BASE__ not applicable */
/* __ARM_ARCH_8M_MAIN__ not applicable */
/* CMSIS compiler specific defines */
#ifndef __ASM
#define __ASM __asm
#endif
#ifndef __INLINE
#define __INLINE __inline
#endif
#ifndef __STATIC_INLINE
#define __STATIC_INLINE static __inline
#endif
#ifndef __NO_RETURN
#define __NO_RETURN __declspec(noreturn)
#endif
#ifndef __USED
#define __USED __attribute__((used))
#endif
#ifndef __WEAK
#define __WEAK __attribute__((weak))
#endif
#ifndef __PACKED
#define __PACKED __attribute__((packed))
#endif
#ifndef __PACKED_STRUCT
#define __PACKED_STRUCT __packed struct
#endif
#ifndef __PACKED_UNION
#define __PACKED_UNION __packed union
#endif
#ifndef __UNALIGNED_UINT32 /* deprecated */
#define __UNALIGNED_UINT32(x) (*((__packed uint32_t *)(x)))
#endif
#ifndef __UNALIGNED_UINT16_WRITE
#define __UNALIGNED_UINT16_WRITE(addr, val) ((*((__packed uint16_t *)(addr))) = (val))
#endif
#ifndef __UNALIGNED_UINT16_READ
#define __UNALIGNED_UINT16_READ(addr) (*((const __packed uint16_t *)(addr)))
#endif
#ifndef __UNALIGNED_UINT32_WRITE
#define __UNALIGNED_UINT32_WRITE(addr, val) ((*((__packed uint32_t *)(addr))) = (val))
#endif
#ifndef __UNALIGNED_UINT32_READ
#define __UNALIGNED_UINT32_READ(addr) (*((const __packed uint32_t *)(addr)))
#endif
#ifndef __ALIGNED
#define __ALIGNED(x) __attribute__((aligned(x)))
#endif
#ifndef __RESTRICT
#define __RESTRICT __restrict
#endif
#define ASM_CALLER
/* ########################### Core Function Access ########################### */
/** \ingroup CMSIS_Core_FunctionInterface
\defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
@{
*/
/**
\brief Enable IRQ Interrupts
\details Enables IRQ interrupts by clearing the I-bit in the CPSR.
Can only be executed in Privileged modes.
*/
/* intrinsic void __enable_irq(); */
#define __enable_irq() __set_PRIMASK(0)
/**
\brief Disable IRQ Interrupts
\details Disables IRQ interrupts by setting the I-bit in the CPSR.
Can only be executed in Privileged modes.
*/
/* intrinsic void __disable_irq(); */
#define __disable_irq() __set_PRIMASK(1)
/**
\brief Get Control Register
\details Returns the content of the Control Register.
\return Control Register value
*/
__STATIC_INLINE uint32_t __get_CONTROL(void)
{
register uint32_t __regControl __ASM("control");
return(__regControl);
}
/**
\brief Set Control Register
\details Writes the given value to the Control Register.
\param [in] control Control Register value to set
*/
__STATIC_INLINE void __set_CONTROL(uint32_t control)
{
register uint32_t __regControl __ASM("control");
__regControl = control;
}
/**
\brief Get IPSR Register
\details Returns the content of the IPSR Register.
\return IPSR Register value
*/
__STATIC_INLINE uint32_t __get_IPSR(void)
{
register uint32_t __regIPSR __ASM("ipsr");
return(__regIPSR);
}
/**
\brief Get APSR Register
\details Returns the content of the APSR Register.
\return APSR Register value
*/
__STATIC_INLINE uint32_t __get_APSR(void)
{
register uint32_t __regAPSR __ASM("apsr");
return(__regAPSR);
}
/**
\brief Get xPSR Register
\details Returns the content of the xPSR Register.
\return xPSR Register value
*/
__STATIC_INLINE uint32_t __get_xPSR(void)
{
register uint32_t __regXPSR __ASM("xpsr");
return(__regXPSR);
}
/**
\brief Get Process Stack Pointer
\details Returns the current value of the Process Stack Pointer (PSP).
\return PSP Register value
*/
__STATIC_INLINE uint32_t __get_PSP(void)
{
register uint32_t __regProcessStackPointer __ASM("psp");
return(__regProcessStackPointer);
}
/**
\brief Set Process Stack Pointer
\details Assigns the given value to the Process Stack Pointer (PSP).
\param [in] topOfProcStack Process Stack Pointer value to set
*/
__STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
{
register uint32_t __regProcessStackPointer __ASM("psp");
__regProcessStackPointer = topOfProcStack;
}
/**
\brief Get Main Stack Pointer
\details Returns the current value of the Main Stack Pointer (MSP).
\return MSP Register value
*/
__STATIC_INLINE uint32_t __get_MSP(void)
{
register uint32_t __regMainStackPointer __ASM("msp");
return(__regMainStackPointer);
}
/**
\brief Set Main Stack Pointer
\details Assigns the given value to the Main Stack Pointer (MSP).
\param [in] topOfMainStack Main Stack Pointer value to set
*/
__STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
{
register uint32_t __regMainStackPointer __ASM("msp");
__regMainStackPointer = topOfMainStack;
}
/**
\brief Get Priority Mask
\details Returns the current state of the priority mask bit from the Priority Mask Register.
\return Priority Mask value
*/
__STATIC_INLINE uint32_t __get_PRIMASK(void)
{
register uint32_t __regPriMask __ASM("primask");
return(__regPriMask);
}
/**
\brief Set Priority Mask
\details Assigns the given value to the Priority Mask Register.
\param [in] priMask Priority Mask
*/
__STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
{
register uint32_t __regPriMask __ASM("primask");
__regPriMask = (priMask);
}
#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
(defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
/**
\brief Enable FIQ
\details Enables FIQ interrupts by clearing the F-bit in the CPSR.
Can only be executed in Privileged modes.
*/
#define __enable_fault_irq __enable_fiq
/**
\brief Disable FIQ
\details Disables FIQ interrupts by setting the F-bit in the CPSR.
Can only be executed in Privileged modes.
*/
#define __disable_fault_irq __disable_fiq
/**
\brief Get Base Priority
\details Returns the current value of the Base Priority register.
\return Base Priority register value
*/
__STATIC_INLINE uint32_t __get_BASEPRI(void)
{
register uint32_t __regBasePri __ASM("basepri");
return(__regBasePri);
}
/**
\brief Set Base Priority
\details Assigns the given value to the Base Priority register.
\param [in] basePri Base Priority value to set
*/
__STATIC_INLINE void __set_BASEPRI(uint32_t basePri)
{
register uint32_t __regBasePri __ASM("basepri");
__regBasePri = (basePri & 0xFFU);
}
/**
\brief Set Base Priority with condition
\details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
or the new value increases the BASEPRI priority level.
\param [in] basePri Base Priority value to set
*/
__STATIC_INLINE void __set_BASEPRI_MAX(uint32_t basePri)
{
register uint32_t __regBasePriMax __ASM("basepri_max");
__regBasePriMax = (basePri & 0xFFU);
}
/**
\brief Get Fault Mask
\details Returns the current value of the Fault Mask register.
\return Fault Mask register value
*/
__STATIC_INLINE uint32_t __get_FAULTMASK(void)
{
register uint32_t __regFaultMask __ASM("faultmask");
return(__regFaultMask);
}
/**
\brief Set Fault Mask
\details Assigns the given value to the Fault Mask register.
\param [in] faultMask Fault Mask value to set
*/
__STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
{
register uint32_t __regFaultMask __ASM("faultmask");
__regFaultMask = (faultMask & (uint32_t)1U);
}
#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
(defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
#if ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
/**
\brief Get FPSCR
\details Returns the current value of the Floating Point Status/Control register.
\return Floating Point Status/Control register value
*/
__STATIC_INLINE uint32_t __get_FPSCR(void)
{
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined (__FPU_USED ) && (__FPU_USED == 1U)) )
register uint32_t __regfpscr __ASM("fpscr");
return(__regfpscr);
#else
return(0U);
#endif
}
/**
\brief Set FPSCR
\details Assigns the given value to the Floating Point Status/Control register.
\param [in] fpscr Floating Point Status/Control value to set
*/
__STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
{
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined (__FPU_USED ) && (__FPU_USED == 1U)) )
register uint32_t __regfpscr __ASM("fpscr");
__regfpscr = (fpscr);
#else
(void)fpscr;
#endif
}
#endif /* ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
/*@} end of CMSIS_Core_RegAccFunctions */
/* ########################## Core Instruction Access ######################### */
/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
Access to dedicated instructions
@{
*/
/**
\brief No Operation
\details No Operation does nothing. This instruction can be used for code alignment purposes.
*/
#define __NOP __nop
/**
\brief Wait For Interrupt
\details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
*/
#define __WFI __wfi
/**
\brief Wait For Event
\details Wait For Event is a hint instruction that permits the processor to enter
a low-power state until one of a number of events occurs.
*/
#define __WFE __wfe
/**
\brief Send Event
\details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
*/
#define __SEV __sev
/**
\brief Instruction Synchronization Barrier
\details Instruction Synchronization Barrier flushes the pipeline in the processor,
so that all instructions following the ISB are fetched from cache or memory,
after the instruction has been completed.
*/
#define __ISB() do {\
__schedule_barrier();\
__isb(0xF);\
__schedule_barrier();\
} while (0U)
/**
\brief Data Synchronization Barrier
\details Acts as a special kind of Data Memory Barrier.
It completes when all explicit memory accesses before this instruction complete.
*/
#define __DSB() do {\
__schedule_barrier();\
__dsb(0xF);\
__schedule_barrier();\
} while (0U)
/**
\brief Data Memory Barrier
\details Ensures the apparent order of the explicit memory operations before
and after the instruction, without ensuring their completion.
*/
#define __DMB() do {\
__schedule_barrier();\
__dmb(0xF);\
__schedule_barrier();\
} while (0U)
/**
\brief Reverse byte order (32 bit)
\details Reverses the byte order in integer value.
\param [in] value Value to reverse
\return Reversed value
*/
#define __REV __rev
/**
\brief Reverse byte order (16 bit)
\details Reverses the byte order in two unsigned short values.
\param [in] value Value to reverse
\return Reversed value
*/
#ifndef __NO_EMBEDDED_ASM
__attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value)
{
rev16 r0, r0
bx lr
}
#endif
/**
\brief Reverse byte order in signed short value
\details Reverses the byte order in a signed short value with sign extension to integer.
\param [in] value Value to reverse
\return Reversed value
*/
#ifndef __NO_EMBEDDED_ASM
__attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int32_t __REVSH(int32_t value)
{
revsh r0, r0
bx lr
}
#endif
/**
\brief Rotate Right in unsigned value (32 bit)
\details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
\param [in] op1 Value to rotate
\param [in] op2 Number of Bits to rotate
\return Rotated value
*/
#define __ROR __ror
/**
\brief Breakpoint
\details Causes the processor to enter Debug state.
Debug tools can use this to investigate system state when the instruction at a particular address is reached.
\param [in] value is ignored by the processor.
If required, a debugger can use it to store additional information about the breakpoint.
*/
#define __BKPT(value) __breakpoint(value)
/**
\brief Reverse bit order of value
\details Reverses the bit order of the given value.
\param [in] value Value to reverse
\return Reversed value
*/
#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
(defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
#define __RBIT __rbit
#else
__attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
{
uint32_t result;
int32_t s = (4 /*sizeof(v)*/ * 8) - 1; /* extra shift needed at end */
result = value; /* r will be reversed bits of v; first get LSB of v */
for (value >>= 1U; value; value >>= 1U)
{
result <<= 1U;
result |= value & 1U;
s--;
}
result <<= s; /* shift when v's highest bits are zero */
return(result);
}
#endif
/**
\brief Count leading zeros
\details Counts the number of leading zeros of a data value.
\param [in] value Value to count the leading zeros
\return number of leading zeros in value
*/
#define __CLZ __clz
#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
(defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
/**
\brief LDR Exclusive (8 bit)
\details Executes a exclusive LDR instruction for 8 bit value.
\param [in] ptr Pointer to data
\return value of type uint8_t at (*ptr)
*/
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
#define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr))
#else
#define __LDREXB(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint8_t ) __ldrex(ptr)) _Pragma("pop")
#endif
/**
\brief LDR Exclusive (16 bit)
\details Executes a exclusive LDR instruction for 16 bit values.
\param [in] ptr Pointer to data
\return value of type uint16_t at (*ptr)
*/
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
#define __LDREXH(ptr) ((uint16_t) __ldrex(ptr))
#else
#define __LDREXH(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint16_t) __ldrex(ptr)) _Pragma("pop")
#endif
/**
\brief LDR Exclusive (32 bit)
\details Executes a exclusive LDR instruction for 32 bit values.
\param [in] ptr Pointer to data
\return value of type uint32_t at (*ptr)
*/
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
#define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr))
#else
#define __LDREXW(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint32_t ) __ldrex(ptr)) _Pragma("pop")
#endif
/**
\brief STR Exclusive (8 bit)
\details Executes a exclusive STR instruction for 8 bit values.
\param [in] value Value to store
\param [in] ptr Pointer to location
\return 0 Function succeeded
\return 1 Function failed
*/
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
#define __STREXB(value, ptr) __strex(value, ptr)
#else
#define __STREXB(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
#endif
/**
\brief STR Exclusive (16 bit)
\details Executes a exclusive STR instruction for 16 bit values.
\param [in] value Value to store
\param [in] ptr Pointer to location
\return 0 Function succeeded
\return 1 Function failed
*/
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
#define __STREXH(value, ptr) __strex(value, ptr)
#else
#define __STREXH(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
#endif
/**
\brief STR Exclusive (32 bit)
\details Executes a exclusive STR instruction for 32 bit values.
\param [in] value Value to store
\param [in] ptr Pointer to location
\return 0 Function succeeded
\return 1 Function failed
*/
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
#define __STREXW(value, ptr) __strex(value, ptr)
#else
#define __STREXW(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
#endif
/**
\brief Remove the exclusive lock
\details Removes the exclusive lock which is created by LDREX.
*/
#define __CLREX __clrex
/**
\brief Signed Saturate
\details Saturates a signed value.
\param [in] value Value to be saturated
\param [in] sat Bit position to saturate to (1..32)
\return Saturated value
*/
#define __SSAT __ssat
/**
\brief Unsigned Saturate
\details Saturates an unsigned value.
\param [in] value Value to be saturated
\param [in] sat Bit position to saturate to (0..31)
\return Saturated value
*/
#define __USAT __usat
/**
\brief Rotate Right with Extend (32 bit)
\details Moves each bit of a bitstring right by one bit.
The carry input is shifted in at the left end of the bitstring.
\param [in] value Value to rotate
\return Rotated value
*/
#ifndef __NO_EMBEDDED_ASM
__attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint32_t value)
{
rrx r0, r0
bx lr
}
#endif
/**
\brief LDRT Unprivileged (8 bit)
\details Executes a Unprivileged LDRT instruction for 8 bit value.
\param [in] ptr Pointer to data
\return value of type uint8_t at (*ptr)
*/
#define __LDRBT(ptr) ((uint8_t ) __ldrt(ptr))
/**
\brief LDRT Unprivileged (16 bit)
\details Executes a Unprivileged LDRT instruction for 16 bit values.
\param [in] ptr Pointer to data
\return value of type uint16_t at (*ptr)
*/
#define __LDRHT(ptr) ((uint16_t) __ldrt(ptr))
/**
\brief LDRT Unprivileged (32 bit)
\details Executes a Unprivileged LDRT instruction for 32 bit values.
\param [in] ptr Pointer to data
\return value of type uint32_t at (*ptr)
*/
#define __LDRT(ptr) ((uint32_t ) __ldrt(ptr))
/**
\brief STRT Unprivileged (8 bit)
\details Executes a Unprivileged STRT instruction for 8 bit values.
\param [in] value Value to store
\param [in] ptr Pointer to location
*/
#define __STRBT(value, ptr) __strt(value, ptr)
/**
\brief STRT Unprivileged (16 bit)
\details Executes a Unprivileged STRT instruction for 16 bit values.
\param [in] value Value to store
\param [in] ptr Pointer to location
*/
#define __STRHT(value, ptr) __strt(value, ptr)
/**
\brief STRT Unprivileged (32 bit)
\details Executes a Unprivileged STRT instruction for 32 bit values.
\param [in] value Value to store
\param [in] ptr Pointer to location
*/
#define __STRT(value, ptr) __strt(value, ptr)
#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
(defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
/* ################### Compiler specific Intrinsics ########################### */
/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
Access to dedicated SIMD instructions
@{
*/
#if ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
#define __SADD8 __sadd8
#define __QADD8 __qadd8
#define __SHADD8 __shadd8
#define __UADD8 __uadd8
#define __UQADD8 __uqadd8
#define __UHADD8 __uhadd8
#define __SSUB8 __ssub8
#define __QSUB8 __qsub8
#define __SHSUB8 __shsub8
#define __USUB8 __usub8
#define __UQSUB8 __uqsub8
#define __UHSUB8 __uhsub8
#define __SADD16 __sadd16
#define __QADD16 __qadd16
#define __SHADD16 __shadd16
#define __UADD16 __uadd16
#define __UQADD16 __uqadd16
#define __UHADD16 __uhadd16
#define __SSUB16 __ssub16
#define __QSUB16 __qsub16
#define __SHSUB16 __shsub16
#define __USUB16 __usub16
#define __UQSUB16 __uqsub16
#define __UHSUB16 __uhsub16
#define __SASX __sasx
#define __QASX __qasx
#define __SHASX __shasx
#define __UASX __uasx
#define __UQASX __uqasx
#define __UHASX __uhasx
#define __SSAX __ssax
#define __QSAX __qsax
#define __SHSAX __shsax
#define __USAX __usax
#define __UQSAX __uqsax
#define __UHSAX __uhsax
#define __USAD8 __usad8
#define __USADA8 __usada8
#define __SSAT16 __ssat16
#define __USAT16 __usat16
#define __UXTB16 __uxtb16
#define __UXTAB16 __uxtab16
#define __SXTB16 __sxtb16
#define __SXTAB16 __sxtab16
#define __SMUAD __smuad
#define __SMUADX __smuadx
#define __SMLAD __smlad
#define __SMLADX __smladx
#define __SMLALD __smlald
#define __SMLALDX __smlaldx
#define __SMUSD __smusd
#define __SMUSDX __smusdx
#define __SMLSD __smlsd
#define __SMLSDX __smlsdx
#define __SMLSLD __smlsld
#define __SMLSLDX __smlsldx
#define __SEL __sel
#define __QADD __qadd
#define __QSUB __qsub
#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \
((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) )
#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \
((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) )
#define __SMMLA(ARG1,ARG2,ARG3) ( (int32_t)((((int64_t)(ARG1) * (ARG2)) + \
((int64_t)(ARG3) << 32U) ) >> 32U))
#endif /* ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
/*@} end of group CMSIS_SIMD_intrinsics */
#endif /* __CMSIS_ARMCC_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,361 @@
/**************************************************************************//**
* @file cmsis_compiler.h
* @brief CMSIS compiler generic header file
* @version V5.0.2
* @date 13. February 2017
******************************************************************************/
/*
* Copyright (c) 2009-2017 ARM Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __CMSIS_COMPILER_H
#define __CMSIS_COMPILER_H
#include <stdint.h>
/*
* ARM Compiler 4/5
*/
#if defined ( __CC_ARM )
#include "cmsis_armcc.h"
#ifndef __FORCEINLINE
#define __FORCEINLINE __forceinline
#endif
#define __GET_RETURN_ADDRESS() __return_address()
/*
* ARM Compiler 6 (armclang)
*/
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#include "cmsis_armclang.h"
/*
* GNU Compiler
*/
#elif defined ( __GNUC__ )
#include "cmsis_gcc.h"
#ifndef __FORCEINLINE
#define __FORCEINLINE __attribute__((always_inline)) inline
#endif
#define __GET_RETURN_ADDRESS() __builtin_return_address(0)
/*
* IAR Compiler
*/
#elif defined ( __ICCARM__ )
#ifndef __ASM
#define __ASM __asm
#endif
#ifndef __INLINE
#define __INLINE inline
#endif
#ifndef __STATIC_INLINE
#define __STATIC_INLINE static inline
#endif
#include <cmsis_iar.h>
/* CMSIS compiler control architecture macros */
#if (__CORE__ == __ARM6M__) || (__CORE__ == __ARM6SM__)
#ifndef __ARM_ARCH_6M__
#define __ARM_ARCH_6M__ 1
#endif
#elif (__CORE__ == __ARM7M__)
#ifndef __ARM_ARCH_7M__
#define __ARM_ARCH_7M__ 1
#endif
#elif (__CORE__ == __ARM7EM__)
#ifndef __ARM_ARCH_7EM__
#define __ARM_ARCH_7EM__ 1
#endif
#endif
#ifndef __NO_RETURN
#define __NO_RETURN __noreturn
#endif
#ifndef __USED
#define __USED __root
#endif
#ifndef __WEAK
#define __WEAK __weak
#endif
#ifndef __PACKED
#define __PACKED __packed
#endif
#ifndef __PACKED_STRUCT
#define __PACKED_STRUCT __packed struct
#endif
#ifndef __PACKED_UNION
#define __PACKED_UNION __packed union
#endif
#ifndef __UNALIGNED_UINT32 /* deprecated */
__packed struct T_UINT32 { uint32_t v; };
#define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
#endif
#ifndef __UNALIGNED_UINT16_WRITE
__PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
#define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
#endif
#ifndef __UNALIGNED_UINT16_READ
__PACKED_STRUCT T_UINT16_READ { uint16_t v; };
#define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
#endif
#ifndef __UNALIGNED_UINT32_WRITE
__PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
#define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
#endif
#ifndef __UNALIGNED_UINT32_READ
__PACKED_STRUCT T_UINT32_READ { uint32_t v; };
#define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
#endif
#ifndef __ALIGNED
#warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored.
#define __ALIGNED(x)
#endif
#ifndef __RESTRICT
#warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
#define __RESTRICT
#endif
// Workaround for missing __CLZ intrinsic in
// various versions of the IAR compilers.
// __IAR_FEATURE_CLZ__ should be defined by
// the compiler that supports __CLZ internally.
#if (defined (__ARM_ARCH_6M__)) && (__ARM_ARCH_6M__ == 1) && (!defined (__IAR_FEATURE_CLZ__))
__STATIC_INLINE uint32_t __CLZ(uint32_t data)
{
if (data == 0u) { return 32u; }
uint32_t count = 0;
uint32_t mask = 0x80000000;
while ((data & mask) == 0)
{
count += 1u;
mask = mask >> 1u;
}
return (count);
}
#endif
/*
* TI ARM Compiler
*/
#elif defined ( __TI_ARM__ )
#include <cmsis_ccs.h>
#ifndef __ASM
#define __ASM __asm
#endif
#ifndef __INLINE
#define __INLINE inline
#endif
#ifndef __STATIC_INLINE
#define __STATIC_INLINE static inline
#endif
#ifndef __NO_RETURN
#define __NO_RETURN __attribute__((noreturn))
#endif
#ifndef __USED
#define __USED __attribute__((used))
#endif
#ifndef __WEAK
#define __WEAK __attribute__((weak))
#endif
#ifndef __PACKED
#define __PACKED __attribute__((packed))
#endif
#ifndef __PACKED_STRUCT
#define __PACKED_STRUCT struct __attribute__((packed))
#endif
#ifndef __PACKED_UNION
#define __PACKED_UNION union __attribute__((packed))
#endif
#ifndef __UNALIGNED_UINT32 /* deprecated */
struct __attribute__((packed)) T_UINT32 { uint32_t v; };
#define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
#endif
#ifndef __UNALIGNED_UINT16_WRITE
__PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
#define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void*)(addr))->v) = (val))
#endif
#ifndef __UNALIGNED_UINT16_READ
__PACKED_STRUCT T_UINT16_READ { uint16_t v; };
#define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
#endif
#ifndef __UNALIGNED_UINT32_WRITE
__PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
#define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
#endif
#ifndef __UNALIGNED_UINT32_READ
__PACKED_STRUCT T_UINT32_READ { uint32_t v; };
#define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
#endif
#ifndef __ALIGNED
#define __ALIGNED(x) __attribute__((aligned(x)))
#endif
#ifndef __RESTRICT
#warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
#define __RESTRICT
#endif
/*
* TASKING Compiler
*/
#elif defined ( __TASKING__ )
/*
* The CMSIS functions have been implemented as intrinsics in the compiler.
* Please use "carm -?i" to get an up to date list of all intrinsics,
* Including the CMSIS ones.
*/
#ifndef __ASM
#define __ASM __asm
#endif
#ifndef __INLINE
#define __INLINE inline
#endif
#ifndef __STATIC_INLINE
#define __STATIC_INLINE static inline
#endif
#ifndef __NO_RETURN
#define __NO_RETURN __attribute__((noreturn))
#endif
#ifndef __USED
#define __USED __attribute__((used))
#endif
#ifndef __WEAK
#define __WEAK __attribute__((weak))
#endif
#ifndef __PACKED
#define __PACKED __packed__
#endif
#ifndef __PACKED_STRUCT
#define __PACKED_STRUCT struct __packed__
#endif
#ifndef __PACKED_UNION
#define __PACKED_UNION union __packed__
#endif
#ifndef __UNALIGNED_UINT32 /* deprecated */
struct __packed__ T_UINT32 { uint32_t v; };
#define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
#endif
#ifndef __UNALIGNED_UINT16_WRITE
__PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
#define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
#endif
#ifndef __UNALIGNED_UINT16_READ
__PACKED_STRUCT T_UINT16_READ { uint16_t v; };
#define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
#endif
#ifndef __UNALIGNED_UINT32_WRITE
__PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
#define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
#endif
#ifndef __UNALIGNED_UINT32_READ
__PACKED_STRUCT T_UINT32_READ { uint32_t v; };
#define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
#endif
#ifndef __ALIGNED
#define __ALIGNED(x) __align(x)
#endif
#ifndef __RESTRICT
#warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
#define __RESTRICT
#endif
/*
* COSMIC Compiler
*/
#elif defined ( __CSMC__ )
#include <cmsis_csm.h>
#ifndef __ASM
#define __ASM _asm
#endif
#ifndef __INLINE
#define __INLINE inline
#endif
#ifndef __STATIC_INLINE
#define __STATIC_INLINE static inline
#endif
#ifndef __NO_RETURN
// NO RETURN is automatically detected hence no warning here
#define __NO_RETURN
#endif
#ifndef __USED
#warning No compiler specific solution for __USED. __USED is ignored.
#define __USED
#endif
#ifndef __WEAK
#define __WEAK __weak
#endif
#ifndef __PACKED
#define __PACKED @packed
#endif
#ifndef __PACKED_STRUCT
#define __PACKED_STRUCT @packed struct
#endif
#ifndef __PACKED_UNION
#define __PACKED_UNION @packed union
#endif
#ifndef __UNALIGNED_UINT32 /* deprecated */
@packed struct T_UINT32 { uint32_t v; };
#define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
#endif
#ifndef __UNALIGNED_UINT16_WRITE
__PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
#define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
#endif
#ifndef __UNALIGNED_UINT16_READ
__PACKED_STRUCT T_UINT16_READ { uint16_t v; };
#define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
#endif
#ifndef __UNALIGNED_UINT32_WRITE
__PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
#define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
#endif
#ifndef __UNALIGNED_UINT32_READ
__PACKED_STRUCT T_UINT32_READ { uint32_t v; };
#define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
#endif
#ifndef __ALIGNED
#warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored.
#define __ALIGNED(x)
#endif
#ifndef __RESTRICT
#warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
#define __RESTRICT
#endif
#else
#error Unknown compiler.
#endif
#endif /* __CMSIS_COMPILER_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
/**************************************************************************//**
* @file cmsis_version.h
* @brief CMSIS Core(M) Version definitions
* @version V5.0.2
* @date 19. April 2017
******************************************************************************/
/*
* Copyright (c) 2009-2017 ARM Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined ( __ICCARM__ )
#pragma system_include /* treat file as system include file for MISRA check */
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#pragma clang system_header /* treat file as system include file */
#endif
#ifndef __CMSIS_VERSION_H
#define __CMSIS_VERSION_H
/* CMSIS Version definitions */
#define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */
#define __CM_CMSIS_VERSION_SUB ( 0U) /*!< [15:0] CMSIS Core(M) sub version */
#define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \
__CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */
#endif

View File

@ -0,0 +1,133 @@
/****************************************************************************
*
* Copy right: 2017-, Copyrigths of EigenComm Ltd.
* File name: CommonTypedef.h
* Description: Common type define file
* History: 08/23/2017 Originated by Yunfei Li
*
****************************************************************************/
#ifndef _COMMON_TYPEDEF_H
#define _COMMON_TYPEDEF_H
#ifndef WIN32
#include "cmsis_compiler.h"
#else
#define __FORCEINLINE __inline
typedef unsigned long uint32_t;
#endif
//#define PUBLIC_CMCC_EDRX_DEBUG 1
/*****************************************************************************
armcc definition
char 8 1 (byte-aligned) 0 to 255 (unsigned) by default.
C128 to 127 (signed) when compiled with
--signed_chars.
signed char 8 1 (byte-aligned) ¨C128 to 127
unsigned char 8 1 (byte-aligned) 0 to 255
(signed) short 16 2 (halfword-aligned) ¨C32,768 to 32,767
unsigned short 16 2 (halfword-aligned) 0 to 65,535
(signed) int 32 4 (word-aligned) ¨C2,147,483,648 to 2,147,483,647
unsigned int 32 4 (word-aligned) 0 to 4,294,967,295
(signed) long 32 4 (word-aligned) ¨C2,147,483,648 to 2,147,483,647
unsigned long 32 4 (word-aligned) 0 to 4,294,967,295
(signed) long long 64 8 (doubleword-aligned) ¨C9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
unsigned long long 64 8 (doubleword-aligned) 0 to 18,446,744,073,709,551,615
float 32 4 (word-aligned) 1.175494351e-38 to 3.40282347e+38 (normalized values)
double 64 8 (doubleword-aligned) 2.22507385850720138e-308 to 1.79769313486231571e
+308 (normalized values)
long double 64 8 (doubleword-aligned) 2.22507385850720138e-308 to 1.79769313486231571e
+308 (normalized values)
wchar_t 16 2 (halfword-aligned) 0 to 65,535 by default.
32 4 (word-aligned) 0 to 4,294,967,295 when compiled with --wchar32.
All pointers 32 4 (word-aligned) Not applicable.
bool (C++ only) 8 1 (byte-aligned) false or true
_Bool (C only) 8 1 (byte-aligned) false or true
*****************************************************************************/
//#define VC_VERSION /* defined for windows, if undefined, unix or linux */
#ifndef VC_VERSION
typedef signed char INT8;
typedef unsigned char UINT8;
typedef signed short INT16;
typedef unsigned short UINT16;
typedef signed long INT32;
typedef unsigned long UINT32;
typedef long long INT64;
typedef unsigned long long UINT64;
#if (!defined WIN32)||(!defined PHY_PC_UNILOG)
typedef unsigned char BOOL;
#else
#define BOOL UINT8
#endif
typedef char CHAR;
#else
typedef signed char INT8;
typedef unsigned char UINT8;
typedef signed short INT16;
typedef unsigned short UINT16;
typedef signed long INT32;
typedef unsigned long UINT32;
typedef __int64 INT64;
typedef unsigned __int64 UINT64;
typedef unsigned char BOOL;
typedef char CHAR;
#endif //#ifndef VC_VERSION
typedef void ( *PhyCBFunc_T )(void* sigBody);
typedef struct
{
INT32 integer;
INT32 fwl;
} DCXODouble;
#ifndef FALSE
#define FALSE ((BOOL)0)
#endif
#ifndef TRUE
#define TRUE ((BOOL)1)
#endif
#ifndef NULL
#define NULL 0
#endif
#ifndef PNULL
#define PNULL ((void*) NULL)
#endif
#ifndef PPNULL
#define PPNULL ((void*)((void*) NULL))
#endif
#define __IO volatile /*!< Defines 'read / write' permissions */
/* following defines should be used for structure members */
#define __IM volatile const /*! Defines 'read only' structure member permissions */
#define __OM volatile /*! Defines 'write only' structure member permissions */
#define __IOM volatile /*! Defines 'read / write' structure member permissions */
#define STRINGNIFY_IMPL(s) #s
#define _STRINGNIFY_(s) STRINGNIFY_IMPL(s)
#endif //#ifndef _COMMON_TYPEDEF_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,182 @@
/******************************************************************************
* @file mpu_armv7.h
* @brief CMSIS MPU API for ARMv7 MPU
* @version V5.0.2
* @date 09. June 2017
******************************************************************************/
/*
* Copyright (c) 2017 ARM Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ARM_MPU_ARMV7_H
#define ARM_MPU_ARMV7_H
#define ARM_MPU_REGION_SIZE_32B ((uint8_t)0x04U)
#define ARM_MPU_REGION_SIZE_64B ((uint8_t)0x05U)
#define ARM_MPU_REGION_SIZE_128B ((uint8_t)0x06U)
#define ARM_MPU_REGION_SIZE_256B ((uint8_t)0x07U)
#define ARM_MPU_REGION_SIZE_512B ((uint8_t)0x08U)
#define ARM_MPU_REGION_SIZE_1KB ((uint8_t)0x09U)
#define ARM_MPU_REGION_SIZE_2KB ((uint8_t)0x0AU)
#define ARM_MPU_REGION_SIZE_4KB ((uint8_t)0x0BU)
#define ARM_MPU_REGION_SIZE_8KB ((uint8_t)0x0CU)
#define ARM_MPU_REGION_SIZE_16KB ((uint8_t)0x0DU)
#define ARM_MPU_REGION_SIZE_32KB ((uint8_t)0x0EU)
#define ARM_MPU_REGION_SIZE_64KB ((uint8_t)0x0FU)
#define ARM_MPU_REGION_SIZE_128KB ((uint8_t)0x10U)
#define ARM_MPU_REGION_SIZE_256KB ((uint8_t)0x11U)
#define ARM_MPU_REGION_SIZE_512KB ((uint8_t)0x12U)
#define ARM_MPU_REGION_SIZE_1MB ((uint8_t)0x13U)
#define ARM_MPU_REGION_SIZE_2MB ((uint8_t)0x14U)
#define ARM_MPU_REGION_SIZE_4MB ((uint8_t)0x15U)
#define ARM_MPU_REGION_SIZE_8MB ((uint8_t)0x16U)
#define ARM_MPU_REGION_SIZE_16MB ((uint8_t)0x17U)
#define ARM_MPU_REGION_SIZE_32MB ((uint8_t)0x18U)
#define ARM_MPU_REGION_SIZE_64MB ((uint8_t)0x19U)
#define ARM_MPU_REGION_SIZE_128MB ((uint8_t)0x1AU)
#define ARM_MPU_REGION_SIZE_256MB ((uint8_t)0x1BU)
#define ARM_MPU_REGION_SIZE_512MB ((uint8_t)0x1CU)
#define ARM_MPU_REGION_SIZE_1GB ((uint8_t)0x1DU)
#define ARM_MPU_REGION_SIZE_2GB ((uint8_t)0x1EU)
#define ARM_MPU_REGION_SIZE_4GB ((uint8_t)0x1FU)
#define ARM_MPU_AP_NONE 0u
#define ARM_MPU_AP_PRIV 1u
#define ARM_MPU_AP_URO 2u
#define ARM_MPU_AP_FULL 3u
#define ARM_MPU_AP_PRO 5u
#define ARM_MPU_AP_RO 6u
/** MPU Region Base Address Register Value
*
* \param Region The region to be configured, number 0 to 15.
* \param BaseAddress The base address for the region.
*/
#define ARM_MPU_RBAR(Region, BaseAddress) ((BaseAddress & MPU_RBAR_ADDR_Msk) | (Region & MPU_RBAR_REGION_Msk) | (1UL << MPU_RBAR_VALID_Pos))
/**
* MPU Region Attribut and Size Register Value
*
* \param DisableExec Instruction access disable bit, 1= disable instruction fetches.
* \param AccessPermission Data access permissions, allows you to configure read/write access for User and Privileged mode.
* \param TypeExtField Type extension field, allows you to configure memory access type, for example strongly ordered, peripheral.
* \param IsShareable Region is shareable between multiple bus masters.
* \param IsCacheable Region is cacheable, i.e. its value may be kept in cache.
* \param IsBufferable Region is bufferable, i.e. using write-back caching. Cacheable but non-bufferable regions use write-through policy.
* \param SubRegionDisable Sub-region disable field.
* \param Size Region size of the region to be configured, for example 4K, 8K.
*/
#define ARM_MPU_RASR(DisableExec, AccessPermission, TypeExtField, IsShareable, IsCacheable, IsBufferable, SubRegionDisable, Size) \
((DisableExec << MPU_RASR_XN_Pos) & MPU_RASR_XN_Msk) | \
((AccessPermission << MPU_RASR_AP_Pos) & MPU_RASR_AP_Msk) | \
((TypeExtField << MPU_RASR_TEX_Pos) & MPU_RASR_TEX_Msk) | \
((IsShareable << MPU_RASR_S_Pos) & MPU_RASR_S_Msk) | \
((IsCacheable << MPU_RASR_C_Pos) & MPU_RASR_C_Msk) | \
((IsBufferable << MPU_RASR_B_Pos) & MPU_RASR_B_Msk) | \
((SubRegionDisable << MPU_RASR_SRD_Pos) & MPU_RASR_SRD_Msk) | \
((Size << MPU_RASR_SIZE_Pos) & MPU_RASR_SIZE_Msk) | \
((1UL << MPU_RASR_ENABLE_Pos) & MPU_RASR_ENABLE_Msk)
/**
* Struct for a single MPU Region
*/
typedef struct _ARM_MPU_Region_t {
uint32_t RBAR; //!< The region base address register value (RBAR)
uint32_t RASR; //!< The region attribute and size register value (RASR) \ref MPU_RASR
} ARM_MPU_Region_t;
/** Enable the MPU.
* \param MPU_Control Default access permissions for unconfigured regions.
*/
__STATIC_INLINE void ARM_MPU_Enable(uint32_t MPU_Control)
{
__DSB();
__ISB();
MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk;
#ifdef SCB_SHCSR_MEMFAULTENA_Msk
//SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk;
#endif
}
/** Disable the MPU.
*/
__STATIC_INLINE void ARM_MPU_Disable()
{
__DSB();
__ISB();
#ifdef SCB_SHCSR_MEMFAULTENA_Msk
SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk;
#endif
MPU->CTRL &= ~MPU_CTRL_ENABLE_Msk;
}
/** Clear and disable the given MPU region.
* \param rnr Region number to be cleared.
*/
__STATIC_INLINE void ARM_MPU_ClrRegion(uint32_t rnr)
{
MPU->RNR = rnr;
MPU->RASR = 0u;
}
/** Configure an MPU region.
* \param rbar Value for RBAR register.
* \param rsar Value for RSAR register.
*/
__STATIC_INLINE void ARM_MPU_SetRegion(uint32_t rbar, uint32_t rasr)
{
MPU->RBAR = rbar;
MPU->RASR = rasr;
}
/** Configure the given MPU region.
* \param rnr Region number to be configured.
* \param rbar Value for RBAR register.
* \param rsar Value for RSAR register.
*/
__STATIC_INLINE void ARM_MPU_SetRegionEx(uint32_t rnr, uint32_t rbar, uint32_t rasr)
{
MPU->RNR = rnr;
MPU->RBAR = rbar;
MPU->RASR = rasr;
}
/** Memcopy with strictly ordered memory access, e.g. for register targets.
* \param dst Destination data is copied to.
* \param src Source data is copied from.
* \param len Amount of data words to be copied.
*/
__STATIC_INLINE void orderedCpy(volatile uint32_t* dst, const uint32_t* __RESTRICT src, uint32_t len)
{
uint32_t i;
for (i = 0u; i < len; ++i)
{
dst[i] = src[i];
}
}
/** Load the given number of MPU regions from a table.
* \param table Pointer to the MPU configuration table.
* \param cnt Amount of regions to be configured.
*/
__STATIC_INLINE void ARM_MPU_Load(ARM_MPU_Region_t const* table, uint32_t cnt)
{
orderedCpy(&(MPU->RBAR), &(table->RBAR), cnt*sizeof(ARM_MPU_Region_t)/4u);
}
#endif

View File

@ -0,0 +1,15 @@
ifeq ($(FPGA_DEBUG),y)
CFLAGS += -DFPGA_TEST
endif
ifeq ($(SOC_DEBUG),y)
CFLAGS += -DSOC_TEST
endif
ifeq ($(RF_ADI_USED_ENABLE),y)
CFLAGS += -DRF_ADI_USED
endif
ifeq ($(BUILD_USE_PREBUILD_LIB),y)
CFLAGS += -DSDK_REL_BUILD
endif

Some files were not shown because too many files have changed in this diff Show More