Pumpkin, Inc.

Pumpkin User Forums

Memory usage etc. etc.

For issues specific to Microchip's PICmicro® MCUs, including compilers (e.g. HI-TECH PICC & PICC-18, Microchip MPLAB®-C18) and IDEs (e.g. Microchip MPLAB®).

Memory usage etc. etc.

Postby kamyip » Wed May 05, 2004 5:55 am

Hi,

I'm using Salvo lite 3.2, C18 V2.3 compiler under MPLAB 6.51. on PIC18F6720.
Currently the settings I use are;
Memory model:code model - small code
Memory model:data model - large data
library - slc18sfa.lib

I'm have 22 tasks running and 16 events defined. The total code size now stand at 28K+

questions:
1) I've error when trying to use large code memory model + slc18lfa.lib.
2) I've problem using OS_Replace() as per example from the manual pg 261. reason being TaskCountUp() was not created before it can replace TaskCountUp() using OS_Replace(TaskCountDown,5). is there a mistake here.
3) An example code:

code:
void TaskDummy(void){

for(;;){
OS_WaitEFlag(EFLAG_1,1,OSALL_BITS,
OSNO_TIMEOUT,TaskDummy1);
//do something here//
}
}

Observation:
I expect once the EFLAG.1 has been set TaskDummy() should run indefinitely, consuming all the OS time but it didn't. I still pass back to OSSched(). Is it correct?

Over 2 u,
Kamyip

[This message has been edited by aek (edited May 05, 2004).]

kamyip
 
Posts: 46
Joined: Mon Apr 15, 2002 11:00 pm

Re: Memory usage etc. etc.

Postby aek » Wed May 05, 2004 8:02 am

Hi.
quote:
1) I've error when trying to use large code memory model + slc18lfa.lib
Can you be more specific? Cut-and-paste Build Results window?
quote:
2) I've problem using OS_Replace() as per example from the manual pg 261. reason being TaskCountUp() was not created before it can replace TaskCountUp() using OS_Replace(TaskCountDown,5). is there a mistake here.
It should be fine ... OS_Replace() is really just a macro that calls OSCreateTask() and returns to the scheduler ... see salvo.h.
quote:
I expect once the EFLAG.1 has been set TaskDummy() should run indefinitely, consuming all the OS time but it didn't. I still pass back to OSSched(). Is it correct?
No, but you will always pass back to OSSched() inside a call to OS_WaitXyz(), regardless of the value of the event being waited on. OS_WaitXyz() is always an unconditional context-switch, followed by code that analyzes whether the wait-on-event is successful. What's TaskDummy()'s priority? If it's not the highest, and there are other eligible tasks, then they'll run instead ...

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Memory usage etc. etc.

Postby kamyip » Wed May 05, 2004 8:44 am

aek,

1) The error msg:
Error - section '.udata_mem.o' can not fit the section. Section '.udata_mem.o' length=0x00000110
Errors : 1

2) I've tried OS_Replace() but I get error of TaskCountDown() not being recognise. Do I have to OSCreateTask(TaskCountDown,...) in the main()? which doesn't make sense because it will take up a few more byte of memory, right?

3) The DummyTask() is just to make sure that I can still multitask even though the EFlag is not cleared. Previously I put in a OS_Yield() as the end of the loop but I seems now that it is redundant.

Another question though...

4)with the unlimited task and even available, are there any reason that I should go for the professional OS version
5)will there be an RTOS for DspPIC ?

Over2u....

kamyip
 
Posts: 46
Joined: Mon Apr 15, 2002 11:00 pm

Re: Memory usage etc. etc.

Postby aek » Wed May 05, 2004 9:06 am

Hi.

1) See RM-MCC18.PDF. What's happening is that all of the Salvo vars are in one section, and that section has grown to be too big (because large-model function pointers are bigger than small-model ones). You can manually edit Salvo's mem.c to place OStcbArea[] in its own section, and then you'll be able to build successfully. The upcoming next major release has a new mem.c that maximizes the flexibility w/regard to C18's sections.

2) If TaskCountDown() isn't being recognized, then the compiler / linker can't find it. No need to create it -- you're simply having a problem resolving a name / address. Probably a typo somewhere, or a lack of an extern declaration. No need to call OSCreateTask() to solve it.

4) See RM-MCC18.PDF. Tasks and events are not unlimited due to C18's restriction that arrays must fit in 256-byte blocks. So if you needed to get around this, you'd probably need Salvo Pro.

5) No announcement re dsPIC has been made. If you had Salvo Pro, you could try a port yourself ... :-)

------------------

[This message has been edited by aek (edited May 05, 2004).]

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Memory usage etc. etc.

Postby kamyip » Thu May 06, 2004 5:05 am

aek,

1)sounds a bit daunting. Would appreciate if you could show me a simple example how to manually locate OStcbArea[] can be done?

thanks for the prompt reply.

over2u....

kamyip
 
Posts: 46
Joined: Mon Apr 15, 2002 11:00 pm

Re: Memory usage etc. etc.

Postby kamyip » Fri May 07, 2004 5:25 am

aek,

thanks,i'll try it out.


kamyip
 
Posts: 46
Joined: Mon Apr 15, 2002 11:00 pm

Re: Memory usage etc. etc.

Postby kamyip » Fri May 07, 2004 6:10 am

hi again Andrew,

I've got the program working again but in doing so what are the penalties or issues that I should look out for.

Anyway really appreciate such a prompt support... :-)

kamyip

kamyip
 
Posts: 46
Joined: Mon Apr 15, 2002 11:00 pm

Re: Memory usage etc. etc.

Postby aek » Fri May 07, 2004 7:40 am

code:
#pragma udata OSVarsTcbArea
OSgltypeTcb OStcbArea[OSTASKS];
#pragma udata OSVars

in mem.c (modify what's there) will place OStcbArea[] in its own RAM section / page.

See MPLAB-C18 user's guid for more information.

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Memory usage etc. etc.

Postby aek » Fri May 07, 2004 9:04 am

In terms of separate sections? None, really.

In terms of the large memory model? Well, each tcb is one byte larger to accomodate the 21(?)-bit maximum address space of the PIC18.

If someone can show me how to overcome the 256 bytes-per-array limit imposed by C18, I' be happy to incorporate that into the reference manual, etc. But one probably needs Salvo Pro to do that, since I suspect something like a far pointer is required ...

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm


Return to PICmicro MCUs

Who is online

Users browsing this forum: No registered users and 2 guests

cron