-
Notifications
You must be signed in to change notification settings - Fork 37
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
MacOS Sonoma (Mac M2) issue uploading firmware with WCH-Link (+workaround) #44
Comments
For the binaries, I'm using what WCH provides as precompiled (http://www.mounriver.com/download). Sources are hard to find and sometimes outdated (although they are technically obliged to release them through the GPL.). But yes, other PlatformIO packages bundle the necesary dylib files in the |
Yes, none of the Mac packages (neither darwin x86_64 nor arm64) has a |
Thanks for sharing. Had to copy it to |
I've published a package update to first of all update to the latest OpenOCD version (might resolve CH32X035 issues) and second of all the Mac x64 and ARM packages now have the libusb dylib prepackaged in them. It now awaits moderation by the PlatformIO team. |
Hi folks. I have the same issue here. @maxgerhardt any update with the moderation of PIO team? Thanks. |
Still no update. Depending on whether you're on Windows, Linux or Mac I suggest injecting the right package as workaround for now, by adding to the ; Use only one.
; for Windows
platform_packages = tool-openocd-riscv-wch@https://github.com/Community-PIO-CH32V/tool-openocd-riscv-wch.git
; for Linux
platform_packages = tool-openocd-riscv-wch@https://github.com/Community-PIO-CH32V/tool-openocd-riscv-wch.git#linux
; for MacOS x64
platform_packages = tool-openocd-riscv-wch@https://github.com/Community-PIO-CH32V/tool-openocd-riscv-wch.git#darwin_x64
; for MacOS ARM (M1 etc.)
platform_packages = tool-openocd-riscv-wch@https://github.com/Community-PIO-CH32V/tool-openocd-riscv-wch.git#darwin_arm |
Update went fine, however, flashing problem remains:
|
The same here. I created o symbolic link in '/usr/local/opt/libusb/lib/libusb-1.0.0.dylib' but with no success
(mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')) |
I also tried to add platform_packages = tool-openocd-riscv-wch@https://github.com/Community-PIO-CH32V/tool-openocd-riscv-wch.git#darwin_arm
|
Great, then the two MacOS packages I've submitted are a catastrophic failure. Cursed be this OS. @Jason2866 sorry to tag you directly, could this issue of the |
@maxgerhardt Built openocd for espressif32 myself on my M1. Did not run in this issue. |
@maxgerhardt after updating the framework with
|
@francismariano what's the output of
in the PIO core cli? PlatformIO may still, for some reason, decide to install the x64 version on your ARM machine. I think Jason even into that. |
But my mac has an Apple M2 chip |
Then see platformio/platformio-vscode-ide#3949. But this shouldn't matter too much, then it should just use the x64 packages; But those don't find their dylib as well. |
Ok. Another thing. When I force
|
It doesn't even attempt to look in the current directory for the file; I don't entirely get that and I still think this is an RPath issue in the openocd Macho-Binary. Since MounRiver builds these binaries (without releasing source code although this is GPL covered, hm hm), I can't really influence the build process, only try to post-path their binaries.. But, that would require me to have a Mac. Can you check with the now cloned binary whether this command helps at all?
|
I ran the command above
I dunno if the opencd was executed successfully. I tried run directly into vscode (with upload action) but the opencd is not executed.
PS. Even before to execute the command above, the opencd was not executed into vscode when the platform-package is forced inside platformio.ini file. |
Sigh. This is going to prove difficult. I might just add to the readme that libusb has to be manually installed for this to work, if I can't patch the binary to properly use the included libusb dylib. This is what https://github.com/Community-PIO-CH32V/tool-openocd-riscv-wch/tree/darwin_arm says in the README after all too. Just to confirm, openocd does work correctly if you now |
Sorry, I cant install x64 variant because the rosetta is not install for now. I will install rosetta and I let you know. Do you know the reason the opencd is not found when platform-package is forced into platformio.ini?? |
Just out of curiosity, is not possible to install the open-ocd via homebrew and binding it to vscode?? |
PlatformIO actively discourages that, all tools it needs should be packaged as PlatformIO packages ( Also, the openocd installed via homebrew will absolutely not work, as it specifically needs to be the WCH variant. That is not added in upstream OpenOCD at all. |
Not at home so I can't test the next days. After some googling i do understand the problem, but probably hard to solve without trying things. |
Hello everyone. Good news here. First, I comment the line So I downloaded MRS_Toolchain_MAC_V191 in http://www.mounriver.com/download page. That file has openocd to arm64 and x86_654 architecture.
The opencd executable points to libusb and libhidapi installed by homebrew. When I tried to execute the opencd I get error of code signature and invalid IDs:
So I executed the following command in openocd
So I replaced the openocd in tool-openocd-riscv-wch/bin and the upload performed with success. |
Following up to @francismariano 's comment, I also got further in my attempt to work on my Mac M3 but I had to do the following:
I then started running into this error:
I got past this by doing 2 things and I'm not sure which method fixed it:
|
Hi,
After installing for VSCode as per instructions I was able to build but not flash firmware (noneos-sdk) because of libusb not being found. This despite having both Homebrew and MacPorts instances of libusb installed on my Mac M2.
Copying libusb-1.0.0.dylib (either Homebrew or MacPort) to /usr/lib/ generated the above error plus the following:
(mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
Workaround was to download pre-built binaries from https://sourceforge.net/projects/libusb/ and copy libusb-1.0.0.dylib (macos11_6/lib/ directory) to /usr/lib.
Clunky but at least now I can flash and debug. My questions, why x86_64? I assume this is a WCH/OpenOCD thing?
Also, is it possible to add additional search paths somewhere in the project config so that DYLD can find the appropriate libusb? Currently it is looking for it in all the wrong places.
Anyway, great to see PlatformIO support being added for these chips, well done!
The text was updated successfully, but these errors were encountered: