Skip to content

Car firmware

Eugene Batalov edited this page Jun 30, 2016 · 1 revision

Car firmware is based on Peripheral_Examples/IO_Toggle project from STM32F4-Discovery_FW (firmware) package. Firmware version: V1.1.0. Makefiles for building in Linux are implemented manually. They are not part of STM32F4 FW package.

Peripheral_Examples/IO_Toggle project is chosen as a base for car firmware because it uses GPIO and timings. We'll need both of this to implement pulse-width modulation needed for control of car wheels engines speed.

Car firmware source code contains main fw code and libraries it depends on. Main car fw code is located in src directory. Libraries source code and binaries are located in src/lib directory. Add more libraries here if you need them. Makefiles based building solution is quite extensible too.

Building on Linux. To build car fw you need to setup dev environment first (see wiki page about this) and then run make.

Use bin/car_fmw.elf with gdb for debugging and MCU reprogramming. To flush car fw to MCU without gdb run st-flash write bin/car_fmw.bin 0x08000000. st-flash is a program from st-link tools set.

stm32_flash.ld is linker script. This script specifies what parts of program are put at which addresses. Our MCU has single flat physical address space. Car fw code is put into flash memory that starts at address 0x08000000. Stack, heap and all the static data is places in RAM that starts at 0x20000000. Knowing sizes and start addresses of flash and RAM you can safely vary stack and heap sizes. Remember that stack grows from upper addresses to lower.

Clone this wiki locally