-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
thumb bit no longer set in reset entry in vector table #4631
Comments
The whole build target thing has become a Rube Goldberg... Your problem is that Use something like: exe.setTarget(.{
.cpu_arch = .thumb,
.os_tag = .freestanding,
.abi = .none,
.cpu_model = .{ .explicit = &std.Target.arm.cpu.cortex_m0 },
}); |
Why do you say that? I think if you take some time to see how it works, you will find it to be quite sane. I don't think @markfirmware needs to change the target. This looks like a regression. Previously, |
Not really, the previous (and bad) baseline was ARMv6, as usual it only worked due to the luck factor :) This is the correct way to build the project as the Microbit is equipped with a Cortex-M0, there's no need to play the baseline-cpu lottery anymore. |
EDIT: wow never replying via email again
|
How is a user supposed to know what features are enabled for a given http://www.llvm.org/svn/llvm-project/llvm/trunk/lib/Target/ARM/ARM.td From that page, here is the definition of cortex-m7.
You can see(?) that it includes the floating point unit for that architecture. If you look at the datasheet for the cortex-m7 however, the floating So it would appear that you don't have to specify the FPU if you are Am I misunderstanding something? Why do you need to specify the fpu Also, how would you select b/t the three ABIs for floating point? Is Thanks, |
Ah! OK this is a success story for the new cpu features then. I got confused by the rube goldberg thing and thought you were suggesting a workaround.
It needs to be augmented with feature descriptions which are not exposed yet. But you can find the source here: https://github.com/ziglang/zig/blob/master/lib/std/target/arm.zig
Zig's CPU models & features are now independent from LLVM. They are a superset of LLVM's CPU models & features. However they are integrated with LLVM so that LLVM is informed correctly when doing code generation. Point being that we are taking steps towards a non-llvm backend being a possibility.
Here is where zig specifies this: Lines 1823 to 1830 in ad27041
It seems you have found a bug in the CPU feature set, and a pull request would be most welcome! Especially with a cited source of the data sheet.
If the FPU is not determinable only by specifying the cpu model as cortex-m7, then the user should have to specify the FPU. The features attached to a given CPU model should be only what is guaranteed to be available in the hardware, and optional features are supposed to be supplied separately.
It's likely that clang has extra logic associated with this target on top of LLVM.
Currently how the ABI works is that the "abi" portion of the target triple selects "hard" or "soft":
Next, the CPU feature set determines whether it's soft-float using FPU or software floating point emulation. If there is an FPU, it's the former, otherwise, the latter. 2 caveats:
|
The suggestion #4631 (comment) is correct. When using With using the parse function: exe.setTarget(std.zig.CrossTarget.parse(.{
.arch_os_abi = "thumb-freestanding-none",
.mcpu = "cortex_m0",
}) catch unreachable); If you wanted to use a generic CPU rather than cortex_m0: exe.setTarget(std.zig.CrossTarget.parse(.{
.arch_os_abi = "thumb-freestanding-none",
.mcpu = "generic+v6m",
}) catch unreachable); Please let me know if this does not solve the problem. |
Thanks - working well now. |
Before the last few commits to master, this build.zig and this vector table would actually set the lsb of the .long mission1_main in the vector table. This is needed for starting in thumb mode. I think something has changed with regards to cpu and features, but I don't know how to address this.
Thanks,
Mark
Updated for latest zig:
https://github.com/markfirmware/zig-bare-metal-microbit/tree/thumb-bit
The text was updated successfully, but these errors were encountered: