09-11-2020, 12:09 PM
Hi,
I am trying to compile a simple code which has global arrays. I have initialized all the global arrays to make sure the compiler does not generate the code to initialize them to 0. However, I am still getting these "memset" calls in the _start section of the assembly.
The program is not return to start section after executing till 1C0001f8
What should I do to load complete hex file to my verilator model? how can I get rid of this memset? I tried with
in my gcc, but not solved my issue. Currently using riscv gnu toolchain 10.1.0.
I am trying to compile a simple code which has global arrays. I have initialized all the global arrays to make sure the compiler does not generate the code to initialize them to 0. However, I am still getting these "memset" calls in the _start section of the assembly.
Code:
Disassembly of section .text:
1c000000 <_start>:
1c000000: 00001197 auipc gp,0x1
1c000004: 18018193 addi gp,gp,384 # 1c001180 <__global_pointer$>
1c000008: 00001517 auipc a0,0x1
1c00000c: 95850513 addi a0,a0,-1704 # 1c000960 <__FRAME_END__>
1c000010: 00001617 auipc a2,0x1
1c000014: 97060613 addi a2,a2,-1680 # 1c000980 <completed.1>
1c000018: 40a60633 sub a2,a2,a0
1c00001c: 00000593 li a1,0
1c000020: 1a8000ef jal ra,1c0001c8 <memset>
1c000024: 00000517 auipc a0,0x0
Code:
1c0001c8 <memset>:
1c0001c8: 00f00313 li t1,15
1c0001cc: 00050713 mv a4,a0
1c0001d0: 02c37e63 bgeu t1,a2,1c00020c <memset+0x44>
1c0001d4: 00f77793 andi a5,a4,15
1c0001d8: 0a079063 bnez a5,1c000278 <memset+0xb0>
1c0001dc: 08059263 bnez a1,1c000260 <memset+0x98>
1c0001e0: ff067693 andi a3,a2,-16
1c0001e4: 00f67613 andi a2,a2,15
1c0001e8: 00e686b3 add a3,a3,a4
1c0001ec: 00b72023 sw a1,0(a4)
1c0001f0: 00b72223 sw a1,4(a4)
1c0001f4: 00b72423 sw a1,8(a4)
1c0001f8: 00b72623 sw a1,12(a4)
1c0001fc: 01070713 addi a4,a4,16
1c000200: fed766e3 bltu a4,a3,1c0001ec <memset+0x24>
1c000204: 00061463 bnez a2,1c00020c <memset+0x44>
What should I do to load complete hex file to my verilator model? how can I get rid of this memset? I tried with
PHP Code:
-fno-zero-initialized-in-bss