freedv-gui/codec2-1.2.0/stm32
Mooneer Salem e9ec9347d9
Make sure RTSan-related code isn't added if not installed. (#900)
* Make sure RTSan-related code isn't added if not installed.

* Enable RTSan checks in GH Actions.

* Fix syntax error in GH action.

* Fix GCC compile failures.

* Use different GH workflow to get correct Clang installed.

* Split RTSan test into separate build and test steps

* Move LLVM installation to beginning in case there are side effects.

* Prevent dynamic resampling in AudioPipeline when playing back files.

* Mixed up sample calculation, causing tests to fail.

* Additional changes to see if it still hangs.

* Update cmake-macos.yml

* Do completion check after queuing to output FIFO.

* Fix buffer overflow.

* Some additional changes based on local testing.

* GH tests weren't actually being run through the resampler.

* Remove ExclusiveAccessStep files as they're not being used.

* Remove some logging that shouldn't be in RT context.

* Add reset() to IPipelineStep to avoid repeated deallocations and reallocations of the TX pipeline.

* Fix segfault from previous changes.

* Remove RADE specific logging in RT context and suppress RTSan for RADE EOO handling.

* Disable RTSan for RADE text handling.

* Try disabling real-time for macOS.

* Force Windows 2022.

* Revert "Try disabling real-time for macOS."

This reverts commit c8ee871406.

* Experiment: use O(1) heap allocator for Codec2.

* Fix patch commands.

* thread_local is only in C++11 and above.

* Force codec2 folder to be removed every call.

* Update codec2 patch.

* Fix Windows compiler error.

* Oops, should be _aligned_malloc.

* Integrate codec2 into source tree so we don't need to deal with patch.

* Update Codec2 README.

* mbest needs to use o1heap too.

* Remove rtsan disable from FreeDV TX/RX steps.

* Bring back AudioPipeline change previously removed by master merge.

* Result resampler needs to be initialized on construction.

* Create resampler only if input and output rates don't match.

* Increase Codec2 RT heap size.

* Fix Windows failures.

* Ensure separate threads spawned from PipelineStep are also checked by RTSan.

* Support RTSan builds on macOS if user has appropriate LLVM.

* Remove no longer needed patch.

* Remove unneeded resettingThread property.

* Fix issue discovered during testing.

* Test: match Linux and macOS requested latency to Windows.

* Add PR #900 to changelog.
2025-06-05 08:17:24 -07:00
..
cmake Make sure RTSan-related code isn't added if not installed. (#900) 2025-06-05 08:17:24 -07:00
doc Make sure RTSan-related code isn't added if not installed. (#900) 2025-06-05 08:17:24 -07:00
inc Make sure RTSan-related code isn't added if not installed. (#900) 2025-06-05 08:17:24 -07:00
src Make sure RTSan-related code isn't added if not installed. (#900) 2025-06-05 08:17:24 -07:00
stlink Make sure RTSan-related code isn't added if not installed. (#900) 2025-06-05 08:17:24 -07:00
unittest Make sure RTSan-related code isn't added if not installed. (#900) 2025-06-05 08:17:24 -07:00
usb_conf Make sure RTSan-related code isn't added if not installed. (#900) 2025-06-05 08:17:24 -07:00
usb_lib Make sure RTSan-related code isn't added if not installed. (#900) 2025-06-05 08:17:24 -07:00
CMakeLists.txt Make sure RTSan-related code isn't added if not installed. (#900) 2025-06-05 08:17:24 -07:00
README.md Make sure RTSan-related code isn't added if not installed. (#900) 2025-06-05 08:17:24 -07:00
stm32_flash.ld Make sure RTSan-related code isn't added if not installed. (#900) 2025-06-05 08:17:24 -07:00
stm32_ram.ld Make sure RTSan-related code isn't added if not installed. (#900) 2025-06-05 08:17:24 -07:00

README.md

Building for the stm32

Quickstart

  1. Build codec2 (with -DUNITTEST=1) for your host system, see codec2/README.md

    $ cd ~/codec2
    $ mkdir build_linux && cd build_linux && cmake -DUNITTEST=1 .. && make
    
  2. Install a gcc arm toolchain:

    $ cd ~
    $ 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
    $ tar xvjf gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2
    $ export PATH=$HOME/gcc-arm-none-eabi-8-2018-q4-major/bin:$PATH
    

    NOTE: We do not recommend toolchains provided by popular distributions (e.g. the Ubuntu 18 gcc-arm-none-eabi package will not work).

  3. Create a build directory (/path/to/codec2/stm32 recommended to support unit tests)

    $ cd /path/to/codec2/stm32
    $ mkdir build_stm32
    $ cd build_stm32
    
  4. The STM32 Standard Peripheral Library is required. The download requires a registration on the STM website. Save the zip file somewhere safe and then extract it anywhere you like. You will have to tell cmake where the unzipped library is by giving the variable PERIPHLIBDIR the location of top level directory, e.g. for version 1.8.0 this is STM32F4xx_DSP_StdPeriph_Lib_V1.8.0.

    In this example we will assume the library has been unzipped in ~/Downloads.

  5. Configure the build system by running cmake:

    $ cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/STM32_Toolchain.cmake \
      -DPERIPHLIBDIR=~/Downloads/STM32F4xx_DSP_StdPeriph_Lib_V1.8.0 ..
    

    Or a more general case:

    $ cmake /path/to/codec2-dev/stm32 -DCMAKE_TOOLCHAIN_FILE=/path/to/codec2-dev/stm32/cmake/STM32_Toolchain.cmake \
      -DPERIPHLIBDIR=/path/to/unzipped/STM32F4xx_DSP_StdPeriph_Lib_Vx.x.x ..
    
  6. Build binaries (including sm1000.bin)

    Finally:

    $ make
    

    To see all the details during compilation:

    $ make VERBOSE=1
    

Flashing your SM1000

  1. Power up your SM1000 with the PTT button down. Then flash it with:

  2. sudo dfu-util -d 0483:df11 -c 1 -i 0 -a 0 -s 0x08000000 -D sm1000.bin
    
  3. Power cycle to reboot.

Loading and Debugging stm32 programs

  1. See unitest/README.md for information on how to set up openocd.

  2. In one console Start openocd:

    $ openocd -f board/stm32f4discovery.cfg
    
    
  3. In another start gdb:

    $ cd ~/codec2/stm32/build_stm32
    $ arm-none-eabi-gdb usart_ut.elf
    (gdb) target remote :3333
    <snip>
    (gdb) load
    <snip>
    (gdb) c
    
    

Directories

Directory Notes
cmake cmake support files for the stm32
doc SM1000 documentation
inc top level sm1000 source, drivers, and some legacy test code
src top level sm1000 source, drivers, and some legacy test code
unittest comprehensive set of automated unit tests for the stm32 700D port