Skip to content

Commit 9217b6f

Browse files
committed
builder: Fix builder for rt-thread msh application
Signed-off-by: Huaqi Fang <578567190@qq.com>
1 parent e10ca28 commit 9217b6f

3 files changed

Lines changed: 24 additions & 12 deletions

File tree

builder/frameworks/_bare.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,19 @@
2626
"-Os",
2727
"-Wall", # show warnings
2828
"-ffunction-sections",
29-
"-fdata-sections"
29+
"-fdata-sections",
30+
"-fno-common"
3031
],
3132

3233
LINKFLAGS=[
3334
"-Os",
34-
"-nostartfiles",
35-
"--specs=nano.specs",
36-
"--specs=nosys.specs",
35+
"-ffunction-sections",
36+
"-fdata-sections",
37+
"-fno-common",
3738
"-Wl,--gc-sections"
3839
],
3940

40-
LIBS=["c"],
41+
LIBS=[],
4142
)
4243

4344
# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)

builder/frameworks/nuclei-sdk.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ def parse_nuclei_soc_predefined_cores(core_mk):
171171

172172
env.SConscript("_bare.py", exports="env")
173173

174+
target_map = join("$BUILD_DIR", "${PROGNAME}.map")
175+
174176
env.Append(
175177
CCFLAGS=[
176178
"-march=%s" % build_march,
@@ -188,6 +190,10 @@ def parse_nuclei_soc_predefined_cores(core_mk):
188190
"-march=%s" % build_march,
189191
"-mabi=%s" % build_mabi,
190192
"-mcmodel=%s" % build_mcmodel,
193+
"-Wl,-Map,%s" % target_map,
194+
"-nostartfiles",
195+
"--specs=nano.specs",
196+
"--specs=nosys.specs",
191197
"-u", "_isatty",
192198
"-u", "_write",
193199
"-u", "_sbrk",
@@ -214,14 +220,18 @@ def parse_nuclei_soc_predefined_cores(core_mk):
214220
],
215221

216222
LIBPATH=[
217-
"$BUILD_DIR",
218223
join(FRAMEWORK_DIR, "NMSIS", "Library", "DSP", "GCC"),
219224
join(FRAMEWORK_DIR, "NMSIS", "Library", "NN", "GCC")
220225
],
221226

222227
LIBS=["gcc", "m", "stdc++"]
223228
)
224229

230+
# WORKAROUND: If RT-Thread used, force it to include symbols from finsh
231+
# otherwise it will not be included
232+
if build_rtthread_msh == "1":
233+
env.Append(LINKFLAGS=["-u", "finsh_system_init"])
234+
225235
extra_incdirs = get_extra_soc_board_incdirs(build_soc, build_board)
226236
if extra_incdirs:
227237
env.Append(
@@ -235,20 +245,20 @@ def parse_nuclei_soc_predefined_cores(core_mk):
235245
#
236246
# Target: Build Nuclei SDK Libraries
237247
#
238-
248+
soclibname = "soc_" + build_soc
249+
boardlibname = "board_" + build_board
239250
libs = [
240251
env.BuildLibrary(
241-
join("$BUILD_DIR", "SoC", build_soc, "Common"),
252+
join("$BUILD_DIR", "SoC", build_soc, soclibname),
242253
join(FRAMEWORK_DIR, "SoC", build_soc, "Common")
243254
),
244255

245256
env.BuildLibrary(
246-
join("$BUILD_DIR", "SoC", build_soc, "Board", build_board),
257+
join("$BUILD_DIR", "SoC", build_soc, "Board", boardlibname),
247258
join(FRAMEWORK_DIR, "SoC", build_soc, "Board", build_board)
248259
)
249260
]
250261

251-
rtoslibs = []
252262
if selected_rtos == "FreeRTOS":
253263
libs.append(env.BuildLibrary(
254264
join("$BUILD_DIR", "RTOS", "FreeRTOS"),

platform.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def _add_default_debug_tools(self, board):
6363
board_cfg = join(
6464
sdk_dir, "SoC", build_soc, "Board", build_board, "openocd.cfg",
6565
)
66-
server_args = ["-f", board_cfg]
66+
server_args = ["-c", "debug_level 1", "-f", board_cfg]
6767
debug["tools"]["rv-link"] = {
6868
"hwids": [["0x28e9", "0x018a"]],
6969
"require_debug_port": True,
@@ -142,7 +142,8 @@ def _add_default_debug_tools(self, board):
142142
" monitor halt",
143143
"end",
144144
"define pio_reset_run_target",
145-
" monitor reset",
145+
" monitor halt",
146+
" monitor resume",
146147
"end",
147148
"target extended-remote $DEBUG_PORT",
148149
"$LOAD_CMDS",

0 commit comments

Comments
 (0)