Hello everyone, hope you are all doing great!
This is my first email within this group and frankly I'm not sure if it's the
right place to ask for help or report a bug, so please feel free to warn me in
case I should post this elsewhere. I am currently facing some weird problems on
a RISC-V project meant to run on the QEMU environment and thought that maybe
someone here could give me a light on the subject.
I am trying to run a project built on top of one of FreeRTOS' official demo
ports that target the 'virt' QEMU board. I ran across a few weird behaviors
where code execution would just hang at some point (QEMU would keep execution
but the expected terminal output would never come up). I don't have sufficient
knowledge to tell whether the issue is with the FreeRTOS port, the RISC-V gnu
toolchain or QEMU itself, hence why I am raising my hand for help on all
related channels.
This repository
<https://bitbucket.org/softcps-investigacao-risc-v/freertos-riscv-bugs/src/master/> contains
more details and a sample project that illustrates well one of the problems I've been getting lately
(I also give more context about it here
<https://github.com/riscv-collab/riscv-gnu-toolchain/issues/1434>). It basically goes like
this: the program *executes fine* when a certain code snippet is encapsulated *within a function*,
but *"crashes"* (i.e. hangs) when the same snippet is placed *directly in the main code*:
The scope shouldn't matter at all here, since there is no local variable being
used or anything like that. I have tested things like removing compiling
optimization (i.e. changing -Os for -O0) and using regular malloc() instead of
FreeRTOS' dynamic allocation API, but all without success. Note that even
though the project is build on top of the FreeRTOS demo port, no RTOS
functionality is used within this code to make it as simple as it gets.
And that's basically it. If any of you have a wild guess on the likely cause or
something, please let me know.
Thanks in advance.
Best regards,
Alexander Paschoaletto