Merge remote-tracking branch 'origin' into facade
diff --git a/README.md b/README.md
index 4af0768..50455a8 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,8 @@
  - CMake 3.5 or later
  - Boost including boost-python
  - Git
- 
+ - Recent OpenOCD for device programming (`--enable-ftdi` required if building from source)
+
 Clone the Project Trellis repository and download the latest database:
 
      git clone --recursive https://github.com/SymbiFlow/prjtrellis
diff --git a/examples/README.md b/examples/README.md
index 85c770f..a379c33 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -5,7 +5,7 @@
 
 ## Disclaimer
 
-Project Trellis is currently **highly** experimental. Do not use it for anything mission critical like avionics, nuclear power or automatic cat feeders!
+Project Trellis is currently experimental. Do not use it for anything mission critical like avionics, nuclear power or automatic cat feeders!
 Although I have not managed to destroy any FPGAs, there is a non-zero chance that the tools could produce a bitstream that destroys or degrades the FPGA. Do not
 use with a development board that you cannot afford to lose!
 
@@ -16,18 +16,18 @@
 
 ## Included Projects
 
- - **tinyfpga**: morse blink example for the TinyFPGA Ex rev1 prototype with an 85k ECP5
+ - **tinyfpga_rev1/rev2**: morse blink example for the TinyFPGA Ex rev1/2 prototypes with an 85k ECP5
  - **ulx3s**: "Night Rider" example for the 45k ULX3S board
- - **versa**: 14-segment display example for the ECP5 Versa Board
+ - **picorv32_ulx3s**: Small picorv32-based SoC for the 45k ULX3S board that displays prime numbers
+ on the LEDs.
+ - **versa5g**: 14-segment display example for the ECP5 Versa-5G board
+ - **picorv32_versa5g**: Small picorv32-based SoC for the ECP5 Versa-5G board that displays prime numbers
+ on the LEDs.
+ - **soc_versa5g**: Small picorv32-based SoC with RAM and UART for the ECP5 Versa-5G board
+ - **ecp5_evn**: "Night Rider" example for the ECP5 Evaluation Board
+ - **ecp5_evn_multiboot**: multiboot example for the ECP5 Evaluation Board
+ - **soc_ecp5_evn**: Small picorv32-based SoC with RAM and UART for the ECP5 Evaluation Board
 
-All projects include a Makefile for building (and programming in the case of the TinyFPGA example).
+All projects include a Makefile for building and programming.
 
-## Notes
 
-In all cases there are a handful of constant bits (that remain the same in all ECP5 designs), whose detailed function
-is unknown - even if the low-level purpose, such as tying an internal signal low, is known. This is why there is a
-"_empty.config" file in all examples. These files are also located in the `misc/basecfgs` folder. If you need to
-change any of the examples to a different ECP5 device, you will also need to pick the appropriate base config.
-
-IO constraints are currently specified as attributes on `TRELLIS_IO` primitives, reading IO constraint files
-is not yet implemented.
diff --git a/examples/ecp5_evn/README.md b/examples/ecp5_evn/README.md
new file mode 100644
index 0000000..fd67495
--- /dev/null
+++ b/examples/ecp5_evn/README.md
@@ -0,0 +1,6 @@
+# ECP5 Evaluation Board Example
+
+Run `make prog` to load the example to the board.
+
+You must ensure JP2 is shorted to connect the 12MHz
+FTDI clock to the FPGA.
\ No newline at end of file
diff --git a/examples/versa5g/README.md b/examples/versa5g/README.md
new file mode 100644
index 0000000..b390742
--- /dev/null
+++ b/examples/versa5g/README.md
@@ -0,0 +1,9 @@
+# ECP5 Versa-5G Demo
+
+Run `make prog` to build & load, LEDs will count and
+a message will scroll on the 14-segment display.
+
+If your Versa board is new, you will need to change
+J50 to bypass the iSPclock. Re-arrange the jumpers
+to connect pins 1-2 and 3-5 (leaving one jumper spare).
+See p19 of the Versa Board user guide.
diff --git a/libtrellis/CMakeLists.txt b/libtrellis/CMakeLists.txt
index f780213..dc49445 100644
--- a/libtrellis/CMakeLists.txt
+++ b/libtrellis/CMakeLists.txt
@@ -10,8 +10,8 @@
 set(CMAKE_DEFIN)
 set(link_param "")
 if (STATIC_BUILD)
-    set(Boost_USE_STATIC_LIBS   ON)
-    if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+    set(Boost_USE_STATIC_LIBS ON)
+    if (NOT APPLE)
         set(link_param "-static")
     endif()
 endif()
@@ -32,18 +32,18 @@
     # Original source: https://github.com/BVLC/caffe/blob/master/cmake/Dependencies.cmake#L148
     set(version ${PYTHONLIBS_VERSION_STRING})
 
-    STRING(REGEX REPLACE "[^0-9]" "" boost_py_version ${version})
+    STRING(REGEX REPLACE "[^0-9]" "" boost_py_version "${version}")
     find_package(Boost COMPONENTS "python-py${boost_py_version}" ${boost_libs})
     set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})
 
     while (NOT "${version}" STREQUAL "" AND NOT Boost_PYTHON_FOUND)
-        STRING(REGEX REPLACE "([0-9.]+).[0-9]+" "\\1" version ${version})
+        STRING(REGEX REPLACE "([0-9.]+).[0-9]+" "\\1" version "${version}")
 
-        STRING(REGEX REPLACE "[^0-9]" "" boost_py_version ${version})
+        STRING(REGEX REPLACE "[^0-9]" "" boost_py_version "${version}")
         find_package(Boost COMPONENTS "python-py${boost_py_version}" ${boost_libs})
         set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})
 
-        STRING(REGEX MATCHALL "([0-9.]+).[0-9]+" has_more_version ${version})
+        STRING(REGEX MATCHALL "([0-9.]+).[0-9]+" has_more_version "${version}")
         if ("${has_more_version}" STREQUAL "")
             break()
         endif ()
@@ -109,23 +109,23 @@
 find_package(Boost REQUIRED COMPONENTS program_options)
 
 get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
-if ("${LIB64}" STREQUAL "TRUE")
+if (NOT APPLE AND "${LIB64}" STREQUAL "TRUE")
     set(LIBDIR "lib64")
 else()
     set(LIBDIR "lib")
 endif()
 
 function(setup_rpath name)
-  if(APPLE)
-    set_target_properties(${name} PROPERTIES
-                          BUILD_WITH_INSTALL_RPATH ON
-                          INSTALL_RPATH "@loader_path/../${LIBDIR}/trellis"
-                          INSTALL_NAME_DIR "@rpath")
-  elseif(UNIX)
-    set_target_properties(${name} PROPERTIES
-                          BUILD_WITH_INSTALL_RPATH ON
-                          INSTALL_RPATH "\$ORIGIN/../${LIBDIR}/trellis")
-  endif()
+    if(APPLE)
+        set_target_properties(${name} PROPERTIES
+                              BUILD_WITH_INSTALL_RPATH ON
+                              INSTALL_RPATH "@loader_path/../${LIBDIR}/trellis"
+                              INSTALL_NAME_DIR "@rpath")
+    elseif(UNIX)
+        set_target_properties(${name} PROPERTIES
+                              BUILD_WITH_INSTALL_RPATH ON
+                              INSTALL_RPATH "\$ORIGIN/../${LIBDIR}/trellis")
+    endif()
 endfunction()
 
 add_executable(ecppack ${INCLUDE_FILES} tools/ecppack.cpp)
@@ -149,7 +149,7 @@
 setup_rpath(ecpmulti)
 
 if (BUILD_SHARED)
-    install(TARGETS trellis ecppack ecppll ecpunpack ecpmulti LIBRARY DESTINATION ${LIBDIR}/trellis  RUNTIME DESTINATION bin)
+    install(TARGETS trellis ecppack ecppll ecpunpack ecpmulti pytrellis LIBRARY DESTINATION ${LIBDIR}/trellis  RUNTIME DESTINATION bin)
 else()
     install(TARGETS ecppack ecpunpack ecppll ecpmulti RUNTIME DESTINATION bin)
 endif()
@@ -157,6 +157,3 @@
 install(DIRECTORY ../misc DESTINATION share/trellis)
 install(DIRECTORY ../util/common DESTINATION share/trellis/util)
 install(DIRECTORY ../timing/util DESTINATION share/trellis/timing USE_SOURCE_PERMISSIONS)
-if (BUILD_SHARED)
-   install(TARGETS pytrellis DESTINATION ${LIBDIR}/trellis)
-endif()