当前位置:网站首页>Embedded development: tips and tricks -- seven tips for designing powerful boot loader
Embedded development: tips and tricks -- seven tips for designing powerful boot loader
2022-07-26 00:57:00 【Guangdong embedded Education】
Embedded software will never end , The software always needs some adjustments , Add functions or fix errors . Embedded developers can return products to manufacturers for updates , Or you can send technicians to the products . Either way is expensive ! The construction of some products makes it necessary to completely dismantle the system to access the programming port of the microcontroller . The boot loader is the perfect solution for both situations .
Boot loader has become a necessity for almost every embedded system , But unfortunately , They receive little attention . For most developers , The ability to update firmware is an afterthought , Instead of thinking in advance , The result of this oversight is to give up building any update functionality into the system at the last minute . Errors sneak into the system , And due to the lack of testing , There is no doubt that it has entered the field . Yes 7 There are three techniques to follow , To ensure that the boot loader not only updates the firmware , And it's right every time .
skill 1—— Add the boot loader as early as possible
Start the boot loader early in the design , It is best after the proof of concept phase when the project is officially funded . Embedded developers integrate the boot loader into the system as soon as possible , Not only can it be thoroughly tested , You can also limit the changes that may need to be made to the application during the integration process .
skill 2—— Check reset vector
One of the purposes of the boot loader is to put the system into a known state , And decide whether to jump to the application or wait for programming instructions . When the boot loader decides that the application should be started , Jumping to application vectors should not be blind . The system flash memory may have been erased before , Thus, the only position of the reset vector is 0xFFFFFFFF. If you execute this reset vector , What happens to the system ?
Before starting the application , The simplest check that can be performed on it is to ensure that the reset vector has been programmed to a value , That is, it is not erased . A programmed reset vector gives a minimum level of confidence , That is, the program will not jump into the weeds . The following diagram 1 An example is given . Embedded developers even want to get better , Check the boundary of possible effective reset vectors . Boundary checking will help ensure that the reset vector is not only programmed , And is pointed to a valid location .

skill 3—— perform CRC check
Resetting the vector check is a good start to verify the existence of the application , But resetting the vector itself does not tell the whole story . What happens if the firmware update is aborted ? The reset vector may have been written to flash , But the application itself is corrupted . Add... To the application CRC Validation is a good way to validate applications . The boot loader can perform fast on application space at startup CRC Check , If the check is successful , The boot loader can assume that the application space is complete .
skill 4—— Lock boot loader
Updating the boot loader on site is an extremely dangerous job . Power failure 、 Stray cosmic rays or dirty appearance may cause the boot loader of the memory to be partially damaged and unusable . As a result, an embedded system is blocked , Until it was saved by more complex programming tools . The boot loader should be a small 、 Simple and robust applications , No function upgrade or error repair is required . Embedded developers should place the boot loader in a protected part of memory , To make sure it doesn't in any way 、 The shape or form is accidentally deleted or overwritten .
skill 5—— Divide flash memory into multiple application slots
Embedded systems sometimes have complex requirements , For example, update the firmware while the application is still running , Or you can restore to the previous version when the update fails . If the flash memory space is not divided into multiple application segments , These requirements will be difficult to achieve . for example , Flash memory space can be partitioned to include boot loader and original firmware in protected memory , Then there are two spare application parts for updating firmware . The boot loader will program one of the spare slots , If it works , You can switch to using the application . In the event of failure , The boot loader can always return to the original application or the application stored in the backup slot .

skill 6—— Using handshake protocol
The compiler will generate a representation of the application , The representation is broken down into records . These records can be generated in many formats , But a common feature is that each record represents a smaller block of the application , And include checksums . Developers can create a protocol , Send one record at a time , Verification record , Write it to flash , Then update the tool with the confirmation response . Once the tool receives confirmation , You can send the next record . Use handshake to divide the refresh process into manageable blocks , And when something goes wrong , The system can process it immediately , Not at the end of the update cycle .
skill 7—— Use Delta Generator
The traditional microcontroller boot program will completely erase the application flash memory space during the update process . If only minor changes are made to the software , Updating firmware may waste time . The method often used in large computer systems is to determine the increment or difference between application files , And only update those changed files or memory parts . Embedded developers use Delta The generator can also be used to minimize the time required to update the microcontroller application .
边栏推荐
- Crawler small operation
- Jupyter changes the main interface and imports the dataset
- Microwave oven rectifier diode cl01-12
- 【RTOS训练营】上节回顾、空闲任务、定时器任务、执行顺序、调度策略和晚课提问
- [array creation in numpy]
- Azure synapse analytics Performance Optimization Guide (1) -- optimize performance using ordered aggregate column storage indexes
- 什么是信息化?什么是数字化?这两者有什么联系和区别?
- [IJCAI 2022] parameter efficient large model sparse training method, which greatly reduces the resources required for sparse training
- YOLOV2 YOLO9000
- [laser principle and application -3]: foreign brands of lasers
猜你喜欢
随机推荐
Django database addition, deletion, modification and query
Hcip day 13
ASP.NET Core配置
[RTOS training camp] ring buffer, at instruction, preview arrangement and evening class questions
[zero based BLDC series] brushless DC motor control principle based on the zero crossing detection method of back EMF
How jupyter changes the default browser
【软件开发规范三】【软件版本命名规范】
el-table滚动条设置
Open download! Alibaba Devops Practice Manual
JDBC实现MySQL8.0数据库的增删改查
Tell you the meaning of unit testing from another angle
【软件开发规范二】《禁止项开发规范》
How to use if in sql service
Processes and threads
jupyter更改主界面并且导入数据集
参数解析器HandlerMethodArgumentResolver分析与实战
什么是信息化?什么是数字化?这两者有什么联系和区别?
Test the concept of left shift and right shift
Django数据库增删改查
力扣记录:剑指offer(2)——JZ13-22









