1221 views|0 replies

71

Posts

0

Resources
The OP
 

RISC-V IDE MRS Usage Notes (IV): Link-time Optimization [Copy link]

Link-time optimization, or LTO (Link Time Optimization), is partially introduced as follows (for details, please refer to the GCC document on FLTO): When called with source code, it generates GIMPLE (one of GCC's internal representations) and writes it to a special ELF section in the object file. When object files are linked together, all function bodies are read from these ELF sections and instantiated as if they were part of the same translation unit. Multiple intermediate files are merged together by the linker and combined into a program to reduce the code size, so link-time optimization is an analysis of the entire program and cross-module optimization. At the same time, this requires that all parts involved in the link must have this parameter when compiling, otherwise errors may occur during linking.

The optimized entry when opening the link in the project properties page in MRS is as follows:

If you use this option in some projects in MRS and find that the code runs incorrectly, the possible reasons are as follows:

  1. The flto option has no effect on assembly files
  2. In order to prevent the problem of chip failure caused by enabling interrupts in the MCU code but not writing interrupt service functions, an interrupt service routine with in-place jump is declared in the assembly file. As a result, when this option is turned on, some programs use the in-place jump routine in the assembly instead of the interrupt service subroutine.
  3. The code itself is written incorrectly

Solution: Check the code writing method, ensure that the interrupts enabled in the program have C code level handlers, and delete the interrupt in-place jump program in the startup file (as shown in the figure below).

This post is from MCU
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list