Closed jmfriedt closed 1 year ago
@jmfriedt I am sorry that this commit caused an issue and a headache. Thank you for the analysis.
I don't recall the exact rationale for the STM32_UART_NO_BAUD_DELAY
macro, but I believe it was something I used as a temporary measure for testing purposes. I can't think of a good reason to break the peripheral timing by default. I am guessing that I uncommented it while debugging an issue and did not intend to commit it into the released code (lazy programming as I should have just enabled the macro from the command line and not modified the code).
So, I think #define STM32_UART_NO_BAUD_DELAY
should be commented out. I will plan on doing this in the near future...
I am using this version of qemu for teaching FreeRTOS including inconsistent access to a shared resource in a multitasking environment. Using the example at https://github.com/jmfriedt/tp_freertos/tree/master/3mutex I show how a slow peripheral such as a UART leads to unpredictable result if accessing the resource is not protected with a mutex. On both the hardware microcontroller and older versions of this qemu, the result should be
but now the result is
meaning that the long delay introduced by a UART communication leading to the FreeRTOS scheduler to switch task is no longer detected by the emulator. I git bisected the problem to commit 4ac96ba679496140b090b3ef18f429e964a941e7 since 985241040ad0e3a67976d8abdef3df7371140235 is still good. This commit is entitled "fix slow event loop" and touches
hw/char/stm32_uart.c
: I believe the correction brought with this commit is incorrect and breaks the valid behaviour of the emulator.Edit: I realize the change in behaviour is introduced by
#define STM32_UART_NO_BAUD_DELAY
: commenting this options resumes to the original behaviour. I wonder what is the rationale for breaking proper peripheral timing analysis which seems to me as one of the highlights of qemu.