From: feqin f. <feq...@gm...> - 2012-12-21 07:03:50
|
Hello,everyone. just like the title. I write C code like this: ------------------------------------------------------------------------------------------ #include<pic16f887.h> unsigned char a[4] = {0x12, 0x13, 0x14, 0x15}; int main() { PORTA = a[2]; return 0; } ------------------------------------------------------------------------------------------- the generated asmbler file is: ------------------------------------------------------------------------------------------- ID_a_0 idata _a db 0x12 db 0x13 db 0x14 db 0x15 STARTUP code 0x0000 nop pagesel __sdcc_gsinit_startup goto __sdcc_gsinit_startup code_a code _main BANKSEL _a MOVF (_a + 2),W BANKSEL _PORTA MOVWF _PORTA ; .line 1806; "a.c" return 0; MOVLW 0x00 MOVWF STK00 MOVLW 0x00 RETURN ; exit point of _main end ------------------------------------------------------------------------------- in the manual of gputils for the directive IDATA have this "Data memory is alllocated and the initialization data is placed in ROM, The user must provide the code to load the data into memory" so , just like the title can sdcc generate code which can load value from ROM(placed for idata directive) to RAM in startup? if have Where is the source code doing this LOAD? if not ,How can i do this? Another, in SDCC PIC14 the *pic16f887.lib* doing what? and how it come from? how can i compile to get it by myself? What does it contain? Thanks, guys.. -- *live long and prosper..* |
From: Borut R. <bor...@gm...> - 2012-12-21 08:07:28
|
> if have Where is the source code doing this LOAD? > if not ,How can i do this? See device/lib/pic14/libsdcc/idata.c > Another, in SDCC PIC14 the *pic16f887.lib* doing what? > and how it come from? how can i compile to get it by myself? > What does it contain? See device/non-free/lib/pic14/libdev/pic16f887.c Borut On 21. 12. 2012 08:03, feqin fan wrote: > Hello,everyone. > just like the title. > I write C code like this: > ------------------------------------------------------------------------------------------ > #include<pic16f887.h> > unsigned char a[4] = {0x12, 0x13, 0x14, 0x15}; > > int main() { > PORTA = a[2]; > return 0; > } > ------------------------------------------------------------------------------------------- > the generated asmbler file is: > ------------------------------------------------------------------------------------------- > ID_a_0 idata > _a > db 0x12 > db 0x13 > db 0x14 > db 0x15 > > STARTUP code 0x0000 > nop > pagesel __sdcc_gsinit_startup > goto __sdcc_gsinit_startup > > code_a code > > _main > BANKSEL _a > MOVF (_a + 2),W > BANKSEL _PORTA > MOVWF _PORTA > ; .line 1806; "a.c" return 0; > MOVLW 0x00 > MOVWF STK00 > MOVLW 0x00 > RETURN > ; exit point of _main > > end > ------------------------------------------------------------------------------- > in the manual of gputils for the directive IDATA have this "Data > memory is alllocated and the initialization data is placed in ROM, > The user must provide the code to load the data into memory" > so , just like the title can sdcc generate code which can load value > from ROM(placed for idata directive) to RAM in startup? > > if have Where is the source code doing this LOAD? > if not ,How can i do this? > > Another, in SDCC PIC14 the *pic16f887.lib* doing what? > and how it come from? how can i compile to get it by myself? > What does it contain? > > Thanks, guys.. > > -- > *live long and prosper..* > > > ------------------------------------------------------------------------------ > 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 > Sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-user |
From: feqin f. <feq...@gm...> - 2012-12-21 10:02:39
|
I have found the file, but how the compiler automatically insert into the ASM file? I compiled the sdcc in the VS10.0 by myself. I have read a lot of the source code. So please tell me more details.. And how can I get a right version that can generate the load code(using the idata.c) before startup. Thank you, very much. 2012/12/21 Borut Ražem <bor...@gm...> > > if have Where is the source code doing this LOAD? > > if not ,How can i do this? > > See device/lib/pic14/libsdcc/idata.c > > > > Another, in SDCC PIC14 the *pic16f887.lib* doing what? > > and how it come from? how can i compile to get it by myself? > > What does it contain? > > See device/non-free/lib/pic14/libdev/pic16f887.c > > Borut > > > On 21. 12. 2012 08:03, feqin fan wrote: > > Hello,everyone. > just like the title. > I write C code like this: > > ------------------------------------------------------------------------------------------ > #include<pic16f887.h> > unsigned char a[4] = {0x12, 0x13, 0x14, 0x15}; > > int main() { > PORTA = a[2]; > return 0; > } > > ------------------------------------------------------------------------------------------- > the generated asmbler file is: > > ------------------------------------------------------------------------------------------- > ID_a_0 idata > _a > db 0x12 > db 0x13 > db 0x14 > db 0x15 > > STARTUP code 0x0000 > nop > pagesel __sdcc_gsinit_startup > goto __sdcc_gsinit_startup > > code_a code > > _main > BANKSEL _a > MOVF (_a + 2),W > BANKSEL _PORTA > MOVWF _PORTA > ; .line 1806; "a.c" return 0; > MOVLW 0x00 > MOVWF STK00 > MOVLW 0x00 > RETURN > ; exit point of _main > > end > > ------------------------------------------------------------------------------- > in the manual of gputils for the directive IDATA have this "Data memory is > alllocated and the initialization data is placed in ROM, > The user must provide the code to load the data into memory" > so , just like the title can sdcc generate code which can load value from > ROM(placed for idata directive) to RAM in startup? > > if have Where is the source code doing this LOAD? > if not ,How can i do this? > > Another, in SDCC PIC14 the *pic16f887.lib* doing what? > and how it come from? how can i compile to get it by myself? > What does it contain? > > Thanks, guys.. > > -- > *live long and prosper..* > > > ------------------------------------------------------------------------------ > 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 delivershttp://p.sf.net/sfu/logmein_12329d2d > > > > _______________________________________________ > Sdcc-user mailing lis...@li...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 > Sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-user > > -- *live long and prosper..* |
From: feqin f. <feq...@gm...> - 2012-12-21 10:03:30
|
I compiled the sdcc using Microsoft VS10.0 by myself. 2012/12/21 feqin fan <feq...@gm...> > I have found the file, but how the compiler automatically insert into the > ASM file? > I compiled the sdcc in the VS10.0 by myself. > I have read a lot of the source code. So please tell me more details.. > And how can I get a right version that can generate the load code(using > the idata.c) before startup. > > Thank you, very much. > > > > 2012/12/21 Borut Ražem <bor...@gm...> > >> > if have Where is the source code doing this LOAD? >> > if not ,How can i do this? >> >> See device/lib/pic14/libsdcc/idata.c >> >> >> > Another, in SDCC PIC14 the *pic16f887.lib* doing what? >> > and how it come from? how can i compile to get it by myself? >> > What does it contain? >> >> See device/non-free/lib/pic14/libdev/pic16f887.c >> >> Borut >> >> >> On 21. 12. 2012 08:03, feqin fan wrote: >> >> Hello,everyone. >> just like the title. >> I write C code like this: >> >> ------------------------------------------------------------------------------------------ >> #include<pic16f887.h> >> unsigned char a[4] = {0x12, 0x13, 0x14, 0x15}; >> >> int main() { >> PORTA = a[2]; >> return 0; >> } >> >> ------------------------------------------------------------------------------------------- >> the generated asmbler file is: >> >> ------------------------------------------------------------------------------------------- >> ID_a_0 idata >> _a >> db 0x12 >> db 0x13 >> db 0x14 >> db 0x15 >> >> STARTUP code 0x0000 >> nop >> pagesel __sdcc_gsinit_startup >> goto __sdcc_gsinit_startup >> >> code_a code >> >> _main >> BANKSEL _a >> MOVF (_a + 2),W >> BANKSEL _PORTA >> MOVWF _PORTA >> ; .line 1806; "a.c" return 0; >> MOVLW 0x00 >> MOVWF STK00 >> MOVLW 0x00 >> RETURN >> ; exit point of _main >> >> end >> >> ------------------------------------------------------------------------------- >> in the manual of gputils for the directive IDATA have this "Data memory >> is alllocated and the initialization data is placed in ROM, >> The user must provide the code to load the data into memory" >> so , just like the title can sdcc generate code which can load value from >> ROM(placed for idata directive) to RAM in startup? >> >> if have Where is the source code doing this LOAD? >> if not ,How can i do this? >> >> Another, in SDCC PIC14 the *pic16f887.lib* doing what? >> and how it come from? how can i compile to get it by myself? >> What does it contain? >> >> Thanks, guys.. >> >> -- >> *live long and prosper..* >> >> >> ------------------------------------------------------------------------------ >> 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 delivershttp://p.sf.net/sfu/logmein_12329d2d >> >> >> >> _______________________________________________ >> Sdcc-user mailing lis...@li...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 >> Sdc...@li... >> https://lists.sourceforge.net/lists/listinfo/sdcc-user >> >> > > > -- > *live long and prosper..* > -- *live long and prosper..* |
From: Borut R. <bor...@gm...> - 2012-12-21 10:36:42
|
On 21. 12. 2012 11:02, feqin fan wrote: > I have found the file, but how the compiler automatically insert into > the ASM file? It doesn't. The idata.o, included in sdcc.lib, is linked with your program by gplink during the linking phase. Compiling the c program is actually done is several steps: - preprocessing by sdcpp (input: c source code, output: preprocessed c code; sdcc -E) - code generation by sdcc (input: preprocessed c code, output: asm file; sdcc -S) - assebling by gpasm (input: asm file, output: object file; sdcc -c) - linking by gplink (input: object files, output: binary (hex) file) All steps are performed by the sdcc front end. You can see the steps if you invoke sdcc with -V option. Borut > I compiled the sdcc in the VS10.0 by myself. > I have read a lot of the source code. So please tell me more details.. > And how can I get a right version that can generate the load > code(using the idata.c) before startup. > > Thank you, very much. > > > 2012/12/21 Borut Ražem <bor...@gm... > <mailto:bor...@gm...>> > > > if have Where is the source code doing this LOAD? > > if not ,How can i do this? > > See device/lib/pic14/libsdcc/idata.c > > > > Another, in SDCC PIC14 the *pic16f887.lib* doing what? > > and how it come from? how can i compile to get it by myself? > > What does it contain? > > See device/non-free/lib/pic14/libdev/pic16f887.c > > Borut > > > On 21. 12. 2012 08:03, feqin fan wrote: >> Hello,everyone. >> just like the title. >> I write C code like this: >> ------------------------------------------------------------------------------------------ >> #include<pic16f887.h> >> unsigned char a[4] = {0x12, 0x13, 0x14, 0x15}; >> >> int main() { >> PORTA = a[2]; >> return 0; >> } >> ------------------------------------------------------------------------------------------- >> the generated asmbler file is: >> ------------------------------------------------------------------------------------------- >> ID_a_0 idata >> _a >> db 0x12 >> db 0x13 >> db 0x14 >> db 0x15 >> >> STARTUP code 0x0000 >> nop >> pagesel __sdcc_gsinit_startup >> goto __sdcc_gsinit_startup >> >> code_a code >> >> _main >> BANKSEL _a >> MOVF (_a + 2),W >> BANKSEL _PORTA >> MOVWF _PORTA >> ; .line 1806; "a.c" return 0; >> MOVLW 0x00 >> MOVWF STK00 >> MOVLW 0x00 >> RETURN >> ; exit point of _main >> >> end >> ------------------------------------------------------------------------------- >> in the manual of gputils for the directive IDATA have this "Data >> memory is alllocated and the initialization data is placed in ROM, >> The user must provide the code to load the data into memory" >> so , just like the title can sdcc generate code which can load >> value from ROM(placed for idata directive) to RAM in startup? >> >> if have Where is the source code doing this LOAD? >> if not ,How can i do this? >> >> Another, in SDCC PIC14 the *pic16f887.lib* doing what? >> and how it come from? how can i compile to get it by myself? >> What does it contain? >> >> Thanks, guys.. >> >> -- >> *live long and prosper..* >> >> >> ------------------------------------------------------------------------------ >> 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 >> Sdc...@li... <mailto:Sdc...@li...> >> 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 > Sdc...@li... > <mailto:Sdc...@li...> > https://lists.sourceforge.net/lists/listinfo/sdcc-user > > > > > -- > *live long and prosper..* > > > ------------------------------------------------------------------------------ > 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 > Sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-user |
From: feqin f. <feq...@gm...> - 2012-12-21 11:27:56
|
Well, I understand. Thanks, very much. :-) 2012/12/21 Borut Ražem <bor...@gm...> > On 21. 12. 2012 11:02, feqin fan wrote: > > I have found the file, but how the compiler automatically insert into the > ASM file? > > > It doesn't. The idata.o, included in sdcc.lib, is linked with your program > by gplink during the linking phase. > Compiling the c program is actually done is several steps: > - preprocessing by sdcpp (input: c source code, output: preprocessed c > code; sdcc -E) > - code generation by sdcc (input: preprocessed c code, output: asm file; > sdcc -S) > - assebling by gpasm (input: asm file, output: object file; sdcc -c) > - linking by gplink (input: object files, output: binary (hex) file) > > All steps are performed by the sdcc front end. You can see the steps if > you invoke sdcc with -V option. > > Borut > > > > I compiled the sdcc in the VS10.0 by myself. > I have read a lot of the source code. So please tell me more details.. > And how can I get a right version that can generate the load code(using > the idata.c) before startup. > > Thank you, very much. > > > 2012/12/21 Borut Ražem <bor...@gm...> > >> > if have Where is the source code doing this LOAD? >> > if not ,How can i do this? >> >> See device/lib/pic14/libsdcc/idata.c >> >> >> > Another, in SDCC PIC14 the *pic16f887.lib* doing what? >> > and how it come from? how can i compile to get it by myself? >> > What does it contain? >> >> See device/non-free/lib/pic14/libdev/pic16f887.c >> >> Borut >> >> >> On 21. 12. 2012 08:03, feqin fan wrote: >> >> Hello,everyone. >> just like the title. >> I write C code like this: >> >> ------------------------------------------------------------------------------------------ >> #include<pic16f887.h> >> unsigned char a[4] = {0x12, 0x13, 0x14, 0x15}; >> >> int main() { >> PORTA = a[2]; >> return 0; >> } >> >> ------------------------------------------------------------------------------------------- >> the generated asmbler file is: >> >> ------------------------------------------------------------------------------------------- >> ID_a_0 idata >> _a >> db 0x12 >> db 0x13 >> db 0x14 >> db 0x15 >> >> STARTUP code 0x0000 >> nop >> pagesel __sdcc_gsinit_startup >> goto __sdcc_gsinit_startup >> >> code_a code >> >> _main >> BANKSEL _a >> MOVF (_a + 2),W >> BANKSEL _PORTA >> MOVWF _PORTA >> ; .line 1806; "a.c" return 0; >> MOVLW 0x00 >> MOVWF STK00 >> MOVLW 0x00 >> RETURN >> ; exit point of _main >> >> end >> >> ------------------------------------------------------------------------------- >> in the manual of gputils for the directive IDATA have this "Data memory >> is alllocated and the initialization data is placed in ROM, >> The user must provide the code to load the data into memory" >> so , just like the title can sdcc generate code which can load value from >> ROM(placed for idata directive) to RAM in startup? >> >> if have Where is the source code doing this LOAD? >> if not ,How can i do this? >> >> Another, in SDCC PIC14 the *pic16f887.lib* doing what? >> and how it come from? how can i compile to get it by myself? >> What does it contain? >> >> Thanks, guys.. >> >> -- >> *live long and prosper..* >> >> >> ------------------------------------------------------------------------------ >> 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 delivershttp://p.sf.net/sfu/logmein_12329d2d >> >> >> >> _______________________________________________ >> Sdcc-user mailing lis...@li...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 >> Sdc...@li... >> https://lists.sourceforge.net/lists/listinfo/sdcc-user >> >> > > > -- > *live long and prosper..* > > > ------------------------------------------------------------------------------ > 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 delivershttp://p.sf.net/sfu/logmein_12329d2d > > > > _______________________________________________ > Sdcc-user mailing lis...@li...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 > Sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-user > > -- *live long and prosper..* |
From: Gál Z. <tra...@fr...> - 2012-12-22 13:06:37
|
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 <feq...@gm...>: > ------------------------------------------------------------------------------------------ > #include<pic16f887.h> > unsigned char a[4] = {0x12, 0x13, 0x14, 0x15}; > > int main() { > PORTA = a[2]; > return 0; > } > ------------------------------------------------------------------------------------------- -- ~~~~~~~~~~~~~~~~ http://galzsolt.zzl.org |
From: feqin f. <feq...@gm...> - 2012-12-24 11:08:36
|
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 <tra...@fr...> > 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 <feq...@gm...>: > > > ------------------------------------------------------------------------------------------ > > #include<pic16f887.h> > > unsigned char a[4] = {0x12, 0x13, 0x14, 0x15}; > > > > int main() { > > PORTA = a[2]; > > return 0; > > } > > > ------------------------------------------------------------------------------------------- > > > > -- > ~~~~~~~~~~~~~~~~ > http://galzsolt.zzl.org > > > ------------------------------------------------------------------------------ > 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 > Sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-user > -- *live long and prosper..* |
From: Rich B. <ric...@at...> - 2012-12-24 14:35:55
|
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 <feq...@gm...> wrote: From: feqin fan <feq...@gm...> Subject: Re: [Sdcc-user] can sdcc PIC14 generate code which can load value from ROM(placed for idata directive) to RAM in startup? To: sdc...@li... 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 <tra...@fr...> 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 <feq...@gm...>: > ------------------------------------------------------------------------------------------ > #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 Sdc...@li... https://lists.sourceforge.net/lists/listinfo/sdcc-user |
From: feqin f. <feq...@gm...> - 2012-12-24 14:48:39
|
I'll do what you say. Thanks. Merry Christmas.. :-) 圣诞快乐.. 2012/12/24 Rich Bayless <ric...@at...> > 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 <feq...@gm...>* wrote: > > > From: feqin fan <feq...@gm...> > Subject: Re: [Sdcc-user] can sdcc PIC14 generate code which can load value > from ROM(placed for idata directive) to RAM in startup? > To: sdc...@li... > 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 <tra...@fr...<http://mc/compose?to=tra...@fr...> > > > > 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 <feq...@gm...<http://mc/compose?to=feq...@gm...> > >: > > > ------------------------------------------------------------------------------------------ > > #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 > Sdc...@li...<http://mc/compose?to=Sdc...@li...> > 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 > Sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-user > > -- *live long and prosper..* |