We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I want to define the variable in the designated address space.I used another compiler,before the variable define,I can use the #pragma to distribute the address space. What can I do with Keil?Such as the #pragma! Thank you very much!
You can put the whole collection of items you want placed in a section within a structure. That also groups all the information into a logical unit.
The zero_init is used to force the linker to put the data into a section that is not initialized at startup, which is very useful for non volatile data. You might not need or want it.
Thank you very much! I define the section in the sct like this: RAM 0x20000000 0x7FFF { ADDER 0x7FFF { data_common.o(+RW) (foo) ; select section foo from data_common.o } }
define the variable in the data_common.c like this: #pragma arm section rwdata="foo" int data=0; #pragma arm section rwdata
but the variable address in the .map file not assigned to the correct address after compile: Base Addr Size Type Attr Idx E Section Name Object
0x1fff8000 0x0000000c Data RW 605 .data main.o 0x1fff800c 0x00000004 Data RW 647 foo data_common.o
can you help me?Thank you!
I can see no reason for me to continue to give advice when you have chosen to do something other than what I have suggested.
It's over to you now.
I have tested the way you told me like this,but it not effective: int__attribute__((section("foo"))) data;
define the section in the .sct like this :
RAM 0x20000000 0x7FFF { RAM_Data 0x20000000 0x7FFF { data_common.o(+RW) (foo) ; select section foo from data_common.o } }
but the address in the .map didn't in the expect address: data 0x1fff800c Data 4 data_common.o(foo)
so,if I define variable by this method,what can I do? Thank you very much!