The C standard says that "const" variables are still variables, and have to go in ram - as far as I know, the word "const" aids the compiler in generating warnings, and aids optomisation, but nothing more. Similarly, strings are also always copied to ram.
What is the best way to force data into flash, with no copy in ram? This can be quite relevant for strings, and is very important for lookup tables - the project I am working on at the moment is going to have crc routines which use lookup tables, so I'd be grateful if anyone can give me a hint as to how to do this. mvh. David > well, this is in C standard. > > Briefly: > when you declare some var as 'var[]' it means that this should be located in > RAM irrespective to the 'const' modifier (and can be modified later - it is > writable sting). > if it is 'type *var = ...' this will be located in text section (ROM). > So, you're declaring constant _variable_ (const _writable_ string) about which > compiler complains. > Anyway, the result code correct, just waste of RAM. > > ~d > > > On Wednesday 04 December 2002 11:34, Paul Burke wrote: > > I do a lot of this kind of thing: > > > > const char Antinomian[] = "The elect cannot commit mortal sin\r\n"; > > > > .... > > > > if( Religion == RANTER) > > puts( Antinomian); > > > > etc. etc. > > > > The const is just to force the string into the code space, and conserve > > ram. > > > > Each time I do this, the compiler throws up a warning that the type > > qualifcation is lost when the parameter is passed. > > > > True, but as I get a lot of such warnings, it gets difficult to tell if > > there are any useful warnings in there, or indeed any errors. > > > > Is here any waning level setting that supresses this (while leaving more > > useful type conflict etc. warings untouched)? > > > > Paul Burke > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Microsoft Visual Studio.NET > > comprehensive development tool, built to increase your > > productivity. Try a free online hosted session at: > > http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en > > _______________________________________________ > > Mspgcc-users mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/mspgcc-users > > -- > /******************************************************************** > ("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ > `6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys > (_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44 > _..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia > (il),-'' (li),' ((!.-' +7 (812) 3468202, 5585314 > ********************************************************************/ > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Microsoft Visual Studio.NET > comprehensive development tool, built to increase your > productivity. Try a free online hosted session at: > http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en > _______________________________________________ > Mspgcc-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mspgcc-users > >
