Skip to content
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

[BUG] Apio lint fails when the packages path in APIO_PACKAGES_DIR contains spaces. #474

Open
zapta opened this issue Nov 24, 2024 · 7 comments

Comments

@zapta
Copy link
Collaborator

zapta commented Nov 24, 2024

The problem seems to be in the space character escaping of the iverilog command.

To reproduce

  1. Install all apio packges apio packages --install
  2. renamed Users/user/.apio/packages to Users/user/.apio/ packages (notice the extra space).
  3. Define export APIO_PACKAGES_DIR="Users/user/.apio/ packages"
  4. Run the command command apio test in the test-examples/Alhambra-II/02-jumping-LED project.

Once fixing, change conftest.py to have " fuññy " instead of "fuññy" and run make check_all to test.

$ apio system --info
Active env options [APIO_PACKAGES_DIR].
Apio version    0.9.6
Platform id     darwin_arm64
Python package  /Users/user/projects/apio_dev/repo/apio
Apio home       /Users/user/.apio
Apio packages   /Users/user/.apio/ packages
$ apio test
Active env options [APIO_PACKAGES_DIR].
Setting the envinronment.
iverilog -B "/Users/user/.apio/ packages/tools-oss-cad-suite/lib/ivl" -o _build/02-jumping-LED_tb.out -DVCD_OUTPUT=_build/02-jumping-LED_tb -DNO_ICE40_DEFAULT_ASSIGNMENTS "/Users/user/.apio/ packages/tools-oss-cad-suite/share/yosys/ice40/cells_sim.v" main.v 02-jumping-LED_tb.v
sh: /Users/user/.apio/: is a directory
sh: /Users/user/.apio/: is a directory
scons: *** [_build/02-jumping-LED_tb.out] Error 126
======================================================== [ ERROR ] Took 0.36 seconds ========================================================
@zapta
Copy link
Collaborator Author

zapta commented Nov 24, 2024

.. I was able to also reproduce it from the command line, without apio. Need to figure out how to escape spaces in a way that is compatible with iverilog. (all my testing was done on darwin_arm64).

$ '/Users/user/.apio/ packages/tools-oss-cad-suite/bin/iverilog' -B '/Users/user/.apio/ packages/tools-oss-cad-suite/lib/ivl' -o _build/02-jumping-LED_tb.out -DVCD_OUTPUT=_build/02-jumping-LED_tb -DNO_ICE40_DEFAULT_ASSIGNMENTS '/Users/user/.apio/ packages/tools-oss-cad-suite/share/yosys/ice40/cells_sim.v' main.v 02-jumping-LED_tb.v
sh: /Users/user/.apio/: is a directory
sh: /Users/user/.apio/: is a directory

@zapta
Copy link
Collaborator Author

zapta commented Nov 24, 2024

Similar problem with apio build with ecp5. This one may be solved simply by adding quotes.

/Users/user/projects/apio_examples_dev/repo/ColorLight-5A-75B-V8/Ledon $ apio build
Active env options [APIO_PACKAGES_DIR].
Setting the envinronment.
[Sun Nov 24 14:31:20 2024] Processing ColorLight-5A-75B-V8
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
yosys -p "synth_ecp5 -top top -json _build/hardware.json" -q ledon.v
nextpnr-ecp5 --25k --package CABGA256 --json _build/hardware.json --textcfg _build/hardware.config --report _build/hardware.pnr --lpf pinout.lpf -q --timing-allow-fail --force
ecppack --compress --db /Users/user/.apio/ packages/tools-oss-cad-suite/share/trellis/database _build/hardware.config hardware.bit
Error: too many positional options have been specified on the command line

@zapta
Copy link
Collaborator Author

zapta commented Nov 26, 2024

I added in apio_context.py a function called _check_no_spaces_in_dir that performs an early check that the project, home, and packages dirs do not contain spaces. The program exits with a message and error status if they do.

Once this is resolved, delete that function.

@zapta
Copy link
Collaborator Author

zapta commented Nov 26, 2024

Posted this question steveicarus/iverilog#1187

@zapta
Copy link
Collaborator Author

zapta commented Nov 26, 2024

@Obijuan, a question to you, do you know what the -B "/Users/user/.apio/packages/tools-oss-cad-suite/lib/ivl" does in the apio test iverilog command?

On the surface, the test seems to work on darwin_arm64 without it and on Windows, we don't use it anyway, though I don't understand the consequences of removing the -B flag.

"" if is_windows(env) or not ivl_path else f'-B "{ivl_path}"'

iverilog -B '/Users/user/.apio/packages/tools-oss-cad-suite/lib/ivl' -o _build/ledon_tb.out -DVCD_OUTPUT=_build/ledon_tb -DNO_ICE40_DEFAULT_ASSIGNMENTS /Users/user/.apio/packages/tools-oss-cad-suite/share/yosys/ice40/cells_sim.v main.v ledon_tb.v

@zapta
Copy link
Collaborator Author

zapta commented Nov 26, 2024

Hi @Obijuan, I see that you close this issue. What resolution do you have in mind?

  1. It's safe to remove the -B flag.

or

  1. Apio supporting paths with spaces is not requirement.

@zapta zapta reopened this Nov 26, 2024
@Obijuan
Copy link
Member

Obijuan commented Nov 26, 2024

ups, sorry, I closed it by mistake. I do not remember the details of the -B flag. I need some time to catch up, but currently I have no time left. I will resume the work with apio once I finish my lectures this semester

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants