From f4db916a205b9613cb10a4ba6f7c5567f591b7d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Sun, 20 Sep 2020 08:58:44 +0200 Subject: [PATCH] chore: initial commit --- .gitignore | 130 ++++++++++++++++++++++++ .gitmodules | 3 + .idea/.gitignore | 8 ++ .idea/.name | 1 + .idea/avr-seven-segment-example.iml | 2 + .idea/misc.xml | 4 + .idea/modules.xml | 8 ++ .idea/vcs.xml | 8 ++ CMakeLists.txt | 152 ++++++++++++++++++++++++++++ include/seven-segment/main.h | 8 ++ lib/avr-seven-segment | 1 + src/main.c | 5 + 12 files changed, 330 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 .idea/.gitignore create mode 100644 .idea/.name create mode 100644 .idea/avr-seven-segment-example.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 CMakeLists.txt create mode 100644 include/seven-segment/main.h create mode 160000 lib/avr-seven-segment create mode 100644 src/main.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d70059 --- /dev/null +++ b/.gitignore @@ -0,0 +1,130 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/clion,cmake +# Edit at https://www.toptal.com/developers/gitignore?templates=clion,cmake + +### CLion ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### CLion Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +# https://plugins.jetbrains.com/plugin/7973-sonarlint +.idea/**/sonarlint/ + +# SonarQube Plugin +# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin +.idea/**/sonarIssues.xml + +# Markdown Navigator plugin +# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced +.idea/**/markdown-navigator.xml +.idea/**/markdown-navigator-enh.xml +.idea/**/markdown-navigator/ + +# Cache file creation bug +# See https://youtrack.jetbrains.com/issue/JBR-2257 +.idea/$CACHE_FILE$ + +# CodeStream plugin +# https://plugins.jetbrains.com/plugin/12206-codestream +.idea/codestream.xml + +### CMake ### +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps + +### CMake Patch ### +# External projects +*-prefix/ + +# End of https://www.toptal.com/developers/gitignore/api/clion,cmake + +# Custom cmake build directories +cmake-build-debug-avr/ +cmake-build-release-avr/ +cmake-build-relwithdebinfo-avr/ \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..263c8c1 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/avr-seven-segment"] + path = lib/avr-seven-segment + url = https://github.com/Rutherther/avr-seven-segment.git diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..73f69e0 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..0c568d9 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +avr_seven_segment_example \ No newline at end of file diff --git a/.idea/avr-seven-segment-example.iml b/.idea/avr-seven-segment-example.iml new file mode 100644 index 0000000..f08604b --- /dev/null +++ b/.idea/avr-seven-segment-example.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..79b3c94 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..9ab602f --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..c795450 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..640fb9d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,152 @@ +########################################################################## +# "THE ANY BEVERAGE-WARE LICENSE" (Revision 42 - based on beer-ware +# license): +# wrote this file. As long as you retain this notice +# you can do whatever you want with this stuff. If we meet some day, and +# you think this stuff is worth it, you can buy me a be(ve)er(age) in +# return. (I don't like beer much.) +# +# Matthias Kleemann +########################################################################## + +cmake_minimum_required(VERSION 2.8) + +### TOOLCHAIN SETUP AREA ################################################# +# Set any variables used in the toolchain prior project() call. In that +# case they are already set and used. +########################################################################## + +########################################################################## +# tools to beused for programming the AVR +########################################################################## +set(AVR_UPLOADTOOL avrdude) +set(AVR_PROGRAMMER usbasp) +set(AVR_UPLOADTOOL_PORT usb) + +########################################################################## +# AVR and fuses needs to be set +########################################################################## +set(AVR_MCU atmega8) +set(AVR_H_FUSE 0xd9) +set(AVR_L_FUSE 0xc3) + +### END TOOLCHAIN SETUP AREA ############################################# + +# Intentionally left blank, due to a different approach of using the +# toolchain file via -DCMAKE_TOOLCHAIN_FILE=path/to/generic-gcc-avr.cmake +# at the cmake command line call +# +# include(../generic-gcc-avr.cmake) + +########################################################################## +# name your project +########################################################################## +project(avr_seven_segment_example) + +########################################################################## +# status messages +########################################################################## +message(STATUS "Current uploadtool is: ${AVR_UPLOADTOOL}") +message(STATUS "Current programmer is: ${AVR_PROGRAMMER}") +message(STATUS "Current upload port is: ${AVR_UPLOADTOOL_PORT}") +message(STATUS "Current uploadtool options are: ${AVR_UPLOADTOOL_OPTIONS}") +message(STATUS "Current MCU is set to: ${AVR_MCU}") +message(STATUS "Current H_FUSE is set to: ${AVR_H_FUSE}") +message(STATUS "Current L_FUSE is set to: ${AVR_L_FUSE}") + +########################################################################## +# set build type +########################################################################## +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif(NOT CMAKE_BUILD_TYPE) + +########################################################################## +# needs to be defined for AVR toolchain +########################################################################## +set(MCU_SPEED "4000000UL") + +########################################################################## +# some cmake cross-compile necessities +########################################################################## +if(DEFINED ENV{AVR_FIND_ROOT_PATH}) + set(CMAKE_FIND_ROOT_PATH $ENV{AVR_FIND_ROOT_PATH}) +else(DEFINED ENV{AVR_FIND_ROOT_PATH}) + if(EXISTS "/opt/local/avr") + set(CMAKE_FIND_ROOT_PATH "/opt/local/avr") + elseif(EXISTS "/usr/avr") + set(CMAKE_FIND_ROOT_PATH "/usr/avr") + elseif(EXISTS "/usr/lib/avr") + set(CMAKE_FIND_ROOT_PATH "/usr/lib/avr") + elseif(EXISTS "/usr/local/CrossPack-AVR") + set(CMAKE_FIND_ROOT_PATH "/usr/local/CrossPack-AVR") + else(EXISTS "/opt/local/avr") + message(FATAL_ERROR "Please set AVR_FIND_ROOT_PATH in your environment.") + endif(EXISTS "/opt/local/avr") +endif(DEFINED ENV{AVR_FIND_ROOT_PATH}) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +# not added automatically, since CMAKE_SYSTEM_NAME is "generic" +set(CMAKE_SYSTEM_INCLUDE_PATH "${CMAKE_FIND_ROOT_PATH}/include") +set(CMAKE_SYSTEM_LIBRARY_PATH "${CMAKE_FIND_ROOT_PATH}/lib") + +########################################################################## +# status messages for generating +########################################################################## +message(STATUS "Set CMAKE_FIND_ROOT_PATH to ${CMAKE_FIND_ROOT_PATH}") +message(STATUS "Set CMAKE_SYSTEM_INCLUDE_PATH to ${CMAKE_SYSTEM_INCLUDE_PATH}") +message(STATUS "Set CMAKE_SYSTEM_LIBRARY_PATH to ${CMAKE_SYSTEM_LIBRARY_PATH}") + +########################################################################## +# set compiler options for build types +########################################################################## +if(CMAKE_BUILD_TYPE MATCHES Release) + set(CMAKE_C_FLAGS_RELEASE "-Os") + set(CMAKE_CXX_FLAGS_RELEASE "-Os") +endif(CMAKE_BUILD_TYPE MATCHES Release) + +if(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) + set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os -save-temps -g -gdwarf-3 -gstrict-dwarf") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Os -save-temps -g -gdwarf-3 -gstrict-dwarf") +endif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) + +if(CMAKE_BUILD_TYPE MATCHES Debug) + set(CMAKE_C_FLAGS_DEBUG "-O0 -save-temps -g -gdwarf-3 -gstrict-dwarf") + set(CMAKE_CXX_FLAGS_DEBUG "-O0 -save-temps -g -gdwarf-3 -gstrict-dwarf") +endif(CMAKE_BUILD_TYPE MATCHES Debug) + +########################################################################## +# compiler options for all build types +########################################################################## +add_definitions("-DF_CPU=${MCU_SPEED}") +add_definitions("-fpack-struct") +add_definitions("-fshort-enums") +add_definitions("-Wall") +add_definitions("-Werror") +add_definitions("-pedantic") +add_definitions("-pedantic-errors") +add_definitions("-funsigned-char") +add_definitions("-funsigned-bitfields") +add_definitions("-ffunction-sections") +add_definitions("-c") +add_definitions("-std=gnu99") + +########################################################################## +# building library and application in their subdirectories +########################################################################## +add_subdirectory(lib/avr-seven-segment) + +########################################################################## +# testing functions w/o source files - gets FATAL_ERROR +########################################################################## +add_avr_executable(avr_seven_segment_example include/seven-segment/main.h src/main.c) +avr_target_include_directories(avr_seven_segment_example PRIVATE include) + +########################################################################## +# use default documentation target +########################################################################## +#set(DOXYGEN_CONF_IN "doxygen.conf") +#include("${PROJECT_SOURCE_DIR}/../Modules/defaultDocuTarget.cmake") + + diff --git a/include/seven-segment/main.h b/include/seven-segment/main.h new file mode 100644 index 0000000..fab0f36 --- /dev/null +++ b/include/seven-segment/main.h @@ -0,0 +1,8 @@ +// +// Created by ruther on 9/14/20. +// + +#ifndef AVR_SEVEN_SEGMENT_EXAMPLE_MAIN_H +#define AVR_SEVEN_SEGMENT_EXAMPLE_MAIN_H + +#endif //AVR_SEVEN_SEGMENT_EXAMPLE_MAIN_H diff --git a/lib/avr-seven-segment b/lib/avr-seven-segment new file mode 160000 index 0000000..23ac8ec --- /dev/null +++ b/lib/avr-seven-segment @@ -0,0 +1 @@ +Subproject commit 23ac8ec77c5c016a9ff6d538cb305738eefc6906 diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..b41c000 --- /dev/null +++ b/src/main.c @@ -0,0 +1,5 @@ +// +// Created by ruther on 9/14/20. +// + +#include "seven-segment/main.h" \ No newline at end of file -- 2.48.1