inital dump

This commit is contained in:
2025-08-20 11:38:15 +02:00
parent 96ab94ed5c
commit 141a748d65
4 changed files with 136 additions and 1 deletions

37
CMakeLists.txt Normal file
View File

@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 3.13)
# Project
project(lezyne-rear-light-firmware C)
# MCU and clock
set(MCU attiny202)
set(F_CPU 5000000UL) # 5 MHz
# Toolchain executables
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER avr-gcc)
set(OBJCOPY avr-objcopy)
# Compiler flags
set(CMAKE_C_FLAGS "-mmcu=${MCU} -DF_CPU=${F_CPU} -Os -Wall")
# Sources
add_executable(main.elf main.c)
# HEX file
add_custom_command(
OUTPUT main.hex
COMMAND ${OBJCOPY} -O ihex -R .eeprom main.elf main.hex
DEPENDS main.elf
)
# BIN file
add_custom_command(
OUTPUT main.bin
COMMAND ${OBJCOPY} -O binary -R .eeprom main.elf main.bin
DEPENDS main.elf
)
# Targets
add_custom_target(hex ALL DEPENDS main.hex)
add_custom_target(bin ALL DEPENDS main.bin)