A31G32x
Keil Project Setting Guide
Application Note
Version 1.00
Contents/ list of figures/ list of tables A31G32x Keil Project setting guide
Contents
1 Introduction ... 3
2 Keil Project preparation ... 4
3 Creating Keil Project ... 6
4 Keil environment settings ... 10
5 Keil debugger settings... 15
6 Keil Project execution ... 18
Revision history ... 21
List of Figures Figure 1. Setup File Path ... 4
Figure 2. Folder Configuration ... 5
Figure 3. Keil Project Window ... 6
Figure 4. Select Device for Target Window ... 7
Figure 5. Add Files Window ... 8
Figure 6. Add Group and Files Window ... 9
Figure 7. Keil Project Option Menu ... 10
Figure 8. Device for Target ... 10
Figure 9. Target for Target ... 11
Figure 10. Output for Target ... 12
Figure 11. C/C++ for Target ... 13
Figure 12. Other Option Settings for Target (Listing, User, Linker, Asm) ... 14
Figure 13. Debug for Target ... 15
Figure 14. Debug Menu Description ... 16
Figure 15. Utilities for Target ... 17
Figure 16. Keil IDE Window ... 19
Figure 17. Debugging Window ... 20
List of Tables Table 1. Group of Projects... 8
Table 2. File of Projects ... 9
Table 3. Include Paths Menu of Setup Compiler ... 13
Table 4. Connect & Reset Option of Cortex-M Target Driver Setup ... 16
Table 5. Compile Menu ... 18
A31G32x Keil Project setting guide 1. Introduction
1 Introduction
This application note is intended for developers who want to develop ABOV A31G32x products in a Keil integrated development environment.
This document explains from the preparation of the Keil project to the environment variable settings including debugger settings, compilation and debugging. By reading thoroughly this document, you can configure the initial development environment of Keil quickly.
2. Keil Project preparation A31G32x Keil Project setting guide
2 Keil Project preparation
To use the project in the Keil integrated development environment, the configuration file of the A31G32x product must be added to the Keil uVision installation path. The corresponding locations for this copy and paste process are listed below:
Product configuration file path : Example_Code_A31G32x\FlashLoader\Keil
Keil uVision file path : Keil\ARM\Flash
Copy the configuration files at the product configuration file path, and paste them to the Keil uVision file path.
Example) A31G32x_FLASH
Figure 1. Setup File Path
A31G32x Keil Project setting guide 2. Keil Project preparation
As shown in Figure 2, the main folder includes the device name in its folder name, and comprises six folders.
① In the Core folder, there is a folder with the CMSIS header file which is provided as a standard, and C files and assembly files suitable for the device.
② Drivers folder is where the user-created header files and C files are located for the purpose of using the function.
③ Examples folder is where the example code using the Driver function is located. You can run examples for each peripheral.
④ Init folder contains files that specify the device ROM, RAM stack Pointer and pc counter locations.
⑤ SFR and SVD folders contain files that are used when the user checks or changes the value for the peripheral when debugging.
Figure 2. Folder Configuration
①
②
③
⑤
④
3. Creating Keil Project A31G32x Keil Project setting guide
3 Creating Keil Project
This part explains how to create a new project:
① Select the New uVision Project command in the Project menu to bring up the project creation popup window.
② Set the desired folder path. We recommend using English when setting the folder name.
③ Set the project name in accordance with your purpose.
④ Press the OK button to complete the project creation.
Figure 3. Keil Project Window
①
②
③
④
A31G32x Keil Project setting guide 3. Creating Keil Project
Select the target device for A31G32x.
1. Select “ARM Cortex M0 plus - ARMCM0P” from the path and click the OK button as shown in Figure 4.
Figure 4. Select Device for Target Window
3. Creating Keil Project A31G32x Keil Project setting guide
This part explains how to add directory and file to the newly created Keil project.
1. Right-click on the project directory located in the workspace.
2. You can add directories by clicking the Add Group button.
3. Create the Device / Drivers / Main / Startup directory structure. The project consists of the groups as shown in Table 1.
Table 1. Group of Projects
Group Description
Startup This is where the first executed code resides.
CMSIS- CM0plus This is the location of the CORE-side file provided by ARM.
Drivers This is the file location that is required for peripheral operation.
Main This is the location of the code that acts as the main.
4. You can add files by double clicking on the folders.
If you want to add a file by yourself, left-click on the group as shown in Figure 5, and click on the Add New Item to Group ‘Group Name’. You can select File Type, and specify the File Name and Location. After that, click on the Add button.
Figure 5. Add Files Window
A31G32x Keil Project setting guide 3. Creating Keil Project
5. Add source code files to each folder. The project consists of the files as shown in Figure 6.
Table 2. File of Projects
Group File path
Startup Startup_A31G32x.s
Example+Code_A31G32x\Core\Device\ABOV\A31G32x\Source\ARM CMSIS- CM0plus System_A31G32x.c
Example+Code_A31G32x\Core\Device\ABOV\A31G32x\Source Drivers A31G32x_hal_scu.c, A31G32x_hal_pcu.c, A31G32x_hal_usartn.c⋯
Example+Code_A31G32x\Drivers\Source
Main main.c, A31G32x_it.c, A31G32x_PortInit.c, A31G32x_SystemClock.c Example+Code_A31G32x\Examples\StarterKit\GPIO_LedBlinky
4. Keil environment settings A31G32x Keil Project setting guide
4 Keil environment settings
Select the Options command in the Project menu to activate the project options screen.
Figure 7. Keil Project Option Menu This is the product setting part on the project options screen.
You can select a product you want to use by selecting the Target tab as shown in Figure 8.
Figure 8. Device for Target
A31G32x Keil Project setting guide 4. Keil environment settings
You can set the product's memory information and SFR file in the Target menu by following the procedure listed below:
NOTE: If the product's memory information is not set properly, an error may occur when downloading the Flash.
① Load SFR file from the Example_Code_A31G32x\Sfr path. The SFR file allows Peripheral Register on the debugger to be viewed and controlled in the System Viewer.
② Change the size of ROM and RAM according to Chip-Spec.
IROM1 : start 0x0000_0000, size 0x0002_0000 IRAM1 : start 0x2000_0000, size 0x0000_4000
Figure 9. Target for Target
①
②
4. Keil environment settings A31G32x Keil Project setting guide
You can create a hex file of the product in the Target menu by following the procedure listed below:
① Select the Output tab as shown in Figure 10 and write the Chip-name in the Name of Executable window.
② If you want to create a hex file, check Create HEX File option.
Figure 10. Output for Target
①
②
A31G32x Keil Project setting guide 4. Keil environment settings
This part explains the reference directory and compile settings.
You can add a reference directory in the Target menu by following the procedure listed below:
① Select the C/C++ tab as shown in Figure 11.
② Optimization option can be set to four different levels, and is used when the higher the level, the compiler deletes the code automatically to reduce the size of the code and improve efficiency.
③ From the setup compiler, click the button on the right from “Include Paths” window.
④ Then, a folder setup window will appear with the menus on the right. Use the menus to set the location of header and source files that are required for compilation in include paths.
Table 3. Include Paths Menu of Setup Compiler
Icon Menu Description
New(Insert) This is where the first executed code resides.
Delete This is the location of the CORE-side file provided by ARM.
Move up This is the file location that is required for peripheral operation.
Move down This is the location of the code that acts as the main.
①
②
4. Keil environment settings A31G32x Keil Project setting guide
Figure 12 shows other option settings of Keil environment.
Figure 12. Other Option Settings for Target (Listing, User, Linker, Asm)
A31G32x Keil Project setting guide 5. Keil debugger settings
5 Keil debugger settings
This part explains how to setup a Keil Debugger.
You can set the debug configuration by selecting the Debug tab as shown in Figure 13.
① Select Use Simulator to simulate with a virtual device or Use to simulate directly. If Use is selected, set Debug as the name of the equipment you are using.
② Run to main () determines whether to start with main () or startup code at startup.
③ Click the Edit section of the Initialization File to set the SP (Stack Pointer) and PC (Program Counter). The directory of the file is Example_code_A31G32x/Init.
④ If a Device list appears after clicking on the Settings button of the Use item, the connection is successful.
⑤ This product supports SWD, so select SW.
⑥ Change the Connect and Reset windows and Cache Options as shown in Figure 13.
④
⑤
②
③
①
5. Keil debugger settings A31G32x Keil Project setting guide
Figure 14 introduces a description of each Debug mode.
Figure 14. Debug Menu Description
Table 4. Connect & Reset Option of Cortex-M Target Driver Setup Option Description
Connect Normal Stops the CPU right after connecting the device and the debugger.
With Pre-reset Applies a hardware reset (HW RESET) before connecting the debugger to the device.
Under Reset Holds the hardware reset signal active while connecting the debugger to the device.
Without Stop Connects to and disconnects from the target device without explicitly stopping the CPU. This option is used to inspect memory or peripheral SFRs.
Reset Autodetect Selects one of the above reset methods based on the target device.
HW RESET Performs a hardware reset by asserting the HW RESET signal.
SYSRESETREQ Performs a hardware reset by setting the SYSRESETREQ bit.
VECTRESET Performs a software reset by setting the VECTRESET bit.
Cache Cache Code Informs the debugger that the download program code will not change.
Cache Memory Determines whether memory displays are updated while a program is stopped.
NOTE: For further explanation, see Arm's Ulink2 user guide.
A31G32x Keil Project setting guide 5. Keil debugger settings
This part explains how to setup utilities.
You can set a flash menu command configuration by selecting the Utilities tab and following the procedure introduced below:
① Set the debugger driver option and target updates option in the debug window.
② Click on the Settings button to set the target driver.
③ Set the RAM address according to the chip specification. If the RAM address is incorrect, a flash down error occurs.
— RAM: Start 0x2000_0000, size 0x0000_4000
④ Click the Add button and select the Flash files.
— Flash file name: A31G323_64KB, A31G324_128KB
⑤ At this time, if there is no Flash File, insert the Flashloader file in the Example + Code_A31G32x folder in the \ Keil \ ARM \ Flash path.
— FLM file name: A31G323_64.FLM, A31G324_128.FLM
⑥ After selecting the Flash file, check if it is the same as shown in Figure 15 and click the OK button to save the settings.
② ①
③
④
⑥
6. Keil Project execution A31G32x Keil Project setting guide
6 Keil Project execution
This section describes the process of compiling, downloading, and debugging of A31G32x products by using Keil integrated development environment.
The following explains how to compile and download the program.
① Compile and build the source code by selecting the Rebuild All command from the Project menu.
Table 5. Compile Menu
Icon Menu Description
Build To compile, click the icon or press F7 to start (Only one part of code modification is compiled)
Rebuild Click the icon to compile the entire code
② Figure 16 shows the Compile result screen after completing the Compiler Setting. Check the build log window to see if there is an error in the source code.
③ When you click the download button, the compiled information is transferred to ULINK2 (Debugging Tool) via USB, and then the code is downloaded to the ROM.
④ When you click the debug button, the compiler enters into debug mode and detects the program error and identifies the cause.
A31G32x Keil Project setting guide 6. Keil Project execution
Figure 16. Keil IDE Window
①
②
③ ④
6. Keil Project execution A31G32x Keil Project setting guide
The following shows the debugging screen.
After downloading the program, you can execute and debug the program through the corresponding debugging screen.
Select the Run command in the Debug menu to run the program, and select the Break command to stop the program operation. In addition, you can run the program step by step through the Step command options.
Figure 17. Debugging Window
A31G32x Keil Project setting guide Revision history
Revision history
Date Version Description
20.12.04 1.00 Document created
Important notice A31G32x Keil Project setting guide
ABOV Disclaimer
IMPORTANT NOTICE – PLEASE READ CAREFULLY
ABOV Semiconductor ("ABOV") reserves the right to make changes, corrections, enhancements, modifications, and improvements to ABOV products and/or to this document at any time without notice. ABOV does not give warranties as to the accuracy or completeness of the information included herein. Purchasers should obtain the latest relevant information of ABOV products before placing orders. Purchasers are entirely responsible for the choice, selection, and use of ABOV products and ABOV assumes no liability for application assistance or the design of purchasers’ products. No license, express or implied, to any intellectual property rights is granted by ABOV herein. ABOV disclaims all express and implied warranties and shall not be responsible or liable for any injuries or damages related to use of ABOV products in such unauthorized applications. ABOV and the ABOV logo are trademarks of ABOV. All other product or service names are the property of their respective owners.
Information in this document supersedes and replaces the information previously supplied in any former versions of this document.
© 2020 ABOV Semiconductor – All rights reserved Korea
Regional Office, Seoul HQ, Ochang
R&D, Marketing & Sales R&D, QA, and Test Center 8th Fl., 330, Yeongdong-daero,
Gangnam-gu, Seoul, 06177, Korea
93, Gangni 1-gil, Ochang-eup, Cheongwon-gun,
Chungcheongbuk-do, 28126, Korea Tel: +82-2-2193-2200
Fax: +82-2-508-6903 www.abovsemi.com
Tel: +82-43-219-5200 Fax: +82-43-217-3534 www.abovsemi.com
Domestic Sales Manager Global Sales Manager China Sales Manager Tel: +82-2-2193-2206
Fax: +82-2-508-6903 Email: [email protected]
Tel: +82-2-2193-2281 Fax: +82-2-508-6903 Email: [email protected]
Tel: +86-755-8287-2205 Fax: +86-755-8287-2204 Email: [email protected]