Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

missing "encoding.h"!! #11

Open
NawrasAltaleb opened this issue Sep 8, 2018 · 7 comments
Open

missing "encoding.h"!! #11

NawrasAltaleb opened this issue Sep 8, 2018 · 7 comments

Comments

@NawrasAltaleb
Copy link

NawrasAltaleb commented Sep 8, 2018

Hi,
when trying to make riscv-spike it's giving me a message that arch/boot.S is missing encoding.h
I know that FreeRTOS_on_Mi-V_Processor/miv-rv32im-freertos-port-test/riscv_hal/ directory has a "encoding.h" but I don't think this works for riscv-spike because it's still missing some definitions like "CAUSE_MACHINE_ECALL".

@AntonKrug
Copy link
Contributor

Can you try it again now? When I try to build the current sources the output is not clean and there are warnings, but it builds working binary and it does run on my spike:

akrug@xeon32:/opt/projects/freertos_spike/FreeRTOS/FreeRTOS_on_Spike/Demo/riscv-spike$ make
CC arch/boot.S
CC ../../Source/portable/GCC/RISCV/portasm.S
CC ../../Source/portable/GCC/RISCV/port.c
CC ../../Source/list.c
CC ../../Source/tasks.c
CC ../../Source/event_groups.c
CC ../../Source/croutine.c
CC ../../Source/timers.c
CC ../../Source/queue.c
CC ../../Source/portable/MemMang/heap_2.c
CC ../../Source/string.c
CC arch/clib.c
CC arch/syscalls.c
CC main.c
CC ../Common/Minimal/blocktim.c
CC ../Common/Minimal/countsem.c
CC ../Common/Minimal/recmutex.c
../../Source/string.c: In function 'memcpy':
../../Source/string.c:11:29: warning: pointer of type 'void ' used in arithmetic [-Wpointer-arith]
while ((void
)d < (dest + len - (sizeof(uintptr_t)-1))) {
^
../../Source/string.c:11:35: warning: pointer of type 'void ' used in arithmetic [-Wpointer-arith]
while ((void
)d < (dest + len - (sizeof(uintptr_t)-1))) {
^
../../Source/string.c:12:8: warning: cast increases required alignment of target type [-Wcast-align]
(uintptr_t)d = (const uintptr_t)s;
^
../../Source/string.c:12:25: warning: cast increases required alignment of target type [-Wcast-align]
(uintptr_t)d = (const uintptr_t)s;
^
../../Source/string.c:18:27: warning: pointer of type 'void ' used in arithmetic [-Wpointer-arith]
while (d < (char
)(dest + len))
^
../../Source/string.c: In function 'memset':
../../Source/string.c:33:34: warning: pointer of type 'void ' used in arithmetic [-Wpointer-arith]
while (d < (uintptr_t
)(dest + len))
^
../../Source/string.c:37:29: warning: pointer of type 'void ' used in arithmetic [-Wpointer-arith]
while (d < (char
)(dest + len))
^
../../Source/string.c: At top level:
../../Source/string.c:71:6: warning: no previous prototype for 'atol' [-Wmissing-prototypes]
long atol(const char* str)
^~~~
arch/syscalls.c:82:10: warning: no previous prototype for 'zeroExtend' [-Wmissing-prototypes]
uint64_t zeroExtend(long val)
^~~~~~~~~~
arch/syscalls.c: In function 'prvSyscallToHost':
arch/syscalls.c:102:26: warning: passing argument 1 of 'zeroExtend' makes integer from pointer without a cast [-Wint-conversion]
tohost = zeroExtend(magic_mem);
^~~~~~~~~
arch/syscalls.c:82:10: note: expected 'long int' but argument is of type 'volatile uint64_t * {aka volatile long unsigned int *}'
uint64_t zeroExtend(long val)
^~~~~~~~~~
arch/syscalls.c:95:24: warning: unused variable 'oldfromhost' [-Wunused-variable]
volatile uint64_t oldfromhost;
^~~~~~~~~~~
arch/clib.c: In function 'vFormatPrintString':
arch/clib.c:274:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
putch('x', putdat);
^~~~~~~~~~~~~~~~~~
arch/clib.c:277:4: note: here
case 'x':
^~~~
../../Source/queue.c: In function 'prvCopyDataToQueue':
../../Source/queue.c:1806:12: warning: implicit declaration of function 'memcpy' [-Wimplicit-function-declaration]
( void ) memcpy( ( void * ) pxQueue->pcWriteTo, pvItemToQueue, ( size_t ) pxQueue->uxItemSize ); /*lint !e961 !e418 MISRA exception as the casts are only redundant for some ports, plus previous logic ensures a null pointer can only be passed to memcpy() if the copy size is 0. */
^~~~~~
../../Source/tasks.c: In function 'prvAllocateTCBAndStack':
../../Source/tasks.c:3165:13: warning: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) usStackDepth * sizeof( StackType_t ) );
^~~~~~
Linking....
Completed riscv-spike.elf

@AntonKrug
Copy link
Contributor

Can you confirm if the issue got solved in the meantime or not? If you do not respond it may cause this issue to get closed automatically.

@Srijith-r2
Copy link

The issue still exists.Could you help me out with it?

@vincentabraham
Copy link

Can you confirm if the issue got solved in the meantime or not? If you do not respond it may cause this issue to get closed automatically.

I'm still receiving this issue when i run the command 'make':
arch/boot.S:73:10: fatal error: encoding.h: No such file or directory
73 | #include "encoding.h"

@vincentabraham
Copy link

Can you try it again now? When I try to build the current sources the output is not clean and there are warnings, but it builds working binary and it does run on my spike:

akrug@xeon32:/opt/projects/freertos_spike/FreeRTOS/FreeRTOS_on_Spike/Demo/riscv-spike$ make
CC arch/boot.S
CC ../../Source/portable/GCC/RISCV/portasm.S
CC ../../Source/portable/GCC/RISCV/port.c
CC ../../Source/list.c
CC ../../Source/tasks.c
CC ../../Source/event_groups.c
CC ../../Source/croutine.c
CC ../../Source/timers.c
CC ../../Source/queue.c
CC ../../Source/portable/MemMang/heap_2.c
CC ../../Source/string.c
CC arch/clib.c
CC arch/syscalls.c
CC main.c
CC ../Common/Minimal/blocktim.c
CC ../Common/Minimal/countsem.c
CC ../Common/Minimal/recmutex.c
../../Source/string.c: In function 'memcpy':
../../Source/string.c:11:29: warning: pointer of type 'void ' used in arithmetic [-Wpointer-arith]
while ((void
)d < (dest + len - (sizeof(uintptr_t)-1))) {
^
../../Source/string.c:11:35: warning: pointer of type 'void ' used in arithmetic [-Wpointer-arith]
while ((void
)d < (dest + len - (sizeof(uintptr_t)-1))) {
^
../../Source/string.c:12:8: warning: cast increases required alignment of target type [-Wcast-align]
(uintptr_t)d = (const uintptr_t)s;
^
../../Source/string.c:12:25: warning: cast increases required alignment of target type [-Wcast-align]
(uintptr_t)d = (const uintptr_t)s;
^
../../Source/string.c:18:27: warning: pointer of type 'void ' used in arithmetic [-Wpointer-arith]
while (d < (char
)(dest + len))
^
../../Source/string.c: In function 'memset':
../../Source/string.c:33:34: warning: pointer of type 'void ' used in arithmetic [-Wpointer-arith]
while (d < (uintptr_t
)(dest + len))
^
../../Source/string.c:37:29: warning: pointer of type 'void ' used in arithmetic [-Wpointer-arith]
while (d < (char
)(dest + len))
^
../../Source/string.c: At top level:
../../Source/string.c:71:6: warning: no previous prototype for 'atol' [-Wmissing-prototypes]
long atol(const char* str)
^~~~
arch/syscalls.c:82:10: warning: no previous prototype for 'zeroExtend' [-Wmissing-prototypes]
uint64_t zeroExtend(long val)
^~~~~~~~~~
arch/syscalls.c: In function 'prvSyscallToHost':
arch/syscalls.c:102:26: warning: passing argument 1 of 'zeroExtend' makes integer from pointer without a cast [-Wint-conversion]
tohost = zeroExtend(magic_mem);
^~~~~~~~~
arch/syscalls.c:82:10: note: expected 'long int' but argument is of type 'volatile uint64_t * {aka volatile long unsigned int *}'
uint64_t zeroExtend(long val)
^~~~~~~~~~
arch/syscalls.c:95:24: warning: unused variable 'oldfromhost' [-Wunused-variable]
volatile uint64_t oldfromhost;
^~~~~~~~~~~
arch/clib.c: In function 'vFormatPrintString':
arch/clib.c:274:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
putch('x', putdat);
^~~~~~~~~~~~~~~~~~
arch/clib.c:277:4: note: here
case 'x':
^~~~
../../Source/queue.c: In function 'prvCopyDataToQueue':
../../Source/queue.c:1806:12: warning: implicit declaration of function 'memcpy' [-Wimplicit-function-declaration]
( void ) memcpy( ( void * ) pxQueue->pcWriteTo, pvItemToQueue, ( size_t ) pxQueue->uxItemSize ); /*lint !e961 !e418 MISRA exception as the casts are only redundant for some ports, plus previous logic ensures a null pointer can only be passed to memcpy() if the copy size is 0. */
^~~~~~
../../Source/tasks.c: In function 'prvAllocateTCBAndStack':
../../Source/tasks.c:3165:13: warning: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) usStackDepth * sizeof( StackType_t ) );
^~~~~~
Linking....
Completed riscv-spike.elf

I believe it's due to some paths not included in the make file. Do I have to do anything except do the changes in CCPATH ?

@kevinscully100
Copy link
Collaborator

Is Makefile#L62 possibly a reason for the build error? Seems like the variable RISCV should be assigned the same path as CCPATH in Makefile.inc

@vincentabraham
Copy link

vincentabraham commented Nov 3, 2021

Is Makefile#L62 possibly a reason for the build error? Seems like the variable RISCV should be assigned the same path as CCPATH in Makefile.inc

Yeah, I changed the path but am still getting the same error. It was a slightly different path actually.
On running the command "sudo make", I'm getting the following error:
CC arch/boot.S
make: riscv64-unknown-elf-gcc: Command not found
make: *** [Makefile:130: arch/boot.o] Error 127

Here's my makefile.inc:
RISCV_XLEN ?= 64
RISCV_LIB ?= elf

TARGET=riscv${RISCV_XLEN}-unknown-${RISCV_LIB}
#-----------------------------------------------------------
GCC = $(TARGET)-gcc
OBJCOPY = $(TARGET)-objcopy
OBJDUMP = $(TARGET)-objdump
AR = $(TARGET)-ar
RANLIB = $(TARGET)-ranlib
CCPATH = /home/abraham/Vincent/RISCV

PROG = riscv-spike
CRT0 = arch/boot.S

FREERTOS_SOURCE_DIR = ../../Source
CUNIT = ../../../cunit

Here's my makefile:

include ./Makefile.inc

#Root of RISC-V tools installation. Note that we expect to find the spike
#simulator header files here under $(RISCV)/include/spike .
#RISCV ?= /opt/riscv
RISCV ?= /home/abraham/Vincent/RISCV/riscv64-unknown-elf

FREERTOS_SRC =
$(FREERTOS_SOURCE_DIR)/croutine.c
$(FREERTOS_SOURCE_DIR)/list.c
$(FREERTOS_SOURCE_DIR)/queue.c
$(FREERTOS_SOURCE_DIR)/tasks.c
$(FREERTOS_SOURCE_DIR)/timers.c
$(FREERTOS_SOURCE_DIR)/event_groups.c
$(FREERTOS_SOURCE_DIR)/portable/MemMang/heap_2.c
$(FREERTOS_SOURCE_DIR)/string.c

APP_SOURCE_DIR = ../Common/Minimal

APP_SRC =
$(APP_SOURCE_DIR)/blocktim.c
$(APP_SOURCE_DIR)/countsem.c
$(APP_SOURCE_DIR)/recmutex.c

PORT_SRC = $(FREERTOS_SOURCE_DIR)/portable/GCC/RISCV/port.c
PORT_ASM = $(FREERTOS_SOURCE_DIR)/portable/GCC/RISCV/portasm.S

DEMO_SRC =
arch/syscalls.c
arch/clib.c
main.c

INCLUDES =
-I.
-I$(RISCV)/include
-I./arch
-I./conf
-I./include
-I$(FREERTOS_SOURCE_DIR)/include
-I../Common/include
-I$(FREERTOS_SOURCE_DIR)/portable/GCC/RISCV

CFLAGS =
$(WARNINGS) $(INCLUDES)
-fomit-frame-pointer -fno-strict-aliasing -fno-builtin
-D__gracefulExit -mcmodel=medany #-fPIC

GCCVER = $(shell $(GCC) --version | grep gcc | cut -d" " -f9)

RTOS_OBJ = $(FREERTOS_SRC:.c=.o)
APP_OBJ = $(APP_SRC:.c=.o)
PORT_OBJ = $(PORT_SRC:.c=.o)
DEMO_OBJ = $(DEMO_SRC:.c=.o)
PORT_ASM_OBJ = $(PORT_ASM:.S=.o)
CRT0_OBJ = $(CRT0:.S=.o)
OBJS = $(CRT0_OBJ) $(PORT_ASM_OBJ) $(PORT_OBJ) $(RTOS_OBJ) $(DEMO_OBJ) $(APP_OBJ)

LDFLAGS = -T arch/link.ld -nostartfiles -static -nostdlib
LIBS = -L$(CCPATH)/lib/gcc/$(TARGET)/$(GCCVER)
-L$(CCPATH)/$(TARGET)/lib
-lc -lgcc

%.o: %.c
@echo " CC $<"
@$(GCC) -c $(CFLAGS) -o $@ $<

%.o: %.S
@echo " CC $<"
@$(GCC) -c $(CFLAGS) -o $@ $<

all: $(PROG).elf

$(PROG).elf : $(OBJS) Makefile
@echo Linking....
@$(GCC) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)
@$(OBJDUMP) -S $(PROG).elf &gt; $(PROG).asm
@echo Completed $@

clean :
@rm -f $(OBJS)
@rm -f $(PROG).elf
@rm -f $(PROG).map
@rm -f $(PROG).asm

force_true:
@true

#-------------------------------------------------------------
sim:
spike $(PROG).elf

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants