SoC
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
  • Arm Cortex M3
  • Contact
Reading: How to Correctly Configure Linker Options for Cortex-M23 in uVision5?
SUBSCRIBE
SoCSoC
Font ResizerAa
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
Search
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
Have an existing account? Sign In
Follow US
  • Looking for Something?
  • Privacy Policy
  • About Us
  • Sitemap
  • Contact Us
© S-O-C.ORG, All Rights Reserved.
Arm

How to Correctly Configure Linker Options for Cortex-M23 in uVision5?

Ryan Ryan
Last updated: September 17, 2023 9:37 am
Ryan Ryan 5 Min Read
Share
SHARE

Configuring the linker options correctly is crucial for building efficient and optimized applications for Cortex-M23 devices using uVision5. The linker is responsible for combining object files and libraries into the final executable. The linker options control memory layout, symbol resolution, regions for code and data, and more. Setting these options incorrectly can result in a non-functioning or bloated application binary.

Contents
Understanding Cortex-M23 Memory ArchitectureEssential Linker SettingsSpecify Target ProcessorSet Memory RegionsConfigure Memory PlacementSpecify Stack and HeapAdvanced Optimization OptionsSplit Code and DataGarbage CollectionInterwork CallsTail CallsLinker File TemplatesLinker ValidationConclusion

Understanding Cortex-M23 Memory Architecture

The Cortex-M23 processor has a Von Neumann architecture with unified address space for code and data. It has separate flash and SRAM memories connected over the AMBA 3 AHB-Lite bus. The on-chip flash is used for storing code and read-only data while SRAM stores writable data. The processor also has tightly coupled memory for high-performance access.

The linker needs to be configured to place code and read-only data in flash and writable data in SRAM. It also needs to take advantage of the tightly coupled memory for time-critical code and data. Keeping these architectural details in mind will help set up the linker optimally.

Essential Linker Settings

Specify Target Processor

The first step is to set the target processor to Cortex-M23 in the device manager. This will pre-configure some of the linker settings like memory regions and processor defines. Double check that the device variant matches the exact M23 chip being used.

Set Memory Regions

The linker needs to be told where to place code and data in the target memory map. The MEMORY section defines the start address, length, and attributes of each memory region. Flash and SRAM regions must be defined along with any tightly coupled memory. The attributes specify if the region is for code or data.

Configure Memory Placement

The linker now needs to know what content to place in which memory region. The SECTIONS directive controls this. Code and read-only data must go in flash while writable data goes in SRAM. Any performance-critical functions should be placed in tightly coupled memory.

Specify Stack and Heap

The stack and heap memory allocations need to be defined. The stack takes up memory from high addresses growing down while the heap grows up from lower addresses. Sufficient SRAM must be left for both based on application requirements. The heap can be omitted if dynamic allocation is not used.

Advanced Optimization Options

Split Code and Data

Splitting code and data into separate sections allows the linker to place them optimally. Function pointers also benefit since data sections can be relocated independently while code remains static.

Garbage Collection

Dead code removal or garbage collection strips unused code and data from the final binary. This minimizes application size at virtually no cost. Garbage collection should always be enabled.

Interwork Calls

This enables calls between ARM and Thumb code without overhead. Cortex-M23 only supports Thumb so this option is not needed.

Tail Calls

The compiler can optimize stack usage by converting tail call sequences to jumps. This also needs function and data sections split. Useful for stack-constrained designs.

Linker File Templates

uVision provides pre-configured linker files for each processor and toolchain. These contain all the necessary sections and options. They serve as a good starting point for customization. Verify the memory regions match the target device. Tweak placements and sizes as needed.

Linker Validation

Correct linker configuration must be validated before deployment. Memory use should be analyzed to catch overflows or fragmentation. Unused memory can be reduced. Code placement should be verified especially in tightly coupled memory. Fail to validate the linker settings and the application may not work as intended.

Conclusion

Configuring the linker properly is key to an efficient Cortex-M23 application with uVision5. The target processor and memory architecture guide what linker options are needed. Sections place code and data into the correct memories. Advanced optimizations reduce size and improve performance. Pre-configured templates provide robust default settings. Be sure to validate the memory use matches expectations after configuring the linker.

Newsletter Form (#3)

More ARM insights right in your inbox

 


Share This Article
Facebook Twitter Email Copy Link Print
Previous Article Best practices for Cortex-M1 MMI generation in Xilinx FPGAs
Next Article Alternatives to uVision5 for Developing Cortex-M23 Projects
Leave a comment Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

2k Followers Like
3k Followers Follow
10.1k Followers Pin
- Sponsored-
Ad image

You Might Also Like

What is the enhancement of the Cortex-M4 from the Cortex-M3?

The Cortex-M4 is an advancement over the earlier Cortex-M3 microcontroller…

7 Min Read

What are the advantages of using ARM Cortex-M microprocessors?

ARM Cortex-M microprocessors offer many advantages that make them a…

7 Min Read

Can I copy the vector table to SRAM, remap SRAM to 0x0, so interrupts fetch vectors from SRAM not flash?

Yes, it is possible to copy the vector table from…

5 Min Read

Arm Cortex M1 Architecture

The Arm Cortex M1 is a 32-bit reduced instruction set…

6 Min Read
SoCSoC
  • Looking for Something?
  • Privacy Policy
  • About Us
  • Sitemap
  • Contact Us
Welcome Back!

Sign in to your account