@@ -423,6 +423,7 @@ add_executable(nuttx)
423
423
add_custom_target (nuttx_post )
424
424
if (CONFIG_BUILD_PROTECTED )
425
425
add_executable (nuttx_user )
426
+ add_dependencies (nuttx_post nuttx_user )
426
427
nuttx_add_library_internal (nuttx_user )
427
428
endif ()
428
429
@@ -730,6 +731,21 @@ if(CONFIG_ARCH_SIM)
730
731
file (APPEND ${CMAKE_BINARY_DIR} /nuttx.manifest "nuttx\n " )
731
732
endif ()
732
733
734
+ # Generate system map using the compiler toolchain. Conventionally, the tool
735
+ # which dump symbols are called nm, though, some compiler toolchain may have a
736
+ # different name.
737
+ if (NOT WIN32 )
738
+ add_custom_command (
739
+ OUTPUT System .map
740
+ COMMAND
741
+ ${CMAKE_NM} nuttx | grep -v
742
+ '\( compiled\)\|\(\$ {CMAKE_C_OUTPUT_EXTENSION}$$\)\|\( [aUw] \)\|\(\.\. ng$$\)\|\( LASH[RL]DI\) '
743
+ | sort > System .map
744
+ DEPENDS nuttx )
745
+ add_custom_target (systemmap ALL DEPENDS System .map )
746
+ add_dependencies (nuttx_post systemmap )
747
+ endif ()
748
+
733
749
# Userspace portion ##########################################################
734
750
735
751
if (CONFIG_BUILD_PROTECTED )
@@ -798,6 +814,7 @@ if(CONFIG_BUILD_PROTECTED)
798
814
COMMAND ${CMAKE_NM} nuttx_user > User.map
799
815
DEPENDS nuttx_user )
800
816
add_custom_target (usermap ALL DEPENDS User.map )
817
+ add_dependencies (nuttx_post usermap )
801
818
802
819
# generate binary outputs in different formats (.bin, .hex, etc)
803
820
nuttx_generate_outputs (nuttx_user )
0 commit comments