File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ SET(CMAKE_CXX_FLAGS "{{cxx_flags}} -include mbed_config.h")
30
30
SET(CMAKE_ASM_FLAGS "{{asm_flags}} -include mbed_config.h")
31
31
SET(CMAKE_CXX_LINK_FLAGS "{{ld_flags}}")
32
32
{% if pp -%}
33
- SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_INK_FLAGS} {{ link_script_option}} ${CMAKE_BINARY_DIR}/{{name}}.link_script.ld ${LD_SYS_LIBS} ")
33
+ SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} ${LD_SYS_LIBS} {{ link_script_option}} ${CMAKE_BINARY_DIR}/{{name}}.link_script.ld")
34
34
{%- endif %}
35
35
36
36
ADD_DEFINITIONS(
@@ -48,21 +48,26 @@ ADD_LIBRARY({{libname}} STATIC
48
48
{% endfor %}
49
49
50
50
# executable {{name}}
51
- ADD_EXECUTABLE({{name}}.elf
51
+ ADD_EXECUTABLE({{name}}
52
52
{% for src in sources %}{{src}}
53
53
{% endfor %})
54
- TARGET_LINK_LIBRARIES({{name}}.elf
55
- {% for libname in dependencies %}{{libname}}
54
+ TARGET_LINK_LIBRARIES({{name}}
55
+ {% for libname in dependencies.keys()|sort(reverse=true) %}{{libname}}
56
56
{% endfor %})
57
57
58
58
{% if pp -%}
59
- add_custom_command(TARGET {{name}}.elf PRE_LINK
59
+ add_custom_command(TARGET {{name}} PRE_LINK
60
60
COMMAND "{{pp}}" {{pp_flags}} {{linker_script}} -o ${CMAKE_CURRENT_BINARY_DIR}/{{name}}.link_script.ld
61
61
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
62
62
BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/{{name}}.link_script.ld"
63
63
)
64
64
{%- endif %}
65
65
66
+ add_custom_command(TARGET {{name}} POST_BUILD
67
+ COMMAND ${ELF2BIN} -O ihex $<TARGET_FILE:{{name}}> $<TARGET_FILE:{{name}}>.hex
68
+ )
69
+
70
+
66
71
##########################################################################
67
72
# mbed-cli specific targets
68
73
##########################################################################
Original file line number Diff line number Diff line change @@ -73,10 +73,9 @@ def generate(self):
73
73
depSources = {k : v for k , v in depSources .items () if len (v ) != 0 }
74
74
75
75
# remove all source files that ended up being part of one of the dependencies
76
- # we flatten the list of source files from all dependencies and
77
- # then only add file to srcs if its not in that list
78
- # (basically srcs = allSourcefiles - flatten(depSources.values())
79
- srcs = [f for f in allSourceFiles if f not in [item for sublist in depSources .values () for item in sublist ]]
76
+ srcs = allSourceFiles
77
+ for dep in depSources .values ():
78
+ srcs .difference_update (dep )
80
79
81
80
# additional libraries
82
81
libraries = [self .prepare_lib (basename (lib )) for lib in self .resources .libraries ]
@@ -85,7 +84,7 @@ def generate(self):
85
84
ctx = {
86
85
'name' : self .project_name ,
87
86
'target' : self .target ,
88
- 'sources' : srcs ,
87
+ 'sources' : sorted ( srcs ) ,
89
88
'dependencies' : depSources ,
90
89
'libraries' : libraries ,
91
90
'ld_sys_libs' : sys_libs ,
You can’t perform that action at this time.
0 commit comments