cannot generate random number on scr1 with pre-build binary tool
odingo opened this issue · 5 comments
Hi,
I'm trying to run simple C code on scr1, but failed to generate random number.
I used 'rand()' in the C code and compiled it with the pre-build binary tool which was downloaded from http://syntacore.com/page/products/sw-tools. (in Linux)
But the 'rand()' always returned zero value.
The workaround now is to use -Wl,--wrap=srand,--wrap=rand with compiler and to write my own srand(), and rand() functions.
Hi,
I'm trying to run simple C code on scr1, but failed to generate random number.
I used 'rand()' in the C code and compiled it with the pre-build binary tool which was downloaded from http://syntacore.com/page/products/sw-tools. (in Linux)
But the 'rand()' always returned zero value.
Hello!
We have checked and have not found any problems with the rand function. Please describe what you are doing in more detail (we are interested in the compiler keywords, linker script and minimal code).
BR,
Irina
CPU architecture
ARCH := ec
ABI := ilp32e
Tool chain
export CROSS_PREFIX ?= riscv64-unknown-elf-
export GNU_CC ?= $(CROSS_PREFIX)gcc
export GNU_OBJDUMP ?= $(CROSS_PREFIX)objdump
export GNU_OBJCOPY ?= $(CROSS_PREFIX)objcopy
LINKER_SCRIPT = $(CODE_DIR)/common/link.ld
FLAGS = -O0 -funroll-loops -fpeel-loops -fgcse-sm -fgcse-las -g -Wl,--wrap=srand,--wrap=rand
CFLAGS_COMMON = -static -std=gnu99 -fno-common -fno-builtin-printf
CFLAGS_ARCH = -Wa,-march=rv32$(ARCH) -march=rv32$(ARCH) -mabi=$(ABI)
GNU_CC_FLAGS =
LDFLAGS ?= -nostartfiles -nostdlib -lc -lgcc -march=rv32$(ARCH) -mabi=$(ABI)