Using CCS10 and pdk_am437x_1_0_15 for AM4376 Cortex-A. I'm trying to verify CRC of .text and .data during runtime.
I added a section to my linker script which I populate after a 2 pass link, once to build the program, then export the sections to a local .bin file, get its CRC32 and add it during the seconds link pass, similar to what's described in https://stackoverflow.com/questions/24150030/storing-crc-into-an-axf-elf-file
.crc : ALIGN(4)
{
__crc_start__ = .;
crc_table = .;
LONG(CRC_TEXTA);
LONG(CRC_DATAA);
LONG(CRC_BSSA);
__crc_end__ = .;
} > DDR0
.text : ALIGN(4)
{
__text_start__ = .;
*init.o (.text)
*(.text*)
KEEP(*(.init))
KEEP(*(.fini))
/* .ctors */
*crtbegin.o(.ctors)
*crtbegin?.o(.ctors)
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
*(SORT(.ctors.*))
*(.ctors)
/* .dtors */
*crtbegin.o(.dtors)
*crtbegin?.o(.dtors)
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
*(SORT(.dtors.*))
*(.dtors)
*(.rodata*)
KEEP(*(.eh_frame*))
__text_end__ = .;
} > DDR0
Everything compiled fine and links, during runtime, my .data CRC compares fine, but .text fails. I have paused on the debugger and exported out the dump of the memory from __text_start__ to __text_end__ and the .bin export matches the temp .bin I created during CRC calculation. However it does not compute correct while it runs. My .text section isn't that big, around 700kb, and the same CRC function matches the .data and .bss CRCs (the BSS section is way bigger at around 40MB). I was wondering how the .text CRC fails. I have run it the program via debugger and via NFS, still .text does not match. I have added
__asm__("dmb");
__asm__("isb");
instructions in between CRC32 checks in case the pipelines get corrupted. I have copied over the .text section into a global array and run CRC32 on it, still fails.