STM32LAB
Zur Startseite des STM32LAB geht es hier:
http://stm32lab.hs-augsburg.de
1 Neuigkeiten
Es gibt zwei Git Repositories für Beispielprogramme:
https://github.com/hsa-embedded/stm32lab
Im Herbst 2014 arbeitet Andreas Schumann an Software-Beispielen, die er in dieses Repository füllt. Siehe auch http://andreas-schumann.eu/stm32lab/.
git://hhoegl.informatik.fh-augsburg.de/srv/git/stm32-at-hsa.git
Dieses Repo ist schon etwas älter und enthält meine ursprüngliche Sammlung von Programmbeispielen.
- STM32 Forum https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/AllItems.aspx
Eclipse zur Entwicklung für den STM32
http://hhoegl.informatik.fh-augsburg.de/pub/stm32lab/Hauffe-Fischer-Eclipse/bericht.html
Demos der Standard Peripherie-Lib unter Linux
http://hhoegl.informatik.fh-augsburg.de/pub/stm32lab/stdperiph-demos-hh
2 Fremde Programmbeispiele und Tutorials
Übersicht zur Familie der STM32 Controller auf mikrocontroller.net
Tutorial auf keytosmart.com
- http://www.keytosmart.com/programming-stm32-usart-gcc-tools-part-1
- http://www.keytosmart.com/programming-stm32-usart-gcc-tools-part-2/
- http://www.keytosmart.com/stm32-interrupts-programming-gcc/
- ...
Dieses Tutorial ist auch auf embedds.com gespiegelt:
- http://www.embedds.com/arm-cortex-tutorials/
- http://www.embedds.com/do-we-need-arm/
- http://www.embedds.com/programming-stm32f10x-io-port-pins/
- http://www.embedds.com/programming-stm32-usart-using-gcc-tools-part-1/
- http://www.embedds.com/programming-stm32-usart-using-gcc-tools-part-2/
- http://www.embedds.com/using-direct-memory-access-dma-in-stm23-projects/
- http://www.embedds.com/introducing-to-stm32-adc-programming-part1/
- http://www.embedds.com/introducing-to-stm32-adc-programming-part2/
- http://www.embedds.com/stm32-nucleo-boards-enable-faster-prototyping/
- http://www.embedds.com/stm32-interrupts-and-programming-with-gcc/
- http://www.embedds.com/st32mvldiscovery-project-template-for-gcc/
- http://www.embedds.com/setting-arm-gcc-development-environment/
- http://www.embedds.com/programming-stm32-discovery-using-gnu-tools-startup-code/
- http://www.embedds.com/programming-stm32-discovery-using-gnu-tools-linker-script/
- http://www.embedds.com/st32mvldiscovery-project-template-for-gcc/ (STM32DiscoveryTemplate.zip)
Things to remember when developing a program for STM32 using STM32-Library
Using STM32 discovery kits with open source tools (stlink, summon-arm-toolchain, Chibios, 10 Seiten, aus der STLINK Dokumentation).
https://raw.github.com/texane/stlink/master/doc/tutorial/tutorial.pdf
STM32 Tutorial von Diller Technologies (CooCox, CoIDE)
Flashing the STM32VL with stlink
Tutorials von Hussam Al-Hertani
STM32F0Discovery Under Linux Tutorial Part 1 – Setting up the GCC ARM Toolchain, OpenOCD and stlink
http://hertaville.com/2013/09/02/stm32f0discovery-part-1-linux/
STM32F0Discovery Under Linux Tutorial Part 2 – Using a Minimalist Integrated Development Environment From the Command Line (mit Beispiel iotogglem0), Sept 2013
http://hertaville.com/2013/09/03/stm32f0discovery-command-line-ide
Tutorial für Windows
Discovering the STM32 Microcontroller von Geoffrey Brown (verwendet stlink)
Linux Demo für STM32 von Stefano Oliveri
http://developers.stf12.net/linux-demo
Neue Version (Open Development Idea): STM32F107, FreeRTOS, StdPeriphLib, Eclipse.
http://www.stf12.org/developers/ODeV.html
http://www.stf12.org/developers/Download.html
Multitasking meets C++ in the embedded world http://www.stf12.org/developers/FreeRTOS_EC.html
Alle Projekte von Stefano http://www.stf12.org/developers/Projects.html
STM32F0-discovery default demo using FreeRTOSv7.5.2, codesourcery arm-gcc, and Eclipse.
Eclipse Helios und Codesourcery Compiler auf Windows 7 für STM32 einrichten
"Setting up Eclipse and Code Sourcery lite for STM32 Discovery Development"
Mike Szczys, How to develop for STM32 discovery boards using Linux, 10/2011 (verwendet die STLINK Software).
http://hackaday.com/2011/10/17/how-to-develop-for-stm32-discovery-boards-using-linux/
Programming STM32 F2, F4 ARMs under Linux: A Tutorial from Scratch
Mike Szczys, Beginner’s look at On-Chip Debugging, 9/2012
http://hackaday.com/2012/09/27/beginners-look-at-on-chip-debugging/
Mike Szczys, Game of snake (STM32F0 Discovery)
http://hackaday.com/2012/09/21/classic-game-of-snake-on-an-arm-controller/
Tutorial von Radoslaw Kwiecien. Code jedoch nur für MDK-ARM geschrieben.
All articles with tag "stm32"
STM32/ARM Cortex-M3 HOWTO: Development under Ubuntu (Debian)
JorgeAparicio / bareCortexM, An Eclipse project template for bare metal development of ARM Cortex M processors. https://github.com/JorgeAparicio/bareCortexM Siehe auch andere Sachen: - Terminal Program https://github.com/JorgeAparicio/qSerialTerm - C++ template library for STM32 https://github.com/JorgeAparicio/libstm32pp - https://github.com/JorgeAparicio/libKiCad - STM32F4 https://github.com/JorgeAparicio/F4Dev
Kleine Platine mit STM32F4 und vielen Sensoren (accel, gyro, ...), mit KiCad gezeichnet.
Minimalistischer Beispielcode für STM32F4 (sehr viele Beispiele; asm/C, arm-gcc, clang/llvm, Makefile).
Beispielprogramme von Martin Thomas
http://siwawi.bauing.uni-kl.de/avr_projects/arm_projects/index_cortex.html
Template-Projekte auf Github
This package is for use when compiling programs for STM32F05xx ARM microcontrollers using arm-none-eabi-gcc (I'm using the Code Sourcery G++:Lite Edition toolchain). The Makefile in the main directory will call the Make file in the Libraries directory, thereby automatically building the STM peripheral library. However, running 'make clean' will not affect the peripherals library (the same command can be run from the Libraries directory to do this).
This template will serve as a quick-start for those who do not wish to use an IDE, but rather develop in a text editor of choice and build from the command line. It is based on an example template for the F4 Discovery board put together by Jeremy Herbert.
Die Tutorials basieren auf dem Tutorial von Jeremy Herbert für den F4:
Getting Started with the STM32F4 and GCC (Ubuntu 11.10, summon-arm-toolchain)
Anwendungsbeispiel:
http://www.emcu.it/Dog-Cat-Automation/Dog-Cat-Automation.html
Links zu den Templates:
https://github.com/szczys/stm32f0-discovery-basic-template
https://github.com/mblythe86/stm32f3-discovery-basic-template
Sehr detaillierte Artikel von Balau
http://balau82.wordpress.com/2010/02/14/simplest-bare-metal-program-for-arm/ (arm926) http://balau82.wordpress.com/2011/09/03/using-codesourcery-bare-metal-toolchain-for-cortex-m3/
http://balau82.wordpress.com/2010/02/28/hello-world-for-bare-metal-arm-using-qemu/
http://balau82.wordpress.com/2010/12/05/using-ubuntu-arm-cross-compiler-for-bare-metal-programming/
http://balau82.wordpress.com/2010/12/16/using-newlib-in-arm-bare-metal-programs/
darin erwähnt: Developing Software for ARM Processors (DUI0471H_developing_for_arm_processors.pdf)
http://balau82.wordpress.com/2013/08/14/flashing-the-stm32-p152-board-with-openocd/
- Cortex-M3 Assemblerprogrammierung auf dem STM32, 2011 http://pygmy.utoh.org/riscy/cortex/led-stm32.html Der Autor Frank Sergeant hat auch das Pygmy Forth geschrieben, das es auch für den STM32 gibt: http://pygmy.utoh.org/riscy. Es ist auch portiert für TI/LuminaryMicro. preasm.tcl, OpenOCD, Olimex ARM USB Tiny JTAG adaptor, gdb, Emacs, M-x arm-elf-gdb --annotate=3, .gdbinit, Text mit Emacs org-mode geschrieben. http://pygmy.utoh.org/riscy/cortex/
Die freie mbed C/C++ Bibliothek kann auch auf dem VL-Discovery genutzt werden (ausserdem auf F0-, F3- und F4-Discovery):
https://github.com/mbedmicro/mbed
Integriert ist unter anderem die CMSIS-RTOS Bibliothek.
3 Interessante Aufgaben
printf() umsetzen über
- UART
- Semihosting
Retargetting a C Library Function (printf() auf die UART Konsole, mit Keil MDK)
http://doulos.com/knowhow/arm/Retargetting_a_C_library_function/
Stoffsammlung zu printf() über UART
- http://forum.superkato.net/viewtopic.php?t=81
- https://balau82.wordpress.com/2010/12/16/using-newlib-in-arm-bare-metal-programs
- http://www.embedded.com/design/prototyping-and-development/4024867/Embedding-with-GNU-Newlib
- http://e2e.ti.com/support/microcontrollers/stellaris_arm/f/471/t/45015.aspx
- http://koda-karma.blogspot.de/2006/05/newlib-printf-through-uart-on-gnu-arm.html
- http://siwawi.bauing.uni-kl.de/avr_projects/arm_projects/#gcc_stdio
- http://embdev.net/topic/129810
- http://wiki.osdev.org/Porting_Newlib
- Serielle Kommunikation über UART mit Interrupts.
Serieller GDB Debug Stub
siehe z.B. https://groups.google.com/forum/#!topic/diyrovers/GtfSQDLP2_E
Adafruit 1.8" SPI TFT display, 160x128 18-bit color, ST7735R
http://www.adafruit.com/products/618
Von Adafruit gibt es eine Bibliothek für den ST7735, allerdings nur für den Arduino. Gibt es auch Bibliotheken in C?
- Servo Demo (siehe stm32-servo.c und stm32-servo-4.c)
- FreeRTOS Demo
- CMSIS RTOS, a.k.a. "Keil RTX" (BSD Lizenz), Demo mit GCC machen.
STM32Cube (Nachfolger Std-Periph-Lib)
STM32CubeMX (Konfigurationsgenerator)
- Qemu für Cortex-M3 testen
Device Firmware Upgrade Utility, auch für STM32 geeignet
Homepage: http://dfu-util.gnumonks.org
Quelltext der STM32 stdperiph lib untersuchen
Mit find und grep nach einem Namen suchen.
Problematisch ist, dass in manchen Dateinamen ein Leerzeichen ist. Das kann man so umgehen:
find . -name *.c -print0 | xargs -0 grep -i RCC_AHBPeriphClockCmd
Klären:
Wie wurde die Hilfedatei erstellt? Antwort: doxygen
stm32vldiscovery_package/stm32f10x_an3268_fw.chm <-- M$ Format!
Im Quelltext stehen @page, @verbatim, @file, @version, @author, @date, @defgroup, @addtogroup, @brief, @param, @arg, @retval, @note, @copy, ...
Genauso wurde CMSIS dokumentiert.
Lizenzen bei STM32 Projekten prüfen
Codesourcery Compiler kommerziell, teilweise geschlossen (das betrifft CM3 Startup Code). Besser wären
- https://launchpad.net/gcc-arm-embedded
- summon arm toolchain https://github.com/esden/summon-arm-toolchain
- Ubuntu gcc-arm-linux-gnueabi
Lizenz der Std-Periph Lib:
http://www.st.com/software_license_agreement_liberty_v2
besser: CMSIS End User License Agreement
Keil RTX für Cortex M ist unter BSD Lizenz: cmsis_rtos_rtx_v4p70.zip
Keil RTX ist zu CMSIS kompatibel. Sollte man es in die Liste der freien RTOSse für CM3 aufnehmen? (FreeRTOS, ChibiOS, RTX).
- CMSIS-RTOS Demo machen
4 CMSIS
2014-11-07 | Getting started with CMSIS - The Cortex Microcontroller Software Interface Standard
http://www.doulos.com/knowhow/arm/CMSIS/
https://www.doulos.com/knowhow/arm/Cortex-M3_CMSIS_programming/
2014-02-27 | CMSIS Info
Download CMSIS von https://silver.arm.com/browse/CMSIS (mit login/pwd) Aktuelle Version 4.0 (CMSIS-SP-00300-r4p0-00rel0.zip, ca. 63 MByte gross)
Doku von Keil:
http://www.keil.com/pack/doc/CMSIS/Core/html/index.html enthält "Using CMSIS in embedded applications"
http://www.keil.com/pack/doc/CMSIS/Driver/html/index.html Peripheral Driver Interface
http://www.keil.com/pack/doc/CMSIS/DSP/html/index.html DSP Software Library
http://www.keil.com/pack/doc/CMSIS/RTOS/html/index.html CMSIS RTOS
http://www.keil.com/pack/doc/CMSIS/Pack/html/index.html
"Pack" concept: The Pack Concept supports devices, boards, and software components. It describes the content of a Software Pack in a way that allows development tools to pick-up device or board information and related software components and make it available to the user. Software components can have dependencies to devices or other software components that are part of the same or any other Software Pack.
All files that belong to a Software Pack are compressed into a PACK file using a standard ZIP file format. The content of each Software Pack is described in the Pack Description (DSC) file that is part of each Pack. Refer to Pack Description (PDSC) Format for more information.
http://www.keil.com/pack/doc/CMSIS/SVD/html/index.html CMSIS System View Definition
CMSIS-SVD formalizes the description of the programmer's view for the system contained in ARM Cortex-M processor-based microcontrollers, in particular the memory mapped registers of the peripherals. The detail contained in system view descriptions is comparable to what is found in device reference manuals published by silicon vendors. The information ranges from a high level functional description of a peripheral all the way down to the definition and purpose of an individual bit field in a memory mapped register. CMSIS-SVD files are developed and maintained by the silicon vendors. Silicon vendors manage their descriptions in a central, web-based Device Database and the CMSIS-SVD files are downloadable via a public web interface once they have been released by the silicon vendor. Tool vendors use these descriptions for providing device-specific debug views of peripherals in their debugger. Last but not least CMSIS compliant device header files are generated
CMSIS "Handbücher" auf mbed.org
RTOS Handbook
CMSIS-DAP
CMSIS DSP API, FIR Filter Design mit SciPy (Scientific Python)
5 Notizen
Olimex GCCFD
- Eine Entwicklungsumgebung von Olimex (Eclipse, Yagarto, und so weiter) für Windows.
- Wahrscheinlich heisst das nun ODS = Olimex OpenOCD Development Suite https://www.olimex.com/Products/ARM/JTAG/_resources/OpenOCD/
stm32plus C++ Bibliothek von Andy Brown
https://github.com/andysworkshop/stm32plus.git
Website http://andybrown.me.uk/wk/
Aktuelle Version 3.1.1: Support für STM32F100 und grössere Bausteine
http://andybrown.me.uk/wk/2013/12/28/stm32plus-311/, stm32plus::net
scons
Bauen für VL Discovery mit:
scons mode=fast mcu=f1mdvl hse=8000000
Ergebnis: lib mit etwa 8 MByte:
hhoegl@aspire1:~/STM32/STM32-Baustelle/stm32plus$ ls -l ./lib/build/fast-f1mdvl-8000000/libstm32plus-master-f1mdvl-fast.a -rw-r--r-- 1 hhoegl hhoegl 7799686 Feb 27 16:54 ./lib/build/fast-f1mdvl-8000000/libstm32plus-master-f1mdvl-fast.a
gcc Aufruf beim Bauen:
arm-none-eabi-g++ -o lib/build/fast-f1mdvl-8000000/src/usart/interrupts/Usart2InterruptHandler.o -c -Wextra -Werror -pedantic-errors -fno-rtti -std=gnu++0x -fno-threadsafe-statics -pipe -Wall -Werror -ffunction-sections -fdata-sections -fno-exceptions -mthumb -gdwarf-2 -pipe -DHSE_VALUE=8000000 -mcpu=cortex-m3 -DSTM32PLUS_F1_MD_VL -O3 -Ilib/include -Ilib/include/stl -Ilib lib/src/usart/interrupts/Usart2InterruptHandler.cpp u.s.w.
Jede Menge Tests von Michael Fischer für Cortex-M0, M3, M4
Fileinklusion mit Doxygen grafisch veranschaulichen
Dokumente zum gcc-arm-embedded sind in
/opt/gcc-arm-none-eabi-4_7-2013q3/share/doc/gcc-arm-none-eabi/pdf/
Dort sind zu finden:
annotate.pdf binutils.pdf gdbint.pdf ld.pdf libm.pdf as.pdf etc gdb.pdf libc.pdf refcard.pdf bfd.pdf gcc gprof.pdf libiberty.pdf stabs.pdfDie Beschreibung der "newlib" 1.19.0 ist in libc.pdf. Auch die System Calls und Reentrancy sind hier bescrieben.
- Man kann den arm-gcc mit --std=c11 verwenden, dann kennt er aber keine asm() Anweisung mehr. Die funktioniert mit --std=gnu11.
Manche Demos verwenden die Header-Datei "STM32vldiscovery.h". Diese ist nicht in der Std-Periph-Lib enhalten, sondern man findet sie z.B. hier:
FreeRTOSV7.5.3/CORTEX_STM32F100_Atollic/Utilities/STM32_EVAL/STM32_Discovery/STM32vldiscovery.h
In dieser Header Datei ist eine Include-Anweisung, die man korrigieren muss (Kleinschreibung nötig!):
#include "STM32f10x.h"Auch die Datei "stm32f10x.h" wird oft importiert, sie kommt von CMSIS:
STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/CMSIS/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h