1 Reply Latest reply on Jun 21, 2017 9:38 PM by AnkitaS_51

    What is correct way to declare an array of pointers in flash (ROM)?

      I would like to generate a pointer array in flash (ROM) initialized with the addresses of tool generated variables (G4 CapSense data from the structure) for tuning and general debugging.  This way I'm able to use a loop to index the data without using the macro "CapSense_BUTTON0_SNS0_RAW0_VALUE".  I've tried named areas and assigned the area to flash in the build settings for the linker. 


      I understand


      const uint8 Variable = 0x12;  // Put in flash.


      needs an initializer to put it into flash.  Otherwise the compiler create a RAM variable.


      const uint8 Variable;              // Put in RAM.




      Here is a snippet of the declaration.  The comments added are what I've determine by using the debugger to confirm the compiler's placement in memory.  I have successfully used a struct in a named area in flash with initializers before, so I'm puzzled why the declaration and initialization does not work.


      uint16 * const VariableCapSense_sensorRaw4[] = // INCORRECT array in FLASH of random? addresses.














       This should be the correct construction - VariableCapSense_sensorRaw4[] is an array in const memory of pointers to uint16's in RAM.


      But my results placed this array at address 0 according to the debugger.