gnupic: Questions about SDCC PIC code gen
Subject:
Re: Questions about SDCC PIC code gen
From:
matt ####@####.####
Date:
22 Oct 2002 04:40:49 -0000
Message-Id: <200210221437.18353.matt@dsp.com.au>
They both look like 'real' bugs to me..
What does anyone else think???
I've marked the dodgy bits with a string ogf '#############'s.
On Tue, 22 Oct 2002 2:14 pm, you wrote:
> on 10/21/02 7:27 PM, matt at ####@####.#### wrote:
>
> > Can you give us, say, the 5 preceding assembly instructions and the 5
> > following. Thanks.
>
> Sure! I only limited it because it was on a different computer, and I was
> typing it all in. Here's the actual code, copy/pasted. I've put both the C
> and the ASM, but I left out all of the equates. BTW, I also don't get proper
> code for setting the global gIRState variable.
>
>
> -----------------------
>
> #include "p16f877.h"
>
>
> typedef unsigned char UInt8;
>
>
> void InitPorts();
>
>
> UInt8 gIRState = 0;
>
>
> void
> main()
> {
> InitPorts();
> PORTD = 0xA;
> }
>
> void
> InitPorts()
> {
> // Clear GIE
>
> do
> {
> GIE = 0;
> } while (GIE != 0);
>
> TRISD = 0;
>
> // Clear all our program registers
>
> gIRState = 1;
> }
>
> -----------------------
>
> ORG 0
> ;--------------------------------------------------------
> ; interrupt vector
> ;--------------------------------------------------------
> ; .area CSEG (CODE)
> ;__interrupt_vect:
> ; ljmp __sdcc_gsinit_startup
> ; reti
> ; .ds 7
> ; reti
> ; .ds 7
> ; reti
> ; .ds 7
> ; reti
> ; .ds 7
> ; reti
> ; .ds 7
> ; reti
> ; .ds 7
> ;--------------------------------------------------------
> ; global & static initialisations
> ;--------------------------------------------------------
> ; .area GSINIT (CODE)
> ; .area GSFINAL (CODE)
> ; .area GSINIT (CODE)
> __sdcc_gsinit_startup:
> ; .area GSFINAL (CODE)
> ; ljmp __sdcc_program_startup
> ;--------------------------------------------------------
> ; code
> ;--------------------------------------------------------
> ; .area CSEG (CODE)
> ;***
> ; pBlock Stats: dbName = D
> ;***
> ;; Starting pCode block
> ;***
> ; pBlock Stats: dbName = M
> ;***
> ;entry: _main ;Function start
> ; 2 exit points
> ;has an exit
> ;functions called:
> ; _InitPorts
> ; _InitPorts
> ;; Starting pCode block
> _main ;Function start
> ; 2 exit points
> ;#CSRC test.c 16
> ; InitPorts();
> CALL _InitPorts
> ;#CSRC test.c 17
> ; PORTD = 0xA;
> MOVLW 0x0a
> MOVWF _PORTD
> RETURN
> ; exit point of _main
> ;***
> ; pBlock Stats: dbName = C
> ;***
> ;entry: _InitPorts ;Function start
> ; 2 exit points
> ;has an exit
> ;; Starting pCode block
> _InitPorts ;Function start
> ; 2 exit points
> ;#CSRC test.c 27
##############HERE####################
> ; GIE = 0;
> BCF (_GIE >> 3), (_GIE & 7)
> BSF _STATUS,5
###################################
> ;#CSRC test.c 30
> ; TRISD = 0;
> CLRF _TRISD
> ;#CSRC test.c 34
################AND HERE###############
> ; gIRState = 1;
> MOVLW 0x01
#####################################
> BCF _STATUS,5
> RETURN
> ; exit point of _InitPorts
> end
>
>
> --
> Rick
>
>
>
DSP Systems (a division of SPC-Ardmona Limited). [MMII]