> > > So a max depth of 2, from serial_hardware usage. So where does 5 come from > ? I can remember something about stack usage and ISR, where stack levels > aren't being considered,... oh I can't remember :) What I mean is this "5 of > 8" might actually be "2 of 8", according to the debug comments. > > I'll give a better search on this. >
OK, this is the opposite, according to Kyle ( http://tech.groups.yahoo.com/group/jallist/message/25984), the "call stack" debug information does not take ISR calls into account. And the "Hardware stack depth 5 of 8" really is what must be considered. So I tried to directly call user's callback in ISR (just for testing purpose, no working code), and stack remains at 5. I also tried to remove "pragma inline" to see what happens: stack grows to 6. So these "pragma inline" works as expected. And now I wonder where does this 5 come from... serial_hw_write in i2c_hw_slave_on_error() callback are responsible for 1 stack level (removing them gives "4 of 8"). As far I can count, there are: - 1 stack level for ISR itself - 1 more stack level in some states (call to i2c_hw_slave_write_i2c()) and that's all... Missing: 3 stack levels... Kyle also mentioned "intrinsic functions" like "multiply or divide are really subroutines, therefore cause a stack level.". Maybe there are some of those. [edit] some more information: removing serial_hardware lib, stack falls to "3 of 8" !!! Reading some asm code (too cryptic for me since I start using jal), I still can see in serial_hw_write() (see asm body for serial_hw_write), some weird calls to "l__pic_stkpush" or "l__pic_stkpop" ??? What's that ? I'm continuing my stack level hunt: remove "include i2c_hw_slave_isr", stack falls to "1 of 8". This "1" is due to "i2c_hw_slave_init()" call. So if you remove "i2c_hw_slave_init()", and keep "include i2c_hw_slave_isr", you'll have a "2 of 8" stack usage. Well, guys, I'm sorry this is can be very cryptic reading this :) What I mean, to sum up, is: - using i2c_hw_slave_isr with "pragma inline" uses 2 stack levels: one for isr, another for i2c read/write calls. You can't be shorter than that... - serial_hardware consumes some stack levels, I can't see why Seb -- Sébastien Lelong http://www.sirloon.net http://sirbot.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jallib?hl=en -~----------~----~----~----~------~----~------~--~---
