Hello,
You should test both ways.
As far as the way your program functions, you are right, both __code and const
will look the same to your program. Both will be constant values that can't be
changed.
Look at the assembly listing and the memory map files. You will see a
difference in the amount of code memory and of ram memory.
While you are doing some testing, also test the effects of __data, __idata,
__xdata, and __pdata, on your memory map and code size.
Happy holidays to you too!
Rich.
--- On Mon, 12/24/12, feqin fan <feqin1...@gmail.com> wrote:
From: feqin fan <feqin1...@gmail.com>
Subject: Re: [Sdcc-user] can sdcc PIC14 generate code which can load value from
ROM(placed for idata directive) to RAM in startup?
To: sdcc-user@lists.sourceforge.net
Date: Monday, December 24, 2012, 6:08 AM
I dont test it ,but I think the
-------------------------------------------------------------------------
__code unsigned char a[4] = {0x12, 0x13, 0x14, 0x15};
shoule be same as:
const unsigned char a[4] = {0x12, 0x13, 0x14, 0x15};
---------------------------------------------------------------------------
Merry Christmas :-)
圣诞快乐.
2012/12/22 Gál Zsolt <tralitove...@freemail.hu>
Hello,
You can find in the SDCC documentation a modifier. It is __code ( with
two underscore ).
So you can try this example and see what is the different form your
original code:
------------------------------------------------------------------------------------------
#include<pic16f887.h>
__code unsigned char a[4] = {0x12, 0x13, 0x14, 0x15};
int main() {
PORTA = a[2];
return 0;
}
-------------------------------------------------------------------------------------------
2012/12/21 feqin fan <feqin1...@gmail.com>:
> ------------------------------------------------------------------------------------------
> #include<pic16f887.h>
> unsigned char a[4] = {0x12, 0x13, 0x14, 0x15};
>
> int main() {
> PORTA = a[2];
> return 0;
> }
> -------------------------------------------------------------------------------------------
--
~~~~~~~~~~~~~~~~
http://galzsolt.zzl.org
_____
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user