Pumpkin, Inc.

Pumpkin User Forums

How to Reduce Salvo Footprint with Full Version?

If you can't make Salvo do what you want it to do, post it here.

How to Reduce Salvo Footprint with Full Version?

Postby Salvo User » Tue Nov 13, 2001 8:12 am

I have the full version:
v2.2

This is my setup:
PIC16F877
HI-TECH
MPLAB ICD development platform

I want to reduce the Salvo footprint on my application.

These are services I'm using (and what I expect to use):

Event (only one 8 bits event flag) services (WaitE, ClrearE and ReadE in
background, SetE in forground)
Delay in background
Idle task
Inline OSTimer() in foreground only
Diagnostic services
Clearing watchdog in scheduler
I also want to use OSLOC_ALL to locate Salvo code where I want.

Up to now, I have successfully compiled&linked this project:
MyApplication.c (see attached file)
Init.c
Initecb.c
Inittask.c
mem.c
slp42caa.lib

My salvocfg.h options:

code:
 
#define OSUSE_LIBRARY TRUE
#define OSLIBRARY_TYPE OSL //Standard
#define OSLIBRARY_CONFIG OSA
#define OSLIBRARY_VARIANT OSA
#define OSTASKS 5
#define OSEVENT_FLAGS 1
#define OSEVENTS 1
#define OSMESSAGE_QUEUES 0
#define OSUSE_INLINE_OSTIMER TRUE

What is the best strategy ? Building my own library ? Commented out some
unused functions ?

Regards.

[This message has been edited by Salvo User (edited November 13, 2001).]

Salvo User
 
Posts: 1
Joined: Tue Nov 13, 2001 12:00 am

Re: How to Reduce Salvo Footprint with Full Version?

Postby Salvo Tech Support » Tue Nov 13, 2001 8:47 am

You're off to a good start. Here are the results I get when compiling the application you supplied:

code:
Program ROM   $0000 - $008F  $0090 (   144) words
Program ROM $03C5 - $07FF $043B ( 1083) words
$04CB ( 1227) words total Program ROM

Bank 0 RAM $0020 - $0042 $0023 ( 35) bytes
Bank 0 RAM $0071 - $0073 $0003 ( 3) bytes
$0026 ( 38) bytes total Bank 0 RAM

Bank 1 RAM $00A0 - $00CC $002D ( 45) bytes total Bank 1 RAM


quote:
What is the best strategy ? Building my own library ? Commented out some
unused functions ?

There should not be any unused functions in your existing build -- you can check by reviewing the text psects in the Symbol table at the bootom of the map file. Right now, it looks like this:

code:
_IntVector           text4       0090  _OSCreateEFlag       text1       0446
_OSCreateTask text1 056C _OSDelay text0 046C
_OSIdleTask text0 03C8 _OSIdleTaskHook text5 03C5
_OSIdleTaskLabel text0 03D2 _OSInit text0 0510
_OSInitEcb text0 03DF _OSInitPrioTask text1 0555
_OSInitTcb text0 03F0 _OSInsPrioQ text0 06D8
_OSReturnEFlag text0 042F _OSSaveRtnAddr text0 03D3
_OSSched text0 075D _OSSignalEFlag text3 05F1
_OSWaitEFlag text2 0498 _OSWaitEvent text0 0401

You can see that the only OS functions in the application are the ones you're actually using. PICC is "smart" about extracting modules out of libraries ... so there aren't any unused functions you can comment out.

You won't be able to reduce the code size much beyond what you've already done when using the libraries -- they're actually pretty efficient. In your existing application, the only things I can see are:

1) Inline OSSched().
2) #include "eflag.c" in your myappl.c. This may reduce the size of your ISR save and restore, since PICC will be able to "see" OSSignalEFlag() and know which registers it uses.

Beyond this, you will need to do a source code build. You can see a source code build projects in tutorial u1-tu6 u1.pjt-tu6.pjt. With a source code build,

1) You should not use the built-in idle task, as it consumes ROM in OSInit() (more in 2)). Just creat your own idle task, and give it priority 15 (lowest).

2) As long as you do not need persistent Salvo variables (i.e. you do not reset the PIC and expect the variables to remain), you can omit OSInit() altogether -- PICC will be clearing all the Salvo variables to 0 anyway (as long as they're not persistent), and that's all OSInit() does when OSIdleTask() is not used...

3) I'm not sure what you mean by diagnostic services. You can set OSDISABLE_ERROR_CHECKING to TRUE and will save some ROM. You could set OSUSE_EVENT_TYPES to FALSE and save some RAM.

Note that when changing OSLOC_ALL to something other than RAM bank 1 (bank1), you may see an increase in ROM size. That's because bank0 and bank1 are essentially synonymous, as are bank2 and bank3. With PICC vars in bank0 and Salvo vars in bank2 or bank3, the code may require more bank switching.

With a source code build, if you include a module that contains a function you don't use, that function will still end up in your application. So be sure to only include those source modules (*.c) that you really need.


------------------
-----------------------
Salvo Technical Support
Please request all tech support through the Forums.

[This message has been edited by Salvo Tech Support (edited November 13, 2001).]

--------
Salvo Technical Support
Please request all tech support through the Forums.
Salvo Tech Support
 
Posts: 173
Joined: Sun Nov 19, 2000 12:00 am

Re: How to Reduce Salvo Footprint with Full Version?

Postby Salvo Tech Support » Tue Nov 13, 2001 9:21 am

I'll also add that you're unlikely to get much of an improvement (i.e. reduction) in code size over the libraries if you are using just one kind of event (e.g. eFlags). If you are using multiple event types, then settings OSCOMBINE_EVENT_SERVICES to TRUE will result in ROM savings.

After I have created a full-source build of your project, I'll post the results here.

------------------
-----------------------
Salvo Technical Support
Please request all tech support through the Forums.

--------
Salvo Technical Support
Please request all tech support through the Forums.
Salvo Tech Support
 
Posts: 173
Joined: Sun Nov 19, 2000 12:00 am

Re: How to Reduce Salvo Footprint with Full Version?

Postby Salvo Tech Support » Tue Nov 13, 2001 10:09 am

OK, here is the result I get with a source code build:

code:
Linking:
Command line: "C:HT-PICBINPICC.EXE -G -INTEL -M1-1.map -ICD -16F877 -o1-1.HEX -fakelocal MYAPPL.OBJ
C:SALVOSOURCEINITTASK.OBJ
C:SALVOSOURCEMEM.OBJ
C:SALVOSOURCEQINS.OBJ
C:SALVOSOURCEUTIL.OBJ
C:SALVOSOURCEDELAY.OBJ
C:SALVOSOURCEEFLAG.OBJ
C:SALVOSOURCEEVENT.OBJ "
Enter PICC -HELP for help

Memory Usage Map:

Program ROM $0000 - $0084 $0085 ( 133) words
Program ROM $0483 - $07FF $037D ( 893) words
$0402 ( 1026) words total Program ROM

Bank 0 RAM $0020 - $0042 $0023 ( 35) bytes
Bank 0 RAM $0071 - $0073 $0003 ( 3) bytes
$0026 ( 38) bytes total Bank 0 RAM

Bank 1 RAM $00A0 - $00C2 $0023 ( 35) bytes total Bank 1 RAM


and here is the salvocfg.h I used:

code:
#define OSTASKS                     5 
#define OSEVENT_FLAGS 1
#define OSEVENTS 1
#define OSMESSAGE_QUEUES 0
#define OSUSE_INLINE_OSTIMER TRUE
#define OSUSE_INLINE_OSSCHED TRUE


#if MAKE_WITH_STD_LIB

#define OSUSE_LIBRARY TRUE
#define OSLIBRARY_TYPE OSL //Standard
#define OSLIBRARY_CONFIG OSA
#define OSLIBRARY_VARIANT OSA

#else

#define OSBYTES_OF_DELAYS 1
#define OSBYTES_OF_TICKS 0
#define OSCALL_OSCREATEEVENT OSFROM_ANYWHERE
#define OSCALL_OSRETURNEVENT OSFROM_ANYWHERE
#define OSCALL_OSSIGNALEVENT OSFROM_ANYWHERE
#define OSCLEAR_WATCHDOG_TIMER() asm(" clrwdt")
#define OSCOMPILER OSHT_PICC
#define OSDISABLE_ERROR_CHECKING TRUE
#define OSENABLE_EVENT_FLAGS TRUE
#define OSENABLE_EVENT_READING TRUE
#define OSENABLE_IDLE_TASK FALSE
#define OSENABLE_IDLE_TASK_HOOK FALSE
#define OSSET_LIMITS FALSE
#define OSTARGET OSPIC16
#define OSUSE_EVENT_TYPES FALSE
#define OSPIC16_GIE_BUG FALSE

#define OSLOC_ALL bank1

#endif


There are a couple of things to note here:

1) Currently, you can't include eFlag.c and events.c in an effort to reduce the size of the ISR -- you'll get compile-time errors. But the ISR save and restore is quite small anyway, so it wouldn't make much of a difference.

2) I inlined OSSched() as well as OSTimer().

3) I deleted OSInit() from main(). Also, note that v2.2 has some problems with OSInit() when you try to reduce the numbers of Salvo objects (see the Service Bulletins in the Forums). By doing a full source-code build, you avoid these altogether.

4) The source files required can be seen above in the Linker input.

So, this saved around 200 bytes. Not bad!

------------------
-----------------------
Salvo Technical Support
Please request all tech support through the Forums.

[This message has been edited by Salvo Tech Support (edited November 13, 2001).]

--------
Salvo Technical Support
Please request all tech support through the Forums.
Salvo Tech Support
 
Posts: 173
Joined: Sun Nov 19, 2000 12:00 am

Re: How to Reduce Salvo Footprint with Full Version?

Postby Salvo Tech Support » Tue Nov 13, 2001 10:15 am

One last thing -- be sure to set

Local Optimizations On
Gloabl Optimizations On 9

in each source file's Node Properties window in MPLAB. This has a big (beneficial) effect on code size.

------------------
-----------------------
Salvo Technical Support
Please request all tech support through the Forums.

--------
Salvo Technical Support
Please request all tech support through the Forums.
Salvo Tech Support
 
Posts: 173
Joined: Sun Nov 19, 2000 12:00 am


Return to Coding

Who is online

Users browsing this forum: No registered users and 1 guest

cron