Tool/software:
Hi Teams,
1. My requirement is not to use the example code (MCRC)which you provided in the sdk.
so here i created the crc function of my own(sample implementation in below i attached) in that i need to find the crc by using my function.
below i attached my sample code to calculate crc,
typedef struct {
uint32_t Polynomial;
uint32_t Initial;
uint32_t FinalXor;
uint32_t RefelectDataFlag;
uint32_t RefelectRemainderFlag;
CRC_Type Type; //< New field to specify the CRC type
} ST_CRC32_PARAM;
uint32_t CRC32Calculate(const uint8_t* data, uint32_t length, const st_CRC32_param* ptrParam)
{
uint32_t result;
uint8_t buffer;
if ((length != EMPTY_BUFFER) && (ptrParam->polynomial != EMPTY_BUFFER)) // Checking if data is valid
{
uint32_t crc = ptrParam->initial;
for (uint32_t i = 0U; i < length; i++)
{
// Use reflection based on RefelectDataFlag
if ((ptrParam->RefelectDataFlag) != 0U)
{
buffer = (uint8_t)ReverseBits(data[i], BYTES_BY_BYTES); // Reflect data
}
else
{
buffer = data[i]; // No reflection
}
// XOR buffer with the relevant bits of the current CRC
buffer ^= (uint8_t)(crc >> (WIDTH - BYTES_BY_BYTES)); // Explicit cast to 8-bit
// Update CRC using the lookup table and polynomial
crc = CRCTableCreation[buffer] ^ (crc << BYTES_BY_BYTES);
}
// Use reflection for the final CRC value based on RefelectRemainderFlag
if ((ptrParam->RefelectRemainderFlag != 0U)) // Explicit boolean condition
{
result = (ReverseBits(crc, WIDTH) ^ ptrParam->finalXor); // Reflect final CRC
}
else
{
result = (crc ^ ptrParam->finalXor); // No reflection
}
}
else
{
result = 0U; // RESULT 0 for invalid input
}
return result;
}
so, here i need to calculate the CRC for the whole RAM memory(Because our code which is store in OCRAM) so, I need to implement with out using SDK provided examples.
2. i want your approach let suppose we know the RAM address starting from OCRAM : ORIGIN = 0x70040000 , LENGTH = 0x100000
how can we read the RAM memory? and how to do CRC?