mirror of
https://github.com/Derisis13/AT-VFD.git
synced 2025-12-06 19:32:49 +01:00
Fix: returned CMake support alongside make
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,4 @@
|
|||||||
cmake-build-debug/*
|
cmake-build-debug-avr/*
|
||||||
.idea/*
|
.idea/*
|
||||||
main.bin
|
main.bin
|
||||||
main.hex
|
main.hex
|
||||||
|
|||||||
23
CMakeLists.txt
Normal file
23
CMakeLists.txt
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.21)
|
||||||
|
set(CMAKE_SYSTEM_NAME Generic)
|
||||||
|
set(CMAKE_C_STANDARD 99)
|
||||||
|
project(vfdprog C)
|
||||||
|
|
||||||
|
set(CMAKE_C_COMPILER avr-gcc)
|
||||||
|
set(OBJCOPY avr-objcopy)
|
||||||
|
set(TARGET_CPU atmega88)
|
||||||
|
|
||||||
|
add_compile_definitions("__AVR_${TARGET_CPU}__" "F_CPU=8000000UL")
|
||||||
|
include_directories(/usr/lib/avr/include)
|
||||||
|
set(CMAKE_C_FLAGS "-Os -mcall-prologues -mmcu=${TARGET_CPU} -Wall")
|
||||||
|
|
||||||
|
add_link_options(-Wl,--print-memory-usage)
|
||||||
|
add_executable(${PROJECT_NAME}.bin main.c PT6302.c PT6302.h)
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
FLASH
|
||||||
|
${OBJCOPY} -j .text -j .data -O ihex ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.bin ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.hex &&
|
||||||
|
avrdude -p ${TARGET_CPU} -c USBasp -v -U flash:w:${PROJECT_BINARY_DIR}/${PROJECT_NAME}.hex:a
|
||||||
|
DEPENDS ${PROJECT_NAME}.bin
|
||||||
|
COMMENT "Flash to ${TARGET_CPU}"
|
||||||
|
)
|
||||||
6
Makefile
6
Makefile
@@ -6,11 +6,11 @@ OBJCOPY=avr-objcopy
|
|||||||
CFLAGS=-std=c99 -Wall -g -Os -mcall-prologues -mmcu=${MCU} -DF_CPU=${F_CPU} -I/usr/lib/avr/include/
|
CFLAGS=-std=c99 -Wall -g -Os -mcall-prologues -mmcu=${MCU} -DF_CPU=${F_CPU} -I/usr/lib/avr/include/
|
||||||
TARGET=main
|
TARGET=main
|
||||||
SRCS=main.c PT6302.c PT6302.h
|
SRCS=main.c PT6302.c PT6302.h
|
||||||
|
|
||||||
all:
|
all:
|
||||||
${CC} ${CFLAGS} -o ${TARGET}.bin ${SRCS}
|
${CC} ${CFLAGS} -o ${TARGET}.bin ${SRCS}
|
||||||
${OBJCOPY} -j .text -j .data -O ihex ${TARGET}.bin ${TARGET}.hex
|
${OBJCOPY} -j .text -j .data -O ihex ${TARGET}.bin ${TARGET}.hex
|
||||||
|
|
||||||
flash:
|
flash:
|
||||||
avrdude -p ${MCU} -c usbasp -U flash:w:${TARGET}.hex:i -F -P usb
|
avrdude -p ${MCU} -c usbasp -U flash:w:${TARGET}.hex:i -F -P usb
|
||||||
|
|
||||||
|
|||||||
1
PT6302.c
1
PT6302.c
@@ -17,7 +17,6 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||||
* USA
|
* USA
|
||||||
*/
|
*/
|
||||||
#define F_CPU 8000000UL
|
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include <util/delay.h>
|
#include <util/delay.h>
|
||||||
#include "PT6302.h"
|
#include "PT6302.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user