我是mbed和uvisor的新手,所以我的问题可能是关于理解事物是如何工作的。我有一块恩智浦FRDM-K64F板,我正在尝试学习mbed和uvisor。我已经成功地编译并运行了一些在不同机器上运行任务的基本示例。我正在尝试连接网络,uvisor中的一个盒子,但有些东西不能正常工作。
主文件代码如下:
#include "uvisor-lib/uvisor-lib.h"
#include "mbed.h"
#include "main-hw.h"
/* Create ACLs for main box. */
MAIN_ACL(g_main_acl);
/* Enable uVisor. */
UVISOR_SET_MODE_ACL(UVISOR_ENABLED, g_main_acl);
UVISOR_SET_PAGE_HEAP(8 * 1024, 5);
int main(void)
{
printf("----Eup---------\r\n");
DigitalOut led(MAIN_LED);
while (1) {
printf("taka\r\n");
led = !led;
/* Blink once per second. */
Thread::wait(1000);
}
return 0;
}这是box文件中的代码:
#include "uvisor-lib/uvisor-lib.h"
#include "mbed.h"
#include "main-hw.h"
#include "EthernetInterface.h"
// Network interface
EthernetInterface net;
struct box_context {
Thread * thread;
uint32_t heartbeat;
};
static const UvisorBoxAclItem acl[] = {
};
static void my_box_main(const void *);
/* Box configuration
* We need 1kB of stack both in the main and interrupt threads as both of them
* use printf. */
UVISOR_BOX_NAMESPACE(NULL);
UVISOR_BOX_HEAPSIZE(3072);
UVISOR_BOX_MAIN(my_box_main, osPriorityNormal, 1024);
UVISOR_BOX_CONFIG(my_box, acl, 1024, box_context);
static void my_box_main(const void *)
{
while (1) {
printf("tan tan\r\n");
Thread::wait(2000);
}
}我还没有添加具体的连接代码,只添加了EthernetInterface对象的定义,并且在编译时收到以下错误:
../../../../arm-none-eabi/bin/ld.exe: Region m_data_2 overflowed with stack and heap
collect2.exe: error: ld returned 1 exit status我已经尝试更改堆大小的值,但我还没有找到一种方法来使其工作。我遗漏了什么?
发布于 2017-02-10 00:41:15
在main框中,更改UVISOR_SET_PAGE_HEAP的值。
在主箱中使用UVISOR_SET_PAGE_HEAP(8 * 1024, 3),在安全箱中使用8K堆,在安全箱中使用UVISOR_BOX_STACK_SIZE堆栈大小,它会为我编译和链接(mbed OS5.3,K64F上的GCC ARM )。
https://stackoverflow.com/questions/42141709
复制相似问题