mirror of https://github.com/ARMmbed/mbed-os.git
Fixed Linking with Linker Script
parent
b112ad7da4
commit
e423947af3
|
@ -49,6 +49,11 @@ MKDIR=mkdir
|
|||
CP=cp
|
||||
CCADMIN=CCadmin
|
||||
|
||||
BUILDDIR = BUILD
|
||||
PLATFORM = {{target}}
|
||||
ELF2BIN = 'arm-none-eabi-objcopy'
|
||||
TARGET = ${CND_DISTDIR}/${CONF}/${CND_PLATFORM}/{{name}}
|
||||
|
||||
|
||||
# build
|
||||
build: .build-post
|
||||
|
@ -58,7 +63,10 @@ build: .build-post
|
|||
|
||||
.build-post: .build-impl
|
||||
# Add your post 'build' code here...
|
||||
|
||||
$(ELF2BIN) -O binary ${TARGET}.elf ${TARGET}.bin
|
||||
+@echo "===== bin file ready to flash: $(TARGET).bin ====="
|
||||
$(ELF2BIN) -O ihex ${TARGET}.elf ${TARGET}.hex
|
||||
cp ${TARGET}.* ${CND_BUILDDIR}/${CONF}/${CND_PLATFORM}
|
||||
|
||||
# clean
|
||||
clean: .clean-post
|
||||
|
@ -126,3 +134,6 @@ include nbproject/Makefile-impl.mk
|
|||
|
||||
# include project make variables
|
||||
include nbproject/Makefile-variables.mk
|
||||
|
||||
CND_BUILDDIR = ${BUILDDIR}
|
||||
CND_PLATFORM = ${PLATFORM}
|
||||
|
|
|
@ -28,6 +28,10 @@ class GNUARMNetbeans(Exporter):
|
|||
return apply_supported_whitelist(
|
||||
cls.TOOLCHAIN, POST_BINARY_WHITELIST, target)
|
||||
|
||||
@staticmethod
|
||||
def prepare_sys_lib(libname):
|
||||
return "-l" + libname
|
||||
|
||||
def toolchain_flags(self, toolchain):
|
||||
"""Returns a dictionary of toolchain flags.
|
||||
Keys of the dictionary are:
|
||||
|
@ -207,11 +211,19 @@ class GNUARMNetbeans(Exporter):
|
|||
sources = [self.filter_dot(field) for field in sources]
|
||||
include_paths = [self.filter_dot(field) for field in self.resources.inc_dirs]
|
||||
|
||||
sys_libs = [self.prepare_sys_lib(lib) for lib
|
||||
in self.toolchain.sys_libs]
|
||||
preproc = " ".join([part for part
|
||||
in ([basename(self.toolchain.preproc[0])] +
|
||||
self.toolchain.preproc[1:] +
|
||||
self.toolchain.ld[1:])])
|
||||
|
||||
if 'nbproject' in include_paths:
|
||||
include_paths.remove('nbproject')
|
||||
|
||||
jinja_ctx = {
|
||||
'name': self.project_name,
|
||||
'target': self.toolchain.target.name,
|
||||
'elf_location': join('BUILD', self.project_name) + '.elf',
|
||||
'c_symbols': self.toolchain.get_symbols(),
|
||||
'asm_symbols': self.toolchain.get_symbols(True),
|
||||
|
@ -233,6 +245,8 @@ class GNUARMNetbeans(Exporter):
|
|||
'c_std': self.get_netbeans_c_std(c_std),
|
||||
'cpp_std': self.get_netbeans_cpp_std(cpp_std),
|
||||
'linker_script': self.ld_script,
|
||||
'linker_libs': sys_libs,
|
||||
'pp_cmd': preproc
|
||||
}
|
||||
return jinja_ctx
|
||||
|
||||
|
|
|
@ -131,8 +131,10 @@
|
|||
</preprocessorList>
|
||||
</asmTool>
|
||||
<linkerTool>
|
||||
<output>${CND_DISTDIR}/${CND_CONF}/{{target}}/{{name}}.elf</output>
|
||||
<additionalDep>${CND_BUILDDIR}/${CND_CONF}/{{target}}/.link_script.ld</additionalDep>
|
||||
<commandlineTool>arm-none-eabi-gcc</commandlineTool>
|
||||
<commandLine>{%- for symbol in opts['ld'] -%}{{ symbol+" "}}{%- endfor -%}</commandLine>
|
||||
<commandLine>-T ${CND_BUILDDIR}/${CND_CONF}/{{target}}/.link_script.ld {%- for symbol in opts['ld'] -%}{{" "+symbol}}{%- endfor -%} {%- for item in linker_libs -%}{{" "+item}}{%- endfor -%} </commandLine>
|
||||
</linkerTool>
|
||||
</compileType>
|
||||
{% for h in headers -%}
|
||||
|
@ -156,6 +158,11 @@
|
|||
</item>
|
||||
{% endfor -%}
|
||||
<item path="{{linker_script }}" ex="false" tool="3" flavor2="0">
|
||||
<customTool>
|
||||
<customToolCommandline>{{pp_cmd}} -o $@ $<</customToolCommandline>
|
||||
<customToolDescription>Create ELF File using Link Script</customToolDescription>
|
||||
<customToolOutputs>${CND_BUILDDIR}/${CND_CONF}/{{target}}/.link_script.ld</customToolOutputs>
|
||||
</customTool>
|
||||
</item>
|
||||
<item path="/nbproject/private/c_standard_headers_indexer.c" ex="true" tool="0" flavor2="0">
|
||||
</item>
|
||||
|
|
Loading…
Reference in New Issue