Pumpkin, Inc.

Pumpkin User Forums

OSVars and very large projects

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®).

OSVars and very large projects

Postby aek » Fri Aug 19, 2005 12:03 am

Hi Tyrel.

Why did the code in salvoincsalvoprg.h (which does the same thing) not work for you?

Just wondering ...

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

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

Re: OSVars and very large projects

Postby tyski » Fri Aug 19, 2005 12:26 am

After commenting out my changes in the linker and mem.c files, this is the linker error that I get:

Error - section '.udata_mem.o' can not fit the section. Section '.udata_mem.o' length=0x0000010f

I also tried something else, that is define to OSMPLAB_C18_LOC_ALL_NEAR as FALSE in salvocfg.h and I get numerous salvo generated errors (illegal option for library build).

It may be that I need to do a source code build, but all I have is library version of salvo.

sidenote: salvoprg.h is very short and nothing it in pertains to the mcc18 compiler

------------------
Tyrel Newton
Electrical Engineer

Tethers Unlimited, Inc.
11807 North Creek Parkway South, Suite B-102
Bothell, WA 98011-8804, USA
425-486-0100 x836 425-482-9670 FAX
newton@tethers.com
http://www.tethers.com/

Tyrel Newton
Electrical Engineer

Tethers Unlimited, Inc.
11807 North Creek Parkway South, Suite B-102
Bothell, WA 98011-8804, USA
425-486-0100 x836 425-482-9670 FAX
newton@tethers.com
http://www.tethers.com/

tyski
 
Posts: 17
Joined: Thu Aug 18, 2005 11:00 pm
Location: Bothell, WA, USA

Re: OSVars and very large projects

Postby aek » Fri Aug 19, 2005 12:42 am

Hi Tyrel.

Wow -- you tripped across something interesting ...

The "new" salvoprg.h is in the later Salvo installers, e.g. the v3.2.4 one for Salvo for AVR and MegaAVR. You can install Salvo Lite for AVR in your Salvo directory and you'll get the new file. Sorry about that.

The advantage of the new files (there are various small changes in the source between v3.2.3 and v3.2.4, but none of them affect the Salvo code per se -- they're more for various compiler features) is that salvoprg.h splits the Salvo vars into different named sections, so it's easy to deal with the problem you're having.

Alternately, I think you're OK with what you've done, as it mirrors what we did in v3.2.4. As long as you're using a library with the memory type code of f you should be able to force Salvo's vars into a named section of your choosing and size.

If that is indeed possible (to declare a section greater than 256 bytes in size) would you mind posting your linker file? This has always been an issue with MPLAB-C18 that I have not seen addressed very well.

Thanks,

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

[This message has been edited by aek (edited August 19, 2005).]

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

Re: OSVars and very large projects

Postby aek » Fri Aug 19, 2005 12:48 am

OK, I just tested this by installing Salvo Lite 3.2.4-a over an existing Salvo PIC v3.2.3 installation.

The various newer files are in place, including salvoincsalvoprg.h, which splits up Salvo's global objects for MPLAB-C18 into a bunch of different named sections. The user can then created his/her own named sections in the MPLAB-C18 linker file to locate these sections as code size demands.

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

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

Re: OSVars and very large projects

Postby aek » Fri Aug 19, 2005 12:50 am

(post deleted)

[This message has been edited by aek (edited August 19, 2005).]

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

Re: OSVars and very large projects

Postby tyski » Fri Aug 19, 2005 1:02 am

Given the size of my application, far memory pointers are a necessity. As for the my hack, I think I'll stick with my solution for now as I've already had to alter the linker file for various large buffers.

A snippet of my linker file should suffice here (its really very simple but explained very poorly in the mcc18 documentation - the pertinent section is in the user's manual where it tells you how to create software stacks greater than 256 bytes in size).

The normal linker file looks something like:
DATABANK NAME=gpr8 START=0x800 END=0x8FF
DATABANK NAME=gpr9 START=0x900 END=0x9FF

Say you want a section 512 bytes big for salvo's globals, you would declare something like (after getting rid of the default stuff from above):

DATABANK NAME=OSVarsArea START=0x800 END=0x9FF
SECTION NAME=OSVars RAM=OSVarsArea

and then use:

#pragma udata OSVars

just before the variable declarations

sidenote: If more variables follow those that you want in the custom section, you have to have another "#pragam udata" to tell the compiler to place variables normally again.

I've used this method to create various buffers (one 512 bytes big, a couple others 256 bytes big). mcc18 tries to force all global/static variables in a single .c file into a single memory bank (for obvious performance reasons), so if a .c file has more than 256 bytes worth of globals, you need to get a tricky.

Thanks for the help Andrew -
Tyrel

------------------
Tyrel Newton
Electrical Engineer

Tethers Unlimited, Inc.
11807 North Creek Parkway South, Suite B-102
Bothell, WA 98011-8804, USA
425-486-0100 x836 425-482-9670 FAX
newton@tethers.com
http://www.tethers.com/

Tyrel Newton
Electrical Engineer

Tethers Unlimited, Inc.
11807 North Creek Parkway South, Suite B-102
Bothell, WA 98011-8804, USA
425-486-0100 x836 425-482-9670 FAX
newton@tethers.com
http://www.tethers.com/

tyski
 
Posts: 17
Joined: Thu Aug 18, 2005 11:00 pm
Location: Bothell, WA, USA

Re: OSVars and very large projects

Postby aek » Fri Aug 19, 2005 1:09 am

Hi Tyrel.

OK, great.

I knew about the edits to the linker file -- but for some reason i thought that arrays of larger than 256 bytes or maybe 256 elements were (once) a problem. I guess not.

The new Salvo files "cancel" the #pragma udata name by issuing a #prgama udata thereafter, as you describe.

Thanks,

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

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

Re: OSVars and very large projects

Postby aek » Fri Aug 19, 2005 1:12 am

Hi Tyrel.

Small nit:

Note that your code will choke if another compiler is used -- you want a two-level

code:
#if (..) 
#if (..)
#pragma udata access OSVars
#else
#pragma udata OSVars
#endif
#endif

construct so that the body is only parsed if the MPLAB-C18 compiler is used.

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

[This message has been edited by aek (edited August 19, 2005).]

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

Re: OSVars and very large projects

Postby tyski » Fri Aug 19, 2005 1:20 am

good point, but fortunately for me, I can only afford one compiler...

------------------
Tyrel Newton
Electrical Engineer

Tethers Unlimited, Inc.
11807 North Creek Parkway South, Suite B-102
Bothell, WA 98011-8804, USA
425-486-0100 x836 425-482-9670 FAX
newton@tethers.com
http://www.tethers.com/

Tyrel Newton
Electrical Engineer

Tethers Unlimited, Inc.
11807 North Creek Parkway South, Suite B-102
Bothell, WA 98011-8804, USA
425-486-0100 x836 425-482-9670 FAX
newton@tethers.com
http://www.tethers.com/

tyski
 
Posts: 17
Joined: Thu Aug 18, 2005 11:00 pm
Location: Bothell, WA, USA

Re: OSVars and very large projects

Postby aek » Fri Aug 19, 2005 1:26 am

LOL!

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

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

Next

Return to PICmicro MCUs

Who is online

Users browsing this forum: No registered users and 2 guests