eZ430 Chronos 的無線 BSL(Bootstrap Loader) 功能原理詳解
app
eZ430 Chronos 提供了一個名爲 RFBSL 的功能,也就是經過RF無線方式來執行BSL操做進行手錶固件程序(firmware
)的刷新,不須要拆開手錶鏈接到JTAG接口,很是方便調試手錶上運行的程序。我開始時沒有理解BSL方式,一直也沒搞清楚具體的細節實現是如何進行的,昨天把SLAU292C(eZ430-Chronos™ Development Tool User's Guide)的相關章節認真讀了一遍以後終於明白了 eZ430 Chronos 的BSL詳細流程。less
RFBSL 的詳細流程以下:
一、首先要在PC側運行 Control Center ,選擇 Wireless Update ,注意,這裏必定要選擇正確的 firmware 文件,eZ430 Chronos 的 firmware 文件就是用CCS編譯生成的位於 D:\EZ430\workspace\ez430_chronos\915MHz - Unrestricted CCS Platinum 目錄下的那個名爲 ez430_chronos_915MHz.txt 的文件,千萬不要選擇那個位於 D:\Program Files\Texas Instruments\eZ430-Chronos\Control Center\Chronos Control Center 目錄下的名爲 ram_based_updater.txt 的文件,不然就是一個悲劇(我第一次刷就遇到這個悲劇,當時還奇怪怎麼這個固件文件這麼小呢?),以下圖示:
二、手錶側執行 rfBSL 程序,該程序的主要做用就是先檢查電池電壓,再檢查BlueRobin程序狀態,再檢查SimpliciTI程序狀態,若是電池電壓沒有太低,BlueRobin和SimpliciTI都沒有執行,則跳轉到 flash 的 0x1000 地址處,這時手錶上全部其餘的用戶程序所有被中止,從 0x1000 開始的2KB的flash區域內保存着BSL程序,這個程序是事先寫好放在這裏的(若是想本身開發BSL程序,也能夠,使用 BM innovations 的 Firmware Update Tool 就好了.詳細參見 3.6.3.4.2 eZ430-Chronos Watch Update),rfbsl.c的主程序函數以下:ide
#define CALL_RFSBL() ((void (*)())0x1000)() void sx_rfbsl(u8 line) { // Exit if battery voltage is too low for radio operation if (sys.flag.low_battery) return; // Exit if BlueRobin stack is active if (is_bluerobin()) return; // Exit if SimpliciTI stack is active if (is_rf()) return; // Before entering RFBSL clear the LINE1 Symbols display_symbol(LCD_SYMB_AM, SEG_OFF); clear_line(LINE1); // Write RAM to indicate we will be downloading the RAM Updater first display_chars(LCD_SEG_L1_3_0, (u8 *)" RAM", SEG_ON); // Call RFBSL CALL_RFSBL(); }
三、在手錶上執行 rFBSL 程序以後,手錶側會嘗試和 PC 側創建無線鏈接,鏈接成功後,會從 PC 側下載那個名爲 ram_based_updater.txt 的文件(這個文件只要放在和 Control Center 程序同一個目錄下便可,系統本身已經準備好了,不須要手動指定)到手錶的 RAM 中,成功下載後,就執行 RAM 中新下載的這個程序,這個程序會再次嘗試鏈接 PC 側來獲取真正的更新鏡像文件,若是鏈接成功,flash 就會執行塊刪除,從 0x8000 到 0xFFFF 的32KB的 flash 區域所有被刪除。而後它會開始接收數據包而且寫入到 flash 中,寫入時會檢查每一個 word 是否寫入成功,寫 falsh 時手錶的LCD屏幕右上角會顯示一個百分比進度,從 0% 開始到 100% 結束。函數
四、成功寫入固件文件後,手錶會重啓,全部的日期時間都會被重置爲初始值。
原文描述以下:
3.6.3.2 Detailed Description of the Wireless Update Feature
To invoke the wireless update procedure, the main application must call the start of the wireless updater,
which is located at address 0x1000. Therefore, the sports watch and data logger projects contain an extra
menu item called "rFbSL". Once activated, it checks if the battery level of the watch is sufficient to start a
wireless update and then calls address 0x1000. At this point the user application is no longer running.
NOTE: Whenever the wireless update is activated on the watch, it returns to the main application
with a reset, regardless if an update was performed or not. Time, data, alarm and other
RAM-based data is lost.
After invoking the wireless update (rFbSL), the watch tries to link to a listening RF access point and start
the update procedure. If the link is successful, the watch downloads the RAM based updater into the RAM
of the CC430. Once finished, this software then tries to link again with the RF access point to download
the actual update image. If this link is successful, a mass flash erase is performed, which erases all the
main memory flash (0x8000 to 0xFFFF). It then start receiving all the data packets and writes them to
flash, checking if each word was written successfully. If the link is not successful, the watch generates a
reset to restart the user application. During the download of the update image, a percentage indicator
appears on the watch. "dOnE" appears and a reset is generated to start the new user application that has
just been written to flash.ui
【PC側的流程:】
this
【手錶側的流程:】
spa