From e7e988c44d0390261e506c0702a7125b5cf08ee4 Mon Sep 17 00:00:00 2001 From: Derisis13 Date: Sat, 19 Mar 2022 18:34:43 +0100 Subject: [PATCH] =?UTF-8?q?Fix:=20transition=20to=20make=20because=20CMake?= =?UTF-8?q?=20used=20the=20wrong=20linker=20Credit=20to=20=C5=81ukasz=20Po?= =?UTF-8?q?dkalicki=20for=20Makefile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 +++- CMakeLists.txt | 21 --------------------- Makefile | 18 ++++++++++++++++++ PT6302.h | 5 +++-- 4 files changed, 24 insertions(+), 24 deletions(-) delete mode 100644 CMakeLists.txt create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 6d91608..abb89c0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ cmake-build-debug/* -.idea/* \ No newline at end of file +.idea/* +main.bin +main.hex diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 365786a..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -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(TARGET_CPU ATmega88) - -add_compile_definitions("__AVR_${TARGET_CPU}__") -include_directories(/usr/lib/avr/include) -set(CMAKE_C_FLAGS "-O3 -Wall") - -add_link_options(-Wl,--print-memory-usage) -add_executable(${PROJECT_NAME} main.c PT6302.c PT6302.h) - -add_custom_target( - FLASH - avrdude -p ${TARGET_CPU} -c USBasp -v -U flash:w:${PROJECT_BINARY_DIR}/${PROJECT_NAME}:a - DEPENDS ${PROJECT_NAME} - COMMENT "Flash to ${TARGET_CPU}" -) \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..553fb80 --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +# Credits to Ɓukasz Podkalicki: https://blog.podkalicki.com/how-to-compile-and-burn-the-code-to-avr-chip-on-linuxmacosxwindows/ +MCU=atmega88 +F_CPU=8000000UL +CC=avr-gcc +OBJCOPY=avr-objcopy +CFLAGS=-std=c99 -Wall -g -O3 -mmcu=${MCU} -DF_CPU=${F_CPU} -I/usr/lib/avr/include/ +TARGET=main +SRCS=main.c PT6302.c PT6302.h + +all: + ${CC} ${CFLAGS} -o ${TARGET}.bin ${SRCS} + ${OBJCOPY} -j .text -j .data -O ihex ${TARGET}.bin ${TARGET}.hex + +flash: + avrdude -p ${MCU} -c usbasp -U flash:w:${TARGET}.hex:i -F -P usb + +clean: + rm -f *.bin *.hex diff --git a/PT6302.h b/PT6302.h index 7d2dc42..034ad2f 100644 --- a/PT6302.h +++ b/PT6302.h @@ -19,8 +19,9 @@ * USA */ -#define DISPLAY_DIGITS 12 - +#define DISPLAY_DIGITS 15 +#include +#include /* PT6302 timing constants, all in usec */ static const uint8_t TCW = 1; //CLKB pulse width static const uint8_t TDOFF = 16; //Data processing time