Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI waveform flavour select #7715

Merged
merged 12 commits into from
Nov 20, 2020
10 changes: 7 additions & 3 deletions tests/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ function build_sketches()
local sketches=$(find $srcpath -name *.ino | sort)
print_size_info >size.log
export ARDUINO_IDE_PATH=$arduino
local pwm_phase=""
[ $(( $build_rem % 2 )) -eq 0 ] && local pwm_phase="--waveform_phase"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bash is a monster, isn't it? I was about to make a comment that you wanted == but then realized you're generating local.

Not sure if the local here is needed since you already made one on the prior line.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the second local

local testcnt=0
for sketch in $sketches; do
testcnt=$(( ($testcnt + 1) % $build_mod ))
Expand Down Expand Up @@ -104,16 +106,16 @@ function build_sketches()
fi
echo -e "\n ------------ Building $sketch ------------ \n";
# $arduino --verify $sketch;
if [ "$WINDOWS" == "1" ]; then
if [ "$WINDOWS" == "1" ]; then
sketch=$(echo $sketch | sed 's/^\/c//')
# MINGW will try to be helpful and silently convert args that look like paths to point to a spot inside the MinGW dir. This breaks everything.
# http://www.mingw.org/wiki/Posix_path_conversion
# https://stackoverflow.com/questions/7250130/how-to-stop-mingw-and-msys-from-mangling-path-names-given-at-the-command-line#34386471
export MSYS2_ARG_CONV_EXC="*"
export MSYS_NO_PATHCONV=1
fi
echo "$build_cmd $sketch"
time ($build_cmd $sketch >build.log)
echo "$build_cmd $pwm_phase $sketch"
time ($build_cmd $pwm_phase $sketch >build.log)
local result=$?
if [ $result -ne 0 ]; then
echo "Build failed ($1)"
Expand All @@ -128,6 +130,8 @@ function build_sketches()
cat build.log
fi
fi
# TEMPORARY TESTING
cat build.log
rm build.log
print_size_info $build_dir/*.elf >>size.log
done
Expand Down
4 changes: 4 additions & 0 deletions tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ def compile(tmp_dir, sketch, cache, tools_dir, hardware_dir, ide_path, f, args):
'ResetMethod=nodemcu'.format(**vars(args))
if args.debug_port and args.debug_level:
fqbn += 'dbg={debug_port},lvl={debug_level}'.format(**vars(args))
if args.waveform_phase:
fqbn += ',waveform=phase'
cmd += [fqbn]
cmd += ['-built-in-libraries', ide_path + '/libraries']
cmd += ['-ide-version=10607']
Expand Down Expand Up @@ -115,6 +117,8 @@ def parse_args():
type=int, choices=[40, 80])
parser.add_argument('--debug_port', help='Debug port',
choices=['Serial', 'Serial1'])
parser.add_argument('--waveform_phase', action='store_true',
help='Select waveform locked on phase')
parser.add_argument('--debug_level', help='Debug level')
parser.add_argument('--build_cache', help='Build directory to cache core.a', default='')
parser.add_argument('sketch_path', help='Sketch file path')
Expand Down
6 changes: 3 additions & 3 deletions tools/platformio-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ def scons_patched_match_splitext(path, suffixes=None):
#
# Waveform
#
if "PIO_FRAMEWORK_ARDUINO_WAVEFORM_LOCKED_PWM" in flatten_cppdefines:
env.Append(CPPDEFINES=[("WAVEFORM_LOCKED_PWM", 1)])
# PIO_FRAMEWORK_ARDUINO_WAVEFORM_LOCKED_PHASE will be used by default
if "PIO_FRAMEWORK_ARDUINO_WAVEFORM_LOCKED_PHASE" in flatten_cppdefines:
env.Append(CPPDEFINES=[("WAVEFORM_LOCKED_PHASE", 1)])
# PIO_FRAMEWORK_ARDUINO_WAVEFORM_LOCKED_PWM will be used by default

#
# VTables
Expand Down