efabless / caravel_board

31 stars 41 forks source link

Add libgcc to firmware examples Makefiles? #101

Open mbalestrini opened 7 months ago

mbalestrini commented 7 months ago

Testing some caravel firmware project that had integer multiplication I got this error: undefined reference to '__mulsi3'

It seems that the default Makefile didn't include libgcc, where soft implementations of mult, mod, float, etc are located

Adding -lgcc at the end of the compilation command seems to solve the issue: $(TOOLCHAIN_PATH)$(TOOLCHAIN_PREFIX)-gcc -I../ -I../generated/ -O0 -mabi=ilp32 -march=$(ARCH) -D__vexriscv__ -Wl,-Bstatic,-T,../sections.lds,--strip-debug -ffreestanding -nostdlib -o $@ ../crt0_vex.S ../isr.c ../stub.c $< -lgcc

I'm not an expert on the subject so maybe there are some other implications to adding libgcc, but it seems to me that making this change could help others that may run into this issue