我为Tricore控制器编写了一个C程序,编译后我得到了以下错误信息,实际上我无法搞清楚。你能提出一些意见吗?
我可以猜到它与内存层次结构有关,但仍无法找出实际问题。
Error Messages:
ltc I455: requirement: 193K (0x304c8) bytes of RAM area in space spe:tc:linear
amk E451: make stopped
ltc I456: section type: group restriction - clustered
ltc I457: .bss.Pro2.group (60) (0x30140 bytes)
ltc I457: .bss._dbg_request.libcs_fpu (418) (0x14 bytes)
ltc I457: .bss.Pro2.rocount (61) (0x2d4 bytes)
ltc I457: .bss.stdin_buf.libcs_fpu (273) (0x50 bytes)
ltc I457: .bss.stdout_buf.libcs_fpu (274) (0x50 bytes)
代码:
/*
============================================================================
Name : hough.c
Author :
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define M 4
#define N 4
#define PI 3.14159265
typedef struct point {
int x;
int y;
} point;
typedef struct points {
point points[M * N];
double ro;
int pointCount;
} points;
int image[M][N] = { { 1, 1, 0, 1 }, { 1, 1, 0, 1 }, { 1, 1, 1, 1 },
{ 1, 0, 0, 0 } };
int i, j, k;
points group[181][M * N / 2];
int rocount[181];
int compare_float(double f1, double f2) {
float precision = 0.000001;
if (((f1 - precision) < f2) && ((f1 + precision) > f2)) {
return 1;
} else {
return 0;
}
}
void insert(double ro, int x, int y, int angle) {
int loopcount;
int roflag = 0;
if (rocount[angle] == 0) {
group[angle][rocount[angle]].ro = ro;
group[angle][rocount[angle]].pointCount = 0;
group[angle][rocount[angle]].points[group[angle][rocount[angle]].pointCount].x =
x;
group[angle][rocount[angle]].points[group[angle][rocount[angle]].pointCount].y =
y;
group[angle][rocount[angle]].pointCount++;
rocount[angle]++;
} else {
for (loopcount = 0; loopcount < rocount[angle]; loopcount++) {
if (compare_float(group[angle][loopcount].ro, ro)) {
roflag = 1;
group[angle][loopcount].points[group[angle][loopcount].pointCount].x =
x;
group[angle][loopcount].points[group[angle][loopcount].pointCount].y =
y;
group[angle][loopcount].pointCount++;
break;
}
}
if (roflag == 0) {
group[angle][rocount[angle]].ro = ro;
group[angle][rocount[angle]].pointCount = 0;
group[angle][rocount[angle]].points[group[angle][rocount[angle]].pointCount].x =
x;
group[angle][rocount[angle]].points[group[angle][rocount[angle]].pointCount].y =
y;
group[angle][rocount[angle]].pointCount++;
rocount[angle]++;
}
}
}
int main(void) {
double ro;
point x1;
for (k = -90; k <= 90; k++) {
rocount[k + 90];
for (i = 0; i < M; i++) {
for (j = 0; j < N; j++) {
if (image[i][j] == 1) {
ro = (i + 1) * cos(k * (PI / 180))
+ (j + 1) * sin(k * (PI / 180));
insert(ro, i + 1, j + 1, k + 90);
}
}
}
}
for (k = -90; k <= 90; k++) {
for (i = 0; i < rocount[k + 90]; i++) {
printf("\n Angle :%d RO:%f \n", k, group[k + 90][i].ro);
for (j = 0; j < group[k + 90][i].pointCount; j++) {
printf("(x:%d,y:%d)", group[k + 90][i].points[j].x,
group[k + 90][i].points[j].y);
}
}
}
return EXIT_SUCCESS;
}
P.S:代码是为TC1797微控制器编写的。
答案 0 :(得分:1)
我不知道Tricore控制器,但看起来你已经超出了一些限制。我假设这个控制器的资源非常有限,构建过程会检查你没有超过它们。
requirement: 193K (0x304c8) bytes of RAM area in space spe:tc:linear
必须意味着你使用了193K的东西,这太多了
.bss.Pro2.group (60) (0x30140 bytes)
表示大部分来自BSS部分(即静态未初始化变量)。
我没有做数学,但points group[181][M * N / 2];
的大小可能是主要问题。