Embedded Project Generator: A Tool Worth Knowing!

Embedded Project Generator: A Tool Worth Knowing!

In practical development, different developers prefer different development tools. For example, when developing for STM32, tools like Keil, IAR, and VSCode+GCC can be used. For example, the examples provided for the Anfu Lai development board often include projects for both Keil and IAR:

Embedded Project Generator: A Tool Worth Knowing!

Is there a tool that can generate project files for multiple development environments simultaneously? I stumbled upon a tool called project_generator, which does just that.

What is project_generator?

project_generator is an embedded project generator, abbreviated as progen. We can write a specific syntax YAML file to manage our projects and generate IDE project files based on the rules defined in the records.

Visit the progen official website:

https://pypi.org/project/project-generator/

Embedded Project Generator: A Tool Worth Knowing!

The progen project generator currently supports generating projects for the following tools (IDE, Makefile, etc.):

  • uVision4 and uVision5
  • IAR
  • Generated files (GCC ARM)
  • Generated files (ARMCC)
  • Cmake (GCC ARM)
  • CoIDE (GCC ARM)
  • Eclipse (with Makefile for GCC ARM)
  • Sublime (with Makefile for GCC ARM)
  • Visual Studio (with Makefile for GCC ARM)

Installing project_generator

progen depends on a Python environment, so you need to set up Python first. You can install Python2.7.x or Python3.x.x, whichever you prefer. After setting up the Python environment, use pip to install project-generator:

pip install project-generator

Embedded Project Generator: A Tool Worth Knowing!

After installation, you will get:

Embedded Project Generator: A Tool Worth Knowing!

Practicing with project_generator

The official documentation provides us with a baremetal blinky example, which we will use for practical demonstration.

Download the baremetal blinky examples to get:

Embedded Project Generator: A Tool Worth Knowing!

projects.yaml is the YAML file that manages our project. This is the main YAML file, which will reference sub-YAML files in records. The sub-YAML files referenced by projects.yaml can manage multiple projects simultaneously. For example, the content of projects.yaml is as follows:

projects:
  gpio_demo_frdmk64f:
    - records/frdm_k64f.yaml
  gpio_demo_frdmkl25z:
    - records/frdm_kl25z.yaml
  gpio_demo_frdmkl46z:
    - records/frdm_kl46z.yaml

This manages three projects: gpio_demo_frdmk64f, gpio_demo_frdmkl25z, and gpio_demo_frdmkl46z, with corresponding YAML files in records:

Embedded Project Generator: A Tool Worth Knowing!

Next, we will use the progen tool to generate the project. Since the progen tool is stored in the Python/Scripts path and has been added to the environment variable, it is globally effective. We can execute the corresponding command in the baremetal blinky examples project directory to generate the project.

「1. Generate the Keil project for gpio_demo_frdmk64f:」

progen generate -f projects.yaml -p gpio_demo_frdmk64f -t uvision

The -p parameter specifies the project name; the -t parameter specifies the generated project type.

Embedded Project Generator: A Tool Worth Knowing!

Embedded Project Generator: A Tool Worth Knowing!

Embedded Project Generator: A Tool Worth Knowing!

「2. Generate the IAR project for gpio_demo_frdmk64f:」

progen generate -f projects.yaml -p gpio_demo_frdmk64f -t iar_arm

Embedded Project Generator: A Tool Worth Knowing!

Embedded Project Generator: A Tool Worth Knowing!

「3. Generate the gcc_arm project for gpio_demo_frdmk64f:」

progen generate -f projects.yaml -p gpio_demo_frdmk64f -t gcc_arm

Embedded Project Generator: A Tool Worth Knowing!

Embedded Project Generator: A Tool Worth Knowing!

We know that tools like Keil initially support a limited number of chips, requiring the installation of chip support packages for expansion. Similarly, progen also has limited support for development boards and chips, but we can add target support ourselves. The path is as follows:

C:\Python27\Lib\site-packages\project_generator_definitions\target

Embedded Project Generator: A Tool Worth Knowing!

This concludes the brief sharing about the progen project generator. I learned about this tool by chance, explored it a bit, and wanted to share it with everyone, along with some basic practical insights.

This article does not cover the contents of the YAML file; if you are interested, you can learn more on your own:

https://github.com/project-generator/project_generator/wiki/Home

Embedded Project Generator: A Tool Worth Knowing!Embedded Project Generator: A Tool Worth Knowing!

1. Depth: A well-defined embedded project must consider defects during design.

2. Transitioning from a “tech guy” to a “manager” requires a change in role.

3. It is important to learn to love writing documentation!

4. Implement an offline voice controller using STM32!

5. A practical software framework for MCU without an OS.

6. How to identify a bad company?

Embedded Project Generator: A Tool Worth Knowing!

Disclaimer: This article is a network reprint, and the copyright belongs to the original author. If there are any copyright issues, please contact us, and we will confirm the copyright based on the materials you provide and either pay for the manuscript or delete the content.

Leave a Comment