Pi Zi Heng Embedded: ARM Cortex-M Files (2) - Link File (.icf)

Publisher:祝福的4号Latest update time:2019-12-18 Source: eefocusKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere


  At this point, a basic linker file is done. Isn’t it so easy?


Extra 1: Custom section


  For those who have read this far with patience, Pi Ziheng must give a big reward. The previous part is about how to deal with the system default segment, so is it possible to customize the segment in the code? Imagine that you have such a requirement, you need to open a 1KB updateable data area in your application, you want to specify this data area to the address range of 0x18000 - 0x183ff, you need to define a 4-byte read-only config block constant in the application to point to the first address of this updateable data area (this config block will only be updated by an external debugger or bootloader), how to do it?


// In the C file

/////////////////////////////////////////////////////

// Use the @ operator to specify the variable myConfigBlock[4] to be placed in the custom .myBuffer section

const uint8_t myConfigBlock[4] @ ".myBuffer" = {0x00, 0x01, 0x02, 0x03};


// Linker file

/////////////////////////////////////////////////////

// Customize the specified mySection_region and put .myBuffer into this region

define region mySection_region = mem:[from 0x0x18000 to 0x183ff];

place at start of mySection_region { readonly section .myBuffer };


  The above has achieved the goal of putting constants in the code into a custom segment? So how do you put functions in the code into a custom segment? Read on


// In the C file

/////////////////////////////////////////////////////

// Use #pragma location to specify the function myFunction() to be placed in the custom .myTask section

#pragma location = ".myTask"

void myFunction(void)

{

    __NOP();

}


// Linker file

/////////////////////////////////////////////////////

// Put .myTask into mySection_region

place in mySection_region { readonly section .myTask };


  It seems that the work is done. There is one last thing to note. If myConfigBlock is not referenced in the code, the IDE may ignore this variable when linking (IDE thinks it is useless, so it optimizes it). So how can I force the IDE to link myConfigBlock? IAR has left a backdoor. In the Keep symbols input box in options->Linker->Input tab, fill in the object name you want to force link (note that it is the object name in the code, not the custom segment name in the linker file).


Note: For more details about the extra content, please refer to the Pragma directives section in the IAR SystemsEmbedded Workbench xxxarmdocEWARM_DevelopmentGuide.ENU.pdf document in the IAR software installation directory.

[1] [2]
Keywords:ARM Reference address:Pi Zi Heng Embedded: ARM Cortex-M Files (2) - Link File (.icf)

Previous article:Boost download, installation, compilation, configuration and usage guide (including Windows, Linux and ARM Linux)
Next article:Pi Ziheng Embedded: ARM Cortex-M Core (5) - Instruction Set

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

arm-linux cross-compile ACE
The development of ACE for the data acquisition core of the main station has come to an end. Now I plan to get involved in the design of embedded Linux applications. As the saying goes, "If you want to do your work well, you must first sharpen your tools." ACE supports the arm series of embedded systems. Of course, I
[Microcontroller]
arm-linux cross-compile ACE
In-depth analysis of the design of a dental chair control system based on ARM embedded technology
1 Introduction At present, the market for high-end dental chair equipment is basically dominated by foreign companies. Generally, they are expensive and the technology is not transferable. As people pay more and more attention to oral health, it is particularly necessary to develop a high-end integrated oral diagnosis
[Microcontroller]
In-depth analysis of the design of a dental chair control system based on ARM embedded technology
What is the function of the clrex instruction in the linux kernel of the arm architecture?
1. The function of clrex instruction: "ARM Architecture Reference Manual" B2-1292 hereinafter referred to as ARM ARM Manual   The ClearExclusiveLocal() procedure takes as arguments the processor identifier processorid . The procedure clears the local record of processor processorid for which an address has had a r
[Microcontroller]
How to understand ARM exceptions, interrupts and vector tables
In the past, I have always been puzzled about what "ARM exceptions, interrupts and their vector tables" are, and how they are implemented. I didn't expect that today I came across the chapter on ARM exceptions, interrupts and their vector tables in (ARM System Developer's Guide: Designing and OpTImizing System Softwar
[Microcontroller]
How to understand ARM exceptions, interrupts and vector tables
ARM Exploration Tour | 1. Get to know the ARM Cortex-M camp
introduction 笔者接触嵌入式领域软件开发已近五年,几乎用的都是 ARM Cortex M 内核系列的微控制器。在这五年期间,感谢C语言编译器的存在,让我不用接触汇编即可进行开发,但是彷佛也错过了一些风景,没有领域到编译器之美和CPU之美,所以决定周末无聊的休息时间通过寻找资料、动手实验、得出结论的方法来探索 ARM CPU 架构的美妙,以及C语言编译器的奥秘。(因为我个人实在是不赞同学校中微机原理类课程的教学方法)。 一、ARM CPU Architecture The ARM CPU architecture is a family of reduced instruction set (RISC) archit
[Microcontroller]
ARM Exploration Tour | 1. Get to know the ARM Cortex-M camp
ARM(44b0) beginner summary (reprinted)
My development board is s3c44b0x, 2m NOR FLASH is in bank0, 8m sdram is in bank6. First, let's look at the problem we are going to solve. Some ARM chips have built-in RAM and FALSH. This allows the program to be run directly on the chip. The 44B0X chip only has a few K caches, and both ROM and RAM are external chips. O
[Microcontroller]
ARM assembly language learning notes (II) running a lamp program and .s file analysis
1. How to write assembly language We all know that C can be written in C and then compiled. What about assembly language? Assembly language is written in assembly language and then written as .s file. So we only need any editor that can write .s file, such as source insight, notepad, etc. 2. Write a test /*  * Turn
[Microcontroller]
ARM assembly language learning notes (II) running a lamp program and .s file analysis
Design of Speech Processing System Based on ARM7TDMI SoC
Introduction With the rapid development of microelectronics and computer technology, many embedded application systems have emerged. Among them, various voice processing systems have been continuously developed and widely used in various industries, such as voice station announcers, automatic interpretation de
[Microcontroller]
Design of Speech Processing System Based on ARM7TDMI SoC
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号