From 02f06be0df4949a3714e62d60a30a7509161d8e7 Mon Sep 17 00:00:00 2001 From: Silver Valdvee Date: Mon, 27 Jun 2022 18:43:03 +0300 Subject: [PATCH] Fix application offset and bootloader size --- bootloader/Makefile | 2 +- bootloader/ld.ld | 186 -------------------------------------------- firmware/Makefile | 2 +- 3 files changed, 2 insertions(+), 188 deletions(-) delete mode 100644 bootloader/ld.ld diff --git a/bootloader/Makefile b/bootloader/Makefile index f423aa4f..1d2418cd 100644 --- a/bootloader/Makefile +++ b/bootloader/Makefile @@ -11,7 +11,7 @@ CSRC = $(shell find src -name '*.c' | sort) bxcan/bxcan.c UINCDIR = src src/os kocherga/kocherga bxcan UDEFS = -DHW_VERSION_MAJOR=$(HW_VERSION_MAJOR) \ - -DAPPLICATION_OFFSET=61440 \ + -DAPPLICATION_OFFSET=34816 \ -DBXCAN_MAX_IFACE_INDEX=0 # ChibiOS diff --git a/bootloader/ld.ld b/bootloader/ld.ld deleted file mode 100644 index d259c55c..00000000 --- a/bootloader/ld.ld +++ /dev/null @@ -1,186 +0,0 @@ -/** - * Copyright (c) 2016 Zubax Robotics - */ -MEMORY -{ - /* - * Location of the signature can't be easily changed because that would break - * binary compatibility with released firmware images. - * - * Start End Size Purpose - * ---------------------------------------------------- - * 0 32512 32512 Bootloader - * 32512 32768 256 Digital signature - * 32768 Application - */ - bootloader_flash : org = 0x08000000, len = 59136 /* 32512 32K for the bootloader minus 256 for the signature */ - - /* - * We use both SRAM1 and SRAM2 as a single contiguous memory region. - * The very end of SRAM2 is used for app-bootloader communication. - * - * Start End Size Purpose - * ---------------------------------------------------- - * 0 256 256 Space for application-bootloader data exchange -- legacy - * 256 130560 130304 Bootloader - * 130560 128K 512 Space for application-bootloader data exchange - */ - ram : org = 0x20000000, len = 65265 /* 64K - 263 - 8 for AppShared */ -} - -__ram_start__ = ORIGIN(ram); -__ram_size__ = LENGTH(ram); -__ram_end__ = __ram_start__ + __ram_size__; - -ENTRY(Reset_Handler); - - -/* - The DeviceSignature is not actually used at this moment. - If it was used then it would erase the application if the signature was missing or invalid. -*/ -PROVIDE(DeviceSignatureStorage = "DeviceSignatureStorage_start_address"); -PROVIDE(AppSharedStruct = 0x2000FEF0); /* I honestly don't remember how I got this address. It's supposed to be at the very end of RAM 0x20010000 - 256 */ - -SECTIONS -{ - - . = 0; - _text = .; - - startup : ALIGN(16) SUBALIGN(16) - { - FILL(0xDEADC0DE); - KEEP(*(.vectors)) - . = ALIGN(8); - KEEP(*(.app_descriptor)); - . = ALIGN(8); - } > bootloader_flash - - constructors : ALIGN(4) SUBALIGN(4) - { - FILL(0xDEADC0DE); - PROVIDE(__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE(__init_array_end = .); - } > bootloader_flash - - destructors : ALIGN(4) SUBALIGN(4) - { - FILL(0xDEADC0DE); - PROVIDE(__fini_array_start = .); - KEEP(*(.fini_array)) - KEEP(*(SORT(.fini_array.*))) - PROVIDE(__fini_array_end = .); - } > bootloader_flash - - .text : ALIGN(4) SUBALIGN(4) - { - FILL(0xDEADC0DE); - *(.text) - *(.text.*) - *(.rodata) - *(.rodata.*) - *(.glue_7t) - *(.glue_7) - *(.gcc*) - /* - * Note that SOME DEBUGGERS WILL REFUSE TO LOAD THE ELF if it contains odd-sized sections! - * This issue can be observed, for example, with DroneCode Probe. - * It also important to ensure proper alignment at the end of the section in order to - * avoid gaps that contain undefined bytes (see the padding sections for details). - */ - . = ALIGN(8); - } > bootloader_flash - - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > bootloader_flash - - .ARM.exidx : - { - PROVIDE(__exidx_start = .); - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - PROVIDE(__exidx_end = .); - } > bootloader_flash - - .eh_frame_hdr : - { - *(.eh_frame_hdr) - } > bootloader_flash - - .eh_frame : ONLY_IF_RO - { - *(.eh_frame) - } > bootloader_flash - - .textalign : ONLY_IF_RO - { - FILL(0xDEADC0DE); - BYTE(0xFF); - . = ALIGN(64); - } > bootloader_flash - - . = ALIGN(4); - _etext = .; - _textdata_start = _etext; - - .mstack : - { - . = ALIGN(8); - __main_stack_base__ = .; - . += __main_stack_size__; - . = ALIGN(8); - __main_stack_end__ = .; - } > ram - - .pstack : - { - __process_stack_base__ = .; - __main_thread_stack_base__ = .; - . += __process_stack_size__; - . = ALIGN(8); - __process_stack_end__ = .; - __main_thread_stack_end__ = .; - } > ram - - .data : ALIGN(4) - { - FILL(0xDEADC0DE); - . = ALIGN(4); - PROVIDE(_data_start = .); - *(.data) - *(.data.*) - *(.ramtext) - . = ALIGN(4); - PROVIDE(_data_end = .); - } > ram AT > bootloader_flash - - .bss : ALIGN(4) - { - . = ALIGN(4); - PROVIDE(_bss_start = .); - *(.bss) - *(.bss.*) - *(COMMON) - . = ALIGN(4); - PROVIDE(_bss_end = .); - PROVIDE(end = .); - } > ram - - .ram (NOLOAD) : ALIGN(4) - { - . = ALIGN(4); - *(.ram) - *(.ram.*) - . = ALIGN(4); - __ram_free__ = .; - } > ram -} - -/* Heap default boundaries, it is defaulted to be the non-used part of ram region.*/ -__heap_base__ = __ram_free__; -__heap_end__ = __ram_end__; - diff --git a/firmware/Makefile b/firmware/Makefile index 4dcaa7b3..8df5ea5f 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -91,7 +91,7 @@ BUILD_CHIBIOS_SHELL = 1 SERIAL_CLI_PORT_NUMBER = 1 -BOOTLOADER_SIZE = 61440 # Including 256 bytes for DeviceSignatureStorage +BOOTLOADER_SIZE = 34816 # Including 256 bytes for DeviceSignatureStorage # This firmware is compatible with all versions of hardware where the major number is 1 (i.e. 1.x),