nuttx: Simulator export fails
I am trying to build my own app using the export target with the simulator. And I’ve run into few issues : To be clear, here’s the procedure I following :
- ./tools/configure.sh sim:nsh
- make export
- tar -xf nuttx-export-12.4.0.tar.gz
- My CMakeList.txt file :
cmake_minimum_required(VERSION 3.16)
project(test)
include(../nuttx-export-12.4.0/scripts/toolchain.cmake)
add_executable(test main.c)
- cmake . && make and here’s the output
ld: unrecognized option '-Wl,--gc-sections'
Indeed in the target.cmake of the export the LDFLAGS are :
"-Wl,--gc-sections -Wl,-Ttext-segment=0x400000 -Wl,-Map=/home/nuttxspace/nuttx/nuttx.map")
Which can not work because we passing the -Wl argument directly to the linker… First issue.
- To go further, I have just modified the target.cmake, removing the -Wl before the arguments.
Then the linker returns this error :
ld: read in flex scanner failedWith some research, this error is a the way of the linker to say that it can’t read some arguments. Some tests showed me that the -T{LINKER_SCRIPT} argument (toolchain.cmake) was the culprit. Here’s the line where we set the LINKER_SCRIPT variable :set(LINKER_SCRIPT ${NUTTX_PATH}/scripts/${LDNAME})Problem, in the target.cmake the ${LDNAME} is empty:set(LDNAME "")The LDNAME variable is set in the Export.mk file :
ifneq ($(ARCHSCRIPT),)
LDPATH = $(call CONVERT_PATH,$(ARCHSCRIPT))
LDNAME = ${notdir ${LDPATH}}
LDDIR = ${dir ${LDPATH}}
endif
For now, I’ve stopped there the investigation, but I will go further in this. These errors make me think that the simulator export is bugged. What do you think ? Is it possible that it isn’t really used and it is now outdated ? Or is there something I’m doing wrong ? By the way, without the export, it works perfectly well (tested with nsh). ping @leducp
About this issue
- Original URL
- State: closed
- Created 4 months ago
- Comments: 16 (16 by maintainers)
Yes, but only for Makefile