title: STM32 link crc value of firmware in the final binary
body: <p>I'm attempting to write a bootloader + application for a custom STM32F401RE board, and I have some questions.</p>
  <p>Currently, I have the booloader lives at 0x08000000, and application lives 0x08020000. The idea is to have the bootloader perform a CRC check before jumping to the application.</p>
  <p>I used a linker script to create a section called <code>.fw_crc</code> right after <code>.isr_vector</code> , and before <code>.text</code>. In the application code, I can write to this directly to this address in the flash. But this is where I got stuck.</p>
  <p>If I understand it correctly, I should...</p>
  <ol>
  <li>Default the CRC value to 0 in the application.</li>
  <li>Build the binary.</li>
  <li>Generate the CRC of this binary.</li>
  <li>Use some hex tool to overwrite this section with the computed CRC value.</li>
  <li>Regenerate the binary again for final flashing.</li>
  </ol>
  <p>Is the above assumption correct? Doesn't regenerating the binary a second time with the updated CRC value ultimately change the resulting CRC of the final binary?</p>
  <p>Also, inside the bootloader, do I perform the CRC check from the start of the <code>application_address</code> to <code>application_address + binary_size</code>?</p>