Searching \ for '[PIC]: PIC16F877 & Hi-Tech C - compiler problem?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/languages.htm?key=c
Search entire site for: 'PIC16F877 & Hi-Tech C - compiler problem?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: PIC16F877 & Hi-Tech C - compiler problem?'
2001\01\18@145217 by Sam Linder

flavicon
face
Ooops - sorry - forgot the correct subject line!

       Sam....

-----Original Message-----
From: Sam Linder
Sent: Thursday, January 18, 2001 11:40 AM
To: spam_OUTPICLISTTakeThisOuTspamMITVMA.MIT.EDU
Cc: '.....supportKILLspamspam@spam@htsoft.com'; 'John.GulsenspamKILLspammicrochip.com'
Subject:


Can someone help me understand the following:
Without the offending line of code, I get a successful compile showing I've
used up 5974 ROM words out of a possible 8192 (I'm using a PIC16F877).

When I add the offending line of code:    d_temp = pow((double)10.0,
d_temp);
I not only get a signature mismatch error, but I also get out of ROM space
errors.


In MPLAB, Menu Project\Edit Project, I changed "Floating Point For Doubles"
from 32-bit to 24-bit - The signature mismatch error is now gone. However, I
still have out of ROM space errors. I can't believe that calling on the pow
library function consumes over 2218 words (8192 - 5974).

Any ideas out there? I posted this query to Hi-Tech C yesterday, but
unfortunately they weren't any help.
(See Memory Maps below for compiler messages)

       Sam....

Stat-K Memory Usage Map - 18 Jan 2001 @1110:

Program ROM   $0000 - $0077  $0078 (   120) words
Program ROM   $007A - $0FFF  $0F86 (  3974) words
Program ROM   $10A8 - $17FF  $0758 (  1880) words
                            $1756 (  5974) words total Program ROM

Bank 0 RAM    $0023 - $0062  $0040 (    64) bytes
Bank 0 RAM    $0071 - $007D  $000D (    13) bytes
                            $004D (    77) bytes total Bank 0 RAM

Bank 1 RAM    $00A0 - $00EC  $004D (    77) bytes total Bank 1 RAM
Bank 2 RAM    $0110 - $0168  $0059 (    89) bytes total Bank 2 RAM
Bank 3 RAM    $0190 - $01DA  $004B (    75) bytes total Bank 3 RAM
Bank 0 Bits   $0100 - $0115  $0016 (    22) bits  total Bank 0 Bits

Build completed successfully.

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

Stat-K Memory Usage Map - 18 Jan 2001 @1111:

Added following line of code: (where d_temp is defined as type double)
   d_temp = pow((double)10.0, d_temp);

Linking:
Command line: "C:\HT-PIC\BIN\PICC.EXE -q -Gstatk.dbg -INTEL -Estatk.err
-Mstatk.map -PSECTMAP -ICD -16F877 -oSTATK.HEX -fakelocal -asmlist
SKMAIN.OBJ SKDELAY.OBJ SK_I2C.OBJ SK_LCD.OBJ SK_SPI.OBJ "
Error[000] C:\HT-PIC\LIB\pic422-c.lib(exp.obj) 20 : signatures do not match:
_pow (C:\HT-PIC\LIB\pic422-c.lib: exp.obj): 0x2073/0x2074
Error[000]   : Can't find 0x50 words for psect rbss_0 in segment BANK0
Error[000]   : Can't find 0x2 words (0x2 withtotal) for psect intsave in
segment BANK0
Error[000]   : Can't find 0x2 words (0x2 withtotal) for psect code_ptr in
segment BANK0
Error[000]   : Can't find 0x1 words (0x1 withtotal) for psect intsave_0 in
segment COMBANK
Error[000]   : Can't find 0x1 words (0x1 withtotal) for psect fsr_save in
segment BANK0

MPLAB is unable to find output file "STATK.HEX".

Build failed.

---------------------------------------------------------------
Stat-K Memory Usage Map - 18 Jan 2001 @1111:

In MPLAB, Menu Project\Edit Project, I changed "Floating Point For Doubles"
from 32-bit to 24-bit - The signature mismatch error is now gone. However, I
still have Out Of ROM errors.

Linking:
Command line: "C:\HT-PIC\BIN\PICC.EXE -q -Gstatk.dbg -INTEL -Estatk.err
-Mstatk.map -PSECTMAP -ICD -16F877 -oSTATK.HEX -fakelocal -asmlist
SKMAIN.OBJ SKDELAY.OBJ SK_I2C.OBJ SK_LCD.OBJ SK_SPI.OBJ "
Error[000]   : Can't find 0x4F words for psect rbss_0 in segment BANK0
Error[000]   : Can't find 0x2 words (0x2 withtotal) for psect intsave in
segment BANK0
Error[000]   : Can't find 0x2 words (0x2 withtotal) for psect code_ptr in
segment BANK0
Error[000]   : Can't find 0x1 words (0x1 withtotal) for psect intsave_0 in
segment COMBANK

MPLAB is unable to find output file "STATK.HEX".

Build failed.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\01\18@150500 by Dipperstein, Michael

face picon face
You're not running out of ROM, you're running out of Bank 0 RAM.

By the way, I noticed that you're using the -ICD flag, that's going to prevent
code from being allocated at the top of your ROM.  If you're expecting to have
that space available for code, you won't

-Mike

{Original Message removed}

2001\01\18@152111 by Mike Mansheim

flavicon
face
>When I add the offending line of code:    d_temp = pow((double)10.0,
>d_temp);
>still have out of ROM space errors. I can't believe that calling on the
pow
>library function consumes over 2218 words (8192 - 5974).

Adding floating point C calls can consume huge amounts of program memory -
2k wouldn't surprise me at all.  As a test, strip your program down until
it compiles, then remove the pow() call and see how much rom it took.
Another factor is that a C compiler is not going to be able to use every
last bit of rom.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\01\18@154050 by Bob Blick

face
flavicon
face
You're out of RAM, not ROM.

If you use any longs or floats, you'd better get as many of your variables
out of bank 0 as you can because the compiler will need them.

-Bob

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\01\18@154633 by Sam Linder

flavicon
face
To Michael Dipperstein, Bob Blick, & Mike Mansheim:
Thanks for the info guys. I'll try out your suggestions. I'd hate to have to
migrate to a larger PIC this late in the game, but might have to. I'll
report back my results to the list later.

       Sam....


> {Original Message removed}

2001\01\18@161325 by Barry King

flavicon
face
Sam,

The error you're getting isn't an out-of-codespace error, its out of
Bank0 RAM.  Is this the first addition of floating point to the
program?  If so, the floating point library's scratch area might be
why.

Can you move some variables to upper banks using the "bank1",
"bank2", "bank3" qualifiers?  If possible, leaving all your static
variables explicitly in upper banks gives the compiler the most elbow
room in the prime real estate in the memory map.

> Error[000]   : Can't find 0x4F words for psect rbss_0 in segment BANK0
> Error[000]   : Can't find 0x2 words (0x2 withtotal) for psect intsave in segment BANK0
> Error[000]   : Can't find 0x2 words (0x2 withtotal) for psect code_ptr in segment BANK0
> Error[000]   : Can't find 0x1 words (0x1 withtotal) for psect intsave_0 in segment COMBANK

-Barry.
------------
Barry King, Engineering Manager
NRG Systems "Measuring the Wind's Energy"
http://www.nrgsystems.com
Phone: 802-482-2255
FAX:   802-482-2272

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\01\18@162508 by Sam Linder

flavicon
face
Barry, et al:
Thanks for the good advice. Even though the compiler was telling me where to
look, I just didn't see the forest for the trees. That's what happens when
you get too deeply "embedded" in your code.

I tried the previously mentioned suggestions and this is what I found. The
"pow" function consumes 1189 words of ROM and 24 bytes of BANK0 RAM. Ouch!

I'm currently able to live with the results and still have a bit of
breathing room, but if this program gets much larger (and I'm sure it will),
I'm going to have to migrate to the PIC18xxx.

Thanks for all your help gentlemen. As always, I can count on the people in
this list to help me through my programming hiccups.

       Sam....


> {Original Message removed}

2001\01\19@090817 by Wynn Rostek

flavicon
face
> To Michael Dipperstein, Bob Blick, & Mike Mansheim:
> Thanks for the info guys. I'll try out your suggestions. I'd hate to have
to
> migrate to a larger PIC this late in the game, but might have to. I'll
> report back my results to the list later.
>
>         Sam....

Sam,

You don't have to, just add bank1, or bank2, or bank3 in front of some of
your other variable declarations.
This doesn't work with automatic variables (variables declared in fuctions)
just static (file scope) variables.

was:
unsigned char tmp;

is:

bank1 unsigned char tmp;

knock yourself out.

Wynn Rostek.

P.S. Check Section 5.19.2 Bank1, Bank2, Bank3 Type Qualifiers, page 140 of
the new manual.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\01\24@161536 by Sam Linder

flavicon
face
Sorry for the delayed reply - been in firedrill mode for a while.
I've just about used up all my banks - that's part of the problem.

       Sam....


> {Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...