xref: /OK3568_Linux_fs/buildroot/board/stmicroelectronics/stm32f429-disco/flash.sh (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#!/bin/bash
2
3OUTPUT_DIR=$1
4BOARD_NAME=${2:-stm32f429discovery}
5
6if ! test -d "${OUTPUT_DIR}" ; then
7    echo "ERROR: no output directory specified."
8    echo "Usage: $0 OUTPUT_DIR BOARD_NAME"
9    echo ""
10    echo "Arguments:"
11    echo "    OUTPUT_DIR    The Buildroot output directory."
12    echo "    BOARD_NAME    One of the available boards among:"
13    echo "                  stm32f429discovery, stm32f429disc1"
14    exit 1
15fi
16
17${OUTPUT_DIR}/host/bin/openocd -f board/${BOARD_NAME}.cfg \
18  -c "init" \
19  -c "reset init" \
20  -c "flash probe 0" \
21  -c "flash info 0" \
22  -c "flash write_image erase ${OUTPUT_DIR}/images/stm32f429i-disco.bin 0x08000000" \
23  -c "flash write_image erase ${OUTPUT_DIR}/images/stm32f429-disco.dtb 0x08004000" \
24  -c "flash write_image erase ${OUTPUT_DIR}/images/xipImage 0x08008000" \
25  -c "reset run" \
26  -c "shutdown"
27