2010-03-18 11:50:16 problem using unsigned short int variablen[76800];
Patrick Hotz (GERMANY)
Message: 87412
Hi,
new day, new problem ;-)
I want to use some variables (unsigned short int variablen[76800];) there is a problem with uClinux2008R1...
This is the output:
root:~> ./display
start
Going to reboot
Undefined instruction
- May be used to emulate instructions that are not defined for
a particular processor implementation.
Defered Exception context
CURRENT PROCESS:
COMM=display PID=354
TEXT = 0x00b20040-0x00b23500 DATA = 0x00b23510-0x00b23b10
BSS = 0x00b23b10-0x00b23d60 USER-STACK = 0x00b24edc
return address: [0x00aff45c]; contents of:
0x00aff430: cc33 cc33 cc33 cc33 cc33 cc33 cc33 cc33
0x00aff440: cc33 cc33 cc33 cc33 cc33 cc33 cc33 cc33
0x00aff450: cc33 cc33 cc33 cc33 cc33 cc33 [cc33] cc33
0x00aff460: cc33 cc33 cc33 cc33 cc33 cc33 cc33 cc33
SEQUENCER STATUS: Not tainted
SEQSTAT: 00062021 IPEND: 0030 SYSCFG: 0006
HWERRCAUSE: 0x18
EXCAUSE : 0x21
RETE: <0x00000000> /* Maybe null pointer? */
RETN: <0x00b80000> /* unknown address */
RETX: <0x00aff45c> /* unknown address */
RETS: <0x00b2015a> [ display + 0x11a ]
PC : <0x00aff45c> /* unknown address */
DCPLB_FAULT_ADDR: <0x00b7fffc> /* unknown address */
ICPLB_FAULT_ADDR: <0x00aff45c> /* unknown address */
PROCESSOR STATE:
R0 : 00000000 R1 : 00012bff R2 : 00000006 R3 : 00000000
R4 : 00b20140 R5 : 00000001 R6 : 00b23d3c R7 : 00000000
P0 : 00000004 P1 : 000257fe P2 : 00b24e7e P3 : 00b24ee0
P4 : 00b23b10 P5 : 00b23510 FP : 00b24e88 SP : 00b7ff24
LB0: 00b22605 LT0: 00b225f8 LC0: 00000000
LB1: 0196e27b LT1: 0196e274 LC1: 00000000
B0 : 00000000 L0 : 00000000 M0 : 00000000 I0 : 00b24df5
B1 : 00000000 L1 : 00000000 M1 : 00000000 I1 : 00ca1bd8
B2 : 00000000 L2 : 00000000 M2 : 00000000 I2 : 00000000
B3 : 00000000 L3 : 00000000 M3 : 00000000 I3 : 00000000
A0.w: 00000000 A0.x: 00000000 A1.w: 00000000 A1.x: 00000000
USP : 00ab4674 ASTAT: 02003004
Hardware Trace:
0 Target : <0x001037be> { _trap_c + 0x1e }
Source : <0x0010c14e> { _printk + 0x16 }
1 Target : <0x0010c14a> { _printk + 0x12 }
Source : <0x0010c000> { _vprintk + 0x1b8 }
2 Target : <0x0010bfe2> { _vprintk + 0x19a }
Source : <0x0010be30> { _wake_up_klogd + 0x24 }
3 Target : <0x0010be0c> { _wake_up_klogd + 0x0 }
Source : <0x0010c538> { _release_console_sem + 0x1f4 }
4 Target : <0x0010c52a> { _release_console_sem + 0x1e6 }
Source : <0x0010c51c> { _release_console_sem + 0x1d8 }
5 Target : <0x0010c512> { _release_console_sem + 0x1ce }
Source : <0x0010c504> { _release_console_sem + 0x1c0 }
6 Target : <0x0010c4e4> { _release_console_sem + 0x1a0 }
Source : <0x0010c3ca> { _release_console_sem + 0x86 }
7 Target : <0x0010c39a> { _release_console_sem + 0x56 }
Source : <0x0010c4c6> { _release_console_sem + 0x182 }
8 Target : <0x0010c4c0> { _release_console_sem + 0x17c }
Source : <0x0010bd06> { __call_console_drivers + 0x7e }
9 Target : <0x0010bd00> { __call_console_drivers + 0x78 }
Source : <0x0010bcc2> { __call_console_drivers + 0x3a }
10 Target : <0x0010bcb2> { __call_console_drivers + 0x2a }
Source : <0x0010bca2> { __call_console_drivers + 0x1a }
11 Target : <0x0010bc88> { __call_console_drivers + 0x0 }
Source : <0x0010c4bc> { _release_console_sem + 0x178 }
12 Target : <0x0010c4b2> { _release_console_sem + 0x16e }
Source : <0x0010c450> { _release_console_sem + 0x10c }
13 Target : <0x0010c44a> { _release_console_sem + 0x106 }
Source : <0x0010bc86> { ___call_console_drivers + 0x52 }
14 Target : <0x0010bc7a> { ___call_console_drivers + 0x46 }
Source : <0x001ae5ae> { _bfin_serial_console_write + 0x46 }
15 Target : <0x001ae5a8> { _bfin_serial_console_write + 0x40 }
Source : <0x001ae59a> { _bfin_serial_console_write + 0x32 }
Stack from 00b7ff04:
00b24ee0 ffa00870 0028262c 0028262c 00282624 00000000 00b20140 0194d454
00aff45c 00000030 00062021 00000000 00b80000 00aff45c 00aff45c 00b2015a
00000000 02003004 0196e27b 00b22605 0196e274 00b225f8 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00ca1bd8 00b24df5 00ab4674 00b24e88 00b23510 00b23b10
Call Trace:
Illegal instruction
root:~>
This is the code:
/*
* main.c
*
* Created on: 18.03.2010
* Author: photz
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdint.h>
int main()
{
printf("start\n");
unsigned short int bilddaten[76800];
unsigned short int bildtext[153600];
// unsigned char bildtext[153600];
int i;
int bilddatenpos;
for(i = 0; i < 76800; i++)
{
bilddaten[i] = 0x001f;
//printf("bilddaten[%05i] = %04x\n", i, bilddaten[i]);
}
i = 0;
bilddatenpos = 0;
while(i < 153600)
{
bildtext[i] = bilddaten[bilddatenpos] >> 8;
printf("bildtext[%06i] = %02x\n", i, bildtext[i]);
i++;
bildtext[i] = bilddaten[bilddatenpos] & 0xff;
printf("bildtext[%06i] = %02x\n", i, bildtext[i]);
i++;
bilddatenpos++;
}
printf("fertig\n");
exit(0);
}
If i reduce the sizes of the variables to "unsigned short int bilddaten[500];" and "unsigned short int bildtext[153600];" and also reduce the number of loops at the "for(...)" the program is running....
Does anyone have a idea?
Regards,
Patrick
TranslateQuoteReplyEditDelete
2010-03-18 11:59:43 Re: problem using unsigned short int variablen[76800];
Mike Frysinger (UNITED STATES)
Message: 87414
you're sticking that **** on the stack. are you sure you didnt just blow the **** out of it ? if you didnt use additional compiler flags, then the answer is "yes, yes you did".
please read the documentation:
docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:debugging_applications#stack_checking
QuoteReplyEditDelete
2010-03-18 23:21:31 Re: problem using unsigned short int variablen[76800];
Sonic Zhang (CHINA)
Message: 87434
Please avoid allocating big array on stack in NOMMU arch. Call malloc instead.
QuoteReplyEditDelete
2010-03-19 04:07:15 Re: problem using unsigned short int variablen[76800];
Patrick Hotz (GERMANY)
Message: 87473
Thanks for the informations,
my code is now running without problems.
Patrick