::================================================================================================================================================================================================================================================:: ::File_Name : projectCreate.bat ::Description : This batch file can create CCS projects based on the project settings specified in the project create options files. ::Date : 19-Oct-2016 ::File_Version : 2.0.1 - Created initial version for generating PRU-ICSS-EtherCAT Slave package example projects. :: : 2.0.2 - Added PROCESSOR Argument support ::Usage Syntax: :: projectCreate.bat [SOC] [PROCESSOR] [PROJECT_NAME] :: :: [SOC] Valid values are AM335x, AMIC11x, AM437x, AM571x, AM572x, K2G :: [PROCESSOR] Valid values are arm :: [PROJECT_NAME] Valid values are ethercat_slave_demo, ethercat_slave_full, ecat_ti_esc_spi_master, ecat_ti_esc_spi_slave :: ::Usage example 1: :: projectCreate.bat AM572x arm ethercat_slave_demo :: -Creates ethercat_slave_demo application project for AM572x ARM core :: ::Usage example 2: :: projectCreate.bat AM571x arm ethercat_slave_full :: -Creates ethercat_slave_full application project for AM571x ARM core :: ::Copyright (c) 2017 Texas Instruments Incorporated ALL RIGHTS RESERVED ::================================================================================================================================================================================================================================================:: ::Turn off console prints including this command @echo off ::================================================================================================================================================================================================================================================:: :: USER CONFIGURATION SECTION STARTS! ::================================================================================================================================================================================================================================================:: ::Set CCS installation directory path(Mandatory) - The path where folder 'eclipse' is located set "CCS_INSTALL_DIR=C:\ti\ccsv7" ::Set the CCS workspace location(Mandatory). Workspace will be created if it doesn't exist! set "CCS_WORKSPACE_LOC=%USERPROFILE%\ccs_workspace" ::Set the IA_SDK_HOME Directory(Mandatory) set "IA_SDK_HOME=%cd%\..\..\.." ::set "IA_SDK_HOME=C:\ti\PRU-ICSS-EtherCAT_Slave_01.00.04.00" ::Set PDK Installation directory path(Mandatory for AM57xx projects) set "AM57xx_PDK_INSTALL_PATH=C:\ti\pdk_am57xx_1_0_7\packages" ::Set PDK Installation directory path(Mandatory for K2G projects) set "K2G_PDK_INSTALL_PATH=C:\ti\pdk_k2g_1_0_6\packages" ::Set PDK Installation directory path(Mandatory for AM335x projects) set "AM335x_PDK_INSTALL_PATH=C:\ti\pdk_am335x_1_0_7\packages" ::Set PDK Installation directory path(Mandatory for AM437x projects) set "AM437x_PDK_INSTALL_PATH=C:\ti\pdk_am437x_1_0_7\packages" :: Set the folder path where the projects will be created using command line project create method(Mandatory) set "PROJECT_CREATE_DIR=%IA_SDK_HOME%\protocols\ethercat_slave\projects" :: Set the folder path where command line project create Options files for are kept(Mandatory) set "PROJECT_CREATE_OPTIONS_FILE_DIR=%IA_SDK_HOME%\protocols\ethercat_slave\projects\ccsproject_args" ::Set AM57xx PDK Eclipse ID set "AM57xx_PDK_ECLIPSE_ID=com.ti.pdk.am57xx" ::Set K2G PDK Eclipse ID set "K2G_PDK_ECLIPSE_ID=com.ti.pdk.k2g" ::Set AM335x PDK Eclipse ID set "AM335x_PDK_ECLIPSE_ID=com.ti.pdk.am335x" ::Set AM437x PDK Eclipse ID set "AM437x_PDK_ECLIPSE_ID=com.ti.pdk.am437x" ::Set AM57xx PDK Version set "AM57xx_PDK_VERSION=1.0.7" ::Set K2G PDK Version set "K2G_PDK_VERSION=1.0.6" ::Set AM335x PDK Version set "AM335x_PDK_VERSION=1.0.7" ::Set AM437x PDK Version set "AM437x_PDK_VERSION=1.0.7" :: Set XDC Tools Version which is to be used while creating the project set "XDC_TOOLS_VERSION=3.32.01.22_core" :: Set SYSBIOS Version which is to be used while creating the project ::set "SYS_BIOS_VERSION=6.46.05.55" set "SYS_BIOS_VERSION=6.35.04.50" :: Set NDK Version which is to be used while creating the project set "NDK_VERSION=2.25.01.11" :: Set EDMA3 Version which is to be used while creating the project set "EDMA_VERSION=2.12.04.28" ::================================================================================================================================================================================================================================================:: :: USER CONFIGURATION SECTION ENDS! ::================================================================================================================================================================================================================================================:: ::Lists of valid input parameters set "SUPPORTED_SOC_LIST=AM335x AMIC11x AM437x AM571x AM572x K2G" set "SUPPORTED_PROCESSOR_LIST=arm" set "SUPPORTED_PROJECT_LIST=ethercat_slave_demo ethercat_slave_full ecat_ti_esc_spi_master ecat_ti_esc_spi_slave" ::Set flags which will be enabled when empty/incorrect command line argument is detected. set "COMMAND_LINE_ARGS_INSUFFICIENT=FALSE" set "COMMAND_LINE_ARGS_INCORRECT=FALSE" ::Validate the first commandline argument IF [%1]==[] ( set "COMMAND_LINE_ARGS_INSUFFICIENT=TRUE" ) ELSE ( set "SOC=%1" ) ::Validate the second commandline argument IF [%2]==[] ( set "COMMAND_LINE_ARGS_INSUFFICIENT=TRUE" ) ELSE ( set "PROCESSOR=%2" ) ::Validate the third commandline argument IF [%3]==[] ( set "COMMAND_LINE_ARGS_INSUFFICIENT=TRUE" ) ELSE ( set "PROJECT_NAME=%3" ) IF "%COMMAND_LINE_ARGS_INSUFFICIENT%"=="TRUE" ( echo. echo.ERROR: COMMAND_LINE_ARGS_INSUFFICIENT call :DisplayUsageInstructions exit /b ) ::Validate the supplied SOC against the list of valid values for %%a in (%SUPPORTED_SOC_LIST%) do ( if %SOC% == %%a ( goto SOC_NAME_VALIDATION_COMPLETE ) ) echo. echo ERROR: SOC "%SOC%" is invalid! set "COMMAND_LINE_ARGS_INCORRECT=TRUE" :SOC_NAME_VALIDATION_COMPLETE ::Validate the supplied PROCESSOR against the list of valid values for %%a in (%SUPPORTED_PROCESSOR_LIST%) do ( if %PROCESSOR% == %%a ( goto PROCESSOR_VALIDATION_COMPLETE ) ) echo. echo ERROR: Processor name "%PROCESSOR%" is invalid! set "COMMAND_LINE_ARGS_INCORRECT=TRUE" :PROCESSOR_VALIDATION_COMPLETE ::Validate the supplied PROJECT_NAME against the list of valid values for %%a in (%SUPPORTED_PROJECT_LIST%) do ( if %PROJECT_NAME% == %%a ( goto PROJECT_NAME_VALIDATION_COMPLETE ) ) echo. echo ERROR: Project name "%PROJECT_NAME%" is invalid! set "COMMAND_LINE_ARGS_INCORRECT=TRUE" :PROJECT_NAME_VALIDATION_COMPLETE IF "%COMMAND_LINE_ARGS_INCORRECT%"=="TRUE" ( echo. echo.ERROR: COMMAND_LINE_ARGS_INCORRECT call :DisplayUsageInstructions exit /b ) ::Define the full project name as shown in CCS project explorer set PROJECT_NAME_FULL=%PROJECT_NAME%_%SOC%_%PROCESSOR% ::Set the build configurations with respect to SOC set "BUILD_CONFIG_NAME1=%SOC%_debug" set "BUILD_CONFIG_NAME2=%SOC%_release" IF "%SOC%"=="AM335x" ( :: Set version of CG-Tools for ARM set "CGT_VERSION=GNU_4.9.3:Linaro" :: Set Device type for AM335x ARM set "CCS_DEVICE="Cortex A.AM3359"" ::set RTSC Target for AM335x ARM set "RTSC_TARGET=gnu.targets.arm.A8F" ::set RTSC Platfrom for AM335X set "RTSC_PLATFORM=ti.platforms.evmAM3359" ::Set PDK Installation directory path set "PDK_INSTALL_PATH=%AM335x_PDK_INSTALL_PATH%" ::Set AM335x PDK Eclipse ID set "PDK_ECLIPSE_ID=%AM335x_PDK_ECLIPSE_ID%" ::Set AM335x PDK Version set "PDK_VERSION=%AM335x_PDK_VERSION%" ::Set SOC in small case to match sdk folder structure set "SOC_SMALL=am335x" ::Set SOC which is used in post build script to generate binary image. set SOC_FOR_POSTBUILD="AM335x" ) ELSE IF "%SOC%"=="AM437x" ( :: Set version of CG-Tools for ARM set "CGT_VERSION=GNU_4.9.3:Linaro" :: Set Device type for AM437x ARM set "CCS_DEVICE="Cortex A.AM4379"" ::set RTSC Target for AM437x ARM set "RTSC_TARGET=gnu.targets.arm.A9F" ::Set PDK Installation directory path set "PDK_INSTALL_PATH=%AM437x_PDK_INSTALL_PATH%" ::Set AM437x PDK Eclipse ID set "PDK_ECLIPSE_ID=%AM437x_PDK_ECLIPSE_ID%" ::Set AM437x PDK Version set "PDK_VERSION=%AM437x_PDK_VERSION%" ::set RTSC Platfrom for AM437X set "RTSC_PLATFORM=ti.platforms.evmAM437X" ::Set SOC in small case to match sdk folder structure set "SOC_SMALL=am437x" ::Set SOC which is used in post build script to generate binary image. set SOC_FOR_POSTBUILD="AM437x" ) ELSE IF "%SOC%"=="AM571x" ( :: Set version of CG-Tools for ARM set "CGT_VERSION=GNU_4.9.3:Linaro" :: Set Device type for AM571X ARM set "CCS_DEVICE="Cortex A.AM5718"" ::set RTSC Target for AM571X/AM572X ARM set "RTSC_TARGET=gnu.targets.arm.A15F" ::set RTSC Platfrom for AM571X ARM set "RTSC_PLATFORM=ti.platforms.evmAM571X" ::Set PDK Installation directory path set "PDK_INSTALL_PATH=%AM57xx_PDK_INSTALL_PATH%" ::Set AM572x PDK Eclipse ID set "PDK_ECLIPSE_ID=%AM57xx_PDK_ECLIPSE_ID%" ::Set AM57xx PDK Version set "PDK_VERSION=%AM57xx_PDK_VERSION%" ::Set SOC which is used in post build script to generate binary image. set SOC_FOR_POSTBUILD="AM571x" ) ELSE IF "%SOC%"=="AM572x" ( :: Set version of CG-Tools for ARM set "CGT_VERSION=GNU_4.9.3:Linaro" :: Set Device type for AM571X ARM set "CCS_DEVICE="Cortex A.AM5728"" ::set RTSC Target for AM571X/AM572X ARM set "RTSC_TARGET=gnu.targets.arm.A15F" ::set RTSC Platfrom for AM572X ARM set "RTSC_PLATFORM=ti.platforms.evmAM572X" ::Set PDK Installation directory path set "PDK_INSTALL_PATH=%AM57xx_PDK_INSTALL_PATH%" ::Set AM572x PDK Eclipse ID set "PDK_ECLIPSE_ID=%AM57xx_PDK_ECLIPSE_ID%" ::Set AM57xx Version set "PDK_VERSION=%AM57xx_PDK_VERSION%" ::Set SOC which is used in post build script to generate binary image. set SOC_FOR_POSTBUILD="AM572x" ) ELSE IF "%SOC%"=="AM57xx" ( :: Set version of CG-Tools for ARM set "CGT_VERSION=GNU_4.9.3:Linaro" :: Set Device type for AM571X ARM set "CCS_DEVICE="Cortex A.AM5728"" ::set RTSC Target for AM571X/AM572X ARM set "RTSC_TARGET=gnu.targets.arm.A15F" ::set RTSC Platfrom for AM572X ARM set "RTSC_PLATFORM=ti.platforms.evmAM572X" ::Set PDK Installation directory path set "PDK_INSTALL_PATH=%AM57xx_PDK_INSTALL_PATH%" ::Set AM572x PDK Eclipse ID set "PDK_ECLIPSE_ID=%AM57xx_PDK_ECLIPSE_ID%" ::Set AM57xx Version set "PDK_VERSION=%AM57xx_PDK_VERSION%" ) ELSE IF "%SOC%"=="AMIC11x" ( :: Set version of CG-Tools for ARM set "CGT_VERSION=GNU_4.9.3:Linaro" :: Set Device type for AM335x ARM set "CCS_DEVICE="Cortex A.AM3359"" ::set RTSC Target for AM335x ARM set "RTSC_TARGET=gnu.targets.arm.A8F" ::set RTSC Platfrom for AM335X set "RTSC_PLATFORM=ti.platforms.evmAM3359" ::Set PDK Installation directory path set "PDK_INSTALL_PATH=%AM335x_PDK_INSTALL_PATH%" ::Set AM335x PDK Eclipse ID set "PDK_ECLIPSE_ID=%AM335x_PDK_ECLIPSE_ID%" ::Set AM335x PDK Version set "PDK_VERSION=%AM335x_PDK_VERSION%" ::Set SOC which is used in post build script to generate binary image. set SOC_FOR_POSTBUILD="AM335x" ) ELSE IF "%SOC%"=="K2G" ( :: Set version of CG-Tools for ARM set "CGT_VERSION=GNU_4.9.3:Linaro" :: Set Device type for K2G ARM set "CCS_DEVICE="Cortex A.66AK2G02"" ::set RTSC Target for K2G ARM set "RTSC_TARGET=gnu.targets.arm.A15F" ::set RTSC Platfrom for K2G set "RTSC_PLATFORM=ti.platforms.evmTCI66AK2G02" ::Set PDK Installation directory path set "PDK_INSTALL_PATH=%K2G_PDK_INSTALL_PATH%" ::Set K2G PDK Eclipse ID set "PDK_ECLIPSE_ID=%K2G_PDK_ECLIPSE_ID%" ::Set K2G PDK Version set "PDK_VERSION=%K2G_PDK_VERSION%" ::Set SOC which is used in post build script to generate binary image. set SOC_FOR_POSTBUILD="K2G" ) ::Set the Post build script for Application projects set POST_BUILD_STEP_APP_PROJECT="${PDK_INSTALL_PATH}/pdkAppImageCreate.bat ${PDK_INSTALL_PATH} ${CG_TOOL_ROOT} ${PROJECT_LOC}/${ConfigName} ${ProjName} %SOC_FOR_POSTBUILD% %PROCESSOR%" echo ************************************************************************** echo Environment Configuration Summary: echo CCS Install Directory : %CCS_INSTALL_DIR% echo CCS Workspace Directory : %CCS_WORKSPACE_LOC% echo SDK Install Directory : %IA_SDK_HOME% echo PDK Install Directory : %PDK_INSTALL_PATH% echo Projects create Directory : %PROJECT_CREATE_DIR% echo Project create args directory : %PROJECT_CREATE_OPTIONS_FILE_DIR% echo ************************************************************************** echo. echo.Creating project '%PROJECT_NAME_FULL%' for '%SOC%' platform in directory '%PROJECT_CREATE_DIR%\%PROJECT_NAME_FULL%' by overwriting the project if it exists already... ::================================================================================================================================================================================================================================================# :: ETHERCAT_SLAVE_DEMO or ETHERCAT_SLAVE_FULL or ECAT_TI_ESC_SPI_MASTER FULL or ECAT_TI_ESC_SPI_SLAVE FULL APPLICATIONS ::================================================================================================================================================================================================================================================# ::Create the EtherCAT slave limited demo application project by specifying the project settings options %CCS_INSTALL_DIR%\eclipse\eclipsec -noSplash -data "%CCS_WORKSPACE_LOC%" -application com.ti.ccstudio.apps.projectCreate -ccs.name %PROJECT_NAME_FULL% -ccs.location %PROJECT_CREATE_DIR%\%PROJECT_NAME_FULL% -ccs.cmd "" -ccs.outputFormat elf -ccs.outputType executable -ccs.device %CCS_DEVICE% -ccs.endianness little -ccs.cgtVersion %CGT_VERSION% -rtsc.enableRtsc -rtsc.xdcVersion %XDC_TOOLS_VERSION% -rtsc.biosVersion %SYS_BIOS_VERSION% -rtsc.products "com.ti.rtsc.SYSBIOS:%SYS_BIOS_VERSION%;%PDK_ECLIPSE_ID%:%PDK_VERSION%" -rtsc.platform %RTSC_PLATFORM% -rtsc.target %RTSC_TARGET% -ccs.rts libc.a -ccs.configurations %BUILD_CONFIG_NAME1% %BUILD_CONFIG_NAME2% -ccs.defaultConfiguration %BUILD_CONFIG_NAME2% -rtsc.buildProfile release -ccs.definePathVariable PDK_INSTALL_PATH %PDK_INSTALL_PATH% @scope project -ccs.definePathVariable IA_SDK_HOME %IA_SDK_HOME% @scope project -ccs.defineBuildVariable PDK_INSTALL_PATH %PDK_INSTALL_PATH% @type string @scope configuration @configurations %BUILD_CONFIG_NAME1% %BUILD_CONFIG_NAME2% -ccs.defineBuildVariable IA_SDK_HOME %IA_SDK_HOME% @type string @scope configuration @configurations %BUILD_CONFIG_NAME1% %BUILD_CONFIG_NAME2% -ccs.setPostBuildStep %POST_BUILD_STEP_APP_PROJECT% @configurations %BUILD_CONFIG_NAME1% %BUILD_CONFIG_NAME2% -ccs.args %PROJECT_CREATE_OPTIONS_FILE_DIR%\%SOC%\%PROJECT_NAME_FULL%.txt -ccs.overwrite full ::Stop the script execution now GOTO :EOF ::================================================================================================================================================================================================================================================:: :: DOS Functions ::================================================================================================================================================================================================================================================:: ::DOS Function to provide user instructions about command line argument syntax :DisplayUsageInstructions echo.Usage Syntax: projectCreate.bat [SOC] [PROCESSOR] [PROJECT_NAME] echo. echo.[SOC] Valid values are "%SUPPORTED_SOC_LIST%" (case sensitive) echo.[PROCESSOR] Valid values are "%SUPPORTED_PROCESSOR_LIST%" (case sensitive) echo.[PROJECT_NAME] Valid values are "%SUPPORTED_PROJECT_LIST%" (case sensitive) exit /b