guides:stm32toolchain
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
guides:stm32toolchain [2014/08/16 15:30] – jonsowman | guides:stm32toolchain [2016/04/07 20:48] (current) – [Step 5 (libopencm3 Libraries)] mbrejza | ||
---|---|---|---|
Line 12: | Line 12: | ||
* For use of newlib-nano, | * For use of newlib-nano, | ||
* Extract to somewhere like /usr/local and add / | * Extract to somewhere like /usr/local and add / | ||
- | export PATH=/ | + | '' |
*Then to use the amended PATH: | *Then to use the amended PATH: | ||
- | $ source ~/.bashrc | + | '' |
* Alternatively (and for when they fix newlib nano in the repos), install from ppa: | * Alternatively (and for when they fix newlib nano in the repos), install from ppa: | ||
- | $ sudo add-apt-repository ppa: | + | '' |
- | $ sudo apt-get update | + | '' |
- | $ sudo apt-get install gcc-arm-none-eabi | + | '' |
* Check install is working by running | * Check install is working by running | ||
- | $ arm-none-eabi-gcc --version | + | '' |
==== Step 2 - Clone a blank project ==== | ==== Step 2 - Clone a blank project ==== | ||
- | $ git clone https:// | + | '' |
==== Step 3 - Fetch and build libopencm3 ==== | ==== Step 3 - Fetch and build libopencm3 ==== | ||
- | - `cd` into the root of the repo | + | - '' |
- | - Run $ `git submodule update --init` to fetch libopencm3. | + | - Run '' |
- | - `cd` to the libopencm3 directory and run `make` to build. | + | - '' |
==== Step 4 - Adjust for your device ==== | ==== Step 4 - Adjust for your device ==== | ||
- | Open up Makefile.include in firmware/ | ||
- | * LIBNAME - The name of the library. This is " | ||
- | * DEFS - A define for the particular device. Use -DSTM32F0 for the F0, -DSTM32F1 for F1, etc | ||
- | * FP_FLAGS - Set this to -msoft-float if the device doesn' | ||
- | * ARCH_FLAGS - Always include -mthumb. Also define the CPU using -mcpu=cortex-m0 (adjust for others) | ||
- | Now open up common/ | + | **We' |
+ | Open up Makefile in firmware/ | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | Now open up common/ | ||
==== Step 5 - Install flashing/ | ==== Step 5 - Install flashing/ | ||
* Clone texane' | * Clone texane' | ||
- | * Follow the " | + | * Follow the " |
==== Step 6 - Build ==== | ==== Step 6 - Build ==== | ||
A libopencm3 LED blink example is provided in firmware/ | A libopencm3 LED blink example is provided in firmware/ | ||
- | `cd` to this directory and build the firmware with $ make | + | '' |
- | This should produce the main.elf file. | + | If you're having issues then use '' |
==== Step 7 - Flash the firmware ==== | ==== Step 7 - Flash the firmware ==== | ||
* Connect the board to the machine via the USB port | * Connect the board to the machine via the USB port | ||
- | * Erase the device with $ st-flash erase | + | * Erase the device with '' |
- | * Make the .bin version of the binary with $ make bin | + | * Make the .bin version of the binary with '' |
- | * Flash the firmware to the device with $ st-flash write main.bin 0x8000000 | + | * Flash the firmware to the device with '' |
* 0x800000 is the start address of the flash memory in the device memory address space | * 0x800000 is the start address of the flash memory in the device memory address space | ||
- | **On Linux, st-flash needs root privileges ($ sudo ./st-flash ...) to access the USB system until you set up udev rules** | + | **On Linux, st-flash needs root privileges ('' |
+ | |||
+ | ---- | ||
===== Windows, Makefile, libopencm3 ===== | ===== Windows, Makefile, libopencm3 ===== | ||
Line 106: | Line 109: | ||
==== Step 5 (libopencm3 Libraries) ==== | ==== Step 5 (libopencm3 Libraries) ==== | ||
- | Firstly add the libopencm3 files to the project directory. This can be fetched from the [[https:// | + | Firstly add the libopencm3 files to the project directory. This can be fetched from the [[https:// |
The final file needed is part of the linker script. Copy [[https:// | The final file needed is part of the linker script. Copy [[https:// | ||
Line 129: | Line 132: | ||
coIDE defaults to STLink to download programs, however if you are having issues, check ' | coIDE defaults to STLink to download programs, however if you are having issues, check ' | ||
+ | |||
+ | ---- | ||
===== Code Listings ===== | ===== Code Listings ===== |
guides/stm32toolchain.1408203000.txt.gz · Last modified: 2014/08/16 15:30 by jonsowman