- 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
https://github.com/gnu-mcu-eclipse/org.eclipse.epp.packages/releases20190101-2023-gnumcueclipse-4.5.1-2018-12-R-macosx.cocoa.x86_64.tar.gzunzip and move to the folderApplications
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 ""
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/releasesgnu-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.
- 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
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.
brew install stlink
st-info --version
# it prints:
v1.5.1
st-info --descr
# it prints
F7 device
- 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
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
Start gdb
arm-none-eabi-gdb
(gdb) target remote localhost:3333
- 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
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
# 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", 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.
- 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.
-
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"
-
Or use the following command
st-flash write ./build/*.bin 0x08000000
HAL_GPIO_TogglePin(LD1_GPIO_Port, LD1_Pin);
HAL_Delay(1000);
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
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 betty.usbmodelxxxx
, replacexxxx
in the following commandminicom -D /dev/tty.usbmodem1423
- it should print the message sent from the board
- Note that the metakey in
iterm2
isESC
. PressESC + Z
ot invoke the help window. ESC + Z
, then pressX
to exit minicom
To redirect printf
, do the following:
-
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
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! -
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
toLD_FLAGS
in theMakefile
.
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 the youtube video Getting Started with STM32Cube.AI.
Refer to https://github.com/araobp/stm32-mcu/tree/master/NUCLEO-F401RE/AI for an example of using x-cube-ai.
Refer to
@nalzok
I think I did not post it here to open the
app
from the commandline and do NOT know why you tried it this way.No idea how to solve your problem.
You can just Google your error message or open the
app
by double clicking it instead of from the cmd line.