Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
cmake/ | H | 27-Dec-2021 | - | 603 | 551 | |
doc/ | H | 03-May-2022 | - | 186 | 121 | |
inc/ | H | 27-Dec-2021 | - | 921 | 249 | |
src/ | H | 27-Dec-2021 | - | 5,781 | 3,236 | |
stlink/ | H | 27-Dec-2021 | - | 590 | 497 | |
support/ | H | 27-Dec-2021 | - | 3,394 | 2,634 | |
unittest/ | H | 27-Dec-2021 | - | 6,371 | 3,799 | |
usb_conf/ | H | 27-Dec-2021 | - | 1,389 | 561 | |
usb_lib/ | H | 27-Dec-2021 | - | 9,200 | 5,354 | |
README.md | H A D | 27-Dec-2021 | 2.7 KiB | 98 | 75 | |
stm32_flash.ld | H A D | 27-Dec-2021 | 3.7 KiB | 152 | 131 | |
stm32_ram.ld | H A D | 27-Dec-2021 | 2.9 KiB | 117 | 100 |
README.md
1# Building for the stm32 2 3## Quickstart 4 51. Build codec2 for your host system, see [codec2/README.md](../README.md) 6 72. Install a gcc arm toolchain: 8 ``` 9 $ cd ~ 10 $ wget https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/8-2018q4/gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2 11 $ tar xvjf gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2 12 $ export PATH=$HOME/gcc-arm-none-eabi-8-2018-q4-major/bin:$PATH 13 ``` 14 15 NOTE: We do not recommend toolchains provided by popular 16 distributions (e.g. the Ubuntu 18 gcc-arm-none-eabi package will not 17 work). 18 193. Create a build directory (```/path/to/codec2/stm32``` recommended to support unit tests) 20 ``` 21 $ cd /path/to/codec2/stm32 22 $ mkdir build_stm32 23 $ cd build_stm32 24 ``` 25 264. The STM32 Standard Peripheral Library is required. The download 27 requires a registration on the STM website. Save the zip file 28 somewhere safe and then extract it anywhere you like. You will have 29 to tell cmake where the unzipped library is by giving the variable 30 PERIPHLIBDIR the location of top level directory, e.g. for version 31 1.8.0 this is STM32F4xx_DSP_StdPeriph_Lib_V1.8.0. 32 33 In this example we will assume the library has been unzipped in ~/Downloads. 34 355. Configure the build system by running cmake: 36 37 ``` 38 $ cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/STM32_Toolchain.cmake \ 39 -DPERIPHLIBDIR=~/Downloads/STM32F4xx_DSP_StdPeriph_Lib_V1.8.0 .. 40 ``` 41 Or a more general case: 42 ``` 43 $ cmake /path/to/codec2-dev/stm32 -DCMAKE_TOOLCHAIN_FILE=/path/to/codec2-dev/stm32/cmake/STM32_Toolchain.cmake \ 44 -DPERIPHLIBDIR=/path/to/unzipped/STM32F4xx_DSP_StdPeriph_Lib_Vx.x.x .. 45 ``` 46 476. Build binaries (including sm1000.bin) 48 49 Finally: 50 ``` 51 $ make 52 ``` 53 To see all the details during compilation: 54 ``` 55 $ make VERBOSE=1 56 ``` 57 58## Flashing your SM1000 59 601. Power up your SM1000 with the PTT button down. Then flash it with: 61 622. ``` 63 sudo dfu-util -d 0483:df11 -c 1 -i 0 -a 0 -s 0x08000000 -D sm1000.bin 64 ``` 653. Power cycle to reboot. 66 67## Loading and Debugging stm32 programs 68 691. See unitest/README.md for information on how to set up openocd. 70 712. In one console Start openocd: 72 ``` 73 $ openocd -f board/stm32f4discovery.cfg 74 75 ``` 76 773. In another start gdb: 78 ``` 79 $ cd ~/codec2/stm32/build_stm32 80 $ arm-none-eabi-gdb usart_ut.elf 81 (gdb) target remote :3333 82 <snip> 83 (gdb) load 84 <snip> 85 (gdb) c 86 87 ``` 88 89## Directories 90 91Directory | Notes 92---|--- 93cmake | cmake support files for the stm32 94doc | SM1000 documentation 95inc | top level sm1000 source, drivers, and some legacy test code 96src | top level sm1000 source, drivers, and some legacy test code 97unittest | comprehensive set of automated unit tests for the stm32 700D port 98