-
Notifications
You must be signed in to change notification settings - Fork 1
ST LINK tool
Many STM-boards include an on-board ST-LINK programmer. To program the board you just need to connect a micro-USB cable to the USB port that is centered on the top of the board. To write software into the mircrocontrollers flash memory we recommend to use OpenOCD. However, some time ago we used the ST-LINK tool for this. This is a quick guide about installing and using the ST-LINK tool.
- First of all you have to download the st-flash tool from texane's github repository:
# git clone https://github.com/texane/stlink.git stlink
- Change into the new directory:
# cd stlink
- Build the st-flash tool
# ./autogen
# ./configure
# make
For this step you have to have a working build-environment installed, for debian/ubuntu you can do this by installing the build-essential
package.
- Add the
st-flash
andst-util
tools to your bin-path
Now you have to connect the device to your computer via USB-microUSB to write your program on it. Use the CN1 connector on the STM32F4discovery board for this. Normally, the device should be flashed automatically by typing:
make flash
which should run the st-flash tool. However, this did not work at my setup so I flashed the board manually using the st-flash tool:
sudo st-flash write bin/stm32f4discovery/hello-world.hex 0x8000000
(For other boards you type the respective board name). The .hex file should be written to the devices program-storage with start address 0x8000000
After you have compiled a program, you can start the st-util tool from the projects repository with:
sudo st-util
This should automatically connect to your device and start a GDB-Server listening at port :4242
. In another terminal you start the GDB with:
arm-none-eabi-gdb -tui *your_project*/bin/stm32f4discovery/hello-wolrd.elf
The declaration of the .elf file is important because otherwise there wouldn't be meta-information like code line numbers. The option -tui (Text User Interface) runs a terminal interface which shows the source file, assembly output, program registers etc. and makes it more comfortable to debug. The last step to debug your program is to connect the GDB to the GDB-server (which runs in the other terminal and waits for connection). After the GDB started just type:
target extended-remote :4242
Congratulations! You should now be able to debug your program using the GDB-commands.
RIOT - The friendly Operating System for the Internet of Things
Homepage | [GitHub] (https://github.com/RIOT-OS/) | Developers Mailing List | Users Mailing List | Twitter @RIOT_OS
- Family: ARM
- Board: Airfy Beacon
- Board: Arduino Due
- Board: CC2538DK
- Board: CC2650STK
- Board: HikoB Fox
- Board: IoT LAB M3
- Board: LimiFrog-v1
- Board: mbed_lpc1768
- Board: MSB-IoT
- Board: MSBA2
- Board: Nucleo-L1
- Board: Nucleo-F334
- Board: Nucleo-F303
- Board: Nucleo-F091
- Board: Mulle
- Board: OpenMote
- Board: PCA1000x (nRF51822 Development Kit)
- Board: Phytec phyWAVE-KW22
- Board: RFduino
- Board: SAMR21-xpro
- Board: SAML21-xpro
- Board: Spark Core
- Board: STM32F0discovery
- Board: STM32F3discovery
- Board: STM32F4discovery
- Board: UDOO
- Board: yunjia-nrf51822
- Board: Zolertia remote
- Family: ATmega
- Board: Arduino Mega2560
- Family: MSP430
- Board: MSB-430H
- Board: TelosB
- Board: WSN430
- Board: Zolertia Z1
- Board: eZ430-Chronos
- Family: native
- Board: native
- Family: x86
- Board: Intel Galileo