Skip to content
Snippets Groups Projects
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: default avatarRahix <rahix@rahix.de>
parent c30d297a
No related branches found
No related tags found
No related merge requests found
#!/bin/sh #!/bin/sh
set -xe set -xe
cd "$(dirname "$0")" || exit 1 cd "$(dirname "$0")"
test -d build/ && rm -r build/ test -d build/ && rm -r build/
git submodule update --init --recursive git submodule update --init ./lib/micropython
meson --cross-file card10-cross.ini build/ meson --cross-file card10-cross.ini build/
set +x set +x
......
...@@ -31,7 +31,8 @@ modules_h = custom_target( ...@@ -31,7 +31,8 @@ modules_h = custom_target(
qstr_h = custom_target( qstr_h = custom_target(
'qstrdefs.generated.h', 'qstrdefs.generated.h',
output: '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@'], 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" ...@@ -5,7 +5,7 @@ PYTHON="$1"
SOURCE_DIR="$2" SOURCE_DIR="$2"
PROJECT_SRC="$3" PROJECT_SRC="$3"
OUTPUT="$4" OUTPUT="$4"
# IGNORE="$5" CUSTOM_QSTR="$5"
shift 5 shift 5
...@@ -27,7 +27,7 @@ gcc -E -DNO_QSTR -I"$SOURCE_DIR/micropython" -I"$PROJECT_SRC" -I"$OUTPUT_DIR" "$ ...@@ -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 # Preprocess Header ... I did not come up with this, this is code copied from
# the official make file. Seriously. # 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(.*)/"&"/' \ | sed 's/^Q(.*)/"&"/' \
| gcc -E -I"$SOURCE_DIR/micropython" -I"$PROJECT_SRC" -I"$OUTPUT_DIR" - \ | gcc -E -I"$SOURCE_DIR/micropython" -I"$PROJECT_SRC" -I"$OUTPUT_DIR" - \
| sed 's/^\"\(Q(.*)\)\"/\1/' \ | sed 's/^\"\(Q(.*)\)\"/\1/' \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment