From 475a521d0fe394723b2d86e85c8d4668f9ccb445 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 28 Apr 2016 21:19:31 +0300 Subject: [PATCH 1/9] Minor fixes --- docs/frameworks/arduino.rst | 71 +++++++++++++++++++++------ docs/frameworks/simba.rst | 8 +-- docs/platforms/atmelavr.rst | 67 ++++++++++++++++++++----- docs/platforms/atmelsam.rst | 4 +- platformio/__init__.py | 2 +- platformio/platforms/lattice_ice40.py | 3 ++ 6 files changed, 120 insertions(+), 35 deletions(-) diff --git a/docs/frameworks/arduino.rst b/docs/frameworks/arduino.rst index 31ff07eb..af3f11b1 100644 --- a/docs/frameworks/arduino.rst +++ b/docs/frameworks/arduino.rst @@ -224,6 +224,13 @@ Arduino - 32 Kb - 2 Kb + * - ``chiwawa`` + - `Arduino Industrial 101 `_ + - ATMEGA32U4 + - 16 MHz + - 32 Kb + - 2.5 Kb + * - ``diecimilaatmega168`` - `Arduino Duemilanove or Diecimila ATmega168 `_ - ATMEGA168 @@ -239,28 +246,28 @@ Arduino - 2 Kb * - ``due`` - - `Arduino Due (Programming Port) `_ + - `Arduino Due (Programming Port) `_ - SAM3X8E - 84 MHz - 512 Kb - 32 Kb * - ``dueUSB`` - - `Arduino Due (USB Native Port) `_ + - `Arduino Due (USB Native Port) `_ - SAM3X8E - 84 MHz - 512 Kb - 32 Kb * - ``esplora`` - - `Arduino Esplora `_ + - `Arduino Esplora `_ - ATMEGA32U4 - 16 MHz - 32 Kb - 2.5 Kb * - ``ethernet`` - - `Arduino Ethernet `_ + - `Arduino Ethernet `_ - ATMEGA328P - 16 MHz - 32 Kb @@ -274,7 +281,14 @@ Arduino - 2 Kb * - ``leonardo`` - - `Arduino Leonardo `_ + - `Arduino Leonardo `_ + - ATMEGA32U4 + - 16 MHz + - 32 Kb + - 2.5 Kb + + * - ``leonardoeth`` + - `Arduino Leonardo ETH `_ - ATMEGA32U4 - 16 MHz - 32 Kb @@ -295,28 +309,28 @@ Arduino - 2 Kb * - ``megaADK`` - - `Arduino Mega ADK `_ + - `Arduino Mega ADK `_ - ATMEGA2560 - 16 MHz - 256 Kb - 8 Kb * - ``megaatmega1280`` - - `Arduino Mega or Mega 2560 ATmega1280 `_ + - `Arduino Mega or Mega 2560 ATmega1280 `_ - ATMEGA1280 - 16 MHz - 128 Kb - 8 Kb * - ``megaatmega2560`` - - `Arduino Mega or Mega 2560 ATmega2560 (Mega 2560) `_ + - `Arduino Mega or Mega 2560 ATmega2560 (Mega 2560) `_ - ATMEGA2560 - 16 MHz - 256 Kb - 8 Kb * - ``micro`` - - `Arduino Micro `_ + - `Arduino Micro `_ - ATMEGA32U4 - 16 MHz - 32 Kb @@ -337,14 +351,14 @@ Arduino - 2 Kb * - ``nanoatmega168`` - - `Arduino Nano ATmega168 `_ + - `Arduino Nano ATmega168 `_ - ATMEGA168 - 16 MHz - 16 Kb - 1 Kb * - ``nanoatmega328`` - - `Arduino Nano ATmega328 `_ + - `Arduino Nano ATmega328 `_ - ATMEGA328P - 16 MHz - 32 Kb @@ -379,28 +393,35 @@ Arduino - 2 Kb * - ``robotControl`` - - `Arduino Robot Control `_ + - `Arduino Robot Control `_ - ATMEGA32U4 - 16 MHz - 32 Kb - 2.5 Kb * - ``robotMotor`` - - `Arduino Robot Motor `_ + - `Arduino Robot Motor `_ - ATMEGA32U4 - 16 MHz - 32 Kb - 2.5 Kb * - ``uno`` - - `Arduino Uno `_ + - `Arduino Uno `_ - ATMEGA328P - 16 MHz - 32 Kb - 2 Kb * - ``yun`` - - `Arduino Yun `_ + - `Arduino Yun `_ + - ATMEGA32U4 + - 16 MHz + - 32 Kb + - 2.5 Kb + + * - ``yunmini`` + - `Arduino Yun Mini `_ - ATMEGA32U4 - 16 MHz - 32 Kb @@ -897,6 +918,26 @@ LightUp - 32 Kb - 2.5 Kb +Linino +~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``one`` + - `Linino One `_ + - ATMEGA32U4 + - 16 MHz + - 32 Kb + - 2.5 Kb + LowPowerLab ~~~~~~~~~~~ diff --git a/docs/frameworks/simba.rst b/docs/frameworks/simba.rst index c179ebc7..e2c12f20 100644 --- a/docs/frameworks/simba.rst +++ b/docs/frameworks/simba.rst @@ -78,28 +78,28 @@ Arduino - RAM * - ``due`` - - `Arduino Due (Programming Port) `_ + - `Arduino Due (Programming Port) `_ - SAM3X8E - 84 MHz - 512 Kb - 32 Kb * - ``megaatmega2560`` - - `Arduino Mega or Mega 2560 ATmega2560 (Mega 2560) `_ + - `Arduino Mega or Mega 2560 ATmega2560 (Mega 2560) `_ - ATMEGA2560 - 16 MHz - 256 Kb - 8 Kb * - ``nanoatmega328`` - - `Arduino Nano ATmega328 `_ + - `Arduino Nano ATmega328 `_ - ATMEGA328P - 16 MHz - 32 Kb - 2 Kb * - ``uno`` - - `Arduino Uno `_ + - `Arduino Uno `_ - ATMEGA328P - 16 MHz - 32 Kb diff --git a/docs/platforms/atmelavr.rst b/docs/platforms/atmelavr.rst index da5eac55..4f4b5955 100644 --- a/docs/platforms/atmelavr.rst +++ b/docs/platforms/atmelavr.rst @@ -214,6 +214,13 @@ Arduino - 32 Kb - 2 Kb + * - ``chiwawa`` + - `Arduino Industrial 101 `_ + - ATMEGA32U4 + - 16 MHz + - 32 Kb + - 2.5 Kb + * - ``diecimilaatmega168`` - `Arduino Duemilanove or Diecimila ATmega168 `_ - ATMEGA168 @@ -229,14 +236,14 @@ Arduino - 2 Kb * - ``esplora`` - - `Arduino Esplora `_ + - `Arduino Esplora `_ - ATMEGA32U4 - 16 MHz - 32 Kb - 2.5 Kb * - ``ethernet`` - - `Arduino Ethernet `_ + - `Arduino Ethernet `_ - ATMEGA328P - 16 MHz - 32 Kb @@ -250,7 +257,14 @@ Arduino - 2 Kb * - ``leonardo`` - - `Arduino Leonardo `_ + - `Arduino Leonardo `_ + - ATMEGA32U4 + - 16 MHz + - 32 Kb + - 2.5 Kb + + * - ``leonardoeth`` + - `Arduino Leonardo ETH `_ - ATMEGA32U4 - 16 MHz - 32 Kb @@ -271,28 +285,28 @@ Arduino - 2 Kb * - ``megaADK`` - - `Arduino Mega ADK `_ + - `Arduino Mega ADK `_ - ATMEGA2560 - 16 MHz - 256 Kb - 8 Kb * - ``megaatmega1280`` - - `Arduino Mega or Mega 2560 ATmega1280 `_ + - `Arduino Mega or Mega 2560 ATmega1280 `_ - ATMEGA1280 - 16 MHz - 128 Kb - 8 Kb * - ``megaatmega2560`` - - `Arduino Mega or Mega 2560 ATmega2560 (Mega 2560) `_ + - `Arduino Mega or Mega 2560 ATmega2560 (Mega 2560) `_ - ATMEGA2560 - 16 MHz - 256 Kb - 8 Kb * - ``micro`` - - `Arduino Micro `_ + - `Arduino Micro `_ - ATMEGA32U4 - 16 MHz - 32 Kb @@ -313,14 +327,14 @@ Arduino - 2 Kb * - ``nanoatmega168`` - - `Arduino Nano ATmega168 `_ + - `Arduino Nano ATmega168 `_ - ATMEGA168 - 16 MHz - 16 Kb - 1 Kb * - ``nanoatmega328`` - - `Arduino Nano ATmega328 `_ + - `Arduino Nano ATmega328 `_ - ATMEGA328P - 16 MHz - 32 Kb @@ -355,28 +369,35 @@ Arduino - 2 Kb * - ``robotControl`` - - `Arduino Robot Control `_ + - `Arduino Robot Control `_ - ATMEGA32U4 - 16 MHz - 32 Kb - 2.5 Kb * - ``robotMotor`` - - `Arduino Robot Motor `_ + - `Arduino Robot Motor `_ - ATMEGA32U4 - 16 MHz - 32 Kb - 2.5 Kb * - ``uno`` - - `Arduino Uno `_ + - `Arduino Uno `_ - ATMEGA328P - 16 MHz - 32 Kb - 2 Kb * - ``yun`` - - `Arduino Yun `_ + - `Arduino Yun `_ + - ATMEGA32U4 + - 16 MHz + - 32 Kb + - 2.5 Kb + + * - ``yunmini`` + - `Arduino Yun Mini `_ - ATMEGA32U4 - 16 MHz - 32 Kb @@ -579,6 +600,26 @@ LightUp - 32 Kb - 2.5 Kb +Linino +~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``one`` + - `Linino One `_ + - ATMEGA32U4 + - 16 MHz + - 32 Kb + - 2.5 Kb + LowPowerLab ~~~~~~~~~~~ diff --git a/docs/platforms/atmelsam.rst b/docs/platforms/atmelsam.rst index 1113932c..9e232616 100644 --- a/docs/platforms/atmelsam.rst +++ b/docs/platforms/atmelsam.rst @@ -99,14 +99,14 @@ Arduino - RAM * - ``due`` - - `Arduino Due (Programming Port) `_ + - `Arduino Due (Programming Port) `_ - SAM3X8E - 84 MHz - 512 Kb - 32 Kb * - ``dueUSB`` - - `Arduino Due (USB Native Port) `_ + - `Arduino Due (USB Native Port) `_ - SAM3X8E - 84 MHz - 512 Kb diff --git a/platformio/__init__.py b/platformio/__init__.py index bc8d2788..b770a33d 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (2, 9, 0) +VERSION = (2, 9, "1.dev0") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/platforms/lattice_ice40.py b/platformio/platforms/lattice_ice40.py index 1791a51c..35d41ed8 100755 --- a/platformio/platforms/lattice_ice40.py +++ b/platformio/platforms/lattice_ice40.py @@ -36,5 +36,8 @@ class Lattice_ice40Platform(BasePlatform): } } + def get_name(self): + return "Lattice iCE40" + def is_embedded(self): return True From a77cbe5c16b8f2530e4f4b6a94f7a95f5f654423 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 30 Apr 2016 13:28:57 +0300 Subject: [PATCH 2/9] Handle pointer to the prototypes while converting "*.ino" to ".cpp" // Resolve #639 --- HISTORY.rst | 6 ++++++ platformio/builder/tools/piomisc.py | 31 +++++++++++++++++++---------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 407f9e52..c308b9af 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,12 @@ Release Notes PlatformIO 2.0 -------------- +2.9.1 (2016-04-??) +~~~~~~~~~~~~~~~~~~ + +* Handle pointer to the prototypes while converting ``*.ino`` to ``.cpp`` + (`issue #639 `_) + 2.9.0 (2016-04-28) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index 202eb175..b5acfdf2 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -34,8 +34,8 @@ class InoToCPPConverter(object): """, re.X | re.M | re.I ) - DETECTMAIN_RE = re.compile(r"void\s+(setup|loop)\s*\(", re.M | re.I) + PROTOPTRS_TPLRE = r"\([^&\(]*&(%s)[^\)]*\)" def __init__(self, nodes): self.nodes = nodes @@ -50,22 +50,33 @@ class InoToCPPConverter(object): if (set([match.group(2).strip(), match.group(3).strip()]) & reserved_keywords): continue - prototypes.append((file_path, match.start(), match.group(1))) + prototypes.append({"path": file_path, "match": match}) return prototypes - @staticmethod - def append_prototypes(contents, prototypes): + def append_prototypes(self, contents, prototypes): result = [] if not prototypes: return result - first_pos = prototypes[0][1] - result.append(contents[:first_pos].strip()) - result.append("%s;" % ";\n".join([p[2] for p in prototypes])) + split_pos = prototypes[0]['match'].start() + prototype_names = set( + [p['match'].group(3).strip() for p in prototypes]) + + match_ptrs = re.search( + self.PROTOPTRS_TPLRE % ("|".join(prototype_names)), + contents[:split_pos], + re.M + ) + if match_ptrs: + split_pos = contents.rfind("\n", 0, match_ptrs.start()) + + result.append(contents[:split_pos].strip()) + result.append("%s;" % + ";\n".join([p['match'].group(1) for p in prototypes])) result.append('#line %d "%s"' % ( - contents.count("\n", 0, first_pos + len(prototypes[0][2])) + 1, - prototypes[0][0].replace("\\", "/"))) - result.append(contents[first_pos:].strip()) + contents.count("\n", 0, split_pos) + 2, + prototypes[0]['path'].replace("\\", "/"))) + result.append(contents[split_pos:].strip()) return result From 0a760ce9a4bd6e9f30228a1dcfa7670d448e3497 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 30 Apr 2016 13:36:20 +0300 Subject: [PATCH 3/9] Update number of supported development platforms --- docs/ide/_platformio_ide_extra.rst | 4 ++-- docs/ide/atom.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/ide/_platformio_ide_extra.rst b/docs/ide/_platformio_ide_extra.rst index cf39a0e0..c762c1b1 100644 --- a/docs/ide/_platformio_ide_extra.rst +++ b/docs/ide/_platformio_ide_extra.rst @@ -15,8 +15,8 @@ * Cross-platform build system without external dependencies to the OS software: - - 200+ embedded boards - - 15+ development platforms + - 250+ embedded boards + - 20+ development platforms - 10+ frameworks * C/C++ Intelligent code completion diff --git a/docs/ide/atom.rst b/docs/ide/atom.rst index 116a9a55..61d515ea 100644 --- a/docs/ide/atom.rst +++ b/docs/ide/atom.rst @@ -18,8 +18,8 @@ PlatformIO IDE is the next-generation integrated development environment for IoT * Cross-platform build system without external dependencies to the OS software: - - 200+ embedded boards - - 15+ development platforms + - 250+ embedded boards + - 20+ development platforms - 10+ frameworks * C/C++ Intelligent Code Completion From f42c8f10f3b4d44920573a0a6cf9a088d919f797 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 30 Apr 2016 17:19:18 +0300 Subject: [PATCH 4/9] Improve INO to CPP converter // Issue #639 --- platformio/builder/tools/piomisc.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index b5acfdf2..e6e7058e 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -53,14 +53,18 @@ class InoToCPPConverter(object): prototypes.append({"path": file_path, "match": match}) return prototypes - def append_prototypes(self, contents, prototypes): + def append_prototypes(self, file_path, contents, prototypes): result = [] if not prototypes: return result - split_pos = prototypes[0]['match'].start() prototype_names = set( [p['match'].group(3).strip() for p in prototypes]) + split_pos = prototypes[0]['match'].start() + for item in prototypes: + if item['path'] == file_path: + split_pos = item['match'].start() + break match_ptrs = re.search( self.PROTOPTRS_TPLRE % ("|".join(prototype_names)), @@ -74,8 +78,7 @@ class InoToCPPConverter(object): result.append("%s;" % ";\n".join([p['match'].group(1) for p in prototypes])) result.append('#line %d "%s"' % ( - contents.count("\n", 0, split_pos) + 2, - prototypes[0]['path'].replace("\\", "/"))) + contents.count("\n", 0, split_pos) + 2, file_path)) result.append(contents[split_pos:].strip()) return result @@ -102,7 +105,8 @@ class InoToCPPConverter(object): result.append('#line 1 "%s"' % file_path.replace("\\", "/")) if is_first and prototypes: - result += self.append_prototypes(contents, prototypes) + result += self.append_prototypes( + file_path, contents, prototypes) else: result.append(contents) is_first = False From 238fa36212c680fd44bc2863a4015b984316422c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 30 Apr 2016 17:23:51 +0300 Subject: [PATCH 5/9] Fix path for Windows for Preprocessor --- platformio/builder/tools/piomisc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index e6e7058e..1fa62f93 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -78,7 +78,8 @@ class InoToCPPConverter(object): result.append("%s;" % ";\n".join([p['match'].group(1) for p in prototypes])) result.append('#line %d "%s"' % ( - contents.count("\n", 0, split_pos) + 2, file_path)) + contents.count("\n", 0, split_pos) + 2, + file_path.replace("\\", "/"))) result.append(contents[split_pos:].strip()) return result From 03c0033bedeb206116c7a7efc47bc8a62e6e8f07 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 30 Apr 2016 17:33:45 +0300 Subject: [PATCH 6/9] Optmize INO to CPP converter // Issue #639 --- platformio/builder/tools/piomisc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index 1fa62f93..8cccb857 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -59,7 +59,8 @@ class InoToCPPConverter(object): return result prototype_names = set( - [p['match'].group(3).strip() for p in prototypes]) + [p['match'].group(3).strip() for p in prototypes + if p['path'] == file_path]) split_pos = prototypes[0]['match'].start() for item in prototypes: if item['path'] == file_path: From cf7a3e377f72589ac18382e8b0ec946430914ada Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 30 Apr 2016 17:35:41 +0300 Subject: [PATCH 7/9] Scan all prototypes with pointers --- platformio/builder/tools/piomisc.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index 8cccb857..1fa62f93 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -59,8 +59,7 @@ class InoToCPPConverter(object): return result prototype_names = set( - [p['match'].group(3).strip() for p in prototypes - if p['path'] == file_path]) + [p['match'].group(3).strip() for p in prototypes]) split_pos = prototypes[0]['match'].start() for item in prototypes: if item['path'] == file_path: From 4c70856505fa9b87d60b5f14e5b37224367aad8e Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 30 Apr 2016 17:40:55 +0300 Subject: [PATCH 8/9] Update history --- HISTORY.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index c308b9af..a4b11b36 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,7 +7,7 @@ PlatformIO 2.0 2.9.1 (2016-04-??) ~~~~~~~~~~~~~~~~~~ -* Handle pointer to the prototypes while converting ``*.ino`` to ``.cpp`` +* Handle prototype pointers while converting ``*.ino`` to ``.cpp`` (`issue #639 `_) 2.9.0 (2016-04-28) From ea800f35b7ae81a85208868e231d48ec4056bd53 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 30 Apr 2016 18:20:31 +0300 Subject: [PATCH 9/9] Version bump to 2.9.1 (issues #639) --- HISTORY.rst | 2 +- platformio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index a4b11b36..ae4961ea 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,7 +4,7 @@ Release Notes PlatformIO 2.0 -------------- -2.9.1 (2016-04-??) +2.9.1 (2016-04-30) ~~~~~~~~~~~~~~~~~~ * Handle prototype pointers while converting ``*.ino`` to ``.cpp`` diff --git a/platformio/__init__.py b/platformio/__init__.py index b770a33d..0f6724ec 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (2, 9, "1.dev0") +VERSION = (2, 9, 1) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio"