DRTIO port - scripts #135
No reviewers
Labels
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: M-Labs/artiq-zynq#135
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "mwojcik/artiq-zynq:drtio_scripts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is a part of few pull requests for DRTIO functionality. They have been broken up to allow easier code review overall. They're identical in contents to drtio_port branch.
This PR includes modified makefile, nix and shell scripts for building and running the firmware.
This PR should be merged last.
Any feedback and suggestions are welcome.
I guess this has to be merged last?
@ -12,2 +13,3 @@
python gateware/$(TARGET).py -r ../build/pl.rs -c ../build/rustc-cfg -m ../build/mem.rs $(GWARGS)
../build/firmware/armv7-none-eabihf/release/runtime: ../build/pl.rs ../build/rustc-cfg $(shell find . -print)
../build/firmware/armv7-none-eabihf/release/runtime: ../build/pl.rs ../build/rustc-cfg
Doesn't this break dependency checks? If you modify a source file Make won't re-run the build properly anymore.
No, it doesn't from what I saw. Cargo must do the checks on its own. And with
find .
it would also try to build satman at the same time as runtime.Yes. But the Makefile needs to run Cargo at all when source is modified.
AFAICT if you remove the
find
then Make will simply skip running Cargo after a corresponding source file is modified.Well, with it, it tries to built satman with pl/mem files obviously not prepared, failing the build. And makes a circular dependency.
Calling make for master runtime throws a warning, and then fails when trying to build satman.
I haven't had issues with modifying a file and not compiling, either. Only when gateware was changed, then yes, it couldn't detect that, and required a clean build.
How did Make detect the change then?
Good question, actually. It's just something I wasn't really thinking about as long as it could compile. A bit of an online search only says "it resolves the dependencies" somehow, I haven't went deep into it.
For circular dependencies and miscompilations, of course that's my mistake - I made targets runtime/satman so nix-build could refer to these, but of course they're listed along with
find
, causing these issues. I'll change their name so they don't collide, update build script and restorefind
.@ -20,2 +22,4 @@
../build/runtime.bin: ../build/firmware/armv7-none-eabihf/release/runtime
llvm-objcopy -O binary ../build/firmware/armv7-none-eabihf/release/runtime ../build/runtime.bin
satmanout: ../build/pl.rs ../build/rustc-cfg
Why the deviation from the runtime Make rules?
You mean in the name of the rule? Fair point, no particular reason for it, I'll revert it.
The name of the rule needs to match the output file, otherwise Make keeps evaluating it every time it is invoked with that target.
Yes, I think so. Good point, I'll make note of order of merging.
@ -14,3 +15,4 @@
inherit pkgs;
board = target;
};
fwtype = if builtins.elem variant sat_variants then "satman" else "runtime";
You can read the JSON to determine that.
Nix has
builtins.fromJSON
zc706 doesn't use JSONs, though. Now that I think about it I could make it a bit better still by having the fwtype specified in the list of targets at the bottom, passed to the build function instead.
@ -2,3 +2,3 @@
GWARGS := -V simple
all: ../build/firmware/armv7-none-eabihf/release/runtime ../build/runtime.bin
all: runtime
There is no rule named
runtime
.@ -5,0 +5,4 @@
runtime_target: ../build/runtime.bin
satman_target: ../build/satman.bin
What are these
*_target
things for?Also (assuming they are necessary at all), if there are no
*_target
files produced those rules should bePHONY
.I was aiming for clearer reference of the targets in nix-scripts, or when called manually. But it's unnecessary after all, it can be called straight up with the output file rule.
OK, I see. Yes the manual command is a bit unwieldy, I suggest adding them back but listed as PHONY. I will merge this now, please send a new PR.