forked from espruino/Espruino
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_pico_image_1v3.sh
More file actions
executable file
·64 lines (48 loc) · 2.09 KB
/
Copy pathcreate_pico_image_1v3.sh
File metadata and controls
executable file
·64 lines (48 loc) · 2.09 KB
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
#!/bin/bash
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# ----------------------------------------------------------------------------------------
# Creates a binary file containing both Espruino and the bootloader
# ----------------------------------------------------------------------------------------
cd `dirname $0` # scripts
cd .. # main dir
BASEDIR=`pwd`
BOARDNAME=PICO_R1_3
ESPRUINOFILE=`python scripts/get_board_info.py $BOARDNAME "common.get_board_binary_name(board)"`
BOOTLOADERFILE=bootloader_$ESPRUINOFILE
IMGFILE=pico_full.bin
rm -f $ESPRUINOFILE $BOOTLOADERFILE $IMGFILE
export BOARD=PICO_R1_3
# export DEBUG=1
export RELEASE=1
BOOTLOADER=1 make clean
BOOTLOADER=1 make || { echo 'Build failed' ; exit 1; }
make clean
make || { echo 'Build failed' ; exit 1; }
BOOTLOADERSIZE=`python scripts/get_board_info.py $BOARDNAME "common.get_espruino_binary_address(board)"`
IMGSIZE=$(expr $BOOTLOADERSIZE + $(du "$ESPRUINOFILE" | cut -f1))
echo ---------------------
echo Image Size = $IMGSIZE
echo ---------------------
echo Create blank image
echo ---------------------
tr "\000" "\377" < /dev/zero | dd bs=1 count=$IMGSIZE of=$IMGFILE || { echo 'Build failed' ; exit 1; }
echo Add bootloader
echo ---------------------
dd bs=1 if=$BOOTLOADERFILE of=$IMGFILE conv=notrunc || { echo 'Build failed' ; exit 1; }
echo Add espruino
echo ---------------------
dd bs=1 seek=$BOOTLOADERSIZE if=$ESPRUINOFILE of=$IMGFILE conv=notrunc || { echo 'Build failed' ; exit 1; }
cp $IMGFILE $ESPRUINOFILE || { echo 'Build failed' ; exit 1; }
echo ---------------------
echo Finished! Written to $IMGFILE and copied to $ESPRUINOFILE
echo dfu-util -a 0 -s 0x08000000 -D ${ESPRUINOFILE}
echo ---------------------
#echo python scripts/stm32loader.py -b 460800 -ewv $IMGFILE
#python scripts/stm32loader.py -b 460800 -ewv $IMGFILE