mirror of
https://github.com/Derisis13/AT-VFD.git
synced 2025-12-06 19:32:49 +01:00
Fix: transition to make because CMake used the wrong linker
Credit to Łukasz Podkalicki for Makefile
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +1,4 @@
|
|||||||
cmake-build-debug/*
|
cmake-build-debug/*
|
||||||
.idea/*
|
.idea/*
|
||||||
|
main.bin
|
||||||
|
main.hex
|
||||||
|
|||||||
@@ -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}"
|
|
||||||
)
|
|
||||||
18
Makefile
Normal file
18
Makefile
Normal file
@@ -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
|
||||||
5
PT6302.h
5
PT6302.h
@@ -19,8 +19,9 @@
|
|||||||
* USA
|
* USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DISPLAY_DIGITS 12
|
#define DISPLAY_DIGITS 15
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <avr/io.h>
|
||||||
/* PT6302 timing constants, all in usec */
|
/* PT6302 timing constants, all in usec */
|
||||||
static const uint8_t TCW = 1; //CLKB pulse width
|
static const uint8_t TCW = 1; //CLKB pulse width
|
||||||
static const uint8_t TDOFF = 16; //Data processing time
|
static const uint8_t TDOFF = 16; //Data processing time
|
||||||
|
|||||||
Reference in New Issue
Block a user