1912 views|5 replies

8

Posts

0

Resources
The OP
 

[RVB2601 Creative Application Development] Dynamically loading MBRE-work submission [Copy link]

 This post was last edited by cqcqwind on 2022-5-13 10:32

Dynamic loading of MBRE verification system

Author: wy2601@outlook.com

  • Project Background

In recent years, with the development of chip technology in my country and the popularization of wireless networks, IOT MCU has become an important field that has achieved rapid development in the microprocessor market. Compared with traditional STM, 51 and other single-chip microcomputers, domestic IOT MCU provides a better cost-effective capability replacement. At the same time, due to its wireless interconnection capability, it has gained a huge advantage in the emerging market of IOT (Internet of Things).

Obviously, due to its interconnected nature, the focus of the IOT market has shifted from traditional MCU sensor data local processing to wide-area, interconnected, and intelligent development. Its processing power is increasing, FLASH/RAM space is expanding, and external storage capabilities (such as SD/TF large-scale storage, psram expansion) are constantly improving, no longer limited by weak local capabilities. Powerful MCU and interconnected capabilities provide a strong foundation for intelligent and distributed terminal applications. Essentially, it provides the ability to intelligentize end-point sensing (end-point smart sensors).

The important change brought about by the improvement of capabilities is that the traditional sensor business model of simple logic processing has developed more towards smart applications, with the following characteristics:

  1. Flexible network interconnection capabilities: including Lora, WIFI, 2.5/3/4/5g network access capabilities, relatively complete LWIP protocol stack and upper-layer application protocols, combined with cloud service provision, providing unlimited possibilities for business changes;
  2. Powerful local processing capability: Under the condition of high cost performance, it can still provide single/dual CPU, CPU clock starting from 100MHZ, Mbit-level FLASH space and large RAM, and the data processing capability has far exceeded the scope of simple sensor data.
  3. Rich application development scenarios: IOT MCU is no longer a single-chip microcomputer. IOT MCU can be compared to a weakened sensor business terminal. Compared with mobile phone terminals, it can be predicted that the IOT MCU market will inevitably be "application-oriented" .

This project is based on the RVB2601 RISCV development board and is a verification system that explores the conversion from SOC software mode to SOC APP application mode.

  • Introduction

In traditional SOC software development, the logic of the system and application are generally integrated together. The functional improvement of IoT MCU makes the limitations of this integration model more obvious:

    1. Applications and systems are not separated, the development environment and SDK are often complex, and the entry curve is steep; development, compilation and flashing of FLASH takes a long time; debugging and modification are time-consuming and laborious; code writers must be relatively familiar with the underlying system;
    2. SOC software generally lacks the dynamic loading capabilities commonly found in PC systems or mobile application systems. Currently, most system function updates are at the OTA FLASH level at most, and are unable to be dynamically and flexibly expanded, modified, or have new functions added, resulting in low system storage resource utilization.

MBRE (Mini Binary Runtime Environment) is a work of this paper. It provides a verification system environment for dynamic loading capabilities on the RVB2601 platform. It can provide complete application (app) generation, app packaging, app dynamic download, app dynamic operation and other prototype verification functions on the E906 RISCV. It enables RVB2601 to break through the existing SOC development model and develop, load and run applications like a PC or mobile phone. So far, domestic IOT MCU manufacturers have not yet provided actual implementations of similar MBRE functions. (Note: Espressif mentioned in its IDF that it provides esp series ELF RAM loading functions. The options can be seen through the project menuconfig, but it is only marked as an experimental experimental function, and no officially released documents or routines have been provided).

  • System Block Diagram

The MBRE system composition is shown in the figure above.

1Developed through CDK environment, relying on the extracted dynamic application SDK development (SDK is extensible, presenting the system bottom application to the upper layer through the interface). When developing APP, it interacts with SDK, not directly interacting with the system-level code. This makes the APP relatively independent of the OS layer code when it changes, and each is compiled relatively independently, which greatly speeds up the compilation speed. After the compilation and connection are completed, the ELF file obtained is packaged and dynamically passed to RVB2601 for operation. In the experiment, a WEB server was used to verify the remote APP download capability.

2 Burn OS-level core code or other related resources/API implementations into RVB2601 . After the APP is independently developed by CDK, the APP download action of RVB2601 is initiated. In the experiment, the download is initiated through the serial port command app down;

3 RVB2601 executes the download action, stores the obtained APP locally, and executes automatic operation or manual trigger operation according to the configuration. In the experiment, RVB2601 downloads the APP to RAM via WIFI for operation. Due to memory limitations, the experimental system only supports downloading and running one APP. If you want to run other APPs, you need to download and run them again. The downloaded APP does not need to be burned into FLASH.

4In principle, RVB2601 can also store the downloaded APP in the FLASH file system or external non-volatile storage. Multiple different APPs can be stored in the storage, and different functions can be executed according to user interaction. In this way, APP resources with unlimited expansion capabilities are provided in the limited RAM and FLASH resources. IOT MCU can behave like a smart phone or MINI PC, providing rich and updateable interactive functions.

  • Functional description and analysis of each part

The MBRE system construction method is as follows:

  1. MBRE base package burning

The attachment provides the RVB2601 base package of MBRE basic functions, which should be burned into the 2601 FLASH. The base package is modified based on the 2601 network MP3 playback routine. Since the command line and processing flow of burning a single partition of 2601 are not clear, when burning, if necessary, you can use the above project to assist in burning. The prim.hex of the burned base package is the actual developed MBRE loader and SDK/support support. Other partitions such as boot are automatically generated by the routine.

It should be noted that the size of the prim.hex partition of the burning base package exceeds the prim uppercase setting in the ch2601 default partition. Therefore, in addition to modifying the partition configuration of the project itself (see Figure 4-1), you may need to modify the partition configuration in the ch2601 board support package in the 2601 SDK (see Figure 4-2).


4-1 Modification of project partition table

4-2 Modify the SDK board-level partition table

After the programming is successful, please connect to RVB2601 through the serial port software (the experiment uses the serial port window that comes with CDK). MBRE provides a CLI interface. Enter the app command through the serial port to see the commands supported by mre, see Figure 4-3:

4-2 MBRE serial port app commands

  1. WEB server construction

There are no special requirements for the WEB server, it only needs to support the content-length standard downstream content in the bin stream download mode. The open source nginx-1.21.6 Windows version was used in the experiment and successfully ran under the win10 system. Other open source web servers such as miniweb can also run.

After installing the web server, please make a simple configuration of the server and start it, and confirm that RVB2601 should be able to access the server through the connected WiFi network.

  1. APP installation and download

The attachment provides a bin file for dynamic downloading. Please copy the bin file to the content directory of nginx. In the experiment, it was copied to the nginx-1.21.6\html directory. At this time, through the RVB2601 CLI serial port command, output

app down app_url to start rvb2601 download application

For example, if the web server IP address is 192.168.137.1,

app down http://192.168.137.1/01mbreu8g2.bin to download the 01mbreu8g2.bin application file on the web server

Under the default configuration, the app will automatically run after downloading. You can turn off this function by using app auto off in the cli;

Because the provided app is only for testing purposes, the app exit processing is not perfect. If you need to test other apps, it is recommended to enter reboot in the cli, wait for the RVB2601 to restart and connect to wifi successfully, and then execute the app down command to download other applications.

The five apps provided for testing are introduced as follows:

01mbreu8g2.bin: This app only needs the RVB2601 baseboard to run, using the monochrome OLED built into the development board. It includes the display test cases of U8G2.

02mbredht11PA7.bin: This app only needs the RVB2601 baseboard to run, using the OLED built into the development board. At the same time, it needs to be connected to the DHT11 temperature and humidity single-wire sensor, and the sensor's signal line should be connected to the RVB2601 PA7 pin. The routine obtains temperature and humidity information in real time through DHT11;

03tftdemo.bin: This app needs to be connected to an external TFT ILI9341 320X240 SPI 4-wire serial port screen. Among them, the screen CLK is connected to PA28, mosi is connected to PA29, SS is connected to PA7, and DC is connected to PA25. This app is a display test routine for tft espi, including subroutines such as ellipse filling, starry sky, and text waterfall;

04jpgtest.bin: This app needs an external TFT (see Example 3). It mainly tests the JPG decoder, decodes the QVGA original JPG and displays it in full screen, and calculates the processing time.

05smalldesktop.rel.bin: RVB2601 ported version of the popular small project Small TV. For detailed introduction, please refer to the previously published article.

5. Source Code

This work only provides the base package and bin files for testing.

05smalldesktop.rel.bin (24.69 KB, downloads: 0)



04jpgtest.bin (39.67 KB, downloads: 0) [

attach]605845

[/attach] 02mbredht11PA7.bin (12.08 KB, downloads: 0)

01mbreu8g2.bin (24.54 KB, downloads: 0)

generated.rar (1.47 MB, downloads: 3)

6. Video Demonstration (Video Introduction + Link)

1 MBRE dynamic loading development process demonstration

https://www.bilibili.com/video/BV1Vu411C7Do?spm_id_from=333.999.0.0

2 MBRE development and dynamic loading of small TV APP

https://www.bilibili.com/video/BV1Q44y1u7DL?spm_id_from=333.999.0.0

3 MBRE TFT DEMO operation

https://www.bilibili.com/video/BV1cZ4y187ir?spm_id_from=333.999.0.0

7. Project Summary (Project Text Summary + Post Sharing Link Summary)

1 [RVB2601 Creative Application Development] CDK Development Environment Simple Application Experience Sharing

2 [Rivet RVB2601 Creative Application Development] Embedded Development, I'm 10 Times Faster Than You -- RVB Dynamic Loading Model MBRE

3 [Rivet RVB2601 Creative Application Development] Dynamic loading model super test case: tearing up the Internet celebrity project small TV

4 [RVB2601 Creative Application Development] Dynamic loading of MBRE LED color screen ILI9341 TFT wiring method

5 [RVB2601 Creative Application Development] Dynamically loading MBRE JPEG decoder transplant source code and test results

6 [RVB2601 Creative Application Development] Dynamically load MBRE, a fast implementation code of NTP with second-level accuracy

8. Others

1About CDK: It has clear advantages and disadvantages.

Advantages: Compared with platforms such as platformio and idf, it integrates functions such as compilation, development, package download, jtag, template project generation, etc., with simple modules and low entry threshold;

Disadvantages: Stability needs to be improved. After installing VS2002 on Windows 10, CDK cannot be started at all, with no error prompts or error logs. The all-English interface of CDK is not very friendly to engineers (engineers generally have English skills, but the Chinese interface obviously reduces the difficulty of focusing). There are problems with the coupling degree with the underlying gcc, etc. In some cases (such as misuse of Chinese punctuation, extra curly brackets, etc.), the compilation does not have any specific error prompts and directly returns the error code -2. It is difficult to open large files and the system freezes.

Suggestion: Open source platforms such as vscode provide a good editing and integration environment. For example, Espressif, 51, Hezhou and other friendly companies have provided plug-ins based on VSCODE, or support platformio, which greatly improves the work experience. It is strongly recommended to support it;

2 About the 2601 development board: The configuration is good, and the stability is good. However, the preset OLED resolution is low, which cannot reflect the processing capability of 2601; at the same time, the low-priced SD/TF processing module is also lacking. Display and storage are important supporting functions of the development board, and I hope they can be improved in the future;

3 About 2601 SDK: SDK needs to be improved. Technical documentation and support libraries are obviously insufficient. For example, friendly companies such as Espressif provide good support including ARDUINO framework. It is strongly recommended that Alibaba also provide similar extension framework to facilitate the use of extensive open source resources on the Internet.

4. Open community technology blog publishing platform: I have to complain about the content that can be posted on eeworld, but it failed the review. In addition to normal reasons such as irregular external links, the reviewers will make their own judgments on the content of the blog and give the evaluation that the published content is worthless. In fact, as long as it does not violate national laws and regulations and competitive requirements, the specific content of the blog is the self-thoughts and summary of each developer. Even if the personal technology is not perfect, sharing is something worthy of praise. It is incredible to me that the reviewers make personal judgments on the value of the blog content. As a large platform, eclecticism seems to be a more tolerant attitude.

【平头哥RVB2601创意应用开发】动态加载MBRE验证系统.doc (7.99 MB, downloads: 1)

03tftdemo.bin

13.9 KB, downloads: 0

Latest reply

Because the flat-headed brother is the most fearless animal. Eating venomous snakes is like eating spicy sticks. After being bitten, he will take a nap and then continue eating when he wakes up. He also likes to eat honey and can kill lizards! Don’t be fooled by his small size, lions and tigers can’t do anything to him!   Details Published on 2022-6-9 11:45
 
 

189

Posts

5

Resources
2
 
Why is it called Flathead?

Comments

Because the flat-headed brother is the most fearless animal. Eating venomous snakes is like eating spicy noodles. After being bitten, he will sleep and eat again. He also likes to eat honey and can kill lizards! Don’t be fooled by his small size. Lions and tigers can’t do anything to him!  Details Published on 2022-6-9 11:45
 
 
 

71

Posts

0

Resources
3
 

Thank you for sharing. Regarding the content synchronization review issue, I am really sorry that you have a bad experience. We also understand the overall situation. First of all, the development experience summarized and shared by you and other developers is definitely valuable. We have discussed the issues you reported and optimized the review process. If you have any related comments and suggestions in the future, you are welcome to contact me directly.

 
 
 

53

Posts

0

Resources
4
 

I am also very interested in your implementation of the over-the-air upgrade function in the self-built WEB server. I compiled it to RVB2601 and downloaded and ran it. The speed was very fast and it felt very good. I will download your code first, but it should be quite complicated. I will ask you if I have any questions. . .

 
 
 

53

Posts

0

Resources
5
 

The problem is, the source code is not the source code, but some hex files, so how can I load it dynamically? ? ?

 
 
 

53

Posts

0

Resources
6
 
WZH70246 posted on 2022-5-13 09:12 Why is it called Flathead Brother?

Because the flat-headed brother is the most fearless animal. Eating venomous snakes is like eating spicy sticks. After being bitten, he will take a nap and then continue eating when he wakes up. He also likes to eat honey and can kill lizards!

Don’t be fooled by his small size, lions and tigers can’t do anything to him!

 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list