- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有谁知道如何处理以下问题:
我有一个 IAR 嵌入式工作台。该项目也使用 SDRAM 来运行它的代码和 Flash ROM。 SDRAM 的代码是从 SD 卡加载的。但是,在 SDRAM 中也存储了一些数据,如全局或静态变量。其中一些必须被初始化。初始化步骤,iar_data_init3
函数调用,在 low_level_init
之后功能。所以问题是为了初始化SDRAM中的一些变量,初始化函数是从iar_data_init3
调用的。 ,其代码在 SDRAM 内部。这是错误的,因为尚未完成从 SD 卡加载 SDRAM 代码。
我已经尝试过 C/C++ 开发指南中描述的手动初始化,但这没有帮助。
被调用的函数是 __sti__routine
,它提供变量的初始化。所有这些函数都是由 IAR 生成的。有什么方法可以告诉链接器将初始化函数放到 Flash ROM 中吗?
编辑 1:
以下是 C/C++ 的 IAR 手册中的信息。
这是如何使用手动初始化的示例。
在链接器配置文件中:
initialize manually { section MYSECTION };
#pragma section = "MYSECTION"
#pragma section = "MYSECTION_init"
void DoInit()
{
char * from = __section_begin("MYSECTION_init");
char * to = __section_begin("MYSECTION");
memcpy(to, from, __section_size("MYSECTION"));
}
SomeClass myclass;
最佳答案
您可以通过使用 pragma
来指定变量和函数的位置。预处理器指令。您将需要使用预定义部分之一或定义您自己的部分。
你没有提到你正在使用的 IAR 的具体风格。以下来自Renesas IAR Compiler Reference Guide但是您应该检查正确的引用指南以确保语法完全相同并了解预定义的部分是什么。
Use the
@
operator or the#pragma
location directive to place groups of functions or global and static variables in named segments, without having explicit control of each object. The variables must be declared either__no_init
orconst
. The segments can, for example, be placed in specific areas of memory, or initialized or copied in controlled ways using the segment begin and end operators. This is also useful if you want an interface between separately linked units, for example an application project and a boot loader project. Use named segments when absolute control over the placement of individual variables is not needed, or not useful.Examples of placing functions in named segments
void f(void) @ "FUNCTIONS";
void g(void) @ "FUNCTIONS"
{
}
#pragma location="FUNCTIONS"
void h(void);To override the default segment allocation, you can explicitly specify a memory attribute other than the default:
__code32 void f(void) @ "FUNCTIONS";
generic_cortex.icf
的链接器文件。定义您的内存区域。在它应该有一些类似于以下的说明:
/* Define the addressable memory */
define memory Mem with size = 4G;
/* Define a region named SDCARD with start address 0xA0000000 and to be 256 Mbytes large */
define region SDCARD = Mem:[from 0xA0000000 size 0xFFFFFFF ];
/* Define a region named SDRAM with start address 0xB0000000 and to be 256 Mbytes large */
define region SDRAM = Mem:[from 0xB0000000 size 0xFFFFFFF ];
/* Place sections named MyCardStuff in the SDCARD region */
place in SDCARD {section MyCardStuff };
/* Place sections named MyRAMStuff in the SDRAM region */
place in SDRAM {section MyRAMStuff };
/* Override default copy initialization for named section */
initialize manually { section MyRAMStuff };
define memory
定义地址空间:
The maximum size of possible addressable memories
The
define memory
directive defines a memory space with a given size, which is the maximum possible amount of addressable memory, not necessarily physically available.
define region
:
Available physical memory
The
define region
directive defines a region in the available memories in which specific sections of application code and sections of application data can be placed.
region
放置命名
section
与
place in
:
Placing sections in regions
The
place at
andplace into
directives place sets of sections with similar attributes into previously defined regions.
initialize manually
覆盖它的部分初始化:
Initializing the application
The directives
initialize
anddo not initialize
control how the application should be started. With these directives, the application can initialize global symbols at startup, and copy pieces of code.
manually
.
SomeClass myClass @ "MyCardStuff";
#pragma section = "MyCardStuff"
#pragma section = "MySDRAMStuff"
void DoInit()
{
/* Copy your code and variables from your SD Card into SDRAM */
char * from = __section_begin("MyCardStuff");
char * to = __section_begin("MySDRAMStuff");
memcpy(to, from, __section_size("MySDRAMStuff"));
/* Initialize your variables */
myClass.init();
}
--log initialization
选项并研究日志和 map 文件以确保您获得所需的内容。
关于embedded - IAR 初始化函数放置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13756058/
语句 1: [2,4,6,7,8].each do |i| (i % 2 == 0) || (puts "Not even" && break) puts i end 声明 2: [2
我有一张正在显示的卡片,上面有一些信息。我想将其包装在SingleChildScrollView中,因为我还有更多项目要添加到卡中,但是当我这样做时,屏幕只是空白吗?我曾尝试将其作为根(脚手架主体)放
我有一个带有窗体的 View ,该窗体显示ViewModel中ObservableCollection中对象的数据。 ObservableCollection使我可以浏览数据。 ObservableC
如何将时间戳附加文件名放在HDFS中? hadoop fs -put topic_2018-12-15%2016:31:15.csv /user/file_structure/ 最佳答案 您只是在运行
我正在寻求一些帮助,以找出为什么以下叠加函数的运行时间会随着每次连续运行而增加。 据我所知,如果缓冲区中的文本保持不变,则运行时间应该是相同的——即,仅向左/向右移动光标应该不会增加运行时间(但它确实
我有一个事件指示器,它显示在中间。如何将其放置在 View 的左上角? var activityIndicator = UIActivityIndicatorView() func show() {
首先,我想提前感谢所有回答这个问题的人。非常感谢您的帮助。这是我第一次在这里发帖,所以如果我发帖不礼貌,请原谅我。 我的问题是关于方法原型(prototype)的: void copySubtree(
我正在开发一个应该是通用的应用程序,一个适用于 iPad 和 iPhone 的应用程序。我想让他们的界面尽可能相似。在 iPhone 应用程序中,我使用的是选项卡栏 Controller ,其中一个选
我目前正在使用 JS 开发 REST API,但遇到以下问题:该代码有效,但如果我尝试删除、放置或修补不存在的条目,它不会返回错误,但会打印成功消息。这是为什么?获取路由完美运行。 app.route
.a{ width:500px; height:500px; background:yellow; border: 3px dashed black; }
首先,请引用下图: 这基本上是我对布局的想法。 我想要的是: 内容 div 成为“主要焦点”,例如当浏览器 调整大小,它应该留在中间; 当浏览器被调整大小时,我希望这两个图像基本上 位于内容 div
我的应用程序需要使用内存映射并发访问数据文件。我的目标是使其在共享内存系统中可扩展。研究了内存映射文件库实现的源码,想不通: 在多个线程中从 MappedByteBuffer 中读取是否合法? get
我有一个 JDesktopPane 并希望以网格样式显示 JInternalFrames 而无需覆盖框架。框架的尺寸会有所不同,因此应动态分配它们的位置。我可以存储最后放置的框架的坐标,但可以移动、最
根据https://isocpp.org/wiki/faq/dtors#placement-new传递给placement-new的地址必须正确对齐。但它给出的例子似乎与此相矛盾。 char memo
我最近一直在查看 Illumos 源代码,发现了一些奇怪的东西。 在他们的源代码中,函数类型是这样写的: static int outdec64(unsigned char *out, unsigne
您好,我目前正在尝试在我的一张图片旁边放置一个图例,但我在放置时遇到了问题。 我想将图例放在图像的左侧或右侧。这是我当前的代码: .my-legend .legend-title { text-a
根据文档, print 之间的唯一区别和 say 似乎是后者添加了 "\n"(并使用 .gist 进行字符串化)。然而, perl6 -e 'print "del\b\b"' 打印“d”,有效地应用转
所以我试图将我的图像标志放在背景上,但我的背景突然被裁剪,出现了一半的黑屏。如图: 我的 main.dart 代码: import 'package:flutter/material.dart'; i
我正在使用 Azure DevOps 构建 python 轮。我想让它尽可能通用,以便团队中的每个人都可以使用相同的管道来构建自己的 python 轮并将它们部署在一些 databricks 工作区中
在构建标准(非 WordPress)网页时,我通常会在正文末尾之前加载所有 javascript 文件,然后包含页面特定 js 代码的部分。 WorPress 建议使用 wp_enqueue_scri
我是一名优秀的程序员,十分优秀!