Skip to content

Commit

Permalink
builder: Fix builder for rt-thread msh application
Browse files Browse the repository at this point in the history
Signed-off-by: Huaqi Fang <578567190@qq.com>
  • Loading branch information
fanghuaqi committed Dec 23, 2020
1 parent e10ca28 commit 9217b6f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
11 changes: 6 additions & 5 deletions builder/frameworks/_bare.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,19 @@
"-Os",
"-Wall", # show warnings
"-ffunction-sections",
"-fdata-sections"
"-fdata-sections",
"-fno-common"
],

LINKFLAGS=[
"-Os",
"-nostartfiles",
"--specs=nano.specs",
"--specs=nosys.specs",
"-ffunction-sections",
"-fdata-sections",
"-fno-common",
"-Wl,--gc-sections"
],

LIBS=["c"],
LIBS=[],
)

# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
Expand Down
20 changes: 15 additions & 5 deletions builder/frameworks/nuclei-sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ def parse_nuclei_soc_predefined_cores(core_mk):

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

target_map = join("$BUILD_DIR", "${PROGNAME}.map")

env.Append(
CCFLAGS=[
"-march=%s" % build_march,
Expand All @@ -188,6 +190,10 @@ def parse_nuclei_soc_predefined_cores(core_mk):
"-march=%s" % build_march,
"-mabi=%s" % build_mabi,
"-mcmodel=%s" % build_mcmodel,
"-Wl,-Map,%s" % target_map,
"-nostartfiles",
"--specs=nano.specs",
"--specs=nosys.specs",
"-u", "_isatty",
"-u", "_write",
"-u", "_sbrk",
Expand All @@ -214,14 +220,18 @@ def parse_nuclei_soc_predefined_cores(core_mk):
],

LIBPATH=[
"$BUILD_DIR",
join(FRAMEWORK_DIR, "NMSIS", "Library", "DSP", "GCC"),
join(FRAMEWORK_DIR, "NMSIS", "Library", "NN", "GCC")
],

LIBS=["gcc", "m", "stdc++"]
)

# WORKAROUND: If RT-Thread used, force it to include symbols from finsh
# otherwise it will not be included
if build_rtthread_msh == "1":
env.Append(LINKFLAGS=["-u", "finsh_system_init"])

extra_incdirs = get_extra_soc_board_incdirs(build_soc, build_board)
if extra_incdirs:
env.Append(
Expand All @@ -235,20 +245,20 @@ def parse_nuclei_soc_predefined_cores(core_mk):
#
# Target: Build Nuclei SDK Libraries
#

soclibname = "soc_" + build_soc
boardlibname = "board_" + build_board
libs = [
env.BuildLibrary(
join("$BUILD_DIR", "SoC", build_soc, "Common"),
join("$BUILD_DIR", "SoC", build_soc, soclibname),
join(FRAMEWORK_DIR, "SoC", build_soc, "Common")
),

env.BuildLibrary(
join("$BUILD_DIR", "SoC", build_soc, "Board", build_board),
join("$BUILD_DIR", "SoC", build_soc, "Board", boardlibname),
join(FRAMEWORK_DIR, "SoC", build_soc, "Board", build_board)
)
]

rtoslibs = []
if selected_rtos == "FreeRTOS":
libs.append(env.BuildLibrary(
join("$BUILD_DIR", "RTOS", "FreeRTOS"),
Expand Down
5 changes: 3 additions & 2 deletions platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _add_default_debug_tools(self, board):
board_cfg = join(
sdk_dir, "SoC", build_soc, "Board", build_board, "openocd.cfg",
)
server_args = ["-f", board_cfg]
server_args = ["-c", "debug_level 1", "-f", board_cfg]
debug["tools"]["rv-link"] = {
"hwids": [["0x28e9", "0x018a"]],
"require_debug_port": True,
Expand Down Expand Up @@ -142,7 +142,8 @@ def _add_default_debug_tools(self, board):
" monitor halt",
"end",
"define pio_reset_run_target",
" monitor reset",
" monitor halt",
" monitor resume",
"end",
"target extended-remote $DEBUG_PORT",
"$LOAD_CMDS",
Expand Down

0 comments on commit 9217b6f

Please # to comment.