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 <[email protected]> wrote:

From: feqin fan <[email protected]>
Subject: Re: [Sdcc-user] can sdcc PIC14 generate code which can load value from 
ROM(placed for idata directive) to RAM in startup?
To: [email protected]
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 <[email protected]>

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 <[email protected]>:

> ------------------------------------------------------------------------------------------

>     #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
[email protected]
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to