mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-09-18 20:04:42 -04:00
fw: Build qemu_firmware with different linker script
The qemu_firmware is too large for the real hardware's 8k of ROM. The emulator, however, has lots of ROM. Use a different linker script for to reflect this.
This commit is contained in:
parent
e935195846
commit
48108cb3a2
2 changed files with 94 additions and 2 deletions
|
@ -185,6 +185,11 @@ LDFLAGS = \
|
||||||
-Wl,--cref,-M \
|
-Wl,--cref,-M \
|
||||||
-L $(LIBDIR) -lcommon -lblake2s
|
-L $(LIBDIR) -lcommon -lblake2s
|
||||||
|
|
||||||
|
QEMU_LDFLAGS = \
|
||||||
|
-T $(P)/fw/tk1/qemu_firmware.lds \
|
||||||
|
-Wl,--cref,-M \
|
||||||
|
-L $(LIBDIR) -lcommon -lblake2s
|
||||||
|
|
||||||
# Common libraries the firmware and testfw depend on. See
|
# Common libraries the firmware and testfw depend on. See
|
||||||
# https://github.com/tillitis/tkey-libs/
|
# https://github.com/tillitis/tkey-libs/
|
||||||
.PHONY: tkey-libs
|
.PHONY: tkey-libs
|
||||||
|
@ -206,8 +211,8 @@ qemu_firmware.elf: CFLAGS += -DQEMU_DEBUG
|
||||||
qemu_firmware.elf: ASFLAGS += -DQEMU_DEBUG
|
qemu_firmware.elf: ASFLAGS += -DQEMU_DEBUG
|
||||||
qemu_firmware.elf: CFLAGS += -DQEMU_SYSCALL
|
qemu_firmware.elf: CFLAGS += -DQEMU_SYSCALL
|
||||||
qemu_firmware.elf: ASFLAGS += -DQEMU_SYSCALL
|
qemu_firmware.elf: ASFLAGS += -DQEMU_SYSCALL
|
||||||
qemu_firmware.elf: firmware.elf
|
qemu_firmware.elf: tkey-libs $(FIRMWARE_OBJS) $(P)/fw/tk1/qemu_firmware.lds
|
||||||
mv firmware.elf qemu_firmware.elf
|
$(CC) $(CFLAGS) $(FIRMWARE_OBJS) $(QEMU_LDFLAGS) -o $@ > $(basename $@).map
|
||||||
|
|
||||||
# Create compile_commands.json for clangd and LSP
|
# Create compile_commands.json for clangd and LSP
|
||||||
.PHONY: clangd
|
.PHONY: clangd
|
||||||
|
|
87
hw/application_fpga/fw/tk1/qemu_firmware.lds
Normal file
87
hw/application_fpga/fw/tk1/qemu_firmware.lds
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2022, 2023 - Tillitis AB
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
OUTPUT_ARCH("riscv")
|
||||||
|
ENTRY(_start)
|
||||||
|
|
||||||
|
/* Define stack size */
|
||||||
|
STACK_SIZE = 3000;
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
ROM (rx) : ORIGIN = 0x00000000, LENGTH = 128k
|
||||||
|
FWRAM (rw) : ORIGIN = 0xd0000000, LENGTH = 0xF00 /* 3840 B */
|
||||||
|
RESETINFO (rw) : ORIGIN = 0xd0000F00, LENGTH = 0x100 /* 256 B (part of FW_RAM area) */
|
||||||
|
RAM (rwx) : ORIGIN = 0x40000000, LENGTH = 0x20000 /* 128 KB */
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.text.init :
|
||||||
|
{
|
||||||
|
*(.text.init)
|
||||||
|
} >ROM
|
||||||
|
|
||||||
|
.htif :
|
||||||
|
{
|
||||||
|
. = ALIGN(0x00000000);
|
||||||
|
*(.htif)
|
||||||
|
} >ROM
|
||||||
|
|
||||||
|
.text :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
_stext = .;
|
||||||
|
*(.text) /* .text sections (code) */
|
||||||
|
*(.text*) /* .text* sections (code) */
|
||||||
|
*(.rodata) /* .rodata sections (constants, strings, etc.) */
|
||||||
|
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
||||||
|
*(.srodata) /* .srodata sections (constants, strings, etc.) */
|
||||||
|
*(.srodata*) /* .srodata* sections (constants, strings, etc.) */
|
||||||
|
. = ALIGN(4);
|
||||||
|
_etext = .;
|
||||||
|
} >ROM
|
||||||
|
|
||||||
|
.stack (NOLOAD) :
|
||||||
|
{
|
||||||
|
. = ALIGN(16);
|
||||||
|
_sstack = .;
|
||||||
|
. += STACK_SIZE;
|
||||||
|
. = ALIGN(16);
|
||||||
|
_estack = .;
|
||||||
|
} >FWRAM
|
||||||
|
|
||||||
|
.data :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
_sdata = .;
|
||||||
|
*(.data) /* .data sections */
|
||||||
|
*(.data*) /* .data* sections */
|
||||||
|
*(.sdata) /* .sdata sections */
|
||||||
|
*(.sdata*) /* .sdata* sections */
|
||||||
|
. = ALIGN(4);
|
||||||
|
_edata = .;
|
||||||
|
} >FWRAM AT>ROM
|
||||||
|
_sidata = LOADADDR(.data);
|
||||||
|
|
||||||
|
/* Uninitialized data section */
|
||||||
|
.bss :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
_sbss = .;
|
||||||
|
*(.bss)
|
||||||
|
*(.bss*)
|
||||||
|
*(.sbss)
|
||||||
|
*(.sbss*)
|
||||||
|
*(COMMON)
|
||||||
|
. = ALIGN(4);
|
||||||
|
_ebss = .;
|
||||||
|
} >FWRAM
|
||||||
|
}
|
||||||
|
|
||||||
|
_sfwram = ORIGIN(FWRAM);
|
||||||
|
_efwram = ORIGIN(FWRAM) + LENGTH(FWRAM);
|
||||||
|
_sresetinfo = ORIGIN(RESETINFO);
|
||||||
|
_eresetinfo = ORIGIN(RESETINFO) + LENGTH(RESETINFO);
|
Loading…
Add table
Add a link
Reference in a new issue