M52235EVB ColdFire Lite with Web Server RTOS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

M52235EVB ColdFire Lite with Web Server RTOS

1,736 Views
JaimeR
Contributor III

Hi to everygone.

 

  I am using Coldfire lite with web server code that comes with the evaluation board for M52235EVB.

  I am using the operating system to work with ethernet. Server works fine until I add a few more   tasks. I add simple tasks that blink the leds and this is the message that appears into hyperterminal:

 

Copyright 1997-2006 by InterNiche Technologies. All rights reserved.
calloc1 failed: size: 225, failures: 1
Access Error -- PC = 0x0000B1F6
Attempted write to write-protected space
Access Error -- PC = 0x0000B1F6
Attempted write to write-protected space
Access Error -- PC = 0x0000B1F6
Attempted write to write-protected space
Access Error -- PC = 0x0000B1F6
Attempted write to write-protecte

 

 The problem appears as soon as I add 1600 (4 Tasks with 400 stack size each). 

I would like to know:

1.- Why is this message appearing?

2.- How to get the stack size for an specific task?

3.- If the application is crashing with this simple tasks, will it be enought memory when I add more complex tasks(USB, CAN, Main application)?

4.-What would be the maximum stack size that I can use for an specific task?

5.-Is there a restriction for the stack size that I can use for ALL the tasks?

 

Thank you in advanced for any help since I am new to the RTOS and the coldfire architecture.

 

Jaime

Labels (1)
0 Kudos
3 Replies

351 Views
bkatt
Contributor IV

Jaime R wrote:

 

1.- Why is this message appearing?

2.- How to get the stack size for an specific task?

3.- If the application is crashing with this simple tasks, will it be enought memory when I add more complex tasks(USB, CAN, Main application)?

4.-What would be the maximum stack size that I can use for an specific task?

5.-Is there a restriction for the stack size that I can use for ALL the tasks?

 


1. there is not enough RAM memory to satisfy an allocation request for 225 bytes.

2. the tk command shows the tasks with their maximum and used stack sizes.

3. no. freescale has used up almost the entire 32K of SRAM just to implement their toy applications. You will have to find memory that they have wasted, and change their code to free it up for your own use.

4. the limit for all uses is the total amount of RAM on the chip, which cannot be expanded.

 

Fortunately, the stack sizes are where most of the memory is wasted. The size for  "Inet main" is set by the linker file, and others are set in tables. Make sure you run the tasks, then see what they actually use with the tk command. Then reduce the task sizes to provide memory for other uses.

 

In your system design, you may need to minimize the total number of tasks, and in programming be careful about use of arrays or buffers on the stack(s).

 

You mentioned USB. I don't think the 52235 supports USB. The USB on the eval board is for the debugging device only (?)

 

Other RTOS/IP combinations might be a better fit for the limited RAM memory of these chips. 

 

 

0 Kudos

351 Views
JaimeR
Contributor III

Thank you for your answer.
In my questions  4 and 5, what I was trying to ask was:
Does the sum of ALL tasks stacks MUST BE equal or less than the total amount of RAM?
    
I believe freescale assigned those stack sizes in order to serve any interrupt into the current task.

Do you think s okay to reduce the size of the stack near the number received by the tk command?

What do you mean by being careful about arrays or buffers on the stacks?

Yes, M52235 does not support USB, but I will be using M52259(which have 64k RAM) with MQX

RTOS. I tought I will get an idea of how RTOS and ethernet works using the hardware I have

at hand.

Regards,

 

Jaime

 

0 Kudos

351 Views
bkatt
Contributor IV

Jaime R wrote:


In my questions  4 and 5, what I was trying to ask was:
Does the sum of ALL tasks stacks MUST BE equal or less than the total amount of RAM?
    
I believe freescale assigned those stack sizes in order to serve any interrupt into the current task.

Do you think s okay to reduce the size of the stack near the number received by the tk command?

What do you mean by being careful about arrays or buffers on the stacks?

Yes, M52235 does not support USB, but I will be using M52259(which have 64k RAM) with MQX

RTOS. I tought I will get an idea of how RTOS and ethernet works using the hardware I have

at hand.



The stacks are separate, and memory is needed for other things besides stacks, and it all must fit.

 

Each task stack must have room for interrupts. I would guess the ethernet interrupt uses the most stack space, probably less than 300 bytes. The way the tk command calculates stack use may or may not include interrupt use depending on when interrupts occurred during the run. So 300 bytes of headroom in each stack might be enough.

 

The coldfire hardware supports two stack pointers but niche doesn't use them. If it did, stack sizes could be determined much more accurately and some memory could be saved.

 

There are several indications that the niche stuff was ported from a system with more RAM, and that sizes of stacks and numbers of buffers are somewhat arbitrary.

 

If you wrote a function such as:

 

int foo( int bar )

{

     char buf[1024];

 

Then any task which calls foo() suddenly needs 1024 bytes more stack space.

 

I don't know anything about how MQX uses RAM, but the docs say it is a pre-emptive, priority tasking system, which is somewhat different from the niche cooperative multitasking system.

0 Kudos