changeset 0:faf27dbe1a63

scripts for initializing aftermarket FFS on Pirelli DP-L10
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 09 Jun 2023 03:27:40 +0000
parents
children acfe834e174f
files Makefile cmd/pirelli-am-ffsinit sh/pirelli-init-fc-ffs
diffstat 3 files changed, 50 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Fri Jun 09 03:27:40 2023 +0000
@@ -0,0 +1,11 @@
+INSTALL_PREFIX=	/opt/freecalypso
+
+all:
+
+clean:
+
+install:
+	mkdir -p ${INSTALL_PREFIX}/bin
+	install -c -m 755 sh/* ${INSTALL_PREFIX}/bin
+	mkdir -p ${INSTALL_PREFIX}/scripts
+	install -c -m 644 cmd/* ${INSTALL_PREFIX}/scripts
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmd/pirelli-am-ffsinit	Fri Jun 09 03:27:40 2023 +0000
@@ -0,0 +1,7 @@
+# This fc-fsio command script initializes aftermarket FFS for FreeCalypso fw
+# running on Pirelli DP-L10.
+
+format /fc-ffs
+pirelli-magnetite-init
+upload-subtree /opt/freecalypso/aud-pirelli /aud
+write-charging-config /opt/freecalypso/charging/pirelli/manual
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sh/pirelli-init-fc-ffs	Fri Jun 09 03:27:40 2023 +0000
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+if [ $# != 1 ]
+then
+	echo "usage: $0 ttyport" 1>&2
+	exit 1
+fi
+
+ffsagent=/opt/freecalypso/target-bin/ffsagent-pirelli-am.srec
+
+if [ ! -f $ffsagent ]
+then
+	echo "Error: $ffsagent is not installed" 1>&2
+	exit 1
+fi
+
+set -ex
+
+# erase the aftermarket FFS area first
+fc-loadtool -h pirelli -Petmoff -t 800 "$1" flash2 erase 0x480000 0x180000
+
+# By running fc-xram *immediately* after our fc-loadtool batch command
+# finishes with iota-off exit mode, we avoid giving the official fw
+# in flash an extra boot cycle.
+
+fc-xram -h pirelli -t 1300 "$1" $ffsagent rvinterf -b
+sleep .5
+fc-fsio exec /opt/freecalypso/scripts/pirelli-am-ffsinit
+sleep .3
+fc-shell poweroff
+sleep .1
+kill `cat /tmp/rvinterf.pid`