This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

pragma and scatter file

Dear Sir, I have read example code.
#pragma arm section rwdata = "foo", rodata = "bar"
int x2 = 5; // in foo (data part of region)
int y2[100]; // in .bss
int const z2[3] = {1,2,3};

Now i want to place x2 data at a particular memory location(0x40000020) using scatter file. how can i do this.As pragma is used to name the section and this name is used to link using scatter file.

Kindly tell, how can i use this pragma to name the section and then placing the variable at a particular memory location using scatter file.

Thanks

Parents
  • you can place your variable inside a separate .c file, then add the object (.o file) at the proper location in the scatter file. as you mentioned, you can also create a separate section using a #pragma (but that is not so portable). see linker documentation for examples.

      RW_IRAM2_2 0x40002040 0xDFC0 {  ; RW data
            FILE_SYSTEM.o (+RW +ZI)
            .ANY (+RW +ZI)
      }
    

Reply
  • you can place your variable inside a separate .c file, then add the object (.o file) at the proper location in the scatter file. as you mentioned, you can also create a separate section using a #pragma (but that is not so portable). see linker documentation for examples.

      RW_IRAM2_2 0x40002040 0xDFC0 {  ; RW data
            FILE_SYSTEM.o (+RW +ZI)
            .ANY (+RW +ZI)
      }
    

Children
No data