diff --git a/boards/arduino_101/Kconfig.defconfig b/boards/arduino_101/Kconfig.defconfig index c4314a232207..0755619744de 100644 --- a/boards/arduino_101/Kconfig.defconfig +++ b/boards/arduino_101/Kconfig.defconfig @@ -4,6 +4,18 @@ if BOARD_ARDUINO_101 config BOARD default "arduino_101" +config TEXT_SECTION_OFFSET + default 0x30 + +config SS_RESET_VECTOR + default 0x40034000 + +config ROM_SIZE + default 192 + +config PHYS_LOAD_ADDR + default 0x40010000 + if NBLE config GPIO diff --git a/boards/arduino_101/Makefile b/boards/arduino_101/Makefile index 097c04d76c33..27f702ffda76 100644 --- a/boards/arduino_101/Makefile +++ b/boards/arduino_101/Makefile @@ -4,4 +4,3 @@ ccflags-y += -I$(srctree)/drivers/pinmux asflags-y := ${ccflags-y} obj-$(CONFIG_PINMUX) += pinmux.o -obj-y += board.o diff --git a/boards/arduino_101/arduino_101_factory_defconfig b/boards/arduino_101/arduino_101_factory_defconfig deleted file mode 100644 index b4c47e1ce09c..000000000000 --- a/boards/arduino_101/arduino_101_factory_defconfig +++ /dev/null @@ -1,16 +0,0 @@ -CONFIG_X86=y -CONFIG_SOC_QUARK_SE_C1000=y -CONFIG_SOC_SERIES_QUARK_SE=y -CONFIG_BOARD_ARDUINO_101=y -CONFIG_CPU_MINUTEIA=y -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y -CONFIG_SERIAL=y -CONFIG_UART_QMSI=y -CONFIG_UART_QMSI_0_BAUDRATE=1000000 -CONFIG_UART_QMSI_0_HW_FC=y -CONFIG_PRINTK=y -CONFIG_PINMUX=y -CONFIG_SS_RESET_VECTOR=0x40034000 -CONFIG_PHYS_LOAD_ADDR=0x40010000 -CONFIG_VERSION_HEADER=y diff --git a/boards/arduino_101/board.c b/boards/arduino_101/board.c deleted file mode 100644 index 65d91137083c..000000000000 --- a/boards/arduino_101/board.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2011-2015, Wind River Systems, Inc. - * Copyright (c) 2016, Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include "board.h" -#include -#include -#include - -#ifdef CONFIG_VERSION_HEADER -#include "version_header.h" -/* The content of this struct is overwritten in a post-build script */ -struct version_header version_header __attribute__((section(".version_header"))) -__attribute__((used)) = { - .magic = {'$', 'B', '!', 'N'}, - .version = 0x01, - .reserved_1 = {0, 0, 0, 0}, - .reserved_2 = {0, 0, 0, 0}, -}; -#endif diff --git a/boards/arduino_101/version_header.h b/boards/arduino_101/version_header.h deleted file mode 100644 index 72fbe049a7b2..000000000000 --- a/boards/arduino_101/version_header.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2016, Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __VERSION_HEADER_H__ -#define __VERSION_HEADER_H__ - -#include - -/** - * Define the content of a 48-bytes binary version header. - * - * The binary version header allows to uniquely identify the binary used. Note: - * - a device may include more than one binary, each having its own binary - * version header. - * - the position of this struct is usually defined in the linker script and - * its content is overwritten after the build (in a special post-build script). - * It therefore doesn't need to be initialized at compile-time (expected magic - * and version), yet can be used in the code at runtime. - * - * Major, Minor, Patch are the following the usual definition, e.g. 1.0.0 - */ -struct version_header { - /** Always equal to $B!N */ - uint8_t magic[4]; - - /** Header format version */ - uint8_t version; - uint8_t major; - uint8_t minor; - uint8_t patch; - - /** - * Human-friendly version string, free format (not NULL terminated) - * Advised format is: PPPPXXXXXX-YYWWTBBBB - * - PPPP : product code - * - XXXXXX: binary info. Usually contains information such as the - * binary type (bootloader, application), build variant (unit tests, - * debug, release), release/branch name - * - YY : year last 2 digits - * - WW : work week number - * - T : build type, e.g. [W]eekly, [L]atest, [R]elease, [P]roduction, - * [F]actory, [C]ustom - * - BBBB : build number, left padded with zeros - * Examples: - * - A101BOOT01-1503W0234 - * - CCCKAPP123-1502R0013 - */ - char version_string[20]; - - /** - * Micro-SHA1 (first 4 bytes of the SHA1) of the binary payload excluding - * this header. It allows to uniquely identify the exact binary used. - * In the case the header is located in the middle of the payload, the - * SHA1 has to be computed from two disjoint buffers. - */ - uint8_t hash[4]; - - /** Position of the payload start relative to the address of this structure */ - int32_t offset; - - /** Filled with zeros, can be eventually used for 64 bits support */ - uint8_t reserved_1[4]; - - /** Size of the payload in bytes, including this header */ - uint32_t size; - - /** Filled with zeros, can be eventually used for 64 bits support */ - uint8_t reserved_2[4]; -} __packed; - -/** The global version header struct */ -extern struct version_header version_header; - -#endif /* __VERSION_HEADER_H__ */ - diff --git a/boards/arduino_101_sss/Kconfig.defconfig b/boards/arduino_101_sss/Kconfig.defconfig index 488bdcdc79e0..86b12ce42e45 100644 --- a/boards/arduino_101_sss/Kconfig.defconfig +++ b/boards/arduino_101_sss/Kconfig.defconfig @@ -4,4 +4,12 @@ if BOARD_ARDUINO_101_SSS config BOARD default "arduino_101_sss" + +config FLASH_SIZE + default 128 + + +config FLASH_BASE_ADDRESS + default 0x40034000 + endif # BOARD_ARDUINO_101_SSS diff --git a/boards/arduino_101_sss/Makefile b/boards/arduino_101_sss/Makefile index 9c255466e432..8bed11bff8b6 100644 --- a/boards/arduino_101_sss/Makefile +++ b/boards/arduino_101_sss/Makefile @@ -2,4 +2,4 @@ ccflags-y += -I$(srctree)/include/drivers ccflags-y += -I$(srctree)/drivers asflags-y := ${ccflags-y} -obj-y += board.o +obj- += dummy.o diff --git a/boards/arduino_101_sss/arduino_101_sss_defconfig b/boards/arduino_101_sss/arduino_101_sss_defconfig index 76a6828f266f..b2989adf6ea5 100644 --- a/boards/arduino_101_sss/arduino_101_sss_defconfig +++ b/boards/arduino_101_sss/arduino_101_sss_defconfig @@ -10,6 +10,7 @@ CONFIG_CPU_ARCEM4=y CONFIG_CPU_ARCV2=y CONFIG_ARCV2_INTERRUPT_UNIT=y CONFIG_ARCV2_TIMER=y +CONFIG_SPI_DW_INTERRUPT_SEPARATED_LINES=y CONFIG_UART_QMSI=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y diff --git a/boards/arduino_101_sss/arduino_101_sss_factory_defconfig b/boards/arduino_101_sss/arduino_101_sss_factory_defconfig deleted file mode 100644 index f830cfcf2ca8..000000000000 --- a/boards/arduino_101_sss/arduino_101_sss_factory_defconfig +++ /dev/null @@ -1,19 +0,0 @@ -CONFIG_ARC=y -CONFIG_SOC_QUARK_SE_C1000_SS=y -CONFIG_BOARD_ARDUINO_101_SSS=y -CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32000000 -CONFIG_XIP=y -CONFIG_NANO_TIMERS=y -CONFIG_PRINTK=y -CONFIG_CPU_ARCEM4=y -CONFIG_CPU_ARCV2=y -CONFIG_ARCV2_INTERRUPT_UNIT=y -CONFIG_ARCV2_TIMER=y -CONFIG_SPI_DW_INTERRUPT_SEPARATED_LINES=y -CONFIG_VERSION_HEADER=y -CONFIG_FLASH_BASE_ADDRESS=0x40034000 -CONFIG_UART_QMSI=y -CONFIG_CONSOLE=y -CONFIG_UART_CONSOLE=y -CONFIG_SERIAL=y diff --git a/boards/arduino_101_sss/board.c b/boards/arduino_101_sss/board.c deleted file mode 100644 index 9cbbc267ca41..000000000000 --- a/boards/arduino_101_sss/board.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2011-2015, Wind River Systems, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include "board.h" -#include -#include -#include - -#ifdef CONFIG_VERSION_HEADER -#include "version_header.h" -/* The content of this struct is overwritten in a post-build script */ -struct version_header version_header __attribute__((section(".version_header"))) -__attribute__((used)) = { - .magic = {'$', 'B', '!', 'N'}, - .version = 0x01, - .reserved_1 = {0, 0, 0, 0}, - .reserved_2 = {0, 0, 0, 0}, -}; -#endif diff --git a/boards/arduino_101_sss/version_header.h b/boards/arduino_101_sss/version_header.h deleted file mode 100644 index 72fbe049a7b2..000000000000 --- a/boards/arduino_101_sss/version_header.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2016, Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __VERSION_HEADER_H__ -#define __VERSION_HEADER_H__ - -#include - -/** - * Define the content of a 48-bytes binary version header. - * - * The binary version header allows to uniquely identify the binary used. Note: - * - a device may include more than one binary, each having its own binary - * version header. - * - the position of this struct is usually defined in the linker script and - * its content is overwritten after the build (in a special post-build script). - * It therefore doesn't need to be initialized at compile-time (expected magic - * and version), yet can be used in the code at runtime. - * - * Major, Minor, Patch are the following the usual definition, e.g. 1.0.0 - */ -struct version_header { - /** Always equal to $B!N */ - uint8_t magic[4]; - - /** Header format version */ - uint8_t version; - uint8_t major; - uint8_t minor; - uint8_t patch; - - /** - * Human-friendly version string, free format (not NULL terminated) - * Advised format is: PPPPXXXXXX-YYWWTBBBB - * - PPPP : product code - * - XXXXXX: binary info. Usually contains information such as the - * binary type (bootloader, application), build variant (unit tests, - * debug, release), release/branch name - * - YY : year last 2 digits - * - WW : work week number - * - T : build type, e.g. [W]eekly, [L]atest, [R]elease, [P]roduction, - * [F]actory, [C]ustom - * - BBBB : build number, left padded with zeros - * Examples: - * - A101BOOT01-1503W0234 - * - CCCKAPP123-1502R0013 - */ - char version_string[20]; - - /** - * Micro-SHA1 (first 4 bytes of the SHA1) of the binary payload excluding - * this header. It allows to uniquely identify the exact binary used. - * In the case the header is located in the middle of the payload, the - * SHA1 has to be computed from two disjoint buffers. - */ - uint8_t hash[4]; - - /** Position of the payload start relative to the address of this structure */ - int32_t offset; - - /** Filled with zeros, can be eventually used for 64 bits support */ - uint8_t reserved_1[4]; - - /** Size of the payload in bytes, including this header */ - uint32_t size; - - /** Filled with zeros, can be eventually used for 64 bits support */ - uint8_t reserved_2[4]; -} __packed; - -/** The global version header struct */ -extern struct version_header version_header; - -#endif /* __VERSION_HEADER_H__ */ - diff --git a/boards/em_starterkit/Makefile b/boards/em_starterkit/Makefile index 9c255466e432..8bed11bff8b6 100644 --- a/boards/em_starterkit/Makefile +++ b/boards/em_starterkit/Makefile @@ -2,4 +2,4 @@ ccflags-y += -I$(srctree)/include/drivers ccflags-y += -I$(srctree)/drivers asflags-y := ${ccflags-y} -obj-y += board.o +obj- += dummy.o diff --git a/boards/em_starterkit/board.c b/boards/em_starterkit/board.c deleted file mode 100644 index 5dc49b6f603a..000000000000 --- a/boards/em_starterkit/board.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2016, Synopsys, Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include "board.h" -#include -#include -#include - -#ifdef CONFIG_VERSION_HEADER -#include "version_header.h" -/* The content of this struct is overwritten in a post-build script */ -struct version_header version_header __attribute__((section(".version_header"))) -__attribute__((used)) = { - .magic = {'$', 'B', '!', 'N'}, - .version = 0x01, - .reserved_1 = {0, 0, 0, 0}, - .reserved_2 = {0, 0, 0, 0}, -}; -#endif diff --git a/boards/em_starterkit/version_header.h b/boards/em_starterkit/version_header.h deleted file mode 100644 index 72fbe049a7b2..000000000000 --- a/boards/em_starterkit/version_header.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2016, Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __VERSION_HEADER_H__ -#define __VERSION_HEADER_H__ - -#include - -/** - * Define the content of a 48-bytes binary version header. - * - * The binary version header allows to uniquely identify the binary used. Note: - * - a device may include more than one binary, each having its own binary - * version header. - * - the position of this struct is usually defined in the linker script and - * its content is overwritten after the build (in a special post-build script). - * It therefore doesn't need to be initialized at compile-time (expected magic - * and version), yet can be used in the code at runtime. - * - * Major, Minor, Patch are the following the usual definition, e.g. 1.0.0 - */ -struct version_header { - /** Always equal to $B!N */ - uint8_t magic[4]; - - /** Header format version */ - uint8_t version; - uint8_t major; - uint8_t minor; - uint8_t patch; - - /** - * Human-friendly version string, free format (not NULL terminated) - * Advised format is: PPPPXXXXXX-YYWWTBBBB - * - PPPP : product code - * - XXXXXX: binary info. Usually contains information such as the - * binary type (bootloader, application), build variant (unit tests, - * debug, release), release/branch name - * - YY : year last 2 digits - * - WW : work week number - * - T : build type, e.g. [W]eekly, [L]atest, [R]elease, [P]roduction, - * [F]actory, [C]ustom - * - BBBB : build number, left padded with zeros - * Examples: - * - A101BOOT01-1503W0234 - * - CCCKAPP123-1502R0013 - */ - char version_string[20]; - - /** - * Micro-SHA1 (first 4 bytes of the SHA1) of the binary payload excluding - * this header. It allows to uniquely identify the exact binary used. - * In the case the header is located in the middle of the payload, the - * SHA1 has to be computed from two disjoint buffers. - */ - uint8_t hash[4]; - - /** Position of the payload start relative to the address of this structure */ - int32_t offset; - - /** Filled with zeros, can be eventually used for 64 bits support */ - uint8_t reserved_1[4]; - - /** Size of the payload in bytes, including this header */ - uint32_t size; - - /** Filled with zeros, can be eventually used for 64 bits support */ - uint8_t reserved_2[4]; -} __packed; - -/** The global version header struct */ -extern struct version_header version_header; - -#endif /* __VERSION_HEADER_H__ */ - diff --git a/include/arch/arc/v2/linker.ld b/include/arch/arc/v2/linker.ld index 4266eda353e2..719151668f52 100644 --- a/include/arch/arc/v2/linker.ld +++ b/include/arch/arc/v2/linker.ld @@ -85,10 +85,6 @@ SECTIONS { KEEP(*(.irq_vector_table)) KEEP(*(".irq_vector_table.*")) -#ifdef CONFIG_VERSION_HEADER - *(.version_header) - KEEP(*(".version_header*")) -#endif KEEP(*(.isr_irq*)) /* diff --git a/include/arch/x86/linker-common-sections.h b/include/arch/x86/linker-common-sections.h index 87fed58255cd..0d4f9add7b52 100644 --- a/include/arch/x86/linker-common-sections.h +++ b/include/arch/x86/linker-common-sections.h @@ -65,17 +65,10 @@ SECTIONS _image_rom_start = PHYS_LOAD_ADDR; _image_text_start = PHYS_LOAD_ADDR; -#ifdef CONFIG_VERSION_HEADER - SECTION_PROLOGUE (version_header_section, (OPTIONAL),) - { - *(.version_header) - KEEP(*(".version_header*")) - } GROUP_LINK_IN(ROMABLE_REGION) -#endif SECTION_PROLOGUE(_TEXT_SECTION_NAME, (OPTIONAL),) { - + . = CONFIG_TEXT_SECTION_OFFSET; *(.text_start) *(".text_start.*") *(.text) diff --git a/misc/Kconfig b/misc/Kconfig index ab87a2abe9f8..14a80176fa01 100644 --- a/misc/Kconfig +++ b/misc/Kconfig @@ -24,6 +24,13 @@ config KERNEL_BIN_NAME help This option sets the name of the generated kernel binary. +config TEXT_SECTION_OFFSET + hex "TEXT section offset" + default 0 + help + This sets and offset before the text section and allows booting images + with custom headers that are inserted at the beginning of the image. + config HAVE_CUSTOM_LINKER_SCRIPT prompt "Custom linker scripts provided" def_bool n @@ -46,14 +53,6 @@ config CUSTOM_LINKER_SCRIPT linker script and avoid having to change the script provided by Zephyr. -config VERSION_HEADER - bool "Add a version header to binary" - default n - help - This will add a version header section to the generated binary that - can be filled with the software version for example using a post - script. - config CROSS_COMPILE string "Cross-compiler tool prefix" help