-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
591 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
.idea | ||
.pio | ||
.vscode | ||
.vscode | ||
cmake-build-* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
cmake_minimum_required(VERSION 3.25) | ||
|
||
########################################################################## | ||
# tools to beused for programming the AVR | ||
########################################################################## | ||
set(AVR_UPLOADTOOL avrdude) | ||
set(AVR_PROGRAMMER avrispmkII) | ||
set(AVR_UPLOADTOOL_PORT usb) | ||
|
||
########################################################################## | ||
# AVR and fuses needs to be set | ||
########################################################################## | ||
set(AVR_MCU attiny85) | ||
set(AVR_H_FUSE 0xDF) | ||
set(AVR_L_FUSE 0xE3) | ||
set(AVR_E_FUSE 0xFF) | ||
|
||
########################################################################## | ||
# set the toolchain file | ||
########################################################################## | ||
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/generic-gcc-avr.cmake) | ||
|
||
### END TOOLCHAIN SETUP AREA ############################################# | ||
|
||
########################################################################## | ||
# define the project | ||
########################################################################## | ||
project(cmake-avr C CXX ASM) | ||
|
||
########################################################################## | ||
# 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}") | ||
message(STATUS "Current E_FUSE is set to: ${AVR_E_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 "16000000UL") | ||
|
||
########################################################################## | ||
# 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 -std=gnu99") | ||
set(CMAKE_CXX_FLAGS_RELEASE "-Os -std=c++14") | ||
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 -std=gnu99") | ||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Os -save-temps -g -gdwarf-3 -gstrict-dwarf -std=c++14") | ||
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 -std=gnu99") | ||
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -save-temps -g -gdwarf-3 -gstrict-dwarf -std=c++14") | ||
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") | ||
|
||
########################################################################## | ||
# include search paths | ||
########################################################################## | ||
include_directories(${AVR-EXAMPLE_SOURCE_DIR}/lib) | ||
|
||
########################################################################## | ||
# building library and application in their subdirectories | ||
########################################################################## | ||
add_subdirectory(src) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,28 +7,31 @@ Holder](https://sites.google.com/site/wayneholder/besting-ben-heck). | |
|
||
The controller requires three pins on the ATtiny85. The pin | ||
assignments can be changed in the defines, but the following shows | ||
the default layout. PB5 (Pin 1) shold probably be connected to Vcc | ||
the default layout. PB5 (Pin 1) should probably be connected to +5V | ||
through a resistor in the 10k- to 30k-ohm range. | ||
|
||
In this configuration, the device assumes it is the only peripheral | ||
on the SPI bus. Accordingly, there is no provision for chip select. | ||
This may be changed in future revisions. | ||
|
||
## Expected Connection Diagram | ||
|
||
+====+ | ||
Vcc -> PB5 |* | Vcc | ||
NC <- PB3 | | PB2 <- CLK | ||
LEDs -- PB4 | | PB1 -- NC | ||
GND | | PB0 <- MOSI | ||
+5V -> PB5 |* | +5V | ||
NC -- PB3 | | PB2 <- SCLK | ||
DOUT <- PB4 | | PB1 -- NC | ||
GND | | PB0 <- COPI | ||
+====+ | ||
|
||
## Direct Dependencies | ||
|
||
* [PlatformIO](https://platformio.org/) | ||
|
||
PlatformIO is used to manage the build environment. | ||
* [GCC for AVR](https://www.microchip.com/en-us/tools-resources/develop/microchip-studio/gcc-compilers) for compiling | ||
* [CMake](https://cmake.org/) is used to manage the build environment. | ||
|
||
## Contribution guidelines | ||
|
||
* Use [GitFlow](http://nvie.com/posts/a-successful-git-branching-model/) | ||
|
||
## For more information | ||
|
||
* James P. Howard, II <<[email protected]>> | ||
* James P. Howard, II <<[email protected]>> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.