How souvik-dev31/automotive-ecu-simulator_freertos works
This repository is an automotive ECU simulator with two implementations: a FreeRTOS Windows host simulation and an STM32F446 target. In both, simulated engine telemetry is queued for fuel-injection calculation and CAN-frame serialization, then consumed by an actuator task; a watchdog checks task liveness. The target sends and receives through the physical CAN peripheral and reports over UART. The target’s HAL, interrupt, clock, and runtime-support files are included as supporting layers. Relationships for runtime features not visible in excerpts are based on the README; unsampled details are not inferred.
Main entry points: main.c Target startup · main_blinky.c Host startup · stm32f4xx_hal_timebase_tim.c HAL timebase · stm32f4xx_it.c Interrupt handlers
Components 19
Host Simulator
- Host startup
Host Simulator/main_blinky.c - Sensor task
Host Simulator/main_blinky.c - ECU processing
Host Simulator/main_blinky.c - CAN actuator
Host Simulator/main_blinky.c - Watchdog
Host Simulator/main_blinky.c
ECU Runtime
- Target startup
STM32 Target/main.c - Sensor task
STM32 Target/main.c - ECU processing
STM32 Target/main.c - CAN actuator
STM32 Target/main.c - Watchdog
STM32 Target/main.c
STM32 Platform
- Peripheral setup
STM32 Target/stm32f4xx_hal_msp.c - HAL timebase
STM32 Target/stm32f4xx_hal_timebase_tim.c - Interrupt handlers
STM32 Target/stm32f4xx_it.c - System clock
STM32 Target/system_stm32f4xx.c - RTOS support
STM32 Target/freertos.c - Newlib syscalls
STM32 Target/syscalls.c - Heap allocator
STM32 Target/sysmem.c
Other components
- CAN bus
- UART terminal
Connections 26
- Host startup → Sensor task: starts
Host Simulator/main_blinky.c - Host startup → ECU processing: starts
Host Simulator/main_blinky.c - Host startup → CAN actuator: starts
Host Simulator/main_blinky.c - Host startup → Watchdog: starts
Host Simulator/main_blinky.c - Sensor task → ECU processing: queues telemetry
Host Simulator/main_blinky.c - ECU processing → CAN actuator: queues CAN frame
Host Simulator/main_blinky.c - Sensor task → Watchdog: sets alive bit
Host Simulator/main_blinky.c - ECU processing → Watchdog: sets alive bit
Host Simulator/main_blinky.c - CAN actuator → Watchdog: sets alive bit
Host Simulator/main_blinky.c - Target startup → Sensor task: starts
STM32 Target/main.c - Target startup → ECU processing: starts
STM32 Target/main.c - Target startup → CAN actuator: starts
STM32 Target/main.c - Target startup → Watchdog: starts
STM32 Target/main.c - Sensor task → ECU processing: queues telemetry
STM32 Target/main.c - ECU processing → CAN bus: transmits frame
STM32 Target/main.c - CAN bus → CAN actuator: provides frame
README.md - Sensor task → Watchdog: sets alive bit
README.md - ECU processing → Watchdog: sets alive bit
README.md - CAN actuator → Watchdog: sets alive bit
README.md - Watchdog → Target startup: resets MCU
STM32 Target/main.c - Target startup → UART terminal: prints over UART
STM32 Target/main.c - Target startup → Peripheral setup: configures peripherals
- Target startup → HAL timebase: uses HAL tick
- Interrupt handlers → HAL timebase: handles timer IRQ
STM32 Target/stm32f4xx_it.c - Target startup → System clock: configures clock
- Target startup → RTOS support: uses RTOS support