diff --git a/targets/TARGET_Maxim/TARGET_MAX32625/CMakeLists.txt b/targets/TARGET_Maxim/TARGET_MAX32625/CMakeLists.txt index e95dfb47750..27faebd1535 100644 --- a/targets/TARGET_Maxim/TARGET_MAX32625/CMakeLists.txt +++ b/targets/TARGET_Maxim/TARGET_MAX32625/CMakeLists.txt @@ -4,12 +4,10 @@ add_subdirectory(TARGET_MAX32625MBED EXCLUDE_FROM_ALL) add_subdirectory(TARGET_MAX32625PICO EXCLUDE_FROM_ALL) add_subdirectory(TARGET_SDT32625B EXCLUDE_FROM_ALL) -add_subdirectory(device EXCLUDE_FROM_ALL) -if(${MBED_TOOLCHAIN} STREQUAL "ARM") - set(STARTUP_FILE device/TOOLCHAIN_ARM_STD/startup_MAX32625.S) -elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") +if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") set(STARTUP_FILE device/TOOLCHAIN_GCC_ARM/startup_max32625.S) + set(LINKER_FILE device/TOOLCHAIN_GCC_ARM/max32625.ld) endif() add_library(mbed-max32625 INTERFACE) @@ -71,4 +69,6 @@ target_sources(mbed-max32625 ${STARTUP_FILE} ) +mbed_set_linker_script(mbed-max32625 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE}) + target_link_libraries(mbed-max32625 INTERFACE mbed-maxim) diff --git a/targets/TARGET_Maxim/TARGET_MAX32625/TARGET_MAX32625MBED/CMakeLists.txt b/targets/TARGET_Maxim/TARGET_MAX32625/TARGET_MAX32625MBED/CMakeLists.txt index cee08018eb1..94060183ebf 100644 --- a/targets/TARGET_Maxim/TARGET_MAX32625/TARGET_MAX32625MBED/CMakeLists.txt +++ b/targets/TARGET_Maxim/TARGET_MAX32625/TARGET_MAX32625MBED/CMakeLists.txt @@ -8,4 +8,4 @@ target_include_directories(mbed-max32625mbed . ) -target_link_libraries(mbed-max32625mbed INTERFACE mbed-max32625 mbed-max32625-no-boot) +target_link_libraries(mbed-max32625mbed INTERFACE mbed-max32625) diff --git a/targets/TARGET_Maxim/TARGET_MAX32625/TARGET_MAX32625PICO/CMakeLists.txt b/targets/TARGET_Maxim/TARGET_MAX32625/TARGET_MAX32625PICO/CMakeLists.txt index 2caee0a28ca..bd20cf7391a 100644 --- a/targets/TARGET_Maxim/TARGET_MAX32625/TARGET_MAX32625PICO/CMakeLists.txt +++ b/targets/TARGET_Maxim/TARGET_MAX32625/TARGET_MAX32625PICO/CMakeLists.txt @@ -13,4 +13,4 @@ target_sources(mbed-max32625pico low_level_init.c ) -target_link_libraries(mbed-max32625pico INTERFACE mbed-max32625 mbed-max32625-boot) +target_link_libraries(mbed-max32625pico INTERFACE mbed-max32625) diff --git a/targets/TARGET_Maxim/TARGET_MAX32625/TARGET_SDT32625B/CMakeLists.txt b/targets/TARGET_Maxim/TARGET_MAX32625/TARGET_SDT32625B/CMakeLists.txt index e3691fbbd44..5aeae1c9cea 100644 --- a/targets/TARGET_Maxim/TARGET_MAX32625/TARGET_SDT32625B/CMakeLists.txt +++ b/targets/TARGET_Maxim/TARGET_MAX32625/TARGET_SDT32625B/CMakeLists.txt @@ -8,4 +8,4 @@ target_include_directories(mbed-sdt32625b . ) -target_link_libraries(mbed-sdt32625b INTERFACE mbed-max32625-no-boot) +target_link_libraries(mbed-sdt32625b INTERFACE mbed-max32625) diff --git a/targets/TARGET_Maxim/TARGET_MAX32625/device/CMakeLists.txt b/targets/TARGET_Maxim/TARGET_MAX32625/device/CMakeLists.txt deleted file mode 100644 index 90c4fc6daca..00000000000 --- a/targets/TARGET_Maxim/TARGET_MAX32625/device/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2020-2021 ARM Limited. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -add_library(mbed-max32625-boot INTERFACE) - -if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") - set(LINKER_FILE_BOOT TOOLCHAIN_GCC_ARM/TARGET_MAX32625_BOOT/max32625.ld) -elseif(${MBED_TOOLCHAIN} STREQUAL "ARM") - set(LINKER_FILE_BOOT TOOLCHAIN_ARM_STD/TARGET_MAX32625_BOOT/MAX32625.sct) -endif() - -mbed_set_linker_script(mbed-max32625-boot ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE_BOOT}) - -target_link_libraries(mbed-max32625-boot INTERFACE mbed-max32625) - -add_library(mbed-max32625-no-boot INTERFACE) - -if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") - set(LINKER_FILE_NO_BOOT TOOLCHAIN_GCC_ARM/TARGET_MAX32625_NO_BOOT/max32625.ld) -elseif(${MBED_TOOLCHAIN} STREQUAL "ARM") - set(LINKER_FILE_NO_BOOT TOOLCHAIN_ARM_STD/TARGET_MAX32625_NO_BOOT/MAX32625.sct) -endif() - -mbed_set_linker_script(mbed-max32625-no-boot ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE_NO_BOOT}) - -target_link_libraries(mbed-max32625-no-boot INTERFACE mbed-max32625) diff --git a/targets/TARGET_Maxim/TARGET_MAX32625/device/TOOLCHAIN_GCC_ARM/TARGET_MAX32625_BOOT/max32625.ld b/targets/TARGET_Maxim/TARGET_MAX32625/device/TOOLCHAIN_GCC_ARM/TARGET_MAX32625_BOOT/max32625.ld deleted file mode 100644 index d833a8a2fcf..00000000000 --- a/targets/TARGET_Maxim/TARGET_MAX32625/device/TOOLCHAIN_GCC_ARM/TARGET_MAX32625_BOOT/max32625.ld +++ /dev/null @@ -1,191 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES - * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of Maxim Integrated - * Products, Inc. shall not be used except as stated in the Maxim Integrated - * Products, Inc. Branding Policy. - * - * The mere transfer of this software does not imply any licenses - * of trade secrets, proprietary technology, copyrights, patents, - * trademarks, maskwork rights, or any other form of intellectual - * property whatsoever. Maxim Integrated Products, Inc. retains all - * ownership rights. - ******************************************************************************* - */ - -#if !defined(MBED_APP_START) - #define MBED_APP_START 0x00010000 -#endif - -#if !defined(MBED_APP_SIZE) - #define MBED_APP_SIZE 0x00070000 -#endif - -#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE) - #define MBED_CONF_TARGET_BOOT_STACK_SIZE 0x400 -#endif - -STACK_SIZE = MBED_CONF_TARGET_BOOT_STACK_SIZE; - -MEMORY -{ - FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE - RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00028000 -} - -/* Linker script to place sections and symbol values. Should be used together - * with other linker script that defines memory regions FLASH and RAM. - * It references following symbols, which must be defined in code: - * Reset_Handler : Entry of reset handler - * - * It defines following symbols, which code can use without definition: - * __exidx_start - * __exidx_end - * __etext - * __data_start__ - * __preinit_array_start - * __preinit_array_end - * __init_array_start - * __init_array_end - * __fini_array_start - * __fini_array_end - * __data_end__ - * __bss_start__ - * __bss_end__ - * __end__ - * end - * __HeapLimit - * __StackLimit - * __StackTop - * __stack - */ -ENTRY(Reset_Handler) - -SECTIONS -{ - .text : - { - KEEP(*(.isr_vector)) - *(.text*) - - KEEP(*(.init)) - KEEP(*(.fini)) - - /* .ctors */ - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - - /* .dtors */ - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) - *(SORT(.dtors.*)) - *(.dtors) - - *(.rodata*) - - KEEP(*(.eh_frame*)) - } > FLASH - - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > FLASH - - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > FLASH - __exidx_end = .; - - __etext = .; - - .data : AT (__etext) - { - __data_start__ = .; - *(vtable) - *(.data*) - - . = ALIGN(8); - /* preinit data */ - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - - . = ALIGN(8); - /* init data */ - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - - - . = ALIGN(8); - /* finit data */ - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP(*(SORT(.fini_array.*))) - KEEP(*(.fini_array)) - PROVIDE_HIDDEN (__fini_array_end = .); - - . = ALIGN(8); - /* All data end */ - __data_end__ = .; - - } > RAM - - .bss : - { - __bss_start__ = .; - *(.bss*) - *(COMMON) - __bss_end__ = .; - } > RAM - - .heap : - { - __end__ = .; - end = __end__; - *(.heap*) - . = ORIGIN(RAM) + LENGTH(RAM) - STACK_SIZE; - __HeapLimit = .; - } > RAM - - /* .stack_dummy section doesn't contains any symbols. It is only - * used for linker to calculate size of stack sections, and assign - * values to stack symbols later */ - .stack_dummy : - { - *(.stack) - } > RAM - - /* Set stack top to end of RAM, and stack limit move down by - * size of stack_dummy section */ - __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __StackLimit = __StackTop - STACK_SIZE; - PROVIDE(__stack = __StackTop); - - /* Check if data + heap + stack exceeds RAM limit */ - ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") -} diff --git a/targets/TARGET_Maxim/TARGET_MAX32625/device/TOOLCHAIN_GCC_ARM/TARGET_MAX32625_NO_BOOT/max32625.ld b/targets/TARGET_Maxim/TARGET_MAX32625/device/TOOLCHAIN_GCC_ARM/max32625.ld similarity index 95% rename from targets/TARGET_Maxim/TARGET_MAX32625/device/TOOLCHAIN_GCC_ARM/TARGET_MAX32625_NO_BOOT/max32625.ld rename to targets/TARGET_Maxim/TARGET_MAX32625/device/TOOLCHAIN_GCC_ARM/max32625.ld index 82b3cd41991..84e00a1c8ae 100644 --- a/targets/TARGET_Maxim/TARGET_MAX32625/device/TOOLCHAIN_GCC_ARM/TARGET_MAX32625_NO_BOOT/max32625.ld +++ b/targets/TARGET_Maxim/TARGET_MAX32625/device/TOOLCHAIN_GCC_ARM/max32625.ld @@ -39,8 +39,8 @@ STACK_SIZE = MBED_CONF_TARGET_BOOT_STACK_SIZE; MEMORY { - FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00080000 - RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00028000 + FLASH (rx) : ORIGIN = MBED_CONFIGURED_ROM_BANK_IROM1_START, LENGTH = MBED_CONFIGURED_ROM_BANK_IROM1_SIZE + RAM (rwx) : ORIGIN = MBED_CONFIGURED_RAM_BANK_IRAM1_START, LENGTH = MBED_CONFIGURED_RAM_BANK_IRAM1_SIZE } /* Linker script to place sections and symbol values. Should be used together diff --git a/targets/cmsis_mcu_descriptions.json5 b/targets/cmsis_mcu_descriptions.json5 index 5dd1b5a932a..1c2a755213e 100644 --- a/targets/cmsis_mcu_descriptions.json5 +++ b/targets/cmsis_mcu_descriptions.json5 @@ -2397,8 +2397,8 @@ "write": true }, "default": true, - "size": 163840, - "start": 536870912, + "size": 0x28000, + "start": 0x20000000, "startup": false }, "IROM1": { @@ -2412,7 +2412,7 @@ "write": false }, "default": true, - "size": 524288, + "size": 0x80000, "start": 0, "startup": true } diff --git a/targets/targets.json5 b/targets/targets.json5 index 3d0b34f4406..c37160277a7 100644 --- a/targets/targets.json5 +++ b/targets/targets.json5 @@ -6463,9 +6463,6 @@ "inherits": [ "MAX32625_BASE" ], - "extra_labels_add": [ - "MAX32625_NO_BOOT" - ], "detect_code": [ "0415" ], @@ -6475,9 +6472,6 @@ "inherits": [ "MAX32625_BASE" ], - "extra_labels_add": [ - "MAX32625_NO_BOOT" - ], "detect_code": [ "3102" ], @@ -6487,10 +6481,16 @@ "inherits": [ "MAX32625_BASE" ], - "extra_labels_add": [ - "MAX32625_BOOT" - ], "bootloader_supported": true, + + // Reserve the first 64k of flash for the bootloader + "memory_bank_config": { + "IROM1": { + "start": 0x00010000, + "size": 0x00070000 + } + }, + "detect_code": [ "0444" ],