diff --git a/Host/BootCommander.exe b/Host/BootCommander.exe index 6ef0bc27..0bd709dd 100644 Binary files a/Host/BootCommander.exe and b/Host/BootCommander.exe differ diff --git a/Host/MicroBoot.exe b/Host/MicroBoot.exe index 34a818bf..9d0955c1 100644 Binary files a/Host/MicroBoot.exe and b/Host/MicroBoot.exe differ diff --git a/Host/Source/BootCommander/CMakeLists.txt b/Host/Source/BootCommander/CMakeLists.txt index 03393fbd..3508cfbb 100644 --- a/Host/Source/BootCommander/CMakeLists.txt +++ b/Host/Source/BootCommander/CMakeLists.txt @@ -73,15 +73,27 @@ set(LIBOPENBLT_LIB ${PROJECT_OUTPUT_DIRECTORY}) #**************************************************************************************** # Compiler flags #**************************************************************************************** -# Set platform specific compiler macro PLATFORM_XXX +# Set platform specific compiler macros PLATFORM_XXX if(WIN32) - if(CMAKE_C_COMPILER_ID MATCHES GNU) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WIN32 -D_CRT_SECURE_NO_WARNINGS -std=gnu99") + if(CMAKE_C_COMPILER_ID MATCHES GNU) + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WINDOWS -DPLATFORM_32BIT -D_CRT_SECURE_NO_WARNINGS -std=gnu99") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WINDOWS -DPLATFORM_64BIT -D_CRT_SECURE_NO_WARNINGS -std=gnu99") + endif() elseif(CMAKE_C_COMPILER_ID MATCHES MSVC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WIN32 -D_CRT_SECURE_NO_WARNINGS") + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WINDOWS -DPLATFORM_32BIT -D_CRT_SECURE_NO_WARNINGS") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WINDOWS -DPLATFORM_64BIT -D_CRT_SECURE_NO_WARNINGS") + endif() endif() elseif(UNIX) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_LINUX -pthread -std=gnu99") + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_LINUX -DPLATFORM_32BIT -pthread -std=gnu99") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_LINUX -DPLATFORM_64BIT -pthread -std=gnu99") + endif() endif(WIN32) # Configure a statically linked run-time library for msvc diff --git a/Host/Source/LibOpenBLT/CMakeLists.txt b/Host/Source/LibOpenBLT/CMakeLists.txt index dc516f3c..cecb11ae 100644 --- a/Host/Source/LibOpenBLT/CMakeLists.txt +++ b/Host/Source/LibOpenBLT/CMakeLists.txt @@ -85,15 +85,27 @@ endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES ) #**************************************************************************************** # Compiler flags #**************************************************************************************** -# Set platform specific compiler macro PLATFORM_XXX +# Set platform specific compiler macros PLATFORM_XXX if(WIN32) - if(CMAKE_C_COMPILER_ID MATCHES GNU) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WIN32 -D_CRT_SECURE_NO_WARNINGS -std=gnu99") + if(CMAKE_C_COMPILER_ID MATCHES GNU) + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WINDOWS -DPLATFORM_32BIT -D_CRT_SECURE_NO_WARNINGS -std=gnu99") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WINDOWS -DPLATFORM_64BIT -D_CRT_SECURE_NO_WARNINGS -std=gnu99") + endif() elseif(CMAKE_C_COMPILER_ID MATCHES MSVC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WIN32 -D_CRT_SECURE_NO_WARNINGS") + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WINDOWS -DPLATFORM_32BIT -D_CRT_SECURE_NO_WARNINGS") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WINDOWS -DPLATFORM_64BIT -D_CRT_SECURE_NO_WARNINGS") + endif() endif() elseif(UNIX) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_LINUX -pthread -std=gnu99") + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_LINUX -DPLATFORM_32BIT -pthread -std=gnu99") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_LINUX -DPLATFORM_64BIT -pthread -std=gnu99") + endif() endif(WIN32) # Configure a statically linked run-time library for msvc diff --git a/Host/Source/LibOpenBLT/bindings/csharp/README.md b/Host/Source/LibOpenBLT/bindings/csharp/README.md index 4b7908b4..c075745a 100644 --- a/Host/Source/LibOpenBLT/bindings/csharp/README.md +++ b/Host/Source/LibOpenBLT/bindings/csharp/README.md @@ -32,9 +32,9 @@ These run-time libraries can be found in the ./Host directory of the OpenBLT boo ### Configure platform target -Under Microsoft Windows, the LibOpenBLT shared library (**libopenblt.dll**) is 32-bit. For this reason you need to build your own C# program as a 32-bit application as well. +Under Microsoft Windows, the LibOpenBLT shared library (**libopenblt.dll**) is 64-bit ever since OpenBLT version 1.14. For this reason you need to build your own C# program as a 64-bit application as well. To configure this, go to your project's properties in Microsoft Visual Studio. In the *Build* settings, set the **Platform target** to **x64**. -To configure this, go to your project's properties in Microsoft Visual Studio. In the *Build* settings, set the **Platform target** to **x86**. +If you use the LibOpenBLT shared library from before OpenBLT version 1.14 or if you rebuilt it yourself as 32-bit, then you need to build your own C# program as a 32-bit application. To configure this, go to your project's properties in Microsoft Visual Studio. In the *Build* settings, set the **Platform target** to **x86**. ### Example program diff --git a/Host/Source/LibOpenBLT/bindings/csharp/openblt.cs b/Host/Source/LibOpenBLT/bindings/csharp/openblt.cs index f6af2f26..85204bd6 100644 --- a/Host/Source/LibOpenBLT/bindings/csharp/openblt.cs +++ b/Host/Source/LibOpenBLT/bindings/csharp/openblt.cs @@ -41,8 +41,15 @@ namespace OpenBLT /// /// /// Note that under Microsoft Windows, the LibOpenBLT shared library (libopenblt.dll) - /// is 32-bit. For this reason, whatever project uses this wrapper class needs to - /// be built as a 32-bit application. + /// is 64-bit, ever since OpenBLT version 1.14 . For this reason, whatever project + /// uses this wrapper class needs to be built as a 64-bit application. + /// + /// To configure this, go to your project's properties in Microsoft Visual Studio. + /// In the "Build" settings, set "Platform target" to "x64". + /// + /// When using LibOpenBLT from before OpenBLT version 1.14 or if you rebuild the + /// LibOpenBLT shared library yourself as 32-bit, then your project that uses this + /// wrapper class needs to be built as a 32-bit application. /// /// To configure this, go to your project's properties in Microsoft Visual Studio. /// In the "Build" settings, set "Platform target" to "x86". diff --git a/Host/Source/LibOpenBLT/bindings/pascal/README.md b/Host/Source/LibOpenBLT/bindings/pascal/README.md index 70572691..84c5c037 100644 --- a/Host/Source/LibOpenBLT/bindings/pascal/README.md +++ b/Host/Source/LibOpenBLT/bindings/pascal/README.md @@ -27,11 +27,9 @@ These run-time libraries can be found in the ./Host directory of the OpenBLT boo ### Lazarus and Delphi specifics on Windows -Under Microsoft Windows, the LibOpenBLT shared library (**libopenblt.dll**) is 32-bit. This means that the application you develop needs to build as a 32-bit application as well. +Under Microsoft Windows, the LibOpenBLT shared library (**libopenblt.dll**) is 64-bit ever since OpenBLT version 1.14. This means that the application you develop needs to build as a 64-bit application as well. When using Lazarus, an easy solution is to install the [64-bit version of Lazarus](https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2064%20bits/). That way your own application automatically builds as a 64-bit application as well. When using Delphi, go to the *Project Manager* and configure just **64-bit Windows platform** for setting **Target Platforms**. -When using Lazarus, an easy solution is to install the 32-bit version of Lazarus. That way your own application automatically builds as a 32-bit application as well. If you already installed the 64-bit version of Lazarus, then you can go to the *Project Options* and set **Target OS** to **Win32** and **Target CPU Family** to **i386**. - -When using Delphi, go to the *Project Manager* and configure just **32-bit Windows platform (Win32)** for setting **Target Platforms**. +If you use the LibOpenBLT shared library from before OpenBLT version 1.14 or if you rebuilt it yourself as 32-bit, you need to build your Lazarus application as a 32-bit application. If you install the [32-bit version of Lazarus](https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2032%20bits/), your application by default builds as a 32-bit. When using Delphi, go to the *Project Manager* and configure just **32-bit Windows platform** for setting **Target Platforms**. ### Lazarus specifics on Linux When running your program under Linux, you will most likely get the following error: diff --git a/Host/Source/LibOpenBLT/bindings/python/README.rst b/Host/Source/LibOpenBLT/bindings/python/README.rst index d6514c2f..6d5636fb 100644 --- a/Host/Source/LibOpenBLT/bindings/python/README.rst +++ b/Host/Source/LibOpenBLT/bindings/python/README.rst @@ -42,4 +42,6 @@ These run-time libraries can be found in the ./Host directory of the OpenBLT boo Specific on Windows ------------------ -Under Microsoft Windows, the LibOpenBLT shared library (libopenblt.dll) is 32-bit. Therefore you need to run your Python application, that makes use of LibOpenBLT, using the 32-bit Python interpreter. +Under Microsoft Windows, the LibOpenBLT shared library (libopenblt.dll) is 64-bit ever since OpenBLT version 1.14. Therefore you need to run your Python application, that makes use of LibOpenBLT, using the 64-bit Python interpreter. + +If you use the LibOpenBLT shared library from before OpenBLT version 1.14 or if you rebuilt it yourself as 32-bit, you need to run your Python application using the 32-bit Python interpreter. diff --git a/Host/Source/LibOpenBLT/candriver.c b/Host/Source/LibOpenBLT/candriver.c index a12c75d7..bc316d1e 100644 --- a/Host/Source/LibOpenBLT/candriver.c +++ b/Host/Source/LibOpenBLT/candriver.c @@ -35,16 +35,15 @@ #include /* for boolean type */ #include /* for string library */ #include "candriver.h" /* Generic CAN driver module */ -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_LINUX) +#include "socketcan.h" /* SocketCAN interface */ +#else #include "pcanusb.h" /* Peak PCAN-USB interface */ #include "leaflight.h" /* Kvaser Leaf Light v2 interface */ #include "canusb.h" /* Lawicel CANUSB interface */ #include "xldriver.h" /* Vector XL driver interface */ #include "vcidriver.h" /* Ixxat VCI driver interface */ #endif -#if defined(PLATFORM_LINUX) -#include "socketcan.h" /* SocketCAN interface */ -#endif /**************************************************************************************** @@ -83,7 +82,12 @@ void CanInit(tCanSettings const * settings) /* Determine the pointer to the correct CAN interface, based on the specified * device name. */ -#if defined(PLATFORM_WIN32) +#if defined(PLATFORM_LINUX) + /* On Linux, the device name is the name of the SocketCAN link, so always link + * the SocketCAN interface to the CAN driver. + */ + canIfPtr = SocketCanGetInterface(); +#else if (strcmp(settings->devicename, "peak_pcanusb") == 0) { canIfPtr = PCanUsbGetInterface(); @@ -104,12 +108,6 @@ void CanInit(tCanSettings const * settings) { canIfPtr = IxxatVciGetInterface(); } -#endif -#if defined(PLATFORM_LINUX) - /* On Linux, the device name is the name of the SocketCAN link, so always link - * the SocketCAN interface to the CAN driver. - */ - canIfPtr = SocketCanGetInterface(); #endif /* Check validity of the interface. */ assert(canIfPtr != NULL); diff --git a/Host/Source/LibOpenBLT/port/windows/canif/ixxat/stdtype.h b/Host/Source/LibOpenBLT/port/windows/canif/ixxat/stdtype.h index d9f59a64..fa16bae9 100644 --- a/Host/Source/LibOpenBLT/port/windows/canif/ixxat/stdtype.h +++ b/Host/Source/LibOpenBLT/port/windows/canif/ixxat/stdtype.h @@ -113,6 +113,14 @@ #define _M_BITS 32 #define _M_IX86_ _M_IX86 #define _M_BYTE_ORDER _LITTLE_ENDIAN + #elif !defined(_M_X64_) && defined(_M_X64) + #define _M_BITS 64 + #define _M_X64_ _M_X64 + #define _M_BYTE_ORDER _LITTLE_ENDIAN + #elif !defined(_M_AMD64_) && defined(_M_AMD64) + #define _M_BITS 64 + #define _M_AMD64_ _M_AMD64 + #define _M_BYTE_ORDER _LITTLE_ENDIAN #endif #endif diff --git a/Host/Source/LibOpenBLT/port/windows/canif/lawicel/canusb.c b/Host/Source/LibOpenBLT/port/windows/canif/lawicel/canusb.c index 4004230e..ec1a3e2f 100644 --- a/Host/Source/LibOpenBLT/port/windows/canif/lawicel/canusb.c +++ b/Host/Source/LibOpenBLT/port/windows/canif/lawicel/canusb.c @@ -589,9 +589,14 @@ static void CanUsbLibLoadDll(void) canUsbLibFuncStatusPtr = NULL; canUsbLibFuncSetReceiveCallBackPtr = NULL; - /* Attempt to load the library and obtain a handle to it. */ + /* Attempt to load the library and obtain a handle to it. Note that the 32-bit DLL + * has a different name than the 64-bit one. + */ +#ifdef PLATFORM_32BIT canUsbDllHandle = LoadLibrary("canusbdrv"); - +#else + canUsbDllHandle = LoadLibrary("canusbdrv64"); +#endif /* Assert libary handle. */ assert(canUsbDllHandle != NULL); diff --git a/Host/Source/SeedNKey/CMakeLists.txt b/Host/Source/SeedNKey/CMakeLists.txt index cfb1efff..38fd6b6f 100644 --- a/Host/Source/SeedNKey/CMakeLists.txt +++ b/Host/Source/SeedNKey/CMakeLists.txt @@ -69,15 +69,27 @@ endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES ) #**************************************************************************************** # Compiler flags #**************************************************************************************** -# Set platform specific compiler macro PLATFORM_XXX +# Set platform specific compiler macros PLATFORM_XXX if(WIN32) - if(CMAKE_C_COMPILER_ID MATCHES GNU) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WIN32 -D_CRT_SECURE_NO_WARNINGS -std=gnu99") + if(CMAKE_C_COMPILER_ID MATCHES GNU) + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WINDOWS -DPLATFORM_32BIT -D_CRT_SECURE_NO_WARNINGS -std=gnu99") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WINDOWS -DPLATFORM_64BIT -D_CRT_SECURE_NO_WARNINGS -std=gnu99") + endif() elseif(CMAKE_C_COMPILER_ID MATCHES MSVC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WIN32 -D_CRT_SECURE_NO_WARNINGS") + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WINDOWS -DPLATFORM_32BIT -D_CRT_SECURE_NO_WARNINGS") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_WINDOWS -DPLATFORM_64BIT -D_CRT_SECURE_NO_WARNINGS") + endif() endif() elseif(UNIX) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_LINUX -pthread -std=gnu99") + if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_LINUX -DPLATFORM_32BIT -pthread -std=gnu99") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPLATFORM_LINUX -DPLATFORM_64BIT -pthread -std=gnu99") + endif() endif(WIN32) # Configure a statically linked run-time library for msvc diff --git a/Host/libopenblt.dll b/Host/libopenblt.dll index c8643978..bc9a2677 100644 Binary files a/Host/libopenblt.dll and b/Host/libopenblt.dll differ diff --git a/Host/libseednkey.dll b/Host/libseednkey.dll index 5a5bc43e..5e2f5595 100644 Binary files a/Host/libseednkey.dll and b/Host/libseednkey.dll differ