Browse Source

init

master
Robin Thoni 4 months ago
commit
8ee564b26f
Signed by: Robin THONI <robin@rthoni.com> GPG Key ID: 4E09DEF46B99E61E
5 changed files with 2426 additions and 0 deletions
  1. 2
    0
      .gitignore
  2. 23
    0
      CMakeLists.txt
  3. 89
    0
      cmake/ArduinoToolchain.cmake
  4. 2304
    0
      cmake/Platform/Arduino.cmake
  5. 8
    0
      main.ino

+ 2
- 0
.gitignore View File

@@ -0,0 +1,2 @@
1
+/.idea
2
+cmake-build*

+ 23
- 0
CMakeLists.txt View File

@@ -0,0 +1,23 @@
1
+cmake_minimum_required(VERSION 2.8.4)
2
+set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/ArduinoToolchain.cmake)
3
+set(PROJECT_NAME heater)
4
+project(${PROJECT_NAME})
5
+
6
+set(${CMAKE_PROJECT_NAME}_BOARD nano328)
7
+set(${CMAKE_PROJECT_NAME}_PORT /dev/ttyUSB3)
8
+
9
+#nano
10
+#set(${CMAKE_PROJECT_NAME}_BOARD nano328)
11
+#set(${CMAKE_PROJECT_NAME}_PORT /dev/ttyUSB0)
12
+
13
+#mega
14
+#set(${CMAKE_PROJECT_NAME}_BOARD mega2560)
15
+#set(${CMAKE_PROJECT_NAME}_PORT /dev/ttyACM0)
16
+
17
+# /usr/share/arduino/hardware/arduino/boards.txt
18
+
19
+
20
+enable_language(ASM)
21
+set(${CMAKE_PROJECT_NAME}_ALL_SRCS main.ino)
22
+set(${CMAKE_PROJECT_NAME}_SKETCH main.ino)
23
+generate_arduino_firmware(${CMAKE_PROJECT_NAME})

+ 89
- 0
cmake/ArduinoToolchain.cmake View File

@@ -0,0 +1,89 @@
1
+#=============================================================================#
2
+# Author: Tomasz Bogdal (QueezyTheGreat)
3
+# Home:   https://github.com/queezythegreat/arduino-cmake
4
+#
5
+# This Source Code Form is subject to the terms of the Mozilla Public
6
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
7
+# You can obtain one at http://mozilla.org/MPL/2.0/.
8
+#=============================================================================#
9
+set(CMAKE_SYSTEM_NAME Arduino)
10
+
11
+set(CMAKE_C_COMPILER   avr-gcc)
12
+set(CMAKE_CXX_COMPILER avr-g++)
13
+
14
+# Add current directory to CMake Module path automatically
15
+if(EXISTS  ${CMAKE_CURRENT_LIST_DIR}/Platform/Arduino.cmake)
16
+    set(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR})
17
+endif()
18
+
19
+#=============================================================================#
20
+#                         System Paths                                        #
21
+#=============================================================================#
22
+if(UNIX)
23
+    include(Platform/UnixPaths)
24
+    if(APPLE)
25
+        list(APPEND CMAKE_SYSTEM_PREFIX_PATH ~/Applications
26
+                                             /Applications
27
+                                             /Developer/Applications
28
+                                             /sw        # Fink
29
+                                             /opt/local) # MacPorts
30
+    endif()
31
+elseif(WIN32)
32
+    include(Platform/WindowsPaths)
33
+endif()
34
+
35
+
36
+#=============================================================================#
37
+#                         Detect Arduino SDK                                  #
38
+#=============================================================================#
39
+if(NOT ARDUINO_SDK_PATH)
40
+    set(ARDUINO_PATHS)
41
+
42
+    foreach(DETECT_VERSION_MAJOR 1)
43
+        foreach(DETECT_VERSION_MINOR RANGE 5 0)
44
+            list(APPEND ARDUINO_PATHS arduino-${DETECT_VERSION_MAJOR}.${DETECT_VERSION_MINOR})
45
+            foreach(DETECT_VERSION_PATCH  RANGE 3 0)
46
+                list(APPEND ARDUINO_PATHS arduino-${DETECT_VERSION_MAJOR}.${DETECT_VERSION_MINOR}.${DETECT_VERSION_PATCH})
47
+            endforeach()
48
+        endforeach()
49
+    endforeach()
50
+
51
+    foreach(VERSION RANGE 23 19)
52
+        list(APPEND ARDUINO_PATHS arduino-00${VERSION})
53
+    endforeach()
54
+
55
+    if(UNIX)
56
+        file(GLOB SDK_PATH_HINTS /usr/share/arduino*
57
+            /opt/local/arduino*
58
+            /opt/arduino*
59
+            /usr/local/share/arduino*)
60
+    elseif(WIN32)
61
+        set(SDK_PATH_HINTS "C:\\Program Files\\Arduino"
62
+            "C:\\Program Files (x86)\\Arduino"
63
+            )
64
+    endif()
65
+    list(SORT SDK_PATH_HINTS)
66
+    list(REVERSE SDK_PATH_HINTS)
67
+endif()
68
+
69
+find_path(ARDUINO_SDK_PATH
70
+          NAMES lib/version.txt
71
+          PATH_SUFFIXES share/arduino
72
+                        Arduino.app/Contents/Java/
73
+                        Arduino.app/Contents/Resources/Java/
74
+                        ${ARDUINO_PATHS}
75
+          HINTS ${SDK_PATH_HINTS}
76
+          DOC "Arduino SDK path.")
77
+
78
+if(ARDUINO_SDK_PATH)
79
+    list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${ARDUINO_SDK_PATH}/hardware/tools/avr)
80
+    list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${ARDUINO_SDK_PATH}/hardware/tools/avr/utils)
81
+else()
82
+    message(FATAL_ERROR "Could not find Arduino SDK (set ARDUINO_SDK_PATH)!")
83
+endif()
84
+
85
+set(ARDUINO_CPUMENU)
86
+if(ARDUINO_CPU)
87
+    set(ARDUINO_CPUMENU ".menu.cpu.${ARDUINO_CPU}")
88
+endif(ARDUINO_CPU)
89
+

+ 2304
- 0
cmake/Platform/Arduino.cmake
File diff suppressed because it is too large
View File


+ 8
- 0
main.ino View File

@@ -0,0 +1,8 @@
1
+void setup()
2
+{
3
+    Serial.begin(9600);
4
+}
5
+
6
+void loop()
7
+{
8
+}

Loading…
Cancel
Save