im-tomu / foboot

Bootloader for Fomu
Apache License 2.0
99 stars 32 forks source link

string.h: No such file or directory #335

Open danielkucera opened 6 months ago

danielkucera commented 6 months ago

Hello,

I am unable to build the hw, I am running:

~/Projects/ice50/foboot/hw$ python3 foboot-bitstream.py --revision pvt --seed 19
...
INFO:SoC:--------------------------------------------------------------------------------
INFO:SoCBusHandler:Interconnect: InterconnectShared (2 <-> 4).
make: Entering directory '/storage/Projects/ice50/foboot/hw/build/software/bios'
  CC       ../../../../sw/src/dfu.c dfu.o
../../../../sw/src/dfu.c:25:10: fatal error: string.h: No such file or directory
   25 | #include <string.h>
      |          ^~~~~~~~~~
compilation terminated.
make: *** [/storage/Projects/ice50/foboot/sw/Makefile:124: .obj/dfu.o] Error 1
make: Leaving directory '/storage/Projects/ice50/foboot/hw/build/software/bios'
Traceback (most recent call last):
  File "/storage/Projects/ice50/foboot/hw/foboot-bitstream.py", line 575, in <module>
    main()
  File "/storage/Projects/ice50/foboot/hw/foboot-bitstream.py", line 549, in main
    vns = builder.build(build_name="top")
  File "/storage/Projects/ice50/foboot/hw/deps/litex/litex/soc/integration/builder.py", line 212, in build
    self._generate_rom_software(not self.soc.integrated_rom_initialized)
  File "/storage/Projects/ice50/foboot/hw/deps/litex/litex/soc/integration/builder.py", line 192, in _generate_rom_software
    subprocess.check_call(["make", "-C", dst_dir, "-f", makefile])
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make', '-C', '/storage/Projects/ice50/foboot/hw/build/software/bios', '-f', '/storage/Projects/ice50/foboot/sw/Makefile']' returned non-zero exit status 2.

I tried using picolibc:

diff --git a/sw/Makefile b/sw/Makefile
index 1c86a5b..8593cc2 100644
--- a/sw/Makefile
+++ b/sw/Makefile
@@ -25,7 +25,7 @@ ifeq ($(LITEX),1)
 BASE_DIR   := ../../../../sw
 LDSCRIPT   := $(BASE_DIR)/ld/linker.ld
 LD_DIR     := ../include/generated
-ADD_CFLAGS := -I../include -I$(BASE_DIR)/include
+ADD_CFLAGS := -I../include -I$(BASE_DIR)/include -I/usr/lib/picolibc/riscv64-unknown-elf/include
 ADD_LFLAGS := 
 PACKAGE    := bios
 else

but it seems it doesn't fit:

  CC       ../../../../sw/third_party/libbase/qsort.c   qsort.o
  CC       ../../../../sw/third_party/libbase/time.c    time.o
  CC       ../../../../sw/third_party/libbase/uart.c    uart.o
  LD       bios.elf
/usr/lib/riscv64-unknown-elf/bin/ld: section .srodata.landing_url_descriptor LMA [0000000000001a6c,0000000000001a7a] overlaps section .data LMA [0000000000001a6c,0000000000001a73]
collect2: error: ld returned 1 exit status
make: *** [/storage/Projects/ice50/foboot/sw/Makefile:98: bios.elf] Error 1
make: Leaving directory '/storage/Projects/ice50/foboot/hw/build/software/bios'
Traceback (most recent call last):
  File "/storage/Projects/ice50/foboot/hw/foboot-bitstream.py", line 575, in <module>
    main()
  File "/storage/Projects/ice50/foboot/hw/foboot-bitstream.py", line 549, in main
    vns = builder.build(build_name="top")
  File "/storage/Projects/ice50/foboot/hw/deps/litex/litex/soc/integration/builder.py", line 212, in build
    self._generate_rom_software(not self.soc.integrated_rom_initialized)
  File "/storage/Projects/ice50/foboot/hw/deps/litex/litex/soc/integration/builder.py", line 192, in _generate_rom_software
    subprocess.check_call(["make", "-C", dst_dir, "-f", makefile])
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make', '-C', '/storage/Projects/ice50/foboot/hw/build/software/bios', '-f', '/storage/Projects/ice50/foboot/sw/Makefile']' returned non-zero exit status 2.

How do I fix this?