jhol / pyadf435x

An open source software suite to control the ADF4351 board
61 stars 19 forks source link

Compile STM32 on OSX, flash with JLink - guide #9

Open rosek86 opened 5 years ago

rosek86 commented 5 years ago

Maybe this will be helpful for someone, this is how I've compiled STM32 firmware on OSX.

update submodules

git submodule update --init

bootstrap-mac.sh

Create a bootstrap-mac.sh file in firmware/stm32 and copy script content attached below.

Bootstrap

cd firmware/stm32
source ./bootstrap-mac.sh

Build

cd libopencm3
make
cd ..
make

Flash using JLink

JLinkExe -Device STM32F103C8 -Speed 4000 -If SWD -Autoconnect 1
loadbin stm32adf435xfw.bin 0x08000000
r
g

bootstrap-mac.sh

#!/bin/bash

if [ ! -d gcc-arm-none-eabi-8-2019-q3-update ]; then
  wget https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/8-2019q3/RC1.1/gcc-arm-none-eabi-8-2019-q3-update-mac.tar.bz2
  tar -xjf gcc-arm-none-eabi-8-2019-q3-update-mac.tar.bz2
  rm -f gcc-arm-none-eabi-8-2019-q3-update-mac.tar.bz2
fi

export PATH="$PATH:$(pwd)/gcc-arm-none-eabi-8-2019-q3-update/bin/"

echo "OK"