⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wizard.script

📁 JENNIC无线传感器网络 ZIGBEE 文件资料
💻 SCRIPT
📖 第 1 页 / 共 2 页
字号:
////////////////////////////////////////////////////////////////////////////////
//
// Code::Blocks new project wizard script
//
// Project: Jennic application
// Author:  Richard Mould
// Amended: James Ahmed on 2007/11/29
//
// Wizard scripts documentation can be found at:
// http://wiki.codeblocks.org/index.php?title=Wizard_scripts
//
// References: ../src/sdk/scripting/bindings/scriptbindings.ccp
// References: ../Sources/plugins/scriptedwizard/
// References: ../Others/plugins/scriptedwizard/resources/
//
////////////////////////////////////////////////////////////////////////////////

// Globals

jenWorkingDir <- _T("..\\Build");
envChoice <- 0;
appChoice <- 0;
boardChoice <- 0;
chipChoice <- 0;

//
//------------------------------------------------------------------------------
//

function BeginWizard()
{
    local wiz_type = Wizard.GetWizardType();


    if (wiz_type == wizProject)
    {

        // Wizard.SetWorkingDir(target.GetWorkingDir() + _T(".\\CodeBlocksProjects"))

        // This is the text that will appear in the start (intro) page
        local intro_msg = _T("Welcome to the Jennic application wizard!\n" +
                            "This wizard will guide you through the \n" +
                            "creation of a new Code::Blocks project.\n" +
                            "When you are ready to proceed, please click \"Next\"...");

        // This is the text that will appear in the JennicEnvironment page
        local descrEnv = _T("Select the appropriate Jennic development environment:\n");

        // This is the text that will appear in the JennicAppSlection page
        local descrApp = _T("Select the type of Jennic application to be developed:\n");

         // This is the text that will appear in the JennicBoardSelection page
        local descrBoard = _T("Select the target board type:                       \n");

        // This is the text that will appear in the JennicChipSelection page
        local descrChip = _T("Select the target Jennic Wireless Microcontroller:\n");

        // Intro
        Wizard.AddInfoPage(_T("JennicIntro"), intro_msg);

        // Select project name and path
        Wizard.AddProjectPathPage();

        // Select compiler and configurations
        Wizard.AddCompilerPage(_T("*"), _T("*jn*;*jen*;*or32*"), true, false);

        //Page to select the board that you are developing on from a list
        Wizard.AddGenericSingleChoiceListPage(_T("JennicEnv"), descrEnv, _T("JN5121, working in the developer folder;JN51xx, working in the SDK folder"), 1);

        //Page to select the board that you are developing on from a list
        Wizard.AddGenericSingleChoiceListPage(_T("JennicAppSelection"), descrApp, _T("802.15.4 Application;ZigBee Coordinator;ZigBee End Device;ZigBee Router;Jenie End Device;Jenie Coordinator;Jenie Router"), 0);

        //Page to select the board that you are developing on from a list
        Wizard.AddGenericSingleChoiceListPage(_T("JennicBoardSelection"), descrBoard, _T("DK1 (JN5121-EK000 or JN5121-EK010);DK2 (JN513x-EK000 or JN513x-EK010);Network Test System;High Power Development Kit"), 1);

        //Page to select the chip that you are developing on from a list
        Wizard.AddGenericSingleChoiceListPage(_T("JennicChipSelection"), descrChip, _T("JN5121;JN513xR;JN513xR1;JN513x"), 3);

    }
    else
        print(wiz_type);
}


//
//------------------------------------------------------------------------------
//
    // Function to return the board choice into the variable envChoice
    function OnLeave_JennicEnv(forward)
        {
            if (forward)
            {
             envChoice = Wizard.GetListboxSelection(_T("GenericChoiceList"));
            }
        return true;
        }
//
//------------------------------------------------------------------------------
//
    // Function to return the Application into the variable appChoice
    function OnLeave_JennicAppSelection(forward)
        {
            if (forward)
            {
             appChoice = Wizard.GetListboxSelection(_T("GenericChoiceList"));
            	if (appChoice == 4 || appChoice == 5 || appChoice == 6)
	    	{
	    	ShowWarning(_T("Only JN513x and JN513xR1 chips are supported."));
	    	//return false; // abort the page change
	    	}             
            }

        return true;
        }
//
//------------------------------------------------------------------------------
//
    // Function to return the board choice into the variable boardChoice
    function OnLeave_JennicBoardSelection(forward)
        {
            if (forward)
            {
             boardChoice = Wizard.GetListboxSelection(_T("GenericChoiceList"));
            }

        return true;
        }
//
//------------------------------------------------------------------------------
//
    // Function to return the chip choice into the variable chipChoice
    function OnLeave_JennicChipSelection(forward)
        {
            if (forward)
            {
             chipChoice = Wizard.GetListboxSelection(_T("GenericChoiceList"));
            }
        return true;
        }

//
//------------------------------------------------------------------------------
//

  function GetFilesDir()
  {
      switch (appChoice)
        {
        case 0:
            return _T("Jennic/files_15_4");
            break;
        case 1:
            return _T("Jennic/files_JZ_Coord");
            break;
        case 2:
            return _T("Jennic/files_JZ_EndDevice");
            break;
        case 3:
            return _T("Jennic/files_Router");
            break;
        case 4:
            return _T("Jennic/files_Jenie_ED");
            break;
        case 5:
            return _T("Jennic/files_Jenie_Coord");
            break;
        case 6:
            return _T("Jennic/files_Jenie_Router");
            break; 
        }
  }

//
//------------------------------------------------------------------------------
//

function SetupProject(project)
{
    // NOTE: Major compiler system drawback here.
    // Until it is redesigned to allow easier compiler settings,
    // we have to check the compiler's ID and set options for different compilers...
    // We make things easier for scripts, by providing a few predefined functions
    // to setup common settings like "debug", "warnings", etc.
    // These functions are located in <templates_path>/common_functions.script.
    // If you add other commonly used functions or bug-fix anything in that file,
    // please share it with us :)

    //
    // Set project options
    //

    // Set Compiler Options

    // project.AddCompilerOption(_T("-Os"));
    project.AddCompilerOption(_T("-Wall"));
    project.AddCompilerOption(_T("-I."));
    project.AddCompilerOption(_T("-Wstrict-prototypes"));
    project.AddCompilerOption(_T("-Werror-implicit-function-declaration"));
    project.AddCompilerOption(_T("-fomit-frame-pointer"));
    project.AddCompilerOption(_T("-fno-strength-reduce"));
    project.AddCompilerOption(_T("-pipe"));
    project.AddCompilerOption(_T("-fno-builtin"));
    project.AddCompilerOption(_T("-nostdlib"));
    project.AddCompilerOption(_T("-msibcall"));
    project.AddCompilerOption(_T("-mno-entri"));
    project.AddCompilerOption(_T("-mno-multi"));
    project.AddCompilerOption(_T("-mno-setcc"));
    project.AddCompilerOption(_T("-mno-cmov"));
    project.AddCompilerOption(_T("-mno-carry"));
    project.AddCompilerOption(_T("-mno-subb"));
    project.AddCompilerOption(_T("-mno-sext"));
    project.AddCompilerOption(_T("-mno-ror"));
    project.AddCompilerOption(_T("-mno-ff1"));
    project.AddCompilerOption(_T("-mno-hard-div"));
    project.AddCompilerOption(_T("-mhard-mul"));
    project.AddCompilerOption(_T("-mbranch-cost=3"));
    project.AddCompilerOption(_T("-msimple-mul"));
    project.AddCompilerOption(_T("-mabi=1"));
    project.AddCompilerOption(_T("-march=ba1"));
    project.AddCompilerOption(_T("-mredzone-size=4"));
    project.AddCompilerOption(_T("-DOR1K"));
    project.AddCompilerOption(_T("-DEMBEDDED"));
    project.AddCompilerOption(_T("-DLEAN_N_MEAN"));
    project.AddCompilerOption(_T("-DSINGLE_CONTEXT"));
    //project.AddCompilerOption(_T("-DCHIP_RELEASE_3"));


    // Conditional statement to setup CodeBlocks for the developer directory structure
    if (envChoice == 0)
    {
    // Set working directory
    jenWorkingDir = _T(".\\Build")
    // Compiler Directories
    project.AddIncludeDir(_T("C:\\Jennic\\cygwin\\jennic\\developer\\Public"));
    project.AddIncludeDir(_T("C:\\Jennic\\cygwin\\jennic\\developer\\Stack\\Public"));
    project.AddIncludeDir(_T("C:\\Jennic\\cygwin\\jennic\\developer\\HardwareAPI\\Public"));
    project.AddIncludeDir(_T("C:\\Jennic\\cygwin\\jennic\\developer\\BoardAPI\\Public"));
    project.AddIncludeDir(_T("C:\\Jennic\\cygwin\\jennic\\developer\\Utilities\\Public"));
    project.AddIncludeDir(_T("C:\\Jennic\\cygwin\\jennic\\developer\\Stack\\Source"));
    project.AddIncludeDir(_T("C:\\Jennic\\cygwin\\jennic\\developer\\BoardAPI\\Source"));
    project.AddIncludeDir(_T("C:\\Jennic\\cygwin\\jennic\\developer\\Utilities\\Source"));

    // Linker Directories
    project.AddLibDir(_T("C:\\Jennic\\cygwin\\jennic\\developer\\Build"));

    // Linker Options
    project.AddLinkerOption(_T("-TAppBuild.ld"));

    switch (appChoice)
            {
            case 0:
                break;
            case 1:
                project.AddLinkLib(_T("C:\\Jennic\\cygwin\\jennic\\developer\\ZigbeeStack\\JZ_CoordLib.a"));
                project.AddIncludeDir(_T("C:\\Jennic\\cygwin\\jennic\\developer\\ZigbeeStack"));
                break;
            case 2:
                project.AddLinkLib(_T("C:\\Jennic\\cygwin\\jennic\\developer\\ZigbeeStack\\JZ_EndDeviceLib.a"));
                project.AddIncludeDir(_T("C:\\Jennic\\cygwin\\jennic\\developer\\ZigbeeStack"));
                break;
            case 3:
                project.AddLinkLib(_T("C:\\Jennic\\cygwin\\jennic\\developer\\ZigbeeStack\\JZ_RouterLib.a"));
                project.AddIncludeDir(_T("C:\\Jennic\\cygwin\\jennic\\developer\\ZigbeeStack"));
                break;
            case 4:
                break;
            case 5:
                break;
            case 6:
                break;
            }

    // Switch to select correct directories depending on development board selected.
     switch (boardChoice)
        {
        case 0:
            // Link libraries
            project.AddLinkLib(_T("C:\\Jennic\\cygwin\\jennic\\developer\\Stack\\Library\\JennicLib.a"));
            break;
        case 1:
        //    project.AddIncludeDir(_T("C:\\Jennic\\cygwin\\jennic\\SDK\\Platform\\DK2\\Include"));
        //    project.AddIncludeDir(_T("C:\\Jennic\\cygwin\\jennic\\SDK\\Platform\\DK2\\Source"));
            project.AddLinkLib(_T("C:\\Jennic\\cygwin\\jennic\\developer\\Stack\\Library\\JennicLib.a"));
            break;
        case 2:
            //project.AddIncludeDir(_T("C:\\Jennic\\cygwin\\jennic\\SDK\\Platform\\NTS\\Include"));
            //project.AddIncludeDir(_T("C:\\Jennic\\cygwin\\jennic\\SDK\\Platform\\NTS\\Source"));
            break;
        case 3:
            // Link libraries
            //project.AddLinkLib(_T("C:\\Jennic\\cygwin\\jennic\\developer\\Stack\\Library\\JennicLibHPM.a"));
            if (chipChoice == 0)
	    {
	      // Link libraries
	      project.AddLinkLib(_T("..\\..\\Chip\\JN5121\\Library\\ChipLibHpm.a"));
	    }
            break;
        //default:
        //    local newstr = _T("C:\\Jennic\\") + boardChoice;
        //    project.AddIncludeDir(newstr);
        }
    }

    // Conditional statement to setup CodeBlocks for the SDK directory structure
    if (envChoice == 1)
    {
    // Set Jennic working directory
    jenWorkingDir = _T("..\\Build")
    // Compiler Directories
    project.AddIncludeDir(_T("C:\\Jennic\\cygwin\\jennic\\SDK\\Common\\Include"));
    project.AddIncludeDir(_T("C:\\Jennic\\cygwin\\jennic\\SDK\\Chip\\Common\\Include"));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -