Modbus TCP Server Development and Yocto System Construction

13.8 Modbus TCP Server Development

Source code:

Modbus TCP Server Development and Yocto System Construction

After extraction, the source code is “modbus_server_tcp.c”, which simulates a Modbus TCP sensor. For an explanation of the source code, please refer to “11.7 Modbus TCP Programming and Experimentation”.

When the front-end program and the MQTT program use the RPC interface to read and write the Modbus TCP sensor, the Modbus TCP requests sent by the back-end program (control center) will reach “modbus_server_tcp”.

Chapter 14 System Construction

14.1 Overview of Yocto System

14.1.1 Introduction to Yocto Framework

(You can copy the link below to your browser or scan the QR code to view)

Official Website

https://www.yoctoproject.org/

Modbus TCP Server Development and Yocto System Construction

THE YOCTO PROJECT. IT’S NOT AN EMBEDDED LINUX DISTRIBUTION, IT CREATES A CUSTOM ONE FOR YOU. (YOCTO Project: It is not an embedded Linux distribution, but a project specifically for creating your own custom system!)

The Yocto Project (YP) is an open-source collaborative project that helps developers create custom systems based on Linux, regardless of hardware architecture. The project provides a flexible set of tools and resources that embedded developers around the world can share in terms of technology, software stacks, configurations, and best practices, which can be used to create custom Linux images for embedded and IoT devices or anywhere a customized Linux operating system is needed.

➢Poky: Poky has two meanings. The first meaning refers to the build system used to build Linux; it is worth noting that Poky is merely a concept, not a physical entity: it includes the BitBake tool, the compiler toolchain, BSP, many packages or layers, and can be considered the essence of Yocto; in addition, the default reference Linux distribution obtained using the Poky system is also called Poky (of course, we can name this distribution as we wish). The two meanings of Poky should not be confused.

➢Metadata: A collection of metadata, which describes the various basic elements within the distribution and their sources.

  • Recipes: .bb/.bbappend files, recipe files that describe where to obtain software source code, how to configure it, and how to compile it. The difference between bbappend and bb is mainly that bbappend is based on bb, and its function is to supplement and override the corresponding bb file, somewhat similar to the concept of “rewriting”.

  • Class: .bbclass files.

  • Configuration: .conf files, which are configuration files that we can use to change the build method.

➢Layers: Various meta-xxx directories that classify Metadata into layers, which helps with project maintenance.

➢Bitbake: A task execution engine used to parse and execute Metadata.

➢Output: Various output images.

Summary:

If we describe building a distribution as preparing a banquet, then Yocto is the restaurant name, Poky is the kitchen (and the set of dishes provided as a reference), Metadata is the cooking resources (.bb/.bbappend represent recipes/tips on recipes, .conf represents the head chef in the kitchen), Layers are the categorization of recipes (such as Sichuan cuisine, Cantonese cuisine), Bitbake is the chef, and Output is the banquet that is served.

The following figure introduces the entire framework of the Yocto POKY reference example, where POKY is a reference distribution of YoctoProject®. It includes the OpenEmbedded build system (BitBake and OpenEmbedded Core) as well as a set of meta layers to help you get started building your own distribution. To use the Yocto project tools, you can download Poky and use it to bootstrap your own distribution. Note that Poky does not contain binary files.

Modbus TCP Server Development and Yocto System Construction

14.1.2 Yocto Build Process

The following diagram represents a complete embedded workflow of the Yocto Project, read this diagram using the color-coded blocks in the upper right corner, which includes various Metadata (system source configuration, package configuration, board support packages, etc.), and the yellow area above is specifically for the source code retrieval needed for each build project, including various protocol download methods to save the required source code, which is then processed separately by the light blue Build System to compile different source codes and meta-layer packages simultaneously, ultimately outputting different images and various format packages, SDK system images, etc. For ease of understanding, I have used red text and red arrows for simple explanations.

Modbus TCP Server Development and Yocto System Construction

If you are very interested in Yocto and want to learn more about its usage, you can directly access the official tutorial provided (you can copy the link below to your browser or scan the QR code to view). On this page, the official documentation provides very detailed illustrated tutorials regarding the entire Yocto, and you can refer to the red text descriptions after different chapters under the Manuals section to choose suitable portions for reading and learning.

Official Tutorial Provided

https://docs.yoctoproject.org/

Modbus TCP Server Development and Yocto System Construction
Modbus TCP Server Development and Yocto System Construction
Modbus TCP Server Development and Yocto System Construction
Modbus TCP Server Development and Yocto System Construction

Need Product and Solution Support

Please Scan to Register

Modbus TCP Server Development and Yocto System Construction

Need Technical Support?

If you have any questions while using Renesas MCU/MPU products, you can identify the QR code below or copy the URL to your browser to enter the Renesas Technical Forum to find answers or obtain online technical support.

Modbus TCP Server Development and Yocto System Construction

https://community-ja.renesas.com/zh/forums-groups/mcu-mpu/

To Be Continued

Recommended Reading

Modbus TCP Server Development and Yocto System Construction

Framework Design – RZ MPU Industrial Control Tutorial Series (48)

Modbus TCP Server Development and Yocto System Construction

LVGL Related and JSON-RPC Related – RZ MPU Industrial Control Tutorial Series (49)

Modbus TCP Server Development and Yocto System Construction

Back-end Program Development Related Operations – RZ MPU Industrial Control Tutorial Series (50)

For more exciting content, please stay tuned

Modbus TCP Server Development and Yocto System Construction
Modbus TCP Server Development and Yocto System Construction
Modbus TCP Server Development and Yocto System Construction
Modbus TCP Server Development and Yocto System Construction

Need Product and Solution Support

Please Scan to Register

Leave a Comment