Get memory map values (from MCU Settings) in application code

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by ArriaLive on Tue Aug 04 18:51:11 MST 2015
I've been looking for a way to reference the MCU Settings table in code, but have not yet been successful.  Is there a way?

In our application, running on an LPC4330, we have defined multiple regions of the external flash something like this (from code_Debug_mem.ld file):

  /* Define each memory region */
  RamLoc128 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x20000 /* 128K bytes */
  RamLoc72 (rwx) : ORIGIN = 0x10080000, LENGTH = 0x12000 /* 72K bytes */
  RamAHB32 (rwx) : ORIGIN = 0x20000000, LENGTH = 0x8000 /* 32K bytes */
  RamAHB16 (rwx) : ORIGIN = 0x20008000, LENGTH = 0x4000 /* 16K bytes */
  RamAHB_ETB16 (rwx) : ORIGIN = 0x2000c000, LENGTH = 0x4000 /* 16K bytes */
  CodeFlash (rx) : ORIGIN = 0x14000000, LENGTH = 0x20000 /* 128K bytes */
  [color=#900]Region1Flash [/color](rx) : ORIGIN = 0x14030000, LENGTH = 0x40000 /* 256K bytes */
  [color=#900]Region2Flash [/color](rx) : ORIGIN = 0x14020000, LENGTH = 0x10000 /* 64K bytes */
  [color=#900]Region3Flash[/color] (rx) : ORIGIN = 0x14070000, LENGTH = 0x40000 /* 256K bytes */

I have read that there may be a way to create an external reference such as:

extern int Region1Flash;

and then let the linker resolve the value.  However, I have not been able to get the linker to resolve any reference I can think of.  Is there a simple way to accomplish what we're trying to do?