I am not familiar with the pic16 port, if you really think it is a bug, please
create a ticket on http://sourceforge.net/p/sdcc/bugs/
在2015年05月14 01时32分, "Kustaa Nyholm"<kustaa.nyh...@planmeca.com>写道:
Hi,
I've been tracking a wierd problem, 100% repeatable although the
failures vary.
I'm using:
/Users/nyholku/sdcc-3.4.0/bin/sdcc -v
SDCC :
mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc0
8/s08/stm8 3.4.0 #8981 (Apr 5 2014) (Mac OS X i386)
published under GNU General Public License (GPL)
with PIC18F4550
I've tracked the problem down to these four innocent looking statements
in my interrupt routine:
steppers[0].probePosition = steppers[0].position;
steppers[1].probePosition = steppers[1].position;
steppers[2].probePosition = steppers[2].position;
steppers[3].probePosition = steppers[3].position;
If I comment these out, then all the weird symptoms I've been having
disappear.
The '.probePosition' and '.position' are both 32 bit ints.
Looking at the generated code I see that the compiler generates code:
00438 ; .line 86; stepperirq.c
steppers[0].probePosition = steppers[0].position;
000086 C??? F??? 00439 MOVFF (_steppers + 7), r0x00
00008A C??? F??? 00440 MOVFF (_steppers + 8), r0x01
00008E C??? F??? 00441 MOVFF (_steppers + 9), r0x02
000092 C??? F??? 00442 MOVFF (_steppers + 10), r0x03
000096 50?? 00443 MOVF r0x00, W
000098 ???? 00444 BANKSEL (_steppers + 24)
00009A 6F?? 00445 MOVWF (_steppers + 24), B
00009C 50?? 00446 MOVF r0x01, W
00447 ; removed redundant BANKSEL
00009E 6F?? 00448 MOVWF (_steppers + 25), B
0000A0 50?? 00449 MOVF r0x02, W
00450 ; removed redundant BANKSEL
0000A2 6F?? 00451 MOVWF (_steppers + 26), B
0000A4 50?? 00452 MOVF r0x03, W
00453 ; removed redundant BANKSEL
0000A6 6F?? 00454 MOVWF (_steppers + 27), B
which uses the r0x00 etc variables which the compiler defines like:
00320 .registers udata_ovr 0x0000
000000 00321 r0x00 res 1
000001 00322 r0x01 res 1
000002 00323 r0x02 res 1
000003 00324 r0x03 res 1
Somewhere in the back of my mind I seem to recall that 'udata_ovr'
may cause problems if used both in main program and interrupt code.
My interrupt is defined as:
#pragma save
#pragma nojtbound
#pragma nooverlay
void stepperirq() __interrupt(1) {
in order to avoid overlaying.
So could this (use of overlaid compiler generated temp variables in
interrupt
and main program be a problem)???
br Kusti
This e-mail may contain confidential or privileged information. If you are not
the intended recipient (or have received this e-mail in error) please notify
the sender immediately and destroy this e-mail. Any unauthorized copying,
disclosure or distribution of the material in this e-mail is strictly
forbidden. We will not be liable for direct, indirect, special or consequential
damages arising from alteration of the contents of this message by a third
party or as a result of any virus being passed on or as of transmission of this
e-mail in general.
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user