Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build for OSX with libusb-compat from homebrew to have a working soft reboot? #37

Open
mgcrea opened this issue Jun 14, 2018 · 6 comments

Comments

@mgcrea
Copy link

mgcrea commented Jun 14, 2018

I've rebuild https://github.com/PaulStoffregen/teensy_loader_cli with libusb-compat from homebrew and the soft reboot is working on OSX.

For now I manually replace the teensy_loader_cli with my version. Maybe it should be the default as it's super useful?

@ivankravets
Copy link
Member

Could you share somewhere a final binary? I’ll update packages

@mgcrea
Copy link
Author

mgcrea commented Jun 14, 2018

Here is the binary, probably need to brew install libusb-compat first though (not sure). If required, it might break people uploads if they don't have the package.

teensy_loader_cli.zip

update yep it's required:

$ ./teensy_loader_cli --mcu=mk20dx256 -s ./firmware.hex 
dyld: Library not loaded: /usr/local/opt/libusb-compat/lib/libusb-0.1.4.dylib
  Referenced from: /Users/olivier/Developer/teensy/teensy_loader_cli/./teensy_loader_cli
  Reason: image not found
Abort trap: 6

maybe bundle this lib libusb-0.1.4.dylib along the cli? (not sure if enough)

@ivankravets
Copy link
Member

Are you sure that previous version does not work? I remember that we tested it with @PaulStoffregen and it worked.

@PaulStoffregen
Copy link

Here's a copy compiled on Ubuntu 14.04 (x86 64 bit) with this command to statically link libusb-0.1.4.

gcc -O2 -Wall  -s -DUSE_LIBUSB -o teensy_loader_cli teensy_loader_cli.c /usr/lib/x86_64-linux-gnu/libusb.a

https://www.pjrc.com/teensy/beta/teensy_loader_cli

@PaulStoffregen
Copy link

But that's Linux. For Macintosh OSX you should not need libusb at all. I wrote the Mac version using native OSX IOkit & CoreFoundation APIs.

@mgcrea
Copy link
Author

mgcrea commented Jun 16, 2018

@PaulStoffregen looks like libusb builds enable soft reboot to work on OSX which is really super useful.

@ivankravets I can confirm that the existing teensy_loader_cli bundled with platformio does not have a working soft reboot (as it's probably built against IOkit):

  • with teensy_loader_cli.bak being the shipped version and teensy_loader_cli being my build:
$ ~/.platformio/packages/tool-teensy/teensy_loader_cli -v -s --mcu=mk20dx256 .pioenvs/teensy31/firmware.hex 
Teensy Loader, Command Line, Version 2.1
Read ".pioenvs/teensy31/firmware.hex": 46536 bytes, 17.8% usage
Soft reboot performed
Waiting for Teensy device...
 (hint: press the reset button)
Found HalfKay Bootloader
Read ".pioenvs/teensy31/firmware.hex": 46536 bytes, 17.8% usage
Programming..............................................
Booting

$ ~/.platformio/packages/tool-teensy/teensy_loader_cli.bak -v -s --mcu=mk20dx256 .pioenvs/teensy31/firmware.hex 
Teensy Loader, Command Line, Version 2.1
Read ".pioenvs/teensy31/firmware.hex": 46536 bytes, 17.8% usage
Soft reboot is not implemented for OSX
Waiting for Teensy device...
 (hint: press the reset button)
^C

$ sha1sum ~/.platformio/packages/tool-teensy/teensy_loader_cli.bak
8742c8fe1930f271d75329f7a544918f10759fe3  /Users/olivier/.platformio/packages/tool-teensy/teensy_loader_cli.bak

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants