WO2016078222A1 - 引导程序传输方法、嵌入式系统及引导程序传输系统 - Google Patents

引导程序传输方法、嵌入式系统及引导程序传输系统 Download PDF

Info

Publication number
WO2016078222A1
WO2016078222A1 PCT/CN2015/072249 CN2015072249W WO2016078222A1 WO 2016078222 A1 WO2016078222 A1 WO 2016078222A1 CN 2015072249 W CN2015072249 W CN 2015072249W WO 2016078222 A1 WO2016078222 A1 WO 2016078222A1
Authority
WO
WIPO (PCT)
Prior art keywords
uart
uboot
embedded system
spl
external device
Prior art date
Application number
PCT/CN2015/072249
Other languages
English (en)
French (fr)
Inventor
鲍小云
张红卫
孙恒
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2016078222A1 publication Critical patent/WO2016078222A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating

Definitions

  • the present invention relates to the field of embedded system maintenance, and in particular, to a boot program transmission method, an embedded system, and a boot program transmission system of an embedded system.
  • a device In an embedded system, a device, especially a processor, generally reads a boot program from a storage unit externally connected to the system (generally FLASH memory, such as NOR FLASH, NAND FLASH, SPI FLASH, etc.) to boot the system, and these storage units Generally, it is directly soldered to the device. If the boot program in the external storage unit is lost (such as the boot program is suddenly powered off during the upgrade process), the device will not start directly.
  • a storage unit externally connected to the system generally FLASH memory, such as NOR FLASH, NAND FLASH, SPI FLASH, etc.
  • the common method is to solder the external storage unit from the device, re-burn the boot program into the FLASH through special equipment, and then re-weld the FLASH into the device.
  • This method is too complicated. It requires special personnel and equipment to operate, and the number of operations is increased, and the equipment may be permanently damaged. If the device has a JTAG interface, you can also download and run the bootloader through the emulator, and then re-burn the bootloader into FLASH, but this requires special software and equipment personnel to operate.
  • the invention provides a boot program transmission method, an embedded system and a boot program transmission system of an embedded system, and the method is simple.
  • the present invention provides a bootloader method for an embedded system.
  • the method includes: starting a universal asynchronous transceiver transmitter UART; acquiring a boot program UBOOT provided by an external device through the UART; and running UBOOT.
  • the foregoing embodiment further includes: initializing the storage unit controller, writing the UBOOT to the storage unit FLASH; or, initializing the network port, the storage unit controller, and the protocol stack, connecting to the network, downloading the UBOOT, and writing the FLASH .
  • the step of starting the UART in the above embodiment includes: configuring the UART, switching the power-on configuration to start the UART, and initializing the UART.
  • the step of acquiring the boot program provided by the external device through the UART in the above embodiment comprises: acquiring the second loaded system program SPL provided by the external device through the UART, storing the SPL to the static random access memory SRAM, running the SPL, and acquiring through the UART UBOOT, and stored to double rate synchronous dynamic random access memory DDR; or, obtain UBOOT through UART, store to SRAM.
  • the manner of acquiring the SPL and/or the UBOOT through the UART in the foregoing embodiment includes: acquiring the SPL and/or the UBOOT by using the asynchronous file transfer protocol XMODEM.
  • the present invention also provides an embedded system, which in one embodiment includes a universal asynchronous transceiver transmitter UART, and further includes: a boot module configured to enable the UART; and configured to acquire a boot program UBOOT provided by the external device through the UART Get the module; set to run the UBOOT runtime module.
  • a boot module configured to enable the UART
  • UBOOT boot program
  • the above embodiment further includes a writing module, the writing module is configured to initialize the storage unit controller, write the UBOOT to the storage unit FLASH, or initialize the network port, the protocol stack, connect to the network, download the UBOOT and write the FLASH.
  • the writing module is configured to initialize the storage unit controller, write the UBOOT to the storage unit FLASH, or initialize the network port, the protocol stack, connect to the network, download the UBOOT and write the FLASH.
  • the startup module in the above embodiment is specifically configured to configure the UART, and the switching power-on configuration is UART startup, and the UART is initialized.
  • the obtaining module in the above embodiment is specifically configured to acquire the second sub-system program SPL provided by the external device through the UART, store the SPL to the static random access memory SRAM, run the SPL, acquire the UBOOT through the UART, and store the data to the double rate. Synchronize the dynamic random access memory DDR, or acquire the UBOOT through the UART and store it to the SRAM.
  • the obtaining module in the above embodiment is specifically configured to complete the acquisition of the SPL and/or the UBOOT by using the asynchronous file transfer protocol XMODEM.
  • the present invention also provides a transmission system of an embedded system boot program, which includes an external device configured to provide a boot program UBOOT, and an embedded system provided by the present invention.
  • the embedded system and the external device complete the transmission of the boot program through the UART, and the UART is a commonly used communication interface, and does not need to provide special software for the user, and the user has the calculation of the UART interface.
  • the transfer of the boot program in the embedded system can be completed on the machine, for example, to restore and update the boot program, etc., the operation is simple, and the implementation cost is lower than the existing boot program transfer method requiring the solder/emulator.
  • FIG. 1 is a schematic diagram of a bootloader transmission system according to a first embodiment of the present invention
  • FIG. 2 is a flowchart of a method for transmitting a boot program according to a second embodiment of the present invention
  • FIG. 3 is a flowchart of a method for transmitting a boot program according to a third embodiment of the present invention.
  • the bootloader transmission system provided by the present invention includes an external device 1 and an embedded system 2, wherein
  • the external device 1 is used to provide the boot program UBOOT to the embedded system 2.
  • UART Universal Asynchronous Receiver/Transmitter
  • RS232 external UART communication interface
  • the embedded system 2 and the external device 1 complete the transfer of the boot program based on the UART, which may be a commonly used embedded system with a UART and a UART communication interface, and the embedded system 2 is connected to the external device 1 through the UART communication line to start the UART.
  • the boot program UBOOT provided by the external device 1 is acquired by the UART, and the boot program UBOOT is run to complete the transfer of the boot program UBOOT.
  • the embedded system 2 includes a universal asynchronous transceiver transmitter UART 21, a startup module 22, an acquisition module 23, and an operation module 24, where
  • the UART 21 is set to complete transmission of communication data with the external device 1;
  • the startup module 22 is configured to start the UART 21;
  • the obtaining module 23 is configured to acquire the boot program UBOOT provided by the external device through the UART 21;
  • Run module 24 is set to run UBOOT.
  • the embedded system 2 further includes a write module 25 and a memory unit FLASH26
  • the write module 25 is configured to initialize the memory unit controller, write the UBOOT to the memory unit FLASH26, or initialize Network port, protocol stack, connect to the network, download UBOOT and write to FLASH26.
  • the boot module 22 in the embodiment shown in FIG. 1 is further configured to configure the UART 21, switch the power-on configuration to UART boot, and initialize the UART 21.
  • the obtaining module 23 in the embodiment shown in FIG. 1 is further configured to acquire the second sub-system program SPL (Second Program Loader) provided by the external device 1 through the UART 21, and store the SPL to the static random access memory SRAM (Static).
  • SPL Systemecond Program Loader
  • RAM static random access memory
  • DDR Double Rate Synchronous Dynamic Random Access Memory
  • SRAM SRAM storage space Choose a way to size.
  • the acquisition module 23 in the embodiment shown in FIG. 1 is further configured to perform acquisition of SPL and/or UBOOT using the asynchronous file transfer protocol XMODEM, which will be exemplarily described below.
  • FIG. 2 is a flowchart of a method for transmitting a bootloader according to a second embodiment of the present invention. As shown in FIG. 2, in the embodiment, the bootloader method provided by the present invention includes the following steps:
  • the embodiment shown in FIG. 2 further includes: initializing the storage unit controller, writing the UBOOT to the storage unit FLASH; or initializing the network port, the storage unit controller, and the protocol stack, and connecting to the network, Download UBOOT and write to FLASH.
  • step S201 in the embodiment shown in FIG. 2 includes: configuring a UART, switching the power-on configuration to UART startup, and initializing the UART.
  • step S202 in the embodiment shown in FIG. 2 includes: acquiring a second sub-system program SPL provided by the external device through the UART, storing the SPL to the static random access memory SRAM, running the SPL, acquiring the UBOOT through the UART, and Store to double rate synchronous dynamic random access memory DDR; or, obtain UBOOT through UART and store to SRAM.
  • the manner in which the SPL and/or the UBOOT are acquired by the UART in the above embodiment includes: obtaining the SPL and/or the UBOOT by using the asynchronous file transfer protocol XMODEM.
  • the embedded system in the present invention achieves the purpose of booting the boot system through the UART through mutual cooperation between the CPU and the UART and an external device (such as a computer).
  • the device CPU is configured with a UART chip and corresponding pins, and the internal BOOTROM of the CPU (mainly completes the judgment of the power-on configuration, and the implementation of various power-on configurations, such as the startup implementation of UART, SPI FLASH, and NAND FLASH,
  • the application mainly relates to UART startup and implementation of data download related protocol, and supports UART startup, CPU configuration power-on configuration pin, when power-on configuration is UART startup, select to boot from UART, power-on configuration pin adopts Other I O multiplexing methods, so that no additional CPU pins are used, and the CPU integrates a certain size of SRAM (at least a few K size).
  • the embedded system has a UART debugging interface and a power-on configuration circuit or switch to facilitate power-on selection. Startup type; external device provides RS232 interface (
  • the bootloader transmission method provided by the present invention includes the following steps:
  • step S303 it is necessary to first determine whether the power-on configuration is UART startup, if yes, execute step S303, if not, perform other startup processing, such as NAND FLASH startup;
  • the UART baud rate can be set according to the actual situation, such as set to 115200;
  • serial port inputs the B-UART command, starts to start the UART reception, and receives the boot program UBOOT that is input to the computer;
  • this step it is necessary to determine the size of the SRAM storage space. If the SRAM storage space is small, such as a few K, then this step is specifically: first obtain the second installed system program SPL through the UART, and store the SPL to static random. Memory SRAM, run SPL, get UBOOT via UART, and store to double Rate synchronous dynamic random access memory DDR; correspondingly, if the SRAM storage space is large, such as a few hundred K size, then this step is specifically: directly obtain UBOOT through the UART, and store to the SRAM;
  • step S307 is performed, if the download fails, then step S304 is performed;
  • the CPU receives, receives the running version, and may also add some error detection and retransmission mechanisms.
  • the XMODEM protocol is used to complete data reception between the embedded system and the external device, the following steps are included:
  • the embedded system is ready to start receiving XMODEM protocol
  • the embedded system sends a C message and waits to receive the data
  • the SOH indicates that the data interaction is XMODEM protocol, the data length is 128; if the STX is received, it indicates that the data interaction is 1K-XMODEM protocol, the data length is 1024; if received It is EOT, indicating the end of transmission, sending ACK, and ending the processing; if it is received by CAN, it means that the transmitting end cancels the data transmission, sends the ACK, and ends the processing; if it receives other data or receives the timeout, it sends an ACK and ends the processing;
  • the remaining length depends on the protocol type and check type, which is 2 (packet sequence length) + protocol data length (128/1024) + check length (1/2), where the XMODEM protocol data length is 128, 1K-XMODEM protocol The data length is 1024, the CRC check length is 2, and the SUM check length is 1. If it is successfully completed, go to f processing; if an error occurs, such as receiving timeout, send NAK, return to step d;
  • Judgment basis 2 bytes of sequence data behind the SOH (data 0 + data 1), satisfying the negation relationship (data 0 is equal to the negation of data 1), and the packet sequence number (data 0) is equal to the expected sequence number, or equal to the expected sequence number -1 (previous package). If the serial number is correct, go to g processing; if the serial number is incorrect, send NAK and return to step d;
  • g According to the check type (b/c determined), the data is verified (CRC/SUM), if the check is correct, go to h processing; if the check is not correct, send NAK, return to step d;
  • step d processing the desired packet, expecting the sequence number +1, saving the received data, and transmitting the number of retransmissions to the maximum value, such as 25, sending an ACK, returning to step d (receiving the next packet);
  • j processing the retransmission packet, the number of retransmissions -1, determining whether the number of retransmissions is greater than 0;
  • step k If it is greater than 0, send ACK, return to step d (receive the next packet); if less than / equal to 0, then send CAN (cancel the reception), execute step k;
  • the embedded system and external devices complete the transfer of the boot program through the UART, and the UART is a commonly used communication interface, and does not need to provide special software for it.
  • the user can complete the transfer of the boot program in the embedded system on the computer with the UART interface. For example, it is used to restore and update the boot program, etc., and the operation is simple, and the implementation cost is low compared with the existing bootloader method requiring the solder/emulator.
  • the embedded system and the external device provided by the above embodiments and preferred embodiments complete the transmission of the boot program through the UART
  • the UART is a commonly used communication interface, and does not need to provide dedicated software for the user, and the user has the UART interface.
  • the transfer of the boot program in the embedded system can be completed on the computer, for example, to restore and update the boot program, etc., the operation is simple, and the implementation cost is lower than the existing bootloader method requiring the solder/emulator. .

Abstract

一种嵌入式系统的引导程序传输方法、嵌入式系统及引导程序传输系统,该方法包括:启动通用异步收发传输器UART(S201);通过UART获取外部设备提供的引导程序UBOOT(S202);运行UBOOT(S203)。通过实施上述方案,嵌入式系统及外部设备通过UART完成引导程序的传输,而UART是常用的通信接口,不需要为其提供专用软件,用户在具备UART接口的计算机上即可完成对嵌入式系统内引导程序的传输,操作简单,且与现有需要焊接/仿真器的引导程序传输方法相比,实现成本低。

Description

引导程序传输方法、嵌入式系统及引导程序传输系统 技术领域
本发明涉及嵌入式系统维护领域,特别地涉及一种嵌入式系统的引导程序传输方法、嵌入式系统及引导程序传输系统。
背景技术
在嵌入式系统中,设备,尤其是处理器一般从系统外接的存储单元(一般为FLASH存储器,如NOR FLASH、NAND FLASH、SPI FLASH等)中读取引导程序,以引导系统启动,这些存储单元一般都是直接焊接在设备上,如果外接的存储单元中的引导程序丢失(如引导程序在升级过程中,突然断电),会直接导致设备无法启动。
针对设备的引导程序丢失问题,常用的方法是把外接的存储单元从设备上焊下来,通过专门设备把引导程序重新烧录到FLASH中,再把FLASH重新焊接到设备中,这方法操作太复杂,需要专门人员和设备操作,而且操作次数多了,还可能永久性的损坏设备。如果设备带有JTAG接口,也可以通过仿真器,下载并运行引导程序,再把引导程序重新烧录到FLASH中,但这需要专门软件和设备人员操作。
因此,如何提供一种简单的引导程序传输方法,是本领域技术人员亟待解决的技术问题。
发明内容
本发明提供了一种嵌入式系统的引导程序传输方法、嵌入式系统及引导程序传输系统,方法简单。
本发明提供了一种嵌入式系统的引导程序传输方法,在一个实施例中,该方法包括:启动通用异步收发传输器UART;通过UART获取外部设备提供的引导程序UBOOT;运行UBOOT。
优选地,上述实施例在运行UBOOT之后还包括:初始化存储单元控制器,将UBOOT写入存储单元FLASH;或者,初始化网口、存储单元控制器及协议栈,连接网络,下载UBOOT并写入FLASH。
优选地,上述实施例中的启动UART的步骤包括:配置UART,切换上电配置为UART启动,初始化UART。
优选地,上述实施例中的通过UART获取外部设备提供的引导程序的步骤包括:通过UART获取外部设备提供的第二次装系统程序SPL,存储SPL至静态随机存储器SRAM,运行SPL,通过UART获取UBOOT、并存储至双倍速率同步动态随机存储器DDR;或者,通过UART获取UBOOT,存储至SRAM。
优选地,上述实施例中的通过UART获取SPL和/或UBOOT的方式包括:采用异步文件传输协议XMODEM完成SPL和/或UBOOT的获取。
本发明也提供了一种嵌入式系统,在一个实施例中,其包括通用异步收发传输器UART,还包括:设置为启动UART的启动模块;设置为通过UART获取外部设备提供的引导程序UBOOT的获取模块;设置为运行UBOOT的运行模块。
优选地,上述实施例还包括写入模块,写入模块设置为初始化存储单元控制器,将UBOOT写入存储单元FLASH,或者,初始化网口、协议栈,连接网络,下载UBOOT并写入FLASH。
优选地,上述实施例中的启动模块具体设置为配置UART,切换上电配置为UART启动,初始化UART。
优选地,上述实施例中的获取模块具体设置为通过UART获取外部设备提供的第二次装系统程序SPL,存储SPL至静态随机存储器SRAM,运行SPL,通过UART获取UBOOT、并存储至双倍速率同步动态随机存储器DDR,或者,通过UART获取UBOOT,存储至SRAM。
优选地,上述实施例中的获取模块具体设置为采用异步文件传输协议XMODEM完成SPL和/或UBOOT的获取。
对应的,本发明也提供了一种嵌入式系统引导程序的传输系统,其包括设置为提供引导程序UBOOT的外部设备、及本发明提供的嵌入式系统。
本发明的有益效果:
本发明提供的方案,嵌入式系统及外部设备通过UART完成引导程序的传输,而UART是常用的通信接口,不需要为其提供专用软件,用户在具备UART接口的计算 机上即可完成对嵌入式系统内引导程序的传输,如用来对引导程序进行恢复更新等,操作简单,且与现有需要焊接/仿真器的引导程序传输方法相比,实现成本低。
附图说明
图1为本发明第一实施例提供的引导程序传输系统的示意图;
图2为本发明第二实施例提供的引导程序传输方法的流程图;
图3为本发明第三实施例提供的引导程序传输方法的流程图。
具体实施方式
现通过具体实施方式结合附图的方式对本发明做出进一步的诠释说明。
第一实施例:
图1为本发明第一实施例提供的引导程序传输系统的示意图,由图1可知,在本实施例中,本发明提供的引导程序传输系统包括外部设备1及嵌入式系统2,其中,
外部设备1用于向嵌入式系统2提供引导程序UBOOT,在本发明中,只要外部设备1具有UART(Universal Asynchronous Receiver/Transmitter,通用异步收发传输器,在应用时,其一般表现为一个单独的芯片)、并对外提供RS232等UART通信接口即可,如常用的计算机等;
嵌入式系统2与外部设备1基于UART完成引导程序的传输,其可以是常用的、具备UART及UART通信接口的嵌入式系统,嵌入式系统2通过UART通信线连接到外部设备1,启动UART,利用UART获取外部设备1提供的引导程序UBOOT,并运行引导程序UBOOT,以完成引导程序UBOOT的传输。
在一些实施例中,如图1所示,嵌入式系统2包括通用异步收发传输器UART21、启动模块22、获取模块23及运行模块24,其中,
UART21设置为完成与外部设备1之间通信数据的传输;
启动模块22设置为启动UART21;
获取模块23设置为通过UART21获取外部设备提供的引导程序UBOOT;
运行模块24设置为运行UBOOT。
在一些实施例中,如图1所示,嵌入式系统2还包括写入模块25及存储单元FLASH26,写入模块25设置为初始化存储单元控制器,将UBOOT写入存储单元FLASH26,或者,初始化网口、协议栈,连接网络,下载UBOOT并写入FLASH26。
在一些实施例中,图1所示实施例中的启动模块22还设置为配置UART21,切换上电配置为UART启动,初始化UART21。
在一些实施例中,图1所示实施例中的获取模块23还设置为通过UART21获取外部设备1提供的第二次装系统程序SPL(Second Program Loader),存储SPL至静态随机存储器SRAM(Static RAM),运行SPL,通过UART获取UBOOT、并存储至双倍速率同步动态随机存储器DDR(Double Data Rate),或者,通过UART获取UBOOT,存储至SRAM;在实施例应用中,根据SRAM存储空间的大小选择一种方式。
在一些实施例中,图1所示实施例中的获取模块23还设置为采用异步文件传输协议XMODEM完成SPL和/或UBOOT的获取,本实施例将在下文进行示例性的说明。
第二实施例:
图2为本发明第二实施例提供的引导程序传输方法的流程图,由图2可知,在本实施例中,本发明提供的引导程序传输方法包括以下步骤:
S201:启动通用异步收发传输器UART;
S202:通过UART获取外部设备提供的引导程序UBOOT;
S203:运行UBOOT。
在一些实施例中,图2所示实施例在步骤S203之后还包括:初始化存储单元控制器,将UBOOT写入存储单元FLASH;或者,初始化网口、存储单元控制器及协议栈,连接网络,下载UBOOT并写入FLASH。
在一些实施例中,图2所示实施例中的步骤S201包括:配置UART,切换上电配置为UART启动,初始化UART。
在一些实施例中,图2所示实施例中的步骤S202包括:通过UART获取外部设备提供的第二次装系统程序SPL,存储SPL至静态随机存储器SRAM,运行SPL,通过UART获取UBOOT、并存储至双倍速率同步动态随机存储器DDR;或者,通过UART获取UBOOT,存储至SRAM。
在一些实施例中,上述实施例中的通过UART获取SPL和/或UBOOT的方式包括:采用异步文件传输协议XMODEM完成SPL和/或UBOOT的获取。
现通过具体应用实例对本发明做诠释说明。
第三实施例:
在本实施例中,本发明中的嵌入式系统通过CPU及UART和外部设备(如计算机)之间的相互配合,实现通过UART完成引导系统启动的目的。此时,设备CPU配置有UART芯片以及相应管脚,CPU内部自带的BOOTROM(主要完成上电配置的判断,以及各种上电配置的实现,如UART、SPI FLASH、NAND FLASH的启动实现,本申请主要涉及UART启动,以及数据下载相关协议的实现),并且支持UART启动,CPU配置上电配置管脚,当上电配置为UART启动时,选择从UART启动,上电配置管脚采用与其他I O复用的方式,这样不额外占用CPU管脚,并且CPU内部集成一定大小的SRAM(至少几K大小),嵌入式系统具备UART调试接口及上电配置电路或开关,方便选择上电启动类型;外部设备提供RS232接口(UART通讯接口)及串口通讯软件。
如图3所示,在本实施例中,本发明提供的引导程序传输方法包括以下步骤:
S301:CPU内置BOOTROM UART启动;
S302:BOOTROM UART初始化CPU,获取上电配置;
S303:当上电配置为UART启动时,初始化UART模块,设定UART波特率;
本步骤需要先判断上电配置是否为UART启动,如果是,则执行步骤S303,如果不是,则执行其他启动处理,如NAND FLASH启动;
UART波特率可以根据实际情况设置,如设置为115200;
S304:进入人机交互界面,等待接收并处理串口输入的命令;
S305:串口输入B-UART命令,开始启动UART接收,接收计算机传入的引导程序UBOOT;
在本步骤中,需要判断SRAM存储空间的大小,若SRAM存储空间较小,如为几K大小,那么,本步骤具体为:先通过UART获取第二次装系统程序SPL,存储SPL至静态随机存储器SRAM,运行SPL,通过UART获取UBOOT、并存储至双倍 速率同步动态随机存储器DDR;对应的,若SRAM存储空间较大,如为几百K大小,那么,本步骤具体为:直接通过UART获取UBOOT,存储至SRAM;
S306:判断引导程序UBOOT是否下载成功;
如下载超时,或计算机侧中断传输等都认为下载失败;如果下载成功,则执行步骤S307,如果下载失败,则回转步骤S304;
S307:运行引导程序UBOOT,启动系统,并将UBOOT存储到FLASH;
初始化存储单元控制器,将UBOOT写入存储单元FLASH,或者,初始化网口、协议栈,连接网络,下载UBOOT并写入FLASH。
在一些实施例中,若嵌入式系统与外部设备之间数据的传输有很多种实现方式;如,计算机直接发裸数据,CPU接收,接收完运行版本,还可以增加一些差错检测以及重传机制,例如嵌入式系统与外部设备之间采用XMODEM协议完成数据接收时,包括以下步骤:
a:嵌入式系统准备开始XMODEM协议接收;
初始化内部数据,期望序号为1;
b:嵌入式系统发送C报文,并等待接收数据;
如果在规定时间内收到数据,则转到d处理(采用CRC校验);如果超时了,则转到c处理;
c:发送NAK,并等待接收数据;
如果在规定时间内收到数据,则转到d处理(采用SUM校验);如果超时了,则,发送CAN,并结束处理;
d:接收第一个数据,并分析;
如果收到的是SOH,表明后面数据交互用的是XMODEM协议,数据长度为128;如果收到的是STX,表明后面数据交互用的是1K-XMODEM协议,数据长度为1024;如果收到的是EOT,表明传输结束,发送ACK,结束处理;如果收到的是CAN,表示发送端取消数据传输,发送ACK,结束处理;如果收到的是其他数据或者接收超时,发送ACK,结束处理;
e:接收完剩余的数据;
剩余的长度依赖于协议类型和校验类型,为2(包序号长度)+协议数据长度(128/1024)+校验长度(1/2),其中XMODEM协议数据长度为128,1K-XMODEM协议数据长度为1024,CRC校验长度为2,SUM校验长度为1。如果顺利收完,转到f处理;如果出错,如接收超时,则发送NAK,返回步骤d;
f:判断序号是否正确;
判断依据:SOH后面的2个字节序号数据(数据0+数据1),满足取反的关系(数据0等于数据1取反),并且包序号(数据0)等于期望序号,或者等于期望序号-1(上一个包)。如果序号正确,转到g处理;如果序号不正确,则发送NAK,返回步骤d;
g:根据校验类型(b/c确定),对数据进行校验(CRC/SUM),如果校验正确,转到h处理;如果校验不正确,则发送NAK,返回步骤d;
h:判断包序号是否等于期望序号;
如果等于,表明是期望的包,转i处理;如果不等于,表明上一个重传包,转到j处理;
i:处理期望的包,期望序号+1,保存接收到的数据,重传次数传输到最大值,如25,则发送ACK,返回步骤d(接收一下个包);
j:处理重传包,重传次数-1,判断重传次数是否大于0;
如果大于0,则发送ACK,返回步骤d(接收一下个包);如果小于/等于0,则发送CAN(取消接收),执行步骤k;
k:结束接收,返回最终接收结果;接收成功,返回接收到的数据长度;接收失败,返回失败码。
综上可知,通过本发明的实施,至少存在以下有益效果:
嵌入式系统及外部设备通过UART完成引导程序的传输,而UART是常用的通信接口,不需要为其提供专用软件,用户在具备UART接口的计算机上即可完成对嵌入式系统内引导程序的传输,如用来对引导程序进行恢复更新等,操作简单,且与现有需要焊接/仿真器的引导程序传输方法相比,实现成本低。
以上仅是本发明的具体实施方式而已,并非对本发明做任何形式上的限制,凡是依据本发明的技术实质对以上实施方式所做的任意简单修改、等同变化、结合或修饰,均仍属于本发明技术方案的保护范围。
工业实用性
如上所述,通过上述实施例及优选实施方式所提供的嵌入式系统及外部设备通过UART完成引导程序的传输,而UART是常用的通信接口,不需要为其提供专用软件,用户在具备UART接口的计算机上即可完成对嵌入式系统内引导程序的传输,如用来对引导程序进行恢复更新等,操作简单,且与现有需要焊接/仿真器的引导程序传输方法相比,实现成本低。

Claims (11)

  1. 一种嵌入式系统的引导程序传输方法,包括:
    启动通用异步收发传输器UART;
    通过所述UART获取外部设备提供的引导程序UBOOT;
    运行所述UBOOT。
  2. 如权利要求1所述的引导程序传输方法,其中,在运行所述UBOOT之后还包括:
    初始化存储单元控制器,将所述UBOOT写入存储单元FLASH;
    或者,
    初始化网口、存储单元控制器及协议栈,连接网络,下载所述UBOOT并写入所述FLASH。
  3. 如权利要求1所述的引导程序传输方法,其中,所述启动UART的步骤包括:配置所述UART,切换上电配置为UART启动,初始化所述UART。
  4. 如权利要求1至3任一项所述的引导程序传输方法,其中,所述通过所述UART获取外部设备提供的引导程序的步骤包括:
    通过所述UART获取所述外部设备提供的第二次装系统程序SPL,存储所述SPL至静态随机存储器SRAM,运行所述SPL,通过所述UART获取所述UBOOT、并存储至双倍速率同步动态随机存储器DDR;
    或者,
    通过所述UART获取所述UBOOT,存储至所述SRAM。
  5. 如权利要求4所述的引导程序传输方法,其中,通过所述UART获取所述SPL和/或所述UBOOT的方式包括:采用异步文件传输协议XMODEM完成所述SPL和/或所述UBOOT的获取。
  6. 一种嵌入式系统,包括通用异步收发传输器UART,还包括:
    设置为启动所述UART的启动模块;
    设置为通过所述UART获取外部设备提供的引导程序UBOOT的获取模块;
    设置为运行所述UBOOT的运行模块。
  7. 如权利要求6所述的嵌入式系统,其中,还包括写入模块,所述写入模块设置为初始化存储单元控制器,将所述UBOOT写入存储单元FLASH,或者,初始化网口、协议栈,连接网络,下载所述UBOOT并写入所述FLASH。
  8. 如权利要求6所述的嵌入式系统,其中,所述启动模块具体设置为配置所述UART,切换上电配置为UART启动,初始化所述UART。
  9. 如权利要求6至8任一项所述的嵌入式系统,其中,所述获取模块具体设置为通过所述UART获取所述外部设备提供的第二次装系统程序SPL,存储所述SPL至静态随机存储器SRAM,运行所述SPL,通过所述UART获取所述UBOOT、并存储至双倍速率同步动态随机存储器DDR,或者,通过所述UART获取所述UBOOT,存储至所述SRAM。
  10. 如权利要求9所述的嵌入式系统,其中,所述获取模块具体设置为采用异步文件传输协议XMODEM完成所述SPL和/或所述UBOOT的获取。
  11. 一种嵌入式系统的引导程序传输系统,包括设置为提供引导程序UBOOT的外部设备、及如权利要求6至10任一项所述的嵌入式系统。
PCT/CN2015/072249 2014-11-19 2015-02-04 引导程序传输方法、嵌入式系统及引导程序传输系统 WO2016078222A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410663372.2A CN105677376A (zh) 2014-11-19 2014-11-19 引导程序传输方法、嵌入式系统及引导程序传输系统
CN201410663372.2 2014-11-19

Publications (1)

Publication Number Publication Date
WO2016078222A1 true WO2016078222A1 (zh) 2016-05-26

Family

ID=56013141

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/072249 WO2016078222A1 (zh) 2014-11-19 2015-02-04 引导程序传输方法、嵌入式系统及引导程序传输系统

Country Status (2)

Country Link
CN (1) CN105677376A (zh)
WO (1) WO2016078222A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113467842B (zh) * 2021-06-25 2023-09-19 厦门码灵半导体技术有限公司 适用于工业级应用场景的嵌入式设备的启动方法、嵌入式设备和计算机可读存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060048146A1 (en) * 2004-08-24 2006-03-02 Lg Electronics Inc. Forcibly downloading program in mobile communications terminal
CN101145108A (zh) * 2007-09-20 2008-03-19 中兴通讯股份有限公司 用于嵌入式cpu最小系统模块的程序下载方法和装置
CN102043614A (zh) * 2009-10-12 2011-05-04 无锡华润矽科微电子有限公司 一种二次开发系统及二次开发方法

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100389389C (zh) * 2003-06-20 2008-05-21 华为技术有限公司 在嵌入式系统中实现引导程序热升级的方法
JP4848734B2 (ja) * 2005-10-18 2011-12-28 セイコーエプソン株式会社 電子機器
CN102340538B (zh) * 2011-07-20 2013-09-04 杭州创联电子技术有限公司 一种用于gyk数据管理的手持式设备实现方法
CN103677885B (zh) * 2012-09-21 2019-03-05 厦门雅迅网络股份有限公司 一种arm flash简易程序烧写的方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060048146A1 (en) * 2004-08-24 2006-03-02 Lg Electronics Inc. Forcibly downloading program in mobile communications terminal
CN101145108A (zh) * 2007-09-20 2008-03-19 中兴通讯股份有限公司 用于嵌入式cpu最小系统模块的程序下载方法和装置
CN102043614A (zh) * 2009-10-12 2011-05-04 无锡华润矽科微电子有限公司 一种二次开发系统及二次开发方法

Also Published As

Publication number Publication date
CN105677376A (zh) 2016-06-15

Similar Documents

Publication Publication Date Title
US8386764B2 (en) BIOS architecture
WO2017063577A1 (zh) 一种光模块的固件升级方法及装置
KR20070081095A (ko) 멀티프로세서 시스템, 및 슬레이브 시스템의 부팅 방법
KR20120052406A (ko) 펌웨어 이미지 갱신 및 관리
WO2015100878A1 (zh) 一种芯片启动方法及多核处理器芯片、存储介质
RU2614569C2 (ru) Стойка с функцией автоматического восстановления и способ автоматического восстановления для этой стойки
CN110187909B (zh) 一种基于安卓系统的单片机固件升级方法
CN102945173A (zh) 用户程序在线升级系统和升级方法
WO2021136200A1 (zh) 引导程序的加载方法、存储介质及嵌入式终端
US20190281427A1 (en) Systems and methods for upgrading firmware in multiple devices of a wireless fire detection system
JP5932947B2 (ja) ホスト及びシステム
US9934120B2 (en) Method and apparatus for updating a system on chip (SOC) image from a host computer system without using DMA
CN108037931B (zh) 一种对微处理器存储单元进行文件烧写的方法
WO2015196479A1 (zh) 程序数据的更新方法及设备
WO2016197883A1 (zh) 一种在线更新单片机程序的方法及系统
US10453422B2 (en) Electronic apparatus and driving method thereof
WO2016078222A1 (zh) 引导程序传输方法、嵌入式系统及引导程序传输系统
CN111857303B (zh) 一种fpga复位方法、装置、系统和电子设备
CN107332589A (zh) 一种基于蓝牙的固件升级装置
CN110990116A (zh) 在智能网卡和虚拟机之间传输数据的方法、装置和系统
TWI595361B (zh) 電子裝置與其載入程式碼之方法
US11586509B2 (en) Operating system repairs via electronic devices
CN110737480B (zh) 一种串口驱动程序复用方法和装置
CN102455970B (zh) 带可靠性检测功能的多外设boot实现方法、设备及系统
CN207782809U (zh) 一种基于蓝牙的固件升级装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15861057

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15861057

Country of ref document: EP

Kind code of ref document: A1