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.

SET_CODE_SECTION

I amd trying to use SET_CODE_SECTION pragma directive in a C project to allocate a C file to specific section. This directive is mentioned in the spnu151g manual that it can be used for C or C++. However, when I build my project with CC4 ver 4.2.4, I get a warning "unrecognized #pragma". If I use CODE_SECTION directive instead, it will work, but the problem is that I need to add it for each function, instead of having two pragmas for each file.

Does anyone know what the issue is with SET_CODE_SECTION pragma directive?

  • Hi Alex,

    This is a new feature of the compiler which is available begining with tools version 4.9.0. I guess you are using 4.6.6 which is the default, if I'm not wrong.

    You can change the tools version in your projects' properties, in the tab "CCS Build" --> "General" --> "Code Generation tools:" --> "TI v4.9.1".

    If you don't have the new tools version in this list you should be able to install it with the "Install/Update" feature of CCSv4 just choose "Search for new features to install" and than choose "Code Generation Tools Updates".

     

    Best Regards,

    Christian

  • Hi Christian,

     

     

    Thanks for replying to my question. I hope you not going to be sorry for that because I have some more :).

    At first I want to say that I do have compiler version 4.6.6, but when I tried to update it didn’t find new updates. I did exactly what you said. Any idea why it couldn't find updates?

    I’m doing this stuff because I want to boot from RAM, so I have some program in Flash that I want to copy to RAM, switch between FLASH and RAM and reset via MMUGCR register. The problem that I have is with the intvecs table located at address 0. The assembly branch instruction is not linked correctly because the branch is relative.

    Would you know the steps to create a program that’s loaded in FLASH but needs to run (boot) from RAM?

     

  • Hi Alex,

    sorry for the delay, but I was on vacation the last week.

    I wondering that you don't find the update with the update tool, I tried it again here with another PC and it found the actual version (4.9.1) and installed it without any problems.

     

    Why do you want to boot from RAM, is it just for the development phase, or is it really needed by your application?

    In general if you like to execute some functions out of the RAM during runtime (without a memory swap), you can use the LOAD and RUN time address feature of the linker, as well as the Copy Tables to load the code and data from flash to ram during runtime.

     

    Best Regards,

    Christian

  • Hi Christian,

    Thanks again for the response. I don't know, but when I do "Find new features to install" and select the "Code generation tools updates" the result I get is "No features found on the selected site(s)."

    I found the answers to what I needed myself though. Instead of using the pragma statement I do it through the linker file defining all object files for the section in the parenthesis:

    ramcopy : {file1.obj, file2.obj...} LOAD = FLASH1, RUN = PROGRAM

    We are developing software by DO-178B standard. The actual application is level A software, but we also need Data Load software that can do updates to our application software. This software is level D and cannot be located in the flash in executable form because then it will have to be level A.

    Anyway, I have the concept working now.

     

    Alex