Statistics
| Branch: | Tag: | Revision:

mongoose / examples / ESP8266_RTOS / gen_misc.sh @ eaef5bd1

History | View | Annotate | Download (3.58 KB)

1
#!/bin/bash
2

    
3
:<<!
4
******NOTICE******
5
MUST set SDK_PATH & BIN_PATH firstly!!!
6
example:
7
export SDK_PATH=~/ESP8266_RTOS_SDK
8
export BIN_PATH=~/esp8266_bin
9
!
10

    
11
echo "gen_misc.sh version 20150911"
12
echo ""
13

    
14
if [ $SDK_PATH ]; then
15
    echo "SDK_PATH:"
16
    echo "$SDK_PATH"
17
    echo ""
18
else
19
    echo "ERROR: Please export SDK_PATH in gen_misc.sh firstly, exit!!!"
20
    exit
21
fi
22

    
23
if [ $BIN_PATH ]; then
24
    echo "BIN_PATH:"
25
    echo "$BIN_PATH"
26
    echo ""
27
else
28
    echo "ERROR: Please export BIN_PATH in gen_misc.sh firstly, exit!!!"
29
    exit
30
fi
31

    
32
echo "Please check SDK_PATH & BIN_PATH, enter (Y/y) to continue:"
33
read input
34

    
35
if [[ $input != Y ]] && [[ $input != y ]]; then
36
    exit
37
fi
38

    
39
echo ""
40

    
41
echo "Please follow below steps(1-5) to generate specific bin(s):"
42
echo "STEP 1: use boot_v1.2+ by default"
43
boot=new
44

    
45
echo "boot mode: $boot"
46
echo ""
47

    
48
echo "STEP 2: choose bin generate(0=eagle.flash.bin+eagle.irom0text.bin, 1=user1.bin, 2=user2.bin)"
49
echo "enter (0/1/2, default 0):"
50
read input
51

    
52
if [ -z "$input" ]; then
53
    if [ $boot != none ]; then
54
    	boot=none
55
	echo "ignore boot"
56
    fi
57
    app=0
58
    echo "generate bin: eagle.flash.bin+eagle.irom0text.bin"
59
elif [ $input == 1 ]; then
60
    if [ $boot == none ]; then
61
    	app=0
62
	echo "choose no boot before"
63
	echo "generate bin: eagle.flash.bin+eagle.irom0text.bin"
64
    else
65
	app=1
66
        echo "generate bin: user1.bin"
67
    fi
68
elif [ $input == 2 ]; then
69
    if [ $boot == none ]; then
70
    	app=0
71
	echo "choose no boot before"
72
	echo "generate bin: eagle.flash.bin+eagle.irom0text.bin"
73
    else
74
    	app=2
75
    	echo "generate bin: user2.bin"
76
    fi
77
else
78
    if [ $boot != none ]; then
79
    	boot=none
80
	echo "ignore boot"
81
    fi
82
    app=0
83
    echo "generate bin: eagle.flash.bin+eagle.irom0text.bin"
84
fi
85

    
86
echo ""
87

    
88
echo "STEP 3: choose spi speed(0=20MHz, 1=26.7MHz, 2=40MHz, 3=80MHz)"
89
echo "enter (0/1/2/3, default 2):"
90
read input
91

    
92
if [ -z "$input" ]; then
93
    spi_speed=40
94
elif [ $input == 0 ]; then
95
    spi_speed=20
96
elif [ $input == 1 ]; then
97
    spi_speed=26.7
98
elif [ $input == 3 ]; then
99
    spi_speed=80
100
else
101
    spi_speed=40
102
fi
103

    
104
echo "spi speed: $spi_speed MHz"
105
echo ""
106

    
107
echo "STEP 4: choose spi mode(0=QIO, 1=QOUT, 2=DIO, 3=DOUT)"
108
echo "enter (0/1/2/3, default 0):"
109
read input
110

    
111
if [ -z "$input" ]; then
112
    spi_mode=QIO
113
elif [ $input == 1 ]; then
114
    spi_mode=QOUT
115
elif [ $input == 2 ]; then
116
    spi_mode=DIO
117
elif [ $input == 3 ]; then
118
    spi_mode=DOUT
119
else
120
    spi_mode=QIO
121
fi
122

    
123
echo "spi mode: $spi_mode"
124
echo ""
125

    
126
echo "STEP 5: choose spi size and map"
127
echo "    0= 512KB( 256KB+ 256KB)"
128
echo "    2=1024KB( 512KB+ 512KB)"
129
echo "    3=2048KB( 512KB+ 512KB)"
130
echo "    4=4096KB( 512KB+ 512KB)"
131
echo "    5=2048KB(1024KB+1024KB)"
132
echo "    6=4096KB(1024KB+1024KB)"
133
echo "enter (0/2/3/4/5/6, default 0):"
134
read input
135

    
136
if [ -z "$input" ]; then
137
    spi_size_map=0
138
    echo "spi size: 512KB"
139
    echo "spi ota map:  256KB + 256KB"
140
elif [ $input == 2 ]; then
141
    spi_size_map=2
142
    echo "spi size: 1024KB"
143
    echo "spi ota map:  512KB + 512KB"
144
elif [ $input == 3 ]; then
145
    spi_size_map=3
146
    echo "spi size: 2048KB"
147
    echo "spi ota map:  512KB + 512KB"
148
elif [ $input == 4 ]; then
149
    spi_size_map=4
150
    echo "spi size: 4096KB"
151
    echo "spi ota map:  512KB + 512KB"
152
elif [ $input == 5 ]; then
153
    spi_size_map=5
154
    echo "spi size: 2048KB"
155
    echo "spi ota map:  1024KB + 1024KB"
156
elif [ $input == 6 ]; then
157
    spi_size_map=6
158
    echo "spi size: 4096KB"
159
    echo "spi ota map:  1024KB + 1024KB"
160
else
161
    spi_size_map=0
162
    echo "spi size: 512KB"
163
    echo "spi ota map:  256KB + 256KB"
164
fi
165

    
166
echo ""
167

    
168
echo "start..."
169
echo ""
170

    
171
make clean
172

    
173
make BOOT=$boot APP=$app SPI_SPEED=$spi_speed SPI_MODE=$spi_mode SPI_SIZE_MAP=$spi_size_map