Browse Source

Merge Support PlatformIO (PR#34)

**** NOTE ****
This code is very EXPERIMENTAL and UNSUPPORTED
Richard Wackerbarth 9 years ago
parent
commit
4a72d2ba9c

+ 2
- 0
PlatformIOAddons/.gitignore View File

@@ -0,0 +1,2 @@
1
+.pioenvs
2
+*.dblite

+ 9
- 0
PlatformIOAddons/Readme.md View File

@@ -0,0 +1,9 @@
1
+This folder contains the project file to build and install Marlin firmware using the PlatformIO development environment.
2
+
3
+1) Install platformio (See http://platformio.org/)
4
+
5
+....
6
+
7
+x) From this directory
8
+  platformio run
9
+

+ 57
- 0
PlatformIOAddons/generate_version_header_for_marlin View File

@@ -0,0 +1,57 @@
1
+#/usr/bin/env python -
2
+from SCons.Script import DefaultEnvironment
3
+
4
+env = DefaultEnvironment()
5
+
6
+import os
7
+import errno
8
+
9
+def make_sure_path_exists(path):
10
+    try:
11
+        os.makedirs(path)
12
+    except OSError as exception:
13
+        if exception.errno != errno.EEXIST:
14
+            raise
15
+
16
+import subprocess
17
+
18
+make_sure_path_exists(env.subst('$BUILDSRC_DIR'))
19
+
20
+from datetime import datetime
21
+import time
22
+import string
23
+import re
24
+
25
+p = subprocess.Popen(['git', 'symbolic-ref', '-q', '--short', 'HEAD'], stdout=subprocess.PIPE)
26
+BRANCH = p.stdout.readline().rstrip()
27
+p = subprocess.Popen(['git', 'describe', '--tags', '--first-parent'], stdout=subprocess.PIPE)
28
+RAW_VERSION = p.stdout.readline().rstrip()
29
+s = re.search('(.*)(-.*)(-.*)',RAW_VERSION)
30
+SHORT_VERSION = s.group(1)+' '+BRANCH
31
+DETAILED_VERSION = string.replace(RAW_VERSION,'-',' '+BRANCH+'-',1)
32
+p = subprocess.Popen(['git', 'config', '--local', '--get', 'remote.origin.url'], stdout=subprocess.PIPE)
33
+
34
+
35
+try:
36
+  s = re.search('(.*github.com:)(.*)', p.stdout.readline().rstrip())
37
+  URL = string.replace("https://github.com/"+s.group(2), ".git", "/")
38
+
39
+  url_text = """#define SOURCE_CODE_URL  "%s"
40
+// Deprecated URL definition
41
+#define FIRMWARE_URL  "%s"
42
+""" % (URL, URL)
43
+except Exception, e:
44
+  url_text = ""
45
+
46
+version_header_text = """/* This file is automatically generated by a compile time hook
47
+ * Do not manually edit it
48
+ * It does not get committed to the repository
49
+ */
50
+
51
+#define BUILD_UNIX_DATETIME %s
52
+#define STRING_DISTRIBUTION_DATE "%s"
53
+#define SHORT_BUILD_VERSION "%s"
54
+#define DETAILED_BUILD_VERSION "%s"
55
+%s""" % (int(time.time()), datetime.now().strftime('%Y-%m-%d %H:%M'),SHORT_VERSION, DETAILED_VERSION, url_text)
56
+
57
+open(env.subst('$BUILDSRC_DIR/_Version.h'), 'w').write(version_header_text)

+ 47
- 0
PlatformIOAddons/platformio.ini View File

@@ -0,0 +1,47 @@
1
+#
2
+# Project Configuration File
3
+#
4
+# A detailed documentation with the EXAMPLES is located here:
5
+# http://docs.platformio.org/en/latest/projectconf.html
6
+#
7
+
8
+# A sign `#` at the beginning of the line indicates a comment
9
+# Comment lines are ignored.
10
+
11
+# Automatic targets - enable auto-uploading
12
+# targets = upload
13
+
14
+[platformio]
15
+src_dir = ../Marlin
16
+
17
+[env:mega2560]
18
+platform = atmelavr
19
+framework = arduino
20
+board = megaatmega2560
21
+extra_script = ./generate_version_header_for_marlin
22
+build_flags = -D USE_AUTOMATIC_VERSIONING -I $BUILDSRC_DIR
23
+board_f_cpu = 16000000L
24
+
25
+[env:mega1280]
26
+platform = atmelavr
27
+framework = arduino
28
+board = megaatmega1280
29
+extra_script = ./generate_version_header_for_marlin
30
+build_flags = -D USE_AUTOMATIC_VERSIONING -I $BUILDSRC_DIR
31
+board_f_cpu = 16000000L
32
+
33
+[env:printrboard]
34
+platform = teensy
35
+framework = arduino
36
+board = teensy20pp
37
+extra_script = ./generate_version_header_for_marlin
38
+build_flags = -D USE_AUTOMATIC_VERSIONING -I $BUILDSRC_DIR -D MOTHERBOARD=BOARD_PRINTRBOARD
39
+# Bug in arduino framework does not allow boards running at 20Mhz
40
+#board_f_cpu = 20000000L
41
+
42
+[env:brainwavepro]
43
+platform = teensy
44
+framework = arduino
45
+board = teensy20pp
46
+extra_script = ./generate_version_header_for_marlin
47
+build_flags = -D USE_AUTOMATIC_VERSIONING -I $BUILDSRC_DIR -D MOTHERBOARD=BOARD_BRAINWAVE_PRO -D AT90USBxx_TEENSYPP_ASSIGNMENTS

Loading…
Cancel
Save