Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

DAVE™ Forum Discussions

gachetp
Level 2
Level 2
10 replies posted 25 sign-ins 10 questions asked

Hello, I use a XMC45 with save the value of the crc in this flash.

 

I use J flash to read the value and I find : 

gachetp_0-1652166311281.png

 

I decided to read this value in my soft project to check if the CRC is correct between the way of Srecord(generate a hex file with CRC) or calculate by soft (directly in xmc45)

The problem is that I don't arrived to catch my CRC in Flash.

#define APP_BASE_ADDR (0x0C000000U)
#define END_PTR_ADDR (0x1CU)

void CRC_Init(void)
{
{ // Reads size of loaded app to determine where the CRC is stored
// Address where App code size is written
const uint32_t *pAppSize = (uint32_t *)(APP_BASE_ADDR+ END_PTR_ADDR);
// Reads serial which is just after the CRC at the end of code
uint32_t uAppSize = (*pAppSize);
uint32_t uEOC = (APP_BASE_ADDR + uAppSize);
uint32_t u32AppCRC = *(uint32_t *)uEOC;
Input_Register->CRC_APP = u32AppCRC;;
}
Adresses are good : but it return 0 here : uint32_t u32AppCRC = *(uint32_t *)uEOC;

 

 

To catch value I configure .long __text_size in Startup_XMC4500.s

.align 2
.globl __Vectors
.type __Vectors, %object
__Vectors:
.long __initial_sp /* Top of Stack */
.long Reset_Handler /* Reset Handler */

Entry NMI_Handler /* NMI Handler */
Entry HardFault_Handler /* Hard Fault Handler */
Entry MemManage_Handler /* MPU Fault Handler */
Entry BusFault_Handler /* Bus Fault Handler */
Entry UsageFault_Handler /* Usage Fault Handler */
.long __text_size /* Reserved */

 

Someone can explain me my error ?

Already thank you 

Pierre

0 Likes
1 Solution
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi,

Apologies for the delay. As we understand the issue, there is a CRC count mismatch between debug and release mode configurations. You are able to get proper CRC counts on debug mode. Is this understanding right ?

If the issue is you are getting the CRC value as different in software and FCE calculation, this could be because FCE by default is Big Endian. And the data needs to be converted before CRC calculation. Please check the appnote. https://www.infineon.com/dgdl/Infineon-ApplicationNote_Managing_firmware_integrity_in_XMC_XMC1000_XM...

Best Regards,
Vasanth

View solution in original post

0 Likes
4 Replies
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi Pierre,

Could you please let me know more about the two methods of CRC creation you are doing ? Additionally at what point are you trying to read the CRC value stored ?

Best Regards,
Vasanth

0 Likes

Hello, thank you for your response @Vasanth,

 I write a doc for the process to save CRC in internal flash memory : LTDSWDDoc.docx

But after I try to read the value at address : #define APP_BASE_ADDR (0x0C000000U) + END_PTR_ADDR (0x1CU). But Ii always have 0. The addresse value is good is verified in debug mode. after I use teh releaseCrc mode. 

 

In my project I calculate the crc with FCE generated by DAVE : 

uint32_t crc32 = 0;
// Enable FCE module
XMC_FCE_Enable();

// Initialize the FCE Configuration
XMC_FCE_STATUS_t fceStatus = XMC_FCE_Init(&FCE_config0);
XMC_ASSERT("XMC_FCE_Init bad return status", fceStatus == XMC_FCE_STATUS_OK);

fceStatus = XMC_FCE_CalculateCRC32(&FCE_config0, (uint32_t *)u32Address, u32Size, &crc32);
XMC_ASSERT("XMC_FCE_CalculateCRC32 bad return status", fceStatus == XMC_FCE_STATUS_OK);
XMC_UNUSED_ARG(fceStatus);

XMC_FCE_GetCRCResult(&FCE_config0, &crc32);

XMC_FCE_Disable();

return crc32;

 

0 Likes
gachetp
Level 2
Level 2
10 replies posted 25 sign-ins 10 questions asked

I really need help, I find anything on net 😞

0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi,

Apologies for the delay. As we understand the issue, there is a CRC count mismatch between debug and release mode configurations. You are able to get proper CRC counts on debug mode. Is this understanding right ?

If the issue is you are getting the CRC value as different in software and FCE calculation, this could be because FCE by default is Big Endian. And the data needs to be converted before CRC calculation. Please check the appnote. https://www.infineon.com/dgdl/Infineon-ApplicationNote_Managing_firmware_integrity_in_XMC_XMC1000_XM...

Best Regards,
Vasanth

0 Likes