| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Hi, .const section includes string and some const data stuff. Is that possible to move string to some other memory without moving const data? Thanks |
|
#2
| |||
| |||
| On Sep 5, 8:46*am, "Jiandong Xu" <jiandong...@nsn.com> wrote: > Hi, > > .const section includes string and some const data stuff. Is that possible > to move string to some other memory without moving const data? Thanks There is a missing piece of information here. Can you provide it? John |
|
#3
| |||
| |||
| Depending on the platform.. look for #pragma or similar compiler directives, or provide more info about the development environment and target device. When you search for the directives, keep in mind they may not be #commands.. one compiler I worked with long ago used specifically formatted comments to control memory layout. "John" <sampson164@gmail.com> wrote in message news:6187cd3f-aeb8-4bbb-b5d6-c52b4b14530b@k13g2000hse.googlegroups.com... On Sep 5, 8:46 am, "Jiandong Xu" <jiandong...@nsn.com> wrote: > Hi, > > .const section includes string and some const data stuff. Is that possible > to move string to some other memory without moving const data? Thanks There is a missing piece of information here. Can you provide it? John |
|
#4
| |||
| |||
| Jiandong Xu wrote: > Hi, > > .const section includes string and some const data stuff. Is that possible > to move string to some other memory without moving const data? Thanks > > Hi, Yes. Nils |
|
#5
| |||
| |||
| Jiandong Xu wrote: > Hi, > > const section includes string and some const data stuff. Is that possible > to move string to some other memory without moving const data? Thanks In the most of the embedded compilers, you can explicitly define memory section for every particular object. Many compilers have an option if the strings are kept in RAM (as required by C standard) or stored in the constant memory. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com |
|
#6
| |||
| |||
| On Fri, 05 Sep 2008 20:32:53 -0500, Vladimir Vassilevsky <antispam_bogus@hotmail.com> wrote in comp.dsp: > > > Jiandong Xu wrote: > > > Hi, > > > > const section includes string and some const data stuff. Is that possible > > to move string to some other memory without moving const data? Thanks > > In the most of the embedded compilers, you can explicitly define memory > section for every particular object. Many compilers have an option if > the strings are kept in RAM (as required by C standard) or stored in the > constant memory. There is nothing in the C standard that requires all strings to be stored in RAM. Given: char *s1 = "string one"; char s2[] = "string two"; const char s3[] = "string three"; ....only the character array s2 needs to be stored in RAM. The string literal and the array of const chars can be stored in read-only memory or in RAM. -- Jack Klein Home: http://JK-Technology.Com FAQs for comp.lang.c http://c-faq.com/ comp.lang.c++ http://www.parashift.com/c++-faq-lite/ alt.comp.lang.learn.c-c++ http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html |
|
#7
| |||
| |||
| Jack Klein wrote: (snip) > There is nothing in the C standard that requires all strings to be > stored in RAM. In K&R C, string constants were writable. That ability was removed in ANSI C, but many compilers support it for back compatibility. > Given: > char *s1 = "string one"; > char s2[] = "string two"; > const char s3[] = "string three"; > ...only the character array s2 needs to be stored in RAM. The string > literal and the array of const chars can be stored in read-only memory > or in RAM. -- glen |
|
#8
| |||
| |||
| Thanks for your reply. sure, it is TI compiler: TI C6000 Code Generation Tools: v6.0.5, from Code Composer Studio v3.3 I do remember some compilers can put string section somewhere. But I can't find any information from TI manual. >Depending on the platform.. look for #pragma or similar compiler directives, >or provide more info about the development environment and target device. >When you search for the directives, keep in mind they may not be #commands.. >one compiler I worked with long ago used specifically formatted comments to >control memory layout. > >"John" <sampson164@gmail.com> wrote in message >news:6187cd3f-aeb8-4bbb-b5d6-c52b4b14530b@k13g2000hse.googlegroups.com... >On Sep 5, 8:46 am, "Jiandong Xu" <jiandong...@nsn.com> wrote: >> Hi, >> >> .const section includes string and some const data stuff. Is that possible >> to move string to some other memory without moving const data? Thanks > >There is a missing piece of information here. Can you provide it? > >John > > > |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.