Verified Commit b57d3b92 authored by Rahix's avatar Rahix
Browse files

refactor(upy): Enhance build system wrapper



QSTR generation is a pain ...

Signed-off-by: Rahix's avatarRahix <rahix@rahix.de>
parent c30d297a
#!/bin/sh
set -xe
cd "$(dirname "$0")" || exit 1
cd "$(dirname "$0")"
test -d build/ && rm -r build/
git submodule update --init --recursive
git submodule update --init ./lib/micropython
meson --cross-file card10-cross.ini build/
set +x
......
......@@ -31,7 +31,8 @@ modules_h = custom_target(
qstr_h = custom_target(
'qstrdefs.generated.h',
output: 'qstrdefs.generated.h',
input: [modules_h, version_h, micropython_sources, 'modules/qstr.h'],
input: ['modules/qstrdefs.h', micropython_sources],
depends: [modules_h, version_h],
command: [micropython_gen_qstr, meson.current_source_dir(), '@OUTPUT@', '@INPUT@'],
)
......
MP_QSTR_leds
MP_QSTR_set_dim
MP_QSTR_utime
MP_QSTR_sleep
MP_QSTR_sleep_ms
MP_QSTR_sleep_us
MP_QSTR_ticks_ms
MP_QSTR_ticks_us
MP_QSTR_ticks_cpu
MP_QSTR_ticks_add
MP_QSTR_ticks_diff
MP_QSTR_buzzer
#include "py/mpconfig.h"
/* buzzer */
Q(buzzer)
/* leds */
Q(leds)
Q(set_dim)
/* utime */
Q(utime)
Q(sleep)
Q(sleep_ms)
Q(sleep_us)
Q(ticks_ms)
Q(ticks_us)
Q(ticks_cpu)
Q(ticks_add)
Q(ticks_diff)
......@@ -5,7 +5,7 @@ PYTHON="$1"
SOURCE_DIR="$2"
PROJECT_SRC="$3"
OUTPUT="$4"
# IGNORE="$5"
CUSTOM_QSTR="$5"
shift 5
......@@ -27,7 +27,7 @@ gcc -E -DNO_QSTR -I"$SOURCE_DIR/micropython" -I"$PROJECT_SRC" -I"$OUTPUT_DIR" "$
# Preprocess Header ... I did not come up with this, this is code copied from
# the official make file. Seriously.
cat "$SOURCE_DIR/micropython/py/qstrdefs.h" "$OUTPUT_DIR/qstrdefs.collected.h" \
cat "$SOURCE_DIR/micropython/py/qstrdefs.h" "$CUSTOM_QSTR" "$OUTPUT_DIR/qstrdefs.collected.h" \
| sed 's/^Q(.*)/"&"/' \
| gcc -E -I"$SOURCE_DIR/micropython" -I"$PROJECT_SRC" -I"$OUTPUT_DIR" - \
| sed 's/^\"\(Q(.*)\)\"/\1/' \
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment