magic commit

This commit is contained in:
MultiMote 2015-02-05 20:52:15 +03:00
commit 6536b7092e
7 changed files with 67 additions and 0 deletions

34
CMakeLists.txt Normal file
View File

@ -0,0 +1,34 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.4)
SET(CMAKE_SYSTEM_NAME Generic)
#============================================================================================
PROJECT(avr-clion)
SET(DEVICE "atmega8")
SET(FREQ "4000000")
#============================================================================================
SET(CMAKE_C_COMPILER avr-gcc) #fucking cmake caches, i can't create same working project, it's magically breaks
SET(CMAKE_CXX_COMPILER avr-g++)
SET(CMAKE_C_FLAGS "-Os -mmcu=${DEVICE} -DF_CPU=${FREQ}UL -std=gnu99 -Wl,--gc-sections")
SET(CMAKE_CXX_FLAGS "-Os -mmcu=${DEVICE} -DF_CPU=${FREQ}UL -Wl,--gc-sections")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
#============================================================================================
SET(SOURCE_FILES
main.c
easyavr.h
)
#============================================================================================
ADD_EXECUTABLE(${PROJECT_NAME} ${SOURCE_FILES})
ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD COMMAND avr-objcopy -O ihex -R.eeprom ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}.hex)
ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD COMMAND avr-size ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME} --mcu=${DEVICE} --format=avr)

BIN
bin/avr-clion Normal file

Binary file not shown.

8
bin/avr-clion.hex Normal file
View File

@ -0,0 +1,8 @@
:1000000012C019C018C017C016C015C014C013C044
:1000100012C011C010C00FC00EC00DC00CC00BC06C
:100020000AC009C008C011241FBECFE5D4E0DEBF5E
:10003000CDBF02D018C0E4CF8FEF81BB909A2FE7DD
:1000400088E391E0215080409040E1F700C000003B
:1000500090982FE788E391E0215080409040E1F7AD
:0A00600000C00000EBCFF894FFCFC2
:00000001FF

7
easyavr.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef __EASYAVR_H_
#define __EASYAVR_H_
#define PIN_ON(x,p) ((PORT ## x) |= 1<<(p))
#define PIN_OFF(x,p) ((PORT ## x) &= ~(1<<(p)))
#endif

18
main.c Normal file
View File

@ -0,0 +1,18 @@
#include <avr/io.h>
#include <util/delay.h>
#include "easyavr.h"
int main(void)
{
DDRD = 0xff;
while (1) {
PIN_ON(D, 0);
_delay_ms(100);
PIN_OFF(D, 0);
_delay_ms(100);
}
}

BIN
proofs/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
proofs/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB