pointer assigned error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

pointer assigned error

335 Views
cui_jikai
Contributor I

Hi sir,

    we got some problem that need your kindly help :

   

   Cpu Type:LS1043 

   

   The orignal codes is so complicated ,so I simple the issue like this:

   1.Firstly,I have a global array which address is:0x9e473158,

       int g_port_list[] = {1,2,3,4,5,6};

   2.Secondly,I have one struct like this:

      typedef struct chip_type

      {

            int port_num;

            int *port_list;

      }chip_type_s;

   

   3.Thirdly,I declared one struct varilable as below:

  chip_type_s g_my_chip = 

   {

      .port_num = 6,

      .port_list = g_port_list,

   };

    4.  Here is the issue,I have a pointer:

         int *port_list;

         port_list = g_my_chip.port_list   ------ which the value of port_list should be 0x9e473158,But after I print it out,I got the value 0x73158,and I found the value g_my_chip.port_list is 0x73158 too,Could you please help to point why the address was cut to the least 20 bits ??

    BTW:

        This is cross compile and compile flags :

      cross compile:  aarch64-fsl-linux-gcc 
      compile flags:   -DCONFIG_ARM -DCONFIG_ARM64 -D__ARM64__ -march=armv8-a -fno-common -ffixed-x18 -fno-pic -mstrict-align -ffunction-sections -fdata-sections -fno-builtin -ffreestanding -nostdinc  -pipe -Wno-builtin-macro-redefined -fno-      stack-protector -Wno-format-nonliteral -Wno-format-security -DSTANDALONE -O2 -Os -Wstrict-prototypes -fno-pic -Wall  -DTEXT_BASE=0x9e400000 
0 Kudos
0 Replies