“Which compiler should I use to get the final result faster?” This question often comes to the minds of many people when developing electronic board software. Because, the time spent for learning a difficult and complex compiler reduces the time allocated to complete the project. In this case, it will not be possible to reach a solution by completing the project quickly. At this point, the Keil uVision compiler comes to our help. It is a trouble-free compiler with an interface that is easily understandable and easy to use. Keil, a compiler that has agreements with many MCU (micro-controller) manufacturers and allows the users to easily run sample codes, is also the choice of Nuvoton, a company Ozdisan Elektronik is a distributor of. In this article, we will discuss the interface of the Keil software and the programming of the NUC029LAN micro-controller based on the ARM Cortex M0 manufactured by Nuvoton via Keil.

Installing the Keil Software
You can download and install the C51 setup files for 8051-based micro-controllers and the MDK-Arm setup files for Arm-based micro-controllers via https://www.keil.com/download/product/. Keil offers a free license for all Nuvoton brand M0-based processors. Thus, the users don’t have to pay any license fee.
Downloading Nuvoton NU C029LAN Keil Driver and BSP Files
Since the NUC029LAN micro-controller is Arm-based, you can install MDK-Arm and download the Keil Driver (Nu-Link_Keil_Driver_ V3.01.6951) and the BSP (NUC029xAN_Series_
BSP_CMSIS_V3.00.004) files that contain sample codes from the “Software” section in the “Resources” tab of the web page at this address: https://www.nuvoton.com/hq/products/ microcontrollers/arm-cortex-m0-mcus/ nuc029-series/nuc029lan?__locale=en
Keil Interface – Creating a New Project File
After installing the driver, any sample code in the *.bsp file can be compiled and executed. Also, a new project file can easily be created. Figure 1: Keil Files
Let’s have a step-by-step look at what needs to be done to create a new project file:
- Create a new project folder anywhere on your computer (desktop, my documents, etc.).
- Copy the “library” folder in the BSP folder and the “Template” folder in “BSPàSampleCode” and paste them into your project folder and give the “Template” folder a new name. (The template folder was given a project name.)


- You can change the name of the template “Template.uvproj” project file in “ProjeàKeil”, by right-clicking on the file and selecting the “Rename” option.
- Open the project file whose name you have changed. You can see the files related to the project on the left side. Since the location of the ”Library“ and ”CMSIS“ folders that you copied from the ”BSP“ folder to the ”SAMPLE PROJE_template” folder has changed, the compiler will not be able to find these files, and a yellow warning sign will appear on the files in these folders. These files need to be deleted, and re-added by selecting them again from the “Library” file in the “SAMPLE Proje_template”.
“Keil, a compiler that allows the users to easily run sample codes, is also the choice of Nuvoton, a company Ozdisan Elektronik is a distributor of.”

Adding the system_NU C029xAN.c File
Double-click on the CMSIS folder, and on the screen that opens select the “system_NUC029xAN.c” file in your project file by following the “Library→Device→Nuvoton→ NUC029xANàSource” path, and click “Add”. The “system_NUC029xAN.c”
has been added.

Adding the startup_NU C029xAN .s File
Double-click on the CMSIS folder and on the screen that opens, follow the “Library→Device→Nuvoton→ NUC029xAN→Source→ARM” path in your project file, select the “startup_
NUC029xAN.s” file and click “Add”. The “startup_ NUC029xAN.s” has been added.
Adding the “C” Files of the Peripheral Units to be Used
You need to re-add the “c” files created for the peripherals (adc, uart etc.) that you will use in your project. Double-click on the library folder, follow the “Library→StdDriver→src” path in your project file on the screen that opens, select the necessary “c” files, and click “Add”. The “c” files have been added.

Changing the Project Name via Keil
Right-click on the “Template” section at the top left, and open the “Manage Project Items” section. On the screen that opens, type the name you have given to your project instead of the “Template” written in the “Project Targets” section, and click “OK”. Thus, we have also changed the project name through Keil.

“Keil offers a free license for all Nuvoton brand M0-based processors.
Thus, the users don’t have to pay any license fee.”

Specifying the Location of the Project Files
In order to avoid getting an error about the location of the files to be compiled during compilation, the file locations must be specified correctly. Following the “Options for TargetàC/C++” steps, the “Include Paths” section on the left side must be set according to the location of the file, as shown in Figure 7 below.
Creating a Hex File

When the codes for your project are compiled, you need to get a “hex” code that you can upload to your electronic boards. To do this, you need to check the “Create HEX File” option after following the “Options for TargetàOutput” steps before compiling your code. You can give any name you want to the hex code to be created from the “Name of Executable” part in the same section, and after compiling your code you can access the hex code that will be created in the “Obj” folder. 5. After all these operations, you can now compile your code. Double click on the “main.c “ file to open your project code. There are “Build” and “Rebuild” options on the upper left side. “Build” compiles only the target files where the changes in the code section are made, while “Rebuild” compiles all the files.

Once the code is compiled, it can be uploaded to the micro-controller if no error or warning have been received.

6. Upload your compiled error-free and warning-free code to your micro-controller by clicking on “Download”.

As shown in Figure 13, the code that you compiled by creating a new project has been uploaded to your micro-controller without any issues.



