diff options
Diffstat (limited to 'machxo2/resource')
-rw-r--r-- | machxo2/resource/chipdb.rc | 3 | ||||
-rw-r--r-- | machxo2/resource/embed.cc | 24 | ||||
-rw-r--r-- | machxo2/resource/resource.h | 2 |
3 files changed, 29 insertions, 0 deletions
diff --git a/machxo2/resource/chipdb.rc b/machxo2/resource/chipdb.rc new file mode 100644 index 00000000..eff237fa --- /dev/null +++ b/machxo2/resource/chipdb.rc @@ -0,0 +1,3 @@ +#include "resource.h" + +IDR_CHIPDB_1200 BINARYFILE "machxo2/chipdb/chipdb-1200.bin" 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 diff --git a/machxo2/resource/resource.h b/machxo2/resource/resource.h new file mode 100644 index 00000000..9ac8c585 --- /dev/null +++ b/machxo2/resource/resource.h @@ -0,0 +1,2 @@ +#define BINARYFILE 256 +#define IDR_CHIPDB_1200 103 |