欢迎来到51Due,请先 | 注册
关注我们: 51due论文代写二维码 51due论文代写平台微博
英国论文代写,英国essay代写知名品牌微信

Report代写范文

为您解决留学中生活、学习、工作的困难、疑惑
释放自我

如何写好哲学论文:IAP的设计与实现

2017-03-28 | 来源:51due教员组 | 类别:Report代写范文

哲学论文代写精选:“IAP的设计与实现”,这篇论文主要介绍了IAP的定义和概念,并对通过网络远程方式来更新嵌入式产品固件的方法进行了详细的介绍和分析说明。本哲学论文代写由51due整理,供大家参考阅览。

 

哲学论文代写精选:

 

INTRODUCTION

 

IAP (In Application Programming) refers to updating firmware program of the embedded products dynamically, while not affecting the normal working of them. In industry controlling area, it must be ensured that the embedded products can work continuously, stably and reliably. For many reasons, firmware program must be updated via the given communication interface, like UART, USB, Ethernet, etc, while the product is working. So many customers have a clear demand for IAP function of the embedded products. Many ARM chips both support IAP and ISP (In System Programming) functions, but in contrast to ISP, IAP has the advantage of flexibility, much convenience and no need of a third bootloader program[1]. It is now becoming more and more popular to update the firmware of the embedded products via the network remotely, so, in this paper, we designed the IAP method based on HTTP.

 

This work is supported by the Fundamental Research Funds for the Central Universities grant 78220021.

 

BACKGROUND AND RELATED WORK

 

IAP can be realized through many ways, for example, though UART, though USB, and even though CAN. But these IAP methods all have some disadvantages. Taking IAP through UART as an example, IAP in this way can rarely have remote operation ability, moreover, data transfer speed via UART is very slow. In opposite, Ethernet interface has many advantages to implement IAP: high speed communication rate, remote programming  ability through the network (LAN or WAN), standardized application protocols on top of the TCP/IP stack, like FTP, TFTP, HTTP… , and so on. So, Ethernet is often the preferred interface for implementing IAP capability in embedded products.

 

Nowadays, products with remote updating capability are no doubt very popular to the customers. The IAP method based on HTTP can reduces much work and traveling fee of after service engineers. Try to imagine that if there are 200 embedded terminals in a network needed to be updated for new firmware software, ISP method or IAP though UART require the engineer to go to every working field to update the software by on-line programming. This will be very unconvenient and will waste a lot of human and material resources. While IAP based on HTTP, can do all the updating work remotely on the web, which is very convenient and saves a lot of human and material resources. This kind of simple way is very customer-friendly, which will no doubt increase the competitive power of the embedded products.

 

SYSTEM MODEL DESIGN

 

A.   Hardware platform

This IAP method uses STM32F107 MCU as the experiment hardware platform.

1)   STM32F107 MCU introdution

STM32F107 is 32-bit microcontroller, it features a high-quality 10/100M Ethernet peripheral to interface the PHY. It has an internal UART bootloader on chip which can be used for ISP as the ultimate programming method. It has 256 Kbytes of on-chip Flash memory, up to 64 Kbytes of SRAM. Its internal flash memory can be written protected in 4Kbytes, erased in 1Kbytes or 2Kbytes and written in 2bytes. Program running in one block can write to another block. So STM32F107 is very suitable for IAP applications [2].

2)   system model overview

心理学essay,stat代写,哲学论文代写,research paper代写,英国论文代写,英国代写

 

Figure 1.  system model

The system model is described in figure 1. Every embedded product in the network has a different IP address. Engineers can access each different terminal with a web browser and upload the firmware into it remotely and don’t affect the normal working of the embedded system. The IP address can be set either as a static address or as a dynamic address assigned by a DHCP server. After IP address assignment, the user can start the IAP process.

 

B.   IAP software model

This IAP implementation consists of a simple HTTP web server on top of the LwIP stack, allowing users to update the firmware program by a web browser on the web remotely.

1)   LwIP introdution

The LwIP is a free lightweight TCP/IP stack developed by Adam Dunkels at the Swedish institute of computer science (SICS) and licensed under the BSD license. While retaining the main function of TCP/IP, LwIP reduces the employment of RAM. It only needs several hundred bytes of RAM and about 40Kbytes of ROM to run smoothly, which makes it very suitable for an embedded system [3]. The LwIP supports the following protocols: IPv4, IPv6, UDP, TCP, ICMP, IGMP, SNMP, ARP and PPP. But it does not include protocols from the application layer, like HTTP or TFTP. The official release of the LwIP does not provide any port to any microcontroller. We need to do it by ourselves.

2)   Principles of IAP

In the IAP implementation, there are two parts of code in the flash. The first part is the IAP code, which doesn’t relate to the application function. It is placed at the starting address of the flash. The only function of this part of code is to receive user application firmware from Ethernet interface, and to update the second part of code. The second part of code is the user application code, and it is placed behind the IAP code.

 

心理学essay,stat代写,哲学论文代写,research paper代写,英国论文代写,英国代写

 

Figure 2.  IAP operation flow

Figure 2 shows the IAP operatinon flow chart. IAP code is firstly executed after MCU powered on. During the execution of the IAP code, a flag bit as the operation condition will be checked to decide if to update the user application code or not. This flag bit can be a connected jumper, a down pressed button or something else.

3)   IAP program architecture

This IAP implementation takes advantage of the STM32F107's Ethernet controller. It consists of a simple HTTP web server on top of the LwIP stack. The ethernetif.c and stm32_eth.c files constitute the low-level layer, which is the interface between the stack and the Ethernet controller. The Ethernet interface layer extracts the data packet from a frame and sends them to the LwIP stack. The LwIP stack handles the packet and forwards the data to the HTTP web server. The IAP program gets data from the HTTP web server, and programs it into flash. Figure 3 shows the IAP program architecture.

The DHCP module of LwIP is an optional module. With this module, the IP address of embedded terminals can be set dynamically, assigned by a DHCP server in the network.

 

心理学essay,stat代写,哲学论文代写,research paper代写,英国论文代写,英国代写

 

Figure 3.  IAP program architecture

 

MODEL IMPLEMENTATION

 

The implementation of this IAP method mainly includes two parts of work: the porting of LwIP and the implementation of IAP program.

A.   Porting the LwIP to STM32F107

The porting of LwIP stack has 4 steps as showing in the following parts in sequence.

1)   Ethernet controller interface

The LwIP comes with a file called ethernetif.c, that works as an interface between the stack and the Ethernet controller. This file is presented as a skeleton to be completed to support a specified architecture.

For the STM32F107, the ethernetif.c (under  Utilities\lwip-1.3.1\src\netif) and stm32_eth.c (under Libraries\STM32_ETH_Driver) files constitute the low-level layer, which is the interface between the stack and the Ethernet controller. ethernetif.c contains functions that ensure the transfer of the frames between the low-level driver (stm32_eth.c) and the LwIP stack. Its main function is ethernetif_input, which should be called when a packet is ready to be read from the interface. The low-level layer was set to detect the reception of frames by interrupts. So, when the Ethernet controller receives a valid frame, it generates an interrupt in the handling function, of which the ethernetif_input call is made[4].

2)   Periodic LwIP tasks

Apart from setting the Ethernet controller interface, the LwIP has periodic tasks that should be handled. The STM32F107 SysTick is used to build a system clock that serves as the reference to handle the different periodic tasks. The main function of the periodic task handle is LwIP_Periodic_Handle, which is defined in the netconf.c file. This function guarantees the dispatching of the periodic LwIP tasks. The netconf.c file, which is not part of the LwIP stack, ensures the network interface configuration: LwIP initialization, MAC address setting and IP address setting.

3)   LwIP configuration

The LwIP can be tuned to suit the application's requirements. The default parameters of the stack can be found in the opt.h file, located under the LwIP directory at src\include\LwIP\. To modify these settings, a new file is defined, lwipopts.h, based on the opt.h file, and located under the LwIP directory at port\. It contains the LwIP configuration for the STM32F107 MCU. Basically these parameters concern:

a)   protocol selection, like DHCP, which can be enabled or disabled, defined by LWIP_DHCP

b)   the maximum number of simultaneously active connections, for TCP this is defined by MEMP_NUM_TCP_PCB

c)   the heap size, defined by MEM_SIZE

d)   the number of buffers, defined by PBUF_POOL_SIZE, and the buffer size, defined by PBUF_POOL_BUFSIZE

The number of buffers and the heap size allocated to the application depend on the application’s performance, simultaneous connection requirements and available RAM. Increasing these parameters (number of buffers and heap size) boosts the application performance and connectivity, but reduces the amount of available RAM. Conversely, decreasing these parameters increases the available RAM space, but limits the application performance and connectivity[5].

4)   STM32F107 hardware checksum

Porting LwIP to the STM32F107 takes advantage of  the advanced features of the STM32F107's Ethernet controller’s capability of generating, inserting and verifying the checksums of the IP, and TCP protocols by hardware. This feature frees some CPU load and improves the performance of the IAP program[6].

We can enable the checksum by hardware by uncommenting #define CHECKSUM_BY_HARDWARE in the lwipopts.h file.

The STM32F107’s checksum by hardware feature can be enabled by setting:

a)   the CIC bits, in the first word of the Tx descriptor, for transmitted frames.

b)   the IPCO bit, in the ETH_MACCR register, for received frames.

For those MCU without hardware checksum capability, software generation and checksum verification for the IP, UDP and TCP protocols can be enabled by commenting #define CHECKSUM_BY_HARDWARE in the lwipopts.h file. But it will add some CPU load and decrease the performance of the IAP program.

B.   IAP program implementation

This IAP implementation allows the user to select a binary file with a web browser and to upload it to the embedded system. The IAP firmware can receive a binary file with HTTP protocol and program it into STM32 Flash memory automatically.

1)   Firmware code layout in flash

Because the interrupt vector table of STM32F107 is at the lowest address of the program memory space[6], in order to make the IAP code response to interrupt correctly, the IAP code is placed at the base address of the flash  memory. With the size not exceeding the total size of user flash area, the compiled user application code is placed right after the IAP code (figure 4).

 

心理学essay,stat代写,哲学论文代写,research paper代写,英国论文代写,英国代写

 

Figure 4.  Code layout in Flash memory

The first part of code must be downloaded to MCU with other ways, like JTAG or ISP. The second part of code can use the IAP function of the first part of code. Or it can be downloaded to MCU together with the first part of code, and be updated later with the IAP function of the first part of code.

Before the second part of code starts to run, it should remap the interrupt vector table of CPU to its own interrupt vector table. Then it can do other following operations.

The user application software is compiled and linked to run from the base address of the user Flash area. So, the jump address of IAP code must be equal to the user application link starting address, or the application program cannot be started up correctly[8]. In this IAP implementation, both of the IAP jump address and the base address of the user application program interrupt vector table are 0x8002000, because the user application program start address in the flash is equal to 0x8002000.

2)   File upload using HTTP

File up load using HTTP is defined in RFC1867. This method of uploading files is based on HTML forms. To send raw binary data, the HTML POST method is used instead of the GET method [7].

HTML code for implementing form-based file upload can be like this:Once the server received the POST request, it starts to erase all the user Flash area and waits for a binary file raw data. The received data will then be written into the user Flash area. Flowchart in figure 5 summarizes the IAP method using HTTP.

 

心理学essay,stat代写,哲学论文代写,research paper代写,英国论文代写,英国代写

 

Figure 5.  IAP base on HTTP flow

Before sending the binary file, the web client usually sends HTTP header containing information such as the file name, the content length, etc... These infomation must be parsed by the HTTP web server. While different web clients do not always have the same HTTP header format. For example: Internet Explorer HTTP header format is different from the Mozilla Firefox HTTP header format. So, the HTTP web server must handle these different formats.

The total length of the data to be received is extracted from the HTTP header sent at the beginning of the transfer. Depending on the binary file size, the data is sent in consecutive TCP segments to the web server.

 

V.    MODEL EVALUATION

 

For we applied the standard TCP/IP protocol in this IAP method, the safety of file transfer is surely guaranteed. If for some reasons (like being powered off, hardware problems, wrong operation), the updating process failed, it can be restarted again for another updating process without affecting the normal performance of the product. In the following, we present the user interface, the code size and the downdoad speed of this IAP method.

A.   User interface

Figure 6 shows this IAP user interface. Using a common web browser, the user can select a binary file and upload it to the embedded system (background window). After the IAP operation is finished successfully, the user can reset the MCU and to run the new updated user application program(front window). This way of IAP  is very customer-friendly, unlike IAP via UART and ISP via UART needing specific PC software to cooperate with the firmware.

 

心理学essay,stat代写,哲学论文代写,research paper代写,英国论文代写,英国代写

 

Figure 6.  HTTP based IAP User interface

B.   IAP code size

The optional modules like ICMP module and UDP module is eliminated to reduce the code size. The results in table 1 are computed with the ARM GCC compiler. Optimizations: -O2, One ELF section per function.

The results show that this IAP implementation program size is very small(Flash: 26.8KB, Memory: 19KB), thus can be applied in many embedded products.

 

心理学essay,stat代写,哲学论文代写,research paper代写,英国论文代写,英国代写

 

TABLE 1. IAP CODE SIZE

C.   Download speed

We compared the download speed of this IAP method with IAP via UART and ISP via UART. The results showed in the following table (Table 2) obviously imply that the download speed of this IAP method is faster than the other two methods.

 

心理学essay,stat代写,哲学论文代写,research paper代写,英国论文代写,英国代写

 

TABLE 2. DOWNLOAD SPEED COMPARISION

 

SUMMARY

 

Compare to ISP and some other on-line programming methods, this IAP method doesn’t require any extra hardware support. But it renders many advantages like higher speed of data transfer rate, remote operation capability, very friendly user interface and so on, which greatly increases the work proficiency. So, this IAP method will be easily applied in many embedded products.

 

In the process of updating, safety issue is also greatly concerned. To further improve this IAP method, we can adopt some encryption algorithm like AES, DES, RSA and ECC to encrypt our updating firmware files, avoiding our firmware to be reversely engineered. Only when the key in the updating firmware is right, it can be decrypted and to update the user firmware.

 

51Due作为专业的留学教育辅导机构,专业辅导哲学论文代写research paper代写,自2004年至今,坚持以学生为中心,全天候服务,为海外留学生完成了数万篇assignment代写、essay代写、report代写、经济学论文代写等论文,以优质的英国代写服务赢得留学生的信赖,如有英文论文写作技巧需求,欢迎咨询QQ800020041哦。

 

51Due网站原创范文除特殊说明外一切图文著作权归51Due所有,未经51Due官方授权谢绝任何用途转载或刊发于媒体。如发生侵犯著作权现象,51Due保留一切法律追诉权。-C


我们的优势

  • 05年成立,已帮助上万人
  • 24小时专业客服
  • 团队成员都毕业于全球著名高校
  • 保证原创,支持检测

英国站