diff --git a/builder/frameworks/_bare.py b/builder/frameworks/_bare.py index 0dbcf0b..e6707d1 100644 --- a/builder/frameworks/_bare.py +++ b/builder/frameworks/_bare.py @@ -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) diff --git a/builder/frameworks/nuclei-sdk.py b/builder/frameworks/nuclei-sdk.py index 14c029d..1212f7e 100644 --- a/builder/frameworks/nuclei-sdk.py +++ b/builder/frameworks/nuclei-sdk.py @@ -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, @@ -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", @@ -214,7 +220,6 @@ 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") ], @@ -222,6 +227,11 @@ def parse_nuclei_soc_predefined_cores(core_mk): 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( @@ -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"), diff --git a/platform.py b/platform.py index e5d2ffb..2abb1bc 100644 --- a/platform.py +++ b/platform.py @@ -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, @@ -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",