Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Make the address of the vector table configurable. #341

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

david-boles
Copy link

@david-boles david-boles commented Jan 19, 2022

Not sure if this is the right way to do it; please let me know if there's a better alternative. I'm trying to add dummy sections for a bootloader header and trailer, this change allows my memory.x file to be pretty clear:

MEMORY
{
  /* NOTE K = KiBi = 1024 bytes */
  FLASH : ORIGIN = 0x00008000, LENGTH = 464K
  RAM : ORIGIN = 0x20000000, LENGTH = 64K
}

SECTIONS
{
  .mcuboot_header 0x8000 :
  {
    FILL(0xAAAAAAAA)
    . = . + 32;
  } > FLASH
  PROVIDE(_svector_table = 0x8020);
}
INSERT BEFORE .vector_table;

SECTIONS
{
  .mcuboot_trailer . :
  {
    FILL(0xFFFFFFFF)
    . = . + 40;
  } > FLASH
}
INSERT AFTER .gnu.sgstubs;

It seemed like a simple and useful enough change that you might want to incorporate it.

@david-boles david-boles requested a review from a team as a code owner January 19, 2022 11:13
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @therealprof (or someone else) soon.

Please see the contribution instructions for more information.

@adamgreig
Copy link
Member

This PR might be a good idea regardless, but as another option to solve your problem I wonder if you could do this? I've done something very similar in the past to leave room for configuration data before the vector table in bootloader applications.

MEMORY {
    HEADER : ORIGIN = 0x00008000, LENGTH = 32
    FLASH : ORIGIN = ORIGIN(HEADER) + LENGTH(HEADER), LENGTH = 464K - LENGTH(HEADER)
    RAM : ORIGIN = 0x20000000, LENGTH = 64K
}

SECTIONS {
    .mcuboot_header . : {
      FILL(0xAAAAAAAA)
      . = . + 32;
    } > HEADER
}

SECTIONS
{
  .mcuboot_trailer . : {
    FILL(0xFFFFFFFF)
    . = . + 40;
  } > FLASH
} INSERT AFTER .gnu.sgstubs;

@david-boles
Copy link
Author

adamgreig, that definitely works too and I'll probably go with that unless and until this gets merged. It would feel nicer if the header and trailer could be treated the same way though.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants