The coredump is strange indeed. The stack use thing has to do with compiler optimisation. When an isr is simple, it does not save all possible registers. But when the isr is more complex, it does: call l__pic_stkpush
Iirc correct, the compiler also makes procedures and functions re-entrant when they are called both from level0 and isr-level. And about stack level use analysis: as I said, it would be nice if we had an overview of the worst cases. The assembler file should be a good base to do this and I thought about it quite a few times too (to build in perl, that is). But I did not come to it yet. I'll give it some thought (it is in my head now), but I have quite a lot of projects going and my holiday ends tomorrow :( Joep Joep 2009/1/4, Sebastien Lelong <[email protected]>: > > > > > > > > > > > > > > - serial_hardware consumes some stack levels, I can't see why > > > Noticed that too. > > > > > > And I noticed other very bizarre things... I'll post some more. > > When compiling 16f88_serial_hw_echo.jal, it gives "2 of 8" stack usage: init > call + calculate procedure. So far so good. Now, take this sample, derived > from echo one: > > > procedure isr() is > pragma interrupt > > if serial_hw_read(char) > then > serial_hw_write(char) -- that's the echo... > end if > end procedure > > forever loop > end loop > > (see attachment, dummy_isr.jal) > > I just put the echo logic in an ISR. This is not a functional code, just to > test compilation. Now compile it, and it gives "5 of 8" stack usage ! Where > it should give "3 of 8" (+1 for ISR) right ? > > More, the serial_hw_write looks like this: > > > procedure serial_hw_write(byte in data) is > -- wait until TXREG is empty > while ! PIR1_TXIF loop end loop > -- then put new byte in TXREG (prepare for transmission) > TXREG = data > end procedure > > > Now, comment "TXREG = data" in the lib (or the "while" line), and compile > the contrived ISR echo sample... Core dumped !!! And it does not core dumps > on original sample. serial_hw_read is ok, you can comment all the body's > function, it just compiles ok. > > Bizarre, very bizarre. Maybe some ninja or guru could help. I know all those > aren't real tests, this is not functional code, but I think you'll agree > there's something nasty behind this, behind serial_hw_write... > > > Cheers, > 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 -~----------~----~----~----~------~----~------~--~---
