angry-goose-initiative / wiki

AGI Wiki
0 stars 0 forks source link

C++ RVSW Weirdness #51

Open JZJisawesome opened 4 months ago

JZJisawesome commented 4 months ago

Why is cout not printing the right string here (uart_write_interrupt_test.elf)?

IRVE> Starting IRVE
IRVE>  ___ ______     _______  __
IRVE> |_ _|  _ \ \   / / ____| \ \
IRVE>  | || |_) \ \ / /|  _|    \ \
IRVE>  | ||  _ < \ V / | |___   / /
IRVE> |___|_| \_\ \_/  |_____| /_/
IRVE> 
IRVE> The Inextensible RISC-V Emulator
IRVE> Copyright (C) 2023-2024 John Jekel
IRVE> Copyright (C) 2023-2024 Nick Chan
IRVE> Copyright (C) 2024      Sam Graham
IRVE> Copyright (C) 2024      Seb Atkinson
IRVE> See the LICENSE file at the root of the project for licensing info.
IRVE> 
IRVE> libirve Version 0.9.1 Commit a0aa2fc6ce644904269175c8123c66324c5b860c-dirty
IRVE> libirve built at 23:38:30 on Mar  6 2024
IRVE> irve executable built at 23:10:25 on Mar  6 2024
IRVE> ------------------------------------------------------------------------
IRVE> 
IRVE> 
IRVE> Initializing emulator...
IRVE> Loading memory image from file "rvsw/compiled/src/single_file/cxx/uart_write_interrupt_test.elf"
IRVE> Initialized the emulator in 52360us
IRVE> RVDEBUGADDR: "This program tests writing a string to the UART using interrupts!\n"
IRVE> RVDEBUGADDR: "You should see the string "This is a test string to write to the UART!\n"
IRVE> RVDEBUGADDR: "".\n"
This is a test string to write to the UART!
IRVE> RVDEBUGADDR: "Did it work?\n"
IRVE> Emulation finished in 36737us
IRVE> 2884529 instructions were executed
IRVE> Average of 78518360.236274 instructions per second (78.518360MHz)
IRVE> IRVE is shutting down. Bye bye!
JZJisawesome commented 4 months ago

Oops, looks like adding \n and to the end of the test string and removing volatile from it as well made the difference? You can check my past edit to the above post to see...

Very weird. Check out the RVSW commit that affects uart_write_interrupt_tests.cpp to explore the changes.