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.

TMS320F28069: Source of .cinit : __lock and .cinit__unlock

Part Number: TMS320F28069


I'm currently building a custom bootloader that needs to reside entirely in Sector A. To do this, I've created a CCS project with only my bootloader code. My aim is to then integrate whatever code changes I've made as well as reuse much of my linker command file for a much bigger project. That bigger CCS project will contain my custom bootloader code as well as code that can be upgraded in the future. The code that doesn't have anything to do with the bootloader can be in sectors B-H.

Here's my issue: the first CCS project that I mentioned above (which only has the bootloader) is now working. Meaning, if I erase sectors B-H, it's still able to try to load code to sectors B-H after a power cycle. Furthermore, I can see from the memory map and the Memory Allocation view that there's nothing in sectors B-H. However, in the memory map, I did notice the following:

.cinit 0 003f42af 0000000c

003f42af 00000005 <whole-program> (.cinit:__lock)

003f42b4 00000005 <whole-program> (.cinit:__unlock)

003f42b9 00000002 --HOLE-- [fill = 0]


This does make sense since in my linker command file, I have the following line:

.cinit : > FLASH_A_BOOT, PAGE = 0

As the name suggests, it's storing all the .cinit in flash sector A. However, in my larger project, this will need to reference sectors B-H instead. This is because as global variables change, there will be a need to overwrite those older variables. Therefore, in the larger project, I would need a line like this:

.cinit : > FLASH_BCDEFGH, PAGE = 0

In that larger project, I'll need to specify a section that puts all the bootloader .cinits in sector A (so that it's not erased when the bootloader executes). However, I'm having trouble finding the global variables that's causing the memory map to list <whole-program> (.cinit:__lock) and <whole-program> (.cinit:__unlock). I tried the following, but it didn't work:



As you can see, the linker couldn't find any .cinits associated with the object files highlighted in yellow. Does anyone know how to find the sources of <whole-program> (.cinit:__lock) and <whole-program> (.cinit:__unlock)? Sorry for the long post.


  • Everyone

    It occurred to me that this might have something to do with optimizations.

    Under Properties -> Build -> C2000 Compiler -> Optimization, I changed the "Optimization Level" from "4 - Whole Program Optimizations" to "Off". When I did this and rebuilt the project,  .cinit:__lock and .cinit:__unlock were no longer in my memory map.

    However, as I mentioned earlier, I would like to make this part of a larger CCS project. Therefore, is it possible to have optimizations for only certain parts of a CCS project? Meaning, is there a command/setting for the compiler that tells it to ignore certain files when doing the optimization? In my case, these would be the files that correspond to the bootloader.

    Any suggestions would be greatly appreciated.

    Syed

  • This is obvious in retrospect, but if you right click on the individual files, you can go to Properties -> Build -> C2000 Compiler -> Optimization and change the Optimization level there. Then, it won't be included in optimization level.

    In case anyone needs more information, than can see chapter 3 of "TMS320C28x Optimizing C/C++ Compiler".
  • Hi Syed,

    Thanks for posting the resolution to your issue.