Error building freedom-e-sdk

Hi all. Is this the best place to ask about this? Do you have any suggestions? Need more info?

I tried to do “make software” in my freedom-e-sdk directory. This happened, errors start in the middle of below (in case anyone is wondering, I had to munge the https part at, e.g., PACKAGE_BUGREPORT so I could post this… only 2 links allowed new users, but that has nothing to do with the error)…

$ make software
cd /home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/build/debug/ &&
CFLAGS="-march=rv32imac -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections -I/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/install/include --specs=nano.specs -O0 -g"
/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/configure
–host=riscv64-unknown-elf
–prefix=/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/install
–libdir=/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/install/lib/debug
–disable-maintainer-mode
–with-preconfigured
–with-machine-name=freedom-e310-arty
–with-machine-header=/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/metal.h
–with-machine-inline=/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/metal-inline.h
–with-platform-header=/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/metal-platform.h
–with-machine-ldscript=/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/metal.default.lds
–with-builtin-libgloss
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for riscv64-unknown-elf-strip… riscv64-unknown-elf-strip
checking for a thread-safe mkdir -p… /bin/mkdir -p
checking for gawk… gawk
checking whether make sets $(MAKE)… yes
checking whether make supports nested variables… yes
checking whether to enable maintainer-specific portions of Makefiles… no
checking for riscv64-unknown-elf-gcc… riscv64-unknown-elf-gcc
checking whether the C compiler works… yes
checking for C compiler default output file name… a.out
checking for suffix of executables…
checking whether we are cross compiling… yes
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether riscv64-unknown-elf-gcc accepts -g… yes
checking for riscv64-unknown-elf-gcc option to accept ISO C89… none needed
checking whether riscv64-unknown-elf-gcc understands -c and -o together… yes
checking for style of include used by make… GNU
checking dependency style of riscv64-unknown-elf-gcc… gcc3
checking for riscv64-unknown-elf-ranlib… riscv64-unknown-elf-ranlib
checking for riscv64-unknown-elf-ar… riscv64-unknown-elf-ar
checking the archiver (riscv64-unknown-elf-ar) interface… ar
checking dependency style of riscv64-unknown-elf-gcc… gcc3
checking whether C compiler accepts mmachine=… no
checking whether C compiler accepts menv=metal… no
checking that generated files are newer than configure… done
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
touch -c /home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/build/debug/Makefile
make -C /home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/build/debug install
make[1]: Entering directory ‘/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/build/debug’
cp /home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/metal.h metal/machine.h
cp /home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/metal-inline.h metal/machine/inline.h
cp /home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/metal-platform.h metal/machine/platform.h
cat /home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/riscv__menv__metal.specs.in > riscv__menv__metal.specs
touch riscv__mmachine__freedom-e310-arty.specs
make install-am
make[2]: Entering directory ‘/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/build/debug’
riscv64-unknown-elf-gcc -DPACKAGE_NAME=“freedom-metal” -DPACKAGE_TARNAME=“freedom-metal” -DPACKAGE_VERSION=“v0.1.2” -DPACKAGE_STRING=“freedom-metal\ v0.1.2” -DPACKAGE_BUGREPORT=“githubcom/sifive/freedom-metal/issues” -DPACKAGE_URL=“githubcom/sifive/freedom-metal” -DPACKAGE=“freedom-metal” -DVERSION=“v0.1.2” -I. -I/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal -lriscv_metal_ -march=rv32imac -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections -I/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/install/include --specs=nano.specs -O0 -g -MT src/drivers/libriscv__mmachine__freedom-e310-arty_a-fixed-clock.o -MD -MP -MF src/drivers/.deps/libriscv__mmachine__freedom-e310-arty_a-fixed-clock.Tpo -c -o src/drivers/libriscv__mmachine__freedom-e310-arty_a-fixed-clock.o test -f 'src/drivers/fixed-clock.c' || echo '/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/'src/drivers/fixed-clock.c
mv -f src/drivers/.deps/libriscv__mmachine__freedom-e310-arty_a-fixed-clock.Tpo src/drivers/.deps/libriscv__mmachine__freedom-e310-arty_a-fixed-clock.Po
riscv64-unknown-elf-gcc -DPACKAGE_NAME=“freedom-metal” -DPACKAGE_TARNAME=“freedom-metal” -DPACKAGE_VERSION=“v0.1.2” -DPACKAGE_STRING=“freedom-metal\ v0.1.2” -DPACKAGE_BUGREPORT=“githubcom/sifive/freedom-metal/issues” -DPACKAGE_URL=“githubcom/sifive/freedom-metal” -DPACKAGE=“freedom-metal” -DVERSION=“v0.1.2” -I. -I/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal -lriscv_metal_ -march=rv32imac -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections -I/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/install/include --specs=nano.specs -O0 -g -MT src/drivers/libriscv__mmachine__freedom-e310-arty_a-fixed-factor-clock.o -MD -MP -MF src/drivers/.deps/libriscv__mmachine__freedom-e310-arty_a-fixed-factor-clock.Tpo -c -o src/drivers/libriscv__mmachine__freedom-e310-arty_a-fixed-factor-clock.o test -f 'src/drivers/fixed-factor-clock.c' || echo '/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/'src/drivers/fixed-factor-clock.c
mv -f src/drivers/.deps/libriscv__mmachine__freedom-e310-arty_a-fixed-factor-clock.Tpo src/drivers/.deps/libriscv__mmachine__freedom-e310-arty_a-fixed-factor-clock.Po
riscv64-unknown-elf-gcc -DPACKAGE_NAME=“freedom-metal” -DPACKAGE_TARNAME=“freedom-metal” -DPACKAGE_VERSION=“v0.1.2” -DPACKAGE_STRING=“freedom-metal\ v0.1.2” -DPACKAGE_BUGREPORT=“githubcom/sifive/freedom-metal/issues” -DPACKAGE_URL=“githubcom/sifive/freedom-metal” -DPACKAGE=“freedom-metal” -DVERSION=“v0.1.2” -I. -I/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal -lriscv_metal_ -march=rv32imac -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections -I/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/install/include --specs=nano.specs -O0 -g -MT src/drivers/libriscv__mmachine__freedom-e310-arty_a-inline.o -MD -MP -MF src/drivers/.deps/libriscv__mmachine__freedom-e310-arty_a-inline.Tpo -c -o src/drivers/libriscv__mmachine__freedom-e310-arty_a-inline.o test -f 'src/drivers/inline.c' || echo '/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/'src/drivers/inline.c
mv -f src/drivers/.deps/libriscv__mmachine__freedom-e310-arty_a-inline.Tpo src/drivers/.deps/libriscv__mmachine__freedom-e310-arty_a-inline.Po
riscv64-unknown-elf-gcc -DPACKAGE_NAME=“freedom-metal” -DPACKAGE_TARNAME=“freedom-metal” -DPACKAGE_VERSION=“v0.1.2” -DPACKAGE_STRING=“freedom-metal\ v0.1.2” -DPACKAGE_BUGREPORT=“githubcom/sifive/freedom-metal/issues” -DPACKAGE_URL=“githubcom/sifive/freedom-metal” -DPACKAGE=“freedom-metal” -DVERSION=“v0.1.2” -I. -I/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal -lriscv_metal_ -march=rv32imac -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections -I/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/install/include --specs=nano.specs -O0 -g -MT src/drivers/libriscv__mmachine__freedom-e310-arty_a-riscv_clint0.o -MD -MP -MF src/drivers/.deps/libriscv__mmachine__freedom-e310-arty_a-riscv_clint0.Tpo -c -o src/drivers/libriscv__mmachine__freedom-e310-arty_a-riscv_clint0.o test -f 'src/drivers/riscv_clint0.c' || echo '/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/'src/drivers/riscv_clint0.c
mv -f src/drivers/.deps/libriscv__mmachine__freedom-e310-arty_a-riscv_clint0.Tpo src/drivers/.deps/libriscv__mmachine__freedom-e310-arty_a-riscv_clint0.Po
riscv64-unknown-elf-gcc -DPACKAGE_NAME=“freedom-metal” -DPACKAGE_TARNAME=“freedom-metal” -DPACKAGE_VERSION=“v0.1.2” -DPACKAGE_STRING=“freedom-metal\ v0.1.2” -DPACKAGE_BUGREPORT=“githubcom/sifive/freedom-metal/issues” -DPACKAGE_URL=“githubcom/sifive/freedom-metal” -DPACKAGE=“freedom-metal” -DVERSION=“v0.1.2” -I. -I/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal -lriscv_metal_ -march=rv32imac -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections -I/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/install/include --specs=nano.specs -O0 -g -MT src/drivers/libriscv__mmachine__freedom-e310-arty_a-riscv_cpu.o -MD -MP -MF src/drivers/.deps/libriscv__mmachine__freedom-e310-arty_a-riscv_cpu.Tpo -c -o src/drivers/libriscv__mmachine__freedom-e310-arty_a-riscv_cpu.o test -f 'src/drivers/riscv_cpu.c' || echo '/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/'src/drivers/riscv_cpu.c
mv -f src/drivers/.deps/libriscv__mmachine__freedom-e310-arty_a-riscv_cpu.Tpo src/drivers/.deps/libriscv__mmachine__freedom-e310-arty_a-riscv_cpu.Po
riscv64-unknown-elf-gcc -DPACKAGE_NAME=“freedom-metal” -DPACKAGE_TARNAME=“freedom-metal” -DPACKAGE_VERSION=“v0.1.2” -DPACKAGE_STRING=“freedom-metal\ v0.1.2” -DPACKAGE_BUGREPORT=“githubcom/sifive/freedom-metal/issues” -DPACKAGE_URL=“githubcom/sifive/freedom-metal” -DPACKAGE=“freedom-metal” -DVERSION=“v0.1.2” -I. -I/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal -lriscv_metal_ -march=rv32imac -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections -I/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/install/include --specs=nano.specs -O0 -g -MT src/drivers/libriscv__mmachine__freedom-e310-arty_a-riscv_plic0.o -MD -MP -MF src/drivers/.deps/libriscv__mmachine__freedom-e310-arty_a-riscv_plic0.Tpo -c -o src/drivers/libriscv__mmachine__freedom-e310-arty_a-riscv_plic0.o test -f 'src/drivers/riscv_plic0.c' || echo '/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/'src/drivers/riscv_plic0.c
In file included from /home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/src/drivers/riscv_plic0.c:8:
/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/src/drivers/riscv_plic0.c: In function ‘__metal_plic0_claim_interrupt’:
/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/src/drivers/riscv_plic0.c:17:12: error: ‘METAL_RISCV_PLIC0_CLAIM’ undeclared (first use in this function); did you mean ‘METAL_RISCV_PLIC0_0_SIZE’?
METAL_RISCV_PLIC0_CLAIM));
^~~~~~~~~~~~~~~~~~~~~~~
/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/metal/io.h:8:47: note: in definition of macro ‘__METAL_ACCESS_ONCE’
#define __METAL_ACCESS_ONCE(x) ((typeof(*x) volatile *)(x))
^
/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/src/drivers/riscv_plic0.c:17:12: note: each undeclared identifier is reported only once for each function it appears in
METAL_RISCV_PLIC0_CLAIM));
^~~~~~~~~~~~~~~~~~~~~~~
/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/metal/io.h:8:47: note: in definition of macro ‘__METAL_ACCESS_ONCE’
#define __METAL_ACCESS_ONCE(x) (
(typeof(*x) volatile )(x))
^
/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/src/drivers/riscv_plic0.c: In function ‘__metal_plic0_complete_interrupt’:
/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/src/drivers/riscv_plic0.c:25:12: error: ‘METAL_RISCV_PLIC0_CLAIM’ undeclared (first use in this function); did you mean ‘METAL_RISCV_PLIC0_0_SIZE’?
METAL_RISCV_PLIC0_CLAIM)) = id;
^~~~~~~~~~~~~~~~~~~~~~~
/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/metal/io.h:8:47: note: in definition of macro ‘__METAL_ACCESS_ONCE’
#define __METAL_ACCESS_ONCE(x) (
(typeof(*x) volatile )(x))
^
/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/src/drivers/riscv_plic0.c: In function ‘__metal_plic0_set_threshold’:
/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/src/drivers/riscv_plic0.c:32:12: error: ‘METAL_RISCV_PLIC0_THRESHOLD’ undeclared (first use in this function); did you mean ‘METAL_RISCV_PLIC0_0_SIZE’?
METAL_RISCV_PLIC0_THRESHOLD)) = threshold;
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/metal/io.h:8:47: note: in definition of macro ‘__METAL_ACCESS_ONCE’
#define __METAL_ACCESS_ONCE(x) (
(typeof(*x) volatile )(x))
^
/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/src/drivers/riscv_plic0.c: In function ‘__metal_plic0_get_threshold’:
/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/src/drivers/riscv_plic0.c:41:12: error: ‘METAL_RISCV_PLIC0_THRESHOLD’ undeclared (first use in this function); did you mean ‘METAL_RISCV_PLIC0_0_SIZE’?
METAL_RISCV_PLIC0_THRESHOLD));
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jrl/projects/riscv/freedom-e-sdk/freedom-metal/metal/io.h:8:47: note: in definition of macro ‘__METAL_ACCESS_ONCE’
#define __METAL_ACCESS_ONCE(x) (
(typeof(*x) volatile *)(x))
^
Makefile:1206: recipe for target ‘src/drivers/libriscv__mmachine__freedom-e310-arty_a-riscv_plic0.o’ failed
make[2]: *** [src/drivers/libriscv__mmachine__freedom-e310-arty_a-riscv_plic0.o] Error 1
make[2]: Leaving directory ‘/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/build/debug’
Makefile:2133: recipe for target ‘install’ failed
make[1]: *** [install] Error 2
make[1]: Leaving directory ‘/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/build/debug’
scripts/libmetal.mk:111: recipe for target ‘/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/install/lib/debug/stamp’ failed
make: *** [/home/jrl/projects/riscv/freedom-e-sdk/bsp/freedom-e310-arty/install/lib/debug/stamp] Error 2

Maybe you have inconsistent versions of freedom-e-sdk and freedom-metal checked out? What does “git status” say?

The default branch for freedom-e-sdk is the v201908-branch. The default target is freedom-e310. If you look in bsp/freedom-e310/metal-platform.h you will find a definition of METAL_RISCV_PLIC0_CLAIM.

However, bsp is part of the freedom-e-sdk repo and freedom-metal is a different repo included as a submodule. If I check out the master branch of freedom-e-sdk, and don’t do a “git submodule update --init --recursive” command to update freedom-metal, then I can reproduce the problem you reported. Everytime you checkout a new branch, you need to update the submodules since they might be different on a new branch.

Yep. I removed it all, rechecked it out, did the submodule update (which I did before, and git status showed v201908-branch both at the top and in the freedom-metal directory, but I may have done a
git pull origin master without redoing the submodule update or something like that), and hello apparently compiled. Thanks!