Skip to content

Commit 8b8aeac

Browse files
committed
non-working. fix line endings, change parameter case.
1 parent 8c2a4da commit 8b8aeac

File tree

2 files changed

+34
-21
lines changed

2 files changed

+34
-21
lines changed

README.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ This is the main script to build MicroPython for the ESP8266
1313
Usage:
1414
./build_esp8266.sh [OPTION]
1515

16-
OPTIONS
16+
OPTIONS (note the change to lower case, and addtion of --prefix since last release!)
1717

18-
HELP
18+
--help
1919
show this help. Source will be placed in ~/workspace/ directory.
2020

21-
FULL
21+
--full
2222
Update OS and installed apps, download latest esp-open-sdk and micropython, build everything, erase and upload new binary to /dev/ttyUSB0
2323

24-
MAKE-ONLY
24+
--make-only
2525
Download latest esp-open-sdk and micropython, build everything.
2626

27-
MAKE-ONLY-ESP8266
27+
--MAKE-ONLY-ESP8266
2828
Download latest micropython and build (skip esp-open-sdk).
2929

30-
RUN-TESTS
30+
--RUN-TESTS
3131
Run the esp8266 test script
3232

33-
FLASH-ONLY
33+
--FLASH-ONLY
3434
Only writing existing flash to device. (no updates, no build)
3535

3636

@@ -50,6 +50,18 @@ which really just does this:
5050
~/workspace/esptool/esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash 0 ~/workspace/micropython/esp8266/build/firmware-combined.bin
5151
```
5252

53+
## Known issues:
54+
Errors like this mean that the bash file was edited in Windows:
55+
56+
```
57+
./build_esp8266.sh: line 65: $'\r': command not found
58+
```
59+
60+
to fix:
61+
62+
```
63+
dos2unix build_esp8266.sh
64+
```
5365

5466
## Comments & Feedback
5567
You can leave messages on the MicroPython forum:

build_esp8266.sh

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,40 +58,41 @@
5858
# this has caused problems for new users before. Please see "How to correctly power my module up?"
5959
# section of the "Technical FAQ".
6060
#
61-
MYDEVICE="/dev/ttyUSB0"
61+
# MYDEVICE="/dev/ttyUSB0" # regular linux devices
62+
MYDEVICE="/dev/ttyS3"
6263
MYBAUD="115200" # could be as high as 460800
6364
DEVICEFOUND=0
6465

6566
#*******************************************************************************************************
6667
# startup: show help as needed
6768
#*******************************************************************************************************
68-
if [ "$1" == "" ] || [ "$1" == "HELP" ]; then
69+
if [ "$1" == "" ] || [ "$1" == "--help" ]; then
6970
echo "Usage:"
7071
echo "build_esp8266 [OPTION]"
7172
echo ""
7273
echo "OPTIONS"
7374
echo ""
74-
echo " HELP"
75+
echo " --help"
7576
echo " show this help. Source will be placed in ~/workspace/ directory."
7677
echo ""
77-
echo " FULL"
78+
echo " --full"
7879
echo " Update OS and installed apps, download latest esp-open-sdk and micropython, build everything, erase and upload new binary to $MYDEVICE"
7980
echo ""
80-
echo " MAKE-ONLY"
81+
echo " --make-only"
8182
echo " Download latest esp-open-sdk and micropython, build everything."
8283
echo ""
83-
echo " MAKE-ONLY-ESP8266"
84+
echo " --make-only-esp8266"
8485
echo " Download latest micropython and build (skip esp-open-sdk)."
8586
echo ""
86-
echo " RUN-TESTS"
87+
echo " --run-tests"
8788
echo " Run the esp8266 test script"
8889
echo ""
89-
echo " FLASH-ONLY"
90+
echo " --flash-only"
9091
echo " Only writing existing flash to device. (no updates, no build)"
9192
exit 0
9293
fi
9394

94-
if [ "$1" != "FULL" ] && [ "$1" != "MAKE-ONLY" ] && [ "$1" != "MAKE-ONLY-ESP8266" ] && [ "$1" != "FLASH-ONLY" ] && [ "$1" != "RUN-TESTS" ]; then
95+
if [ "$1" != "--full" ] && [ "$1" != "--make-only" ] && [ "$1" != "--make-only-esp8266" ] && [ "$1" != "--flash-only" ] && [ "$1" != "--run-tests" ]; then
9596
echo "$1 not a valid option. try ./build_esp8266.sh HELP "
9697
exit 0
9798
fi
@@ -252,7 +253,7 @@ fi
252253
#*******************************************************************************************************
253254
# check if we are doing a FULL update, inclusing OS updates
254255
#*******************************************************************************************************
255-
if [ "$1" == "FULL" ]; then
256+
if [ "$1" == "--full" ]; then
256257
echo "*************************************************************************************************"
257258
echo "*************************************************************************************************"
258259
if [[ -a /home/pi/ ]]; then
@@ -345,7 +346,7 @@ if ! [[ -a ~/workspace ]]; then
345346
mkdir ~/workspace
346347
fi
347348

348-
if [ "$1" == "MAKE-ONLY" ] || [ "$1" == "FULL" ]; then
349+
if [ "$1" == "--make-only" ] || [ "$1" == "--full" ]; then
349350
#*******************************************************************************************************
350351
# check that gcc is installed before attempting to build
351352
#*******************************************************************************************************
@@ -443,7 +444,7 @@ fi
443444
#*******************************************************************************************************
444445
# next, fetch micropython source from github and build, as needed (skip if we are only writing firmware)
445446
#*******************************************************************************************************
446-
if [ "$1" == "FULL" ] || [ "$1" == "MAKE-ONLY" ] || [ "$1" == "MAKE-ONLY-ESP8266" ] || [ "$1" == "RUN-TESTS" ]; then
447+
if [ "$1" == "--full" ] || [ "$1" == "--make-only" ] || [ "$1" == "--make-only-esp8266" ] || [ "$1" == "--run-tests" ]; then
447448
cd ~/workspace
448449

449450
if ! [[ -a ~/workspace/micropython ]]; then
@@ -478,7 +479,7 @@ make -C mpy-cross
478479
#*******************************************************************************************************
479480
# check if we are only running tests (note we need to ensure we have the lasted MicroPython scripts!)
480481
#*******************************************************************************************************
481-
if [ "$1" == "RUN-TESTS" ]; then
482+
if [ "$1" == "--run-tests" ]; then
482483
echo "*************************************************************************************************"
483484
echo "*************************************************************************************************"
484485
echo "* Running MicroPython tests... "
@@ -494,7 +495,7 @@ fi
494495
#*******************************************************************************************************
495496
# build the esp8266 MicroPython firmware
496497
#*******************************************************************************************************
497-
if [ "$1" == "FULL" ] || [ "$1" == "MAKE-ONLY" ] || [ "$1" == "MAKE-ONLY-ESP8266" ]; then
498+
if [ "$1" == "--full" ] || [ "$1" == "--make-only" ] || [ "$1" == "--make-only-esp8266" ]; then
498499
echo "*************************************************************************************************"
499500
echo "*************************************************************************************************"
500501
echo "* Build ESP8266"

0 commit comments

Comments
 (0)