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.

Writing to a specific flash address during uploading a FW

Other Parts Discussed in Thread: SYSCONFIG

Hello,

I use NVS functions to write parameters to flash. It works good. I would like to check the all parameters were successfuly written (I do several writes/erases). I know (and I use it) there is check after writing. But if the power supply interrupt happens during writing, some data would be missing. I think the easist way to check it is to use another variable in the flash which I reset (set to zero) at the beggining after all writting I set the different value. Then I can anytime check the value of this variable, if the variable is not the chosen value, there is flash problem. I have implemented this. But the problem is the first start after uploading the FW. Can I tell the compiler to write a value of the specific address in my nvs section? I tried #pragma LOCATION and #pragma DATA_SECTION, but it does not work. I use CCS and CC1312 (when I filled the MCU in the part number here I could not choose CCS forum)

  • I tried #pragma LOCATION and #pragma DATA_SECTION, but it does not work.

    When you use #pragma LOCATION, what do you see that lets you know it didn't work?  Exactly how do you see it?

    Thanks and regards,

    -George

  • When I use that, I see "program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. run placement with alignment fails for section ".TI.bound:checkFlashVar" size 0x2, overlaps with ".TI.bound:flashBuf0", size 0x4000 (page 0)". I think this happens because this pragma does not do only writting to a specific address but it also increases the section where is writting in.

  • I think you use #pragma LOCATION for both checkFlashVar and flashBuf0, and they overlap in memory.  You have to change the address for one of them, or not use #pragma LOCATION for one of them, or something similar.

    Thanks and regards,

    -George

  • flashBuf0 is not a variable, it is probably inner name for the flash section. I do not use the flashBuf0 variable anywhere.

  • The only way I know to create an output section with the name ...

    .TI.bound:flashBuf0

    ... is to write C code similar to ...

    #pragma LOCATION(flashBuf0, 0x1000)
    unsigned char flashBuf0[0x4000];

    You must create this output section some other way.  How do you do it?

    In addition, which compiler do you use, and what version?

    Thanks and regards,

    -George

  • Unfortunately using pointer type NVS did not help. I could create variable at the specific address without any errors. However when I started debugging, the program could not start. It jumped imediately to faultISR. I also checked the flash address and there was not the required value but 0xFF.

    I use the compiler TI v20.2.5.LTS

  • Hi Igi, 

    I am able to place a character array in a particular location using the pragma LOCATION. 

    I chose an arbitrary location 0x4000 that was not equal to 0x10000 which is my NVS driver's reserved region.(named flashbuf0)

    In your case, the error message suggests that you are using the same memory location for the string as the region of the NVS driver.(between regionBase and regionBase+regionSize).    

    When I use that, I see "program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. run placement with alignment fails for section ".TI.bound:checkFlashVar" size 0x2, overlaps with ".TI.bound:flashBuf0", size 0x4000 (page 0)".

    This overlapping of NVS region and your string location causes the error message you are seeing. 

    You can use Pointer as the RegionType on Sysconfig. This way Sysconfig does not create a variable flashbuf0 placed in that region, allowing you to overlap the variable you want to place and this NVS region. 


    Regards,

    Sid