Freedom Studio

I have followed the instructions in the quick start guide and sucesfully imported the example projects, but when I attempt to build any project I get an error like this one.

04:56:59 **** Incremental Build of configuration Debug for project hello ****
make all
Building file: …/bsp/env/freedom-e300-hifive1/init.c
Invoking: RISC-V GCC/Newlib C Compiler
/home/steve/FreedomStudio/bin/riscv64-unknown-elf-gcc -mabi=ilp32 -g3 -gdwarf-2 -march=rv32imac -I"/home/steve/project test/hello/bsp/env/freedom-e300-hifive1" -I"/home/steve/project test/hello/bsp/env" -I"/home/steve/project test/hello/bsp/include" -I"/home/steve/project test/hello/bsp/drivers" -O0 -ffunction-sections -fdata-sections -Wall -c -fno-builtin-printf -include sys/cdefs.h -MMD -MP -MF"bsp/env/freedom-e300-hifive1/init.d" -MT"bsp/env/freedom-e300-hifive1/init.o" -o “bsp/env/freedom-e300-hifive1/init.o” "…/bsp/env/freedom-e300-hifive1/init.c"
riscv64-unknown-elf-gcc: fatal error: no input files
compilation terminated.
make: *** [bsp/env/freedom-e300-hifive1/init.o] Error 1

It looks like some kind of path issue from the make file but since everything is autogenerated I can’t figure out how to set the correct path.

Any ideas on why this is happening?

Are you importing the examples from the included zip files or from Freedom-E-SDK?

Do you see init.c in your project under Project/bsp/env/freedom-e300-hifive1?

It looks like some kind of path issue from the make file but since everything is autogenerated I can’t figure out how to set the correct path.

Which path is incorrect?

I have tried importing from both the included zip files and the Freedom-E-SDK and have had the same results. The file init.c does exist in Project/bsp/env/freedom-e300-hifive1. The makefile is in the Project/Debug folder but it is like it is not running from that location to get to …/bsp/env/freedom-e300-hifive1/init.c.

What operating system are you using?

What happens if you open a terminal, cd to {Workspace}/hello/Debug and manually invoke make all outside of Eclipse? It should compile normally if the makefiles are auto-generating correctly.

If the build doesn’t work then it may be informative to verify the directories listed in hello/Debug/subdir.mk and hello/Debug/bsp/env/freedom-e300-hifive1/subdir.mk.

You can also double-check the directory Eclipse will use as the build location. Assuming the “hello” program, right-click the “hello” project from Project Explorer and select “Properties.” There will be a section named “Build location” containing a “Build directory” field. It will be greyed out due to “Generate Makefiles automatically” being selected and should contain something like:

${workspace_loc:/hello}/Debug

In your case “/home/steve/project test” is your workspace? This is probably all correct if it’s getting as far as generating makefiles in the first place, mind.

Linux ubuntu 14.04

Manually running make all from the command line produced the same results. So i tried this directly copied from the eclipse console:

steve@steve:~/projecttest/hello/Debug$ /home/steve/FreedomStudio/bin/riscv64-unknown-elf-gcc -mabi=ilp32 -g3 -gdwarf-2 -march=rv32imac -I"/home/steve/projecttest/hello/bsp/env/freedom-e300-hifive1" -I"/home/steve/projecttest/hello/bsp/env" -I"/home/steve/projecttest/hello/bsp/include" -I"/home/steve/projecttest/hello/bsp/drivers" -O0 -ffunction-sections -fdata-sections -Wall -c -fno-builtin-printf -include sys/cdefs.h -MMD -MP -MF"bsp/env/freedom-e300-hifive1/init.d" -MT"bsp/env/freedom-e300-hifive1/init.o" -o “bsp/env/freedom-e300-hifive1/init.o” "…/bsp/env/freedom-e300-hifive1/init.c"
riscv64-unknown-elf-gcc: fatal error: no input files
compilation terminated.

Then I changed the path to where gcc is actually located and init.c compiled.

steve@steve:~/projecttest/hello/Debug$ /home/steve/FreedomStudio/SiFive/riscv64-unknown-elf-gcc-20170503-x86_64-pc-linux-gnu/bin/riscv64-unknown-elf-gcc -mabi=ilp32 -g3 -gdwarf-2 -march=rv32imac -I"/home/steve/projecttest/hello/bsp/env/freedom-e300-hifive1" -I"/home/steve/projecttest/hello/bsp/env" -I"/home/steve/projecttest/hello/bsp/include" -I"/home/steve/projecttest/hello/bsp/drivers" -O0 -ffunction-sections -fdata-sections -Wall -c -fno-builtin-printf -include sys/cdefs.h -MMD -MP -MF"bsp/env/freedom-e300-hifive1/init.d" -MT"bsp/env/freedom-e300-hifive1/init.o" -o “bsp/env/freedom-e300-hifive1/init.o” “…/bsp/env/freedom-e300-hifive1/init.c”
…/bsp/env/freedom-e300-hifive1/init.c: In function ‘_init’:
…/bsp/env/freedom-e300-hifive1/init.c:225:25: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
printf(“core freq at %d Hz\n”, get_cpu_freq());
~^ ~~~~~~~~~~~~~~
%ld

/home/steve/FreedomStudio/bin/riscv64-unknown-elf-gcc is not passing anything into the “real” application located in /home/steve/FreedomStudio/SiFive/riscv64-unknown-elf-gcc-20170503-x86_64-pc-linux-gnu/bin/.

In eclipse, the freedom studio quick launch “change toolchain path” doesn’t seem to work. When I try to change to the path that complies init.c and build, the path reverts back to /home/steve/FreedomStudio/bin/riscv64-unknown-elf-gcc. I also have the same problem with changing the PATH environment variable in properities.

I’m curious if you navigate to /home/steve/FreedomStudio/bin/ and try to run riscv64-unknown-elf-gcc --version if it reports back the toolchain version?

You can also manually add the toolchain to your path and it should work as the button in the quicklaunch only appends to your normal environment PATH.

alternatively you can create new symlinks to /home/steve/FreedomStudio/bin/ by issuing something similar to the following

rm /home/steve/FreedomStudio/bin/*
ln -s /home/steve/FreedomStudio/SiFive/riscv64-unknown-elf-gcc-20170503-x86_64-pc-linux-gnu/bin/* /home/steve/FreedomStudio/bin/

In any case this is an area we are actively working on as we are switching to a new build plugin. The new plugin should help a lot with path issues. Hopefully one of my recommendations above gets you going for now.

The new symlinks did the trick. I also had to copy over /home/steve/FreedomStudio/SiFive/riscv64-unknown-elf-gcc-20170503-x86_64-pc-linux-gnu/libexec/gcc/riscv64-unknown-elf/liblto_plugin.so with the file from the freedom-e-sdk because the linker was complaining that file was too small. Finally, I had to symlink the openocd path to get the debugger to work. Now I can compile, run the debugger, set breakpoints, single step, etc.
Thanks for the help.

Thats great! Thanks for the feedback on liblto_plugin.so.

Happy Debugging :wink: