This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Placing vtable of a Class into RAM

Hi

In a C++ application I have to place the vtable of a class (UARTDriver.cpp) into RAM.

I can of course do that by placing all RO-content of UARTDriver.o into RAM:

LR_IROM1 0x08000000 0x00008000  {    ; load region size_region
  ER_IROM1 0x08000000 0x00008000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
  }
  RW_IRAM1 0x20000000 0x00002000  {  ; RW data
   UARTDriver.o (.constdata__ZTV10UartDriver)
   .ANY(RAMCODE)
   .ANY (+RW +ZI)
  }
}

But this places all methods into RAM as well which is undesirable!

By looking at the map-file, I can see that the mangled name for my vtable is .constdata__ZTV10UartDriver.

vtable for UartDriver     0x20000554   Data     112  uartdriver.o(.constdata__ZTV10UartDriver)

Putting this into the scatter-file, my vtable gets places into RAM as desired.

LR_IROM1 0x08000000 0x00008000  {    ; load region size_region
  ER_IROM1 0x08000000 0x00008000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
  }
  RW_IRAM1 0x20000000 0x00002000  {  ; RW data
   UARTDriver.o (.constdata__ZTV10UartDriver)
   .ANY(RAMCODE)
   .ANY (+RW +ZI)
  }
}

But this solution is not really nice since it depends on the name-mangling of the compiler.

How can I qualify the vtable of UARTDriver in the scatter-file so it gets placed into RAM?

0