国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Table of Contents
What is a cmd file?
MEMORY and SECTION
Custom segment
Home Common Problem What is cmd file in Linux

What is cmd file in Linux

Mar 07, 2023 am 10:27 AM
linux cmd file

In Linux, the cmd file is the link command file, which stores the configuration information of the linker and can be referred to as the command file; the function of the cmd file is to indicate how to link the program. The cmd file consists of two parts: MEMORY and SECTIONS: MEMERY is used to define the name, starting address and length of each memory block; SECTIONS is mainly used to describe which segment is mapped to which segment of storage space.

What is cmd file in Linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What is a cmd file?

cmd files are linker command files (Linker Command Files), ending with the suffix .cmd.

The professional name of CMD is linker configuration file, which stores the configuration information of the linker. We call it command file for short. As can be seen from its name, the purpose of this file is to specify how to link the program.

Then we know that when writing a TI DSP program, the program can be divided into many segments, such as text, bss, etc., and each segment has a different role. When actually running in the film, the location is also different. For example, text code should generally be placed in flash, while bss variables should be placed in ram. etc. However, for different chips, the starting and ending addresses of each memory are different. Moreover, the linker does not know where in which memory the user wants to place a certain section, especially a custom section. In order to tell the linker the allocation of the internal storage space of the chip to be used and the specific storage location of each section of the program, it is necessary to write a configuration file, that is, a CMD file.

cmd file consists of two parts: MEMORY (ie: memory) and SECTIONS (ie: segments). MEMERY is used to define the name, starting address and length of each memory block. SECTIONS is mainly used to describe which segment is mapped to which segment of storage space. MEMORY can be divided into PAGE0 (program storage space) and PAGE1 (data storage space), PAGE (ie: frame).

The segments mentioned above can be divided into two categories: initialized segments and uninitialized segments. The initialized segment contains the actual instructions and data and is stored in the program memory space. The uninitialized segment only reserves the address space of the variable. The uninitialized segment does not have real content. Data is written to the variable during the running of the program and stored in the data storage space. In C language, there are many defined segments, such as ".text", ".const", and ".system". For these defined segments, there are many explanations about them on the Internet, so I will not go into details here. This article will next introduce readers to how to define segments by themselves as a user.

MEMORY and SECTION

Comments can be written in the cmd file, surrounded by "/*" and "*/", but "http://" is not allowed ", this is different from C language.

To write cmd files we need to use two pseudo-instructions MEMORY and SECTIONS (must be capitalized).

The syntax of MEMORY and SECTION can be found online. This article will explain the contents of MEMORY and SECTION with specific examples.

Explain MEMORY based on the cmd file of F28335 used by the author.

MEMORY
{
PAGE 0:    /* Program Memory */
           /* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE1 for data allocation */
 
   ZONE0       : origin = 0x004000, length = 0x001000     /* XINTF zone 0 */
   RAML0       : origin = 0x008000, length = 0x001000     /* on-chip RAM block L0 */
   RAML1       : origin = 0x009000, length = 0x001000     /* on-chip RAM block L1 */
   RAML2       : origin = 0x00A000, length = 0x001000     /* on-chip RAM block L2 */
   RAML3       : origin = 0x00B000, length = 0x001000     /* on-chip RAM block L3 */
   ZONE6       : origin = 0x0100000, length = 0x100000    /* XINTF zone 6 */ 
   ZONE7A      : origin = 0x0200000, length = 0x00FC00    /* XINTF zone 7 - program space */ 
   FLASHH      : origin = 0x300000, length = 0x008000     /* on-chip FLASH */
   FLASHG      : origin = 0x308000, length = 0x008000     /* on-chip FLASH */
   FLASHF      : origin = 0x310000, length = 0x008000     /* on-chip FLASH */
   FLASHE      : origin = 0x318000, length = 0x008000     /* on-chip FLASH */
   FLASHD      : origin = 0x320000, length = 0x008000     /* on-chip FLASH */
   FLASHC      : origin = 0x328000, length = 0x008000     /* on-chip FLASH */
   FLASHA      : origin = 0x338000, length = 0x007F80     /* on-chip FLASH */
   CSM_RSVD    : origin = 0x33FF80, length = 0x000076     /* Part of FLASHA.  Program with all 0x0000 when CSM is in use. */
   BEGIN       : origin = 0x33FFF6, length = 0x000002     /* Part of FLASHA.  Used for "boot to Flash" bootloader mode. */
   CSM_PWL     : origin = 0x33FFF8, length = 0x000008     /* Part of FLASHA.  CSM password locations in FLASHA */
   OTP         : origin = 0x380400, length = 0x000400     /* on-chip OTP */
   ADC_CAL     : origin = 0x380080, length = 0x000009     /* ADC_cal function in Reserved memory */
   
   IQTABLES    : origin = 0x3FE000, length = 0x000b50     /* IQ Math Tables in Boot ROM */
   IQTABLES2   : origin = 0x3FEB50, length = 0x00008c     /* IQ Math Tables in Boot ROM */  
   FPUTABLES   : origin = 0x3FEBDC, length = 0x0006A0     /* FPU Tables in Boot ROM */
   ROM         : origin = 0x3FF27C, length = 0x000D44     /* Boot ROM */        
   RESET       : origin = 0x3FFFC0, length = 0x000002     /* part of boot ROM  */
   VECTORS     : origin = 0x3FFFC2, length = 0x00003E     /* part of boot ROM  */
 
PAGE 1 :   /* Data Memory */
           /* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE0 for program allocation */
           /* Registers remain on PAGE1                                                  */
   
   BOOT_RSVD   : origin = 0x000000, length = 0x000050     /* Part of M0, BOOT rom will use this for stack */
   RAMM0       : origin = 0x000050, length = 0x0003B0     /* on-chip RAM block M0 */
   RAMM1       : origin = 0x000400, length = 0x000400     /* on-chip RAM block M1 */
   RAML4       : origin = 0x00C000, length = 0x001000     /* on-chip RAM block L1 */
   RAML5       : origin = 0x00D000, length = 0x001000     /* on-chip RAM block L1 */
   RAML6       : origin = 0x00E000, length = 0x001000     /* on-chip RAM block L1 */
   RAML7       : origin = 0x00F000, length = 0x001000     /* on-chip RAM block L1 */
   ZONE7B      : origin = 0x20FC00, length = 0x000400     /* XINTF zone 7 - data space */
   FLASHB      : origin = 0x330000, length = 0x008000     /* on-chip FLASH */
}

You can see that MEMORY usually contains PAGE0 and PAGE1. RAML0 in PAGE0 represents the storage space with a starting address of 0x008000 and a storage space length of 0x001000. In the same way, we can know the meanings of other storage space names.

Comparing the TI28335 chip data manual (only part of it is intercepted), we can see that the writing of the above cmd file is based on the memory mapping section of the TI28335 chip data manual. We can also refer to the memory mapping section in the chip data manual to write the cmd file.

What is cmd file in Linux

Next, the author will explain the content contained in SECTION. Also taking the cmd file of F28335 as an example

SECTIONS
{
 
   /* Allocate program areas: */
   .cinit              : > FLASHA      PAGE = 0
   .pinit              : > FLASHA,     PAGE = 0
   .text               : > FLASHA      PAGE = 0
   codestart           : > BEGIN       PAGE = 0
   ramfuncs            : LOAD = FLASHD, 
                         RUN = RAML0, 
                         LOAD_START(_RamfuncsLoadStart),
                         LOAD_END(_RamfuncsLoadEnd),
                         RUN_START(_RamfuncsRunStart),
                         LOAD_SIZE(_RamfuncsLoadSize),
                         PAGE = 0
 
   csmpasswds          : > CSM_PWL     PAGE = 0
   csm_rsvd            : > CSM_RSVD    PAGE = 0
   
   /* Allocate uninitalized data sections: */
   .stack              : > RAMM1       PAGE = 1
   .ebss               : > RAML4       PAGE = 1
   .esysmem            : > RAMM1       PAGE = 1
 
   /* Initalized sections go in Flash */
   /* For SDFlash to program these, they must be allocated to page 0 */
   .econst             : > FLASHA      PAGE = 0
   .switch             : > FLASHA      PAGE = 0      
 
   /* Allocate IQ math areas: */
   IQmath              : > FLASHC      PAGE = 0                  /* Math Code */
   IQmathTables     : > IQTABLES,  PAGE = 0, TYPE = NOLOAD 
   
   /* Uncomment the section below if calling the IQNexp() or IQexp()
      functions from the IQMath.lib library in order to utilize the 
      relevant IQ Math table in Boot ROM (This saves space and Boot ROM 
      is 1 wait-state). If this section is not uncommented, IQmathTables2
      will be loaded into other memory (SARAM, Flash, etc.) and will take
      up space, but 0 wait-state is possible.
   */
   /*
   IQmathTables2    : > IQTABLES2, PAGE = 0, TYPE = NOLOAD 
   {
   
              IQmath.lib<IQNexpTable.obj> (IQmathTablesRam)
   
   }
   */
   
   FPUmathTables    : > FPUTABLES, PAGE = 0, TYPE = NOLOAD 
         
   /* Allocate DMA-accessible RAM sections: */
   DMARAML4         : > RAML4,     PAGE = 1
   DMARAML5         : > RAML5,     PAGE = 1
   DMARAML6         : > RAML6,     PAGE = 1
   DMARAML7         : > RAML7,     PAGE = 1
   
   /* Allocate 0x400 of XINTF Zone 7 to storing data */
   ZONE7DATA        : > ZONE7B,    PAGE = 1
 
   /* .reset is a standard section used by the compiler.  It contains the */ 
   /* the address of the start of _c_int00 for C Code.   /*
   /* When using the boot ROM this section and the CPU vector */
   /* table is not needed.  Thus the default type is set here to  */
   /* DSECT  */ 
   .reset              : > RESET,      PAGE = 0, TYPE = DSECT
   vectors             : > VECTORS     PAGE = 0, TYPE = DSECT
   
   /* Allocate ADC_cal function (pre-programmed by factory into TI reserved memory) */
   .adc_cal     : load = ADC_CAL,   PAGE = 0, TYPE = NOLOAD
 
}

You can see that SECTION contains Various section names. Take ".text" as an example. ".text" is the binary instruction code segment generated after compilation. You can see that we allocate the content in ".text" to FLASHA for storage, and FLASHA is located at PAGE0 in MEMORY.

The ramfuncs in SECTION are related to the startup of 28335. Its essence is to read the user code from FLASH through the "bootstrap program" when powering on, save it in RAM and run it in RAM, thereby solving the problem of ROM The reading and writing speed is slow, and it is difficult to meet the problem of data loss due to high-speed smart chips and RAM power failure.

Custom segment

What use does knowing this information about the segment have for our users? The most direct use is that when the compiler prompts that the memory memory is insufficient, we can find the corresponding storage space through the corresponding segment name and modify the size of its storage space to meet the needs of our program. We can even store our code and data by customizing segment names.

Pass #pragma DATA_SECTION (function name or global variable name, "user-defined segment name in data space") or #pragma CODE_SECTION (function name or global variable name, "user-defined segment name in program space") Segment name") can implement customized segment names, thereby freely allocating storage space.

#pragma DATA_SECTION (for variables)

#pragma CODE_SECTION(用于函數(shù))

但使用以上指令時(shí)需注意:不能在函數(shù)體內(nèi)聲明必須在定義和使用前聲明,#pragma可以阻止對(duì)未調(diào)用的函數(shù)的優(yōu)化。

下面結(jié)合實(shí)際使用例子來具體講解:

#pragma DATA_SECTION(FFT_output, "FFT_buffer1");
float FFT_output[FFT_SIZE];

筆者聲明了一個(gè)數(shù)據(jù)段,段名為FFT_buffer1,段的內(nèi)容在變量FFT_ouput里。而聲明后才定義變量FFT_output的大小。

我們?nèi)绻胍褂眠@個(gè)自定義的段,接下來我們還要在CMD文件的SECTION中指定FFT_buffer1的存儲(chǔ)空間。

FFT_buffer1		: > RAML4,     PAGE = 1

通過以上幾條語句,筆者實(shí)現(xiàn)了將變量的內(nèi)容存放入指定的RAML4存儲(chǔ)空間的操作。

從上可以得出,當(dāng)全局變量所占內(nèi)存過大時(shí),我們可以通過自定義段選擇有所余裕的存儲(chǔ)空間的方式,從而來解決內(nèi)存不足的問題。

相關(guān)推薦:《Linux視頻教程

The above is the detailed content of What is cmd file in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Postman Integrated Application on CentOS Postman Integrated Application on CentOS May 19, 2025 pm 08:00 PM

Integrating Postman applications on CentOS can be achieved through a variety of methods. The following are the detailed steps and suggestions: Install Postman by downloading the installation package to download Postman's Linux version installation package: Visit Postman's official website and select the version suitable for Linux to download. Unzip the installation package: Use the following command to unzip the installation package to the specified directory, for example /opt: sudotar-xzfpostman-linux-x64-xx.xx.xx.tar.gz-C/opt Please note that "postman-linux-x64-xx.xx.xx.tar.gz" is replaced by the file name you actually downloaded. Create symbols

How to manually install plugin packages in VSCode How to manually install plugin packages in VSCode May 15, 2025 pm 09:33 PM

The steps to manually install the plug-in package in VSCode are: 1. Download the .vsix file of the plug-in; 2. Open VSCode and press Ctrl Shift P (Windows/Linux) or Cmd Shift P (Mac) to call up the command panel; 3. Enter and select Extensions:InstallfromVSIX..., then select .vsix file and install. Manually installing plug-ins provides a flexible way to install, especially when the network is restricted or the plug-in market is unavailable, but attention needs to be paid to file security and possible dependencies.

Detailed introduction to each directory of Linux and each directory (reprinted) Detailed introduction to each directory of Linux and each directory (reprinted) May 22, 2025 pm 07:54 PM

[Common Directory Description] Directory/bin stores binary executable files (ls, cat, mkdir, etc.), and common commands are generally here. /etc stores system management and configuration files/home stores all user files. The root directory of the user's home directory is the basis of the user's home directory. For example, the home directory of the user user is /home/user. You can use ~user to represent /usr to store system applications. The more important directory /usr/local Local system administrator software installation directory (install system-level applications). This is the largest directory, and almost all the applications and files to be used are in this directory. /usr/x11r6?Directory for storing x?window/usr/bin?Many

Where is the pycharm interpreter? Where is the pycharm interpreter? May 23, 2025 pm 10:09 PM

Setting the location of the interpreter in PyCharm can be achieved through the following steps: 1. Open PyCharm, click the "File" menu, and select "Settings" or "Preferences". 2. Find and click "Project:[Your Project Name]" and select "PythonInterpreter". 3. Click "AddInterpreter", select "SystemInterpreter", browse to the Python installation directory, select the Python executable file, and click "OK". When setting up the interpreter, you need to pay attention to path correctness, version compatibility and the use of the virtual environment to ensure the smooth operation of the project.

The difference between programming in Java and other languages ??Analysis of the advantages of cross-platform features of Java The difference between programming in Java and other languages ??Analysis of the advantages of cross-platform features of Java May 20, 2025 pm 08:21 PM

The main difference between Java and other programming languages ??is its cross-platform feature of "writing at once, running everywhere". 1. The syntax of Java is close to C, but it removes pointer operations that are prone to errors, making it suitable for large enterprise applications. 2. Compared with Python, Java has more advantages in performance and large-scale data processing. The cross-platform advantage of Java stems from the Java virtual machine (JVM), which can run the same bytecode on different platforms, simplifying development and deployment, but be careful to avoid using platform-specific APIs to maintain cross-platformity.

After installing Nginx, the configuration file path and initial settings After installing Nginx, the configuration file path and initial settings May 16, 2025 pm 10:54 PM

Understanding Nginx's configuration file path and initial settings is very important because it is the first step in optimizing and managing a web server. 1) The configuration file path is usually /etc/nginx/nginx.conf. The syntax can be found and tested using the nginx-t command. 2) The initial settings include global settings (such as user, worker_processes) and HTTP settings (such as include, log_format). These settings allow customization and extension according to requirements. Incorrect configuration may lead to performance issues and security vulnerabilities.

MySQL installation tutorial teach you step by step the detailed steps for installing and configuration of mySQL step by step MySQL installation tutorial teach you step by step the detailed steps for installing and configuration of mySQL step by step May 23, 2025 am 06:09 AM

The installation and configuration of MySQL can be completed through the following steps: 1. Download the installation package suitable for the operating system from the official website. 2. Run the installer, select the "Developer Default" option and set the root user password. 3. After installation, configure environment variables to ensure that the bin directory of MySQL is in PATH. 4. When creating a user, follow the principle of minimum permissions and set a strong password. 5. Adjust the innodb_buffer_pool_size and max_connections parameters when optimizing performance. 6. Back up the database regularly and optimize query statements to improve performance.

Comparison between Informix and MySQL on Linux Comparison between Informix and MySQL on Linux May 29, 2025 pm 11:21 PM

Informix and MySQL are both popular relational database management systems. They perform well in Linux environments and are widely used. The following is a comparison and analysis of the two on the Linux platform: Installing and configuring Informix: Deploying Informix on Linux requires downloading the corresponding installation files, and then completing the installation and configuration process according to the official documentation. MySQL: The installation process of MySQL is relatively simple, and can be easily installed through system package management tools (such as apt or yum), and there are a large number of tutorials and community support on the network for reference. Performance Informix: Informix has excellent performance and