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.

TMS320C6748: how can i fill a userdefine section with 0

Part Number: TMS320C6748
Other Parts Discussed in Thread: OMAP-L138

i create a new section in cfg file,like:

Program.sectMap[".env_reg"] = new Program.SectionSpec();
Program.sectMap[".env_reg"].loadSegment = "DDR_INIT_1";
Program.sectMap[".env_reg"].loadAlign = 4;
Program.sectMap[".env_reg"].fill = 0;

so, i hope the unsed palce of this section is filled by 0.and  in linker.cmd file,it seemed worked.

but, the unsed palce of this section is not filled by 0 in fact.

and in map file,it seemed that the above cfg is not worked.

is there something wrong?

  • Hello Xu Yang,

    How is the section .env_reg defined in your source code?

    Can you try to make a project without using RTSC .cfg file but defining a linker command file? You can simply add the following to the linker command file:

    .env_reg: load > DDR_INIT_1 align = 0x4, fill = 0x0

    I'd like to know if this is a RTSC issue or a linker issue.

    Thanks and regards,

    Jianzhong

  • hi,here is the project:

    test_fill.zip

    but, the section is not filled by 0, too.

  • Hello,

    I looked at your code. First of all, because you only had variable "c" in section ".env_reg", only 0xC0400000 is expected to be filled by 0.

    Secondly, I built your code and loaded to OMAP-L138 LCDK and was able to see memory filled by 0 correctly.

    Before I loaded the code, the memory content was:

    After I loaded the code, the memory content became:

    Then I modified your code to define c as an array of 8 elements:

    #pragma DATA_SECTION(c, ".env_reg");
    #pragma RETAIN ( c );
    
    volatile int a, b, c[8];
    

    and the memory was filled by 0's properly after loading the code:

    I'm not sure what's the problem with your setup. Can you try if you can directly modify the content at 0xC0400000? 

    Regards,

    Jianzhong

  • “fill 0” means fill 0 to an uninitialized variate?

    now, i want to fill 0 to the space of unuesed section.it means fill 0 to all section except  the variable used.

    how can i do that?

  • Ok. I understand your needs now. You can use CCS to fill a memory section with 0 and then load your code. While in debug mode, go to CCS > Tools > Fill Memory. 

    Now, 0x100 memory locations are set to 0:

  • no, i hope fill the unuesed space of a memory section with 0 when the code startup.without any emulator.

  • “fill 0” means fill 0 to an uninitialized variate?

    It means 0 will be filled to the specified section. For example, with the following, 0 will be filled to section .env_reg:

    .env_reg: load > DDR_INIT_1 align = 0x4, fill = 0x0

    i want to fill 0 to the space of unuesed section.it means fill 0 to all section except  the variable used.

    This is not possible. The linker can only fill 0 to the whole specified section, not part of the section.

  • It means 0 will be filled to the specified section. For example, with the following, 0 will be filled to section .env_reg:

    .env_reg: load > DDR_INIT_1 align = 0x4, fill = 0x0

    yes,i'd like to do this.but it do not work.

    in my project,there have only one variable,so the section will be all 0, but 0xc0400000~0xc0400003,but it do not work.

  • I was able to do that. Please refer to my earlier post. Can you try if you can directly modify the content at 0xC0400000 through CCS on your setup? 

  • sorry,i have a mistake.

    the section .env_reg is locaed in memeory DDR_INIT_1.i want fill DDR_INIT_1 with 0.

  • Ok. Can you try if you can directly modify the content of the memory which you want to fill 0 in through CCS on your setup? Because I tried your project and was able to fill memory with 0's, I'd like to know if that's your board setup problem. If you can modify the content of the memory, that means your board doesn't have setup problems.

  • i can fill 0 through CCS, but i want fill it by 0 when the cpu free run.

    because of there have a bootloader, is runned before my project.and the bootloader use the DDR_INIT_1 area, too.

    red cycle is filled by my project, the others are filled by bootloader. now i want to fill all DDR_INIT_1 area by 0, in my project.

  • If you can directly modify the memory content, then you should be able to fill the same memory with 0's, when you specify that in the linker command file:

    .env_reg: load > DDR_INIT_1 align = 0x4, fill = 0x0

    I verified this in my earlier post.

  • the blue area is DDR_INIT_1 memroy, the red area is .env_reg section.

    the linker command ".env_reg: load > DDR_INIT_1 align = 0x4, fill = 0x0" can fill red area with 0, only.

    in my project,

    you can fill some data in red area and blue area.then restart in ccs.you can see the red area filled by 0,and the blue area is not.

    now i want fill all the blue area with zero with some command in the cfg file.

  • the linker command ".env_reg: load > DDR_INIT_1 align = 0x4, fill = 0x0" can fill red area with 0, only.

    Yes, this is expected. The red area is section .env_reg. To fill the whole blue area, you'll need to increase the size of section .env_reg.