2003-12-21 08:36 PM
2003-12-10 03:44 PM
Has anyone tried to use pointer declaration with const prefix in C. Normally any declaration with const prefix goes to ROM or const segment but when I declare a pointer array with const prefix it goes to data segment.
const unsigned char * MyPtr[]={}; I want MyPtr to be stored in ROM I have tried this with both Metrowerks and Cosmic compliers Thanks in advance, Regards, praveenG2003-12-10 09:17 PM
Try this:
#pragma INTO_ROM const unsigned char * MyPtr[]={}; then look in the MAP file and check: - VARIABLES: MyPtr address len ( 2) ROM_VARatz2003-12-11 01:53 AM
Thanks a lot
It really works for Metrowerks. Could you suggest some method for Cosmic compiler also. Does anyone knows how to do the same for cosmic compiler???? Thanks again Regards, PraveenG2003-12-11 11:33 AM
To make the pointer constant in cosmic do the following:
const unsigned char * const pString = ''string''; Regards sjo2003-12-11 09:01 PM
Thanks a lot
it works for cosmic also Regards, PraveenG2003-12-21 08:36 PM
I recently found out that Metrowerks has one technical note on this topic
Refer TN102:Contant pointer and pointer to constant (Search TN102 on www.metrowerks.com) Regards, Parveen[ This message was edited by: praveenG on 22-12-2003 10:07 ]