Skip to content

Commit 6f09da1

Browse files
committed
cmake working
1 parent 7b7f504 commit 6f09da1

File tree

4 files changed

+168
-0
lines changed

4 files changed

+168
-0
lines changed

.gitignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Object files
2+
*.o
3+
*.ko
4+
*.obj
5+
*.elf
6+
7+
# Precompiled Headers
8+
*.gch
9+
*.pch
10+
11+
# Libraries
12+
*.lib
13+
*.a
14+
*.la
15+
*.lo
16+
17+
# Shared objects (inc. Windows DLLs)
18+
*.dll
19+
*.so
20+
*.so.*
21+
*.dylib
22+
23+
# Executables
24+
*.exe
25+
*.out
26+
*.app
27+
*.i*86
28+
*.x86_64
29+
*.hex
30+
31+
# Debug files
32+
*.dSYM/
33+
*.su
34+
35+
# build folder
36+
build/

CMakeLists.txt

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
##########################################################################
2+
# "THE ANY BEVERAGE-WARE LICENSE" (Revision 42 - based on beer-ware
3+
# license):
4+
# <dev@layer128.net> wrote this file. As long as you retain this notice
5+
# you can do whatever you want with this stuff. If we meet some day, and
6+
# you think this stuff is worth it, you can buy me a be(ve)er(age) in
7+
# return. (I don't like beer much.)
8+
#
9+
# Matthias Kleemann
10+
##########################################################################
11+
12+
cmake_minimum_required(VERSION 2.8)
13+
14+
### TOOLCHAIN SETUP AREA #################################################
15+
# Set any variables used in the toolchain prior project() call. In that
16+
# case they are already set and used.
17+
##########################################################################
18+
19+
##########################################################################
20+
# tools to beused for programming the AVR
21+
##########################################################################
22+
set(AVR_UPLOADTOOL avrdude)
23+
#set(AVR_PROGRAMMER avrispmkII)
24+
#set(AVR_UPLOADTOOL_PORT usb)
25+
set(AVR_PROGRAMMER stk500v2)
26+
set(AVR_UPLOADTOOL_PORT /dev/ttyACM0)
27+
28+
##########################################################################
29+
# AVR and fuses needs to be set
30+
##########################################################################
31+
set(AVR_MCU atmega2560)
32+
set(AVR_H_FUSE 0xd9)
33+
set(AVR_L_FUSE 0xc3)
34+
set(MCU_SPEED "16000000UL")
35+
36+
### END TOOLCHAIN SETUP AREA #############################################
37+
38+
# Intentionally left blank, due to a different approach of using the
39+
# toolchain file via -DCMAKE_TOOLCHAIN_FILE=path/to/generic-gcc-avr.cmake
40+
# at the cmake command line call
41+
#
42+
include(AVRhal/generic-gcc-avr.cmake)
43+
44+
##########################################################################
45+
# name your project
46+
##########################################################################
47+
project(EPROM)
48+
49+
##########################################################################
50+
# status messages
51+
##########################################################################
52+
message(STATUS "Current uploadtool is: ${AVR_UPLOADTOOL}")
53+
message(STATUS "Current programmer is: ${AVR_PROGRAMMER}")
54+
message(STATUS "Current upload port is: ${AVR_UPLOADTOOL_PORT}")
55+
message(STATUS "Current uploadtool options are: ${AVR_UPLOADTOOL_OPTIONS}")
56+
message(STATUS "Current MCU is set to: ${AVR_MCU}")
57+
message(STATUS "Current H_FUSE is set to: ${AVR_H_FUSE}")
58+
message(STATUS "Current L_FUSE is set to: ${AVR_L_FUSE}")
59+
60+
##########################################################################
61+
# set build type
62+
##########################################################################
63+
if(NOT CMAKE_BUILD_TYPE)
64+
set(CMAKE_BUILD_TYPE Release)
65+
endif(NOT CMAKE_BUILD_TYPE)
66+
67+
##########################################################################
68+
# include search paths
69+
##########################################################################
70+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/AVRhal/include)
71+
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/AVRhal/driver)
72+
73+
##########################################################################
74+
# building library and application in their subdirectories
75+
##########################################################################
76+
77+
add_subdirectory(AVRhal)
78+
add_subdirectory(src)
79+
80+

src/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
##########################################################################
2+
# "THE ANY BEVERAGE-WARE LICENSE" (Revision 42 - based on beer-ware
3+
# license):
4+
# <dev@layer128.net> wrote this file. As long as you retain this notice
5+
# you can do whatever you want with this stuff. If we meet some day, and
6+
# you think this stuff is worth it, you can buy me a be(ve)er(age) in
7+
# return. (I don't like beer much.)
8+
#
9+
# Matthias Kleemann
10+
##########################################################################
11+
12+
SET(EXECUTABLE_NAME "EPROM-PROG")
13+
14+
FILE(GLOB_RECURSE _SOURCES *.c)
15+
FILE(GLOB_RECURSE _HEADERS *.h)
16+
SOURCE_GROUP("Header Files" FILES ${_HEADERS})
17+
18+
add_avr_executable(${EXECUTABLE_NAME} ${_SOURCES} ${_HEADERS})
19+
20+
avr_target_link_libraries(${EXECUTABLE_NAME} HAL)
21+

src/main.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* UART_Test.c
3+
*
4+
* Created: 26.10.2014 19:01:09
5+
* Author: Peter Buchegger
6+
*/
7+
8+
9+
#include <stdint.h>
10+
#include <stdio.h>
11+
#include "COM/UART.h"
12+
#define _DEBUG
13+
#include "Debug.h"
14+
#include "System.h"
15+
16+
int main(void)
17+
{
18+
uint32_t max = 0xFFFFFFFF;
19+
UART_Init(UART_BAUD_SELECT(9600, F_CPU));
20+
interrupts(1); //sei();
21+
22+
while(UART_GetC() == UART_NO_DATA)
23+
{
24+
}
25+
26+
while(1)
27+
{
28+
printf("TEST: %lu\n", (long unsigned int)max);
29+
DEBUG_OUT("HALLOOOO\n");
30+
}
31+
}

0 commit comments

Comments
 (0)