Keil (MDK-ARM) series tutorial (IV)_Project target option configuration (II)

Publisher:Blissful444Latest update time:2019-09-17 Source: eefocusKeywords:Keil Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

II. C/C++ Options

Among the following five options, C/C++ is the most important, so some functions need to be emphasized. Looking at the option title "C/C++", it is mainly aimed at C/C++, which is similar to the next option "Asm".

No. 1: Preprocessor Symbols

The main thing here is to predefine functions, which is equivalent to #define xxxx in the program. I predefine STM32F10X_HD above, so there is no need to define it in the stm32f10x.h file.


Part 2: Language / Code Generation

Language/code Generation Language code generation can be understood as compiling, linking, and finally generating code. This part of the function is more important for code optimization. Beginners do not need to understand it too much, but those who have higher requirements for code size, running speed, etc. need to understand it in depth. 


Execute only Code: Generate only execution code;


[Set compiler command line: --execute_only]


Generate execution code only prevents the compiler from generating any data access code sections.


Optimize: Optimize options, there are four options from Level0 to Level3.


[Set compiler command line: -Onum]


For beginners and online debugging, it is recommended to use Level 0, that is, no optimization, so that the execution effect is the same as the code. If configured to Level 3, online debugging may optimize some places and fail to breakpoint.


Optimize for Time: Optimize time, that is, optimize the time-consuming parts of the code.


[Set compiler command line: -Otime] --split_sections


For example, some algorithms have a large amount of code and take a long time to run (for example, 2 seconds). If you check this function, you will find that the running time is significantly reduced (perhaps less than 1 second).


Split Load and Store Multiple: Load and store multiple splits.


[Set compiler command line: --split_ldm]


Non-aligned data is accessed multiple times. When more than 4 LMD/STM instructions are generated, the LMD and STM instructions are split to reduce the interrupt delay.


One ELF Section per Function: Optimize each function ELF segment (it is recommended to check both).


[Set compiler command line: --split_sections]


Each function will generate an ELF segment. Check this option to allow optimization of each ELF segment. This option can reduce potential shared addresses, data and strings between functions.


To put it simply: the code size ROM can be reduced (memory RAM will not be reduced).


For example, the storage size after compilation is compared before and after checking this option:


Before checking:


Program Size: Code=2540 RO-data=336 RW-data=40 ZI-data=1024


After checking:


Program Size: Code=908 RO-data=320 RW-data=40 ZI-data=1024


Strict ANSI C: Standard (strict) ANSC.


[Set compiler command line: --strict]


That is to say: during compilation, it is strictly checked according to the ANSI C standard.


Enum Container always int: Enumeration is always int type


[Set compiler command line: --enum_is_int]


It is easy to understand that the member variable type when we enumerate is int.


Plain Char is Signed: Plain Char is Signed.


[Set compiler command line: --signed_chars]


Code example: char a[] = "abcd"; that is, mark "abcd" as character type.


Read-Only Position Independent: Generates an independent code space for constants.


[Set compiler command line: --apcs=/ropi]


For example: we define font variables as constants, and checking this option will place these font variables in a separate code space.


Read-Write Position Independent: Generates an independent code space for readable and writable code.


[Set compiler command line: --apcs=/rwpi]


Warnings: Warnings


[No Warnings set compiler command line: -W]


No Warnings: There will be no warning prompts or outputs;


All Warnings: All warning prompts and outputs.


Thumb Mode: Thumb mode.


Specifies to set the file or folder (group) to Thumb mode.


[Note: This mode is the default in the project, which means it cannot be selected]


No Auto Includes: Do not automatically add header files (usually not checked).


If you do not check this option, the compiler will search for the .h files in your project in the Keil installation path.


For example: we define uint8_t in the stdint.h file, but there is usually no stdint.h file in our project directory. At this time, the compiler will look for the stdint.h file in the Keil path.


C99 Mode: C99 standard mode.


[Set compiler command line: --c99]


C speech has multiple versions of standards, such as C89, C90, C99, etc.


No. 3: Include Paths

The include path is a must-know item when using Keil (and similar) software. The include path specifies the location of the files used in our project so that the compiler can find the corresponding files. It is a must-know item for both beginners and advanced software engineers.


This option has been described in the previous article "Keil (MDK-ARM) Series Tutorial (I)_Detailed Process of Creating a New Software Project". It is relatively easy to understand and simple.

Section 4: Misc Controls

Specifies that there is no separate dialog control. For example, error messages are displayed in Japanese. [Not commonly used]


No. 5: Compiler control string

This is the name of the compiler execution, showing the current compiler command line instructions.


In the above "2nd place: Language code generation" there is a bracket [Set the compiler command line:]


The names inside are shown here.


III. Asm Option

From the layout and structure of this option, we can know that it is similar to the previous option "C/C++", but this one is for Asm. Therefore, this section will only briefly describe it without emphasizing it. You can refer to the previous section for comparison. The 3rd, 4th, and 5th are the same as the C/C++ option, so they are not described here.

No. 1: Conditional Assembly Control Symbols

Specify assembly conditions, which is similar to the preprocessing in the C/C++ options in the previous section.


Part 2: Language / Code Generation

Similar to the previous chapter.


Read-Only Position Independent: Generates an independent code space for constants.


Read-Write Position Independent: Generates an independent code space for readable and writable code.


Thumb Mode: Thumb mode.


Split Load and Store Multiple: Load and store multiple splits.


Execute only Code: Generate only execution code;


No Auto Includes: Do not automatically add header files (usually not checked).


IV. Linker Options

This option is Linker Link, which is the linker configuration option. You can modify, edit and view the linked files. The 1st and 2nd are the key points. The 3rd and 4th are the same as the C/C++ options, so they are not discussed here.

The first place: Use Memory Layout from Target Dialog to load the Target page of the dialog box using a scatter file (Use Memory Layout from Target Dialog)

Make RW Sections Position Independent: Make the RW segments independent.


[Set compiler command line: --rwpi]


When enabled: The variable area (including RW and ZI) has independent addresses.


When disabled: The variable area (including RW and ZI) is located at an absolute memory address.


Make RO Sections Position Independent: Make RO sections independent.


[Set compiler command line: --ropi]


When enabled: Constant and Code Region (RO) have separate addresses.


When disabled: Constants and code regions (RO) are located at absolute memory addresses.


Don't Search Standard Libraries: Do not search the standard library.


[Set compiler command line: --noscanlib]


Disables scanning of the default compiler runtime library.


Report 'might fail' Conditions as Errors: Report 'might fail' conditions as errors.


[Set compiler command line: --strict]


Conditions that could result in failure are reported as errors, not warnings.


X/O Base: X/O base address.


[Set compiler command line: --xo_base=address]


R/O Base: R/O base address.


[Set compiler command line: --ro_base=address]


R/W Base: R/W base address.


[Set compiler command line: --rw_base=address]


disable Warnings: Police warnings.


[Set compiler command line: --diag_suppress]


Part 2: Scatter File

Here you can load, view and edit scattered files. Click the three dots "..." at the back to load the file; click "Edit..." to view and edit the corresponding file.

V. Debug options

This option is more important, and is mainly used for (software simulation, hardware online) debugging. Since the configuration interface of software simulation and hardware online debugging is basically the same, and now we basically use hardware online debugging, therefore, only the hardware online debugging interface is selected for description.

Step 1: Select hardware online debugging

There is no need to say much about the choice of download debugger, mainly to talk about the "Setting" later. Many people often use J-Link to download debugger, and when debugging STM32, you can use the four-wire SWD mode. If you use J-Link for SWD debugging. At this time, you need to select the "SW" mode in "Setting", as follows:

Step 2: Select hardware online debugging

Load Application at Startup: Load the application at startup.


Run to main(): The program executes to the main() function.


When entering debug mode, the program automatically runs to the main function.


Initialization File: Load and edit initialization file.


This can be used in some cases, such as debugging code in RAM. You can refer to my article: STM32 internal RAM online debugging configuration method and detailed instructions (based on Keil development tools).


Part 3: Restore Debug Session Settings

Here, reset settings means to restore settings. If checked, click "Reset" to restore to the previous state. Including: breakpoints, watch windows, performance analyzer, memory window, toolbox, system viewer, etc.


No. 4: DLL file (best default)

The configuration here belongs to Keil's own configuration and it is best not to modify it.


CPU/Driver DLL - Parameter: CPU driver files and parameters.


Dialog DLL - Parameter: Dialog box DLL file and parameters.


Part 5: Managing component description files

Manage Component Viewer Description Files


There is generally no need to manage here.


VI. Utilities option

This chapter contains common options and is relatively simple.

[1] [2]
Keywords:Keil Reference address:Keil (MDK-ARM) series tutorial (IV)_Project target option configuration (II)

Previous article:Keil (MDK-ARM) series tutorial (three)_project target option configuration (I)
Next article:Keil (MDK-ARM) series tutorial (V)_Configuration (I)

Recommended ReadingLatest update time:2024-11-16 19:32

Silabs IDE Compiler Settings (Keil for C51)
Because Silabs IDE has its own compiler, but it is a 2K limited version of Keil for C51. If the program is slightly larger, it will not be able to proceed unless it is registered. Now let's explain how to configure the Keil compiler in Silabs IDE:        If the above dialog box appears when you compile, it means tha
[Microcontroller]
Silabs IDE Compiler Settings (Keil for C51)
The logic analysis provided by Keil is good
The software logic analyzer in Keil MDK has powerful functions, which can analyze digital signals, analog signals, CPU bus (UART, IIC and other output pins), and provide debugging function mechanism to generate custom signals, such as Sin, triangle wave, bath sound signal, etc., which can be defined.     Take the bu
[Microcontroller]
The logic analysis provided by Keil is good
How to embed assembly directly in KEIL C51
Details: How to embed assembly code directly in KEIL C51 Methods for embedding assembly code directly: 1. To embed assembly code in a C file, add the assembly code as follows: #pragma ASM ; Assembler Code Here #pragma ENDASM 2. In the Project window, right-click the C file containing the assembly code, select "
[Microcontroller]
Keil program debugging window
  In the previous lecture, we learned several commonly used program debugging methods. In this lecture, we will introduce the uses of various windows provided by Keil, such as the output window, observation window, memory window, disassembly window, serial window, etc., as well as how to use these windows, and introdu
[Microcontroller]
Create a new project using Keil uVision
For MCU programs, each functional program must have a supporting project, even a simple functional program like lighting up an LED is no exception. Therefore, we must first create a new project. After opening our Keil software, click: Project-- New uVision Project... Then a new project interface will appear, as shown
[Microcontroller]
Create a new project using Keil uVision
Keil (MDK-ARM) series tutorial (I)_Detailed process of creating a new software project
Ⅰ. Write in front This article uses the latest version (November 2016) of Keil (MDK-ARM) V5.21a development environment and takes the STM32 processor as an example to describe the detailed process of creating a new software project. Keil (MDK-ARM) V4 and V5 new software projects are basically the same, this article
[Microcontroller]
Keil (MDK-ARM) series tutorial (I)_Detailed process of creating a new software project
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号