Follow+Star Public Account, don’t miss exciting content
Source | Gitee
Author | DinoHaw
Although Keil development for microcontrollers is often criticized by many developers, it must be acknowledged that Keil is still one of the preferred tools for many microcontroller developers.
Today, I will share an open-source automated compilation script for Keil.
1. Source of Demand
Some companies with restrictions on the development process separate development from compilation (the submitted code version) and require that the compilation process involve as little human participation as possible, necessitating the implementation of automated compilation in the program. This script was developed based on this demand.
2. Introduction
-
Automatically search for all Keil projects in the directory where the script is located
-
When multiple Keil projects are found, if none is specified, the last found Keil project will be selected by default -
When specifying a Keil project, both relative and absolute paths are supported
<span>Keil_v4</span>
or <span>Keil_v5</span>
for compilation-
If left empty, it defaults to using <span>Keil_v5</span>
, specify<span>Keil_v4</span>
by inputting<span>4</span>
-
Supports fuzzy input, such as: <span>K4</span>
,<span>Keil4</span>
,<span>Keilv4</span>
,<span>Keil_4</span>
, etc. -
Supports specifying different paths for Keil software, such as: <span>C:\Keil_v5\UV4\UV4.exe</span>
-
When the installation path of Keil is different from the one in this case <span>D:\Keil_v5\UV4\UV4.exe</span>
, unless the code is modified and recompiled into a new<span>.exe</span>
, the path of the Keil software must be specified
<span>project target</span>
-
If left empty, it defaults to the last selected <span>project target</span>
-
Supports illegal character recognition and error reporting
<span>.bin</span>
and <span>.hex</span>
files to the same directory as the script-
Only copies the <span>.bin</span>
and<span>.hex</span>
files generated by the selected Keil project
3. What Parameters Are Available
Note: All parameters of this script can be input in any order, and leaving them empty indicates default selection, but parameters must be separated by spaces.
4. I Want to Use It Directly
-
This script only supports
<span>windows</span>
systems and requires that Keil software is already installed -
Download the runnable
<span>.exe</span>
from the release -
Place the
<span>.exe</span>
script in the same directory as the Keil project to be compiled (hereafter referred to as Directory A) -
Open
<span>powershell</span>
or<span>cmd</span>
and navigate to Directory A
-
If using
<span>powershell</span>
, you can right-click in an empty space in Directory A while holding the<span>shift</span>
key and select to open<span>powershell</span>
, which will automatically navigate to Directory A
Execute the script
.\