Interoperability with C
Code examples from previous chapters that you were able to run in a Renode simulator are using both C++ and C code. We used vendor provided HAL library and Common Microcontroller Software Interface Standard (CMSIS) by Arm, both written in C and contained in the platform
folder.
If you take a look at the CMakeLists.txt
file and the add_executable
function in it, you will see listed C files from the platform
folder and just a few C++ files. Building a project will provide the following console output:
[ 7%] Building C object CMakeFiles/bare.elf.dir/platform/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal.c.o
[ 15%] Building C object CMakeFiles/bare.elf.dir/platform/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_cortex.c.o
[ 23%] Building C object CMakeFiles/bare.elf.dir/platform/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_gpio.c.o
[ 30%] Building C object CMakeFiles/bare.elf.dir/platform/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_rcc.c.o
[ 38%] Building C object CMakeFiles/bare...