[PicForth] Large amounts of text seem to cause PicForth
to generate bad code - updated
Alex Holden
alex at linuxhacker.org
Thu Dec 2 16:32:34 CET 2004
I've made some progress in narrowing this bug down. The problem seems to
be that the yield word in multitasker.fs generates bad code once the
amount of program memory in use gets above 2K. I think it's probably
just missing out the bank selects but I really don't understand how
multitasker.fs works so I'm not sure how to fix it. The large amounts of
text thing was a red herring- I believe an equal amount of instruction
code would have caused the same problem to appear.
Here's an example task:
task : alarm begin [char] a emit yield again ;
And here's the generated code:
; name: alarm
; max return-stack depth: 3
0x07B2 3061 movlw 0x61
0x07B3 20BB call 0x0BB ; emit (rs depth: 2)
0x07B4 3007 movlw 0x07
0x07B5 00BF movwf 0x3F
0x07B6 30B8 movlw 0xB8
0x07B7 2927 goto 0x127 ; flash-write + 0x001
0x07B8 2FB2 goto 0x7B2 ; alarm (rs depth: 3)
In fact 0x127 is not flash-write + 0x001 (it's in the middle of a word
called /mod) and it's not part of the code generated by 'multitasker' -
that is at around 0x927 ie. 0x800 (2K) higher than the generated address.
--
------------ Alex Holden - http://www.linuxhacker.org ------------
If it doesn't work, you're not hitting it with a big enough hammer
More information about the PicForth
mailing list