Allocating Variables in Absolute RAM or ROM Locations Using ImageCraft ‘C’ Compiler - KBA203832

Version: **

 

Question:

How do I allocate an absolute RAM or R0M address in PSoC® 1 using ImageCraft ‘C’ compiler? 

 

Answer:

Use the syntax shown below to declare the variable at absolute RAM and ROM locations. 

#pragma abs_address:  //declaration of variables to be located in ROM address   #pragma end_abs_address   #pragma ram_abs_address   //declaration of variables to be located in RAM address   #pragma end_abs_address 

 

Example: 

Make sure that the ROM location is not overlapping with the user code and that the address is valid for the particular device. 

#pragma abs_address:0x500   WORD waRomBuffer[10]; //waRomBeffer is located at the ROM address=0x500   #pragma end_abs_address   #pragma ram_abs_address 0xE0   WORD waRamBuffer[10]; //waRamBuffer is located at the Ram address of 0xE0  #pragma end_abs_address