From d2c809abe04ca14d2828458edaa9392724ede85f Mon Sep 17 00:00:00 2001 From: Michael Cardell Widerkrantz Date: Thu, 17 Apr 2025 12:51:26 +0200 Subject: [PATCH] testapp: Use tkey-libs crt0 and linker script --- hw/application_fpga/fw/testapp/Makefile | 5 +- hw/application_fpga/fw/testapp/app.lds | 64 ------------------------- hw/application_fpga/fw/testapp/crt0.S | 53 -------------------- 3 files changed, 2 insertions(+), 120 deletions(-) delete mode 100644 hw/application_fpga/fw/testapp/app.lds delete mode 100644 hw/application_fpga/fw/testapp/crt0.S diff --git a/hw/application_fpga/fw/testapp/Makefile b/hw/application_fpga/fw/testapp/Makefile index afc13f8..a83469f 100644 --- a/hw/application_fpga/fw/testapp/Makefile +++ b/hw/application_fpga/fw/testapp/Makefile @@ -35,8 +35,8 @@ ASFLAGS = \ -mno-relax LDFLAGS = \ - -T $(P)/app.lds \ - -L $(LIBDIR) -lcommon + -T $(LIBDIR)/app.lds \ + -L $(LIBDIR) -lcrt0 -lcommon .PHONY: all all: testapp.bin @@ -54,7 +54,6 @@ TESTAPP_FMTFILES = *.[ch] TESTAPP_OBJS = \ $(P)/main.o \ - $(P)/crt0.o \ $(P)/syscall.o testapp.elf: tkey-libs $(TESTAPP_OBJS) diff --git a/hw/application_fpga/fw/testapp/app.lds b/hw/application_fpga/fw/testapp/app.lds deleted file mode 100644 index 421122c..0000000 --- a/hw/application_fpga/fw/testapp/app.lds +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022 Tillitis AB - * SPDX-License-Identifier: BSD-2-Clause - */ - -OUTPUT_ARCH( "riscv" ) -ENTRY(_start) - -MEMORY -{ - RAM (rwx) : ORIGIN = 0x40000000, LENGTH = 0x20000 /* 128 KB */ -} - -SECTIONS -{ - .text.init : - { - *(.text.init) - } >RAM - - .text : - { - . = ALIGN(4); - *(.text) /* .text sections (code) */ - *(.text*) /* .text* sections (code) */ - *(.rodata) /* .rodata sections (constants, strings, etc.) */ - *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ - *(.srodata) /* .rodata sections (constants, strings, etc.) */ - *(.srodata*) /* .rodata* sections (constants, strings, etc.) */ - . = ALIGN(4); - _etext = .; - _sidata = _etext; - } >RAM - - .data : AT (_etext) - { - . = ALIGN(4); - _sdata = .; - . = ALIGN(4); - *(.data) /* .data sections */ - *(.data*) /* .data* sections */ - *(.sdata) /* .sdata sections */ - *(.sdata*) /* .sdata* sections */ - . = ALIGN(4); - _edata = .; - } >RAM - - /* Uninitialized data section */ - .bss : - { - . = ALIGN(4); - _sbss = .; - *(.bss) - *(.bss*) - *(.sbss) - *(.sbss*) - *(COMMON) - - . = ALIGN(4); - _ebss = .; - } >RAM - - /* libcrt0/crt0.S inits stack to start just below end of RAM */ -} diff --git a/hw/application_fpga/fw/testapp/crt0.S b/hw/application_fpga/fw/testapp/crt0.S deleted file mode 100644 index f484b7d..0000000 --- a/hw/application_fpga/fw/testapp/crt0.S +++ /dev/null @@ -1,53 +0,0 @@ -// SPDX-FileCopyrightText: 2022 Tillitis AB -// SPDX-License-Identifier: BSD-2-Clause - - .section ".text.init" - .global _start -_start: - li x1, 0 - li x2, 0 - li x3, 0 - li x4, 0 - li x5, 0 - li x6, 0 - li x7, 0 - li x8, 0 - li x9, 0 - li x10,0 - li x11,0 - li x12,0 - li x13,0 - li x14,0 - li x15,0 - li x16,0 - li x17,0 - li x18,0 - li x19,0 - li x20,0 - li x21,0 - li x22,0 - li x23,0 - li x24,0 - li x25,0 - li x26,0 - li x27,0 - li x28,0 - li x29,0 - li x30,0 - li x31,0 - - /* init stack below 0x40020000 (TK1_RAM_BASE+TK1_RAM_SIZE) */ - li sp, 0x4001fff0 - - /* zero-init bss section */ - la a0, _sbss - la a1, _ebss - bge a0, a1, end_init_bss - -loop_init_bss: - sw zero, 0(a0) - addi a0, a0, 4 - blt a0, a1, loop_init_bss - -end_init_bss: - call main