Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Very similar to #274 , but now the
memory
feature enables includingmemory.x
directly inlink.x
.Usually, a standard embedded rust project has three linker files:
link.x
: the foundational linker file of the runtime. In the RISC-V ecosystem, this linker file is provided byriscv-rt
. It defines all the sections, checks that alignments are correct, etc.device.x
: It is usually provided by PACs. It defines the device-specific interrupt sources, exceptions, etc.memory.x
: It is usually provided by BSPs. It defines available memory regions on a device (e.g., FLASH and RAM).In
cortex-m-rt
, thememory.x
file is mandatory and always included in their linker file. Alternatively, PACs may enable thedevice
feature to includedevice.x
at the end of theirlink.x
file. In this way, when compiling, users only need to provide the-C link-arg=Tlink.x
. This applies to everycortex-m
device, which makes this approach user-friendly and convenient.With this PR, in
riscv-rt
it will be possible to have such behavior by enabling both thedevice
andmemory
features. New PAC version would now enable thedevice
feature, and new BSP version would now enable thememory
feature. Users would only need to modify theRUSTFLAGS
when compiling, as now they would only need to do-C link-arg=Tlink.x
for linking.As mentioned in the PR, leaving these two features optionals have two major benefits:
device.x
ormemory.x
file without too much effort. This makesriscv-rt
quite versatile.Once this PR is merged, I would say that #238 is solved.