aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5/resource
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2018-08-02 14:51:05 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2018-08-02 14:51:05 +0200
commitf1893f9681ea82e146fdf3d2e9d3bba7b667f8fb (patch)
tree2cb1066ce40ae9b5730cdeec4e5885c5c43ae6f6 /ecp5/resource
parentfc882d73d6511be4325a7b9c16d6833263c06b10 (diff)
downloadnextpnr-f1893f9681ea82e146fdf3d2e9d3bba7b667f8fb.tar.gz
nextpnr-f1893f9681ea82e146fdf3d2e9d3bba7b667f8fb.tar.bz2
nextpnr-f1893f9681ea82e146fdf3d2e9d3bba7b667f8fb.zip
Add missing files and missing includes for MSVC
Diffstat (limited to 'ecp5/resource')
-rw-r--r--ecp5/resource/chipdb.rc5
-rw-r--r--ecp5/resource/embed.cc28
-rw-r--r--ecp5/resource/resource.h4
3 files changed, 37 insertions, 0 deletions
diff --git a/ecp5/resource/chipdb.rc b/ecp5/resource/chipdb.rc
new file mode 100644
index 00000000..7191f581
--- /dev/null
+++ b/ecp5/resource/chipdb.rc
@@ -0,0 +1,5 @@
+#include "resource.h"
+
+IDR_CHIPDB_25K BINARYFILE "..\chipdbs\chipdb-25k.bin"
+IDR_CHIPDB_45K BINARYFILE "..\chipdbs\chipdb-45k.bin"
+IDR_CHIPDB_88K BINARYFILE "..\chipdbs\chipdb-85k.bin"
diff --git a/ecp5/resource/embed.cc b/ecp5/resource/embed.cc
new file mode 100644
index 00000000..adbb7781
--- /dev/null
+++ b/ecp5/resource/embed.cc
@@ -0,0 +1,28 @@
+#include <cstdio>
+#include <windows.h>
+#include "nextpnr.h"
+#include "resource.h"
+
+NEXTPNR_NAMESPACE_BEGIN
+
+const char *chipdb_blob_25k;
+const char *chipdb_blob_45k;
+const char *chipdb_blob_85k;
+
+const char *LoadFileInResource(int name, int type, DWORD &size)
+{
+ HMODULE handle = ::GetModuleHandle(NULL);
+ HRSRC rc = ::FindResource(handle, MAKEINTRESOURCE(name), MAKEINTRESOURCE(type));
+ HGLOBAL rcData = ::LoadResource(handle, rc);
+ size = ::SizeofResource(handle, rc);
+ return static_cast<const char *>(::LockResource(rcData));
+}
+void load_chipdb()
+{
+ DWORD size = 0;
+ chipdb_blob_25k = LoadFileInResource(IDR_CHIPDB_25K, BINARYFILE, size);
+ chipdb_blob_45k = LoadFileInResource(IDR_CHIPDB_45K, BINARYFILE, size);
+ chipdb_blob_85k = LoadFileInResource(IDR_CHIPDB_85K, BINARYFILE, size);
+}
+
+NEXTPNR_NAMESPACE_END \ No newline at end of file
diff --git a/ecp5/resource/resource.h b/ecp5/resource/resource.h
new file mode 100644
index 00000000..1a18bee2
--- /dev/null
+++ b/ecp5/resource/resource.h
@@ -0,0 +1,4 @@
+#define BINARYFILE 256
+#define IDR_CHIPDB_25K 101
+#define IDR_CHIPDB_45K 102
+#define IDR_CHIPDB_85K 103