Open RRArinc opened 2 days ago
Works for me using the most recent GCC 13.2 CI build:
wget https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.09.03/riscv32-elf-ubuntu-22.04-gcc-nightly-2024.09.03-nightly.tar.gz
tar xzvf riscv32-elf-ubuntu-22.04-gcc-nightly-2024.09.03-nightly.tar.gz
cd riscv/bin
vi test.c
# Add the code above
./riscv32-unknown-elf-gcc test.c -o test
./qemu-riscv32 test
hello -1- world -1.000000-
You'll probably need to explain in more detail how you're getting/building your toolchain, how you're compiling your code, how you're running your program etc.
Hi, I build the toolchain GCC13 version and able to compile the sample c code as below and observed the following.
// program to printf fixed and float point values
include
int main() { printf( "hello -%g- world -%f-\n", 1.0, 1.0f); return 0; }
Any online GCC compiler provides output as hello -1- world -1.000000-
However riscv32-unknown-elf-gcc compiles and outputs as hello -g- world -1.000000-
Here format specifier %g representing "fixed point" value is not printed correctly, but only prints "floating point" values.
Note: Toolchain is build for bare metal and not Linux flavour.
Any inputs/suggestions are welcome.
Thanks