Hi,

I've got a problem with SDCC for the PIC16F8722, and I'm willing to submit 
patches, if there's a reasonably quick fix for this. The following code snippet 
reveals the problem:

#include <pic18fregs.h>
#include <usart.h>

void putchar (char c) __wparam
{
        while(usart_busy() != 0);
        usart_putc(c);
}

void main()
{
    char text[] = {'D', 'u', 'c', 'k'};
    char *ptr;
    
    usart_open(USART_TX_INT_OFF & USART_RX_INT_OFF & USART_BRGH_HIGH &
               USART_EIGHT_BIT & USART_ASYNCH_MODE, 64);

    while(1)
    {
        ptr = text;
        putchar(*ptr);  // Prints garbage
        
        putchar(*text); // Prints "D"
    }
}

I've been looking at disassemblies, and stepping through the code and the 
problem seems to focus around _gptrget1. I'm not sure that the parameters are 
being correctly loaded for it.

It seems that support for PIC16F8722 is very new. It's only present in SVN - no 
official release yet. Is it still immature? Is there anything fundamental 
standing in the way of supporting it better? I ran a "make test-pic16" in the 
regression tests, and almost all of those passed. Would that have tested the 
8722? or only other PICs? I guess not, because gpsim doesn't appear to support 
the 8722.

I'm using MPLAB to program the hardware with an ICD2. Usually I import a hex 
file, but if I import the cod file into MPLAB, it pops up the message "The 
Extended CPU Mode configuration bit is enabled, but the program that was loaded 
was not built using extended CPU instructions. Therefore, your code may not 
work properly."

Is that relevant at all?

What do you think?
Joel



This message should be regarded as confidential. If you have received this 
email in error please notify the sender and destroy it immediately.
Statements of intent shall only become binding when confirmed in hard copy by 
an authorised signatory.  The contents of this email may relate to dealings 
with other companies within the Detica Limited group of companies.

Detica Limited is registered in England under No: 1337451.

Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, England.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to