Pumpkin, Inc.

Pumpkin User Forums

Linker Problem w/Salvo Lite and PIC18C658

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

Linker Problem w/Salvo Lite and PIC18C658

Postby Unregistered User » Thu Oct 18, 2001 7:04 am

We've encountered the following problem when evaluating Salvo Lite.

1. We've created a very simple program with 3 tasks using "sfp800ab.lib"
and it runs fine.

2. But the linker generates the following error when we use a larger
program (23K Rom 1K Ram) :-
Error[000] : Can't find 0x1D words for psect intsave_regs in
segment COMRAM

3. With "sfp800m-.lib" it doesn't generate any error with both large and
small program.

My system info :-

MPLAB v5.40
Hitech PICC-18 v8.10pl1
Salvo Lite 2.2.0
Processor : PIC18C658

SalvoCfg.h
--------------

code:
 
#define OSUSE_LIBRARY TRUE
#define OSLIBRARY_TYPE OSF
#define OSLIBRARY_CONFIG OSA
#define OSLIBRARY_VARIANT OSB

Would appreciate if you could advise as soon as possible.

Unregistered User
 
Posts: 36
Joined: Thu Aug 09, 2001 11:00 pm

Re: Linker Problem w/Salvo Lite and PIC18C658

Postby Salvo Tech Support » Thu Oct 18, 2001 7:38 am

Hello.

The v2.2.0 Salvo Lite libraries for the PIC18 were mistakenly generated with the near qualifier applied to the Salvo variables. This means that all of the Salvo variables are located in the ACCESS RAM from 00h to 7Fh. Here's an example, taken from salvodemod4sysfd4free.pjt:

code:
Linking:
Command line: "c:ht-pic18inpicc18.exe -G -FAKELOCAL -INTEL -Md4free.map -18C452 -oD4FREE.HEX
salvodemod4MAIN.OBJ salvolibrarySFP800AB.LIB "
Enter PICC18 -HELP for help

Memory Usage Map:

Program ROM $000000 - $000003 $000004 ( 4) bytes
Program ROM $000008 - $000013 $00000C ( 12) bytes
Program ROM $000018 - $000615 $0005FE ( 1534) bytes
Program ROM $0005F4 - $0005F4 $000001 ( 1) bytes
Program ROM $000616 - $0007C9 $0001B4 ( 436) bytes
$0007C3 ( 1987) bytes total Program ROM

RAM data $000000 - $00000E $00000F ( 15) bytes
RAM data $000048 - $000064 $00001D ( 29) bytes
RAM data $0005F5 - $0005FF $00000B ( 11) bytes
$000037 ( 55) bytes total RAM data

Common RAM $00000F - $000047 $000039 ( 57) bytes total Common RAM
ROM data $000004 - $000004 $000001 ( 1) bytes
ROM data $300000 - $300001 $000002 ( 2) bytes
$000003 ( 3) bytes total ROM data

Build completed successfully.


Note the 57 bytes total Common RAM -- that's mainly Salvo variables, though it also includes int save and restore stuff, etc.

(You can build this yourself, too). Looking at the map file d4free.map, we see:

code:
                                  Symbol Table

?_OSCreateTask bss 0005FB ?_OSInitPrioTask bss 0005FF
?_OSInsPrioQ bss 0005FF ?_OSSaveRtnAddr bss 0005F8
?a_OSInit bss 0005F8 _IntVector text 0001DE
_OSCreateTask text 000550 _OSDelay text 0006B0
_OSIdleTask text 000764 _OSIdleTaskHook text 0001D2
_OSIdleTaskLabel text 000778 _OSInit text 000616
_OSInitEcb text 0006FC _OSInitPrioTask text 0005DC
_OSInitTcb text 000724 _OSInsPrioQ text 0002E2
_OSSaveRtnAddr text 000796 _OSSched text 000424
_OSTimer text 00074C _OScTcbP rbss 00000F
_OSdelayQP rbss 000010 _OSecbArea rbss 00001F
_OSefcbArea rbss 000011 _OSeligQP rbss 000012
_OSglStat rbss 000013 _OSmqcbArea rbss 00001A
_OSsigQinP rbss 000014 _OSsigQoutP rbss 000015
_OStcbArea rbss 000033 _OStimerTicks rbss 000016
_TaskHigh text 0000E2 _TaskHigh1 text 0000F4
_TaskLow text 000168 _TaskLow1 text 0001CE
_TaskMedium text 0000FE _TaskMedium1 text 000110


You can see that the Salvo variables (the ones prefixed by _OS, like OStcbArea and OStimerTicks) are all located in the rbss psect, which is in the common area.

The likely reason why your code compiles and links successfully with the m- library and not with the ab library is that when all functionality is enabled, the Salvo variables occupy a larger amount of RAM. For example, with delays and events enabled, each tcb is larger ...

So much for theory. Until v2.3.0 is released (30-60 days from now), you can do the following:

1) Make sure that none of your variables are declared as near. You won't be able to influence the compiler's placement of int save and restore variables, of course.

2) Use a library that contains only that functionality that you're actually using, e.g. don't use an ab library if you're only using delays or events, but not both.

We will attempt to (re-)build a set of PIC18 Salvo Lite v2.2.0 libraries and make them available for ftp download within the next few days.

We apologize for this inconvenience.

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

[This message has been edited by Salvo Tech Support (edited October 18, 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: Linker Problem w/Salvo Lite and PIC18C658

Postby aek » Thu Oct 18, 2001 7:58 am

One other thing that may work (no guarantees) is to follow the recommendations outlined for reducing RAM usage when linking to a Salvo Library. This information is presented in Service Bulletin SB-9 (here in the Forums), App Note AN-1, and the Libraries chapter of the User Manual.

To have any chance of having it work at all, you must call OSInit() at the very beginning of main(), i.e.:

code:
main() 
{
OSInit();
... // other initialization
for (;;)
OSSched();
}

In many instances this (combined with a modified salvocfg.h and linking to mem.c) will work to safely reduce Salvo's RAM requirements.

I think we can have the fixed PIC18 libraries on the ftp website by tomorrow (Friday).

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

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

Re: Linker Problem w/Salvo Lite and PIC18C658

Postby aek » Fri Oct 19, 2001 8:31 am

The fix for this problem is now available as a Salvo Lite patch.

Please visit ftp://ftp.pumpkininc.com and in the Salvo/2.2.0 directory you'll find salvo-lite-pic-2.2.0-a.zip.

Follow the directions in the readme.txt file to install this patch to your Salvo Lite distribution.

Below is the linker output for salvodemod4sysf with the new libraries:

code:
Linking:
Command line: "c:ht-pic18inpicc18.exe -G -FAKELOCAL -INTEL -Md4free.map -18C452 -oD4FREE.HEX
salvodemod4MAIN.OBJ salvolibrarySFP800AB.LIB "
Enter PICC18 -HELP for help

Memory Usage Map:

Program ROM $000000 - $000003 $000004 ( 4) bytes
Program ROM $000008 - $000013 $00000C ( 12) bytes
Program ROM $000018 - $000785 $00076E ( 1902) bytes
Program ROM $0005A4 - $0005A4 $000001 ( 1) bytes
Program ROM $000786 - $000B05 $000380 ( 896) bytes
$000AFF ( 2815) bytes total Program ROM

RAM data $000000 - $00000E $00000F ( 15) bytes
RAM data $000010 - $00002C $00001D ( 29) bytes
RAM data $0005A5 - $0005FF $00005B ( 91) bytes
$000087 ( 135) bytes total RAM data

Common RAM $00000F - $00000F $000001 ( 1) bytes total Common RAM
ROM data $000004 - $000004 $000001 ( 1) bytes
ROM data $300000 - $300001 $000002 ( 2) bytes
$000003 ( 3) bytes total ROM data

Build completed successfully.


Compare this to the listing in an earlier posting -- now much of the Common RAM space is freed up for other uses.

Users of the full version of Salvo can download and install this patch, too. They should then regenerate the PIC18 standard libraries (slp8xxcv.lib) using the makefiles available on the ftp site.

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

[This message has been edited by aek (edited October 19, 2001).]

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


Return to Coding

Who is online

Users browsing this forum: No registered users and 1 guest

cron