STM32开发 -- cannot open source input file "absacc.h" 解决方法

问题描述:

使用 keil MDK 5.24
代码里有包含头文件 absacc.h
也使用了相关功能 const uint8_t ver[32] __at (0x08002400) =”12345678V01.01”;

编译出现错误:cannot open source input file “absacc.h”: No such file or directory

解决方法:

找了个 keil MDK 4.74 (安装地址:C:\Keil\ARM\ARMCC\include)的 absacc.h 拷贝到 keil MDK 5.24(安装地址:C:\Keil_v5\ARM\ARMCC\include)里,问题解决。

下载:百度网盘 – absacc.h

原因:

keil MDK 5.24 版本里缺少 absacc.h

使用

参看: _attribute_((at(address))) variable attribute

attribute((at(address))) variable attribute
This variable attribute enables you to specify the absolute address of a variable.

Syntax

attribute((at(address)))
Where:
address
is the desired address of the variable.

Usage

The variable is placed in its own section, and the section containing the variable is given an appropriate type by the compiler:
Read-only variables are placed in a section of type RO.
Initialized read-write variables are placed in a section of type RW.
Variables explicitly initialized to zero are placed in:
A section of type ZI in RVCT 4.0 and later.
A section of type RW (not ZI) in RVCT 3.1 and earlier. Such variables are not candidates for the ZI-to-RW optimization of the compiler.
Uninitialized variables are placed in a section of type ZI.

Note

GNU compilers do not support this variable attribute.

Restrictions

The linker is not always able to place sections produced by the at variable attribute.
The compiler faults use of the at attribute when it is used on declarations with incomplete types.

Errors

The linker gives an error message if it is not possible to place a section at a specified address.

Example

const int x1 attribute((at(0x10000))) = 10; /* RO */
int x2 attribute((at(0x12000))) = 10; /* RW */
int x3 attribute((at(0x14000))) = 0; /* RVCT 3.1 and earlier: RW.
* RVCT 4.0 and later: ZI. */
int x4 attribute((at(0x16000))); /* ZI */

猜你喜欢

转载自blog.csdn.net/qq_29350001/article/details/80831070