-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
arm-embedded GCC breaks Zephyr RTOS on nRF51 (Cortex-M0) #63143
Comments
You should make sure the right gcc & binutils are being called. mkShell awkwardly has its own ld and cc. This can be done by putting them in "nativeBuildInputs". Note sure if this is causing the issue, just one thing to make sure is happening correctly. strip can be especially bad at breaking these things. |
Yes, its definitely calling the right toolchain. Zephyr uses |
It looks like intermixing both toolchain paths, what is type of the crash, UsageFault UNDEFINSTR ? How about use Reference #51907 Also I'm also thinking about usage of Zephyr SDK directly (wrapped with build FHS) as it is used for Shippable CI in Zephyr PR testing. |
Hello, I'm a bot and I thank you in the name of the community for opening this issue. To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human. The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it. If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them. Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel. |
I'm pretty sure I've discovered the cause of this problem, although now I'm working on building ArduPilot with a fully Nix built toolchain, and I haven't gone back and tested my Zephyr project. The key difference between With The fix is to manually specify the proper For example, to build ArduPilot for Cortex-M4 and M7 processors, I use the following platform, which is equivalent to the {
config = "arm-none-eabi";
libc = "newlib-nano";
gcc = {
arch = "armv7e-m+fp";
float-abi = "hard";
};
} Additionally, These limitations are the reason there are currently only two usages of
|
Issue description
pkgsCross.arm-embedded.buildPackages.gcc9
causes Zephyr RTOS to immediately crash on boot for all non-trivial applications. This also occurs with GCC 7, but I did most of my testing with GCC 9 for easier comparison with Arch Linux'sarm-none-eabi-gcc
package, which has GCC 9.1 and works correctly.I have reproduced this on the Nordic nRF51822, which has an ARM Cortex-M0 CPU. I have no other hardware available to test.
The output of
diffoscope --tool-prefix-binutils arm-none-eabi- zephyr.nix.strip.elf zephyr.arch.strip.elf
can be seen here.Most of the differences seem to be caused by different offsets (which is unexpected, but doesn't seem to be the root cause of the problem), but I did notice this:
This makes me suspect that Nix's GCC is getting confused about the architecture and potentially generating code for the wrong CPU.
Steps to reproduce
Create a Zephyr application for the nRF51 that calls
k_sleep
in an infinite loop. Compile in a nix-shell environment as shown below. Flash the result to the device and observe that it immediately crashes with a hard fault.shell.nix
Technical details
"x86_64-linux"
Linux 5.1.7-arch1-1-ARCH, Arch Linux, noversion
yes
yes
nix-env (Nix) 2.2.2
"nixpkgs"
/home/ben/Documents/Projects/nixpkgs
The text was updated successfully, but these errors were encountered: