本揭露要解決的一個技術問題是,提供一種能夠應對物聯網設備的升級風險的升級方案。
根據本揭露的第一個態樣,提出了一種物聯網設備中的系統升級方法,包括:檢查是否存在升級標識;在存在升級標識的情況下,判斷升級次數是否超過第一預定臨限值;在判定升級次數超過第一預定臨限值的情況下,啟動第一系統,並且/或者在判定升級次數未超過第一預定臨限值的情況下,嘗試啟動第二系統,其中,第二系統為待升級的新系統,第一系統的版本低於第二系統。
可選地,該系統升級方法還包括:在不存在升級標識的情況下,啟動第一系統。
可選地,該系統升級方法還包括:在嘗試啟動第二系統的情況下,將升級次數加一。
可選地,該系統升級方法還包括:在成功啟動第二系統的情況下,清除升級標識及/或升級次數。
可選地,該系統升級方法還包括:設置計時器,計時器用於回應於計時超過第二預定臨限值觸發系統升級方法的執行,或者觸發第一系統的啟動。
可選地,該系統升級方法還包括:在成功啟動第二系統的情況下,迴圈執行如下操作:在計時器的計時超過第二預定臨限值之前,重置計時。
可選地,該系統升級方法還包括:回應於接收到伺服器下發的升級檔或升級指令,產生升級標識。
可選地,啟動第一系統的步驟包括:啟動升級前運行的系統;或者根據系統穩定性,從第二系統之前多個版本的系統中選擇一個版本的系統進行啟動。
可選地,物聯網設備為以下至少一項:車輛;個人數位助理終端;感測器;智慧家居設備。
可選地,物聯網設備的儲存區被劃分為第一區、第二區、第三區以及第四區,第一區用於儲存引導載入程式,引導載入程式用於執行系統升級方法,第二區用於儲存第一系統,第三區用於儲存第二系統;第四區用於儲存升級標識及/或升級次數。
根據本揭露的第二個態樣,還提出了一種物聯網設備中的系統升級方法,包括:設置引導載入程式,引導載入程式被配置為:回應於物聯網設備上電啟動,執行如本揭露第一個態樣述及的系統升級方法。
根據本揭露的第三個態樣,還提出了一種物聯網設備中的系統升級方法,包括:回應於系統升級請求,嘗試啟動第二系統;在第二系統啟動失敗或者第二系統啟動失敗次數超過第一預定臨限值的情況下,啟動第一系統,其中,第二系統為待升級的新系統,第一系統的版本低於第二系統。
根據本揭露的第四個態樣,還提出了一種物聯網設備中的程式升級方法,包括:檢查是否存在升級標識;在存在升級標識的情況下,判斷升級次數是否超過第一預定臨限值;在判定升級次數超過第一預定臨限值的情況下,啟動第一程式,並且/或者在判定升級次數未超過第一預定臨限值的情況下,嘗試啟動第二程式,其中,第二程式為待升級的新程式,第一程式的版本低於第二程式。
根據本揭露的第五個態樣,還提出了一種物聯網設備中的程式升級方法,包括:設置引導載入程式,引導載入程式被配置為:回應於物聯網設備上電啟動,執行如本揭露第四個態樣述及的程式升級方法。
根據本揭露的第六個態樣,還提出了一種物聯網設備中的程式升級方法,包括:回應於程式升級請求,嘗試啟動第二程式;在第二程式啟動失敗或者第二程式啟動失敗次數超過第一預定臨限值的情況下,啟動第一程式,其中,第二程式為待升級的新程式,第一程式的版本低於第二程式。
根據本揭露的第七個態樣,還提出了一種物聯網設備中的系統升級裝置,包括:檢查模組,用於檢查是否存在升級標識;判斷模組,用於在存在升級標識的情況下,判斷升級次數是否超過第一預定臨限值;第一啟動模組,用於在判斷模組判定升級次數超過第一預定臨限值的情況下,啟動第一系統,及/或第二啟動模組,用於在判斷模組判定升級次數未超過第一預定臨限值的情況下,嘗試啟動第二系統,其中,第二系統為待升級的新系統,第一系統的版本低於第二系統。
根據本揭露的第八個態樣,還提出了一種物聯網設備中的系統升級裝置,包括:設置模組,用於設置引導載入程式,引導載入程式被配置為:回應於物聯網設備上電啟動,執行如本揭露第一個態樣述及的系統升級方法。
根據本揭露的第九個態樣,還提出了一種物聯網設備中的系統升級裝置,包括:第二啟動模組,用於回應於系統升級請求,嘗試啟動第二系統;第一啟動模組,用於在第二系統啟動失敗或者第二系統啟動失敗次數超過預定臨限值的情況下,啟動第一系統,其中,第二系統為待升級的新系統,第一系統的版本低於第二系統。
根據本揭露的第十個態樣,還提出了一種物聯網設備中的程式升級裝置,包括:檢查模組,用於檢查是否存在升級標識;判斷模組,用於在存在升級標識的情況下,判斷升級次數是否超過第一預定臨限值;第一啟動模組,用於在判斷模組判定升級次數超過第一預定臨限值的情況下,啟動第一程式,及/或第二啟動模組,用於在判斷模組判定升級次數未超過第一預定臨限值的情況下,嘗試啟動第二程式,其中,第二程式為待升級的新程式,第一程式的版本低於第二程式。
根據本揭露的第十一個態樣,還提出了一種物聯網設備中的程式升級裝置,包括:設置模組,用於設置引導載入程式,引導載入程式被配置為:回應於物聯網設備上電啟動,執行如本揭露第四個態樣述及的程式升級方法。
根據本揭露的第十二個態樣,還提出了一種物聯網設備中的程式升級裝置,包括:第二啟動模組,用於回應於程式升級請求,嘗試啟動第二程式;第一啟動模組,用於在第二程式啟動失敗或者第二程式啟動失敗次數超過第一預定臨限值的情況下,啟動第一程式,其中,第二程式為待升級的新程式,第一程式的版本低於第二程式。
根據本揭露的第十三個態樣,還提出了一種計算設備,包括:處理器;以及記憶體,其上儲存有可執行代碼,當可執行代碼被處理器執行時,使處理器執行如本揭露第一個態樣至第六個態樣中任一個態樣述及的方法。
根據本揭露的第十四個態樣,還提出了一種非暫時性機器可讀儲存媒體,其上儲存有可執行代碼,當可執行代碼被電子設備的處理器執行時,使處理器執行如本揭露第一個態樣至第六個態樣中任一個態樣述及的方法。
本揭露支援物聯網設備中的系統升級,並可以在系統升級失敗或升級次數超過預定臨限值時,自動回滾到之前版本,從而可以消除物聯網設備的升級風險。A technical problem to be solved by this disclosure is to provide an upgrade solution that can deal with the upgrade risk of IoT devices.
According to the first aspect of the present disclosure, a system upgrade method in an IoT device is proposed, which includes: checking whether there is an upgrade mark; if there is an upgrade mark, judging whether the number of upgrades exceeds a first predetermined threshold; In the case where it is determined that the number of upgrades exceeds the first predetermined threshold, the first system is started, and/or in the case where it is determined that the number of upgrades does not exceed the first predetermined threshold, the second system is tried to be started, wherein the second system For the new system to be upgraded, the version of the first system is lower than that of the second system.
Optionally, the system upgrade method further includes: in the case that there is no upgrade identifier, starting the first system.
Optionally, the system upgrade method further includes: in the case of trying to start the second system, adding one to the number of upgrades.
Optionally, the system upgrade method further includes: in the case of successfully starting the second system, clearing the upgrade identifier and/or the number of upgrades.
Optionally, the system upgrade method further includes: setting a timer, and the timer is used to trigger the execution of the system upgrade method in response to the timing exceeding the second predetermined threshold, or to trigger the activation of the first system.
Optionally, the system upgrade method further includes: in the case of successfully starting the second system, performing the following operations in a loop: resetting the timing before the timing of the timer exceeds the second predetermined threshold.
Optionally, the system upgrade method further includes: generating an upgrade identifier in response to receiving an upgrade file or an upgrade instruction issued by the server.
Optionally, the step of starting the first system includes: starting the system that was running before the upgrade; or according to the stability of the system, selecting a version of the system from the previous versions of the second system to start.
Optionally, the IoT device is at least one of the following: a vehicle; a personal digital assistant terminal; a sensor; a smart home device.
Optionally, the storage area of the Internet of Things device is divided into a first area, a second area, a third area, and a fourth area. The first area is used to store the boot loader, and the boot loader is used to execute the system upgrade method. , The second area is used to store the first system, the third area is used to store the second system; the fourth area is used to store the upgrade identification and/or the number of upgrades.
According to the second aspect of this disclosure, a system upgrade method in an IoT device is also proposed, which includes: setting a boot loader, the boot loader is configured to respond to the startup of the IoT device and execute such as The system upgrade method mentioned in the first aspect of this disclosure.
According to the third aspect of the present disclosure, a system upgrade method in an IoT device is also proposed, which includes: responding to a system upgrade request, trying to start the second system; when the second system fails to start or the number of times the second system fails to start When the first predetermined threshold is exceeded, the first system is started, where the second system is a new system to be upgraded, and the version of the first system is lower than the second system.
According to the fourth aspect of this disclosure, a program upgrade method in IoT devices is also proposed, which includes: checking whether there is an upgrade mark; if there is an upgrade mark, judging whether the number of upgrades exceeds the first predetermined threshold ; When it is determined that the number of upgrades exceeds the first predetermined threshold, the first program is started, and/or when it is determined that the number of upgrades does not exceed the first predetermined threshold, try to start the second program, where the second The program is a new program to be upgraded, and the version of the first program is lower than the second program.
According to the fifth aspect of this disclosure, a program upgrade method in IoT devices is also proposed, which includes: setting a boot loader. The boot loader is configured to respond to the startup of the IoT device and execute such as The program upgrade method mentioned in the fourth aspect of this disclosure.
According to the sixth aspect of this disclosure, a program upgrade method in IoT devices is also proposed, including: responding to a program upgrade request, attempting to start the second program; when the second program fails to start or the number of times the second program fails to start When the first predetermined threshold is exceeded, the first program is started, where the second program is a new program to be upgraded, and the version of the first program is lower than the second program.
According to the seventh aspect of this disclosure, a system upgrade device in an Internet of Things device is also proposed, which includes: a check module for checking whether there is an upgrade mark; a judgment module for when there is an upgrade mark , Determine whether the number of upgrades exceeds the first predetermined threshold; the first activation module is used to activate the first system and/or the second activation when the judgment module determines that the number of upgrades exceeds the first predetermined threshold The module is used to try to start the second system when the module determines that the number of upgrades does not exceed the first predetermined threshold, where the second system is a new system to be upgraded, and the version of the first system is lower than the first Two systems.
According to the eighth aspect of this disclosure, a system upgrade device in an IoT device is also proposed, including: a setting module for setting a boot loader, and the boot loader is configured to respond to the IoT device Power on and start, and execute the system upgrade method described in the first aspect of this disclosure.
According to the ninth aspect of the present disclosure, a system upgrade device in an Internet of Things device is also proposed, which includes: a second activation module for responding to a system upgrade request to try to activate the second system; and a first activation module , Used to start the first system when the second system fails to start or the number of times the second system fails to start exceeds a predetermined threshold, where the second system is a new system to be upgraded, and the version of the first system is lower than the first system Two systems.
According to the tenth aspect of this disclosure, a program upgrade device in Internet of Things equipment is also proposed, including: a check module for checking whether there is an upgrade logo; a judging module for when there is an upgrade logo , To determine whether the number of upgrades exceeds the first predetermined threshold; the first activation module is used to activate the first program and/or the second activation when the judgment module determines that the number of upgrades exceeds the first predetermined threshold The module is used to try to start the second program when the module determines that the number of upgrades does not exceed the first predetermined threshold, where the second program is a new program to be upgraded, and the version of the first program is lower than the first Two programs.
According to the eleventh aspect of the present disclosure, a program upgrade device in the Internet of Things device is also proposed, including: a setting module for setting a boot loader, the boot loader is configured to respond to the Internet of Things The device is powered on and starts, and executes the program upgrade method described in the fourth aspect of this disclosure.
According to the twelfth aspect of this disclosure, a program upgrade device in an Internet of Things device is also proposed, which includes: a second activation module, which is used to respond to a program upgrade request and try to activate the second program; and the first activation module Group, used to start the first program when the second program failed to start or the number of second program failed to start exceeds the first predetermined threshold, where the second program is a new program to be upgraded, the version of the first program Lower than the second formula.
According to the thirteenth aspect of the present disclosure, a computing device is also proposed, including: a processor; and a memory, on which executable code is stored. When the executable code is executed by the processor, the processor executes such as This disclosure discloses the method described in any one of the first aspect to the sixth aspect.
According to the fourteenth aspect of the present disclosure, a non-transitory machine-readable storage medium is also proposed, on which executable code is stored. When the executable code is executed by the processor of the electronic device, the processor executes such as This disclosure discloses the method described in any one of the first aspect to the sixth aspect.
This disclosure supports system upgrades in IoT devices, and can automatically roll back to the previous version when the system upgrade fails or the number of upgrades exceeds a predetermined threshold, thereby eliminating the upgrade risk of IoT devices.
下面將參照附圖更詳細地描述本揭露的優選實施方式。雖然附圖中顯示了本揭露的優選實施方式,然而應該理解,可以以各種形式實現本揭露而不應被這裡闡述的實施方式所限制。相反,提供這些實施方式是為了使本揭露更加透徹和完整,並且能夠將本揭露的範圍完整地傳達給本領域的技術人員。
圖1示出了物聯網設備與伺服器間的通信流程圖。
本揭露述及的物聯網設備100可以是但不限於PDA (Personal Digital Assistant,個人數位助理)智慧終端機、車輛(如無人汽車)、感測器、智慧家居設備(如可以包括但不限於智慧音箱、掃地機器人、智慧燈泡、智慧開關、智慧門鎖)等。其中PDA智慧終端機可以是但不限於快件跟蹤掃描記錄儀,用於實現零售開單、列印小票、盤點、資料上傳和日結等一種或多種功能的移動POS機。
物聯網(Internet of Things,簡稱IoT),即“萬物相連的網際網路”是網際網路基礎上的延伸和擴充的網路,將各種資訊感測設備與網際網路結合起來而形成的一個巨大網路,實現在任何時間、任何地點,人、機、物的互聯互通。物聯網設備100可以通過物聯網與伺服器通信,也可以通過物聯網與其他物聯網設備連接。
如圖1所示,物聯網設備100可以利用OTA(Over-the-Air Technology,空中下載技術)進行遠端升級。例如,物聯網設備100可以通過網路從伺服器200獲取更新檔,以實現物聯網設備100的遠端升級。其中網路可以是但不限於無線通訊網路、網際網路、私域網、區域網路、都會區網路、廣域網路或是蜂巢式資料網路等。
在物聯網設備100利用OTA進行遠端升級的過程中,不可避免地會出現因升級檔錯誤或其他原因導致升級失敗的情況發生。
為了使得系統升級失敗時,物聯網設備100能夠自動回滾到之前的版本,不影響設備的正常使用,本揭露提出了一種支援升級失敗自動回滾到之前版本的系統升級方案。本揭露主要是設置引導載入程式,基於引導載入程式引導系統升級並提供升級失敗情況下的應對處理。本揭露述及的引導載入程式可以視為設備加電後運行的第一段軟體代碼,其中引導載入程式可以實現為一種韌體,例如可以是Bootloader韌體。
物聯網設備上電啟動後,可以首先啟動引導載入程式,由引導載入程式執行本揭露的系統升級方法,實現系統升級及升級失敗情況下的應對處理。
圖2示出了物聯網設備的儲存區佈局結構示意圖。
如圖2所示,物聯網設備的儲存區可以劃分為第一區、第二區、第三區以及第四區。其中這裡述及的劃分不代表執行實際的劃分動作,而可以是指邏輯上的劃分。
第一區用於儲存引導載入程式,引導載入程式用於執行本揭露的系統升級方法,引導啟動整個系統。
第二區用於儲存第一系統,第三區用於儲存第二系統,其中第二系統為待升級的新系統,第一系統的版本低於第二系統,第一系統可以視為舊系統。第一系統可以是指升級新系統前設備運行過的系統,第二區可以儲存一個或多個版本低於第二系統的舊系統。
第四區用於儲存升級標識、升級次數等升級參數。其中,第四區定義的參數設計為引導載入程式和系統程式進行共用的資料橋樑,可以相互配合完成對系統啟動失敗的自動判斷。
作為示例,在新系統成功啟動後,可以將第二區中的舊系統替換為新系統,並清空第三區,以等待新的升級系統的到來。
另外在新系統成功啟動後,也可以在不刪除第二區中儲存的舊系統的情況下,將新系統添加到第二區,由此第二區中可以儲存多個設備運行過的系統。
圖3示出了根據本揭露一實施例的物聯網設備中的系統升級方法的示意性流程圖。
如圖3所示,物聯網設備上電啟動後,首先啟動引導載入程式,在引導載入程式的引導作用下,實現整個系統升級方法的執行。
在步驟S110,可以由引導載入程式設置計時器,也即初始化計時器。
計時器用於計時,並回應於計時超過預定臨限值(為了便於分區,可以稱為第二預定臨限值)觸發本揭露的系統升級方法的執行(也即觸發引導載入程式的重啟),或者觸發第一系統的啟動。其中計時器可以實現為一種硬體模組,如可以實現為硬體看門狗。
在本實施例中,第一系統可以是升級前運行的系統,如可以是第二系統的上一個版本的系統。另外第一系統也可以是從第二系統之前多個版本的系統中選擇的一個版本的系統,也即第一系統可以是從第二區儲存的多個舊系統中選擇的一個系統。
在步驟S120,檢查是否存在升級標識。
升級標識用於表徵物聯網設備當前是否存在升級需求,升級標識可以是回應於接收到伺服器下發的升級檔或升級指令而產生的識別字。關於升級標識的具體表示形式,本揭露不再贅述。
在不存在升級標識的情況下,表明物聯網設備當前無需升級,可以執行步驟S190,啟動第一系統。作為示例,在執行步驟S190時,可以啟動升級前運行的系統,也可以根據統計得到的各個版本的系統穩定性,從第二系統之前多個版本的系統中選擇穩定性較好的版本的系統進行啟動。
在存在升級標識的情況下,表明物聯網設備當前存在升級需求,可以執行步驟S130,判斷升級次數是否超過預定臨限值N(為了便於分區,可以稱為第一預定臨限值)。此處述及的升級次數是指嘗試啟動待升級的新系統的次數,也即失敗次數。第一預定臨限值的大小可以根據實際情況設定。
如上文結合圖1所述,第四區用於儲存升級標識、升級次數等參數,因此在執行步驟S120、步驟S130時,均可以從第四區獲取升級標識、升級次數,實現升級標識的尋找、升級次數的判斷等操作。
在判定升級次數超過第一預定臨限值的情況下,表明失敗次數過多,無法升級成功,此時可以執行步驟S190,啟動第一系統。
在判定升級次數不超過第一預定臨限值的情況下,可以執行步驟S140、步驟S150,將升級次數加1並嘗試啟動新系統。
在執行完步驟S150後,可以判斷是否成功啟動。
在第二系統能夠正常運行的情況下可以認為啟動成功,也即升級成功。在第二系統啟動過程中出錯(如拋出錯誤)或者啟動耗時(也即升級耗時)超過第三預定臨限值的情況下,可以認為啟動失敗。
在未成功啟動新系統的情況下,可以執行步驟S195,使計時器超時,進而觸發引導載入程式的重新開機。可選地,在未成功啟動的情況下,也可以通過執行步驟S195使計時器超時,觸發第一系統的啟動。
在成功啟動新系統的情況下,可以執行步驟S170,迴圈執行如下操作:在計時器的計時超過第二預定臨限值之前,重置計時。通過迴圈對計時器的計時清零,可以避免在新系統能夠正常運行的情況下,因計時器超時而重啟引導載入程式或回滾到第一系統。其中,在計時器是看門狗的情況下,步驟S170也即對看門狗進行自動餵狗。可選地,步驟S170可以由成功啟動後的新系統執行。
在本揭露中,可以在計時器的配合下實現系統升級失敗情況下本揭露的系統升級方法(也即引導載入程式)的重啟。可選地計時器還可以用於在第二系統的啟動耗時超過第二預定臨限值的情況下,自動回滾到第一系統。
另外在成功啟動的情況下,還可以執行步驟S180,清除升級標識及/或升級次數。由此,在執行完步驟S180後,成功啟動後的新系統就可以作為當前運行系統運行,此後在物聯網設備需要再次升級的情況下,當前運行的系統可以作為第一系統,待升級的新系統可以作為新的第二系統,再次執行圖3所示的流程,實現系統升級。
綜上,本揭露可以在引導載入程式的作用下初始化計時器,並引導啟動新系統,在成功啟動新系統後,可以迴圈重置計時器的計時,避免系統重啟。而在新系統啟動失敗時,可以由計時器觸發系統重啟,重新在引導載入程式的作用下執行本揭露的升級方法,在失敗次數(也即升級次數)超過第一預定臨限值時,自動回滾到舊系統。
本揭露還提出了另一種物聯網設備中的系統升級方法,包括:設置引導載入程式,引導載入程式被配置為:執行上文結合圖3所示的系統升級方法。
本揭露還提出了另一種物聯網設備中的系統升級方法,包括:回應於系統升級請求,嘗試啟動第二系統;在第二系統啟動失敗或者第二系統啟動失敗次數超過第一預定臨限值的情況下,啟動第一系統。關於第一系統、第二系統可以參見上文相關描述,此處不再贅述。系統升級請求也即物聯網設備的系統升級需求,可以通過檢查是否存在升級標識的方式判斷是否存在系統升級需求,關於升級標識可以參見上文相關描述,此處也不再贅述。
在第二系統啟動失敗的情況下,可以將失敗次數(也即上文述及的啟動次數)加1,然後再次嘗試啟動第二系統,如此在失敗次數超過第一預定臨限值時,不再嘗試啟動第二系統,而是啟動第一系統。
在本實施例中,可以在第二系統超過第三預定臨限值未啟動成功的情況下,判定第二系統啟動失敗。也即本揭露可以根據第二系統啟動耗時來觸發重新升級或回滾到第一系統。
作為示例,可以通過設置計時器,來實現系統第二系統啟動失敗或者第二系統啟動失敗次數超過預定臨限值時,自動回滾到第一系統。例如,計時器可以被設置為,回應於計時超過第二預定臨限值,觸發第一系統的啟動,引導載入程式可以在啟動第二系統失敗或者失敗次數超過第一預定臨限值時,使計時器超時,以回滾到第一系統。
以物聯網設備為快件跟蹤掃描記錄儀、移動POS機為例,上文述及的第一系統/第二系統可以是指即時作業系統(RTOS)。RTOS是指當外界事件或資料產生時,能夠接受並以足夠快的速度予以處理,其處理的結果又能在規定的時間之內來控制生產過程或對處理系統作出快速回應,並控制所有即時任務協調一致運行的作業系統。
至此,就本揭露的物聯網設備中的系統升級方法做了詳細說明。本揭露還可以實現為一種針對物聯網設備中的其他非系統程式的升級的程式升級方法。也即上文述及的第一系統/第二系統也可以替換為運行在物聯網設備中的第一程式/第二程式。
下面就本揭露的物聯網設備中的程式升級方法的流程進行示例性說明,關於方案涉及的細節均可以參見上文相關描述,此處不再贅述。
公開的物聯網設備中的程式升級方法,可以包括:檢查是否存在升級標識;在存在升級標識的情況下,判斷升級次數是否超過第一預定臨限值;在判定升級次數超過第一預定臨限值的情況下,啟動第一程式,並且/或者在判定升級次數未超過第一預定臨限值的情況下,嘗試啟動第二程式,其中,第二程式為待升級的新程式,第一程式的版本低於第二程式。也即本揭露還可以用於對物聯網設備中非系統程式的升級,其中關於方法涉及的細節可以參見上文相關描述,此處不再贅述。
公開的物聯網設備中的程式升級方法,還可以包括:設置引導載入程式,引導載入程式被配置為:執行上文述及的程式升級方法。
公開的物聯網設備中的程式升級方法,還可以包括:回應於程式升級請求,嘗試啟動第二程式;在第二程式啟動失敗或者第二程式啟動失敗次數超過第一預定臨限值的情況下,啟動第一程式,其中,第二程式為待升級的新程式,第一程式的版本低於第二程式。
圖4示出了根據本揭露一個實施例的物聯網設備中的升級裝置的結構示意圖。其中,升級裝置的功能模組可以由實現本揭露原理的硬體、軟體或硬體和軟體的結合來實現。本領域技術人員可以理解的是,圖4所描述的功能模組可以組合起來或者劃分成子模組,從而實現上述發明的原理。因此,本文的描述可以支持對本文描述的功能模組的任何可能的組合、或者劃分、或者更進一步的限定。
下面就升級裝置可以具有的功能模組以及各功能模組可以執行的操作做簡要說明,對於其中涉及的細節部分可以參見上文相關描述,這裡不再贅述。
參見圖4,升級裝置400包括檢查模組410、判斷模組420、第一啟動模組430及/或第二啟動模組440。
在本揭露的一個實施例中,升級裝置400用於實現物聯網設備中的系統升級。
檢查模組410用於檢查是否存在升級標識。
在不存在升級標識的情況下,可以由第一啟動模組430啟動第一系統。第一啟動模組430可以啟動升級前運行的系統,或者也可以根據系統穩定性,從第二系統之前多個版本的系統中選擇一個版本的系統進行啟動。
在存在升級標識的情況下,可以由判斷模組420判斷升級次數是否超過第一預定臨限值。
在判斷模組420判定升級次數超過第一預定臨限值的情況下,可以由第一啟動模組430啟動第一系統。
在判斷模組420判定升級次數未超過第一預定臨限值的情況下,可以由第二啟動模組440嘗試啟動第二系統。
升級裝置400還可以包括累加模組,用於在第二啟動模組440嘗試啟動第二系統的情況下,將升級次數加一。
升級裝置400還可以包括清除模組,用於在第二啟動模組440成功啟動第二系統的情況下,清除升級標識及/或升級次數。
升級裝置400還可以包括計時器,計時器用於回應於計時超過第二預定臨限值觸發系統升級方法的執行,或者觸發第一系統的啟動。
升級裝置400還可以包括重置模組,用於在第二啟動模組440成功啟動第二系統的情況下,迴圈執行如下操作:在計時器的計時超過第二預定臨限值之前,重置計時。
升級裝置400還可以包括產生模組,用於回應於接收到伺服器下發的升級檔或升級指令,產生升級標識。
在本揭露的另一個實施例中,升級裝置400用於實現物聯網設備中的程式升級。
檢查模組410用於檢查是否存在升級標識。
在不存在升級標識的情況下,可以由第一啟動模組430啟動第一程式。第一啟動模組430可以啟動升級前運行的程式,或者也可以根據程式穩定性,從第二程式之前多個版本的程式中選擇一個版本的程式進行啟動。
在存在升級標識的情況下,可以由判斷模組420判斷升級次數是否超過第一預定臨限值。
在判斷模組420判定升級次數超過第一預定臨限值的情況下,可以由第一啟動模組430啟動第一程式,第一程式為版本低於第二程式的程式。
在判斷模組420判定升級次數未超過第一預定臨限值的情況下,可以由第二啟動模組440嘗試啟動第二程式,第二程式為待升級的新程式。
升級裝置400還可以包括累加模組,用於在第二啟動模組440嘗試啟動第二程式的情況下,將升級次數加一。
升級裝置400還可以包括清除模組,用於在第二啟動模組440成功啟動第二程式的情況下,清除升級標識及/或升級次數。
升級裝置400還可以包括計時器,計時器用於回應於計時超過第二預定臨限值觸發系統升級方法的執行,或者觸發第一程式的啟動。
升級裝置400還可以包括重置模組,用於在第二啟動模組440成功啟動第二程式的情況下,迴圈執行如下操作:在計時器的計時超過第二預定臨限值之前,重置計時。
升級裝置400還可以包括產生模組,用於回應於接收到伺服器下發的升級檔或升級指令,產生升級標識。
本揭露還提出了另一種物聯網設備中的升級裝置。該升級裝置包括用於設置引導載入程式的設置模組。引導載入程式可以被配置為執行上文述及的系統升級方法,也可以被配置為執行上文述及的程式升級方法。
圖5示出了根據本揭露另一個實施例的物聯網設備中的升級裝置的結構示意圖。其中,升級裝置的功能模組可以由實現本揭露原理的硬體、軟體或硬體和軟體的結合來實現。本領域技術人員可以理解的是,圖4所描述的功能模組可以組合起來或者劃分成子模組,從而實現上述發明的原理。因此,本文的描述可以支持對本文描述的功能模組的任何可能的組合、或者劃分、或者更進一步的限定。
下面就升級裝置可以具有的功能模組以及各功能模組可以執行的操作做簡要說明,對於其中涉及的細節部分可以參見上文相關描述,這裡不再贅述。
參見圖5,升級裝置500包括第一啟動模組510和第二啟動模組520。
在本揭露的一個實施例中,升級裝置400用於實現物聯網設備中的系統升級。第二啟動模組520用於回應於系統升級請求,嘗試啟動第二系統。第一啟動模組510用於在第二系統啟動失敗或者第二系統啟動失敗次數超過第一預定臨限值的情況下,啟動第一系統,其中,第二系統為待升級的新系統,第一系統的版本低於第二系統。
在本揭露的另一個實施例中,升級裝置400用於實現物聯網設備中的程式升級。第二啟動模組520用於回應於程式升級請求,嘗試啟動第二程式。第一啟動模組510用於在第二程式啟動失敗或者第二程式啟動失敗次數超過第一預定臨限值的情況下,啟動第一程式,其中,第二程式為待升級的新程式,第一程式的版本低於第二程式。
圖6示出了根據本揭露一實施例可用於實現上述物聯網設備中的系統升級方法或程式方法的計算設備的結構示意圖。
參見圖6,計算設備600包括記憶體610和處理器620。
處理器620可以是一個多核的處理器,也可以包含多個處理器。在一些實施例中,處理器620可以包含一個通用的主處理器以及一個或多個特殊的輔助處理器,例如圖形處理器(GPU)、數位訊號處理器(DSP)等等。在一些實施例中,處理器620可以使用訂製的電路實現,例如特殊應用積體電路(ASIC,Application Specific Integrated Circuit)或者現場可程式設計邏輯閘陣列(FPGA,Field
Programmable Gate Arrays)。
記憶體610可以包括各種類型的儲存單元,例如系統記憶體、唯讀記憶體(ROM),和永久儲存裝置。其中,ROM可以儲存處理器620或者電腦的其他模組需要的靜態資料或者指令。永久儲存裝置可以是可讀寫的儲存裝置。永久儲存裝置可以是即使電腦斷電後也不會失去儲存的指令和資料的非揮發性存放裝置。在一些實施方式中,永久性儲存裝置採用大型存放區裝置(例如磁或光碟、快閃記憶體)作為永久儲存裝置。另外一些實施方式中,永久性儲存裝置可以是可移除的存放裝置(例如軟碟、光碟機)。系統記憶體可以是可讀寫存放裝置或者揮發性可讀寫存放裝置,例如動態隨機存取記憶體。系統記憶體可以儲存一些或者所有處理器在運行時需要的指令和資料。此外,記憶體610可以包括任意電腦可讀儲存媒介的組合,包括各種類型的半導體儲存晶片(DRAM、SRAM、SDRAM、快閃記憶體、可程式設計唯讀記憶體),磁碟及/或光碟也可以採用。在一些實施方式中,記憶體610可以包括可讀及/或寫的可移除的存放裝置,例如雷射唱片(CD)、唯讀數位多功能光碟(例如DVD-ROM,雙層DVD-ROM)、唯讀藍光光碟、超密度光碟、快閃記憶體卡(例如SD卡、min SD卡、Micro-SD卡等等)、磁性軟碟等等。電腦可讀儲存媒介不包含載波和通過無線或有線傳輸的瞬間電子信號。
記憶體610上儲存有可執行碼,當可執行碼被處理器620處理時,可以使處理器620執行上文述及的物聯網設備中的系統升級方法或程式方法。
上文中已經參考附圖詳細描述了根據本揭露的物聯網設備中的系統或程式升級方法、裝置及設備。
此外,根據本揭露的方法還可以實現為一種電腦程式或電腦程式產品,該電腦程式或電腦程式產品包括用於執行本揭露的上述方法中限定的上述各步驟的電腦程式代碼指令。
或者,本揭露還可以實施為一種非暫時性機器可讀儲存媒體(或電腦可讀儲存媒體、或機器可讀儲存媒體),其上儲存有可執行代碼(或電腦程式、或電腦指令代碼),當所述可執行代碼(或電腦程式、或電腦指令代碼)被電子設備(或計算設備、伺服器等)的處理器執行時,使所述處理器執行根據本揭露的上述方法的各個步驟。
本領域技術人員還將明白的是,結合這裡的公開所描述的各種示例性邏輯塊、模組、電路和演算法步驟可以被實現為電子硬體、電腦軟體或兩者的組合。
附圖中的流程圖和方塊圖顯示了根據本揭露的多個實施例的系統和方法的可能實現的體系架構、功能和操作。在這點上,流程圖或方塊圖中的每個方塊可以代表一個模組、程式段或碼的一部分,所述模組、程式段或碼的一部分包含一個或多個用於實現規定的邏輯功能的可執行指令。也應當注意,在有些作為替換的實現中,方塊中所標記的功能也可以以不同於附圖中所標記的順序發生。例如,兩個連續的方塊實際上可以基本平行地執行,它們有時也可以按相反的循序執行,這依所涉及的功能而定。也要注意的是,方塊圖及/或流程圖中的每個方塊、以及方塊圖及/或流程圖中的方塊的組合,可以用執行規定的功能或操作的專用的基於硬體的系統來實現,或者可以用專用硬體與電腦指令的組合來實現。
以上已經描述了本揭露的各實施例,上述說明是示例性的,並非窮盡性的,並且也不限於所披露的各實施例。在不偏離所說明的各實施例的範圍和精神的情況下,對於所屬技術領域中具有通常知識者來說許多修改和變更都是顯而易見的。本文中所用用語的選擇,旨在最好地解釋各實施例的原理、實際應用或對市場中的技術的改進,或者使本技術領域的其它普通技術人員能理解本文披露的各實施例。Hereinafter, the preferred embodiments of the present disclosure will be described in more detail with reference to the accompanying drawings. Although the preferred embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to make the disclosure more thorough and complete, and to fully convey the scope of the disclosure to those skilled in the art.
Figure 1 shows a flow chart of communication between IoT devices and servers.
The IoT device 100 mentioned in this disclosure can be, but is not limited to, a PDA (Personal Digital Assistant, personal digital assistant) smart terminal, a vehicle (such as an unmanned car), a sensor, a smart home device (such as, but not limited to, smart Speakers, sweeping robots, smart bulbs, smart switches, smart door locks, etc. Among them, the PDA smart terminal can be, but is not limited to, a shipment tracking and scanning recorder, a mobile POS machine used to implement one or more functions such as retail billing, printing of small receipts, inventory, data uploading, and daily settlement.
Internet of Things (Internet of Things, referred to as IoT), that is, the "Internet of Things Connected" is an extension and expansion network based on the Internet, which is formed by combining various information sensing devices with the Internet. The huge network realizes the interconnection of people, machines and things at any time and any place. The Internet of Things device 100 may communicate with a server through the Internet of Things, and may also be connected with other Internet of Things devices through the Internet of Things.
As shown in FIG. 1, the Internet of Things device 100 can use OTA (Over-the-Air Technology, over-the-air technology) for remote upgrade. For example, the Internet of Things device 100 may obtain an update file from the server 200 through the network, so as to realize the remote upgrade of the Internet of Things device 100. The network can be, but is not limited to, a wireless communication network, the Internet, a private area network, a local area network, a metropolitan area network, a wide area network, or a cellular data network.
In the process of remote upgrade of the Internet of Things device 100 using OTA, it is inevitable that the upgrade will fail due to an upgrade file error or other reasons.
In order to enable the IoT device 100 to automatically roll back to the previous version when the system upgrade fails, without affecting the normal use of the device, this disclosure proposes a system upgrade solution that supports the automatic rollback of the upgrade failure to the previous version. This disclosure is mainly to set up a boot loader, based on the boot loader to guide the system upgrade and provide response processing in the case of an upgrade failure. The boot loader mentioned in this disclosure can be regarded as the first piece of software code that runs after the device is powered on, and the boot loader can be implemented as a kind of firmware, such as a bootloader firmware.
After the Internet of Things device is powered on and started, the boot loader can be started first, and the boot loader executes the disclosed system upgrade method to realize the system upgrade and the handling in case of failure of the upgrade.
Figure 2 shows a schematic diagram of the layout structure of the storage area of the Internet of Things device.
As shown in Figure 2, the storage area of the IoT device can be divided into a first area, a second area, a third area, and a fourth area. The division mentioned here does not represent the execution of the actual division action, but may refer to the logical division.
The first area is used to store the boot loader, and the boot loader is used to execute the disclosed system upgrade method to boot the entire system.
The second area is used to store the first system, and the third area is used to store the second system. The second system is a new system to be upgraded. The version of the first system is lower than that of the second system. The first system can be regarded as the old system. . The first system can refer to the system where the equipment has been running before the new system is upgraded, and the second area can store one or more old systems whose versions are lower than the second system.
The fourth area is used to store upgrade parameters such as upgrade identification and upgrade times. Among them, the parameters defined in the fourth area are designed as a data bridge shared by the boot loader and the system program, which can cooperate with each other to complete the automatic judgment of the system startup failure.
As an example, after the new system is successfully started, the old system in the second zone can be replaced with the new system, and the third zone can be cleared to wait for the arrival of the new upgraded system.
In addition, after the new system is successfully started, the new system can also be added to the second area without deleting the old system stored in the second area, so that the second area can store systems that have been run by multiple devices.
Fig. 3 shows a schematic flowchart of a system upgrade method in an Internet of Things device according to an embodiment of the present disclosure.
As shown in Figure 3, after the Internet of Things device is powered on, the boot loader is first started, and under the guidance of the boot loader, the implementation of the entire system upgrade method is realized.
In step S110, the timer can be set by the boot loader, that is, the timer is initialized.
The timer is used for timing, and in response to the timing exceeding a predetermined threshold (for ease of partitioning, it may be referred to as the second predetermined threshold) triggers the execution of the system upgrade method of the present disclosure (that is, triggers the restart of the boot loader), Or trigger the activation of the first system. The timer can be implemented as a hardware module, such as a hardware watchdog.
In this embodiment, the first system may be a system running before the upgrade, for example, it may be a system of the previous version of the second system. In addition, the first system may also be a system of a version selected from multiple versions of systems before the second system, that is, the first system may be a system selected from a plurality of old systems stored in the second area.
In step S120, it is checked whether there is an upgrade identifier.
The upgrade identifier is used to characterize whether there is a current upgrade requirement for the Internet of Things device, and the upgrade identifier may be an identifier generated in response to receiving an upgrade file or an upgrade instruction issued by the server. Regarding the specific representation form of the upgrade logo, this disclosure will not repeat it.
In the case that there is no upgrade identifier, it indicates that the IoT device does not currently need to be upgraded, and step S190 may be executed to start the first system. As an example, when step S190 is performed, the system that was running before the upgrade can be started, or the system with better stability can be selected from the systems of multiple versions before the second system according to the system stability of each version obtained by statistics. Start up.
If there is an upgrade identifier, it indicates that the IoT device currently has upgrade requirements, and step S130 can be executed to determine whether the number of upgrades exceeds a predetermined threshold N (for ease of partitioning, it may be referred to as a first predetermined threshold). The number of upgrades mentioned here refers to the number of attempts to start the new system to be upgraded, that is, the number of failures. The size of the first predetermined threshold can be set according to actual conditions.
As described above in conjunction with Figure 1, the fourth area is used to store parameters such as the upgrade identifier and the number of upgrades. Therefore, when step S120 and step S130 are performed, the upgrade identifier and the number of upgrades can be obtained from the fourth area to realize the search for the upgrade identifier. , Judging the number of upgrades and other operations.
In the case where it is determined that the number of upgrades exceeds the first predetermined threshold, it indicates that the number of failures is too many and the upgrade cannot be successful. In this case, step S190 may be executed to start the first system.
In the case where it is determined that the number of upgrades does not exceed the first predetermined threshold, step S140 and step S150 can be executed to increase the number of upgrades by 1 and try to start the new system.
After step S150 is executed, it can be judged whether the startup is successful.
In the case that the second system can run normally, it can be considered that the startup is successful, that is, the upgrade is successful. In the case that an error occurs during the startup of the second system (for example, an error is thrown) or the startup time (that is, the upgrade time) exceeds the third predetermined threshold, the startup may be regarded as a failure.
In the case that the new system is not successfully started, step S195 can be executed to cause the timer to time out, thereby triggering the reboot of the boot loader. Optionally, in the case of unsuccessful startup, the timer can also be timed out by executing step S195 to trigger the startup of the first system.
In the case that the new system is successfully started, step S170 may be executed, and the following operations are performed in a loop: reset the timing before the timing of the timer exceeds the second predetermined threshold. By resetting the timer's timing through the loop, it can avoid restarting the boot loader or rolling back to the first system due to the timer's timeout when the new system can run normally. Wherein, when the timer is a watchdog, step S170 is to automatically feed the watchdog. Optionally, step S170 may be executed by the new system after successful startup.
In the present disclosure, the system upgrade method (that is, the boot loader) of the present disclosure can be restarted when the system upgrade fails with the cooperation of a timer. Optionally, the timer can also be used to automatically roll back to the first system in the case that the startup time of the second system exceeds the second predetermined threshold.
In addition, in the case of successful startup, step S180 may also be executed to clear the upgrade identifier and/or the number of upgrades. Therefore, after performing step S180, the new system after successful startup can be run as the current running system. After that, if the IoT device needs to be upgraded again, the currently running system can be used as the first system, and the new system to be upgraded The system can be used as a new second system, and the process shown in Figure 3 is executed again to achieve system upgrades.
In summary, this disclosure can initialize the timer under the action of the boot loader and boot the new system. After the new system is successfully started, the timer can be reset in a loop to avoid system restart. When the new system fails to start, the system restart can be triggered by a timer, and the upgrade method of this disclosure is executed again under the action of the boot loader. When the number of failures (that is, the number of upgrades) exceeds the first predetermined threshold, Automatically roll back to the old system.
This disclosure also proposes another system upgrade method in the Internet of Things device, which includes: setting a boot loader, and the boot loader is configured to execute the system upgrade method shown in FIG. 3 above.
This disclosure also proposes another system upgrade method in IoT devices, including: responding to a system upgrade request, attempting to start the second system; when the second system fails to start or the number of times the second system fails to start exceeds a first predetermined threshold In the case, start the first system. For the first system and the second system, please refer to the relevant description above, which will not be repeated here. The system upgrade request is the system upgrade requirement of the IoT device. It can be judged whether there is a system upgrade requirement by checking whether there is an upgrade identifier. For the upgrade identifier, please refer to the relevant description above, which will not be repeated here.
In the case that the second system fails to start, the number of failures (that is, the number of startups mentioned above) can be increased by 1, and then try to start the second system again, so that when the number of failures exceeds the first predetermined threshold, no Try to start the second system again, but start the first system.
In this embodiment, it may be determined that the second system has failed to start when the second system exceeds the third predetermined threshold and fails to start successfully. That is, the present disclosure can trigger a re-upgrade or rollback to the first system according to the time it takes for the second system to start.
As an example, a timer can be set to implement automatic rollback to the first system when the second system fails to start or the number of times the second system fails to start exceeds a predetermined threshold. For example, the timer may be set to trigger the activation of the first system in response to the timing exceeding the second predetermined threshold. The bootloader may fail to activate the second system or the number of failures exceeds the first predetermined threshold, Time out the timer to roll back to the first system.
Taking IoT devices as express tracking and scanning recorders and mobile POS machines as examples, the first system/second system mentioned above may refer to a real-time operating system (RTOS). RTOS means that when external events or data are generated, they can be accepted and processed quickly enough, and the results of the processing can control the production process or respond quickly to the processing system within the specified time, and control all real-time An operating system where tasks are coordinated.
So far, the system upgrade method in the Internet of Things device disclosed in this disclosure has been described in detail. The disclosure can also be implemented as a program upgrade method for upgrading other non-system programs in the Internet of Things device. That is, the first system/second system mentioned above can also be replaced with the first program/second program running in the IoT device.
The following is an exemplary description of the procedure of the program upgrade method in the Internet of Things device disclosed in the present disclosure. For the details involved in the solution, please refer to the relevant description above, which will not be repeated here.
The disclosed program upgrade method in the Internet of Things device may include: checking whether there is an upgrade mark; if there is an upgrade mark, judging whether the number of upgrades exceeds a first predetermined threshold; after judging that the number of upgrades exceeds the first predetermined threshold Value, start the first program, and/or if it is determined that the number of upgrades does not exceed the first predetermined threshold, try to start the second program, where the second program is the new program to be upgraded, and the first program The version of is lower than the second program. That is to say, the present disclosure can also be used to upgrade non-system programs in the Internet of Things devices. For details about the method involved, please refer to the relevant description above, which will not be repeated here.
The disclosed program upgrade method in the Internet of Things device may further include: setting a boot loader, and the boot loader is configured to execute the program upgrade method mentioned above.
The disclosed program upgrade method in the Internet of Things device may also include: responding to the program upgrade request, attempting to start the second program; in the case that the second program fails to start or the number of times the second program fails to start exceeds the first predetermined threshold , Start the first program, where the second program is a new program to be upgraded, and the version of the first program is lower than the second program.
Fig. 4 shows a schematic structural diagram of an upgrading apparatus in an Internet of Things device according to an embodiment of the present disclosure. Among them, the functional modules of the upgrade device can be implemented by hardware, software, or a combination of hardware and software that implement the principles of the disclosure. Those skilled in the art can understand that the functional modules described in FIG. 4 can be combined or divided into sub-modules to realize the principle of the above-mentioned invention. Therefore, the description herein can support any possible combination, or division, or further limitation of the functional modules described herein.
The following briefly describes the functional modules that the upgrade device can have and the operations that can be performed by each functional module. For the details involved, please refer to the relevant description above, which will not be repeated here.
Referring to FIG. 4, the upgrading apparatus 400 includes an inspection module 410, a judgment module 420, a first activation module 430 and/or a second activation module 440.
In an embodiment of the present disclosure, the upgrading apparatus 400 is used to implement a system upgrade in an Internet of Things device.
The checking module 410 is used to check whether there is an upgrade identifier.
If there is no upgrade identifier, the first system can be activated by the first activation module 430. The first startup module 430 may start the system that was running before the upgrade, or may also select a version of the system from multiple versions of the system before the second system to start it according to the stability of the system.
If there is an upgrade indicator, the judgment module 420 can determine whether the number of upgrades exceeds the first predetermined threshold.
When the judgment module 420 determines that the number of upgrades exceeds the first predetermined threshold, the first activation module 430 may activate the first system.
In the case that the judgment module 420 judges that the number of upgrades does not exceed the first predetermined threshold, the second activation module 440 may try to activate the second system.
The upgrading apparatus 400 may further include an accumulation module, which is used to increase the number of upgrades by one when the second activation module 440 attempts to activate the second system.
The upgrading apparatus 400 may further include a clearing module for clearing the upgrade identifier and/or the number of upgrades when the second activation module 440 successfully starts the second system.
The upgrading apparatus 400 may further include a timer, which is used to trigger the execution of the system upgrading method in response to the time exceeding the second predetermined threshold, or to trigger the activation of the first system.
The upgrade device 400 may also include a reset module, which is used to looply perform the following operations when the second activation module 440 successfully activates the second system: before the timer exceeds the second predetermined threshold, restart Set time.
The upgrading apparatus 400 may further include a generation module for generating an upgrade identifier in response to receiving an upgrade file or an upgrade command issued by the server.
In another embodiment of the present disclosure, the upgrading apparatus 400 is used to implement program upgrading in the Internet of Things device.
The checking module 410 is used to check whether there is an upgrade identifier.
In the case that there is no upgrade identifier, the first program can be activated by the first activation module 430. The first activation module 430 may activate the program that was running before the upgrade, or may also select a version of the program from multiple versions of the program before the second program to activate it according to the stability of the program.
If there is an upgrade indicator, the judgment module 420 can determine whether the number of upgrades exceeds the first predetermined threshold.
When the judgment module 420 determines that the number of upgrades exceeds the first predetermined threshold, the first activation module 430 can activate the first program, and the first program is a program whose version is lower than the second program.
In the case that the determining module 420 determines that the number of upgrades does not exceed the first predetermined threshold, the second activation module 440 may try to activate the second program, and the second program is a new program to be upgraded.
The upgrading device 400 may also include an accumulation module for increasing the number of upgrades by one when the second activation module 440 attempts to activate the second program.
The upgrading apparatus 400 may further include a clearing module for clearing the upgrade identification and/or the number of upgrades when the second activation module 440 successfully activates the second program.
The upgrade device 400 may further include a timer, which is used to trigger the execution of the system upgrade method in response to the timing exceeding the second predetermined threshold, or trigger the start of the first program.
The upgrading device 400 may also include a reset module, which is used to looply perform the following operations when the second activation module 440 successfully starts the second program: before the timer exceeds the second predetermined threshold, restart Set time.
The upgrading apparatus 400 may further include a generation module for generating an upgrade identifier in response to receiving an upgrade file or an upgrade command issued by the server.
This disclosure also proposes another upgrade device in the Internet of Things equipment. The upgrade device includes a setting module for setting a boot loader. The boot loader can be configured to execute the system upgrade method described above, or it can be configured to execute the program upgrade method described above.
Fig. 5 shows a schematic structural diagram of an upgrading apparatus in an Internet of Things device according to another embodiment of the present disclosure. Among them, the functional modules of the upgrade device can be implemented by hardware, software, or a combination of hardware and software that implement the principles of the disclosure. Those skilled in the art can understand that the functional modules described in FIG. 4 can be combined or divided into sub-modules to realize the principle of the above-mentioned invention. Therefore, the description herein can support any possible combination, or division, or further limitation of the functional modules described herein.
The following briefly describes the functional modules that the upgrade device can have and the operations that can be performed by each functional module. For the details involved, please refer to the relevant description above, which will not be repeated here.
Referring to FIG. 5, the upgrading apparatus 500 includes a first activation module 510 and a second activation module 520.
In an embodiment of the present disclosure, the upgrading apparatus 400 is used to implement a system upgrade in an Internet of Things device. The second activation module 520 is used to respond to the system upgrade request and try to activate the second system. The first startup module 510 is used to start the first system when the second system fails to start or the number of times the second system fails to start exceeds the first predetermined threshold, where the second system is a new system to be upgraded, and the second system is a new system to be upgraded. The version of the first system is lower than that of the second system.
In another embodiment of the present disclosure, the upgrading apparatus 400 is used to implement program upgrading in the Internet of Things device. The second activation module 520 is used to respond to the program upgrade request and try to activate the second program. The first startup module 510 is used to start the first program when the second program fails to start or the number of times the second program fails to start exceeds the first predetermined threshold, where the second program is a new program to be upgraded, and the second program is a new program to be upgraded. The version of one program is lower than that of the second program.
FIG. 6 shows a schematic structural diagram of a computing device that can be used to implement the system upgrade method or program method in the above-mentioned Internet of Things device according to an embodiment of the present disclosure.
Referring to FIG. 6, the computing device 600 includes a memory 610 and a processor 620.
The processor 620 may be a multi-core processor, or may include multiple processors. In some embodiments, the processor 620 may include a general-purpose main processor and one or more special auxiliary processors, such as a graphics processing unit (GPU), a digital signal processor (DSP), and so on. In some embodiments, the processor 620 may be implemented using a customized circuit, such as an Application Specific Integrated Circuit (ASIC, Application Specific Integrated Circuit) or a field programmable logic gate array (FPGA, Field
Programmable Gate Arrays).
The memory 610 may include various types of storage units, such as system memory, read-only memory (ROM), and permanent storage. Among them, the ROM can store static data or instructions required by the processor 620 or other modules of the computer. The permanent storage device may be a readable and writable storage device. The permanent storage device may be a non-volatile storage device that does not lose stored instructions and data even after the computer is powered off. In some embodiments, the permanent storage device uses a large storage area device (such as a magnetic or optical disk, flash memory) as the permanent storage device. In other embodiments, the permanent storage device may be a removable storage device (such as a floppy disk, an optical disc drive). The system memory can be a readable and writable storage device or a volatile readable and writable storage device, such as dynamic random access memory. The system memory can store some or all of the instructions and data needed by the processor when it is running. In addition, the memory 610 may include any combination of computer-readable storage media, including various types of semiconductor storage chips (DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), magnetic disks and/or optical disks Can also be used. In some embodiments, the memory 610 may include removable storage devices that can be read and/or written, such as compact discs (CDs), read-only multi-function optical discs (such as DVD-ROM, double-layer DVD-ROM) ), read-only Blu-ray discs, ultra-density discs, flash memory cards (such as SD cards, min SD cards, Micro-SD cards, etc.), magnetic floppy disks, etc. Computer-readable storage media does not contain carrier waves and instantaneous electronic signals that are transmitted wirelessly or wiredly.
The memory 610 stores executable codes. When the executable codes are processed by the processor 620, the processor 620 can execute the system upgrade method or program method in the IoT device mentioned above.
The method, device, and device for upgrading the system or program in the Internet of Things device according to the present disclosure have been described in detail above with reference to the accompanying drawings.
In addition, the method according to the present disclosure can also be implemented as a computer program or computer program product. The computer program or computer program product includes computer program code instructions for executing the above-mentioned steps defined in the above-mentioned method of the present disclosure.
Alternatively, the present disclosure can also be implemented as a non-transitory machine-readable storage medium (or computer-readable storage medium, or machine-readable storage medium) on which executable code (or computer program, or computer instruction code) is stored When the executable code (or computer program, or computer instruction code) is executed by the processor of the electronic device (or computing device, server, etc.), the processor is caused to execute the steps of the above-mentioned method according to the present disclosure .
Those skilled in the art will also understand that the various exemplary logic blocks, modules, circuits, and algorithm steps described in conjunction with the disclosure herein can be implemented as electronic hardware, computer software, or a combination of both.
The flowcharts and block diagrams in the accompanying drawings show the possible implementation architecture, functions, and operations of the system and method according to multiple embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram can represent a module, program segment, or part of the code, and the module, program segment, or part of the code contains one or more logic for implementing the specified Executable instructions for the function. It should also be noted that in some alternative implementations, the functions marked in the block may also occur in a different order than the order marked in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and/or flowchart, and the combination of blocks in the block diagram and/or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations. It can be realized, or it can be realized by a combination of dedicated hardware and computer instructions.
The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Without departing from the scope and spirit of the illustrated embodiments, many modifications and changes are obvious to those with ordinary knowledge in the technical field. The choice of terms used herein is intended to best explain the principles, practical applications, or improvements to the technology in the market for each embodiment, or to enable other ordinary skilled in the art to understand the various embodiments disclosed herein.