public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] eCos Array memory size
@ 2008-10-02  6:48 Yong Chen Tan
  2008-10-02  6:55 ` Andrew Lunn
  0 siblings, 1 reply; 10+ messages in thread
From: Yong Chen Tan @ 2008-10-02  6:48 UTC (permalink / raw)
  To: ecos-discuss



Hi, I am currently developing a RFID application with eCos using AT91RM9200 processor. I meet with some problems when I am trying to capture all the incoming bits from RFID tag response.

I actually declared an array int raw_data[2238]. Is it too big for an array? When I am capturing such a big response, my RFID application hangs. I got no problems capturing the bits reponse with a smaller raw_data value. (Eg, raw_data[500]) May I know what is the maximum memory allocated for an int array? Is there any way to expand this memory? Thanks

Cheers
Tan Yong Chen

_________________________________________________________________
Easily edit your photos like a pro with Photo Gallery.
http://get.live.com/photogallery/overview

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS] eCos Array memory size
  2008-10-02  6:48 [ECOS] eCos Array memory size Yong Chen Tan
@ 2008-10-02  6:55 ` Andrew Lunn
  2008-10-02  6:58   ` [ECOS] FW: " Yong Chen Tan
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Lunn @ 2008-10-02  6:55 UTC (permalink / raw)
  To: Yong Chen Tan; +Cc: ecos-discuss

On Thu, Oct 02, 2008 at 06:47:20AM +0000, Yong Chen Tan wrote:
> 
> 
> Hi, I am currently developing a RFID application with eCos using AT91RM9200 processor. I meet with some problems when I am trying to capture all the incoming bits from RFID tag response.
> 
> I actually declared an array int raw_data[2238]. Is it too big for an array? When I am capturing such a big response, my RFID application hangs. I got no problems capturing the bits reponse with a smaller raw_data value. (Eg, raw_data[500]) May I know what is the maximum memory allocated for an int array? Is there any way to expand this memory? Thanks

Where in memory is this array? Is it static allocated? Allocated by
malloc? On the stack?

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ECOS] FW: [ECOS] eCos Array memory size
  2008-10-02  6:55 ` Andrew Lunn
@ 2008-10-02  6:58   ` Yong Chen Tan
  2008-10-02  7:02     ` Andrew Lunn
  0 siblings, 1 reply; 10+ messages in thread
From: Yong Chen Tan @ 2008-10-02  6:58 UTC (permalink / raw)
  To: ecos-discuss





> Date: Thu, 2 Oct 2008 08:54:47 +0200
> From: andrew@lunn.ch
> To: oricon776@hotmail.com
> CC: ecos-discuss@ecos.sourceware.org
> Subject: Re: [ECOS] eCos Array memory size
>
> On Thu, Oct 02, 2008 at 06:47:20AM +0000, Yong Chen Tan wrote:
>>
>>
>> Hi, I am currently developing a RFID application with eCos using AT91RM9200 processor. I meet with some problems when I am trying to capture all the incoming bits from RFID tag response.
>>
>> I actually declared an array int raw_data[2238]. Is it too big for an array? When I am capturing such a big response, my RFID application hangs. I got no problems capturing the bits reponse with a smaller raw_data value. (Eg, raw_data[500]) May I know what is the maximum memory allocated for an int array? Is there any way to expand this memory? Thanks
>
> Where in memory is this array? Is it static allocated? Allocated by
> malloc? On the stack?
>
> Andrew
ecos-discuss@ecos.sourceware.org


Hi, I code this application using C. I am not sure where it is being allocated. Is there a way to check it?





_________________________________________________________________
Get in touch with your inner athlete. Take the quiz.
http://yourinnerathlete.windowslive.com?locale=en-sg&ocid=TXT_TAGLM_WLYIA_takequiz_sg

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS] FW: [ECOS] eCos Array memory size
  2008-10-02  6:58   ` [ECOS] FW: " Yong Chen Tan
@ 2008-10-02  7:02     ` Andrew Lunn
  2008-10-02  7:22       ` [ECOS] FW: " Yong Chen Tan
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Lunn @ 2008-10-02  7:02 UTC (permalink / raw)
  To: Yong Chen Tan; +Cc: ecos-discuss

> Hi, I code this application using C. I am not sure where it is being
> allocated. Is there a way to check it?

Since it is in C, you are allocating it and you have control over
it. How are you allocating it?  Since you don't seem to understand C,
maybe you can post some of your code?

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ECOS] FW: [ECOS] FW: [ECOS] eCos Array memory size
  2008-10-02  7:02     ` Andrew Lunn
@ 2008-10-02  7:22       ` Yong Chen Tan
  2008-10-02  7:52         ` Andrew Lunn
  0 siblings, 1 reply; 10+ messages in thread
From: Yong Chen Tan @ 2008-10-02  7:22 UTC (permalink / raw)
  To: ecos-discuss





> Date: Thu, 2 Oct 2008 09:01:34 +0200
> From: andrew@lunn.ch
> To: oricon776@hotmail.com
> CC: ecos-discuss@ecos.sourceware.org
> Subject: Re: [ECOS] FW: [ECOS] eCos Array memory size
>
>> Hi, I code this application using C. I am not sure where it is being
>> allocated. Is there a way to check it?
>
> Since it is in C, you are allocating it and you have control over
> it. How are you allocating it? Since you don't seem to understand C,
> maybe you can post some of your code?
>
> Andrew
>
> --
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>

Basically my code is to declare a raw_data[2238] arrary and pass it to receive_response_14443a_readall function.
In this function, I will read all the incoming response from the RFID tag.

In my other functions, I also used the similar approach but with a smaller raw_data value of raw_data[500] to get the response value and it works.

Below are the codes:

void Read_all_14443a_type1(cyg_uint32 uid0, cyg_uint32 uid1, cyg_uint32 uid2, cyg_uint32 uid3) {
	
	cyg_uint32 request[9];
	cyg_uint32 binary[71]; 
	cyg_uint32 symbol[89]; 
	cyg_uint32 processed_data[124];
	cyg_uint32 CRC;
	int i,parity_check,byteValue;
	int responseFlag=0;
	int raw_data [2238]; 
	.
	. 
	.
                responseFlag=receive_response_14443a_readall(raw_data,1,0,500);

int receive_response_14443a_readall(int *raw_data, int loopvalue, int delay, int listen) {

	cyg_uint32 readDOUT, readDSYNC;
	readDOUT=0x00;
	int timeout = 0;
	int i,j;
	int k=0;
	int responseFlag=0;
	int count=0;
	delay_us(15);
	.
	. 
	.
	do{
		HAL_READ_UINT32(AT91_PIOC+AT91_PIO_PDSR,readDSYNC);
		readDSYNC= readDSYNC & 0x8;
	}
	while(readDSYNC ==0x8);
				
	HAL_READ_UINT32(AT91_PIOC+AT91_PIO_PDSR,readDOUT);
	readDOUT= readDOUT & 0x40;	
				
	if(readDOUT == 0){
		k++;
		*raw_data=0;
	}
	else
		*raw_data=1;
	
	delay_us(3);
	count++;
	raw_data++;	

Thanks for helping...	
_________________________________________________________________
Join the Fantasy Football club and win cash prizes here!
http://fantasyfootball.sg.msn.com

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS] FW: [ECOS] FW: [ECOS] eCos Array memory size
  2008-10-02  7:22       ` [ECOS] FW: " Yong Chen Tan
@ 2008-10-02  7:52         ` Andrew Lunn
  2008-10-02  7:59           ` [ECOS] FW: " Yong Chen Tan
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Lunn @ 2008-10-02  7:52 UTC (permalink / raw)
  To: Yong Chen Tan; +Cc: ecos-discuss

> void Read_all_14443a_type1(cyg_uint32 uid0, cyg_uint32 uid1, cyg_uint32 uid2, cyg_uint32 uid3) {
> 	
> 	cyg_uint32 request[9];
> 	cyg_uint32 binary[71]; 
> 	cyg_uint32 symbol[89]; 
> 	cyg_uint32 processed_data[124];
> 	cyg_uint32 CRC;
> 	int i,parity_check,byteValue;
> 	int responseFlag=0;
> 	int raw_data [2238]; 
> 	.

So it is on the stack. When you create the thread which is running
this code, how big a stack do you allocate?

void cyg_thread_create(cyg_addrword_t sched_info, 
                       cyg_thread_entry_t* entry, 
                       cyg_addrword_t entry_data, 
                       char* name, void* stack_base,
                       cyg_ucount32 stack_size, 
                       cyg_handle_t* handle, 
                       cyg_thread* thread);

You need to have sufficient space on the stack for this variable, all
your other variables, and everything else that you put on the stack.

Maybe putting it on the stack is the wrong way to do this. Maybe it
should be a static variable? It is then not on the stack, it is in the
BSS. Or allocate it with malloc() so that it is on the heap.

     Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ECOS] FW: [ECOS] FW: [ECOS] FW: [ECOS] eCos Array memory size
  2008-10-02  7:52         ` Andrew Lunn
@ 2008-10-02  7:59           ` Yong Chen Tan
  2008-10-02  8:06             ` Andrew Lunn
  0 siblings, 1 reply; 10+ messages in thread
From: Yong Chen Tan @ 2008-10-02  7:59 UTC (permalink / raw)
  To: ecos-discuss





> Date: Thu, 2 Oct 2008 09:51:23 +0200
> From: andrew@lunn.ch
> To: oricon776@hotmail.com
> CC: ecos-discuss@ecos.sourceware.org
> Subject: Re: [ECOS] FW: [ECOS] FW: [ECOS] eCos Array memory size
>
>> void Read_all_14443a_type1(cyg_uint32 uid0, cyg_uint32 uid1, cyg_uint32 uid2, cyg_uint32 uid3) {
>>
>> cyg_uint32 request[9];
>> cyg_uint32 binary[71];
>> cyg_uint32 symbol[89];
>> cyg_uint32 processed_data[124];
>> cyg_uint32 CRC;
>> int i,parity_check,byteValue;
>> int responseFlag=0;
>> int raw_data [2238];
>> .
>
> So it is on the stack. When you create the thread which is running
> this code, how big a stack do you allocate?
>
> void cyg_thread_create(cyg_addrword_t sched_info,
> cyg_thread_entry_t* entry,
> cyg_addrword_t entry_data,
> char* name, void* stack_base,
> cyg_ucount32 stack_size,
> cyg_handle_t* handle,
> cyg_thread* thread);
>
> You need to have sufficient space on the stack for this variable, all
> your other variables, and everything else that you put on the stack.
>
> Maybe putting it on the stack is the wrong way to do this. Maybe it
> should be a static variable? It is then not on the stack, it is in the
> BSS. Or allocate it with malloc() so that it is on the heap.
>
> Andrew
>
> --
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>

Hi, my stack size is defined to be 4096 bytes. Seems like it is not enough for the application. 
Sorry, I am not very sure on how to declare it as a static variable. Do you have any reference on how to declare it? I have bought the Embedded Software Development with eCos. Does it mention in the book?
_________________________________________________________________
Join the Fantasy Football club and win cash prizes here!
http://fantasyfootball.sg.msn.com

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS] FW: [ECOS] FW: [ECOS] FW: [ECOS] eCos Array memory size
  2008-10-02  7:59           ` [ECOS] FW: " Yong Chen Tan
@ 2008-10-02  8:06             ` Andrew Lunn
  2008-10-03  4:19               ` [ECOS] FW: " Yong Chen Tan
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Lunn @ 2008-10-02  8:06 UTC (permalink / raw)
  To: Yong Chen Tan; +Cc: ecos-discuss

> Sorry, I am not very sure on how to declare it as a static
> variable. Do you have any reference on how to declare it? I have
> bought the Embedded Software Development with eCos. Does it mention
> in the book?

What you need is a book about C in general. 

     Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ECOS] FW: [ECOS] FW: [ECOS] FW: [ECOS] FW: [ECOS] eCos Array memory size
  2008-10-02  8:06             ` Andrew Lunn
@ 2008-10-03  4:19               ` Yong Chen Tan
  2008-10-03  5:29                 ` Andrew Lunn
  0 siblings, 1 reply; 10+ messages in thread
From: Yong Chen Tan @ 2008-10-03  4:19 UTC (permalink / raw)
  To: ecos-discuss





> Date: Thu, 2 Oct 2008 10:05:43 +0200
> From: andrew@lunn.ch
> To: oricon776@hotmail.com
> CC: ecos-discuss@ecos.sourceware.org
> Subject: Re: [ECOS] FW: [ECOS] FW: [ECOS] FW: [ECOS] eCos Array memory size
>
>> Sorry, I am not very sure on how to declare it as a static
>> variable. Do you have any reference on how to declare it? I have
>> bought the Embedded Software Development with eCos. Does it mention
>> in the book?
>
> What you need is a book about C in general.
>
> Andrew
>
> --
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>
Hi, I have replaced the array using malloc() and I have free them after I finished using. However after sometime, the application still hangs. What could be the problem? 
_________________________________________________________________
Easily publish your photos to your Spaces with Photo Gallery.
http://get.live.com/photogallery/overview

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS] FW: [ECOS] FW: [ECOS] FW: [ECOS] FW: [ECOS] eCos Array  memory size
  2008-10-03  4:19               ` [ECOS] FW: " Yong Chen Tan
@ 2008-10-03  5:29                 ` Andrew Lunn
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Lunn @ 2008-10-03  5:29 UTC (permalink / raw)
  To: Yong Chen Tan; +Cc: ecos-discuss

> Hi, I have replaced the array using malloc() and I have free them
> after I finished using. However after sometime, the application
> still hangs. What could be the problem?

I get the impression you are a very new C programmer. What i suggest
you do is find somebody who can mentor you. It needs to be somebody
who is close by and has a lot of experience with C and some experience
with embedded systems. 

     Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-10-03  5:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-02  6:48 [ECOS] eCos Array memory size Yong Chen Tan
2008-10-02  6:55 ` Andrew Lunn
2008-10-02  6:58   ` [ECOS] FW: " Yong Chen Tan
2008-10-02  7:02     ` Andrew Lunn
2008-10-02  7:22       ` [ECOS] FW: " Yong Chen Tan
2008-10-02  7:52         ` Andrew Lunn
2008-10-02  7:59           ` [ECOS] FW: " Yong Chen Tan
2008-10-02  8:06             ` Andrew Lunn
2008-10-03  4:19               ` [ECOS] FW: " Yong Chen Tan
2008-10-03  5:29                 ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).