gnupic: [PATCH] Bad warning for BRA on 16F code
Subject:
Re: [PATCH] Bad warning for BRA on 16F code
From:
Borut ####@####.####
Date:
24 Jul 2013 10:57:55 -0000
Message-Id: <51EFB2F4.4060607@gmail.com>
Fixed in svn revision #984.
The gputils snapshot build source package is available at
http://sourceforge.net/projects/gputils/files/snapshot_builds/src/gputils-src-20130724-984.tar.gz.
Windows 32bit setup package is at
http://sourceforge.net/projects/gputils/files/snapshot_builds/i686-mingw32msvc/gputils-20130724-984-setup.exe.
Borut
On 22. 07. 2013 20:04, Tamas Rudnai wrote:
> Not really, mid-range PICs have 14-bit word sizes and they use word
> addressing, not byte addressing. In the other hand 18F (otherwise known as
> high-performance) has 16bit program memory storage and can be addressed at
> byte level, therefore the 16bit word alignment is required (but as far as I
> know you cannot even load uneven addresses using BRA or GOTO, as with BRA
> the address is encoded in a '2n' way so it is sifted left, and in GOTO the
> bit 0 is ignored from the given address).
>
> 16f1518 is an enhanced-mid-range, it has 14bit size words, addresses
> program memory by words, not bytes, and does not require alignments.
>
> Tamas
>
>
> On 22 July 2013 09:54, mengjin su ####@####.#### wrote:
>
>> In Hex output, PIC always uses byte address.
>> In assembly language, those trivial things happen all the time.
>>
>>
>>> From: ####@####.####
>>> To: ####@####.####
>>> Subject: [PATCH] Bad warning for BRA on 16F code
>>> Date: Sun, 21 Jul 2013 22:05:03 -0600
>>>
>>> I have found a warning that I believe is wrong. I am assembling for
>> 16f1508 and I am
>>> getting a warning for a branch to a label with an odd address. Here is
>> the test code:
>>>> cat bad.asm
>>> LIST P=PIC16F1518
>>> include p16f1518.inc
>>>
>>> org 0x000
>>>
>>> bra main
>>> ; nop
>>> main: goto main
>>>
>>> end
>>>
>>>> gpasm -c bad.asm ; gplink -o bad.hex bad.o
>>> message: using default linker script
>>> "/usr/home/install/gputils/share/gputils/lkr/16f1518_g.lkr"
>>> warning: destination address must be word aligned at 0 of section
>> ".org_0"
>>> If I add a nop instruction to make the destination even, there is no
>> warning.
>>> I understand that pic18 uses byte addressing, where 12f and 16f use word
>> addresses, so
>>> pic18 destinations should always be even. With that in mind, I made this
>> patch:
>>> %diff -u libgputils/gpcofflink.c.orig libgputils/gpcofflink.c
>>> --- libgputils/gpcofflink.c.orig 2013-07-10 22:00:41.000000000
>> -0600
>>> +++ libgputils/gpcofflink.c 2013-07-21 21:42:21.000000000 -0600
>>> @@ -1415,6 +1415,7 @@
>>> break;
>>>
>>> case RELOCT_BRA:
>>> + if (class != &proc_class_pic14e)
>>> if (value & 1) {
>>> gp_warning("destination address must be word aligned at %#x of
>> section \"%s\"",
>>> org, section->name);
>>>
>>> I don't know if this patch is the right way to fix the error, but I hope
>> it is useful.
>>> Thanks!
>>> -Richard
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ####@####.####
>>> For additional commands, e-mail: ####@####.####
>>>
>>
>
>