From ca1adccb2b4bda986b3b2eb733d5dd295c7e3cef Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Mon, 28 Aug 2023 10:01:06 +0200 Subject: [PATCH] fixes TGC5L settings --- CMakeLists.txt | 4 +- bare-metal-bsp/env/TGC5L/link.lds | 4 +- bare-metal-bsp/env/start.S | 8 +- benchmarks/dhrystone/dhrystone.dis | 3946 ---------------------------- hello-world/hello | Bin 61008 -> 0 bytes hello-world/hello.dis | 2558 ------------------ 6 files changed, 9 insertions(+), 6511 deletions(-) delete mode 100644 benchmarks/dhrystone/dhrystone.dis delete mode 100755 hello-world/hello delete mode 100644 hello-world/hello.dis diff --git a/CMakeLists.txt b/CMakeLists.txt index 952443d..12cd66f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,10 +9,10 @@ add_custom_target(fw-hello-world ALL USES_TERMINAL WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) add_custom_target(fw-dhrystone ALL - COMMAND make -C ${riscvfw_SOURCE_DIR}/benchmarks/dhrystone BOARD=${TARGET} ISA=${ISA} + COMMAND make -C ${riscvfw_SOURCE_DIR}/benchmarks/dhrystone BOARD=${BOARD} ISA=${ISA} USES_TERMINAL WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) add_custom_target(fw-coremark ALL - COMMAND make -C ${riscvfw_SOURCE_DIR}/benchmarks/coremark/cm PORT_DIR=../tgc BOARD=${TARGET} ISA=${ISA} + COMMAND make -C ${riscvfw_SOURCE_DIR}/benchmarks/coremark/cm PORT_DIR=../tgc BOARD=${BOARD} ISA=${ISA} USES_TERMINAL WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/bare-metal-bsp/env/TGC5L/link.lds b/bare-metal-bsp/env/TGC5L/link.lds index 86a83a4..927479c 100644 --- a/bare-metal-bsp/env/TGC5L/link.lds +++ b/bare-metal-bsp/env/TGC5L/link.lds @@ -4,8 +4,8 @@ ENTRY( _start ) MEMORY { - flash (rxai!w) : ORIGIN = 0x80000000, LENGTH = 64k - ram (wxa!ri) : ORIGIN = 0x80010000, LENGTH = 64k + flash (rxai!w) : ORIGIN = 0x00000000, LENGTH = 256M + ram (wxa!ri) : ORIGIN = 0x20000000, LENGTH = 1M } PHDRS diff --git a/bare-metal-bsp/env/start.S b/bare-metal-bsp/env/start.S index b57c04d..0c26749 100644 --- a/bare-metal-bsp/env/start.S +++ b/bare-metal-bsp/env/start.S @@ -5,6 +5,8 @@ .type _start,@function _start: + la gp, trap_entry + csrw mtvec, gp .option push .option norelax la gp, __global_pointer$ @@ -18,8 +20,8 @@ _start: bgeu a1, a2, 2f 1: lw t0, (a0) - sw t0, (a1) addi a0, a0, 4 + sw t0, (a1) addi a1, a1, 4 bltu a1, a2, 1b 2: @@ -35,11 +37,11 @@ _start: 2: /* Call global constructors */ -#ifdef HAVE_INIT_FINI +//#ifdef HAVE_INIT_FINI la a0, __libc_fini_array call atexit call __libc_init_array -#endif +//#endif #ifndef __riscv_float_abi_soft /* Enable FPU */ li t0, MSTATUS_FS diff --git a/benchmarks/dhrystone/dhrystone.dis b/benchmarks/dhrystone/dhrystone.dis deleted file mode 100644 index f87ecee..0000000 --- a/benchmarks/dhrystone/dhrystone.dis +++ /dev/null @@ -1,3946 +0,0 @@ - -dhrystone: file format elf32-littleriscv - - -Disassembly of section .init: - -00000020 <_start>: - .type _start,@function - -_start: -.option push -.option norelax - la gp, __global_pointer$ - 20: 10000197 auipc gp,0x10000 - 24: 7f018193 addi gp,gp,2032 # 10000810 <__global_pointer$> -.option pop - la sp, _sp - 28: 10004117 auipc sp,0x10004 - 2c: fd810113 addi sp,sp,-40 # 10004000 <_sp> - - /* Load data section */ - la a0, _data_lma - 30: 00003517 auipc a0,0x3 - 34: e7450513 addi a0,a0,-396 # 2ea4 <_data_lma> - la a1, _data - 38: 10000597 auipc a1,0x10000 - 3c: fc858593 addi a1,a1,-56 # 10000000 <__DATA_BEGIN__> - la a2, _edata - 40: 10000617 auipc a2,0x10000 - 44: fd460613 addi a2,a2,-44 # 10000014 - bgeu a1, a2, 2f - 48: 00c5fc63 bgeu a1,a2,60 <_start+0x40> -1: - lw t0, (a0) - 4c: 00052283 lw t0,0(a0) - sw t0, (a1) - 50: 0055a023 sw t0,0(a1) - addi a0, a0, 4 - 54: 00450513 addi a0,a0,4 - addi a1, a1, 4 - 58: 00458593 addi a1,a1,4 - bltu a1, a2, 1b - 5c: fec5e8e3 bltu a1,a2,4c <_start+0x2c> -2: - - /* Clear bss section */ - la a0, __bss_start - 60: 10000517 auipc a0,0x10000 - 64: fb450513 addi a0,a0,-76 # 10000014 - la a1, _end - 68: 10002597 auipc a1,0x10002 - 6c: 7b058593 addi a1,a1,1968 # 10002818 <__BSS_END__> - bgeu a0, a1, 2f - 70: 00b57863 bgeu a0,a1,80 <_start+0x60> -1: - sw zero, (a0) - 74: 00052023 sw zero,0(a0) - addi a0, a0, 4 - 78: 00450513 addi a0,a0,4 - bltu a0, a1, 1b - 7c: feb56ce3 bltu a0,a1,74 <_start+0x54> - fssr x0 -1: -#endif - - /* argc = argv = 0 */ - li a0, 0 - 80: 00000513 li a0,0 - li a1, 0 - 84: 00000593 li a1,0 - call main - 88: 008000ef jal ra,90
- tail _exit - 8c: 5640106f j 15f0 <__wrap__exit> - -Disassembly of section .text: - -00000090
: -main () -/*****/ - - /* main program, corresponds to procedures */ - /* Main and Proc_0 in the Ada version */ -{ - 90: 7135 addi sp,sp,-160 - REG int Run_Index; - REG int Number_Of_Runs; - - /* Initializations */ - - Next_Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type)); - 92: 03000513 li a0,48 -{ - 96: cf06 sw ra,156(sp) - 98: cd22 sw s0,152(sp) - 9a: c94a sw s2,144(sp) - 9c: c74e sw s3,140(sp) - 9e: c552 sw s4,136(sp) - a0: c356 sw s5,132(sp) - a2: c15a sw s6,128(sp) - a4: dede sw s7,124(sp) - a6: dce2 sw s8,120(sp) - a8: dae6 sw s9,116(sp) - aa: d8ea sw s10,112(sp) - ac: d6ee sw s11,108(sp) - ae: cb26 sw s1,148(sp) - Next_Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type)); - b0: 440010ef jal ra,14f0 <__wrap_malloc> - b4: 842a mv s0,a0 - b6: 82818793 addi a5,gp,-2008 # 10000038 - Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type)); - ba: 03000513 li a0,48 - Next_Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type)); - be: c380 sw s0,0(a5) - Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type)); - c0: 430010ef jal ra,14f0 <__wrap_malloc> - - Ptr_Glob->Ptr_Comp = Next_Ptr_Glob; - Ptr_Glob->Discr = Ident_1; - Ptr_Glob->variant.var_1.Enum_Comp = Ident_3; - Ptr_Glob->variant.var_1.Int_Comp = 40; - strcpy (Ptr_Glob->variant.var_1.Str_Comp, - c4: 00002717 auipc a4,0x2 - c8: 50470713 addi a4,a4,1284 # 25c8 <__modsi3+0x30> - "DHRYSTONE PROGRAM, SOME STRING"); - strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING"); - cc: 00003917 auipc s2,0x3 - d0: a9890913 addi s2,s2,-1384 # 2b64 <__modsi3+0x5cc> - strcpy (Ptr_Glob->variant.var_1.Str_Comp, - d4: 00072283 lw t0,0(a4) - d8: 00472e83 lw t4,4(a4) - dc: 00872e03 lw t3,8(a4) - e0: 00c72303 lw t1,12(a4) - e4: 01072883 lw a7,16(a4) - e8: 01472803 lw a6,20(a4) - ec: 4f0c lw a1,24(a4) - ee: 01c75603 lhu a2,28(a4) - f2: 01e74683 lbu a3,30(a4) - strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING"); - f6: 00092f83 lw t6,0(s2) - fa: 00492f03 lw t5,4(s2) - fe: 00892983 lw s3,8(s2) - Ptr_Glob->variant.var_1.Enum_Comp = Ident_3; - 102: 4389 li t2,2 - Ptr_Glob->variant.var_1.Int_Comp = 40; - 104: 02800a13 li s4,40 - Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type)); - 108: 82c18a93 addi s5,gp,-2004 # 1000003c - Ptr_Glob->variant.var_1.Enum_Comp = Ident_3; - 10c: 00752423 sw t2,8(a0) - strcpy (Ptr_Glob->variant.var_1.Str_Comp, - 110: 00552823 sw t0,16(a0) - 114: 01d52a23 sw t4,20(a0) - 118: 01c52c23 sw t3,24(a0) - 11c: 00652e23 sw t1,28(a0) - 120: 03152023 sw a7,32(a0) - 124: 03052223 sw a6,36(a0) - 128: d50c sw a1,40(a0) - 12a: 02c51623 sh a2,44(a0) - 12e: 02d50723 sb a3,46(a0) - strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING"); - 132: d07e sw t6,32(sp) - 134: d27a sw t5,36(sp) - Ptr_Glob->Ptr_Comp = Next_Ptr_Glob; - 136: c100 sw s0,0(a0) - Ptr_Glob->Discr = Ident_1; - 138: 00052223 sw zero,4(a0) - Ptr_Glob->variant.var_1.Int_Comp = 40; - 13c: 01452623 sw s4,12(a0) - Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type)); - 140: 00aaa023 sw a0,0(s5) - strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING"); - 144: 00c92b03 lw s6,12(s2) - 148: 01092b83 lw s7,16(s2) - 14c: 01492c03 lw s8,20(s2) - 150: 01892c83 lw s9,24(s2) - 154: d44e sw s3,40(sp) - 156: 01c95d03 lhu s10,28(s2) - 15a: 01e94d83 lbu s11,30(s2) - - Arr_2_Glob [8][7] = 10; - 15e: 10000797 auipc a5,0x10000 - 162: faa78793 addi a5,a5,-86 # 10000108 - 166: 4429 li s0,10 - 168: 6487ae23 sw s0,1628(a5) - /* Was missing in published program. Without this statement, */ - /* Arr_2_Glob [8][7] would have an undefined value. */ - /* Warning: With 16-Bit processors and Number_Of_Runs > 32000, */ - /* overflow may occur for this array element. */ - - printf ("\n"); - 16c: 00002517 auipc a0,0x2 - 170: 6c450513 addi a0,a0,1732 # 2830 <__modsi3+0x298> - strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING"); - 174: d65a sw s6,44(sp) - 176: d85e sw s7,48(sp) - 178: da62 sw s8,52(sp) - 17a: dc66 sw s9,56(sp) - 17c: 03a11e23 sh s10,60(sp) - 180: 03b10f23 sb s11,62(sp) - printf ("\n"); - 184: 425010ef jal ra,1da8 <__wrap_printf> - printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n"); - 188: 00002517 auipc a0,0x2 - 18c: 46050513 addi a0,a0,1120 # 25e8 <__modsi3+0x50> - 190: 419010ef jal ra,1da8 <__wrap_printf> - printf ("\n"); - 194: 00002517 auipc a0,0x2 - 198: 69c50513 addi a0,a0,1692 # 2830 <__modsi3+0x298> - 19c: 40d010ef jal ra,1da8 <__wrap_printf> - if (Reg) - 1a0: 8181a503 lw a0,-2024(gp) # 10000028 - 1a4: 5a050963 beqz a0,756 - { - printf ("Program compiled with 'register' attribute\n"); - 1a8: 00002517 auipc a0,0x2 - 1ac: 47050513 addi a0,a0,1136 # 2618 <__modsi3+0x80> - 1b0: 3f9010ef jal ra,1da8 <__wrap_printf> - printf ("\n"); - 1b4: 00002517 auipc a0,0x2 - 1b8: 67c50513 addi a0,a0,1660 # 2830 <__modsi3+0x298> - 1bc: 3ed010ef jal ra,1da8 <__wrap_printf> - else - { - printf ("Program compiled without 'register' attribute\n"); - printf ("\n"); - } - printf ("Please give the number of runs through the benchmark: "); - 1c0: 00002517 auipc a0,0x2 - 1c4: 4b450513 addi a0,a0,1204 # 2674 <__modsi3+0xdc> - 1c8: 3e1010ef jal ra,1da8 <__wrap_printf> - { - int n; - scanf ("%d", &n); - 1cc: 008c addi a1,sp,64 - 1ce: 00002517 auipc a0,0x2 - 1d2: 4de50513 addi a0,a0,1246 # 26ac <__modsi3+0x114> - 1d6: 70a000ef jal ra,8e0 <__wrap_scanf> - Number_Of_Runs = n; - 1da: 4406 lw s0,64(sp) - } - printf ("\n"); - 1dc: 00002517 auipc a0,0x2 - 1e0: 65450513 addi a0,a0,1620 # 2830 <__modsi3+0x298> - Number_Of_Runs = n; - 1e4: c622 sw s0,12(sp) - printf ("\n"); - 1e6: 3c3010ef jal ra,1da8 <__wrap_printf> - - printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs); - 1ea: 85a2 mv a1,s0 - 1ec: 00002517 auipc a0,0x2 - 1f0: 4c450513 addi a0,a0,1220 # 26b0 <__modsi3+0x118> - 1f4: 3b5010ef jal ra,1da8 <__wrap_printf> -#ifdef TIMES - times (&time_info); - Begin_Time = (long) time_info.tms_utime; -#endif -#ifdef TIME - Begin_Time = time ( (long *) 0); - 1f8: 4501 li a0,0 - 1fa: 6da000ef jal ra,8d4