-
Notifications
You must be signed in to change notification settings - Fork 0
/
extra_script.py
74 lines (54 loc) · 1.63 KB
/
extra_script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
from os.path import join
Import("env", "projenv")
# access to global build environment
print(env)
# access to project build environment (is used source files in "src" folder)
print(projenv)
#
# Dump build environment (for debug purpose)
# print(env.Dump())
#
#
# Change build flags in runtime
#
# env.ProcessUnFlags("-DVECT_TAB_ADDR")
# env.Append(CPPDEFINES=("VECT_TAB_ADDR", 0x123456789))
# #
# # Upload actions
# #
# def before_upload(source, target, env):
# print("before_upload")
# # do some actions
# # call Node.JS or other script
# env.Execute("node --version")
# def after_upload(source, target, env):
# print("after_upload")
# # do some actions
# print("Current build targets", map(str, BUILD_TARGETS))
# env.AddPreAction("upload", before_upload)
# env.AddPostAction("upload", after_upload)
# #
# # Custom actions when building program/firmware
# #
# env.AddPreAction("buildprog", callback...)
# env.AddPostAction("buildprog", callback...)
# #
# # Custom actions for specific files/objects
# #
# env.AddPreAction("$BUILD_DIR/${PROGNAME}.elf", [callback1, callback2,...])
# env.AddPostAction("$BUILD_DIR/${PROGNAME}.hex", callback...)
# # custom action before building SPIFFS image. For example, compress HTML, etc.
# env.AddPreAction("$BUILD_DIR/spiffs.bin", callback...)
# # custom action for project's main.cpp
# env.AddPostAction("$BUILD_DIR/src/main.cpp.o", callback...)
# Custom HEX from ELF
# Custom BIN from ELF
env.AddPostAction(
"$BUILD_DIR/${PROGNAME}.elf",
env.VerboseAction(" ".join([
"$OBJCOPY",
"-O",
"binary",
"$TARGET",
"$BUILD_DIR/${PROGNAME}.bin"
]), "Building $TARGET"))