This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Segger Fixed Memory Allocation in Flash and SoftDevice compatibility.

Hi All,

New user here but couldn't find a concrete answer to the following question.

In PIC land I've usually allocated fixed memory using the _at_ or __attribute__ label but Segger doesn't support this. From googling I read to add a reference to the xml file, which I've done as shown below:

<!DOCTYPE Board_Memory_Definition_File>
<root name="nRF52810_xxAA">
  <MemorySegment access="ReadOnly" name="FLASH1" size="0x00030000" start="0x00000000" />
  <MemorySegment access="Read/Write" name="RAM1" size="0x00006000" start="0x20000000" />
  <MemorySegment access="Read/Write" name="CODE_RAM1" size="0x00006000" start="0x00800000" />

  <MemorySegment name="$(FLASH_NAME:FLASH)">
    <ProgramSection alignment="4" load="Yes" name=".settingsStore" start="0x00000000" />
  </MemorySegment>
</root>

You can see that the start is 0x0 which is probably a bad idea, likely the entry point of the application if it's like PIC's. A related question to ask at this point is where does a SoftDevice get placed in Flash?

Back to the main question, I then have the following to take up a 4kb page of flash (actual usage is 1kb so plenty for futureproofing).

static const union {
  struct settingsProto settings;
  uint8_t pad[FLASH_PAGE_SIZE_BYTES];
} store __attribute__((section(".settingsStore"))); // reserve flash page

Upon build I receive the error:

unplaced section: .settingsStore [config.o], size=4000, align=4



Parents Reply Children
  • I'm still either confused or unknowledgeable about how to retrieve APP_CODE_BASE.

    If the SoftDevice is flashed it takes over the 0x0 address. After it's done it's init it willl jump to APP_CODE_BASE address.

    If I can't compile a program because I don't know APP_CODE_BASE to add to the linker then how can I call SoftDevice's API in debug mode to find out what APP_CODE_BASE is? Why doesn't Nordic just publish it in the spec for the chips the SoftDevice works with instead of this merry-go-round?

Related