Skip to content

Instantly share code, notes, and snippets.

@sashaegorov
Forked from csukuangfj/stm32-macos.md
Created August 13, 2023 20:20
Show Gist options
  • Select an option

  • Save sashaegorov/b6fc03664d8932c1bc4e40db78f63c66 to your computer and use it in GitHub Desktop.

Select an option

Save sashaegorov/b6fc03664d8932c1bc4e40db78f63c66 to your computer and use it in GitHub Desktop.

Revisions

  1. @csukuangfj csukuangfj revised this gist Jan 9, 2020. 1 changed file with 14 additions and 14 deletions.
    28 changes: 14 additions & 14 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -4,9 +4,9 @@

    - [1. Install JDK 8](#1-Install-JDK-8)
    - ~~[2. Install Eclipse](#2-install-eclipse)~~
    * ~~[Option 1: GNU MCU Eclipse IDE for C/C++ Developers](#option-1-gnu-mcu-eclipse-ide-for-cc-developers)
    * ~~[Option 1: GNU MCU Eclipse IDE for C/C++ Developers](#option-1-gnu-mcu-eclipse-ide-for-cc-developers)~~
    - [3. Cross Compile Toolchain (arm-none-eabi-*))](#3-cross-compile-toolchain-arm-none-eabi-)
    * ~~[Option 1: GNU MCU Eclipse ARM Embedded GCC](#option-1-gnu-mcu-eclipse-arm-embedded-gcc)
    * ~~[Option 1: GNU MCU Eclipse ARM Embedded GCC](#option-1-gnu-mcu-eclipse-arm-embedded-gcc)~~
    * [Option 2: GNU ARM Embedded Toolchain](#option-2-gnu-arm-embedded-toolchain)
    - [4. Install STLink](#4-install-stlink)
    - [5. OpenCD](#5-opencd)
    @@ -24,23 +24,23 @@
    - https://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-macosx-x64.dmg
    - double click to install

    ## ~~2. Install Eclipse
    ## ~~2. Install Eclipse~~

    ### ~~Option 1: GNU MCU Eclipse IDE for C/C++ Developers
    ### ~~Option 1: GNU MCU Eclipse IDE for C/C++ Developers~~

    - ~~https://github.com/gnu-mcu-eclipse/org.eclipse.epp.packages/releases
    - ~~20190101-2023-gnumcueclipse-4.5.1-2018-12-R-macosx.cocoa.x86_64.tar.gz
    - ~~unzip and move to the folder `Applications`
    - ~~start eclipse, menu, help, install new software, work with, select "cdt", check "CDT main features", next, finish, restart eclipse.
    - ~~start eclipse, menu, help, install new software, work with, select ""
    - ~~https://github.com/gnu-mcu-eclipse/org.eclipse.epp.packages/releases~~
    - ~~20190101-2023-gnumcueclipse-4.5.1-2018-12-R-macosx.cocoa.x86_64.tar.gz~~
    - ~~unzip and move to the folder `Applications`~~
    - ~~start eclipse, menu, help, install new software, work with, select "cdt", check "CDT main features", next, finish, restart eclipse.~~
    - ~~start eclipse, menu, help, install new software, work with, select ""~~

    ## 3. Cross Compile Toolchain (arm-none-eabi-*))

    ### ~~Option 1: GNU MCU Eclipse ARM Embedded GCC
    ### ~~Option 1: GNU MCU Eclipse ARM Embedded GCC~~

    - ~~refer to https://gnu-mcu-eclipse.github.io/toolchain/arm/install/
    - ~~Go to the GitHub release page, https://github.com/gnu-mcu-eclipse/arm-none-eabi-gcc/releases
    - ~~gnu-mcu-eclipse-arm-none-eabi-gcc-8.2.1-1.1-20190102-1122-macos.tgz
    - ~~refer to https://gnu-mcu-eclipse.github.io/toolchain/arm/install/~~
    - ~~Go to the GitHub release page, https://github.com/gnu-mcu-eclipse/arm-none-eabi-gcc/releases~~
    - ~~gnu-mcu-eclipse-arm-none-eabi-gcc-8.2.1-1.1-20190102-1122-macos.tgz~~

    ```
    mkdir $HOME/opt
    @@ -49,7 +49,7 @@ tar xvf gnu-mcu-eclipse-arm-none-eabi-gcc-8.2.1-1.1-20190102-1122-macos.tgz
    chmod -R -w $HOME/opt/gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.1-20190102-1122/
    ```

    ~~we have `$HOME/opt/gnu-mcu-eclipse`.
    ~~we have `$HOME/opt/gnu-mcu-eclipse`.~~

    ```
    cd $HOME/opt/gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.1-20190102-1122/bin/
  2. @csukuangfj csukuangfj revised this gist Jan 9, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    ## Table of Contents

    - [1. Install JDK 8](#1-Install-JDK-8)
    - ~~[2. Install Eclipse](#2-install-eclipse)
    - ~~[2. Install Eclipse](#2-install-eclipse)~~
    * ~~[Option 1: GNU MCU Eclipse IDE for C/C++ Developers](#option-1-gnu-mcu-eclipse-ide-for-cc-developers)
    - [3. Cross Compile Toolchain (arm-none-eabi-*))](#3-cross-compile-toolchain-arm-none-eabi-)
    * ~~[Option 1: GNU MCU Eclipse ARM Embedded GCC](#option-1-gnu-mcu-eclipse-arm-embedded-gcc)
  3. @csukuangfj csukuangfj revised this gist Jan 9, 2020. 1 changed file with 15 additions and 15 deletions.
    30 changes: 15 additions & 15 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -3,10 +3,10 @@
    ## Table of Contents

    - [1. Install JDK 8](#1-Install-JDK-8)
    - [2. Install Eclipse](#2-install-eclipse)
    * [Option 1: GNU MCU Eclipse IDE for C/C++ Developers](#option-1-gnu-mcu-eclipse-ide-for-cc-developers)
    - ~~[2. Install Eclipse](#2-install-eclipse)
    * ~~[Option 1: GNU MCU Eclipse IDE for C/C++ Developers](#option-1-gnu-mcu-eclipse-ide-for-cc-developers)
    - [3. Cross Compile Toolchain (arm-none-eabi-*))](#3-cross-compile-toolchain-arm-none-eabi-)
    * [Option 1: GNU MCU Eclipse ARM Embedded GCC](#option-1-gnu-mcu-eclipse-arm-embedded-gcc)
    * ~~[Option 1: GNU MCU Eclipse ARM Embedded GCC](#option-1-gnu-mcu-eclipse-arm-embedded-gcc)
    * [Option 2: GNU ARM Embedded Toolchain](#option-2-gnu-arm-embedded-toolchain)
    - [4. Install STLink](#4-install-stlink)
    - [5. OpenCD](#5-opencd)
    @@ -24,23 +24,23 @@
    - https://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-macosx-x64.dmg
    - double click to install

    ## 2. Install Eclipse
    ## ~~2. Install Eclipse

    ### Option 1: GNU MCU Eclipse IDE for C/C++ Developers
    ### ~~Option 1: GNU MCU Eclipse IDE for C/C++ Developers

    - https://github.com/gnu-mcu-eclipse/org.eclipse.epp.packages/releases
    - 20190101-2023-gnumcueclipse-4.5.1-2018-12-R-macosx.cocoa.x86_64.tar.gz
    - unzip and move to the folder `Applications`
    - start eclipse, menu, help, install new software, work with, select "cdt", check "CDT main features", next, finish, restart eclipse.
    - start eclipse, menu, help, install new software, work with, select ""
    - ~~https://github.com/gnu-mcu-eclipse/org.eclipse.epp.packages/releases
    - ~~20190101-2023-gnumcueclipse-4.5.1-2018-12-R-macosx.cocoa.x86_64.tar.gz
    - ~~unzip and move to the folder `Applications`
    - ~~start eclipse, menu, help, install new software, work with, select "cdt", check "CDT main features", next, finish, restart eclipse.
    - ~~start eclipse, menu, help, install new software, work with, select ""

    ## 3. Cross Compile Toolchain (arm-none-eabi-*))

    ### Option 1: GNU MCU Eclipse ARM Embedded GCC
    ### ~~Option 1: GNU MCU Eclipse ARM Embedded GCC

    - refer to https://gnu-mcu-eclipse.github.io/toolchain/arm/install/
    - Go to the GitHub release page, https://github.com/gnu-mcu-eclipse/arm-none-eabi-gcc/releases
    - gnu-mcu-eclipse-arm-none-eabi-gcc-8.2.1-1.1-20190102-1122-macos.tgz
    - ~~refer to https://gnu-mcu-eclipse.github.io/toolchain/arm/install/
    - ~~Go to the GitHub release page, https://github.com/gnu-mcu-eclipse/arm-none-eabi-gcc/releases
    - ~~gnu-mcu-eclipse-arm-none-eabi-gcc-8.2.1-1.1-20190102-1122-macos.tgz

    ```
    mkdir $HOME/opt
    @@ -49,7 +49,7 @@ tar xvf gnu-mcu-eclipse-arm-none-eabi-gcc-8.2.1-1.1-20190102-1122-macos.tgz
    chmod -R -w $HOME/opt/gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.1-20190102-1122/
    ```

    we have `$HOME/opt/gnu-mcu-eclipse`.
    ~~we have `$HOME/opt/gnu-mcu-eclipse`.

    ```
    cd $HOME/opt/gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.1-20190102-1122/bin/
  4. @csukuangfj csukuangfj revised this gist Apr 23, 2019. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -163,6 +163,12 @@ at file "embedded:startup.tcl", line 60
    at file "board/st_nucleo_f7.cfg", line 8
    at file "target/stm32f7x.cfg", line 155
    ```
    Start gdb

    ```
    arm-none-eabi-gdb
    (gdb) target remote localhost:3333
    ```

    ## 6. Install STM32CubeMX

  5. @csukuangfj csukuangfj revised this gist Jan 9, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -311,6 +311,8 @@ int __io_putchar(int ch) {
    - Note that `syscalls.c` can be downloaded from <https://github.com/xtrinch/stm32f7-demos/blob/master/07-rfid-rc522/syscalls.c>
    - To support printing float, i.e., `printf("%f", 1.25)`, append `-u _printf_float` to `LD_FLAGS` in the `Makefile`.
    ## X-CUBE-AI
    Go to <https://my.st.com/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-ai.license=1546650638389.product=X-CUBE-AI.version=3.3.0.html>
  6. @csukuangfj csukuangfj revised this gist Jan 9, 2019. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -328,6 +328,10 @@ select "STMicroelectronics.X-CUBE-AI.3.3.0.pack".
    Refer to the youtube video [Getting Started with STM32Cube.AI](https://www.youtube.com/watch?v=grgNXdkmzzQ&feature=youtu.be&t=316).
    Refer to <https://github.com/araobp/stm32-mcu/tree/master/NUCLEO-F401RE/AI> for an example of using x-cube-ai.
    # References
    Refer to
    - https://github.com/glegrain/STM32-with-macOS
  7. @csukuangfj csukuangfj revised this gist Jan 9, 2019. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -295,7 +295,7 @@ After uploading the binary to the board. On macOS, do the following:

    To redirect `printf`, do the following:

    - Copy `syscall.c` from `$HOME/STM32Cube/Repository/STM32Cube_FW_F7_V1.14.0/Projects/STM32F769I_EVAL/Examples/UART/UART_Printf/SW4STM32`
    - Copy `syscalls.c` from `$HOME/STM32Cube/Repository/STM32Cube_FW_F7_V1.14.0/Projects/STM32F769I_EVAL/Examples/UART/UART_Printf/SW4STM32`
    to the project

    - add the following function to `main.c`
    @@ -309,6 +309,8 @@ int __io_putchar(int ch) {
    - then compile the project. `printf` should be redirected to the console!
    - Note that `syscalls.c` can be downloaded from <https://github.com/xtrinch/stm32f7-demos/blob/master/07-rfid-rc522/syscalls.c>
    ## X-CUBE-AI
    Go to <https://my.st.com/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-ai.license=1546650638389.product=X-CUBE-AI.version=3.3.0.html>
  8. @csukuangfj csukuangfj revised this gist Jan 9, 2019. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -293,6 +293,22 @@ After uploading the binary to the board. On macOS, do the following:
    - `ESC + Z`, then press `X` to exit minicom


    To redirect `printf`, do the following:

    - Copy `syscall.c` from `$HOME/STM32Cube/Repository/STM32Cube_FW_F7_V1.14.0/Projects/STM32F769I_EVAL/Examples/UART/UART_Printf/SW4STM32`
    to the project

    - add the following function to `main.c`

    ```cpp
    int __io_putchar(int ch) {
    HAL_UART_Transmit(&huart3, (uint8_t *)&ch, 1, 0xFFFF);
    return ch;
    }
    ```
    - then compile the project. `printf` should be redirected to the console!
    ## X-CUBE-AI
    Go to <https://my.st.com/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-ai.license=1546650638389.product=X-CUBE-AI.version=3.3.0.html>
  9. @csukuangfj csukuangfj revised this gist Jan 8, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,7 @@
    - [7. STM32CubeProgrammer](#7-stm32cubeprogrammer)
    - [8. Hello World](#8-hello-world)
    * [LED](#led)
    * [USART](#usart)

    - [X-CUBE-AI](#x-cube-ai)

    @@ -257,6 +258,7 @@ HAL_Delay(1000);
    ```
    ### USART
    In cubemx,
    - Clock Configuration, HCLK (MHz) --> 216 MHz (for STM32F746 Nucleon-144 board)
    - Pinout & Configuration
  10. @csukuangfj csukuangfj revised this gist Jan 8, 2019. 1 changed file with 43 additions and 0 deletions.
    43 changes: 43 additions & 0 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -13,6 +13,7 @@
    - [6. Install STM32CubeMX](#6-install-stm32cubemx)
    - [7. STM32CubeProgrammer](#7-stm32cubeprogrammer)
    - [8. Hello World](#8-hello-world)
    * [LED](#led)

    - [X-CUBE-AI](#x-cube-ai)

    @@ -248,6 +249,48 @@ cd ~/opt/gnu-mcu-eclipse/openocd/0.10.0-10-20181020-0522/scripts/
    st-flash write ./build/*.bin 0x08000000
    ```

    ### LED

    ```cpp
    HAL_GPIO_TogglePin(LD1_GPIO_Port, LD1_Pin);
    HAL_Delay(1000);
    ```
    ### USART
    In cubemx,
    - Clock Configuration, HCLK (MHz) --> 216 MHz (for STM32F746 Nucleon-144 board)
    - Pinout & Configuration
    * Computing: CRC, activated
    * Right panel "Pinout view": PD9 (select `USART3_RX`), PD8(USART3_TX)
    * Connectivity: select USART3, mode (select Asynchronous). Leave others to their defaults, i.e., baudrate is 115200, 8bits, no parity check.
    - Generate Code
    In the code
    ```cpp
    char buf[100];
    int i = 0;
    while (1) {
    /* USER CODE END WHILE */
    HAL_GPIO_TogglePin(LD1_GPIO_Port, LD1_Pin);
    i++;
    snprintf(buf, sizeof(buf), "hello %d\r\n", i);
    HAL_UART_Transmit(&huart3, buf, strlen(buf), 5000);
    HAL_Delay(1000);
    }
    ```

    After uploading the binary to the board. On macOS, do the following:

    - `brew install minicom`
    - `ls /dev/tty.usbmodem1423`, it may be `tty.usbmodelxxxx`, replace `xxxx` in the following command
    - `minicom -D /dev/tty.usbmodem1423`
    - it should print the message sent from the board
    - Note that the metakey in `iterm2` is `ESC`. Press `ESC + Z` ot invoke the help window.
    - `ESC + Z`, then press `X` to exit minicom


    ## X-CUBE-AI

    Go to <https://my.st.com/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-ai.license=1546650638389.product=X-CUBE-AI.version=3.3.0.html>
  11. @csukuangfj csukuangfj revised this gist Jan 8, 2019. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -242,6 +242,12 @@ cd ~/opt/gnu-mcu-eclipse/openocd/0.10.0-10-20181020-0522/scripts/
    * Check "Run after programming"
    * Click the button "Start Programming"

    - Or use the following command

    ```
    st-flash write ./build/*.bin 0x08000000
    ```

    ## X-CUBE-AI

    Go to <https://my.st.com/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-ai.license=1546650638389.product=X-CUBE-AI.version=3.3.0.html>
  12. @csukuangfj csukuangfj revised this gist Jan 7, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -257,6 +257,8 @@ unzip en.x-cube-ai.zip
    Then open STM32CubeMx, menu, help, manage embedded software packages, from local...,
    select "STMicroelectronics.X-CUBE-AI.3.3.0.pack".

    Refer to the youtube video [Getting Started with STM32Cube.AI](https://www.youtube.com/watch?v=grgNXdkmzzQ&feature=youtu.be&t=316).


    Refer to
    - https://github.com/glegrain/STM32-with-macOS
  13. @csukuangfj csukuangfj revised this gist Jan 7, 2019. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,8 @@
    - [7. STM32CubeProgrammer](#7-stm32cubeprogrammer)
    - [8. Hello World](#8-hello-world)

    - [X-CUBE-AI](#x-cube-ai)

    ## 1. Install JDK 8

    - Java SE Development Kit 8u191
    @@ -240,6 +242,20 @@ cd ~/opt/gnu-mcu-eclipse/openocd/0.10.0-10-20181020-0522/scripts/
    * Check "Run after programming"
    * Click the button "Start Programming"

    ## X-CUBE-AI

    Go to <https://my.st.com/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-ai.license=1546650638389.product=X-CUBE-AI.version=3.3.0.html>
    to download the software.

    ```
    mkdir x-cube-ai
    cd x-cube-ai
    mv ../en.x-cube-ai.zip .
    unzip en.x-cube-ai.zip
    ```

    Then open STM32CubeMx, menu, help, manage embedded software packages, from local...,
    select "STMicroelectronics.X-CUBE-AI.3.3.0.pack".


    Refer to
  14. @csukuangfj csukuangfj revised this gist Jan 7, 2019. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -229,8 +229,18 @@ cp build/hello_f746_fangjun.bin ~/opt/gnu-mcu-eclipse/openocd/0.10.0-10-20181020
    cd ~/opt/gnu-mcu-eclipse/openocd/0.10.0-10-20181020-0522/scripts/
    ../bin/openocd -f board/st_nucleo_f7.cfg -c "program a.bin exit 0x08000000"
    ```

    - Press the black reset button.

    - Or use `CubeProgrammer` to upload the binary:
    * Open STM32CubeProgrammer
    * Click Connect
    * Select "Erase & Programming"
    * For the file path, select "/path/to/xxxx.bin"
    * For the start address, use the default value "0x08000000"
    * Check "Run after programming"
    * Click the button "Start Programming"



    Refer to
    - https://github.com/glegrain/STM32-with-macOS
  15. @csukuangfj csukuangfj revised this gist Jan 7, 2019. 1 changed file with 15 additions and 1 deletion.
    16 changes: 15 additions & 1 deletion stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,7 @@
    - [5. OpenCD](#5-opencd)
    - [6. Install STM32CubeMX](#6-install-stm32cubemx)
    - [7. STM32CubeProgrammer](#7-stm32cubeprogrammer)
    - [8. Hello World](#8-hello-world)

    ## 1. Install JDK 8

    @@ -217,6 +218,19 @@ Open "STM32CubeProgrammer", it should display no error messages.
    Inside `/Applications/STMicroelectronics/STM32Cube/STM32CubeProgrammer/STM32CubeProgrammer.app/Contents/MacOs/bin`, we can find
    `STM32_Programmer_CLI`, which is the commandline tool.


    ## 8. Hello World

    - Generate a Makefile project from CubeMx. Select the specified board.

    ```
    make GCC_PATH=$HOME/opt/gcc-arm-none-eabi-8-2018-q4-major/bin
    cp build/hello_f746_fangjun.bin ~/opt/gnu-mcu-eclipse/openocd/0.10.0-10-20181020-0522/scripts/a.bin
    cd ~/opt/gnu-mcu-eclipse/openocd/0.10.0-10-20181020-0522/scripts/
    ../bin/openocd -f board/st_nucleo_f7.cfg -c "program a.bin exit 0x08000000"
    ```

    - Press the black reset button.

    Refer to
    - https://github.com/glegrain/STM32-with-macOS
    - https://www.carminenoviello.com/2016/01/22/getting-started-stm32-nucleo-f746zg/
  16. @csukuangfj csukuangfj revised this gist Jan 4, 2019. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -217,4 +217,6 @@ Open "STM32CubeProgrammer", it should display no error messages.
    Inside `/Applications/STMicroelectronics/STM32Cube/STM32CubeProgrammer/STM32CubeProgrammer.app/Contents/MacOs/bin`, we can find
    `STM32_Programmer_CLI`, which is the commandline tool.

    Refer to https://github.com/glegrain/STM32-with-macOS
    Refer to
    - https://github.com/glegrain/STM32-with-macOS
    - https://www.carminenoviello.com/2016/01/22/getting-started-stm32-nucleo-f746zg/
  17. @csukuangfj csukuangfj revised this gist Jan 4, 2019. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    ## Table of Contents

    - [1. Install JDK 8](#1-Install-JDK-8)
    - [2. Install Eclipse](#2-Install Eclipse)
    - [2. Install Eclipse](#2-install-eclipse)
    * [Option 1: GNU MCU Eclipse IDE for C/C++ Developers](#option-1-gnu-mcu-eclipse-ide-for-cc-developers)
    - [3. Cross Compile Toolchain (arm-none-eabi-*))](#3-cross-compile-toolchain-arm-none-eabi-)
    * [Option 1: GNU MCU Eclipse ARM Embedded GCC](#option-1-gnu-mcu-eclipse-arm-embedded-gcc)
    @@ -88,6 +88,11 @@ st-info --version
    # it prints:
    v1.5.1
    st-info --descr
    # it prints
    F7 device
    ```

    ## 5. OpenCD
  18. @csukuangfj csukuangfj revised this gist Jan 4, 2019. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,13 @@
    - [1. Install JDK 8](#1-Install-JDK-8)
    - [2. Install Eclipse](#2-Install Eclipse)
    * [Option 1: GNU MCU Eclipse IDE for C/C++ Developers](#option-1-gnu-mcu-eclipse-ide-for-cc-developers)
    - [3. Cross Compile Toolchain (arm-none-eabi-*))](#3-cross-compile-toolchain-arm-none-eabi-)
    * [Option 1: GNU MCU Eclipse ARM Embedded GCC](#option-1-gnu-mcu-eclipse-arm-embedded-gcc)
    * [Option 2: GNU ARM Embedded Toolchain](#option-2-gnu-arm-embedded-toolchain)
    - [4. Install STLink](#4-install-stlink)
    - [5. OpenCD](#5-opencd)
    - [6. Install STM32CubeMX](#6-install-stm32cubemx)
    - [7. STM32CubeProgrammer](#7-stm32cubeprogrammer)

    ## 1. Install JDK 8

  19. @csukuangfj csukuangfj revised this gist Jan 4, 2019. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@

    ## Table of Contents

    - [1. Install JDK 8](1-Install-JDK-8)
    - [2. Install Eclipse](2-Install Eclipse)
    * [Option 1: GNU MCU Eclipse IDE for C/C++ Developers](Option 1: GNU MCU Eclipse IDE for C/C++ Developers)
    - [1. Install JDK 8](#1-Install-JDK-8)
    - [2. Install Eclipse](#2-Install Eclipse)
    * [Option 1: GNU MCU Eclipse IDE for C/C++ Developers](#option-1-gnu-mcu-eclipse-ide-for-cc-developers)

    ## 1. Install JDK 8

  20. @csukuangfj csukuangfj revised this gist Jan 4, 2019. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,9 @@

    ## Table of Contents

    - [1. Install JDK 8](1.-Install-JDK-8)
    - [1. Install JDK 8](1-Install-JDK-8)
    - [2. Install Eclipse](2-Install Eclipse)
    * [Option 1: GNU MCU Eclipse IDE for C/C++ Developers](Option 1: GNU MCU Eclipse IDE for C/C++ Developers)

    ## 1. Install JDK 8

  21. @csukuangfj csukuangfj revised this gist Jan 4, 2019. 1 changed file with 10 additions and 1 deletion.
    11 changes: 10 additions & 1 deletion stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,9 @@
    # STM32 MacOS X Environment Setup

    ## Table of Contents

    - [1. Install JDK 8](1.-Install-JDK-8)

    ## 1. Install JDK 8

    - Java SE Development Kit 8u191
    @@ -194,4 +198,9 @@ java -jar STLinkUpgrade.jar
    # after a few seconds, it displays: "Upgrade successful".
    # close the window.
    ```
    Open "STM32CubeProgrammer"
    Open "STM32CubeProgrammer", it should display no error messages.

    Inside `/Applications/STMicroelectronics/STM32Cube/STM32CubeProgrammer/STM32CubeProgrammer.app/Contents/MacOs/bin`, we can find
    `STM32_Programmer_CLI`, which is the commandline tool.

    Refer to https://github.com/glegrain/STM32-with-macOS
  22. @csukuangfj csukuangfj revised this gist Jan 4, 2019. 1 changed file with 19 additions and 1 deletion.
    20 changes: 19 additions & 1 deletion stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -176,4 +176,22 @@ java -jar SetupSTM32CubeProgrammer-1.4.0.exe
    # Use the default installation path: /Applications/STMicroelectronics/STM32Cube/STM32CubeProgrammer
    # install only the components that are selected by default, i.e., do not install STM32TrustedPackageCreator
    ```
    # The installed application is available with the name "STM32CubeProgrammer"
    ```
    When it starts, an popup windows says:
    > Error: Old ST-LINK firmware version. Upgrade ST-LINK firmware.
    - Go to https://www.st.com/en/development-tools/stsw-link007.html
    - Download `en.stsw-link007.zip`

    ```
    unzip en.stsw-link007.zip
    cd stsw-link007
    cd AllPlatforms
    java -jar STLinkUpgrade.jar
    # then, click the button "Open in update mode", then click "upgrade"
    # after a few seconds, it displays: "Upgrade successful".
    # close the window.
    ```
    Open "STM32CubeProgrammer"
  23. @csukuangfj csukuangfj revised this gist Jan 4, 2019. 1 changed file with 16 additions and 1 deletion.
    17 changes: 16 additions & 1 deletion stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -161,4 +161,19 @@ java -jar SetupSTM32CubeMX-5.0.1.exe
    # The installed application is available with the name "STM32CubeMX"
    ```

    Its user manual is at <https://my.st.com/content/ccc/resource/technical/document/user_manual/10/c5/1a/43/3a/70/43/7d/DM00104712.pdf/files/DM00104712.pdf/jcr:content/translations/en.DM00104712.pdf>
    Its user manual is at <https://my.st.com/content/ccc/resource/technical/document/user_manual/10/c5/1a/43/3a/70/43/7d/DM00104712.pdf/files/DM00104712.pdf/jcr:content/translations/en.DM00104712.pdf>

    ## 7. STM32CubeProgrammer

    - https://my.st.com/content/my_st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/stm32cubeprog.license=1546605325757.product=STM32CubeProg.version=1.4.0.html

    ```
    mkdir stm32cubeprogrammer
    mv en.stm32cubepro.zip stm32cubeprogrammer
    cd stm32cubeprogrammer
    unzip en.stm32cubepro.zip
    java -jar SetupSTM32CubeProgrammer-1.4.0.exe
    # Use the default installation path: /Applications/STMicroelectronics/STM32Cube/STM32CubeProgrammer
    # install only the components that are selected by default, i.e., do not install STM32TrustedPackageCreator
    ```
  24. @csukuangfj csukuangfj revised this gist Jan 4, 2019. 1 changed file with 27 additions and 0 deletions.
    27 changes: 27 additions & 0 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -70,6 +70,11 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    ```
    brew install stlink
    st-info --version
    # it prints:
    v1.5.1
    ```

    ## 5. OpenCD
    @@ -135,3 +140,25 @@ at file "embedded:startup.tcl", line 60
    at file "board/st_nucleo_f7.cfg", line 8
    at file "target/stm32f7x.cfg", line 155
    ```

    ## 6. Install STM32CubeMX

    - https://www.st.com/en/development-tools/stm32cubemx.html
    - click "Get Software" to download it

    ```
    mkdir stm32cubemx
    mv en.stm32cubemx.zip stm32cubemx
    cd stm32cubemx
    unzip en.stm32cubemx.zip
    java -jar SetupSTM32CubeMX-5.0.1.exe
    # use the default path: /Applications/STMicroelectronics/STM32CubeMX
    # the uninstaller program is in /Applications/STMicroelectronics/STM32CubeMX.app/Contents/Resources/Uninstaller
    # The installed application is available with the name "STM32CubeMX"
    ```

    Its user manual is at <https://my.st.com/content/ccc/resource/technical/document/user_manual/10/c5/1a/43/3a/70/43/7d/DM00104712.pdf/files/DM00104712.pdf/jcr:content/translations/en.DM00104712.pdf>
  25. @csukuangfj csukuangfj revised this gist Jan 4, 2019. 1 changed file with 60 additions and 2 deletions.
    62 changes: 60 additions & 2 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -66,7 +66,13 @@ This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    ```

    ## 4. OpenCD
    ## 4. Install STLink

    ```
    brew install stlink
    ```

    ## 5. OpenCD
    - GNU MCU Eclipse OpenOCD
    - https://github.com/gnu-mcu-eclipse/openocd/releases
    - gnu-mcu-eclipse-openocd-0.10.0-10-20181020-0522-macos.tgz
    @@ -76,4 +82,56 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    cd $HOME/opt
    tar xvf gnu-mcu-eclipse-openocd-0.10.0-10-20181020-0522-macos.tgz
    # its content is in $HOME/opt/gnu-mcu-eclipse/openocd
    ```
    ```

    To test OpenCD

    ```
    cd $HOME/opt/gnu-mcu-eclipse/openocd/0.10.0-10-20181020-0522/scripts/target
    mv stm32f7x.cfg stm32f7x.cfg-fangjun-bak
    wget https://repo.or.cz/openocd.git/blob_plain/HEAD:/tcl/target/stm32f7x.cfg
    cd ..
    ../bin/openocd -f board/st_nucleo_f7.cfg
    ```

    It should output
    ```
    GNU MCU Eclipse 64-bit Open On-Chip Debugger 0.10.0+dev-00352-gaa6c7e9b (2018-10-20-08:28)
    Licensed under GNU GPL v2
    For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
    Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
    adapter speed: 2000 kHz
    adapter_nsrst_delay: 100
    srst_only separate srst_nogate srst_open_drain connect_deassert_srst
    srst_only separate srst_nogate srst_open_drain connect_deassert_srst
    Info : Listening on port 6666 for tcl connections
    Info : Listening on port 4444 for telnet connections
    Info : Unable to match requested speed 2000 kHz, using 1800 kHz
    Info : Unable to match requested speed 2000 kHz, using 1800 kHz
    Info : clock speed 1800 kHz
    Info : STLINK v2 JTAG v25 API v2 SWIM v14 VID 0x0483 PID 0x374B
    Info : using stlink api v2
    Info : Target voltage: 3.240235
    Warn : Silicon bug: single stepping will enter pending exception handler!
    Info : stm32f7x.cpu: hardware has 8 breakpoints, 4 watchpoints
    Info : Listening on port 3333 for gdb connections
    ```

    We get an updated `stm32f7x.dap` to avoid the following error

    ```
    GNU MCU Eclipse 64-bit Open On-Chip Debugger 0.10.0+dev-00352-gaa6c7e9b (2018-10-20-08:28)
    Licensed under GNU GPL v2
    For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
    Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
    adapter speed: 2000 kHz
    adapter_nsrst_delay: 100
    srst_only separate srst_nogate srst_open_drain connect_deassert_srst
    target/stm32f7x.cfg:155: Error: invalid command name "stm32f7x.dap"
    in procedure 'script'
    at file "embedded:startup.tcl", line 60
    at file "board/st_nucleo_f7.cfg", line 8
    at file "target/stm32f7x.cfg", line 155
    ```
  26. @csukuangfj csukuangfj revised this gist Jan 4, 2019. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -64,4 +64,16 @@ arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 8-2018-q4-major) 8.2.1
    Copyright (C) 2018 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    ```

    ## 4. OpenCD
    - GNU MCU Eclipse OpenOCD
    - https://github.com/gnu-mcu-eclipse/openocd/releases
    - gnu-mcu-eclipse-openocd-0.10.0-10-20181020-0522-macos.tgz
    - unzip to `$HOME/opt`

    ```
    cd $HOME/opt
    tar xvf gnu-mcu-eclipse-openocd-0.10.0-10-20181020-0522-macos.tgz
    # its content is in $HOME/opt/gnu-mcu-eclipse/openocd
    ```
  27. @csukuangfj csukuangfj revised this gist Jan 4, 2019. 1 changed file with 17 additions and 9 deletions.
    26 changes: 17 additions & 9 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -13,15 +13,8 @@
    - https://github.com/gnu-mcu-eclipse/org.eclipse.epp.packages/releases
    - 20190101-2023-gnumcueclipse-4.5.1-2018-12-R-macosx.cocoa.x86_64.tar.gz
    - unzip and move to the folder `Applications`


    ### Option 2: Official Eclipse

    - https://www.eclipse.org/downloads/packages/release
    - https://www.eclipse.org/downloads/packages/release/oxygen/3a
    - https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/oxygen/3a/eclipse-cpp-oxygen-3a-macosx-cocoa-x86_64.dmg
    - select a mirror for faster download
    - double click and move to the folder `Applications`
    - start eclipse, menu, help, install new software, work with, select "cdt", check "CDT main features", next, finish, restart eclipse.
    - start eclipse, menu, help, install new software, work with, select ""

    ## 3. Cross Compile Toolchain (arm-none-eabi-*))

    @@ -57,3 +50,18 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    - click downloads
    - gcc-arm-none-eabi-8-2018-q4-major-mac.tar.bz2
    - https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2018q4/gcc-arm-none-eabi-8-2018-q4-major-mac.tar.bz2?revision=1041bf49-06d4-4174-866f-0e5259fa9d8d?product=GNU%20Arm%20Embedded%20Toolchain,64-bit,,Mac%20OS%20X,8-2018-q4-major

    ```
    mkdir -p $HOME/opt
    cd $HOME/opt
    tar xvf gcc-arm-none-eabi-8-2018-q4-major-mac.tar.bz2
    chmod -R -w ./gcc-arm-none-eabi-8-2018-q4-major
    cd gcc-arm-none-eabi-8-2018-q4-major/bin/
    ./arm-none-eabi-gcc --version
    # output:
    arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 8-2018-q4-major) 8.2.1 20181213 (release) [gcc-8-branch revision 267074]
    Copyright (C) 2018 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    ```
  28. @csukuangfj csukuangfj revised this gist Jan 4, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,7 @@

    - https://github.com/gnu-mcu-eclipse/org.eclipse.epp.packages/releases
    - 20190101-2023-gnumcueclipse-4.5.1-2018-12-R-macosx.cocoa.x86_64.tar.gz
    - unzip and move to the folder `Applications`


    ### Option 2: Official Eclipse
  29. @csukuangfj csukuangfj revised this gist Jan 4, 2019. 1 changed file with 35 additions and 1 deletion.
    36 changes: 35 additions & 1 deletion stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,14 @@

    ## 2. Install Eclipse

    ### Option 1: GNU MCU Eclipse IDE for C/C++ Developers

    - https://github.com/gnu-mcu-eclipse/org.eclipse.epp.packages/releases
    - 20190101-2023-gnumcueclipse-4.5.1-2018-12-R-macosx.cocoa.x86_64.tar.gz


    ### Option 2: Official Eclipse

    - https://www.eclipse.org/downloads/packages/release
    - https://www.eclipse.org/downloads/packages/release/oxygen/3a
    - https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/oxygen/3a/eclipse-cpp-oxygen-3a-macosx-cocoa-x86_64.dmg
    @@ -16,7 +24,33 @@

    ## 3. Cross Compile Toolchain (arm-none-eabi-*))

    ### Option 1: GNU ARM Embedded Toolchain
    ### Option 1: GNU MCU Eclipse ARM Embedded GCC

    - refer to https://gnu-mcu-eclipse.github.io/toolchain/arm/install/
    - Go to the GitHub release page, https://github.com/gnu-mcu-eclipse/arm-none-eabi-gcc/releases
    - gnu-mcu-eclipse-arm-none-eabi-gcc-8.2.1-1.1-20190102-1122-macos.tgz

    ```
    mkdir $HOME/opt
    cd $HOME/opt
    tar xvf gnu-mcu-eclipse-arm-none-eabi-gcc-8.2.1-1.1-20190102-1122-macos.tgz
    chmod -R -w $HOME/opt/gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.1-20190102-1122/
    ```

    we have `$HOME/opt/gnu-mcu-eclipse`.

    ```
    cd $HOME/opt/gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.1-20190102-1122/bin/
    ./arm-none-eabi-gcc --version
    # output:
    arm-none-eabi-gcc (GNU MCU Eclipse ARM Embedded GCC, 64-bit) 8.2.1 20181213 (release) [gcc-8-branch revision 267074]
    Copyright (C) 2018 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    ```

    ### Option 2: GNU ARM Embedded Toolchain

    - https://developer.arm.com/open-source/gnu-toolchain/gnu-rm
    - click downloads
  30. @csukuangfj csukuangfj revised this gist Jan 4, 2019. 1 changed file with 18 additions and 1 deletion.
    19 changes: 18 additions & 1 deletion stm32-macos.md
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,21 @@

    - Java SE Development Kit 8u191
    - https://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-macosx-x64.dmg
    - double click to install
    - double click to install

    ## 2. Install Eclipse

    - https://www.eclipse.org/downloads/packages/release
    - https://www.eclipse.org/downloads/packages/release/oxygen/3a
    - https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/oxygen/3a/eclipse-cpp-oxygen-3a-macosx-cocoa-x86_64.dmg
    - select a mirror for faster download
    - double click and move to the folder `Applications`

    ## 3. Cross Compile Toolchain (arm-none-eabi-*))

    ### Option 1: GNU ARM Embedded Toolchain

    - https://developer.arm.com/open-source/gnu-toolchain/gnu-rm
    - click downloads
    - gcc-arm-none-eabi-8-2018-q4-major-mac.tar.bz2
    - https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2018q4/gcc-arm-none-eabi-8-2018-q4-major-mac.tar.bz2?revision=1041bf49-06d4-4174-866f-0e5259fa9d8d?product=GNU%20Arm%20Embedded%20Toolchain,64-bit,,Mac%20OS%20X,8-2018-q4-major