Serasidis / STM32_HID_Bootloader

Driverless USB HID bootloader and flashing tool for STM32F10X devices
418 stars 150 forks source link

Hid-flash 64-bit binaries #68

Open fpistm opened 6 months ago

fpistm commented 6 months ago

Hi @Serasidis

Hope you are fine 🙂

Did you test 64-bit binaries ? I would like to switch on 64-bit version as the arm-none-eabi toolchain only support 64-bit since 1 year. I've built hid-flash for Windows ans Linux. On windows it works while on Linux a segmentation fault is raised. I will try to debug to understand why. It would be fine to also provides this version

fpistm commented 6 months ago

Digging into the code, I've found the issue. It is linked to #30. Since I've change my Laptop, the udev rule was not present causing the fail on Linux and so the seg fault. Applying the patch fix the issue (thanks @matthijskooijman)

I've just add a specific warning for Linux about the udev rule:

@@ -131,12 +131,15 @@ int main(int argc, char *argv[]) {
     goto exit;
   } 

   handle = hid_open(VID, PID, NULL);

-  if (i == 10 && handle != NULL) {
+  if (handle == NULL) {
     printf("\n> Unable to open the [%04X:%04X] device.\n",VID,PID);
+#if defined(__linux__)
+    printf("> Please, ensure to have installed udev rule.\n");
+#endif
     error = 1;
     goto exit;
   }

   printf("\n> [%04X:%04X] device is found !\n",VID,PID);