Page 1 of 1

Unique build id for esp32

Posted: Fri Dec 23, 2022 1:35 am
by tkvjkl
Hello I am trying to add a GNU build id to esp32. I added the option to the cmakelist and to .ld.in file I see the id in the els file but not the bin file. Is there a way to add the build id so that it shows up in the bin.

Code: Select all

set (CMAKE_EXE_LINKER_FLAGS "-Wl,--build-id=sha1")
in the cmakelists

Code: Select all

 .gnu_build_id :
  {
    _gnu_build_id_start = ABSOLUTE(.);
    . = ALIGN(8);
    *(.note.gnu.build-id)
    _gnu_build_id_end = ABSOLUTE(.);
  } > flash_text
in the esp32.project.ld.in

Re: Unique build id for esp32

Posted: Fri Dec 23, 2022 3:14 pm
by mbratch
You could use target_add_binary_data.

Re: Unique build id for esp32

Posted: Fri Dec 23, 2022 7:49 pm
by tkvjkl
That didn't work
I tried adding the following set(ESPTOOLPY_ELF2BIN "objcopy --only-keep-debug -O binary") to the cmakelist and I still do not see the GNU build id in the .bin file but I see it in the .elf file

Re: Unique build id for esp32

Posted: Sat Dec 24, 2022 1:48 pm
by mbratch
I'm not sure exactly what you tried, but the method I showed is exactly how I do it in my project to add data to a bin file. You do need to modify what I showed more specifically for your situation. Did you check the documentation on the usage of those functions?

Re: Unique build id for esp32

Posted: Mon Dec 26, 2022 7:57 pm
by tkvjkl
The link you shared above take me to this page https://docs.espressif.com/projects/esp ... embed-data

Do you have a github page where I can see how you add data to the bin file ?

Re: Unique build id for esp32

Posted: Wed Dec 28, 2022 10:42 pm
by mbratch
tkvjkl wrote:
Mon Dec 26, 2022 7:57 pm
The link you shared above take me to this page https://docs.espressif.com/projects/esp ... embed-data

Do you have a github page where I can see how you add data to the bin file ?
There's a section in that document called "Embedding Binary Data". If you read through that section, it explains how it works and it has a link to an example CMakeList.txt.