forked from ethersex/ethersex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.in
358 lines (296 loc) · 11.7 KB
/
config.in
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
source scripts/usart-config.sh
source scripts/periodic-config.sh
source scripts/rfm12-config.sh
source scripts/namedPinCopy.sh
source scripts/avrdude_config.sh
mainmenu_name "Ethersex Configuration"
get_usart_count
mainmenu_option next_comment
comment "General Setup"
get_usart_count
choice 'Target Architecture' \
"AVR ARCH_AVR \
Host ARCH_HOST" \
'AVR' ARCH
if [ "$ARCH_AVR" = "y" ]; then
choice 'Target MCU' \
"ATmega8 atmega8 \
ATmega88 atmega88 \
ATmega128 atmega128 \
ATmega16 atmega16 \
ATmega162 atmega162 \
ATmega168 atmega168 \
ATmega168p atmega168p \
ATmega169 atmega169 \
ATmega32 atmega32 \
ATmega328p atmega328p \
ATmega32u4 atmega32u4 \
ATmega64 atmega64 \
ATmega644 atmega644 \
ATmega644p atmega644p \
ATmega1284p atmega1284p \
ATmega2560 atmega2560 \
AT90CAN32 at90can32 \
AT90CAN64 at90can64 \
AT90CAN128 at90can128" \
'ATmega644' MCU
int "MCU frequency" FREQ 20000000
choice 'Hardware/Periphery Class' \
"$(scripts/pinning_hardware_list.sh)" \
'Etherrape' HARDWARE
dep_bool "Use CPU sleep" CPU_SLEEP $ARCH_AVR
source hardware/sram/config.in
# get the flash size according to the cpu type
FLASH_SIZE=$((`echo -e "#include <avr/io.h>\nFLASHEND" | avr-cpp -P -mmcu=$MCU | sed '$!d'` + 1 ))
# set the default bootloader bytes according to cpu flash size
if [ "$BOOTLOADER_SIZE" = "" ] ; then
if [ "$FLASH_SIZE" = 8192 ] ; then BOOTLOADER_SIZE=2048 ; fi
if [ "$FLASH_SIZE" = 16384 ] ; then BOOTLOADER_SIZE=2048 ; fi
if [ "$FLASH_SIZE" = 32768 ] ; then BOOTLOADER_SIZE=4096 ; fi
if [ "$FLASH_SIZE" = 65536 ] ; then BOOTLOADER_SIZE=8192 ; fi
if [ "$FLASH_SIZE" = 131072 ] ; then BOOTLOADER_SIZE=8192 ; fi
fi
dep_bool 'Build a bootloader' BOOTLOADER_SUPPORT "$(not $BOOTLOADER_JUMP)" "$(if [ $FLASH_SIZE -gt 65535 ] ; then echo -ne "y"; else echo -ne "n"; fi)"
dep_bool "Enable bootloader jump" BOOTLOADER_JUMP "$(not $BOOTLOADER_SUPPORT)"
if [ "$BOOTLOADER_JUMP" = "y" -o "$BOOTLOADER_SUPPORT" = "y" ] ; then
int 'Bootloader size in bytes' BOOTLOADER_SIZE ""
else
define_int BOOTLOADER_SIZE "$((BOOTLOADER_SIZE))"
fi
define_hex BOOTLOADER_START_ADDRESS "$(printf '0x%X\n' $(($FLASH_SIZE - $BOOTLOADER_SIZE)))"
define_hex FLASH_SIZE "$(printf '0x%X\n' $FLASH_SIZE)"
define_hex EEPROM_SIZE "$(printf '0x%X\n' $((`echo -e "#include <avr/io.h>\nE2END" | avr-cpp -P -mmcu=$MCU | sed '$!d'` + 1)))"
define_hex RAM_SIZE "$(printf '0x%X\n' $((`echo -e "#include <avr/io.h>\nRAMEND-RAMSTART" | avr-cpp -P -mmcu=$MCU | sed '$!d'` + 1)))"
define_hex FLASH_PAGESIZE "$(printf '0x%X\n' $((`echo -e "#include <avr/io.h>\nSPM_PAGESIZE" | avr-cpp -P -mmcu=$MCU | sed '$!d'`)))"
define_hex EEPROM_PAGESIZE "$(printf '0x%X\n' $((`echo -e "#include <avr/io.h>\nE2PAGESIZE" | avr-cpp -P -mmcu=$MCU | sed '$!d'`)))"
source core/crc/config.in
fi
bool "MBR support" MBR_SUPPORT
bool "Teensy build" TEENSY_SUPPORT
dep_bool "Use SPI Timeout" SPI_TIMEOUT $ARCH_AVR
dep_bool "Use Usart in SPI Mode" USART_SPI_SUPPORT $ARCH_AVR
if [ "$USART_SPI_SUPPORT" = y ]; then
choice ' SPI usart select' "$(usart_choice SPI)"
usart_process_choice SPI
else
dep_bool "Use Software-SPI" SOFT_SPI_SUPPORT $ARCH_AVR
fi
define_string GIT_VERSION "$(scripts/get-git-version)"
bool 'Debug: Discard some packets' DEBUG_DISCARD_SOME
# general debug support
dep_bool_menu "Enable Debugging" DEBUG y
comment "Debugging output"
usart_count_used
debug_output_choices=""
# enable choice of USART if there is one used by either
# debug or ecmd or if there is at least one unused USART
if [ "$DEBUG_SERIAL_USART_SUPPORT" = y \
-o "$ECMD_SERIAL_USART_SUPPORT" = y \
-o $USARTS -gt $USARTS_USED ]; then
debug_output_choices="USART usart "
debug_output_default="USART"
else
comment "USART (RS232/RS485) not available. No free usart. ($USARTS_USED/$USARTS)"
fi
if [ "$ARCH_AVR" = y ]; then
debug_output_choices+="Software-UART soft_uart "
test -n "$debug_output_default" || debug_output_default="Software-UART"
fi
# to send debug via syslog one has to enable
# protocols > SYSLOG_SUPPORT first
if [ "$SYSLOG_SUPPORT" = y ]; then
debug_output_choices+="SYSLOG syslog "
test -n "$debug_output_default" || debug_output_default="SYSLOG"
fi
if [ "$DEBUG" = y ] && [ -n "$debug_output_choices" ]; then
choice 'Debug output channel' \
"$debug_output_choices" \
"$debug_output_default" DEBUG_OUTPUT
fi
case "$DEBUG_OUTPUT" in
"usart")
define_bool DEBUG_SERIAL_USART_SUPPORT $DEBUG
define_bool SOFT_UART_SUPPORT n
define_bool DEBUG_USE_SYSLOG n
;;
"soft_uart")
define_bool SOFT_UART_SUPPORT $DEBUG $ARCH_AVR
define_bool DEBUG_SERIAL_USART_SUPPORT n
define_bool DEBUG_USE_SYSLOG n
;;
"syslog")
define_bool DEBUG_USE_SYSLOG $DEBUG $SYSLOG_SUPPORT
define_bool DEBUG_SERIAL_USART_SUPPORT n
define_bool SOFT_UART_SUPPORT n
;;
*)
define_bool DEBUG_USE_SYSLOG $DEBUG n
define_bool DEBUG_SERIAL_USART_SUPPORT n
define_bool SOFT_UART_SUPPORT n
;;
esac
if [ "$DEBUG_SERIAL_USART_SUPPORT" = y ]; then
choice 'Debug USART channel' "$(usart_choice DEBUG)"
usart_process_choice DEBUG
# share ECMD baud settings if the USART is shared
if [ "$ECMD_SERIAL_USART_SUPPORT" = y ] && \
[ "$DEBUG_USE_USART" = "$ECMD_SERIAL_USART_USE_USART" ] ; then
define_int DEBUG_BAUDRATE $ECMD_SERIAL_BAUDRATE
comment "USART Baudrate set to match ECMD setting ($DEBUG_BAUDRATE Baud)."
else
int "USART Baudrate" DEBUG_BAUDRATE 115200
fi
elif [ "$SOFT_UART_SUPPORT" = y ]; then
int "Software-UART Baudrate" DEBUG_BAUDRATE 19200
fi
dep_bool 'Watchdog in debug mode' DEBUG_USE_WATCHDOG $DEBUG
comment 'Debugging Flags'
dep_bool 'Hooks' DEBUG_HOOK $DEBUG
dep_bool 'Reset Reason' DEBUG_RESET_REASON $DEBUG
endmenu
source core/config.in
source core/crypto/config.in
source core/vfs/config.in
source services/pam/config.in
source control6/config.in
endmenu
mainmenu_option next_comment
comment "Network"
string "Hostname" CONF_HOSTNAME "ethersex"
# if [ "$ENC28J60_SUPPORT" = "y" -o "$RFM12_IP_SUPPORT" = "y" -o "$ZBUS_SUPPORT" = "y" -o "$UIP_SUPPORT" = "y" -o "$UDP_SUPPORT" = "y" -o "$TCP_SUPPORT" = "y" -o "$ICMP_SUPPORT" = "y" ]; then
if [ "$NET_MAX_FRAME_LENGTH" = "" ] ; then NET_MAX_FRAME_LENGTH=1500 ; fi
if [ "$NET_MAX_FRAME_LENGTH" -lt 64 -o "$NET_MAX_FRAME_LENGTH" -gt 1500 ] ; then NET_MAX_FRAME_LENGTH=1500 ; fi
if [ "$atmega8" = "y" -o "$atmega88" = "y" -o "$atmega16" = "y" -o "$atmega168" = "y" -o "$atmega169" = "y" -o "$atmega168p" = "y" ] ; then
if [ "$NET_MAX_FRAME_LENGTH" -gt 192 ] ; then NET_MAX_FRAME_LENGTH=192 ; fi
fi
if [ "$atmega32" = "y" ] ; then
if [ "$TEENSY_SUPPORT" = "y" ] ; then
if [ "$NET_MAX_FRAME_LENGTH" -gt 192 ] ; then NET_MAX_FRAME_LENGTH=192 ; fi
else
if [ "$NET_MAX_FRAME_LENGTH" -gt 500 ] ; then NET_MAX_FRAME_LENGTH=500 ; fi
fi
fi
if [ "$atmega162" = "y" -a "$NET_MAX_FRAME_LENGTH" -gt 600 ] ; then NET_MAX_FRAME_LENGTH=600 ; fi
if [ "$atmega328p" = "y" -a "$NET_MAX_FRAME_LENGTH" -gt 384 ] ; then NET_MAX_FRAME_LENGTH=384 ; fi
Value=$NET_MAX_FRAME_LENGTH
int "Network Buffer Size" NET_MAX_FRAME_LENGTH $NET_MAX_FRAME_LENGTH
# fi
source hardware/ethernet/config.in
source core/host/tap-config.in
source hardware/radio/rfm12/config.in
dep_bool 'RFM12 raw' RFM12_RAW_SUPPORT $RFM12_IP_SUPPORT $ROUTER_SUPPORT $UDP_SUPPORT
if [ "$RFM12_RAW_SUPPORT" = y ]; then
int 'RFM12 raw UDP Port' RFM12_RAW_UDP_PORT 16962
fi
source protocols/usb/config.in
source protocols/zbus/config.in
dep_bool 'ZBUS raw' ZBUS_RAW_SUPPORT $ZBUS_SUPPORT $ROUTER_SUPPORT $UDP_SUPPORT
source scripts/ip-router-conf.sh
comment "IP configuration"
dep_bool 'IPv6 support' IPV6_SUPPORT $UIP_SUPPORT
if [ "$IPV6_SUPPORT" = "y" ]; then
define_bool IPV4_SUPPORT n
else
define_bool IPV4_SUPPORT $UIP_SUPPORT
fi
dep_bool 'Enable IP forwarding' IP_FORWARDING_SUPPORT $ROUTER_SUPPORT
dep_bool 'Enable TCP inactivity timeout' UIP_TIMEOUT_SUPPORT $UIP_SUPPORT
if [ "$UIP_TIMEOUT_SUPPORT" = "y" ]; then
int " TCP inactivity timeout (in minutes)" UIP_TIMEOUT_COUNT 10
fi
if [ "$IPV6_SUPPORT" != "y" -a "$BOOTP_SUPPORT" != "y" -o "$IPV6_STATIC_SUPPORT" = "y" ]; then
ip "Default gateway" CONF_ETHERSEX_GATEWAY "192.168.23.1" "2001:6f8:1209:f0:0:0:0:1"
fi
define_bool UIP_MULTI_STACK $ROUTER_SUPPORT
source protocols/uip/ipchair/config.in
source protocols/uip/config.in
source protocols/dns/config.in
if [ "$DHCP_SUPPORT" = "y" ]; then
dep_bool 'BOOTP (DHCP-like) support' BOOTP_SUPPORT "n"
else
dep_bool 'BOOTP (DHCP-like) support' BOOTP_SUPPORT $BROADCAST_SUPPORT $ENC28J60_SUPPORT $IPV4_SUPPORT
fi
dep_bool 'Write BOOTP data to EEPROM' BOOTP_TO_EEPROM_SUPPORT $BOOTLOADER_SUPPORT $BOOTP_SUPPORT
if [ "$BOOTP_SUPPORT" = "y" ]; then
dep_bool "DHCP support" DHCP_SUPPORT "n"
else
dep_bool "DHCP support" DHCP_SUPPORT $BROADCAST_SUPPORT $ENC28J60_SUPPORT $IPV4_SUPPORT
fi
comment "Tunneling protocols"
dep_bool_menu "OpenVPN" OPENVPN_SUPPORT $UDP_SUPPORT
hex "OpenVPN key" CONF_OPENVPN_KEY "00000000000000000000000000000000"
hex "OpenVPN HMAC key" CONF_OPENVPN_HMAC_KEY "00000000000000000000000000000000"
comment "OpenVPN IP configuration"
ip "OpenVPN IP address" CONF_OPENVPN_IP "192.168.23.244" "2001:6f8:1209:F0:0:0:0:1"
if [ "$IPV6_SUPPORT" = "y" ]; then
int "IP prefix length" CONF_OPENVPN_IP6_PREFIX_LEN 64
else
ipv4 "OpenVPN netmask" CONF_OPENVPN_IP4_NETMASK "255.255.255.0"
fi
comment "OpenVPN Remote"
dep_bool "Static OpenVPN Remote" OPENVPN_STATIC_REMOTE $OPENVPN_SUPPORT
if [ "$OPENVPN_STATIC_REMOTE" = "y" ]; then
ip "Remote IP" CONF_OPENVPN_REMOTE_IP "192.168.23.254" "2001:6f8:1209:f0:230:5ff:fe23:3f8"
fi
comment "OpenVPN Port"
int 'OpenVPN Port' CONF_OPENVPN_PORT 1194
endmenu
comment "Debugging Flags"
dep_bool 'Networking' DEBUG_NET $DEBUG
dep_bool ' Config' DEBUG_NET_CONFIG $DEBUG_NET
dep_bool ' IPv6' DEBUG_NET_IP6 $DEBUG
dep_bool ' OpenVPN' DEBUG_OPENVPN $DEBUG
dep_bool ' Router' DEBUG_ROUTER $DEBUG
dep_bool ' uIP' DEBUG_UIP $DEBUG
dep_bool ' Unknown packets' DEBUG_UNKNOWN_PACKETS $DEBUG_NET
endmenu
###############################################################################
mainmenu_option next_comment
comment "I/O"
if [ "$ARCH_HOST" = "y" ]; then
define_bool PORTIO_SUPPORT n
define_bool PORTIO_SIMPLE_SUPPORT n
define_bool NAMED_PIN_SUPPORT n
else
choice "I/O abstraction model (Port I/O)" \
"None CONFIG_IO_NONE \
Simple PORTIO_SIMPLE \
Full-featured PORTIO_FULL_FEATURED" \
Simple PORTIO_SCHEME
if [ x"$PORTIO_SCHEME" = x"PORTIO_SIMPLE" ]; then
define_bool PORTIO_SIMPLE_SUPPORT y
define_bool PORTIO_SUPPORT n
elif [ x"$PORTIO_SCHEME" = x"PORTIO_FULL_FEATURED" ]; then
define_bool PORTIO_SIMPLE_SUPPORT n
define_bool PORTIO_SUPPORT y
fi
source core/portio/config.in
fi
source core/tty/config.in
source hardware/config.in
source mcuf/config.in
endmenu
###############################################################################
source protocols/config.in
###############################################################################
source services/config.in
###############################################################################
if [ "$ZBUS_SUPPORT" = "y" \
-o "$YPORT_SUPPORT" = "y" \
-o "$MODBUS_SUPPORT" = "y" ]; then
define_bool USART_SUPPORT y
fi
if [ "$RFM12_IP_SUPPORT" = "y" -o "$RFM12_ASK_SUPPORT" = "y" -o "$RFM12_DISABLE" = "y" ]; then
define_bool RFM12_SUPPORT y
else
define_bool RFM12_SUPPORT n
fi
if [ "$UIP_SUPPORT" = "y" -a "$IPV6_SUPPORT" != "y" ]; then
define_bool IPV4_SUPPORT y
fi
if [ "$HAS_AVRDUDE" = "y" ]; then
mainmenu_option next_comment
comment "AVRDUDE configuration"
source scripts/avrdude_config.in
endmenu
fi