Mac OSX Support

Hi all!

I spent around an hour fast forwarding through the fun of getting this running on OSX (honestly, not a masochist - 2014 MacPro is a great laptop for simultaneous embedded, client and server work).

Pondering if anyone else has got Arduino working under OSX? Errors pasted at bottom - I’m switching to the bare toolchain now to establish a baseline and then work backwards. At some point I’ll switch to a VM I guess and try arduino on linux but that would be cheating at this early stage!

OpenOCD uses libusb to access the FTDI proprietary functions but an Apple pre-installed driver is in the way - unload it:

sudo kextunload -b com.apple.driver.AppleUSBFTDI

[removes /dev/tty.usb*]

…Note that you have to re-load the built in drivers to see the serial port again. I’m currently using a pyftdi app to access the serial (miniterm.py) so its not a huge issue yet (happy to write up instructions later). To restore:

sudo kextload -b com.apple.driver.AppleUSBFTDI

Recommend installing lsusb so you can see what’s going on:

brew tap jlhonora/lsusb && brew install lsusb

Bus 020 Device 007: ID 05ac:8406 Apple Inc. Card Reader Serial: 000000000820 Bus 020 Device 002: ID 05ac:0259 Apple Inc. Apple Internal Keyboard / Trackpad Bus 020 Device 003: ID 0a5c:4500 Broadcom Corp. BRCM20702 Hub Bus 020 Device 006: ID 05ac:8289 Apple Inc. Bluetooth USB Host Controller Bus 020 Device 014: ID 0403:6010 Future Technology Devices International Limited Dual RS232-HS Bus 000 Device 001: ID 1d6b:ILPT Linux Foundation USB 3.0 Bus

Run through the arduino board support instructions - compile works but download is screwed up:

Error 1:

Open On-Chip Debugger 0.10.0-dev-gb474c22 (2016-12-20-18:44) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html adapter speed: 10000 kHz Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'. Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling" Info : clock speed 10000 kHz Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (<unknown>), part: 0x0e31, ver: 0x1) Error: Wrote 0x5677b2db to Debug RAM at 0, but read back 0xfff04493 Error: Wrote 0x1f4d493 to Debug RAM at 1, but read back 0xfff04493 Error: Wrote 0x40902023 to Debug RAM at 2, but read back 0x1f4d493 Error: Wrote 0x1f4d493 to Debug RAM at 3, but read back 0x40902023 Error: Wrote 0x40902223 to Debug RAM at 4, but read back 0x1f4d493 Error: Wrote 0x3f00006f to Debug RAM at 5, but read back 0x40902223 Error: Wrote 0x60c1218 to Debug RAM at 6, but read back 0x3f00006f Error: Debug RAM 0x0: 0x060c1218 Error: Debug RAM 0x1: 0xfff04493 Error: Debug RAM 0x2: 0x01f4d493 Error: Debug RAM 0x3: 0x40902023 Error: Debug RAM 0x4: 0x01f4d493 Error: Debug RAM 0x5: 0x40902223 Error: Debug RAM 0x6: 0x3f00006f Error: Debug RAM 0x7: 0x060c1218 Error: Debug RAM 0x8: 0xddefd7ff Error: Debug RAM 0x9: 0x00000000 Error: Debug RAM 0xa: 0x00000000 Error: Debug RAM 0xb: 0x00000000 Error: Debug RAM 0xc: 0x00000000 Error: Debug RAM 0xd: 0x00000000 Error: Debug RAM 0xe: 0x00000000 Error: Debug RAM 0xf: 0x00000000 Error: Target not examined yet

Then error 2 until I reboot (assuming JTAG is in bad state and initial scan out returns crap that causes it to bomb out until its reset):

`Open On-Chip Debugger 0.10.0-dev-gb474c22 (2016-12-20-18:44)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 10000 kHz
Info : auto-selecting first available session transport “jtag”. To override use 'transport select '.
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 10000 kHz
Info : JTAG tap: riscv.cpu tap/device found: 0x10e31913 (mfg: 0x489 (), part: 0x0e31, ver: 0x1)
Error: OpenOCD only supports Debug Module version 1, not 0 (dminfo=0x0)
Error: Target not examined yet

the selected serial port
does not exist or your board is not connected`

There was a bug in OpenOCD which is fixed, but hasn’t made it into the package forArduino yet. So using the Freedom E SDK you should have more luck at the moment. We will release another Arduino package once folks are back from the holidays.

I had the same experience you did of having to keep swapping the drivers. I think it’s possible to compile openOCD a different way so that it will play nicer with macOS’ driver, but haven’t dug into it yet myself.

OpenOCD & drivers is the main reason we aren’t officially supporting macOS yet though the Arduino package should install.

I think that I may be having the same issue here:

Luke, did you select “SiFive OpenOCD” under

Tools->Programmer?

good to know, I did not have this selected. Here’s what I get now:

I tried out the bare metal tools - getting stuck building the toolchain.

configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify

I have these dependancies resolved already but something not working - I have a lot of tools installed for other things that I don’t want to break so I’m switched over to vagrant / linux instead which seems to be just fine.

What would be super useful is a docker image for this with the toolchain installed and a remote wrapper for make - I have a template for this - might give it a go later!

There is a docker image in dockerhub, I use it for FPGA development, have you tried it out?
https://hub.docker.com/r/hcook/docker-riscv/