From 28a20d5a6971b8b04c717ab7fde1f37b7442237d Mon Sep 17 00:00:00 2001 From: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Date: Thu, 17 Oct 2024 11:08:16 +0530 Subject: [PATCH] Add volatile qualifier (#1283) Add volatile qualifier This is needed to ensure that the memory mapped address it always read. Signed-off-by: Gaurav Aggarwal --- .gitignore | 1 + FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/ns16550.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index dc8dc7a25b..d75ac31af2 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ [Oo]bj/ [Ll]og/ [Ll]ogs/ +[Bb]uild/ # CodeWarrior temporary files *.tdt diff --git a/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/ns16550.c b/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/ns16550.c index b508fe56db..73f648ae05 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/ns16550.c +++ b/FreeRTOS/Demo/RISC-V-Qemu-virt_GCC/ns16550.c @@ -20,7 +20,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * https://www.FreeRTOS.org - * https://www.github.com/FreeRTOS + * https://github.com/FreeRTOS * */ @@ -54,12 +54,12 @@ static uint8_t readb( uintptr_t addr ) { - return *( (uint8_t *) addr ); + return *( (volatile uint8_t *) addr ); } static void writeb( uint8_t b, uintptr_t addr ) { - *( (uint8_t *) addr ) = b; + *( (volatile uint8_t *) addr ) = b; } void vOutNS16550( struct device *dev, unsigned char c )