SoC
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
  • Arm Cortex M3
  • Contact
Reading: Optimizing make_mmi_file.tcl Generation Time for Cortex-M1 Systems
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

Optimizing make_mmi_file.tcl Generation Time for Cortex-M1 Systems

David Moore
Last updated: September 17, 2023 9:30 am
David Moore 6 Min Read
Share
SHARE

Generating the make_mmi_file.tcl script is a key step in building applications for Cortex-M1 systems, but it can be time consuming. This article provides tips on optimizing the generation time so you can compile your projects faster.

Contents
Understanding make_mmi_file.tclTip 1: Structure Code LogicallyTip 2: Create a Skeletal Driver ModelTip 3: Limit Include Search PathsTip 4: Parse Code Modules IndividuallyTip 5: Limit Compiler WarningsTip 6: Use Multiple CPU CoresTip 7: Cache make_mmi_file.tclTip 8: Use make_mmi_file.tcl PreprocessingTip 9: Reduce Debug InformationTip 10: Upgrade to Latest mmi Version

Understanding make_mmi_file.tcl

The make_mmi_file.tcl script contains all the build rules and dependencies needed to compile your application. It is generated by the mmi tool based on your application code and the libraries/drivers you use. Some key points:

  • Created from your scatter loading file and source code
  • Contains rules to compile source files, link objects, locate libraries etc.
  • Tailored to your specific application’s needs
  • Can take a while to generate for large projects

Since it must analyze all your code, the generation time tends to increase with the size and complexity of your application. The tips below aim to streamline this process.

Tip 1: Structure Code Logically

How you structure your code can directly impact make_mmi_file.tcl generation. Some guidelines:

  • Split code into logical modules/folders based on functionality
  • Minimize inter-module dependencies; avoid cyclical dependencies
  • Include only the necessary headers in each source file
  • Use forward declarations instead of headers when possible

Logical structure helps the mmi tool parse and analyze the code more efficiently. Circular dependencies and unnecessary headers force it to process more interconnectivity between modules.

Tip 2: Create a Skeletal Driver Model

Many projects include drivers for microcontroller peripherals like GPIO, I2C, SPI etc. You can optimize generation time by creating a skeletal driver model:

  • Define the basic driver interface in a header file e.g. gpio_driver.h
  • Provide a minimal stub implementation to link against
  • Exclude stub from make_mmi_file.tcl generation
  • Provide full driver implementation separately

This avoids analyzing the complex driver internals during make_mmi_file.tcl generation. The stub implementation gets replaced during linking with the full driver. Saves processing time.

Tip 3: Limit Include Search Paths

The mmi tool searches all specified include paths to resolve header file dependencies. Limiting include paths accelerates this process:

  • Add only the minimal required external include paths
  • Avoid including unused folders from external libraries
  • Set header include paths relative to the module when possible

The fewer folders it has to search, the faster the generation step will be. Analyze your #include statements and trim unneeded search paths.

Tip 4: Parse Code Modules Individually

Large projects can be split into multiple make_mmi_file.tcl invocations:

  • Partition code into core app modules and optional modules
  • Generate separate make_mmi_file.tcl for core modules
  • Create additional make_mmi_file.tcl for optional modules
  • Merge/link all make_mmi_file.tcl later

This divides the generation processing across smaller code sets. The core make_mmi_file.tcl will build faster. Good for large, complex applications.

Tip 5: Limit Compiler Warnings

The mmi tool invocation enables all compiler warnings during parsing. Limiting warnings speeds up generation:

  • Fix/suppress warnings unrelated to interface or dependencies
  • Eliminate unused variable and function warnings
  • Use pragma directives to disable specific warnings

This reduces warnings the compiler must emit while analyzing the code during make_mmi_file.tcl creation. Streamlines the parsing step.

Tip 6: Use Multiple CPU Cores

Modern multi-core systems can utilize parallelization:

  • Use the -j option with mmi to specify number of threads
  • Set to number of CPU cores to maximize throughput
  • May require sufficient memory to support parallel threads

Generating make_mmi_file.tcl can leverage multiple cores due to its largely parallelizable steps. Enables faster generation on capable hardware.

Tip 7: Cache make_mmi_file.tcl

Regenerating make_mmi_file.tcl from scratch on each build is wasteful:

  • Cache previously generated make_mmi_file.tcl
  • Set cache validity period to force periodic regeneration
  • Only re-invoke mmi when source code changes

This avoids unnecessary regeneration when sources are unchanged. Saves significant time on incremental builds.

Tip 8: Use make_mmi_file.tcl Preprocessing

mmi supports preprocessing make_mmi_file.tcl generation:

  • Preprocess sources to generate .pp files
  • Invoke mmi on .pp files to create make_mmi_file.tcl
  • Only preprocess again when source code changes

Preprocessing is faster than full parsing. This accelerates make_mmi_file.tcl creation, especialy for large code bases.

Tip 9: Reduce Debug Information

Debug symbols bloat make_mmi_file.tcl generation time:

  • Omit debug symbols during make_mmi_file.tcl generation
  • Disable debug symbols on compiler command line
  • Enable symbols only during final application link stage

Parsing debug symbols significantly slows down make_mmi_file.tcl creation. Excluding them speeds up the process.

Tip 10: Upgrade to Latest mmi Version

Newer mmi releases include optimizations:

  • Faster dependency analysis algorithms
  • Better multi-threading and multi-core support
  • Caching and preprocessing capabilities
  • Up-to-date compiler integration

Upgrading can accelerate make_mmi_file.tcl build times, especially for large projects. Enable new generation features.

With some analysis and planning, make_mmi_file.tcl generation for Cortex-M1 systems can be optimized for faster build times. Try integrating some of the above tips into your workflow to reduce development delays.

Newsletter Form (#3)

More ARM insights right in your inbox

 


Share This Article
Facebook Twitter Email Copy Link Print
Previous Article Setting Stack Size and Heap Size in Cortex-M1 Vector Table
Next Article Troubleshooting errors when running make_mmi_file.tcl
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

64-bit data types and operations on ARM Cortex M3

The ARM Cortex M3 is a 32-bit processor, which means…

6 Min Read

What causes hard fault in arm cortex?

A hard fault on an ARM Cortex processor is an…

8 Min Read

How Unaligned Memory Access is Handled in ARM Cortex-M4

ARM Cortex-M4 microcontrollers have built-in support for unaligned memory access,…

7 Min Read

C Programming for Microcontrollers

Microcontrollers are small, low-power computers that are used to control…

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

Sign in to your account