gnupic: Re: [gnupic] Re: GPAL, GPLINK and __CONFIG


Previous by date: 15 Apr 2005 02:51:09 +0100 Re: question, Craig Franklin
Next by date: 15 Apr 2005 02:51:09 +0100 Re: [gnupic] Max symbol size for gpasm, Craig Franklin
Previous in thread: 15 Apr 2005 02:51:09 +0100 Re: [gnupic] Re: GPAL, GPLINK and __CONFIG, Shaun
Next in thread:

Subject: Re: [gnupic] Re: GPAL, GPLINK and __CONFIG
From: Craig Franklin ####@####.####
Date: 15 Apr 2005 02:51:09 +0100
Message-Id: <42606F82.7080207@users.sourceforge.net>

Shaun wrote:

>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.
>
>  
>
1.  gplink segfaults because of a malformed object file.  A relocation 
address was beyond the end of the section.  gplink will now generate an 
error in this condition.

2.  gpasm generates the malformed object because it fails to generate an 
error when a config section is in the middle of a code section.  It now 
generates an error.

3.  gpal puts the config section there because your source told it to.  
Put the config in an asm file.  Assembly it then link it with the gpal 
objects.

>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.)
>
>  
>
It is not the linking.  The processor file contents have changed.  Add a 
"with pic;" to your code and add the processor file to the command line.

>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.
>
>  
>
Not necessary.

>-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: ####@####.####
>>
>>    
>>
>
>  
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ####@####.####
>For additional commands, e-mail: ####@####.####
>


Previous by date: 15 Apr 2005 02:51:09 +0100 Re: question, Craig Franklin
Next by date: 15 Apr 2005 02:51:09 +0100 Re: [gnupic] Max symbol size for gpasm, Craig Franklin
Previous in thread: 15 Apr 2005 02:51:09 +0100 Re: [gnupic] Re: GPAL, GPLINK and __CONFIG, Shaun
Next in thread:


Powered by ezmlm-browse 0.20.