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

Question: env section problem. #679

Open
BaseHardware opened this issue Mar 18, 2024 · 3 comments
Open

Question: env section problem. #679

BaseHardware opened this issue Mar 18, 2024 · 3 comments

Comments

@BaseHardware
Copy link

Hello, I am a newbie of fusesoc.
I declared the script entries in my core file and added an env section to the entries to designate some environmental variables when executing commands in the script entry.
The entries in the scripts section of my core file will be used in the pre_build or post_build section of the synth target.

However, I cannot see any environment variables declared in my core file. How can could it be? Am I wrong in writing the core file?
The following codelet is a part of my core file:

targets:
  default: &default
    filesets:
      - test_files
    hooks:
      pre_build:
        - testscr


scripts:
  testscr:
    cmd:
      - "@python3 ./print_environ.py"
    env:
      test: testvar

print_environ.py does not show the environmental variable of test.
Is this an intended behavior? How can I put an environment variable to my script?

@BaseHardware
Copy link
Author

I think specifying the tool that I used is also important. It was vivado.

@olofk
Copy link
Owner

olofk commented Mar 27, 2024

I think there might be something funky with env vars in scripts. Have a vague memory of this. Unfortunately don't have time myself to look into that right now. Maybe set it before running FuseSoC as a workaround?

@BaseHardware
Copy link
Author

BaseHardware commented Mar 29, 2024

@olofk Thanks for your reply. I share my understanding of this problem: When I tested this problem with the tool 'ghdl', the problem disappeared and it seems the problem is related to the behavior of edalize.

Although I don't know the exact reason, let me say the apparent reason: If I use 'ghdl', the script is executed through the _run_scripts of the edatool class, which sets the environmental variables and any other configurations properly with the core file, while in 'vivado', the script is executed through the 'pre_build' section of the generated Makefile in the build directory, which does not perform such an initialization task for scripts.

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