Espruino/scripts/check_size.sh
Tim Newsom ac7d4f4359 This update adds additional support for file. Files can now be opened
closed, read, written in bytes by position (block reads and writes) and
piped to other files during idle periods (for large files).

check_size.sh has a modification for OSX that allows the same
functionality as on other unix like environments.  Since DU does not
function the same, gdu must be loaded on the system (through macports or
some other channel). The modification is simply to use gdu instead of
du.

This commit also includes a QT creator project file and associated
settings.
2014-04-19 20:39:28 -07:00

32 lines
966 B
Bash

#!/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/.
#
# -----------------------------------------------------------------------------
# Check that the size of the binary is within limits
# -----------------------------------------------------------------------------
cd `dirname $0`
cd ..
FILE=$1
# just a random check...
MAXSIZE=`grep FLASH_AVAILABLE_FOR_CODE gen/platform_config.h | sed "s/[^0-9]*\([0-9][0-9]*\).*/\1/"`
ACTUALSIZE=$(/opt/local/bin/gdu -b "$FILE" | cut -f 1)
if [ $ACTUALSIZE -ge $MAXSIZE ]; then
echo FAIL - size of $ACTUALSIZE is over $MAXSIZE bytes
exit 1
else
echo PASS - size of $ACTUALSIZE is under $MAXSIZE bytes
exit 0
fi