User Tools

Site Tools


en:arm_programming

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:arm_programming [2013/07/27 12:52] fluktuaciaen:arm_programming [Unknown date] (current) – external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
 ====== ARM STM32 processors programming ====== ====== ARM STM32 processors programming ======
  
-The best working environment for ARM processors is the Linux OS. That is why the following manual describes the installation process and how to handle the tools for work with ARM in this system. [[http://wiki.ubuntu.cz/Instalace/Pr%C5%AFvodce%20instalac%C3%AD?redirect=1|Linux installation manual]].+The best working environment for ARM processors is the Linux OS. That is why the following manual describes the installation process and how to handle the tools for work with ARM in this particular system. [[http://wiki.ubuntu.cz/Instalace/Pr%C5%AFvodce%20instalac%C3%AD?redirect=1|Linux installation manual]].
  
 All the software that is mentioned in this guide can be obtained for free. All the software that is mentioned in this guide can be obtained for free.
Line 9: Line 9:
 A required HW includes: A required HW includes:
  
-  * An ARM processor of your choice with necessary peripherals ([[en:stm32f10xrxt|STM32F10xRxT]]) +  * ARM processor of your choice with necessary peripherals ([[en:stm32f10xrxt|STM32F10xRxT]]) 
-  * Program loading +  * Program __loading__ 
-     * Through a serial __port__ ([[en:usbrs23201b|USBRS23201B]])+     * Through a serial link ([[en:usbrs23201b|USBRS23201B]])
      * J-TAG ([[en:jtagft2232v02a|JTAGFT2232V02A]])      * J-TAG ([[en:jtagft2232v02a|JTAGFT2232V02A]])
  
 A required SW includes: A required SW includes:
-  * SW for writing the code / coding Psaní programu+  * SW for writing the code 
   * Compiler   * Compiler
-  * Loading of compiled program Nahrání přeloženého programu+  * Loading of the compiled program 
  
  
 ===== Compiler ===== ===== Compiler =====
  
-You can use freely available GNU C compiler, obtainable from git repository [[https://launchpad.net/gcc-arm-embedded|gcc-arm-embedded]].+You can use freely available GNU C compiler, obtainable from git repository [[https://launchpad.net/gcc-arm-embedded|gcc-arm-embedded]].
  
 To help you with the Ubuntu installation it is possible to used a ready-made [[https://launchpad.net/~terry.guo/+archive/gcc-arm-embedded|deb packages]]. A PPA repository currently works only for Ubuntu version 12.04.   To help you with the Ubuntu installation it is possible to used a ready-made [[https://launchpad.net/~terry.guo/+archive/gcc-arm-embedded|deb packages]]. A PPA repository currently works only for Ubuntu version 12.04.  
  
-== Quick installation using a __repository__ ==+== Quick installation using a software repository ==
  
   sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded   sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
   sudo apt-get update   sudo apt-get update
-  sudo apt-get install gcc-arm-none-eabisudo+  sudo apt-get install gcc-arm-none-eabi
      
 == Compilation procedure ==   == Compilation procedure ==  
Line 55: Line 55:
 ==== STM32F10X standard peripheral library ==== ==== STM32F10X standard peripheral library ====
  
-The complete proprietary library from STMicroelectronics, suffering form uncomfortable programming interface and occupying a lot of space in the final program.+The complete proprietary library from STMicroelectronics, suffering form an uncomfortable programming interface and occupying a lot of space in the final program.
  
 It is available for download at [[http://www.st.com/stonline/stappl/resourceSelector/app?page=resourceSelector&doctype=FIRMWARE&SubClassID=1169|STMicroelectronics web site]]. It is available for download at [[http://www.st.com/stonline/stappl/resourceSelector/app?page=resourceSelector&doctype=FIRMWARE&SubClassID=1169|STMicroelectronics web site]].
Line 62: Line 62:
 ==== libopencm3 ==== ==== libopencm3 ====
  
-A new open-source library with better interface and smaller size, that in unfortunately yet incomplete (though under an ongoing development) +A new open-source library with better interface and smaller size, that in unfortunately yet incomplete (though under an ongoing development)
  
  
Line 71: Line 71:
 ==== Bootloader ==== ==== Bootloader ====
  
-The use of bootloader is useful in cases when we do not intend to use any additional programming HW and we do not need advanced development functions like debugger.+The use of bootloader is useful in cases when we do not intend to use any additional programming HW and we do not need advanced developmental functions like debugger.
  
 === STM32F10xRxT01A module === === STM32F10xRxT01A module ===
Line 78: Line 78:
  
  
-== Připojení modulu ==+== Connecting the module ==
  
-Pro použití bootloaderu je třeba modul připojit na seriovou linkuV případě použití modulu [[cs:usb232r|USB232R01B]] stačí mít zapojené pouze RXD TXD následovně:+In order to be able to use the bootloader, it in necessary to connect it to the serial linkIn the case of using [[en:usb232r|USB232R01B]] module, it is sufficient to have only RXD and TXD connected in a following way:
  
  
Line 87: Line 87:
 | RXD | PA9 | | RXD | PA9 |
  
-Ostatní signály DTR RTS si na modulu zapojují profesionálovékteří nechtějí mačkat tlačítka pří každém uploadu :)  +Professionals can connect other DTR and RTS signals as wellto get rid of an annoying pressing of the keys during every upload :) 
-(Tato funkce vyžaduje upravený stm32flash, který se však asi podařilo ztratit)+(This function requires a modified stm32flash).
  
-== Kompilace stm32flash ==+ 
 +== stm32flash compilation ==
  
   svn checkout http://stm32flash.googlecode.com/svn/trunk/ stm32flash-read-only   svn checkout http://stm32flash.googlecode.com/svn/trunk/ stm32flash-read-only
Line 98: Line 99:
  
  
-Příklad použití:+An example of use:
  
   sudo stm32flash /dev/ttyUSB0   sudo stm32flash /dev/ttyUSB0
Line 116: Line 117:
   Resetting device... done.   Resetting device... done.
  
- +An example of program loading
-Nahravani programu vypada napriklad takto:+
  
   $ ./stm32flash -w ./bin/LED_Blink.hex -v -g 0x0 /dev/ttyUSB0    $ ./stm32flash -w ./bin/LED_Blink.hex -v -g 0x0 /dev/ttyUSB0 
Line 138: Line 138:
 === dfu-util === === dfu-util ===
  
-Přeložené bináry této utility pro jednotlivé platformy naleznete zde: [[http://www.mlab.cz/WebSVN/listing.php?repname=MLAB&path=%2FModules%2FARM%2FSTM32F10xRxT%2FSW%2FUSB_bootloader%2F#_Modules_ARM_STM32F10xRxT_SW_USB_bootloader_/|dfu-util]] +The binaries for this utility can be found here: [[http://www.mlab.cz/WebSVN/listing.php?repname=MLAB&path=%2FModules%2FARM%2FSTM32F10xRxT%2FSW%2FUSB_bootloader%2F#_Modules_ARM_STM32F10xRxT_SW_USB_bootloader_/|dfu-util]] 
  
-Pro aktivaci bootloaderu přes USB musíte připojit +3,3 V na nožičku PA9. Spuštění bootloaderu se provádí tlačítkystiskni RESET, stiskni BOOT, pusť RESET, pusť BOOT.+To activate the bootloader through USB, you have to connect + 3,3 V to the PA9 pinIn order to run the bootloader follow the sequencepress RESET, press BOOT, release RESET, release BOOT.
  
-Dávka pro volání dfu-util pro platformu Windows a přeložená verze dfu-util bez potřeby dalších knihoven je zde: [[http://www.mlab.cz/WebSVN/listing.php?repname=MLAB&path=%2FModules%2FARM%2FSTM32F10xRxT%2FSW%2FUSB_bootloader%2FWin32%2F#_Modules_ARM_STM32F10xRxT_SW_USB_bootloader_Win32_/|dfu-util-static]]. Pod Windows je ještě nutné nainstalovat nějakou verzi usblibTo nejsnáze uděláte programem [[http://www.mlab.cz/WebSVN/filedetails.php?repname=MLAB&path=%2FModules%2FARM%2FSTM32F10xRxT%2FSW%2FUSB_bootloader%2FWin32%2Fzadig.exe/|zadig]]. V průběhu instalace usblib musíte mít procesor v DFU módu (viz sekvenci tlačítek výše).+A __batch__ to call the dfu-util on Windows platform and the compiled version of dfu-until without the need to download other libraries can be found here: [[http://www.mlab.cz/WebSVN/listing.php?repname=MLAB&path=%2FModules%2FARM%2FSTM32F10xRxT%2FSW%2FUSB_bootloader%2FWin32%2F#_Modules_ARM_STM32F10xRxT_SW_USB_bootloader_Win32_/|dfu-util-static]]. Furthermore, to run the program on Windows, it is necessary to install some version of uslibThe easiest way to do it is to use [[http://www.mlab.cz/WebSVN/filedetails.php?repname=MLAB&path=%2FModules%2FARM%2FSTM32F10xRxT%2FSW%2FUSB_bootloader%2FWin32%2Fzadig.exe/|zadig]]. In the course of installation, the processor must be in DFU mode (see the key sequence mentioned above). 
 + 
 +You can test the firmware loading, using this sample binary, that creates the USB HID mouse out of the STM32F107 processor. [[http://www.mlab.cz/WebSVN/filedetails.php?repname=MLAB&path=%2FModules%2FARM%2FSTM32F10xRxT%2FSW%2FUSB_bootloader%2Fsample%2FSTM32F107_mouse.bin/|STM32F107_mouse.bin]]
  
-Nahrání firmware si můžete vyzkoušet pomocí tohoto vzorového bináru, který z procesoru STM32F107 udělá USB HID myš, která opisuje kolečko: [[http://www.mlab.cz/WebSVN/filedetails.php?repname=MLAB&path=%2FModules%2FARM%2FSTM32F10xRxT%2FSW%2FUSB_bootloader%2Fsample%2FSTM32F107_mouse.bin/|STM32F107_mouse.bin]] 
      
 ==== J-TAG ==== ==== J-TAG ====
  
-K programování přes JTAG se potřebuje externí programátorNa modulu [[cs:stm32f10xrxt|STM32F10xRxT01A]] jsou JTAG dráty vyvedeny na zvláštním konektoru (J51). Jako externí programátor může být využit například modul [[http://www.mlab.cz/PermaLink/JTAGFT2232V02A|JTAGFT2232V02A]]+An external programmer is required to program through JTAG. In the case of [[cs:stm32f10xrxt|STM32F10xRxT01A]] module, the JTAG wires have a special __pin-out__ (J51). The [[http://www.mlab.cz/PermaLink/JTAGFT2232V02A|JTAGFT2232V02A]] module can be used as an external programmer.
  
-Programovat lze napřotevřeným programem [[http://openocd.sourceforge.net/|OpenOCD]], který podporuje většinu používaných JTAG programátorů a umí vytvořit back-end pro [[http://www.gnu.org/software/gdb/|GDB]], takže podporuje i debugování.+For programing is suitable eg. [[http://openocd.sourceforge.net/|OpenOCD]], an open programm that supports the majority of JTAG programmers and is able to create the back-end for [[http://www.gnu.org/software/gdb/|GDB]], thus supporting the debugging as well.
  
-OpenOCD má v Ubuntu sice nativně podporované balíčkyale jejich verze je obvykle značně opožděna za současným vývojemProto je lepší si zkompilovat aktualní verzi..  + 
 +=== Ubuntu === 
 + 
 +Though there already exist natively supported packages for OpenOCD in Ubuntu, their versions are usually  
 +quite old compared to the latest development. It is therefore recommended to compile the current version...
  
   sudo apt-get install libtool git gcc automake libftdi-dev texinfo   sudo apt-get install libtool git gcc automake libftdi-dev texinfo
Line 161: Line 166:
   make   make
   sudo make install   sudo make install
-   + 
-Tím máme v systému naistalováno OpenOCD. Pokud jej budeme chtít odinstalovatpoužije se příkaz +To uninstal the OpenOCD, use the following command  
  
   sudo make uninstall   sudo make uninstall
  
-Pokud máme k počítači připojený modul [[cs:jtagft2232v|JTAGFT2232V02A]] s nahraným schématem v FPGA, tak se můžeme připojit k nějakému ARMu.+If you have a [[cs:jtagft2232v|JTAGFT2232V02A]] module with __uploaded FPGA scheme__ connected to you computeryou can connect to ARM 
  
   sudo openocd -f "interface/busblaster.cfg" -f "target/stm32f1x.cfg"   sudo openocd -f "interface/busblaster.cfg" -f "target/stm32f1x.cfg"
Line 185: Line 190:
   Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints   Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
  
-OpenOCD teď vytvořilo server ke kterému se můžeme přípojit přes telnet + 
 +Tho OpenOCD has created a server, that you can connect with through telnet
  
   telnet localhost 4444   telnet localhost 4444
Line 195: Line 201:
   >    > 
    
 +
 +=== Mac OS X ===
 +
 +
 +  ./configure --enable-ft2232_ftd2xx openocd -f busblaster.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg\\
 +\\
 +busblaster.cfg:\\
 +  interface ft2232
 +  ft2232_device_desc "Dual RS232-HS"
 +  ft2232_layout jtagkey
 +  ft2232_vid_pid 0x0403 0x6010
 +
 +basic info: http://pramode.net/fosstronics/stm32-circle.txt
 +
 ===== RTOS ===== ===== RTOS =====
  
 ==== Chibios ==== ==== Chibios ====
  
-[[http://www.chibios.org/dokuwiki/doku.php|Webová stránka projektu]] +[[http://www.chibios.org/dokuwiki/doku.php|Webpage of the project]] 
-  + 
-Jde o základní relaltime operační systém s HAL zjednodušující práci s mikroprocesoremPro snazší práci byla vytvorena kofigurace Chibios přímo pro modul s ARM dostupná je na [[https://github.com/toxygen/mlab-chibios|githubu]] +Chibios is a basic realtime OS with HAL component that simplifies the work with a microprocessorTo facilitate the work, a Chibios configuration directly for module with ARM has been created, and it is available at [[https://github.com/toxygen/mlab-chibios|github]].  
 + 
 +In order to obtain more documentation use [[http://chibios.sourceforge.net/html/index.html|ChibiOS/RT]] site.
  
-Další programová dokumentace je dostupná [[http://chibios.sourceforge.net/html/index.html|ChibiOS/RT]] +=== LED blink demo ===
-=== Demo blikání LED ===+
  
   #include <ch.h>   #include <ch.h>
en/arm_programming.1374929571.txt.gz · Last modified: 2013/07/27 12:52 (external edit)