aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-09-16Hexify the family IDIan McIntyre
Makes it a little easier for me to manually inspect binaries and figure out their targets.
2025-09-16Remove __pre_init inner jump labelsIan McIntyre
Local numbered labels won't appear in the ELF file. This makes debugging a little easier.
2025-09-16Catch target-host version mismatchIan McIntyre
Attach the version information in a symbol that's generated by the host. Then, expect the same symbol exists in the embedded target. If the linker can't resolve this, then the host and target should be incompatible. I'm overloading the __imxrt_family symbol for this.
2025-09-16Adopt Rust 2024 editionIan McIntyre
I'm considering this a breaking change. I'll try to introduce new sections that rely on the user's `unsafe` keyword for linker placement. Rust 2024 has different opinions on format, and clippy has new thoughts. Let's adopt them.
2025-09-09Reserve address 0 by shifting ITCM start addressIan McIntyre
The runtime previously allowed function placement at address 0 in ITCM. However, if you ever formed a pointer to the function placed there, it would look like a null pointer. And you would never be able to call that function if you relied on null pointer optimization. Also, most MCU reference manuals (RM) recommend against this placement. This commit reduces the total capacity of ITCM by 32 bytes, the smallest possible size of a MPU region. Note that this is greater than the RM's recommendation of a four byte reservation. It affects all supported MCUs, except the 1180. If you're so inclined, your MPU could disallow loads, stores, and execution from this reservation. Revised unit tests should cover this change. Additionally, you can manually verify that the ITCM region lengths are reduced by 32 bytes by opening the linker scripts generated by the ELF test suite.
2025-09-09Test how the runtime computes ITCM start, sizeIan McIntyre
No changes here; we're testing an existing behavior. The next commit changes how this math works.
2025-08-03Fix clippy warningsIan McIntyre
2025-06-13Prepare 0.1.7 releaseIan McIntyre
2025-03-21Added in_flash RuntimeBuilder constructorSherif A Abdou
Applications linked through this builder can be placed in a flash reservation. You'll need some other software to launch these programs, since they lack the boot header required by the NXP boot ROM.
2025-03-13Place .xip sections into flashIan McIntyre
We added the `.xip` section to ensure that the reset handler and pre-init functions would be placed in flash. This commit lets users place other content into that section. `.xip` is intended for instructions. The runtime builder will place these instructions into the same load region as `.text`. However, there's no pre-`main` relocation. Aligning the `.xip` and the `.text` section produces more predictable behavior between GNU's ld and LLVM's lld.
2025-03-01Prepare 0.1.6 releaseIan McIntyre
2025-02-22Document workaround for registering exceptionsIan McIntyre
Given the way this package abuses cortex-m-rt, it's not immediately obvious how to register a Cortex-M exception handler with the `#[exception]` macro. This commit documents and demonstrates the workaround I use.
2025-02-08Add imxrt1160 target supportIan McIntyre
Implemented by following the reference manual, and tested on an MIMXRT1160EVK. The target adopts all of the same limitations as the 1170 target.
2025-01-04Add imxrt1040 target supportIan McIntyre
I derived these values from the reference manual. Tested on an MIMXRT1040EVK.
2024-10-26Prepare 0.1.5 releaseIan McIntyre
2024-10-18Bump actions/checkout to v4Ian McIntyre
2024-10-18Remove deprecated actions-rs from CIIan McIntyre
Follows the same approach taken in imxrt-hal, imxrt-ral, etc.
2024-10-18Fix over-aligned test assertionIan McIntyre
There's no requirement for 16 byte-aligned read-only data, and this is the only assertion expecting that requirement. Reducing the requirement lets the test pass when the image is built with a Rust 1.82 toolchain.
2024-10-18Address warnings introduced in 1.82Ian McIntyre
2024-10-17Support RT1180 familyNils Fitinghoff
The 1180 family uses a different boot header than previous families. The header is generated to support the default configuration where hash and signature errors are ignored. The XIP `__pre_init` strategy is still used, more for ease of getting something running than because of any known problems with the boot ROM's implementation of loading images to different memories. The boot ROM for the 1180 does not appear to allow the entry point to lie outside the (loaded or execute-in-place) image, so a new `.xip` section is added after the vector table to put the address inside the image while keeping VMA=LMA. This could cause problems for tools that manipulate binaries based on section names.
2024-10-16Address clippy transmute warningsIan McIntyre
2024-04-05Prepare 0.1.4 releaseIan McIntyre
2024-04-03Add environment variable overrides for stack, heapIan McIntyre
If you define a runtime, you can call `stack_size_env_override` to define an optional environment variable checked by the runtime builder. Same goes for the heap. A user can set these environment variables to override the runtime's stack / heap size. You can use this package's examples to try it out; see the updated build script. There's no default environment variable for either memory region. The package that defines the runtime needs to opt-in to this feature.
2023-10-01Prepare 0.1.3 releaseIan McIntyre
2023-09-30Merge pull request #12 from imxrt-rs/gnu-linkerTom Burdick
Test with GNU's linker
2023-09-29Test with GNU ld in CIIan McIntyre
Ensure that we can use GCC's linker to generate our Rust firmware. This is useful for exploring mixed-language firmware builds.
2023-09-29Ensure __pre_init remains in binaryIan McIntyre
GNU's LTO has a tendency to remove __pre_init, which is written in inline assembly. It doesn't realize that the reset handler references this symbol, because the reset handler is also written in inline assembly. Not sure why LLVM's linker doesn't also optimize it away, but this commit ensures that __pre_init remains in the output file.
2023-09-29Relax asserts for .rodata and .text offsetsIan McIntyre
Haven't fully dug into this one, but GNU ld and LLVM lld have slightly different section positions when we cross from text to data. We can relax the asserts to show ordering without strictly requiring an offset.
2023-09-29Refactor LMA computation in inspect_elfIan McIntyre
Depending on the ordering and contents of program headers, the previous predicate for "is this the program header for this section?" could select the wrong header. GNU's ld and LLVM's lld produce that different header ordering and contents, causing select asserts to fail when using GNU's linker. This commit changes how we select the program header, approximating the way GNU objdump figures the value. This new approach needs more information from the section header, so I'm changing the API to make it easier to call the section_header method. The previous approach was influenced by LLVM objdump. Turns out that LLVM objdump will also compute the wrong LMA for these binaries when they're linked with GNU ld. GNU objdump always produces the correct section LMA, no matter the LLVM or GNU linker.
2023-09-29Use an absolute address for __dcdIan McIntyre
LLVM's lld and GNU's ld have different ways of handling assignments in output sections. Unless we specify ABSOLUTE, ld treats the number '0' as a relative address from the section start, 0x6000_0000. On the other hand, lld treats '0' as if it were written with ABSOLUTE, and it ignores the ABSOLUTE function. So depending on your linker, __dcd would change values. This commit forces an absolute number for __dcd, ensuring a consistent value no matter the linker.
2023-09-08Prepare 0.1.2 releaseIan McIntyre
2023-09-08Remove patched imxrt-ral dependencyIan McIntyre
This development leftover should have been dropped after releasing imxrt-ral 0.5.
2023-09-08Add optional DCD section in linker scriptsummivox
Users can define their device configuration data (DCD), and place the data in the .dcd section. If the .dcd section has content, the entry in the IVT points at the user's DCD. This plays well with imxrt-dcd.
2023-03-25Generate one linker script; add unit testsIan McIntyre
We can still maintain individual linker script components, then write them into one, larger linker script. We're effectively implementing the same behavior as INCLUDE while disallowing overrides of the linker search path to find the INCLUDEd files. Once we have one linker script, we can refactor for easier unit testing. This commit adds simple unit tests for the default builder, and some of the expected errors.
2023-02-14Prepare 0.1.1 releaseIan McIntyre
2023-02-14Bump cortex-m-rt version to 0.7.3Ian McIntyre
The reset handler of 0.7.2 pushes four bytes onto the stack, resulting in a misaligned stack pointer once the next procedure (main) is called. Compilers are free to assume that the stack is eight byte aligned when optimizing code. We depend on this reset handler, so this affects imxrt-rt users. Take the approach recommended in the cortex-m-rt advisory and update to 0.7.3. I tested this by building and running the two examples in this repo on a 1010EVK. Also tested in imxrt-hal by building and running examples on a 1010EVK. cortex-m-rt 0.7.2 is yanked. Since imxrt-rt 0.1.0 fixes its cortex-m-rt version, it will no longer build. I have no plan to also yank imxrt-rt 0.1.0; the upstream yank already signals that something is broken.
2022-12-02Fix tag URLs in CHANGELOGIan McIntyre
2022-12-02Add CHANGELOG for release trackingIan McIntyre
2022-12-01Update to cmrt 0.7.2, and use new featuresIan McIntyre
No need for us to set VTOR and the stack pointer anymore.
2022-12-01Explicitly match family variants in host implIan McIntyre
Might help the next person who wants to add a new family. There's a way to defeat this lint when the enum is (Partial)Eq: use if / else to emulate a fallthrough. I can't find _another_ lint that would prevent that pattern, so I'll try to be vigilent here.
2022-12-01First commitIan McIntyre