platform-teensy
platform-teensy copied to clipboard
Build for OSX with libusb-compat from homebrew to have a working soft reboot?
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?
Could you share somewhere a final binary? I’ll update packages
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.
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)
Are you sure that previous version does not work? I remember that we tested it with @PaulStoffregen and it worked.
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
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.
@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 andteensy_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