This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/RM48L952: Adding crc_table in sys_link.cmd file generated by HALCoGen within the USER CODE sections

Part Number: RM48L952
Other Parts Discussed in Thread: HALCOGEN

Tool/software: TI C/C++ Compiler

Hello,

HALCoGen generates a sys_link.cmd file with a sections definition like :

SECTIONS
{
    .intvecs  : {} > VECTORS
    .text       : {} > FLASH0 | FLASH1
    .const    : {} > FLASH0 | FLASH1
    /*....*/

/* USER CODE BEGIN (4) */
/* USER CODE END */

}

The CRC document (spna235) suggests that you use the following line to let the compiler calculate the CRC over a section :

 SECTIONS
 {
     /* Flash based sections */
     .intvecs    : {} palign=32, fill=0xff, crc_table(_my_crc_table, algorithm=TMS570_CRC64_ISO) > VECTORS                                                     
     .text       : {} palign=8, crc_table(_my_crc_table, algorithm=TMS570_CRC64_ISO) > FLASH0 | FLASH1 /* Executable code and constants */
     .const      : {} palign=8, crc_table(_my_crc_table, algorithm=TMS570_CRC64_ISO) > FLASH0 | FLASH1 /* Global and static const variables that are explicitly initialized */

However, if I substitute these lines in the sys_link.cmd generated by HALCoGen, HALCoGen will overwrite them.
Are there lines that I can add between the USER CODE comments that calculate the crc table?


Best regards,

Karel



  • Hello Karel,

    HALCoGen is able to maintain edits that you make to the generated source code, as long as these edits appear between comments USER CODE BEGIN and USER CODE END.

    Any code that you add to cmd file between the comments USER CODE BEGIN (x) and USER CODE END will be maintained even if you make another pass through HALCoGen and regenerate code after having changed various settings.
  • Hello QJ,

    I know this, that is why I would like to add the instructions to calculate the CRC over the flash sections between the USER CODE BEGIN (X) and the USER CODE END comments. In other words, I would like a command to adjust the allignment (palign=128) and to calculate the CRC over a section without defining a new section.

    As I understand it :
    SECTIONS
    {
    .text : {} FLASH0 | FLASH1 /* Defines the section .text, place it in flash */
    .const : {} FLASH0 | FLASH1 palign=128 fill=0xFFFFFFFF crc_table(flash_crc_table)
    ...
    /* USER CODE BEGIN (4) */
    XXXXXXXXXXXXXXXXXXXX
    .TI.crctab : {} > FLASH1 /* Defines section to place the CRC in
    /* USER CODE END */
    }

    I would like to add something on the line with XXXXX which adds CRC / fill and alignment on the .text section.
    The way this is done for the .const section is what's suggested by spna235, however HALCoGen will overwrite this.
    I hope this clarifies my question
  • Hello Karel,

    SECTIONS
    {
    /* USER CODE BEGIN (5) */
    #if 0
    /* USER CODE END */
    .intvecs : {} > VECTORS
    .text align(32) : {} > FLASH0 | FLASH1
    .const align(32) : {} > FLASH0 | FLASH1
    .cinit align(32) : {} > FLASH0 | FLASH1
    .pinit align(32) : {} > FLASH0 | FLASH1
    .bss : {} > RAM
    .data : {} > RAM
    .sysmem : {} > RAM


    /* USER CODE BEGIN (6) */
    #endif
    #if 1
    .intvecs :{} palign=32, fill=0xff , crc_table(_my_crc_table, algorithm=TMS570_CRC64_ISO) > VECTORS
    .text :{} palign=8, crc_table(_my_crc_table, algorithm=TMS570_CRC64_ISO) > FLASH0 | FLASH1
    .const :{} palign=8, crc_table(_my_crc_table, algorithm=TMS570_CRC64_ISO) > FLASH0 | FLASH1
    .cinit :{} palign=8, crc_table(_my_crc_table, algorithm=TMS570_CRC64_ISO) > FLASH0 | FLASH1
    … …
    .TI.crctab : {} palign=8 > FLASH0 | FLASH1 /* The CRC tables generated by the linker are created in the special section .TI.crctab */

    .stack : {__STACK_START = .;} type=NOINIT > RAM
    .bss : {} palign=8 > RAM
    .data : {} palign=8 > RAM
    .sysmem : {} > RAM
    #endif
    /* USER CODE END */
    }
  • Thanks QJ, I wans't sure that macros worked in the .cmd file
  • Hi Karel,

    There is no problem. Those macros work in cmd file.