Closed fanghuaqi closed 10 months ago
This is caused by when compile with --specs nano.specs
, it will link a libgloss
library, which is conflict with the one provided by semihost, we can add -u _isatty -u _write -u _sbrk -u _read -u _close -u _fstat -u _lseek
in link options to workaround it.
Author: Huaqi Fang <578567190@qq.com>
Date: Mon Jun 5 18:36:36 2023 +0800
Build: Fix semihost not working when link with semihost library
Signed-off-by: Huaqi Fang <578567190@qq.com>
diff --git a/Build/Makefile.conf b/Build/Makefile.conf
index ab1365e5..f431c9da 100644
--- a/Build/Makefile.conf
+++ b/Build/Makefile.conf
@@ -227,7 +227,7 @@ LDFLAGS += -T $(LINKER_SCRIPT) -nostartfiles -Wl,-Map=$(TARGET).map \
$(LIB_OPT) -Wl,--start-group $(LDLIBS) -Wl,--end-group
ifneq ($(findstring newlib,$(STDCLIB)),)
-#LDFLAGS += -u _isatty -u _write -u _sbrk -u _read -u _close -u _fstat -u _lseek
+LDFLAGS += -u _isatty -u _write -u _sbrk -u _read -u _close -u _fstat -u _lseek
endif
# Include RTOS and Components Makefiles
diff --git a/SoC/demosoc/Common/npk.yml b/SoC/demosoc/Common/npk.yml
index b543ba46..a45f690b 100644
--- a/SoC/demosoc/Common/npk.yml
+++ b/SoC/demosoc/Common/npk.yml
@@ -412,7 +412,7 @@ buildconfig:
- flags: -lstdc++
condition: $( startswith(${stdclib}, "newlib") )
- flags: -Wl,--gc-sections -Wl,--check-sections
- - flags: # -u _isatty -u _write -u _sbrk -u _read -u _close -u _fstat -u _lseek
+ - flags: -u _isatty -u _write -u _sbrk -u _read -u _close -u _fstat -u _lseek
condition: $( startswith(${stdclib}, "newlib") )
- flags: -Wl,--defsym=__SMP_CPU_CNT=${nuclei_smp}
condition: $( ${nuclei_smp} > 1 )
diff --git a/SoC/evalsoc/Common/npk.yml b/SoC/evalsoc/Common/npk.yml
index e9fc627e..34cb4cee 100644
--- a/SoC/evalsoc/Common/npk.yml
+++ b/SoC/evalsoc/Common/npk.yml
@@ -412,7 +412,7 @@ buildconfig:
- flags: -lstdc++
condition: $( startswith(${stdclib}, "newlib") )
- flags: -Wl,--gc-sections -Wl,--check-sections
- - flags: # -u _isatty -u _write -u _sbrk -u _read -u _close -u _fstat -u _lseek
+ - flags: -u _isatty -u _write -u _sbrk -u _read -u _close -u _fstat -u _lseek
condition: $( startswith(${stdclib}, "newlib") )
- flags: -Wl,--defsym=__SMP_CPU_CNT=${nuclei_smp}
condition: $( ${nuclei_smp} > 1 )
Fixed by commit 493f783fd42296d62dfa08569707b46e6291a773, you can cherry-pick it into master branch.
When working with Nuclei SDK 0.4.1, build and compile with semihosting library, the semihosting feature is not working as expect.
The program stop at
early_exc_entry
and no output in openocd console, which is not as expected.