天天看點

CCS2.2和CCS3.1在讀寫GEL檔案上的差別之二

下面具體談一下GEL檔案的執行過程。使用CCSStudio Setup工具,可以為在系統配置中的每一個處理器指定一個啟動GEL文 件。當CCSStudio啟動時,GEL文 件加載到PC機的記憶體中,由CCS根據加載的GEL檔案對目标闆進行初始化。在CCS2.2中,主機和目标闆的初始化工作都在GEL檔案的Startup()函數中執行,而CCS2.2必須在打開時就會連接配接目标闆同時進行初始化。但是對于支援Connect/Disconnect的CCSStudio例如CCS3.1,打開後目标闆并沒有被自動連接配接,這樣的GEL檔案中的初始化程式并沒有正确執行,因為CCSStudio啟動時和目标處理器是斷開的。當Startup()函數試圖通路目标處理器時會出錯。是以在CCS3.1中需要回調函數來重新執行初始化。下面可以将SEEDDM642.gel和EVMDM642.gel做一個對比。

首先是SEEDDM642.gel中的StartUp()

StartUp()  

{  

    setup_memory_map();  

    GEL_Reset();    

    init_emif();  

}  

EVMDM642.gel中的StartUp()

    /*------------------------------------------------------*/  

    /* Uncomment the OnTargetConnect() call for CCS 2.X     */  

    /* support.                                             */  

    /*                                                      */  

    //OnTargetConnect();  

從這個函數的對比就可以看到前一個在StartUp()中就已經完成了GEL和emif的初始化工作,而在後一個中就沒有,這一點和前面說的軟體打開時目标闆的連接配接方式剛好一緻。

是以在CCS3.1的gel檔案中就多了這樣一段函數:

OnTargetConnect()  

    /* GEL_Reset() is used to deal with the worst case      */  

    /* senario of unknown target state.  If for some reason */  

    /* a reset is not desired upon target connection,       */  

    /* GEL_Reset() may be removed and replaced with         */  

    /* something "less brutal" like a cache initialization  */  

    /* function.                                            */  

    //GEL_Reset();  

    GEL_TextOut("GEL StartUp Complete./n");  

即在目标闆連接配接的時候進行初始化操作,由此就可以了解為什麼前面彈出的警告了,将SEEDDM642.gel對應的部分修改後在運作警告消失,即在軟體打開時不對晶片初始化,改在晶片連接配接時進行。

    同樣可以看一下gel檔案中的其他函數:

/*--------------------------------------------------------------*/  

/* OnReset()                                                    */  

/* This function is called by CCS when you do Debug->Resest.    */  

/* The goal is to put the C6x into a known good state with      */  

/* respect to cache, edma and interrupts.                       */  

OnReset( int nErrorCode )  

/* OnPreFileLoaded()                                            */  

/* This function is called automatically when the 'Load Program'*/  

/* Menu item is selected.                                       */  

OnPreFileLoaded()  

    flush_cache();  

    IER = 0;  

    IFR = 0;  

/* OnRestart()                                                  */  

/* This function is called by CCS when you do Debug->Restart.   */  

/* Failure to do this can cause problems when you restart and   */  

/* run your application code multiple times.  This is different */  

/* then OnPreFileLoaded() which will do a GEL_Reset() to get the*/  

/* C6x into a known good state.                                 */  

OnRestart( int nErrorCode )  

    /* Turn off L2 for all EMIFA CE spaces.  App should     */  

    /* manage these for coherancy in the application.       */  

    /* GEL_TextOut("Turn off cache segment/n");             */  

    *(int*)0x01848200 = 0;          // MAR0  

    *(int*)0x01848204 = 0;          // MAR1  

    *(int*)0x01848208 = 0;          // MAR2  

    *(int*)0x0184820c = 0;          // MAR3  

    /* Disable EDMA events and interrupts and clear any     */  

    /* pending events.                                      */  

    /* GEL_TextOut("Disable EDMA event/n");                 */  

    *(int*)0x01A0FFA8 = 0;          // CIERH  

    *(int*)0x01A0FFB4 = 0;          // EERH  

    *(int*)0x01A0FFB8 = 0XFFFFFFFF; // ECRH  

    *(int*)0x01A0FFE8 = 0;          // CIERL  

    *(int*)0x01A0FFF4 = 0;          // EERL  

    *(int*)0x01A0FFF8 = 0xFFFFFFFF; // ECRL  

    /* Disable other interrupts */  

本文轉自emouse部落格園部落格,原文連結:http://www.cnblogs.com/emouse/archive/2010/03/21/2198234.html,如需轉載請自行聯系原作者

繼續閱讀