Coder Social home page Coder Social logo

Comments (6)

olofk avatar olofk commented on May 23, 2024

There might be a simple way to solve this, even though it's not the prettiest way. FuseSoC has support for running scripts at different stages. pre_run_scripts are executed before the simulation is run, so we could put in a script that checks for gelf.h.

Unfortunately, right now I think that only scripts in the top-level core is run, but that should be easy to fix, so that scripts from all the included cores are run.

If we get a lot of external dependencies, we should probably spend some effort to make a better mechanism for this, but I think this might actually be one of the only external requirements so we don't have to solve it in a completely generic way

from fusesoc.

mgielda avatar mgielda commented on May 23, 2024

This sounds like a good enough idea for now! If there is already a good mechanism that will work, no sense inventing a new one before we hit further problems, which probably will not happen any time soon.

I can see pre_run_scripts was not implemented in any of the cores in the main repo, am I right? If you could implement the solution you mention I could document how the pre_run_scripts section can be used for things like checking dependencies.

from fusesoc.

olofk avatar olofk commented on May 23, 2024

I have now made some updates to FuseSoC so that scripts are run for all cores in the dependency lists as well. Now we just need to add the following to elf-loader.core:

[scripts]
pre_run_scripts = check_for_libelf.sh

and add an executable script called check_for_libelf.sh with something like this in it:

echo #include <gelf.h> > test.c
echo void main(void) {} >> test.c

gcc test.c || echo "Error: Missing libelf headers"

Not sure what is best practice to search for this, so I'm leaving the last part for someone else to implement.

Note that two more things should be improved as well

  1. This only applies to simulations. I realized that the scripts executed in the FPGA build flow are fetched from the system file. Need some refactoring here
  2. Need to break or warn on script exit code. Not sure about best practice here either. Perhaps 0 = success, >0 = warning, <0 = error or something like that. Love to get some input here as well.

from fusesoc.

olofk avatar olofk commented on May 23, 2024

FuseSoC now aborts on scripts that returns an exit code != 0. Now we just need add the scripts for the missing dependencies

from fusesoc.

olofk avatar olofk commented on May 23, 2024

Oh well. I added and pushed the scripts as well. Please try it out and close the issue if it works

from fusesoc.

mgielda avatar mgielda commented on May 23, 2024

Awesome! Works. Just fixed a little bug in #81

Closing this one.

from fusesoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.