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.
I am currently using Code Composer Studio to setup on-chip flash option bytes, such as GPREG(BOOTCTRL). I need to somehow combine the option bytes with the application hex file so that both can be programmed at one time with UniFlash. It also would be advantageous to combine two hex files (in this case a bootloader and application) so that a program operation with UniFlash could be one step. Can someone point me to the correct documentation or best practice for programming options with UniFlash? Thanks
Hi Paul,
1) Regarding combining OTP fields in to the image: Please search for "How can we program a field in USER OTP?" in this FAQ: https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/951668/faq-faq-on-flash-api-usage-for-c2000-devices
The DCSM tool also should allow you to configure these fields - did you try that? I can loop our DCSM tool expert if needed.
2) Regarding combining two executables: The C28x assembly tools manual’s (www.ti.com/.../spru513) sub-chapter “The Load Image Format” has information on this from our compiler team. You can do something like: hex2000 --load_image -o combined.out prog1.out prog2.out
You can generate the hex file for the combined out file in a separate invocation of the hex2000.
Thanks and regards,
Vamsi
Thanks for those tips. I have a follow up issue with the RETAIN pragma. I am using eabi, so found I need RETAIN to keep the OTP sections from being dropped. But RETAIN is generating warnings or errors for me. Can you advise if I have the syntax, correct? Iwas able to get the solution working by using the variable in code to trick the linker - but I don't really like that solution, it may break under optimization.
in the top on mian.c->
//OTP options
#pragma DATA_SECTION (Z1_BOOTCTRL_value,"BOOT_section")
volatile const long Z1_BOOTCTRL_value = 0x12345678;
#pragma RETAIN('BOOT_section')
gives me warning (and the section is dropped):
#1923-D too many characters in character literal -- extra leading characters ignored main.c /flash_kernel_sci line 34 C/C++ Problem
#830-D error processing pragma RETAIN, verify format main.c /flash_kernel_sci line 34 C/C++ Problem
I've tried " and ' to enclose the section name.
here is the copy of .cmd file:
MEMORY /* modifiied back to FLASH mode 6/14/2023*/
{
BEGIN : origin = 0x00080000, length = 0x00000002
// BOOTVER : origin = 0x00080002, length = 0x00000004 //bootware version string
BOOT_RSVD : origin = 0x00000002, length = 0x00000126
RESET : origin = 0x003FFFC0, length = 0x00000002
RAMM0 : origin = 0x00000128, length = 0x000002D8
RAMM1 : origin = 0x00000400, length = 0x000003F8
// RAMM1_RSVD : origin = 0x000007F8, length = 0x00000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
RAMLS0 : origin = 0x00008000, length = 0x00002000
RAMLS1 : origin = 0x0000A000, length = 0x00001FF0
BOOT_L_KEY : origin = 0x0000BFF0, length = 0x08
BOOTVER : origin = 0x0000BFF8, length = 0x08
// RAMLS1_RSVD : origin = 0x0000BFF8, length = 0x00000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
/* OTP Boot control */
Z1_BOOTCTRL_OTP1 : origin = 0x078208, length = 0x04
/* Flash sectors */
FLASH_BANK0_SEC_0_7 : origin = 0x080008, length = 0x2FF0 /* on-chip Flash <<< all bootloader code goes here END = 0x083000 */
//reserve most flash space for the application
// FLASH_BANK0_SEC_8_15 : origin = 0x082000, length = 0x2000 /* on-chip Flash */
// FLASH_BANK0_SEC_16_23 : origin = 0x084000, length = 0x2000 /* on-chip Flash */
// FLASH_BANK0_SEC_24_31 : origin = 0x086000, length = 0x2000 /* on-chip Flash */
// FLASH_BANK0_SEC_32_39 : origin = 0x088000, length = 0x2000 /* on-chip Flash */
// FLASH_BANK0_SEC_40_47 : origin = 0x08A000, length = 0x2000 /* on-chip Flash */
// FLASH_BANK0_SEC_48_55 : origin = 0x08C000, length = 0x2000 /* on-chip Flash */
// FLASH_BANK0_SEC_56_63 : origin = 0x08E000, length = 0x2000 /* on-chip Flash */
// FLASH_BANK0_SEC_64_71 : origin = 0x090000, length = 0x2000 /* on-chip Flash */
// FLASH_BANK0_SEC_72_79 : origin = 0x092000, length = 0x2000 /* on-chip Flash */
// FLASH_BANK0_SEC_80_87 : origin = 0x094000, length = 0x2000 /* on-chip Flash */
// FLASH_BANK0_SEC_88_95 : origin = 0x096000, length = 0x2000 /* on-chip Flash */
// FLASH_BANK0_SEC_96_103 : origin = 0x098000, length = 0x2000 /* on-chip Flash */
// FLASH_BANK0_SEC_104_111 : origin = 0x09A000, length = 0x2000 /* on-chip Flash */
// FLASH_BANK0_SEC_112_119 : origin = 0x09C000, length = 0x2000 /* on-chip Flash */
// FLASH_BANK0_SEC_120_127 : origin = 0x09E000, length = 0x1FF0 /* on-chip Flash */
// FLASH_BANK0_SEC_127_RSVD : origin = 0x0A0FF0, length = 0x0010 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
}
SECTIONS
{
codestart : > BEGIN
.version : > BOOTVER
// .text : >> FLASH_BANK0_SEC_0_7, ALIGN(8)
.cinit : > FLASH_BANK0_SEC_0_7, ALIGN(8)
.switch : > FLASH_BANK0_SEC_0_7, ALIGN(8)
.reset : > RESET, TYPE = DSECT /* not used, */
.stack : > RAMM1
.bootkey : > BOOT_L_KEY
BOOT_section : > Z1_BOOTCTRL_OTP1
#if defined(__TI_EABI__)
Hi Paul,
I am out of office currently. I will be able to review and get back to you in couple of days. Thank you.
Thanks and regards,
Vamsi
In C code, #pragma RETAIN is applied to functions or variables. It is not applied to a section. When you specify the function or variable, no quotes are used. For further details, please search the C28x compiler manual.
Thanks and regards,
-George