changeset 1:b9ec45077bff

Use MAKE_C_IDENTIFIER since it's available. Add comment about where we got the magic from. Add _end symbol.
author Daniel O'Connor <darius@dons.net.au>
date Mon, 29 Mar 2021 13:54:55 +1030
parents a55e39064a71
children 0d653f60dec8
files local.cmake
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/local.cmake	Mon Mar 29 13:48:34 2021 +1030
+++ b/local.cmake	Mon Mar 29 13:54:55 2021 +1030
@@ -17,12 +17,14 @@
     # Get directory name of source file
     # ld will name the symbol based on the full path so we have to mangle it
     get_filename_component(BIN_SRC_DIR ${FILENAME} DIRECTORY)
-    string(REPLACE "/" "_" SRC_DIRNAME_MANGLED ${BIN_SRC_DIR})
+    string(MAKE_C_IDENTIFIER ${BIN_SRC_DIR} SRC_DIRNAME_MANGLED)
     #message("SRC_DIRNAME_MANGLED ${SRC_DIRNAME_MANGLED}")
 
+    # http://stupefydeveloper.blogspot.com/2008/08/cc-embed-binary-data-into-elf.html
     add_custom_command(OUTPUT ${ELFNAME}
       COMMAND arm-none-eabi-ld -r -b binary -o ${ELFNAME}
  --defsym=${BIN_SYMNAME}_start=_binary_${SRC_DIRNAME_MANGLED}_${BIN_SYMNAME}_start
+ --defsym=${BIN_SYMNAME}_end=_binary_${SRC_DIRNAME_MANGLED}_${BIN_SYMNAME}_end
  --defsym=${BIN_SYMNAME}_size=_binary_${SRC_DIRNAME_MANGLED}_${BIN_SYMNAME}_size
  ${FILENAME}
         DEPENDS ${FILENAME})