gnupic: Re: [gnupic] Re: GPAL, GPLINK and __CONFIG
Subject:
Re: [gnupic] Re: GPAL, GPLINK and __CONFIG
From:
Shaun ####@####.####
Date:
13 Apr 2005 21:18:11 +0100
Message-Id: <425D7E66.8060109@cam.ac.uk>
Hi,
I've attached a sample file that generates the assertion, without the
variable declaration it doesn't.
"gpal -v" gives "gpal-0.13.0 pre-alpha"
$ gpal temp.pal temp.pub p16f877a.pub
message: using default linker script "/usr/share/gputils/lkr/16f877a.lkr"
gplink: gpcofflink.c:1393: gp_cofflink_patch_addr: Assertion
`current_value & 0x80000000' failed.
I tried using the CVS version but its linking seems to be broken at the
moment. (complains about duplicate declarations -- from reading your
prev. post I think you're aware anyway.)
Also, I tried using the uint16 and uint32 types but neither seem to work
(made a simple delay loop using "for i in 0 to 0xff loop null; end
loop;", works fine if i is a uint8 but either loops infinitely or
crashes the pic if i is a uint16 or 32). I can send my test file if you
want.
-Shaun
Craig Franklin wrote:
> Shaun wrote:
>
>> Hi,
>>
>> I've been playing with GPAL on an 16F877A -- I need to set __CONFIG
>> _RC_OSC as I don't have a crystal handy. I've tried the following
>> methods but only the final one worked:
>>
>> (1) add an 'asm' block to my main function containing __CONFIG _RC_OSC
>> -- fails in the linker with:
>> gplink: gpcofflink.c:1359: gp_cofflink_patch_addr: Assertion
>> `current_value & 0x80000000' failed.
>> Aborted
>>
>>
>>
> This can be made to work, but I wouldn't recommend it. Asm blocks are
> only valid within subprograms. The config creates a separate section,
> putting it in the middle of your code section can cause problems.
>
> Not sure what caused the assertion. Send be the file and I will
> figure it out.
>
>> (2) run "gpal -S" then manually add the __CONFIG line and then run gpasm
>> and gplink -- works (although gplink segfaults on completion it creates
>> the output file before this happens).
>>
>>
>>
>
> Don't do that either. Modifying output files is error prone and
> difficult to maintain.
>
> Again I don't know what is causing the segfault. I need the version
> you are using and an example.
>
>> The difference seems to be that adding __CONFIG in the pal file adds the
>> line after the
>>
>> ".code_main code
>> _main_prog_address:
>> global _main_prog_address
>> ; procedure main.main
>> main.main:"
>>
>> chunk. While when I add it by hand I put it right after the include
>> p16f877a.inc line.
>>
>> Could a pragma be added to set the __CONFIG fuses or is there another
>> way of doing it in/outside of gpal that isn't so laborious? An
>> alternative would be to allow adding an asm block that would be put in
>> above the code for example.
>>
>>
>>
> The plan is to add a pragma. For now I recommend putting the config
> in a separate asm file. Assemble it and add it to the link list.
>
>> -Shaun
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ####@####.####
>> For additional commands, e-mail: ####@####.####
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####
>
module temp is
procedure main is
i:uint8;
begin
asm
__CONFIG _RC_OSC & _PWRTE_ON & _BODEN_OFF & _CP_OFF & _WDT_OFF
end asm;
i=1;
i=i+1;
end procedure;
end module;
public temp is
pragma processor="p16f877a";
with p16f877a;
end public;