View previous topic :: View next topic |
Author |
Message |
TSEYFARTH
Joined: 01 Jul 2006 Posts: 1054
|
Posted: Wed Oct 07, 2015 6:08 am Post subject: Question about stackcheck, and $Framesize Variability? |
|
|
Hello all,
I am using an ATMEGA1284. It does two basic things:
1. Talk to a Si4460 radio part - with interrupts
2. Talk to a PC using RS485 at 9600 bps, and am using the built in UART code
I have noticed that one or more variable is changed, seemingly spontaneously. I have not been able to reproduce the problem at will, but I have seen it occur on more than one occasion. I do not know where the problem is, but among other things I am looking at is the settings for $hwstack, $swstack and/or $framesize.
In this part, there is TONS of RAM available, both application space ( I use less than 25%) and RAM. My initial settings were:
Code: |
$hwstack = 7000 '8098 '8000 '8098 '1600 '100 '160 '176 '192 '208 '224 '240 '296 '256 '128
$swstack = 2048 '263 '240 '128 '34 'Calculated to 18 + 4= 22 but set at 32 85 '128 '160 '128
$framesize = 2048 '263 '240 '128 '40 '80 'calculated BaseFramSize=24 + 9 + 4 = 37 *2 = 74
|
Today, I included $lib "stackcheck.lib", and added the code to the m[/code]ain loop. The first round stackcheck output, using the above settings were these:
Code: |
_hw_lowes = 16597
HW stack needed : 42
_fw_highest= 5580
Frame space needed : 2013
_sw_lowest = 9614
SW stack needed : 25
|
I changed the settings to these, since I reasoned that it needed more $Framesize than other.
Code: |
$hwstack =3072 '7000
$swstack = 3072 '2048
$framesize =4096 '2048
|
I tried again, and got these outputs:
Code: |
HWSTACK:16593
Frame:5564
SWSTACK:13247
_hw_lowes = 16593
HW stack needed : 46
_fw_highest= 5564
Frame space needed : 4351
_sw_lowest = 13247
SW stack needed : 29
|
So then I changed the settins again, to:
Code: |
$hwstack = 1024 '3072 '7000
$swstack = 1024 '3072 '2048
$framesize =6144 '4096 '2048
|
... I misplaced these results However, the $Framesize DID track the increase.
Next I used these
Code: |
$hwstack = 1998 '1024 '3072 '7000
$swstack = 1998 '1024 '3072 '2048
$framesize = 7118 '6144 '4096 '2048
|
and got:
Code: |
HWSTACK:16595
Frame:5564
SWSTACK:14614
_hw_lowes = 16595
HW stack needed : 44
_fw_highest= 5564
Frame space needed : 7081
_sw_lowest = 14614
SW stack needed : 27
|
Note in each case, the $framesize grew to near the new limit. This is not what I expected at all, I thought that hardware size would need the most, and never guess that the framesize would need significant size.
I am not sure if this is due to my use of the tool, or something else. In each case, the only change was to the compiler directive, and the app was allowed to run for a reasonable amount of time to be sure that the stackcheck output is correct.
Can anyone offer any insight into what I am seeing, and best way to proceed with regard to the stack size settings.
Thanks,
Tim
(BASCOM-AVR version : 2.0.7.8 ) |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Wed Oct 07, 2015 8:58 am Post subject: |
|
|
Tim
you can best write to support, i have a beta that will show the stack settings in the explorer. that is, the settings for the basic code, not taking into account recursive functions and the asm libs(yet).
you will see that normally these values are low. but framesize : this can become huge when you do not free memory. for example when a sub routine that passed a parameter is jumped out with a goto.
when you send the code (zipped) i will have a look at that. the new code explorer is supposed to find these problems too so it is a good check. _________________ Mark |
|
Back to top |
|
|
TSEYFARTH
Joined: 01 Jul 2006 Posts: 1054
|
Posted: Wed Oct 07, 2015 5:13 pm Post subject: |
|
|
Hi Mark,
Will do.
Tim |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|