-
Notifications
You must be signed in to change notification settings - Fork 25
/
extract-and-patch-WICED
executable file
·70 lines (58 loc) · 1.98 KB
/
extract-and-patch-WICED
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
set -e
WICED_DIR='WICED-SDK-3.3.1'
WICED_ARCHIVE_EXT='.7z.zip'
echo
echo -- WICED 3.3.1 patcher for MXCHIP EMW modules --
echo ------------------------------------------------
if [ -e $WICED_DIR ]; then
echo
echo === ERROR: The $WICED_DIR directory already exists.
echo === Operation aborted, for your safety.
echo ===
echo === Delete the $WICED_DIR directory to proceed.
exit -1
fi
echo
echo === Decompressing WICED
unzip $WICED_DIR$WICED_ARCHIVE_EXT >> /dev/null
7z x *.7z >> /dev/null
rm *.7z
echo
echo === Installing the EMW3162 platform
cp -r patches/EMW3162 $WICED_DIR/platforms
echo
echo === Installing the EMW3165 platform
cp -r patches/EMW3165 $WICED_DIR/platforms
echo
echo === Patching STM32F4xx libraries to support for more than 3 SPI peripherals
cd $WICED_DIR
patch -p1 < ../patches/WICED_3.3.1-STM32F4_Add_SPI_Devices.patch
cd ..
echo
echo "=== Patching STM32F4xx WAF libraries for OTA (see #6)"
cp patches/waf_platform.c $WICED_DIR/WICED/platform/MCU/STM32F4xx/WAF/
echo
echo === Adding SWD and Stlink-v2 support
echo === Use JTAG=stlink-v2 on the make command line to use Stlink-v2
cp -r patches/OpenOCD/* $WICED_DIR/tools/OpenOCD
if [ "`uname`" == "Linux" ]; then
echo
echo "=== Replacing WICED make binary with system one (see http://community.broadcom.com/message/17899#17899)"
# Yea yea... you're not going to be using both anyway :p
cp /usr/bin/make $WICED_DIR/tools/common/Linux64
cp /usr/bin/make $WICED_DIR/tools/common/Linux32
if [ "$TRAVIS" != true ]; then
echo
echo === Adding udev rules to enable JLink and stlink-v2 from userspace
echo === Please enter your password if prompted
sudo cp patches/*.rules /etc/udev/rules.d
fi
fi
echo
echo ===
echo === Finished decompressing and patching $WICED_DIR for MXCHIP EMW
echo === Refer to the README.md and the Github Wiki for info on how to flash.
echo === Support is also available on our Gitter.im channel at:
echo === https://gitter.im/MXCHIP-EMW/WICED-for-EMW
echo ===