Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 28, 2024, 03:41:25 15:41


Login with username, password and session length


Pages: [1]
Print
Author Topic: CCS PICC Stack Usage Report  (Read 3959 times)
0 Members and 1 Guest are viewing this topic.
sam_des
Senior Member
****
Offline Offline

Posts: 253

Thank You
-Given: 124
-Receive: 146


« on: August 10, 2022, 04:49:19 04:49 »

Hi,

I am using PICs after a very long time. Also using CCS PICC(5.109) with MPLAB-X(6.0) just to get hang of it again.
Compiled a small project for PIC16F15386 successfully and it so far is running ok.
But looking at list file generated by compiler, I go this...
Code:

               ROM used:   1306 words (8%)
                           Largest free fragment is 2048
               RAM used:   84 (4%) at main() level
                           118 (6%) worst case
               Stack used: 0 locations
               Stack size: 16


There are actually 'CALL's present in the code, this summary simply doesn't report it.
Interesting thing is, there is also 1 interrupt enabled(TIMER0) which in turn in calling functions 2 level deep, even that isn't showing up in LST file summary.

The '.TRE' file also shows CALLs. Obviously mismatch between .TRE & .LST file summary.

Is it something to do with some MPLAB setting ? Or is it some bug with this particular version of PICC?

Thanks,
sam_des
Logged

Never be afraid to do something new. Remember Amateurs built the Ark, Professionals built the Titanic !
h0nk
Senior Member
****
Offline Offline

Posts: 256

Thank You
-Given: 208
-Receive: 230



« Reply #1 on: August 10, 2022, 10:18:06 10:18 »


Hello sam_des,

8 bit PIC's use a hardware stack for CALL's and Interrupts.
The report of the compiler might reflect the usage of
"automatic variables", which are allocated on an emulated
software stack.



Best Regards
Logged
sam_des
Senior Member
****
Offline Offline

Posts: 253

Thank You
-Given: 124
-Receive: 146


« Reply #2 on: August 10, 2022, 03:03:27 15:03 »

Hello,

Quote
8 bit PIC's use a hardware stack for CALL's and Interrupts.

I am painfully aware of that.  Lips sealed Cry 
As far as I know, the Stack Usage summary in LST file reports only the Hardware Stack usage.
The functions which compiler inlines or use GOTOs as optimization to save the hardware stack are marked as such in TRE file.


Quote
The report of the compiler might reflect the usage of
"automatic variables", which are allocated on an emulated
software stack.
I don't think this emulated stack or variable OVERLAYing as called by other compilers, for auto/param/return variables, have anything to do here.


And lastly, no matter what compiler does, INTERRUPT has to use at least 1 level of HARDWARE stack, isnt it?

Thanks again,
sam_des
Logged

Never be afraid to do something new. Remember Amateurs built the Ark, Professionals built the Titanic !
h0nk
Senior Member
****
Offline Offline

Posts: 256

Thank You
-Given: 208
-Receive: 230



« Reply #3 on: August 10, 2022, 04:21:25 16:21 »

Hello sam_des,

> Stack size: 16

Is the Hardwarestack really 16 Levels deep?

I use XC8 only for 8 bit PIC's, so i am unaware of the software
stackof the PICC compiler.
This software stack would be used for "reentrant" functions in XC8.
Otherwise the compiler only allocates registers for variables.
This would obviously not work for reentrant functions.

For interrupts You should take a look in the section "Automatic Context Saving"
of the datasheet.

I took a look of the datasheet of a similar device (16F1508) and it seems the
hardwarestack now really can hold 16 entries.
I am afraid, i could not help further.


Best Regards
« Last Edit: August 10, 2022, 04:49:14 16:49 by h0nk » Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC