# HG changeset patch # User Daniel O'Connor # Date 1616988295 -37800 # Node ID b9ec45077bff257225e09acd3249be7225eae229 # Parent a55e39064a71be36f210fbe2075d3e55a83781c9 Use MAKE_C_IDENTIFIER since it's available. Add comment about where we got the magic from. Add _end symbol. diff -r a55e39064a71 -r b9ec45077bff local.cmake --- 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})