Hey everyone,
I'm bringing this thread back up because I'm currently working on a project involving ClassB-certified software. The certifiers have requested us to provide separate CRC values for both ClassB software and the application. This means we need to precalculate two CRCs during compilation: one for the application and one for the ClassB software. These CRC values will be stored in designated memory sections (let's call them classB_CRC and app_CRC).
During runtime, these CRC values will be calculated using the CRC-CCITT library and then compared with their respective precalculated values.
Previously, when we only needed to precalculate one CRC, I followed the option suggested by oraut: Renesas Tool Settings > Linker > Output > Advanced, and selected the CRC-CCITT(LSB) type.
However, now that I need two independent CRC calculations, I'm unsure if it's possible. Has anyone encountered a similar situation or knows if this can be done?
Just to provide some context, I'm using the CCRX compiler with an RX200 Family MCU, and my IDE version is e2studio 5.2.0.020.
Any insights or advice would be greatly appreciated.
Thanks!
PD: I did the same question on: CRC option of RX linker - Forum - RX MCU - Renesas Engineering Community
Hi enrip19, thank you for posting on the Renesas community. As I grasped your situation, you have the plan to implement the IEC60730 Self-test program beside your functional code application. I'm not sure, how you're separating your ClassB-certified software and your application, is it through a dual application scheme(bootloader)?By the way, if you're using the CC-RX compiler tool to calculate the CRC16 values of your binaries, this way, you can have several CRC16 values calculated and inserted by the CC-RX compiler:
-Make sure you've unchecked the previous CRC converting options in the IDE setting (Tool setting->converter->CRC operation).
-Go to the 'User' section (Tool setting->converter->User) and add these two options manually as below
-crc=fff70000=ffff0000-ffffffff/16-CCITT-LSB:LITTLE -crc=fff70008=fff90000-fffd0000/16-CCITT-LSB:LITTLE
The output for my code with that:
if you need more information about the ' -crc 'option of the CC-RX compiler, please check out this document.
The settings you'd made in the IDE for CRC creation, just put those lines in the compiler's command line and you can always investigate them in the e2studio's console I hope you find it useful, don't hesitate to ask questions if you need to.
Regards, Hossein.
If this or any other user's response answers your concern, kindly verify the answer. Thank you!
Renesas Engineering Community Moderatorhttps://community.renesas.com/https://academy.renesas.com/en-support.renesas.com/.../
You need to upgrade to calculate 2 or more CRC's. Only the CCRX compiler v3.05.00 or higher supports 2 or more CRC calculations. And you also need the latest version of e2studio 2024-1that supports the setup of multiple CRC's.
Also keep in mind that it's possible that the CRC calculation during debug is not correct because some portions of the code are altered by the debugger. Only way to correctly test it, is by creating a release and hope for the best.
Hey there!
Thanks for the responses, they've been really helpful.
We recently upgraded to CCRX v3.06.00, and everything seems to be working smoothly. Unfortunately, upgrading the IDE isn't an option for us at the moment. However, we managed to resolve our issue by adding the "-crc" commands to the "Converter User-defined options (after)" section, allowing us to request the CRCs from the compiler.
Now, I have a new question: I'm wondering if it's possible to dynamically calculate the address of a section using something like this:
-crc=fffe0008=(uint32_t) __sectop ("PResetPRG")-((uint32_t) __sectop ("CRC_ADDR") - 1)/32-ETHERNET(ffffffff):LITTLE-4-0
I've come across the "sectop" function in the CCRX user guide, which seems to be used for calculating the start address of a section.
Additionally, I'm curious if there's a way to instruct the compiler to calculate two CRC types for the same range of memory.
Can you provide some guidance on this?
Thank you very much!
__sectop(), __secend() and __secsize() are operators meant to be used in c code to get dynamic section info. So I don't think it will work in the command line. I think that the command line only supports fixed addresses.
I expect that it should be possible to calculate 2 crc's from the same range or overlapping range. Just watch out if the crc result is stored in memory range that is used by another crc. I don't know in which order the crc's are calculated.
Hi,
Thank you for your response.
Firstly, ok about __sectop() and beyond operators. We will asume that only fixed addresses are supported.
About the same range calculation, I am getting the next error: E0562022 from the commands:
-crc=fffe0100=fffe0108-ffff11d1:LITTLE-2-0 -crc=fffe0008=fffe0108-ffff11d1/32-ETHERNET(ffffffff):LITTLE-4-0
Please, could you indicate me how to do it?
Thank you!
Looking into the manual I found the following in the remarks of the -crc command:
- An error is output and execution is terminated if the CRC operation range includes an overlaid area.
E0562022 error indicates an overlap in address range in option. So that does not only goes when multiple ranges are given in a single -crc command. But also for multiple -crc commands.
Maybe you can ask a Renesas engineer what the reason is behind this.
Alright, NGE,
Thanks a lot for your response once again. It's been incredibly helpful! I'm going to reach out to a Renesas engineer to see if they can provide a solution for my problem.
Best regards
The CC-RX Linker (object converter feature) is mainly for flash programmer verification.Therefore, the linker might not exactly match to your purpose.You could also consider using other tools such as srec_cat to add CRC value into hex/mot file.cf. https://mcuoneclipse.com/2015/04/26/crc-checksum-generation-with-srecord-tools-for-gnu-and-eclipse/https://llvm-gcc-renesas.com/wiki/index.php?title=CRC_Checksum_Generation_with_%E2%80%98SRecord%E2%80%99_Tools_for_GNU_and_Eclipse