GNU Arm Embedded Toolchain can not execute on Mac Catalina

How to install GNU Arm Embedded Toolchain on Mac Catalina?
One way is go to the web site to download this tool, and follow the install instruction written in readme.txt. For the Mac, readme.txt is in the share/doc/gcc-arm-none-eabi folder.

But Mac Catalina would stop GNU Arm Embedded Toolchain to execute. Sure, you can manually permit this tool (e.g. arm-none-eabi-gcc) to execute by open the System Preferences and then open the Security & Privacy pane to allow it to run. Just like this paper described. But you must do this every time. This is too annoying.

The second way would be better. Using Homebrew to install GNU Arm Embedded Toolchain for us. See this page to do it. And no more can not execute problems.

After install this Toolchain by using Homwbrew. We need to know where these tools are installed.

% which arm-none-eabi-gcc
/usr/local/bin/arm-none-eabi-gcc

% sudo find / -name arm-none-eabi-gcc
Password:
/usr/local/bin/arm-none-eabi-gcc
/usr/local/var/homebrew/linked/arm-none-eabi-gcc
/usr/local/opt/arm-none-eabi-gcc
/usr/local/Cellar/arm-none-eabi-gcc
/usr/local/Cellar/arm-none-eabi-gcc/9-2019-q4-major/bin/arm-none-eabi-gcc
/usr/local/Cellar/arm-none-eabi-gcc/9-2019-q4-major/gcc/bin/arm-none-eabi-gcc

I think by default the PATH environment variable start by /usr/local/bin. So, Homebrew put alias of these tools to that folder. And GNU Arm Embedded Toolchain was copy to /usr/local/Cellar/arm-none-eabi-gcc/9-2019-q4-major/gcc.

You can see this is the newest version (by now, 2019-q4).

So, when you want to using armgcc to compile nRF5SDK example code (or your project base on nRF5SDK). Just modify components/toolchain/gcc/Makefile.posix like below:

GNU_INSTALL_ROOT ?= /usr/local/bin/
GNU_VERSION ?= 9.2.1
GNU_PREFIX ?= arm-none-eabi

Then you can go to nRF5SDK example's armgcc folder, run make to compile it.

And when you using VS Code to work with nRF5SDK. Your need to tell VS Code the include files path, using below information and look like the Fig. below.

"GNU_GCC": "/usr/local/Cellar/arm-none-eabi-gcc/9-2019-q4-major/gcc"
"${env:GNU_GCC}/arm-none-eabi/include/**",

留言

這個網誌中的熱門文章

D-BUS學習筆記

關於藍牙裝置找尋(inquiry, scan)兩三事

Cisco Switch學習筆記: EtherChannel