aboutsummaryrefslogtreecommitdiffstats
path: root/machxo2/resource/embed.cc
diff options
context:
space:
mode:
Diffstat (limited to 'machxo2/resource/embed.cc')
-rw-r--r--machxo2/resource/embed.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/machxo2/resource/embed.cc b/machxo2/resource/embed.cc
new file mode 100644
index 00000000..24d4815a
--- /dev/null
+++ b/machxo2/resource/embed.cc
@@ -0,0 +1,24 @@
+#include <cstdio>
+#include <windows.h>
+#include "nextpnr.h"
+#include "resource.h"
+
+NEXTPNR_NAMESPACE_BEGIN
+
+const char *chipdb_blob_1200;
+
+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_1200 = LoadFileInResource(IDR_CHIPDB_1200, BINARYFILE, size);
+}
+
+NEXTPNR_NAMESPACE_END