From 483b3b3c19e877b69180249b5b76d339f681624f Mon Sep 17 00:00:00 2001 From: Brian Esquilona Date: Fri, 29 Mar 2019 18:16:25 -0500 Subject: [PATCH] Modified target_cfg api 1. Array of flash and ram regions are defined 2. Added flash algo, flags, alias_index for memory region 3. Moved target_config.h and target_rest.h to target folder 4. Modified families and bootloader file for new target_config api 5. Added test filter for boards that cannot run DAPLink test 6. Update documentation for porting target family --- docs/PORT_TARGET_FAMILY.md | 189 +++++++++++++++--- records/board/max32620fthr.yaml | 1 - records/board/max32625mbed.yaml | 1 - records/board/max32630fthr.yaml | 1 - records/daplink/target_board.yaml | 2 +- records/daplink/target_family.yaml | 2 +- source/board/k20dx_bl.c | 29 ++- source/board/k26f_bl.c | 29 ++- source/board/kl26z_bl.c | 28 ++- source/board/lpc4322_bl.c | 27 ++- source/board/max32620_bl.c | 27 ++- source/board/max32625_bl.c | 29 ++- source/board/sam3u2c_bl.c | 27 ++- source/board/stm32f103xb_bl.c | 27 ++- source/daplink/bootloader/main.c | 6 +- source/daplink/drag-n-drop/flash_decoder.c | 22 +- source/daplink/interface/target_flash.c | 58 +++--- source/daplink/validation.c | 45 ++--- source/family/freescale/k20dx/flash_blob.c | 13 +- source/family/freescale/k20dx/target.c | 17 +- source/family/freescale/k22f/flash_blob.c | 6 +- source/family/freescale/k22f/target.c | 17 +- source/family/freescale/k28f/flash_blob.c | 13 +- source/family/freescale/k28f/target.c | 17 +- source/family/freescale/k32w042/flash_blob.c | 9 +- source/family/freescale/k32w042/target.c | 17 +- source/family/freescale/k64f/flash_blob.c | 6 +- source/family/freescale/k64f/target.c | 17 +- source/family/freescale/k66f/flash_blob.c | 9 +- source/family/freescale/k66f/target.c | 17 +- source/family/freescale/k82f/flash_blob.c | 13 +- source/family/freescale/k82f/target.c | 17 +- source/family/freescale/ke15z/flash_blob.c | 13 +- source/family/freescale/ke15z/target.c | 17 +- source/family/freescale/ke18f/flash_blob.c | 13 +- source/family/freescale/ke18f/target.c | 17 +- source/family/freescale/kl02z/flash_blob.c | 13 +- source/family/freescale/kl02z/target.c | 17 +- source/family/freescale/kl05z/flash_blob.c | 13 +- source/family/freescale/kl05z/target.c | 17 +- source/family/freescale/kl25z/flash_blob.c | 13 +- source/family/freescale/kl25z/target.c | 17 +- source/family/freescale/kl26z/flash_blob.c | 13 +- source/family/freescale/kl26z/target.c | 17 +- source/family/freescale/kl27z/flash_blob.c | 13 +- source/family/freescale/kl27z/target.c | 17 +- source/family/freescale/kl28z/flash_blob.c | 13 +- source/family/freescale/kl28z/target.c | 17 +- source/family/freescale/kl43z/flash_blob.c | 13 +- source/family/freescale/kl43z/target.c | 17 +- source/family/freescale/kl46z/flash_blob.c | 13 +- source/family/freescale/kl46z/target.c | 17 +- source/family/freescale/kl82z/flash_blob.c | 13 +- source/family/freescale/kl82z/target.c | 17 +- source/family/freescale/kw24d/flash_blob.c | 13 +- source/family/freescale/kw24d/target.c | 17 +- source/family/freescale/kw41z/flash_blob.c | 13 +- source/family/freescale/kw41z/target.c | 15 +- .../mimxrt1020_spi_flash/flash_blob.c | 14 +- .../freescale/mimxrt1020_spi_flash/target.c | 17 +- .../mimxrt1050_hyper_flash/flash_blob.c | 13 +- .../freescale/mimxrt1050_hyper_flash/target.c | 17 +- .../mimxrt1050_spi_flash/flash_blob.c | 13 +- .../freescale/mimxrt1050_spi_flash/target.c | 17 +- .../freescale/rapid_iot/flash_blob_k64.c | 13 +- .../freescale/rapid_iot/flash_blob_kw40.c | 13 +- .../freescale/rapid_iot/flash_blob_kw41.c | 13 +- source/family/freescale/rapid_iot/target.c | 55 +++-- source/family/maxim/max32620/flash_blob.c | 13 +- source/family/maxim/max32620/target.c | 19 +- source/family/maxim/max32625/flash_blob.c | 13 +- source/family/maxim/max32625/target.c | 19 +- source/family/maxim/max32630/flash_blob.c | 13 +- source/family/maxim/max32630/target.c | 19 +- source/family/nordic/nrf51822/flash_blob.c | 13 +- source/family/nordic/nrf51822/target_16.c | 17 +- source/family/nordic/nrf51822/target_32.c | 17 +- source/family/nordic/nrf5x/flash_blob.c | 17 +- source/family/nordic/nrf5x/target.c | 87 ++++---- source/family/nxp/lpc1114/flash_blob.c | 13 +- source/family/nxp/lpc1114/target.c | 17 +- source/family/nxp/lpc1768/flash_blob.c | 13 +- source/family/nxp/lpc1768/target.c | 17 +- source/family/nxp/lpc4088/flash_blob.c | 13 +- source/family/nxp/lpc4088/target_lpc4088dm.c | 17 +- source/family/nxp/lpc4088/target_lpc4088qsb.c | 17 +- source/family/nxp/lpc54018/flash_blob.c | 10 +- source/family/nxp/lpc54018/target.c | 17 +- source/family/nxp/lpc54114/flash_blob.c | 13 +- source/family/nxp/lpc54114/target.c | 17 +- source/family/nxp/lpc54608/flash_blob.c | 10 +- source/family/nxp/lpc54608/target.c | 17 +- source/family/nxp/lpc55S6X/flash_blob.c | 10 +- source/family/nxp/lpc55S6X/target.c | 27 +-- source/family/nxp/lpc812/flash_blob.c | 13 +- source/family/nxp/lpc812/target.c | 17 +- source/family/nxp/lpc824/flash_blob.c | 13 +- source/family/nxp/lpc824/target.c | 17 +- source/family/onsemi/ncs36510/flash_blob.c | 13 +- source/family/onsemi/ncs36510/target.c | 18 +- source/family/realtek/rtl8195am/flash_blob.c | 13 +- source/family/realtek/rtl8195am/target.c | 18 +- .../renesas/rza1h/gr-peach/flash_blob.c | 10 +- source/family/renesas/rza1h/gr-peach/target.c | 17 +- .../renesas/rza1lu/gr-lychee/flash_blob.c | 10 +- .../family/renesas/rza1lu/gr-lychee/target.c | 17 +- .../family/siliconlabs/efm32gg/flash_blob.c | 13 +- source/family/siliconlabs/efm32gg/target.c | 17 +- source/family/st/nz32_sc151/flash_blob.c | 13 +- source/family/st/nz32_sc151/target.c | 17 +- source/family/st/stm32f072rb/flash_blob.c | 13 +- source/family/st/stm32f072rb/target.c | 17 +- source/family/st/stm32f103rb/flash_blob.c | 13 +- source/family/st/stm32f103rb/target.c | 17 +- source/family/st/stm32f207zg/flash_blob.c | 13 +- source/family/st/stm32f207zg/target.c | 17 +- source/family/st/stm32f334r8/flash_blob.c | 13 +- source/family/st/stm32f334r8/target.c | 17 +- source/family/st/stm32f401re/flash_blob.c | 13 +- source/family/st/stm32f401re/target.c | 17 +- source/family/st/stm32f407/flash_blob.c | 13 +- source/family/st/stm32f407/target.c | 17 +- source/family/st/stm32f411/flash_blob.c | 13 +- source/family/st/stm32f411/target.c | 17 +- source/family/st/stm32f412re/flash_blob.c | 2 +- source/family/st/stm32f412re/target.c | 17 +- source/family/st/stm32f412rg/flash_blob.c | 2 +- source/family/st/stm32f412rg/target.c | 17 +- source/family/st/stm32f429zi/flash_blob.c | 2 +- source/family/st/stm32f429zi/target.c | 17 +- source/family/st/stm32f437vg/flash_blob.c | 13 +- source/family/st/stm32f437vg/target.c | 17 +- source/family/st/stm32f439zi/flash_blob.c | 2 +- source/family/st/stm32f439zi/target.c | 17 +- source/family/st/stm32f746zg/flash_blob.c | 13 +- source/family/st/stm32f746zg/target.c | 17 +- source/family/st/stm32l082cz/flash_blob.c | 10 +- source/family/st/stm32l082cz/target.c | 17 +- source/family/st/stm32l151cbxxa/flash_blob.c | 10 +- source/family/st/stm32l151cbxxa/target.c | 17 +- source/family/st/stm32l443rc/flash_blob.c | 10 +- source/family/st/stm32l443rc/target.c | 17 +- source/family/st/stm32l476rg/flash_blob.c | 13 +- source/family/st/stm32l476rg/target.c | 17 +- source/family/st/stm32l486jg/flash_blob.c | 10 +- source/family/st/stm32l486jg/target.c | 17 +- source/family/st/stm32l4xx_1024/flash_blob.c | 10 +- source/family/st/stm32l4xx_1024/target.c | 20 +- source/family/st/xDot-L151/flash_blob.c | 13 +- source/family/st/xDot-L151/target.c | 17 +- source/family/ti/cc3220sf/flash_blob.c | 13 +- source/family/ti/cc3220sf/target.c | 17 +- source/family/toshiba/tz10xx/target_remap0.c | 17 +- .../family/toshiba/tz10xx/tz10xx_prog_blob.h | 13 +- source/family/wiznet/w7500/flash_blob.c | 13 +- source/family/wiznet/w7500/target.c | 17 +- .../hic_hal/atmel/sam3u2c/flash_hal_SAM3U.c | 8 +- source/hic_hal/stm32/stm32f103xb/flash.c | 8 +- source/{hic_hal => target}/target_config.h | 39 ++-- source/{hic_hal => target}/target_reset.h | 0 test/daplink_board.py | 5 +- test/daplink_firmware.py | 2 +- 162 files changed, 1779 insertions(+), 939 deletions(-) rename source/{hic_hal => target}/target_config.h (59%) rename source/{hic_hal => target}/target_reset.h (100%) diff --git a/docs/PORT_TARGET_FAMILY.md b/docs/PORT_TARGET_FAMILY.md index e31c20f09..ec238e692 100644 --- a/docs/PORT_TARGET_FAMILY.md +++ b/docs/PORT_TARGET_FAMILY.md @@ -1,5 +1,5 @@ # Adding A New Target Family -Adding new target support requires creating a flash algo blob and the implementation for some stub functions. Target support is added to the `source/family//` directory. At minimum, 3 files are needed. The first is `source/target//target_reset.c` +Adding new target family support requires creating a flash algo blob and the implementation for target family api. Target support is added to the `source/family//` directory. At minimum, 3 files are needed. The first is `source/target//target_reset.c` ```c /** @@ -25,30 +25,29 @@ Adding new target support requires creating a flash algo blob and the implementa #include "target_reset.h" #include "swd_host.h" +#include "target_family.h" -void target_before_init_debug(void) +static void target_before_init_debug(void) { // any target specific sequences needed before attaching // to the DAP across JTAG or SWD return; } -uint8_t target_unlock_sequence(void) +static uint8_t target_unlock_sequence(void) { // if the device can secure the flash and there is a way to // erase all it should be implemented here. return 1; } -uint8_t target_set_state(TARGET_RESET_STATE state) +static uint8_t target_set_state(TARGET_RESET_STATE state) { - // invoke reset by sw (VECT_REQ or SYS_REQ) or hw (hardware IO toggle) - //return swd_set_target_state_sw(state); - //or - return swd_set_target_state_hw(state); + // if a custom state machine is needed to set the TARGET_RESET_STATE state + return 1; } -uint8_t security_bits_set(uint32_t addr, uint8_t *data, uint32_t size) +static uint8_t security_bits_set(uint32_t addr, uint8_t *data, uint32_t size) { // if there are security bits in the programmable flash region // a check should be performed. This method is used when programming @@ -57,6 +56,114 @@ uint8_t security_bits_set(uint32_t addr, uint8_t *data, uint32_t size) // if needed. return 0; } + +const target_family_descriptor_t g_target_family = { + .family_id = myFamilyID, + .default_reset_type = kHardwareReset, + .target_before_init_debug = target_before_init_debug, + .target_unlock_sequence = target_unlock_sequence, + .target_set_state = target_set_state, + .security_bits_set = security_bits_set, +}; +``` + +The target family api is located in `source/target/target_family.h` and target_reset file can customize the function apis according to the family specification. Family id is a combination of vendor id and an incrementing id. There are predefined family id stubs that can be used for generic reset types; kStub_HWReset_FamilyID, kStub_SWVectReset_FamilyID and kStub_SWSysReset_FamilyID. + +```c +/** + * @file target_family.h + * @brief + * + * DAPLink Interface Firmware + * Copyright (c) 2018-2019, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: Apache-2.0 + * + * 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 TARGET_FAMILY_H +#define TARGET_FAMILY_H + +#include +#include +#include "target_reset.h" + +#define VENDOR_TO_FAMILY(x, y) (x<<8 | y) + +typedef enum _reset_type { + kHardwareReset=1, + kSoftwareReset, +} reset_type_t; + +enum _vendor_ids { + kStub_VendorID = 0, + kNXP_VendorID = 11, + kTI_VendorID = 16, + kNordic_VendorID = 54, + kToshiba_VendorID = 92, + kRenesas_VendorID = 117, + kWiznet_VendorID = 122, + kRealtek_VendorID = 124, +}; + +typedef enum _family_id { + kStub_HWReset_FamilyID = VENDOR_TO_FAMILY(kStub_VendorID, 1), + kStub_SWVectReset_FamilyID = VENDOR_TO_FAMILY(kStub_VendorID, 2), + kStub_SWSysReset_FamilyID = VENDOR_TO_FAMILY(kStub_VendorID, 3), + kNXP_KinetisK_FamilyID = VENDOR_TO_FAMILY(kNXP_VendorID, 1), + kNXP_KinetisL_FamilyID = VENDOR_TO_FAMILY(kNXP_VendorID, 2), + kNXP_Mimxrt_FamilyID = VENDOR_TO_FAMILY(kNXP_VendorID, 3), + kNXP_RapidIot_FamilyID = VENDOR_TO_FAMILY(kNXP_VendorID, 4), + kNXP_KinetisK32W_FamilyID = VENDOR_TO_FAMILY(kNXP_VendorID, 5), + kNordic_Nrf51_FamilyID = VENDOR_TO_FAMILY(kNordic_VendorID, 1), + kNordic_Nrf52_FamilyID = VENDOR_TO_FAMILY(kNordic_VendorID, 2), + kRealtek_Rtl8195am_FamilyID = VENDOR_TO_FAMILY(kRealtek_VendorID, 1), + kTI_Cc3220sf_FamilyID = VENDOR_TO_FAMILY(kTI_VendorID, 1), + kToshiba_Tz_FamilyID = VENDOR_TO_FAMILY(kToshiba_VendorID, 1), + kWiznet_W7500_FamilyID = VENDOR_TO_FAMILY(kWiznet_VendorID, 1), + kRenesas_FamilyID = VENDOR_TO_FAMILY(kRenesas_VendorID, 1), +} family_id_t; + +typedef struct target_family_descriptor { + uint16_t family_id; /*!< Use to select or identify target family from defined target family or custom ones */ + reset_type_t default_reset_type; /*!< Target family can select predefined reset from kHardwareReset and kSoftwareReset */ + uint32_t soft_reset_type; /*!< Families can override software reset type to VECTRESET or SYSRESETREQ */ + void (*target_before_init_debug)(void); /*!< Target dependant function before debug initialization */ + void (*prerun_target_config)(void); /*!< Target specific initialization */ + uint8_t (*target_unlock_sequence)(void); /*!< Unlock targets that can enter lock state */ + uint8_t (*security_bits_set)(uint32_t addr, uint8_t *data, uint32_t size); /*!< Check security bits in the programmable flash region */ + uint8_t (*target_set_state)(TARGET_RESET_STATE state); /*!< Families can customize target debug states in target_reset.h */ + void (*swd_set_target_reset)(uint8_t asserted); /*!< Families can customize how to send reset to the target */ + uint8_t (*validate_bin_nvic)(const uint8_t *buf); /*!< Validate a bin file to be flash by drag and drop */ + uint8_t (*validate_hexfile)(const uint8_t *buf); /*!< Validate a hex file to be flash by drag and drop */ +} target_family_descriptor_t; + +extern const target_family_descriptor_t *g_target_family; + +#ifdef __cplusplus +extern "C" { +#endif + +void init_family(void); +uint8_t target_family_valid(void); +uint8_t target_set_state(TARGET_RESET_STATE state); +void swd_set_target_reset(uint8_t asserted); + +#ifdef __cplusplus +} +#endif + +#endif ``` A flash algorithm blob is needed to program the target MCUs internal (or external) flash memory. This blob contains position independent functions for erasing, reading and writing to the flash controller. Flash algorithm blobs are created from the [FlashAlgo project.](https://github.com/mbedmicro/FlashAlgo) An example blob is shown below and would be added to `source/family///flash_blob.c` @@ -110,6 +217,17 @@ static const uint32_t targetname_blob[] = { 0x0105f021, 0x20006081, 0x00004770, 0x400c0000, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x00000000, 0x00001000}, + }; + static const program_target_t flash = { 0x200000B5, // Init 0x2000029D, // UnInit @@ -164,42 +282,49 @@ The last required file is the target MCU description file `source/family//< // The file flash_blob.c must only be included in target.c #include "flash_blob.c" -// target information target_cfg_t target_device = { - .sector_size = 4096, - .sector_cnt = (MB(1) / 4096), - .flash_start = 0, - .flash_end = MB(1), - .ram_start = 0x20000000, - .ram_end = 0x20010000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x00000000, + .flash_regions[0].end = 0x00200000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1fff0000, + .ram_regions[0].end = 0x20030000, }; ``` -At this point these target specific files could be added to a board build and developed. - -Complete target configuration api is located in `source/hic_hal_target_config.h` +Complete target configuration api is located in `source/target/target_config.h` ```c +enum _region_flags { + kRegionIsDefault = (1 << 0), //out of bounds regions will use the same flash algo if this is set + kRegionIsSecure = (1 << 1) +}; + + +typedef struct region_info { + uint32_t start; + uint32_t end; + uint32_t flags; + uint8_t alias_index; /*!flash_start) && !config_ram_get_initial_hold_in_bl()) { + if (!gpio_get_reset_btn() && g_board_info.target_cfg && validate_bin_nvic((uint8_t *)g_board_info.target_cfg->flash_regions[0].start) && !config_ram_get_initial_hold_in_bl()) { // change to the new vector table - SCB->VTOR = g_board_info.target_cfg->flash_start; + SCB->VTOR = g_board_info.target_cfg->flash_regions[0].start; //bootloaders should only have one flash region for interface // modify stack pointer and start app - modify_stack_pointer_and_start_app((*(uint32_t *)(g_board_info.target_cfg->flash_start)), (*(uint32_t *)(g_board_info.target_cfg->flash_start + 4))); + modify_stack_pointer_and_start_app((*(uint32_t *)(g_board_info.target_cfg->flash_regions[0].start)), (*(uint32_t *)(g_board_info.target_cfg->flash_regions[0].start + 4))); } // config the usb interface descriptor and web auth token before USB connects diff --git a/source/daplink/drag-n-drop/flash_decoder.c b/source/daplink/drag-n-drop/flash_decoder.c index 50b4d79f7..fdfc813b5 100644 --- a/source/daplink/drag-n-drop/flash_decoder.c +++ b/source/daplink/drag-n-drop/flash_decoder.c @@ -143,7 +143,13 @@ error_t flash_decoder_get_flash(flash_decoder_type_t type, uint32_t addr, bool a } } else if (FLASH_DECODER_TYPE_TARGET == type) { if (g_board_info.target_cfg) { - flash_start_local = g_board_info.target_cfg->flash_start; + region_info_t * region = g_board_info.target_cfg->flash_regions; + for (; region->start != 0 || region->end != 0; ++region) { + if (addr >= region->start && addr <= region->end) { + flash_start_local = region->start; + break; + } + } flash_intf_local = flash_intf_target; } else { status = ERROR_FD_UNSUPPORTED_UPDATE; @@ -337,7 +343,7 @@ error_t flash_decoder_close(void) static bool flash_decoder_is_at_end(uint32_t addr, const uint8_t *data, uint32_t size) { - uint32_t end_addr; + uint32_t end_addr=0; switch (flash_type) { case FLASH_DECODER_TYPE_BOOTLOADER: @@ -351,7 +357,17 @@ static bool flash_decoder_is_at_end(uint32_t addr, const uint8_t *data, uint32_t case FLASH_DECODER_TYPE_TARGET: //only if we are sure it is a bin for the target; without check unordered hex files will cause to terminate flashing if (flash_type_target_bin && g_board_info.target_cfg) { - end_addr = g_board_info.target_cfg->flash_end; + region_info_t * region = g_board_info.target_cfg->flash_regions; + for (; region->start != 0 || region->end != 0; ++region) { + if (addr >= region->start && addr<=region->end) { + end_addr = region->end; + break; + } + } + if(end_addr == 0){ //invalid end_addr + return false; + } + } else { return false; diff --git a/source/daplink/interface/target_flash.c b/source/daplink/interface/target_flash.c index cc4bfb105..14066a2d7 100644 --- a/source/daplink/interface/target_flash.c +++ b/source/daplink/interface/target_flash.c @@ -70,14 +70,17 @@ static flash_func_t last_flash_func = FLASH_FUNC_NOP; //saved flash algo static program_target_t * current_flash_algo = NULL; +//saved default region for default flash algo +static region_info_t * default_region = NULL; + //saved flash start from flash algo static uint32_t flash_start = 0; static program_target_t * get_flash_algo(uint32_t addr) { - flash_region_info_t * flash_region = g_board_info.target_cfg->extra_flash; + region_info_t * flash_region = g_board_info.target_cfg->flash_regions; - for (; flash_region->start != 0 && flash_region->end != 0; ++flash_region) { + for (; flash_region->start != 0 || flash_region->end != 0; ++flash_region) { if (addr >= flash_region->start && addr <= flash_region->end) { flash_start = flash_region->start; //save the flash start if (flash_region->flash_algo) { @@ -89,8 +92,12 @@ static program_target_t * get_flash_algo(uint32_t addr) } //could not find a flash algo for the region; use default - flash_start = g_board_info.target_cfg->flash_start; - return g_board_info.target_cfg->flash_algo; + if (default_region) { + flash_start = default_region->start; + return default_region->flash_algo; + } else { + return NULL; + } } static error_t flash_func_start(flash_func_t func) @@ -150,6 +157,15 @@ static error_t target_flash_init() if (0 == target_set_state(RESET_PROGRAM)) { return ERROR_RESET; } + + //get default region + region_info_t * flash_region = g_board_info.target_cfg->flash_regions; + for (; flash_region->start != 0 || flash_region->end != 0; ++flash_region) { + if (flash_region->flags & kRegionIsDefault) { + default_region = flash_region; + break; + } + } state = STATE_OPEN; return ERROR_SUCCESS; @@ -307,39 +323,21 @@ static error_t target_flash_erase_chip(void) { if (g_board_info.target_cfg){ error_t status = ERROR_SUCCESS; - program_target_t * flash; - flash_region_info_t * flash_region = g_board_info.target_cfg->extra_flash; - - if (current_flash_algo != g_board_info.target_cfg->flash_algo) { - //set the initial flash algo - error_t status = target_flash_set(g_board_info.target_cfg->flash_start); + region_info_t * flash_region = g_board_info.target_cfg->flash_regions; + + for (; flash_region->start != 0 || flash_region->end != 0; ++flash_region) { + status = target_flash_set(flash_region->start); if (status != ERROR_SUCCESS) { return status; } - } - - do { - flash = current_flash_algo; status = flash_func_start(FLASH_FUNC_ERASE); if (status != ERROR_SUCCESS) { return status; } - if (0 == swd_flash_syscall_exec(&flash->sys_call_s, flash->erase_chip, 0, 0, 0, 0)) { + if (0 == swd_flash_syscall_exec(¤t_flash_algo->sys_call_s, current_flash_algo->erase_chip, 0, 0, 0, 0)) { return ERROR_ERASE_ALL; } - - while (flash_region->start != 0 && flash_region->end != 0) { - if (flash_region->flash_algo) { - status = target_flash_set(flash_region->start); - if (status != ERROR_SUCCESS) { - return status; - } - flash_region++; - break; - } - flash_region++; - } - } while (flash != current_flash_algo); //call erase on the next flash algo + } // Reset and re-initialize the target after the erase if required if (g_board_info.target_cfg->erase_reset) { @@ -376,7 +374,9 @@ static uint32_t target_flash_erase_sector_size(uint32_t addr) } } } - return g_board_info.target_cfg->sector_size; + //sector information should be in sector_info + util_assert(0); + return 0; } else { return 0; } diff --git a/source/daplink/validation.c b/source/daplink/validation.c index 5ab521f90..1f8493ed6 100644 --- a/source/daplink/validation.c +++ b/source/daplink/validation.c @@ -36,39 +36,38 @@ uint8_t validate_bin_nvic(const uint8_t *buf) return g_target_family && g_target_family->validate_bin_nvic(buf); } else if (g_board_info.target_cfg) { uint32_t i = 4, nvic_val = 0; - uint8_t index = 0, in_range = 0; + uint8_t in_range = 0; // test the initial SP value memcpy(&nvic_val, buf + 0, sizeof(nvic_val)); - if (0 == test_range(nvic_val, g_board_info.target_cfg->ram_start, g_board_info.target_cfg->ram_end)) { - while (!(g_board_info.target_cfg->extra_ram[index].start == 0 && g_board_info.target_cfg->extra_ram[index].end == 0)) { //try additional reqions if present - if (1 == test_range(nvic_val, g_board_info.target_cfg->extra_ram[index].start, g_board_info.target_cfg->extra_ram[index].end)) { - in_range = 1; - break; - } - index++; - } - if (in_range == 0) { - return 0; + + region_info_t * region = g_board_info.target_cfg->ram_regions; + for (; region->start != 0 || region->end != 0; ++region) { + if (1 == test_range(nvic_val, region->start, region->end)) { + in_range = 1; + break; } - } + } + + if (in_range == 0) { + return 0; + } + // Reset_Handler // NMI_Handler // HardFault_Handler for (; i <= 12; i += 4) { + in_range = 0; memcpy(&nvic_val, buf + i, sizeof(nvic_val)); - if (0 == test_range(nvic_val, g_board_info.target_cfg->flash_start, g_board_info.target_cfg->flash_end)) { - index = 0, in_range = 0; - while (!(g_board_info.target_cfg->extra_flash[index].start == 0 && g_board_info.target_cfg->extra_flash[index].end == 0)) { //try additional reqions if present - if (1 == test_range(nvic_val, g_board_info.target_cfg->extra_flash[index].start, g_board_info.target_cfg->extra_flash[index].end)) { - in_range = 1; - break; - } - index++; - } - if (in_range == 0) { - return 0; + region_info_t * region = g_board_info.target_cfg->flash_regions; + for (; region->start != 0 || region->end != 0; ++region) { + if (1 == test_range(nvic_val, region->start, region->end)) { + in_range = 1; + break; } } + if (in_range == 0) { + return 0; + } } return 1; diff --git a/source/family/freescale/k20dx/flash_blob.c b/source/family/freescale/k20dx/flash_blob.c index f73b17d77..cfda9cfb5 100644 --- a/source/family/freescale/k20dx/flash_blob.c +++ b/source/family/freescale/k20dx/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the k20dx * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -51,6 +51,17 @@ static const uint32_t K20D50M_FLM[] = { 0x40020004, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 1024}, + }; + static const program_target_t flash = { 0x20000021, // Init 0x20000049, // UnInit diff --git a/source/family/freescale/k20dx/target.c b/source/family/freescale/k20dx/target.c index 47515dbfc..4442166c9 100644 --- a/source/family/freescale/k20dx/target.c +++ b/source/family/freescale/k20dx/target.c @@ -3,7 +3,7 @@ * @brief Target information for the k20dx * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 1024, - .sector_cnt = (KB(128) / 1024), - .flash_start = 0, - .flash_end = KB(128), - .ram_start = 0x1FFF8000, - .ram_end = 0x20008000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(128), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1FFF8000, + .ram_regions[0].end = 0x20008000, }; diff --git a/source/family/freescale/k22f/flash_blob.c b/source/family/freescale/k22f/flash_blob.c index bfbeb0c39..5a8d00dfa 100644 --- a/source/family/freescale/k22f/flash_blob.c +++ b/source/family/freescale/k22f/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,11 +58,11 @@ static const uint32_t flash_start = 0x00000000; static const uint32_t flash_size = 0x00080000; /** -* List of start and size for each size of flash sector - even indexes are start, odd are size +* List of start and size for each size of flash sector * The size will apply to all sectors between the listed address and the next address * in the list. * The last pair in the list will have sectors starting at that address and ending -* at address flash_start + flash_size. +* at address start + size. */ static const sector_info_t sectors_info[] = { { 0x00000000, 0x00000800 }, diff --git a/source/family/freescale/k22f/target.c b/source/family/freescale/k22f/target.c index 1a8f6ab23..d00b6ad91 100644 --- a/source/family/freescale/k22f/target.c +++ b/source/family/freescale/k22f/target.c @@ -3,7 +3,7 @@ * @brief Target information for the k22f * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 2048, - .sector_cnt = (KB(512) / 2048), - .flash_start = 0, - .flash_end = KB(512), - .ram_start = 0x1FFF0000, - .ram_end = 0x20010000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(512), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1FFF0000, + .ram_regions[0].end = 0x20010000, }; diff --git a/source/family/freescale/k28f/flash_blob.c b/source/family/freescale/k28f/flash_blob.c index 561f63070..dbd910736 100644 --- a/source/family/freescale/k28f/flash_blob.c +++ b/source/family/freescale/k28f/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the k66f * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -61,6 +61,17 @@ static const uint32_t mk28f15_flash_prog_blob[] = { 0x00800000, 0x01000000, 0x02000000, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + { 0, 4096 }, +}; + static const program_target_t flash = { 0x20000021, // Init 0x20000049, // UnInit diff --git a/source/family/freescale/k28f/target.c b/source/family/freescale/k28f/target.c index 18b3e8cd9..da950b836 100644 --- a/source/family/freescale/k28f/target.c +++ b/source/family/freescale/k28f/target.c @@ -3,7 +3,7 @@ * @brief Target information for the k66f * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 4096, - .sector_cnt = (MB(2) / 4096), - .flash_start = 0, - .flash_end = MB(2), - .ram_start = 0x1FFC0000, - .ram_end = 0x20040000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = MB(2), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1FFC0000, + .ram_regions[0].end = 0x20040000, }; diff --git a/source/family/freescale/k32w042/flash_blob.c b/source/family/freescale/k32w042/flash_blob.c index 4e4e5c20f..4047a706d 100644 --- a/source/family/freescale/k32w042/flash_blob.c +++ b/source/family/freescale/k32w042/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -98,6 +98,13 @@ static const uint32_t k32w042s1m2_flash_prog_blob[] = { 0x00000000 }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ static const sector_info_t sectors_info[] = { {0x00000000, 0x00001000}, }; diff --git a/source/family/freescale/k32w042/target.c b/source/family/freescale/k32w042/target.c index d3958b59c..7a97ebc7d 100644 --- a/source/family/freescale/k32w042/target.c +++ b/source/family/freescale/k32w042/target.c @@ -3,7 +3,7 @@ * @brief Target information for the k32w042 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .flash_start = 0, - .flash_end = KB(1024), - .ram_start = 0x20000000, // M4 DTCM - .ram_end = 0x20030000, - .flash_algo = (program_target_t *) &flash, - .sectors_info = sectors_info, - .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)) + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(1024), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, // M4 DTCM + .ram_regions[0].end = 0x20030000, }; diff --git a/source/family/freescale/k64f/flash_blob.c b/source/family/freescale/k64f/flash_blob.c index 29f3ff9c5..9667ee543 100644 --- a/source/family/freescale/k64f/flash_blob.c +++ b/source/family/freescale/k64f/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,11 +66,11 @@ static const uint32_t flash_start = 0x00000000; static const uint32_t flash_size = 0x00100000; /** -* List of start and size for each size of flash sector - even indexes are start, odd are size +* List of start and size for each size of flash sector * The size will apply to all sectors between the listed address and the next address * in the list. * The last pair in the list will have sectors starting at that address and ending -* at address flash_start + flash_size. +* at address start + size. */ static const sector_info_t sectors_info[] = { { 0x00000000, 0x00001000 }, diff --git a/source/family/freescale/k64f/target.c b/source/family/freescale/k64f/target.c index 355099ab8..458943fc4 100644 --- a/source/family/freescale/k64f/target.c +++ b/source/family/freescale/k64f/target.c @@ -3,7 +3,7 @@ * @brief Target information for the k64f * * DAPLink Interface Firmware - * Copyright (c) 2017-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2017-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .flash_start = 0x00000000, - .flash_end = 0x00100000, - .ram_start = 0x1fff0000, - .ram_end = 0x20030000, - .flash_algo = (program_target_t *) &flash, - .sectors_info = sectors_info, - .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)) + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x00000000, + .flash_regions[0].end = 0x00100000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1fff0000, + .ram_regions[0].end = 0x20030000, }; diff --git a/source/family/freescale/k66f/flash_blob.c b/source/family/freescale/k66f/flash_blob.c index 119326b5e..a18ca320f 100644 --- a/source/family/freescale/k66f/flash_blob.c +++ b/source/family/freescale/k66f/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the k66f * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -61,6 +61,13 @@ static const uint32_t mk66f18_flash_prog_blob[] = { 0x00800000, 0x01000000, 0x02000000, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ static const sector_info_t sectors_info[] = { {0x00000000, 0x00001000}, }; diff --git a/source/family/freescale/k66f/target.c b/source/family/freescale/k66f/target.c index e744fafa0..fe7d5207f 100644 --- a/source/family/freescale/k66f/target.c +++ b/source/family/freescale/k66f/target.c @@ -3,7 +3,7 @@ * @brief Target information for the k66f * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .flash_start = 0x00000000, - .flash_end = 0x00200000, - .ram_start = 0x1fff0000, - .ram_end = 0x20030000, - .flash_algo = (program_target_t *) &flash, - .sectors_info = sectors_info, - .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)) + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x00000000, + .flash_regions[0].end = 0x00200000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1fff0000, + .ram_regions[0].end = 0x20030000, }; diff --git a/source/family/freescale/k82f/flash_blob.c b/source/family/freescale/k82f/flash_blob.c index f9f604d02..cf5bda44e 100644 --- a/source/family/freescale/k82f/flash_blob.c +++ b/source/family/freescale/k82f/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,6 +59,17 @@ static const uint32_t mk82f25615_flash_prog_blob[] = { 0x02000180, 0x04000300, 0x00000600, 0x00000000, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 4096}, + }; + static const program_target_t flash = { 0x20000021, // Init 0x20000071, // UnInit diff --git a/source/family/freescale/k82f/target.c b/source/family/freescale/k82f/target.c index 1b41ff471..8c82420bf 100644 --- a/source/family/freescale/k82f/target.c +++ b/source/family/freescale/k82f/target.c @@ -3,7 +3,7 @@ * @brief Target information for the k66f * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 4096, - .sector_cnt = (KB(256) / 4096), - .flash_start = 0, - .flash_end = KB(256), - .ram_start = 0x1FFF0000, - .ram_end = 0x20030000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(256), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1FFF0000, + .ram_regions[0].end = 0x20030000, }; diff --git a/source/family/freescale/ke15z/flash_blob.c b/source/family/freescale/ke15z/flash_blob.c index 8f3a50eca..855092146 100644 --- a/source/family/freescale/ke15z/flash_blob.c +++ b/source/family/freescale/ke15z/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the ke15z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -66,6 +66,17 @@ static const uint32_t mke15z7_flash_prog_blob[] = { 0x00000000, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 2048}, + }; + static const program_target_t flash = { 0x20000021, // Init 0x20000075, // UnInit diff --git a/source/family/freescale/ke15z/target.c b/source/family/freescale/ke15z/target.c index 06f12ef47..cf3bc8cc2 100644 --- a/source/family/freescale/ke15z/target.c +++ b/source/family/freescale/ke15z/target.c @@ -3,7 +3,7 @@ * @brief Target information for the ke15z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 2048, - .sector_cnt = (KB(256) / 2048), - .flash_start = 0, - .flash_end = KB(256), - .ram_start = 0x1FFFE000, - .ram_end = 0x20006000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(256), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1FFFE000, + .ram_regions[0].end = 0x20006000, }; diff --git a/source/family/freescale/ke18f/flash_blob.c b/source/family/freescale/ke18f/flash_blob.c index 5d62d2404..7aebdc69b 100644 --- a/source/family/freescale/ke18f/flash_blob.c +++ b/source/family/freescale/ke18f/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the ke18f * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -67,6 +67,17 @@ static const uint32_t mke18f16_flash_prog_blob[] = { 0x00000600, 0x00000000, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 4096}, + }; + static const program_target_t flash = { 0x20000021, // Init 0x20000073, // UnInit diff --git a/source/family/freescale/ke18f/target.c b/source/family/freescale/ke18f/target.c index 3266bb698..163e702b2 100644 --- a/source/family/freescale/ke18f/target.c +++ b/source/family/freescale/ke18f/target.c @@ -3,7 +3,7 @@ * @brief Target information for the ke18f * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 4096, - .sector_cnt = (KB(512) / 4096), - .flash_start = 0, - .flash_end = KB(512), - .ram_start = 0x1FFF8000, - .ram_end = 0x20008000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(512), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1FFF8000, + .ram_regions[0].end = 0x20008000, }; diff --git a/source/family/freescale/kl02z/flash_blob.c b/source/family/freescale/kl02z/flash_blob.c index eecb7ea27..c5464564e 100644 --- a/source/family/freescale/kl02z/flash_blob.c +++ b/source/family/freescale/kl02z/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the kl02z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -61,6 +61,17 @@ static const uint32_t KL02Z_FLM[] = { 0x00000000, 0x00000000, 0x00000020, 0x40020004, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 1024}, + }; + static const program_target_t flash = { 0x20000021, // Init 0x20000039, // UnInit diff --git a/source/family/freescale/kl02z/target.c b/source/family/freescale/kl02z/target.c index e92af162c..bc23899f9 100644 --- a/source/family/freescale/kl02z/target.c +++ b/source/family/freescale/kl02z/target.c @@ -3,7 +3,7 @@ * @brief Target information for the kl02z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 1024, - .sector_cnt = (KB(32) / 1024), - .flash_start = 0, - .flash_end = KB(32), - .ram_start = 0x1FFFFC00, - .ram_end = 0x20000C00, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(32), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1FFFFC00, + .ram_regions[0].end = 0x20000C00, }; diff --git a/source/family/freescale/kl05z/flash_blob.c b/source/family/freescale/kl05z/flash_blob.c index de8013f88..549450d4b 100644 --- a/source/family/freescale/kl05z/flash_blob.c +++ b/source/family/freescale/kl05z/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the kl05 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -61,6 +61,17 @@ static const uint32_t KL05Z_FLM[] = { 0x00000000, 0x00000000, 0x00000020, 0x40020004, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 1024}, + }; + static const program_target_t flash = { 0x20000021, // Init 0x20000039, // UnInit diff --git a/source/family/freescale/kl05z/target.c b/source/family/freescale/kl05z/target.c index cb3cc7257..a038c220c 100644 --- a/source/family/freescale/kl05z/target.c +++ b/source/family/freescale/kl05z/target.c @@ -3,7 +3,7 @@ * @brief Target information for the kl05z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 1024, - .sector_cnt = (KB(32) / 1024), - .flash_start = 0, - .flash_end = KB(32), - .ram_start = 0x1FFFFC00, - .ram_end = 0x20000C00, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(32), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1FFFFC00, + .ram_regions[0].end = 0x20000C00, }; diff --git a/source/family/freescale/kl25z/flash_blob.c b/source/family/freescale/kl25z/flash_blob.c index def1dda70..5784a770d 100644 --- a/source/family/freescale/kl25z/flash_blob.c +++ b/source/family/freescale/kl25z/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the kl25z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -73,6 +73,17 @@ static const uint32_t KL25Z_FLM[] = { 0x00000020, 0x40020004, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 1024}, + }; + static const program_target_t flash = { 0x20000021, // Init 0x20000039, // UnInit diff --git a/source/family/freescale/kl25z/target.c b/source/family/freescale/kl25z/target.c index 7014b22bd..0d6e8bde3 100644 --- a/source/family/freescale/kl25z/target.c +++ b/source/family/freescale/kl25z/target.c @@ -3,7 +3,7 @@ * @brief Target information for the kl25z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 1024, - .sector_cnt = (KB(128) / 1024), - .flash_start = 0, - .flash_end = KB(128), - .ram_start = 0x1FFF0000, - .ram_end = 0x20004000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(128), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1FFF0000, + .ram_regions[0].end = 0x20004000, }; diff --git a/source/family/freescale/kl26z/flash_blob.c b/source/family/freescale/kl26z/flash_blob.c index 1c0250a7a..84aa3601d 100644 --- a/source/family/freescale/kl26z/flash_blob.c +++ b/source/family/freescale/kl26z/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the kl26z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -61,6 +61,17 @@ static const uint32_t KL26Z_FLM[] = { 0x00000000, 0x00000000, 0x00000020, 0x40020004, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 1024}, + }; + static const program_target_t flash = { 0x20000021, // Init 0x20000039, // UnInit diff --git a/source/family/freescale/kl26z/target.c b/source/family/freescale/kl26z/target.c index 621259798..583b9f083 100644 --- a/source/family/freescale/kl26z/target.c +++ b/source/family/freescale/kl26z/target.c @@ -3,7 +3,7 @@ * @brief Target information for the kl26z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 1024, - .sector_cnt = (KB(128) / 1024), - .flash_start = 0, - .flash_end = KB(128), - .ram_start = 0x1FFF0000, - .ram_end = 0x20004000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(128), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1FFF0000, + .ram_regions[0].end = 0x20004000, }; diff --git a/source/family/freescale/kl27z/flash_blob.c b/source/family/freescale/kl27z/flash_blob.c index 0a88091ca..fb8ec8781 100644 --- a/source/family/freescale/kl27z/flash_blob.c +++ b/source/family/freescale/kl27z/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the kl27z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -61,6 +61,17 @@ static const uint32_t KL27Z_FLM[] = { 0x00000000, 0x00000000, 0x00000020, 0x40020004, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 1024}, + }; + static const program_target_t flash = { 0x20000021, // Init 0x20000039, // UnInit diff --git a/source/family/freescale/kl27z/target.c b/source/family/freescale/kl27z/target.c index 6424bb937..66a3b3c9d 100644 --- a/source/family/freescale/kl27z/target.c +++ b/source/family/freescale/kl27z/target.c @@ -3,7 +3,7 @@ * @brief Target information for the kl27z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 1024, - .sector_cnt = (KB(64) / 1024), - .flash_start = 0, - .flash_end = KB(64), - .ram_start = 0x1FFFF000, - .ram_end = 0x20003000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(64), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1FFFF000, + .ram_regions[0].end = 0x20003000, }; diff --git a/source/family/freescale/kl28z/flash_blob.c b/source/family/freescale/kl28z/flash_blob.c index 39f9c35b4..77ef6dd81 100644 --- a/source/family/freescale/kl28z/flash_blob.c +++ b/source/family/freescale/kl28z/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the kl46z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -75,6 +75,17 @@ static const uint32_t KL28Z_FLM[] = { 0x00800000, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 1024}, + }; + static const program_target_t flash = { 0x20000021, // Init 0x20000049, // UnInit diff --git a/source/family/freescale/kl28z/target.c b/source/family/freescale/kl28z/target.c index 47e36eab8..815cefd15 100644 --- a/source/family/freescale/kl28z/target.c +++ b/source/family/freescale/kl28z/target.c @@ -3,7 +3,7 @@ * @brief Target information for the kl46z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 1024, - .sector_cnt = (KB(256) / 1024), - .flash_start = 0, - .flash_end = KB(256), - .ram_start = 0x1FFF8000, - .ram_end = 0x20018000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(256), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1FFF8000, + .ram_regions[0].end = 0x20018000, }; diff --git a/source/family/freescale/kl43z/flash_blob.c b/source/family/freescale/kl43z/flash_blob.c index 1b69986fa..e3ef85d37 100644 --- a/source/family/freescale/kl43z/flash_blob.c +++ b/source/family/freescale/kl43z/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the kl43z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -64,6 +64,17 @@ static const uint32_t mkl43z4_flash_prog_blob[] = { 0x02000180, 0x04000300, 0x00000600, 0x00000000, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 1024}, + }; + static const program_target_t flash = { 0x20000021, // Init 0x20000065, // UnInit diff --git a/source/family/freescale/kl43z/target.c b/source/family/freescale/kl43z/target.c index 3f193952f..051efb41d 100644 --- a/source/family/freescale/kl43z/target.c +++ b/source/family/freescale/kl43z/target.c @@ -3,7 +3,7 @@ * @brief Target information for the kl43z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 1024, - .sector_cnt = (KB(256) / 1024), - .flash_start = 0, - .flash_end = KB(256), - .ram_start = 0x1fffe000, - .ram_end = 0x20006000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(256), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1fffe000, + .ram_regions[0].end = 0x20006000, }; diff --git a/source/family/freescale/kl46z/flash_blob.c b/source/family/freescale/kl46z/flash_blob.c index b962229d0..70a0da4d9 100644 --- a/source/family/freescale/kl46z/flash_blob.c +++ b/source/family/freescale/kl46z/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the kl46z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -73,6 +73,17 @@ static const uint32_t KL46Z_FLM[] = { 0x00000020, 0x40020004, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 1024}, + }; + static const program_target_t flash = { 0x20000021, // Init 0x20000021, // UnInit diff --git a/source/family/freescale/kl46z/target.c b/source/family/freescale/kl46z/target.c index 4af164a7a..cfdb4b60e 100644 --- a/source/family/freescale/kl46z/target.c +++ b/source/family/freescale/kl46z/target.c @@ -3,7 +3,7 @@ * @brief Target information for the kl46z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 1024, - .sector_cnt = (KB(256) / 1024), - .flash_start = 0, - .flash_end = KB(256), - .ram_start = 0x1FFFE000, - .ram_end = 0x20006000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(256), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1FFFE000, + .ram_regions[0].end = 0x20006000, }; diff --git a/source/family/freescale/kl82z/flash_blob.c b/source/family/freescale/kl82z/flash_blob.c index 25681124c..d0e8b1552 100644 --- a/source/family/freescale/kl82z/flash_blob.c +++ b/source/family/freescale/kl82z/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,6 +58,17 @@ static const uint32_t mkl82z7_flash_prog_blob[] = { 0x00800060, 0x010000c0, 0x02000180, 0x04000300, 0x00000600, 0x00000000, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 1024}, + }; + static const program_target_t flash = { 0x20000021, // Init 0x20000071, // UnInit diff --git a/source/family/freescale/kl82z/target.c b/source/family/freescale/kl82z/target.c index 2e03f6a2f..2b5ca95d3 100644 --- a/source/family/freescale/kl82z/target.c +++ b/source/family/freescale/kl82z/target.c @@ -3,7 +3,7 @@ * @brief Target information for the kl46z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 1024, - .sector_cnt = (KB(96) / 1024), - .flash_start = 0, - .flash_end = KB(128), - .ram_start = 0x1FFFA000, - .ram_end = 0x20012000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(128), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1FFFA000, + .ram_regions[0].end = 0x20012000, }; diff --git a/source/family/freescale/kw24d/flash_blob.c b/source/family/freescale/kw24d/flash_blob.c index 95e2a5032..fefedb713 100644 --- a/source/family/freescale/kw24d/flash_blob.c +++ b/source/family/freescale/kw24d/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the kw24d * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -66,6 +66,17 @@ const uint32_t mkw24d5_flash_prog_blob[] = { 0x04000300, 0x00000600, 0x00000000, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 2048}, + }; + static const program_target_t flash = { 0x20000021, // Init 0x20000071, // UnInit diff --git a/source/family/freescale/kw24d/target.c b/source/family/freescale/kw24d/target.c index a7ae7d541..b09bdcaa0 100644 --- a/source/family/freescale/kw24d/target.c +++ b/source/family/freescale/kw24d/target.c @@ -3,7 +3,7 @@ * @brief Target information for the kw24d * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 2048, - .sector_cnt = (KB(512) / 2048), - .flash_start = 0, - .flash_end = KB(512), - .ram_start = 0x1FFF8000, - .ram_end = 0x20008000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(512), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1FFF8000, + .ram_regions[0].end = 0x20008000, }; diff --git a/source/family/freescale/kw41z/flash_blob.c b/source/family/freescale/kw41z/flash_blob.c index a18dac6ab..b902e8dd2 100644 --- a/source/family/freescale/kw41z/flash_blob.c +++ b/source/family/freescale/kw41z/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the kw41z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -90,6 +90,17 @@ static const uint32_t mkw41z4_flash_prog_blob[] = { 0x00800000, 0x00000000, 0x00800000, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 2048}, + }; + static const program_target_t flash = { 0x20000021, // Init 0x20000039, // UnInit diff --git a/source/family/freescale/kw41z/target.c b/source/family/freescale/kw41z/target.c index fe6d80e5e..37a801dc4 100644 --- a/source/family/freescale/kw41z/target.c +++ b/source/family/freescale/kw41z/target.c @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 2048, - .sector_cnt = (KB(512) / 2048), - .flash_start = 0, - .flash_end = KB(512), - .ram_start = 0x1FFF8000, - .ram_end = 0x20018000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(512), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x1FFF8000, + .ram_regions[0].end = 0x20018000, }; diff --git a/source/family/freescale/mimxrt1020_spi_flash/flash_blob.c b/source/family/freescale/mimxrt1020_spi_flash/flash_blob.c index 643739f3f..17b6a1b85 100644 --- a/source/family/freescale/mimxrt1020_spi_flash/flash_blob.c +++ b/source/family/freescale/mimxrt1020_spi_flash/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,6 +14,8 @@ * limitations under the License. */ +#include "flash_blob.h" + static const uint32_t RT1020_S25LP064A_flash_prog_blob[] = { 0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2, 0x4605b570, 0x4616460c, 0xcc0fe002, 0x3e10c50f, 0xd2fa2e10, 0xd3022e08, 0xc503cc03, 0x2e043e08, @@ -609,15 +611,15 @@ static const uint32_t flash_start = 0x60000000; static const uint32_t flash_size = 0x00800000; /** -* List of start and size for each size of flash sector - even indexes are start, odd are size +* List of start and size for each size of flash sector * The size will apply to all sectors between the listed address and the next address * in the list. * The last pair in the list will have sectors starting at that address and ending -* at address flash_start + flash_size. +* at address start + size. */ -static const uint32_t sectors_info[] = { - 0x60000000, 0x00001000, -}; +static const sector_info_t sectors_info[] = { + {0x60000000, 0x00001000}, + }; static const program_target_t flash = { 0x20000b01, // Init diff --git a/source/family/freescale/mimxrt1020_spi_flash/target.c b/source/family/freescale/mimxrt1020_spi_flash/target.c index 82f027700..725104884 100644 --- a/source/family/freescale/mimxrt1020_spi_flash/target.c +++ b/source/family/freescale/mimxrt1020_spi_flash/target.c @@ -3,7 +3,7 @@ * @brief Target information for the i.MXRT1020 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -27,11 +27,12 @@ // target information target_cfg_t target_device = { - .sector_size = KB(4), - .sector_cnt = 2048, - .flash_start = 0x60000000, - .flash_end = 0x60000000 + MB(64), - .ram_start = 0x20000000, - .ram_end = 0x20000000 + MB(64), - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x60000000, + .flash_regions[0].end = 0x60000000 + MB(64), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20000000 + MB(64), }; diff --git a/source/family/freescale/mimxrt1050_hyper_flash/flash_blob.c b/source/family/freescale/mimxrt1050_hyper_flash/flash_blob.c index bf9dce2a1..3814f0560 100644 --- a/source/family/freescale/mimxrt1050_hyper_flash/flash_blob.c +++ b/source/family/freescale/mimxrt1050_hyper_flash/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the i.MXRT1050 HyperFlash * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -446,6 +446,17 @@ static const uint32_t MIMXRT_HYPER_FLASH_FLM[] = { 0x00000000, 0x00000000, 0x00000000, 0x00b71b00, 0x00000000, 0x00000000, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x60002000, 0x00000400}, + }; + static const program_target_t flash = { 0x200003A9, // Init 0x20000C79, // UnInit diff --git a/source/family/freescale/mimxrt1050_hyper_flash/target.c b/source/family/freescale/mimxrt1050_hyper_flash/target.c index 2e9bc485a..f1e9ba4d8 100644 --- a/source/family/freescale/mimxrt1050_hyper_flash/target.c +++ b/source/family/freescale/mimxrt1050_hyper_flash/target.c @@ -3,7 +3,7 @@ * @brief Target information for the i.MXRT1050 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = KB(1), - .sector_cnt = 1024, - .flash_start = 0x60002000, - .flash_end = 0x60002000 + MB(64), - .ram_start = 0x20000000, - .ram_end = 0x20000000 + MB(64), - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x60002000, + .flash_regions[0].end = 0x60002000 + MB(64), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20000000 + MB(64), }; diff --git a/source/family/freescale/mimxrt1050_spi_flash/flash_blob.c b/source/family/freescale/mimxrt1050_spi_flash/flash_blob.c index c310c4aea..9e1e72eb8 100644 --- a/source/family/freescale/mimxrt1050_spi_flash/flash_blob.c +++ b/source/family/freescale/mimxrt1050_spi_flash/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the i.MXRT1050 QSPI * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -447,6 +447,17 @@ static const uint32_t MIMXRT_SPI_FLASH_FLM[] = { 0x00000000, 0x00000000, 0x00000000, 0x00b71b00, 0x00000000, 0x00000000, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x60002000, 0x00001000}, + }; + static const program_target_t flash = { 0x200003A1, // Init 0x20000C99, // UnInit diff --git a/source/family/freescale/mimxrt1050_spi_flash/target.c b/source/family/freescale/mimxrt1050_spi_flash/target.c index b853e3606..f1e9ba4d8 100644 --- a/source/family/freescale/mimxrt1050_spi_flash/target.c +++ b/source/family/freescale/mimxrt1050_spi_flash/target.c @@ -3,7 +3,7 @@ * @brief Target information for the i.MXRT1050 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = KB(4), - .sector_cnt = 2048, - .flash_start = 0x60002000, - .flash_end = 0x60002000 + MB(64), - .ram_start = 0x20000000, - .ram_end = 0x20000000 + MB(64), - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x60002000, + .flash_regions[0].end = 0x60002000 + MB(64), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20000000 + MB(64), }; diff --git a/source/family/freescale/rapid_iot/flash_blob_k64.c b/source/family/freescale/rapid_iot/flash_blob_k64.c index 054a54dd0..f9cf27877 100644 --- a/source/family/freescale/rapid_iot/flash_blob_k64.c +++ b/source/family/freescale/rapid_iot/flash_blob_k64.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the k64f * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -61,8 +61,15 @@ static const uint32_t K64F_FLM[] = { 0x00400000, 0x00800000, 0x01000000, 0x01000000, 0x40020004, 0x00000000, }; -static const sector_info_t sectors_info[] = { - {0x00000000, 0x00001000}, +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info_k64[] = { + {0, 4096}, }; static const program_target_t flash_k64 = { diff --git a/source/family/freescale/rapid_iot/flash_blob_kw40.c b/source/family/freescale/rapid_iot/flash_blob_kw40.c index c749e1af8..8306e2657 100644 --- a/source/family/freescale/rapid_iot/flash_blob_kw40.c +++ b/source/family/freescale/rapid_iot/flash_blob_kw40.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the kw40z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -76,6 +76,17 @@ static const uint32_t mkw40z4_flash_prog_blob[] = { 0x00280000, 0x40020004, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info_kw40[] = { + {0, 1024}, + }; + static const program_target_t flash_kw40 = { 0x2000027D, // Init 0x200002E5, // UnInit diff --git a/source/family/freescale/rapid_iot/flash_blob_kw41.c b/source/family/freescale/rapid_iot/flash_blob_kw41.c index 4c212b228..80a6f44f9 100644 --- a/source/family/freescale/rapid_iot/flash_blob_kw41.c +++ b/source/family/freescale/rapid_iot/flash_blob_kw41.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the kw41z * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -82,6 +82,17 @@ static const uint32_t mkw41z4_flash_prog_blob[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info_kw41[] = { + {0, 2048}, + }; + static const program_target_t flash_kw41 = { 0x20000021, // Init 0x20000065, // UnInit diff --git a/source/family/freescale/rapid_iot/target.c b/source/family/freescale/rapid_iot/target.c index 46610c9d3..a76abcf39 100644 --- a/source/family/freescale/rapid_iot/target.c +++ b/source/family/freescale/rapid_iot/target.c @@ -3,7 +3,7 @@ * @brief Target information for the rapid-iot * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -28,39 +28,38 @@ // default target information is k64f target_cfg_t target_device = { - .sector_size = 4096, + .sectors_info = sectors_info_k64, + .sector_info_length = (sizeof(sectors_info_k64))/(sizeof(sectors_info_k64)), #ifdef BOARD_RAPID_IOT - /* Rapid-IoT boards reserve flash at the beginning for bootloader */ - .sector_cnt = (0xEC000 / 4096), - .flash_start = 0x00014000, + .flash_regions[0].start = 0x00014000, #else - /* Hexiwear boards do not have a bootloader at the start of flash */ - .sector_cnt = (MB(1) / 4096), - .flash_start = 0x00000000, -#endif - .flash_end = MB(1), - .ram_start = 0x1fff0000, - .ram_end = 0x20030000, - .flash_algo = (program_target_t *) &flash_k64, + .flash_regions[0].start = 0x00000000, +#endif + .flash_regions[0].end = MB(1), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash_k64, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20030000, }; target_cfg_t target_device_kw40 = { - .sector_size = 1024, - .sector_cnt = (KB(160) / 1024), - .flash_start = 0, - .flash_end = KB(160), - .ram_start = 0x1FFFF000, - .ram_end = 0x20004000, - .flash_algo = (program_target_t *) &flash_kw40, + .sectors_info = sectors_info_kw40, + .sector_info_length = (sizeof(sectors_info_kw40))/(sizeof(sectors_info_kw40)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(160), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash_kw40, + .ram_regions[0].start = 0x1FFFF000, + .ram_regions[0].end = 0x20004000, }; target_cfg_t target_device_kw41 = { - .sector_size = 2048, - /* Rapid-IoT boards reserve flash at the beginning for bootloader */ - .sector_cnt = (0x7C000 / 2048), - .flash_start = 0x4000, - .flash_end = KB(512), - .ram_start = 0x1FFF8000, - .ram_end = 0x20018000, - .flash_algo = (program_target_t *) &flash_kw41, + .sectors_info = sectors_info_kw41, + .sector_info_length = (sizeof(sectors_info_kw41))/(sizeof(sectors_info_kw41)), + .flash_regions[0].start = 0x4000, + .flash_regions[0].end = KB(512), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash_kw41, + .ram_regions[0].start = 0x1FFF8000, + .ram_regions[0].end = 0x20018000, }; diff --git a/source/family/maxim/max32620/flash_blob.c b/source/family/maxim/max32620/flash_blob.c index f93d5ea9e..4a90aad95 100644 --- a/source/family/maxim/max32620/flash_blob.c +++ b/source/family/maxim/max32620/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the MAX32620 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -56,6 +56,17 @@ const uint32_t flash_algo_blob[] = { FLC_BASE, CLK_DIV, BRST_SIZE, FLASH_BASE, FLASH_SIZE, FLASH_SECTOR, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 0x2000}, + }; + const program_target_t flash = { 0x20000021, // Init 0x20000045, // UnInit diff --git a/source/family/maxim/max32620/target.c b/source/family/maxim/max32620/target.c index 582a278bb..ca12cc13f 100644 --- a/source/family/maxim/max32620/target.c +++ b/source/family/maxim/max32620/target.c @@ -3,7 +3,7 @@ * @brief Target information for the MAX32620 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -21,15 +21,16 @@ #include "target_config.h" -extern const program_target_t flash; +#include "flash_blob.c" /* ME02 -- MAX32620 2MiB Flash, 256KiB RAM */ target_cfg_t target_device = { - .sector_size = 0x2000, - .sector_cnt = (0x200000 / 0x2000), - .flash_start = 0, - .flash_end = 0x200000, - .ram_start = 0x20000000, - .ram_end = 0x20040000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = 0x200000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20040000, }; diff --git a/source/family/maxim/max32625/flash_blob.c b/source/family/maxim/max32625/flash_blob.c index 9c10b5e7d..9f9e82f34 100644 --- a/source/family/maxim/max32625/flash_blob.c +++ b/source/family/maxim/max32625/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the MAX32625 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -56,6 +56,17 @@ const uint32_t flash_algo_blob[] = { FLC_BASE, CLK_DIV, BRST_SIZE, FLASH_BASE, FLASH_SIZE, FLASH_SECTOR, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 0x2000}, + }; + const program_target_t flash = { 0x20000021, // Init 0x20000045, // UnInit diff --git a/source/family/maxim/max32625/target.c b/source/family/maxim/max32625/target.c index 5bd35b7b9..402d33b87 100644 --- a/source/family/maxim/max32625/target.c +++ b/source/family/maxim/max32625/target.c @@ -3,7 +3,7 @@ * @brief Target information for the MAX32625 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -21,15 +21,16 @@ #include "target_config.h" -extern const program_target_t flash; +#include "flash_blob.c" /* ME03 -- MAX32625 512KiB Flash, 160KiB RAM */ target_cfg_t target_device = { - .sector_size = 0x2000, - .sector_cnt = (0x80000 / 0x2000), - .flash_start = 0, - .flash_end = 0x80000, - .ram_start = 0x20000000, - .ram_end = 0x20028000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = 0x80000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20028000, }; diff --git a/source/family/maxim/max32630/flash_blob.c b/source/family/maxim/max32630/flash_blob.c index 8c7645c4c..e9193e1de 100644 --- a/source/family/maxim/max32630/flash_blob.c +++ b/source/family/maxim/max32630/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the MAX32630 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -56,6 +56,17 @@ const uint32_t flash_algo_blob[] = { FLC_BASE, CLK_DIV, BRST_SIZE, FLASH_BASE, FLASH_SIZE, FLASH_SECTOR, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 0x2000}, + }; + const program_target_t flash = { 0x20000021, // Init 0x20000045, // UnInit diff --git a/source/family/maxim/max32630/target.c b/source/family/maxim/max32630/target.c index 92afc4239..5713bad56 100644 --- a/source/family/maxim/max32630/target.c +++ b/source/family/maxim/max32630/target.c @@ -3,7 +3,7 @@ * @brief Target information for the MAX32630 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -21,15 +21,16 @@ #include "target_config.h" -extern const program_target_t flash; +#include "flash_blob.c" /* ME03 -- MAX32630 2MiB Flash, 512KiB RAM */ target_cfg_t target_device = { - .sector_size = 0x2000, - .sector_cnt = (0x200000 / 0x2000), - .flash_start = 0, - .flash_end = 0x200000, - .ram_start = 0x20000000, - .ram_end = 0x20080000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = 0x200000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20080000, }; diff --git a/source/family/nordic/nrf51822/flash_blob.c b/source/family/nordic/nrf51822/flash_blob.c index 191991b30..37b723964 100644 --- a/source/family/nordic/nrf51822/flash_blob.c +++ b/source/family/nordic/nrf51822/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the nrf51 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -33,6 +33,17 @@ static const uint32_t nRF51822AA_FLM[] = { /*0x0E0*/ 0x0, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 1024}, + }; + static const program_target_t flash = { .init = 0x20000021, .uninit = 0x20000025, diff --git a/source/family/nordic/nrf51822/target_16.c b/source/family/nordic/nrf51822/target_16.c index 0717829ac..eabd3af1c 100644 --- a/source/family/nordic/nrf51822/target_16.c +++ b/source/family/nordic/nrf51822/target_16.c @@ -3,7 +3,7 @@ * @brief Target information for the nrf51 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,12 +26,13 @@ // target information target_cfg_t target_device = { - .sector_size = 1024, - .sector_cnt = (KB(256) / 1024), - .flash_start = 0, - .flash_end = KB(256), - .ram_start = 0x20000000, - .ram_end = 0x20004000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(256), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20004000, .erase_reset = 1, }; diff --git a/source/family/nordic/nrf51822/target_32.c b/source/family/nordic/nrf51822/target_32.c index b291a531e..1b273f715 100644 --- a/source/family/nordic/nrf51822/target_32.c +++ b/source/family/nordic/nrf51822/target_32.c @@ -3,7 +3,7 @@ * @brief Target information for the nrf51 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,12 +26,13 @@ // target information target_cfg_t target_device = { - .sector_size = 1024, - .sector_cnt = (KB(256) / 1024), - .flash_start = 0, - .flash_end = KB(256), - .ram_start = 0x20000000, - .ram_end = 0x20008000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(256), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20008000, .erase_reset = 1, }; diff --git a/source/family/nordic/nrf5x/flash_blob.c b/source/family/nordic/nrf5x/flash_blob.c index e2a7b95fc..1d50b84da 100644 --- a/source/family/nordic/nrf5x/flash_blob.c +++ b/source/family/nordic/nrf5x/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the nrf51 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -44,6 +44,17 @@ static const uint32_t nRF52832AA_FLM[] = { 0x40010404, 0x40010504, 0x6e524635, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 1024}, + }; + static const program_target_t flash = { // Default is nrf51 .init = 0x20000021, .uninit = 0x20000025, @@ -63,6 +74,10 @@ static const program_target_t flash = { // Default is nrf51 .program_buffer_size = 512 // should be USBD_MSC_BlockSize }; +static const sector_info_t sectors_info_nrf52[] = { + {0, 4096}, + }; + static const program_target_t flash_nrf52 = { .init = 0x20000021, .uninit = 0x20000025, diff --git a/source/family/nordic/nrf5x/target.c b/source/family/nordic/nrf5x/target.c index 8575e2fd5..007a1ca0d 100644 --- a/source/family/nordic/nrf5x/target.c +++ b/source/family/nordic/nrf5x/target.c @@ -3,7 +3,7 @@ * @brief Target information for the nrf51 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,56 +26,61 @@ // target information target_cfg_t target_device = { // Default is nRF51 - .sector_size = 1024, - .sector_cnt = (KB(256) / 1024), - .flash_start = 0, - .flash_end = KB(256), - .ram_start = 0x20000000, - .ram_end = 0x20004000, - .flash_algo = (program_target_t *) &flash, - .erase_reset = 1, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(256), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20004000, + .erase_reset = 1, }; target_cfg_t target_device_nrf52 = { - .sector_size = 4096, - .sector_cnt = (KB(512) / 4096), - .flash_start = 0, - .flash_end = KB(512), - .ram_start = 0x20000000, - .ram_end = 0x20008000, - .flash_algo = (program_target_t *) &flash_nrf52, - .erase_reset = 1, + .sectors_info = sectors_info_nrf52, + .sector_info_length = (sizeof(sectors_info_nrf52))/(sizeof(sectors_info_nrf52)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(512), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash_nrf52, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20008000, + .erase_reset = 1, }; target_cfg_t target_device_nrf52840 = { - .sector_size = 4096, - .sector_cnt = (KB(1024) / 4096), - .flash_start = 0, - .flash_end = KB(1024), - .ram_start = 0x20000000, - .ram_end = 0x20008000, - .flash_algo = (program_target_t *) &flash_nrf52, - .erase_reset = 1, + .sectors_info = sectors_info_nrf52, + .sector_info_length = (sizeof(sectors_info_nrf52))/(sizeof(sectors_info_nrf52)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(1024), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash_nrf52, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20008000, + .erase_reset = 1, }; target_cfg_t target_device_nrf52840_256 = { - .sector_size = 4096, - .sector_cnt = (KB(1024) / 4096), - .flash_start = 0, - .flash_end = KB(1024), - .ram_start = 0x20000000, - .ram_end = 0x20040000, - .flash_algo = (program_target_t *) &flash_nrf52, - .erase_reset = 1, + .sectors_info = sectors_info_nrf52, + .sector_info_length = (sizeof(sectors_info_nrf52))/(sizeof(sectors_info_nrf52)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(1024), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash_nrf52, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20040000, + .erase_reset = 1, }; target_cfg_t target_device_nrf52_64 = { - .sector_size = 4096, - .sector_cnt = (KB(512) / 4096), - .flash_start = 0, - .flash_end = KB(512), - .ram_start = 0x20000000, - .ram_end = 0x20010000, - .flash_algo = (program_target_t *) &flash_nrf52, - .erase_reset = 1, + .sectors_info = sectors_info_nrf52, + .sector_info_length = (sizeof(sectors_info_nrf52))/(sizeof(sectors_info_nrf52)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(512), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash_nrf52, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20010000, + .erase_reset = 1, }; diff --git a/source/family/nxp/lpc1114/flash_blob.c b/source/family/nxp/lpc1114/flash_blob.c index f467766f0..d8e0cb83c 100644 --- a/source/family/nxp/lpc1114/flash_blob.c +++ b/source/family/nxp/lpc1114/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the lpc1114 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -34,6 +34,17 @@ static const uint32_t LPC1114_FLM[] = { /*0x120*/ 0x696847b8, 0xd0002800, 0xbdf82001, 0x40048040, 0x00000004, 0x1fff1ff1, 0x00002ee0, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 4096}, + }; + static const program_target_t flash = { 0x10000025, // Init 0x10000047, // UnInit diff --git a/source/family/nxp/lpc1114/target.c b/source/family/nxp/lpc1114/target.c index 8d9b04162..dbb1cecab 100644 --- a/source/family/nxp/lpc1114/target.c +++ b/source/family/nxp/lpc1114/target.c @@ -3,7 +3,7 @@ * @brief Target information for the lpc1114 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 4096, - .sector_cnt = (KB(32) / 4096), - .flash_start = 0, - .flash_end = KB(32), - .ram_start = 0x10000000, - .ram_end = 0x10001000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(32), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x10000000, + .ram_regions[0].end = 0x10001000, }; diff --git a/source/family/nxp/lpc1768/flash_blob.c b/source/family/nxp/lpc1768/flash_blob.c index 2a4c00eb2..7c4921371 100644 --- a/source/family/nxp/lpc1768/flash_blob.c +++ b/source/family/nxp/lpc1768/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the lpc1768 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -38,6 +38,17 @@ static const uint32_t LPC1768_FLM[] = { /*0x180*/ 0x12345678, 0x87654321L, 0x0, 0x0 }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 1024}, + }; + static const program_target_t flash = { 0x1000002f, // init 0x10000051, // uninit diff --git a/source/family/nxp/lpc1768/target.c b/source/family/nxp/lpc1768/target.c index 24f0fb7cf..dcc29406d 100644 --- a/source/family/nxp/lpc1768/target.c +++ b/source/family/nxp/lpc1768/target.c @@ -3,7 +3,7 @@ * @brief Target information for the lpc1768 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 1024, - .sector_cnt = (KB(512) / 1024), - .flash_start = 0, - .flash_end = KB(512), - .ram_start = 0x10000000, - .ram_end = 0x10008000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(512), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x10000000, + .ram_regions[0].end = 0x10008000, }; diff --git a/source/family/nxp/lpc4088/flash_blob.c b/source/family/nxp/lpc4088/flash_blob.c index 6c0ed6118..62b623b25 100644 --- a/source/family/nxp/lpc4088/flash_blob.c +++ b/source/family/nxp/lpc4088/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the lpc4088 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -54,6 +54,17 @@ static const uint32_t lpc4088_flash_prog_blob[] = { 0x00000001, 0x00000000, 0x00000000, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, KB(4)}, + }; + static const program_target_t flash = { 0x200000D5, // Init 0x200001D9, // UnInit diff --git a/source/family/nxp/lpc4088/target_lpc4088dm.c b/source/family/nxp/lpc4088/target_lpc4088dm.c index a87281394..4d7ce909e 100644 --- a/source/family/nxp/lpc4088/target_lpc4088dm.c +++ b/source/family/nxp/lpc4088/target_lpc4088dm.c @@ -3,7 +3,7 @@ * @brief Target information for the lpc4088 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // The LPC4088 Display Module has 512K internal flash and 16M external QSPI flash target_cfg_t target_device = { - .sector_size = KB(4), - .sector_cnt = ((MB(16) + KB(512)) / KB(4)), - .flash_start = 0, - .flash_end = MB(16) + KB(512), - .ram_start = 0x10000000, - .ram_end = 0x10010000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = MB(16) + KB(512), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x10000000, + .ram_regions[0].end = 0x10010000, }; diff --git a/source/family/nxp/lpc4088/target_lpc4088qsb.c b/source/family/nxp/lpc4088/target_lpc4088qsb.c index d4e565682..ef2f6ecfa 100644 --- a/source/family/nxp/lpc4088/target_lpc4088qsb.c +++ b/source/family/nxp/lpc4088/target_lpc4088qsb.c @@ -3,7 +3,7 @@ * @brief Target information for the lpc4088 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // The LPC4088 QuickStart Board has 512K internal flash and 8M external QSPI flash target_cfg_t target_device = { - .sector_size = KB(4), - .sector_cnt = ((MB(8) + KB(512)) / KB(4)), - .flash_start = 0, - .flash_end = MB(8) + KB(512), - .ram_start = 0x10000000, - .ram_end = 0x10010000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = MB(8) + KB(512), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x10000000, + .ram_regions[0].end = 0x10010000, }; diff --git a/source/family/nxp/lpc54018/flash_blob.c b/source/family/nxp/lpc54018/flash_blob.c index b7b4277c4..0c984c2ef 100644 --- a/source/family/nxp/lpc54018/flash_blob.c +++ b/source/family/nxp/lpc54018/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,14 +67,14 @@ static const uint32_t flash_start = 0x10000000; static const uint32_t flash_size = 0x01000000; /** -* List of start and size for each size of flash sector - even indexes are start, odd are size +* List of start and size for each size of flash sector * The size will apply to all sectors between the listed address and the next address * in the list. * The last pair in the list will have sectors starting at that address and ending -* at address flash_start + flash_size. +* at address start + size. */ -static const uint32_t sectors_info[] = { - 0x10000000, 0x00001000, +static const sector_info_t sectors_info[] = { + {0x10000000, 0x00001000}, }; static const program_target_t flash = { diff --git a/source/family/nxp/lpc54018/target.c b/source/family/nxp/lpc54018/target.c index 142f7d585..d4b01ac17 100644 --- a/source/family/nxp/lpc54018/target.c +++ b/source/family/nxp/lpc54018/target.c @@ -3,7 +3,7 @@ * @brief Target information for the lpc54018 * * DAPLink Interface Firmware - * Copyright (c) 2018, ARM Limited, All Rights Reserved + * Copyright (c) 2018-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 4096, - .sector_cnt = (MB(16) / 4096), - .flash_start = 0x10000000, - .flash_end = 0x11000000, - .ram_start = 0x00000000, - .ram_end = 0x00030000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x10000000, + .flash_regions[0].end = 0x11000000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x00000000, + .ram_regions[0].end = 0x00030000, }; diff --git a/source/family/nxp/lpc54114/flash_blob.c b/source/family/nxp/lpc54114/flash_blob.c index feebb582f..46fcbeff4 100644 --- a/source/family/nxp/lpc54114/flash_blob.c +++ b/source/family/nxp/lpc54114/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,17 @@ static const uint32_t lpc54114_flash_prog_blob[] = { 0x00000000 }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 32768}, +}; + static const program_target_t flash = { 0x20000021, // Init 0x20000053, // UnInit diff --git a/source/family/nxp/lpc54114/target.c b/source/family/nxp/lpc54114/target.c index 6871874ee..e26f366d5 100644 --- a/source/family/nxp/lpc54114/target.c +++ b/source/family/nxp/lpc54114/target.c @@ -3,7 +3,7 @@ * @brief Target information for the lpc812 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 32768, - .sector_cnt = (KB(256) / 32768), - .flash_start = 0, - .flash_end = KB(256), - .ram_start = 0x20000000, - .ram_end = 0x20028000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(256), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20028000, }; diff --git a/source/family/nxp/lpc54608/flash_blob.c b/source/family/nxp/lpc54608/flash_blob.c index 633021c4d..dd0b7ac7b 100644 --- a/source/family/nxp/lpc54608/flash_blob.c +++ b/source/family/nxp/lpc54608/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,14 +39,14 @@ static const uint32_t flash_start = 0x00000000; static const uint32_t flash_size = 0x00080000; /** -* List of start and size for each size of flash sector - even indexes are start, odd are size +* List of start and size for each size of flash sector * The size will apply to all sectors between the listed address and the next address * in the list. * The last pair in the list will have sectors starting at that address and ending -* at address flash_start + flash_size. +* at address start + size. */ -static const uint32_t sectors_info[] = { - 0x00000000, 0x00008000, +static const sector_info_t sectors_info[] = { + {0x00000000, 0x00008000}, }; static const program_target_t flash = { diff --git a/source/family/nxp/lpc54608/target.c b/source/family/nxp/lpc54608/target.c index 2afe597f5..bbe9e222a 100644 --- a/source/family/nxp/lpc54608/target.c +++ b/source/family/nxp/lpc54608/target.c @@ -3,7 +3,7 @@ * @brief Target information for the lpc54608 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 32768, - .sector_cnt = (KB(512) / 32768), - .flash_start = 0, - .flash_end = KB(512), - .ram_start = 0x20000000, - .ram_end = 0x20028000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(512), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20028000, }; diff --git a/source/family/nxp/lpc55S6X/flash_blob.c b/source/family/nxp/lpc55S6X/flash_blob.c index a4ad7d322..86899b3e3 100644 --- a/source/family/nxp/lpc55S6X/flash_blob.c +++ b/source/family/nxp/lpc55S6X/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,14 +69,14 @@ static const uint32_t flash_start = 0x00000000; static const uint32_t flash_size = 0x00098000; /** -* List of start and size for each size of flash sector - even indexes are start, odd are size +* List of start and size for each size of flash sector * The size will apply to all sectors between the listed address and the next address * in the list. * The last pair in the list will have sectors starting at that address and ending -* at address flash_start + flash_size. +* at address start + size. */ -static const uint32_t sectors_info[] = { - 0x00000000, 0x00008000, +static const sector_info_t sectors_info[] = { + {0x00000000, 0x00008000}, }; static const program_target_t flash = { diff --git a/source/family/nxp/lpc55S6X/target.c b/source/family/nxp/lpc55S6X/target.c index cb88a8c19..cee0db0fe 100644 --- a/source/family/nxp/lpc55S6X/target.c +++ b/source/family/nxp/lpc55S6X/target.c @@ -3,7 +3,7 @@ * @brief Target information for the lpc55S6X * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,16 +26,17 @@ // target information target_cfg_t target_device = { - .sector_size = 32768, - .sector_cnt = (KB(608) / 32768), - .flash_start = 0, - .flash_end = KB(608), - .ram_start = 0x20000000, - .ram_end = 0x20044000, - .flash_algo = (program_target_t *) &flash, - .extra_flash[0].start = 0x10000000, - .extra_flash[0].end = 0x10000000 + KB(608), - .extra_flash[0].flash_algo = (program_target_t *) &flash, //each extra flash region requires a flash algo - .extra_ram[0].start = 0x30000000, - .extra_ram[0].end = 0x30000000 + 0x00044000, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(608), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .flash_regions[1].start = 0x10000000, + .flash_regions[1].end = 0x10000000 + KB(608), + .flash_regions[1].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20044000, + .ram_regions[1].start = 0x30000000, + .ram_regions[1].end = 0x30000000 + 0x00044000, }; diff --git a/source/family/nxp/lpc812/flash_blob.c b/source/family/nxp/lpc812/flash_blob.c index 1a07b20d3..be1c15e92 100644 --- a/source/family/nxp/lpc812/flash_blob.c +++ b/source/family/nxp/lpc812/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the lpc812 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -37,6 +37,17 @@ static const uint32_t LPC812_FLM[] = { /* 0x140 */ 0x4, 0x40048040, 0x8, 0x1fff1ff1 }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x00000000, 0x1000}, +}; + static const program_target_t flash = { 0x10000025, // init 0x10000049, // uninit diff --git a/source/family/nxp/lpc812/target.c b/source/family/nxp/lpc812/target.c index d6623ec78..21a41d764 100644 --- a/source/family/nxp/lpc812/target.c +++ b/source/family/nxp/lpc812/target.c @@ -3,7 +3,7 @@ * @brief Target information for the lpc812 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 0x1000, - .sector_cnt = (KB(64) / 0x1000), - .flash_start = 0, - .flash_end = KB(64), - .ram_start = 0x10000000, - .ram_end = 0x10001000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(64), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x10000000, + .ram_regions[0].end = 0x10001000, }; diff --git a/source/family/nxp/lpc824/flash_blob.c b/source/family/nxp/lpc824/flash_blob.c index 39e10bd9e..51777484f 100644 --- a/source/family/nxp/lpc824/flash_blob.c +++ b/source/family/nxp/lpc824/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the lpc824 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -36,6 +36,17 @@ static const uint32_t LPC824_FLM[] = { /*0x140*/ }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 1024}, +}; + static const program_target_t flash = { 0x10000025, // Init 0x10000047, // UnInit diff --git a/source/family/nxp/lpc824/target.c b/source/family/nxp/lpc824/target.c index cc16b186b..e0acd0a29 100644 --- a/source/family/nxp/lpc824/target.c +++ b/source/family/nxp/lpc824/target.c @@ -3,7 +3,7 @@ * @brief Target information for the lpc824 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 1024, - .sector_cnt = (KB(32) / 1024), - .flash_start = 0, - .flash_end = KB(32), - .ram_start = 0x10000000, - .ram_end = 0x10002000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = KB(32), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x10000000, + .ram_regions[0].end = 0x10002000, }; diff --git a/source/family/onsemi/ncs36510/flash_blob.c b/source/family/onsemi/ncs36510/flash_blob.c index 96bfd5b3e..440402244 100644 --- a/source/family/onsemi/ncs36510/flash_blob.c +++ b/source/family/onsemi/ncs36510/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,6 +47,17 @@ static const uint32_t ncs36510_flash_prog_blob[] = { 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x00002000, 0x800}, +}; + static const program_target_t flash = { 0x3fff4259, // Init 0x3fff4299, // UnInit diff --git a/source/family/onsemi/ncs36510/target.c b/source/family/onsemi/ncs36510/target.c index cc92db6cb..e14b9c624 100644 --- a/source/family/onsemi/ncs36510/target.c +++ b/source/family/onsemi/ncs36510/target.c @@ -21,14 +21,12 @@ // target information target_cfg_t target_device = { - .sector_size = 0x800, - // Assume memory is regions are same size. Flash algo should ignore requests - // when variable sized sectors exist - // .sector_cnt = ((.flash_end - .flash_start) / .sector_size); - .sector_cnt = 0x0000002A0, - .flash_start = 0x00002000, - .flash_end = 0x00151FFF, - .ram_start = 0x3FFF4000, - .ram_end = 0x3FFFFFFF, - .flash_algo = (program_target_t*)&flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x00002000, + .flash_regions[0].end = 0x00151FFF, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x3FFF4000, + .ram_regions[0].end = 0x3FFFFFFF, }; diff --git a/source/family/realtek/rtl8195am/flash_blob.c b/source/family/realtek/rtl8195am/flash_blob.c index 5599cf081..e5a3fac57 100644 --- a/source/family/realtek/rtl8195am/flash_blob.c +++ b/source/family/realtek/rtl8195am/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,6 +63,17 @@ static const uint32_t rtl8195am_flash_prog_blob[] = { 0x00000000, 0x00000000, 0x005e0101, 0x00000101, 0x00230201, 0x00050501 }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, KB(4)}, +}; + static const program_target_t flash = { 0x10007237, // Init 0x10007353, // UnInit diff --git a/source/family/realtek/rtl8195am/target.c b/source/family/realtek/rtl8195am/target.c index 585d4cf00..845fd160c 100644 --- a/source/family/realtek/rtl8195am/target.c +++ b/source/family/realtek/rtl8195am/target.c @@ -3,7 +3,7 @@ * @brief Target information for Realtek RTL8195AM * * DAPLink Interface Firmware - * Copyright (c) 2016-2017, Realtek Semiconductor Corp., All Rights Reserved + * Copyright (c) 2016-2019, Realtek Semiconductor Corp., All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,14 +26,14 @@ // target information target_cfg_t target_device = { - .sector_size = KB(4), - .sector_cnt = MB(2) / KB(4), - .flash_start = 0x00000000, - .flash_end = 0x00000000 + MB(2), - .ram_start = 0x10007000, - .ram_end = 0x10070000, - .flash_algo = (program_target_t *) &flash, - .erase_reset = 0, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x00000000, + .flash_regions[0].end = 0x00000000 + MB(2), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x10007000, + .ram_regions[0].end = 0x10070000, }; // RTL8195AM's main cpu can only talk 38400 with DAP UART diff --git a/source/family/renesas/rza1h/gr-peach/flash_blob.c b/source/family/renesas/rza1h/gr-peach/flash_blob.c index 44de2eb23..844e91c1d 100644 --- a/source/family/renesas/rza1h/gr-peach/flash_blob.c +++ b/source/family/renesas/rza1h/gr-peach/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,14 +80,14 @@ static const uint32_t flash_start = 0x18000000; static const uint32_t flash_size = 0x00800000; /** -* List of start and size for each size of flash sector - even indexes are start, odd are size +* List of start and size for each size of flash sector * The size will apply to all sectors between the listed address and the next address * in the list. * The last pair in the list will have sectors starting at that address and ending -* at address flash_start + flash_size. +* at address start + size. */ -static const uint32_t sectors_info[] = { - 0x18000000, 0x00001000, +static const sector_info_t sectors_info[] = { + {0, KB(4)}, }; static const program_target_t flash = { diff --git a/source/family/renesas/rza1h/gr-peach/target.c b/source/family/renesas/rza1h/gr-peach/target.c index cd0b4c5ec..9ef6c4a6f 100644 --- a/source/family/renesas/rza1h/gr-peach/target.c +++ b/source/family/renesas/rza1h/gr-peach/target.c @@ -3,7 +3,7 @@ * @brief Target information for the GR-PEACH * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = KB(4), - .sector_cnt = (MB(8) / KB(4)), - .flash_start = 0, - .flash_end = MB(8), - .ram_start = 0x20000000, - .ram_end = 0x20A00000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = MB(8), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20A00000, }; diff --git a/source/family/renesas/rza1lu/gr-lychee/flash_blob.c b/source/family/renesas/rza1lu/gr-lychee/flash_blob.c index ced2e23de..3acb302d7 100644 --- a/source/family/renesas/rza1lu/gr-lychee/flash_blob.c +++ b/source/family/renesas/rza1lu/gr-lychee/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,14 +83,14 @@ static const uint32_t flash_start = 0x18000000; static const uint32_t flash_size = 0x00800000; /** -* List of start and size for each size of flash sector - even indexes are start, odd are size +* List of start and size for each size of flash sector * The size will apply to all sectors between the listed address and the next address * in the list. * The last pair in the list will have sectors starting at that address and ending -* at address flash_start + flash_size. +* at address start + size. */ -static const uint32_t sectors_info[] = { - 0x18000000, 0x00001000, +static const sector_info_t sectors_info[] = { + {0, KB(4)}, }; static const program_target_t flash = { diff --git a/source/family/renesas/rza1lu/gr-lychee/target.c b/source/family/renesas/rza1lu/gr-lychee/target.c index 7e401a2ee..1377a6955 100644 --- a/source/family/renesas/rza1lu/gr-lychee/target.c +++ b/source/family/renesas/rza1lu/gr-lychee/target.c @@ -3,7 +3,7 @@ * @brief Target information for the GR-LYCHEE * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = KB(4), - .sector_cnt = (MB(8) / KB(4)), - .flash_start = 0, - .flash_end = MB(8), - .ram_start = 0x20000000, - .ram_end = 0x20300000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = MB(8), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20300000, }; diff --git a/source/family/siliconlabs/efm32gg/flash_blob.c b/source/family/siliconlabs/efm32gg/flash_blob.c index b00977c06..1da2c4d2c 100644 --- a/source/family/siliconlabs/efm32gg/flash_blob.c +++ b/source/family/siliconlabs/efm32gg/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the efm32gg * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -46,6 +46,17 @@ static const uint32_t efm32gg_flash_prog_blob[] = { 0x0105f021, 0x20006081, 0x00004770, 0x400c0000, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 4096}, +}; + static const program_target_t flash = { 0x200000B5, // Init 0x2000029D, // UnInit diff --git a/source/family/siliconlabs/efm32gg/target.c b/source/family/siliconlabs/efm32gg/target.c index d3c4840d8..3304f6ef0 100644 --- a/source/family/siliconlabs/efm32gg/target.c +++ b/source/family/siliconlabs/efm32gg/target.c @@ -3,7 +3,7 @@ * @brief Target information for the efm32gg * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 4096, - .sector_cnt = (MB(1) / 4096), - .flash_start = 0, - .flash_end = MB(1), - .ram_start = 0x20000000, - .ram_end = 0x20010000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = MB(1), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20010000, }; diff --git a/source/family/st/nz32_sc151/flash_blob.c b/source/family/st/nz32_sc151/flash_blob.c index 7c69da291..2aac74eac 100644 --- a/source/family/st/nz32_sc151/flash_blob.c +++ b/source/family/st/nz32_sc151/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2017 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,6 +41,17 @@ static const uint32_t stm32l1xx_256_flash_prog_blob[] = { 0x40023c04, 0x40023c10, 0x08040000, 0x00000000 }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x08000000, 256}, +}; + static const program_target_t flash = { 0x20000021, // Init 0x2000006d, // UnInit diff --git a/source/family/st/nz32_sc151/target.c b/source/family/st/nz32_sc151/target.c index 5a2452f5e..310d0b28d 100644 --- a/source/family/st/nz32_sc151/target.c +++ b/source/family/st/nz32_sc151/target.c @@ -3,7 +3,7 @@ * @brief Target information for the stm32l151 * * DAPLink Interface Firmware - * Copyright (c) 2009-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 256, - .sector_cnt = KB(1), - .flash_start = 0x08000000, - .flash_end = 0x08000000 + KB(256), - .ram_start = 0x20000000, - .ram_end = 0x20000000 + KB(32), - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08000000 + KB(256), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20000000 + KB(32), }; diff --git a/source/family/st/stm32f072rb/flash_blob.c b/source/family/st/stm32f072rb/flash_blob.c index 6a5cd3d4c..0e1fc5051 100644 --- a/source/family/st/stm32f072rb/flash_blob.c +++ b/source/family/st/stm32f072rb/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,17 @@ static const uint32_t STM32F072RB_flash_prog_blob[] = { 0xcdef89ab, 0x00005555, 0x40003000, 0x00000fff, 0x0000aaaa, 0x00000000 }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x08000000, 0x400}, +}; + static const program_target_t flash = { 0x20000021, // Init 0x2000004f, // UnInit diff --git a/source/family/st/stm32f072rb/target.c b/source/family/st/stm32f072rb/target.c index b48640694..bfa98cb48 100644 --- a/source/family/st/stm32f072rb/target.c +++ b/source/family/st/stm32f072rb/target.c @@ -3,7 +3,7 @@ * @brief Target information for the * * DAPLink Interface Firmware - * Copyright (c) 2017-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2017-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 0x400, - .sector_cnt = (0x20000 / 0x400), - .flash_start = 0x08000000, - .flash_end = 0x08020000, - .ram_start = 0x20000000, - .ram_end = 0x20004000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08020000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20004000, }; diff --git a/source/family/st/stm32f103rb/flash_blob.c b/source/family/st/stm32f103rb/flash_blob.c index 55b2a1558..2f83aad82 100644 --- a/source/family/st/stm32f103rb/flash_blob.c +++ b/source/family/st/stm32f103rb/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,17 @@ static const uint32_t STM32F103RB_flash_prog_blob[] = { 0xcdef89ab, 0x40003000, 0x00000000 }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x08000000, 0x400}, +}; + static const program_target_t flash = { 0x20000021, // Init 0x20000053, // UnInit diff --git a/source/family/st/stm32f103rb/target.c b/source/family/st/stm32f103rb/target.c index 1c0b02354..d1b3bba10 100644 --- a/source/family/st/stm32f103rb/target.c +++ b/source/family/st/stm32f103rb/target.c @@ -3,7 +3,7 @@ * @brief Target information for the * * DAPLink Interface Firmware - * Copyright (c) 2017-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2017-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 0x400, - .sector_cnt = (0x20000 / 0x400), - .flash_start = 0x08000000, - .flash_end = 0x08020000, - .ram_start = 0x20000000, - .ram_end = 0x20005000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08020000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20005000, }; diff --git a/source/family/st/stm32f207zg/flash_blob.c b/source/family/st/stm32f207zg/flash_blob.c index 580281795..cd3ec68d8 100644 --- a/source/family/st/stm32f207zg/flash_blob.c +++ b/source/family/st/stm32f207zg/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,17 @@ static const uint32_t STM32F207ZG_flash_prog_blob[] = { 0x00000201, 0x00000000 }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x08000000, 0x4000}, +}; + static const program_target_t flash = { 0x2000003d, // Init 0x2000006b, // UnInit diff --git a/source/family/st/stm32f207zg/target.c b/source/family/st/stm32f207zg/target.c index 80f7499e2..ce076e435 100644 --- a/source/family/st/stm32f207zg/target.c +++ b/source/family/st/stm32f207zg/target.c @@ -3,7 +3,7 @@ * @brief Target information for the * * DAPLink Interface Firmware - * Copyright (c) 2017-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2017-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 0x4000, - .sector_cnt = (0x100000 / 0x4000), - .flash_start = 0x08000000, - .flash_end = 0x08100000, - .ram_start = 0x20000000, - .ram_end = 0x20020000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08100000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20020000, }; diff --git a/source/family/st/stm32f334r8/flash_blob.c b/source/family/st/stm32f334r8/flash_blob.c index d20e7b65c..09b768972 100644 --- a/source/family/st/stm32f334r8/flash_blob.c +++ b/source/family/st/stm32f334r8/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,17 @@ static const uint32_t STM32F334R8_flash_prog_blob[] = { 0x40022000, 0xcdef89ab, 0x00005555, 0x40003000, 0x00000fff, 0x0000aaaa, 0x00000000 }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x08000000, 0x800}, +}; + static const program_target_t flash = { 0x20000021, // Init 0x2000004f, // UnInit diff --git a/source/family/st/stm32f334r8/target.c b/source/family/st/stm32f334r8/target.c index 185a2c0a5..858ed83b4 100644 --- a/source/family/st/stm32f334r8/target.c +++ b/source/family/st/stm32f334r8/target.c @@ -3,7 +3,7 @@ * @brief Target information for the * * DAPLink Interface Firmware - * Copyright (c) 2017-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2017-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 0x800, - .sector_cnt = (0x10000 / 0x800), - .flash_start = 0x08000000, - .flash_end = 0x08010000, - .ram_start = 0x20000000, - .ram_end = 0x20003000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08010000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20003000, }; diff --git a/source/family/st/stm32f401re/flash_blob.c b/source/family/st/stm32f401re/flash_blob.c index eda188cf9..3c7a4743f 100644 --- a/source/family/st/stm32f401re/flash_blob.c +++ b/source/family/st/stm32f401re/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,17 @@ static const uint32_t STM32F401RE_flash_prog_blob[] = { 0x00000fff, 0x0000aaaa, 0x00000201, 0x00000000 }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x08000000, 0x4000}, +}; + static const program_target_t flash = { 0x20000047, // Init 0x20000075, // UnInit diff --git a/source/family/st/stm32f401re/target.c b/source/family/st/stm32f401re/target.c index 212aac5b9..3d4d35c8e 100644 --- a/source/family/st/stm32f401re/target.c +++ b/source/family/st/stm32f401re/target.c @@ -3,7 +3,7 @@ * @brief Target information for the * * DAPLink Interface Firmware - * Copyright (c) 2017-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2017-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 0x4000, - .sector_cnt = (0x80000 / 0x4000), - .flash_start = 0x08000000, - .flash_end = 0x08080000, - .ram_start = 0x20000000, - .ram_end = 0x20018000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08080000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20018000, }; diff --git a/source/family/st/stm32f407/flash_blob.c b/source/family/st/stm32f407/flash_blob.c index 9aa7c3072..246e90c68 100644 --- a/source/family/st/stm32f407/flash_blob.c +++ b/source/family/st/stm32f407/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the stm32f407 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -38,6 +38,17 @@ static const uint32_t STM32F407_FLM[] = { /*0x160*/ 0x201, 0x0, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x08000000, 1024}, +}; + static const program_target_t flash = { 0x2000003D, // Init 0x2000006B, // UnInit diff --git a/source/family/st/stm32f407/target.c b/source/family/st/stm32f407/target.c index a7f853a69..c526e8f88 100644 --- a/source/family/st/stm32f407/target.c +++ b/source/family/st/stm32f407/target.c @@ -3,7 +3,7 @@ * @brief Target information for the stm32f407 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 1024, - .sector_cnt = (0x100000 / 1024), - .flash_start = 0x08000000, - .flash_end = 0x08100000, - .ram_start = 0x20000000, - .ram_end = 0x20020000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08100000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20020000, }; diff --git a/source/family/st/stm32f411/flash_blob.c b/source/family/st/stm32f411/flash_blob.c index 5d7ebd443..849993612 100644 --- a/source/family/st/stm32f411/flash_blob.c +++ b/source/family/st/stm32f411/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the stm32f411 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -36,6 +36,17 @@ static const uint32_t output_flash_prog_blob[] = { 0x00000fff, 0x0000aaaa, 0x00000201, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x08000000, KB(16)}, +}; + static const program_target_t flash = { 0x20000047, // Init 0x20000075, // UnInit diff --git a/source/family/st/stm32f411/target.c b/source/family/st/stm32f411/target.c index 1243e5778..ed2f9fd1a 100644 --- a/source/family/st/stm32f411/target.c +++ b/source/family/st/stm32f411/target.c @@ -3,7 +3,7 @@ * @brief Target information for the stm32f411 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = KB(16), - .sector_cnt = 32, - .flash_start = 0x08000000, - .flash_end = 0x08000000 + KB(512), - .ram_start = 0x20000000, - .ram_end = 0x20020000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08000000 + KB(512), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20020000, }; diff --git a/source/family/st/stm32f412re/flash_blob.c b/source/family/st/stm32f412re/flash_blob.c index ae0953c71..68bf4b815 100644 --- a/source/family/st/stm32f412re/flash_blob.c +++ b/source/family/st/stm32f412re/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/source/family/st/stm32f412re/target.c b/source/family/st/stm32f412re/target.c index de53c7dd4..9416b2f80 100644 --- a/source/family/st/stm32f412re/target.c +++ b/source/family/st/stm32f412re/target.c @@ -3,7 +3,7 @@ * @brief Target information for the stm32f412re * * DAPLink Interface Firmware - * Copyright (c) 2017-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2017-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .flash_start = 0x08000000, - .flash_end = 0x08080000, - .ram_start = 0x20000000, - .ram_end = 0x20040000, - .flash_algo = (program_target_t *) &flash, - .sectors_info = sectors_info, - .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)) + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08080000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20040000, }; diff --git a/source/family/st/stm32f412rg/flash_blob.c b/source/family/st/stm32f412rg/flash_blob.c index cd8e71a77..a1a10c85d 100644 --- a/source/family/st/stm32f412rg/flash_blob.c +++ b/source/family/st/stm32f412rg/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/source/family/st/stm32f412rg/target.c b/source/family/st/stm32f412rg/target.c index fb0efbffd..646d29fd3 100644 --- a/source/family/st/stm32f412rg/target.c +++ b/source/family/st/stm32f412rg/target.c @@ -3,7 +3,7 @@ * @brief Target information for the stm32f412rg * * DAPLink Interface Firmware - * Copyright (c) 2017-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2017-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .flash_start = 0x08000000, - .flash_end = 0x08100000, - .ram_start = 0x20000000, - .ram_end = 0x20040000, - .flash_algo = (program_target_t *) &flash, - .sectors_info = sectors_info, - .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)) + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08100000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20040000, }; diff --git a/source/family/st/stm32f429zi/flash_blob.c b/source/family/st/stm32f429zi/flash_blob.c index 955a73b19..fa9bd4702 100644 --- a/source/family/st/stm32f429zi/flash_blob.c +++ b/source/family/st/stm32f429zi/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/source/family/st/stm32f429zi/target.c b/source/family/st/stm32f429zi/target.c index f8b0e9a2c..5f165fedd 100644 --- a/source/family/st/stm32f429zi/target.c +++ b/source/family/st/stm32f429zi/target.c @@ -3,7 +3,7 @@ * @brief Target information for the * * DAPLink Interface Firmware - * Copyright (c) 2017-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2017-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .flash_start = 0x08000000, - .flash_end = 0x08200000, - .ram_start = 0x20000000, - .ram_end = 0x20030000, - .flash_algo = (program_target_t *) &flash, - .sectors_info = sectors_info, - .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)) + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08200000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20030000, }; diff --git a/source/family/st/stm32f437vg/flash_blob.c b/source/family/st/stm32f437vg/flash_blob.c index c31ef0f68..4d303dfe7 100644 --- a/source/family/st/stm32f437vg/flash_blob.c +++ b/source/family/st/stm32f437vg/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,17 @@ static const uint32_t STM32F437VG_flash_prog_blob[] = { 0x00000201, 0x00000000 }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x08000000, 0x4000}, +}; + static const program_target_t flash = { 0x2000003d, // Init 0x2000006b, // UnInit diff --git a/source/family/st/stm32f437vg/target.c b/source/family/st/stm32f437vg/target.c index 7e1d5757f..ad1401579 100644 --- a/source/family/st/stm32f437vg/target.c +++ b/source/family/st/stm32f437vg/target.c @@ -3,7 +3,7 @@ * @brief Target information for the * * DAPLink Interface Firmware - * Copyright (c) 2017-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2017-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 0x4000, - .sector_cnt = (0x100000 / 0x4000), - .flash_start = 0x08000000, - .flash_end = 0x08100000, - .ram_start = 0x20000000, - .ram_end = 0x20030000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08100000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20030000, }; diff --git a/source/family/st/stm32f439zi/flash_blob.c b/source/family/st/stm32f439zi/flash_blob.c index e03e4c5d0..e5767ffb8 100644 --- a/source/family/st/stm32f439zi/flash_blob.c +++ b/source/family/st/stm32f439zi/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/source/family/st/stm32f439zi/target.c b/source/family/st/stm32f439zi/target.c index f8b0e9a2c..5f165fedd 100644 --- a/source/family/st/stm32f439zi/target.c +++ b/source/family/st/stm32f439zi/target.c @@ -3,7 +3,7 @@ * @brief Target information for the * * DAPLink Interface Firmware - * Copyright (c) 2017-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2017-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .flash_start = 0x08000000, - .flash_end = 0x08200000, - .ram_start = 0x20000000, - .ram_end = 0x20030000, - .flash_algo = (program_target_t *) &flash, - .sectors_info = sectors_info, - .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)) + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08200000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20030000, }; diff --git a/source/family/st/stm32f746zg/flash_blob.c b/source/family/st/stm32f746zg/flash_blob.c index 5e64efcc8..9fce82abf 100644 --- a/source/family/st/stm32f746zg/flash_blob.c +++ b/source/family/st/stm32f746zg/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,17 @@ static const uint32_t STM32F746ZG_flash_prog_blob[] = { 0xcdef89ab, 0x00005555, 0x40003000, 0x00000fff, 0x0000aaaa, 0x00000201, 0x00000000 }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x08000000, 0x8000}, +}; + static const program_target_t flash = { 0x20000039, // Init 0x20000067, // UnInit diff --git a/source/family/st/stm32f746zg/target.c b/source/family/st/stm32f746zg/target.c index 11335fc23..8e642ac33 100644 --- a/source/family/st/stm32f746zg/target.c +++ b/source/family/st/stm32f746zg/target.c @@ -3,7 +3,7 @@ * @brief Target information for the * * DAPLink Interface Firmware - * Copyright (c) 2017-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2017-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 0x8000, - .sector_cnt = (0x100000 / 0x8000), - .flash_start = 0x08000000, - .flash_end = 0x08100000, - .ram_start = 0x20000000, - .ram_end = 0x20000000 + 0x50000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08100000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20000000 + 0x50000, }; diff --git a/source/family/st/stm32l082cz/flash_blob.c b/source/family/st/stm32l082cz/flash_blob.c index d42669844..8adb8a925 100644 --- a/source/family/st/stm32l082cz/flash_blob.c +++ b/source/family/st/stm32l082cz/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,14 +38,14 @@ static const uint32_t flash_start = 0x08000000; static const uint32_t flash_size = 0x00030000; /** -* List of start and size for each size of flash sector - even indexes are start, odd are size +* List of start and size for each size of flash sector * The size will apply to all sectors between the listed address and the next address * in the list. * The last pair in the list will have sectors starting at that address and ending -* at address flash_start + flash_size. +* at address start + size. */ -static const uint32_t sectors_info[] = { - 0x08000000, 0x00000080, +static const sector_info_t sectors_info[] = { + {0x08000000, 0x00000080}, }; static const program_target_t flash = { diff --git a/source/family/st/stm32l082cz/target.c b/source/family/st/stm32l082cz/target.c index b071eb49a..b6bdba721 100644 --- a/source/family/st/stm32l082cz/target.c +++ b/source/family/st/stm32l082cz/target.c @@ -3,7 +3,7 @@ * @brief Target information for the stm32l082cz * * DAPLink Interface Firmware - * Copyright (c) 2017-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2017-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 0x80, - .sector_cnt = (0x30000 / 0x80), - .flash_start = 0x08000000, - .flash_end = 0x08030000, - .ram_start = 0x20000000, - .ram_end = 0x20005000, - .flash_algo = (program_target_t *) &flash + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08030000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20005000, }; diff --git a/source/family/st/stm32l151cbxxa/flash_blob.c b/source/family/st/stm32l151cbxxa/flash_blob.c index a8922cf84..719b592b5 100644 --- a/source/family/st/stm32l151cbxxa/flash_blob.c +++ b/source/family/st/stm32l151cbxxa/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,14 +40,14 @@ static const uint32_t flash_start = 0x08000000; static const uint32_t flash_size = 0x00020000; /** -* List of start and size for each size of flash sector - even indexes are start, odd are size +* List of start and size for each size of flash sector * The size will apply to all sectors between the listed address and the next address * in the list. * The last pair in the list will have sectors starting at that address and ending -* at address flash_start + flash_size. +* at address start + size. */ -static const uint32_t sectors_info[] = { - 0x08000000, 0x00000100, +static const sector_info_t sectors_info[] = { + {0x08000000, 0x00000100}, }; static const program_target_t flash = { diff --git a/source/family/st/stm32l151cbxxa/target.c b/source/family/st/stm32l151cbxxa/target.c index 48bc72375..1da0c81e3 100644 --- a/source/family/st/stm32l151cbxxa/target.c +++ b/source/family/st/stm32l151cbxxa/target.c @@ -3,7 +3,7 @@ * @brief Target information for the stm32l151cbxxa * * DAPLink Interface Firmware - * Copyright (c) 2018-2018, ARM Limited, All Rights Reserved + * Copyright (c) 2018-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 256, - .sector_cnt = 512, - .flash_start = 0x08000000, - .flash_end = 0x08000000 + KB(128), - .ram_start = 0x20000000, - .ram_end = 0x20000000 + KB(32), - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08000000 + KB(128), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20000000 + KB(32), }; diff --git a/source/family/st/stm32l443rc/flash_blob.c b/source/family/st/stm32l443rc/flash_blob.c index 998e1c3f0..896501394 100644 --- a/source/family/st/stm32l443rc/flash_blob.c +++ b/source/family/st/stm32l443rc/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,14 +38,14 @@ static const uint32_t flash_start = 0x08000000; static const uint32_t flash_size = 0x00040000; /** -* List of start and size for each size of flash sector - even indexes are start, odd are size +* List of start and size for each size of flash sector * The size will apply to all sectors between the listed address and the next address * in the list. * The last pair in the list will have sectors starting at that address and ending -* at address flash_start + flash_size. +* at address start + size. */ -static const uint32_t sectors_info[] = { - 0x08000000, 0x00000800, +static const sector_info_t sectors_info[] = { + {0x08000000, 0x00000800}, }; static const program_target_t flash = { diff --git a/source/family/st/stm32l443rc/target.c b/source/family/st/stm32l443rc/target.c index ca2209bdc..a98dbccc0 100644 --- a/source/family/st/stm32l443rc/target.c +++ b/source/family/st/stm32l443rc/target.c @@ -3,7 +3,7 @@ * @brief Target information for the stm32l443rc * * DAPLink Interface Firmware - * Copyright (c) 2017-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2017-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 0x800, - .sector_cnt = (0x40000 / 0x800), - .flash_start = 0x08000000, - .flash_end = 0x08040000, - .ram_start = 0x20000000, - .ram_end = 0x2000c000, - .flash_algo = (program_target_t *) &flash + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08040000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x2000c000, }; diff --git a/source/family/st/stm32l476rg/flash_blob.c b/source/family/st/stm32l476rg/flash_blob.c index 6638dcb1e..fb987a663 100644 --- a/source/family/st/stm32l476rg/flash_blob.c +++ b/source/family/st/stm32l476rg/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,17 @@ static const uint32_t STM32L476RG_flash_prog_blob[] = { 0x40003000, 0x00000000 }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x08000000, 0x800}, +}; + static const program_target_t flash = { 0x20000037, // Init 0x20000067, // UnInit diff --git a/source/family/st/stm32l476rg/target.c b/source/family/st/stm32l476rg/target.c index df5aac682..441c48f1e 100644 --- a/source/family/st/stm32l476rg/target.c +++ b/source/family/st/stm32l476rg/target.c @@ -3,7 +3,7 @@ * @brief Target information for the * * DAPLink Interface Firmware - * Copyright (c) 2017-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2017-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 0x800, - .sector_cnt = (0x100000 / 0x800), - .flash_start = 0x08000000, - .flash_end = 0x08100000, - .ram_start = 0x20000000, - .ram_end = 0x20018000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08100000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20018000, }; diff --git a/source/family/st/stm32l486jg/flash_blob.c b/source/family/st/stm32l486jg/flash_blob.c index 75ea53623..646072f3f 100644 --- a/source/family/st/stm32l486jg/flash_blob.c +++ b/source/family/st/stm32l486jg/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,14 +38,14 @@ static const uint32_t flash_start = 0x08000000; static const uint32_t flash_size = 0x00100000; /** -* List of start and size for each size of flash sector - even indexes are start, odd are size +* List of start and size for each size of flash sector * The size will apply to all sectors between the listed address and the next address * in the list. * The last pair in the list will have sectors starting at that address and ending -* at address flash_start + flash_size. +* at address start + size. */ -static const uint32_t sectors_info[] = { - 0x08000000, 0x00000800, +static const sector_info_t sectors_info[] = { + {0x08000000, 0x00000800}, }; static const program_target_t flash = { diff --git a/source/family/st/stm32l486jg/target.c b/source/family/st/stm32l486jg/target.c index 2755e25bd..d84764cd3 100644 --- a/source/family/st/stm32l486jg/target.c +++ b/source/family/st/stm32l486jg/target.c @@ -3,7 +3,7 @@ * @brief Target information for the stm32l486jg * * DAPLink Interface Firmware - * Copyright (c) 2017-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2017-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 0x800, - .sector_cnt = (0x100000 / 0x800), - .flash_start = 0x08000000, - .flash_end = 0x08100000, - .ram_start = 0x20000000, - .ram_end = 0x20018000, - .flash_algo = (program_target_t *) &flash + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08100000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20018000, }; diff --git a/source/family/st/stm32l4xx_1024/flash_blob.c b/source/family/st/stm32l4xx_1024/flash_blob.c index 68cd8adfa..8a1d9c689 100644 --- a/source/family/st/stm32l4xx_1024/flash_blob.c +++ b/source/family/st/stm32l4xx_1024/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,14 +37,14 @@ static const uint32_t flash_start = 0x08000000; static const uint32_t flash_size = 0x00100000; /** -* List of start and size for each size of flash sector - even indexes are start, odd are size +* List of start and size for each size of flash sector * The size will apply to all sectors between the listed address and the next address * in the list. * The last pair in the list will have sectors starting at that address and ending -* at address flash_start + flash_size. +* at address start + size. */ -static const uint32_t sectors_info[] = { - 0x08000000, 0x00000800, +static const sector_info_t sectors_info[] = { + {0x08000000, 0x00000800}, }; static const program_target_t flash = { diff --git a/source/family/st/stm32l4xx_1024/target.c b/source/family/st/stm32l4xx_1024/target.c index 477a2ac79..608277664 100644 --- a/source/family/st/stm32l4xx_1024/target.c +++ b/source/family/st/stm32l4xx_1024/target.c @@ -3,7 +3,7 @@ * @brief Target information for the stm32l486jg * * DAPLink Interface Firmware - * Copyright (c) 2017-2017, ARM Limited, All Rights Reserved + * Copyright (c) 2017-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,12 +26,14 @@ // target information target_cfg_t target_device_stm32l475 = { - .sector_size = 0x800, - .sector_cnt = (0x100000 / 0x800), - .flash_start = 0x08000000, - .flash_end = 0x08100000, - .ram_start = 0x20000000, //SRAM1 start - .ram_end = 0x20000000 + 0x00018000, //SRAM1 end - .flash_algo = (program_target_t *) &flash, - .extra_ram = {{ 0x10000188, 0x10008000 },}, //SRAM2 + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08100000, + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20000000 + 0x00018000, + .ram_regions[1].start = 0x10000188, + .ram_regions[1].end = 0x10008000, }; diff --git a/source/family/st/xDot-L151/flash_blob.c b/source/family/st/xDot-L151/flash_blob.c index 33c70f95e..f4f8e20d6 100644 --- a/source/family/st/xDot-L151/flash_blob.c +++ b/source/family/st/xDot-L151/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +38,17 @@ static const uint32_t stm32l151_flash_prog_blob[] = { 0x13141516, 0x08040000, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x08000000, 256}, +}; + static const program_target_t flash = { 0x20000021, // Init 0x20000037, // UnInit diff --git a/source/family/st/xDot-L151/target.c b/source/family/st/xDot-L151/target.c index 32aaa823c..310d0b28d 100644 --- a/source/family/st/xDot-L151/target.c +++ b/source/family/st/xDot-L151/target.c @@ -3,7 +3,7 @@ * @brief Target information for the stm32l151 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 256, - .sector_cnt = KB(1), - .flash_start = 0x08000000, - .flash_end = 0x08000000 + KB(256), - .ram_start = 0x20000000, - .ram_end = 0x20000000 + KB(32), - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x08000000, + .flash_regions[0].end = 0x08000000 + KB(256), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20000000 + KB(32), }; diff --git a/source/family/ti/cc3220sf/flash_blob.c b/source/family/ti/cc3220sf/flash_blob.c index 207f03350..6272c1c17 100644 --- a/source/family/ti/cc3220sf/flash_blob.c +++ b/source/family/ti/cc3220sf/flash_blob.c @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2018 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,6 +50,17 @@ static const uint32_t flash_start = 0x01000000; // Size of flash static const uint32_t flash_size = 0x00100000; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0x01000000, 2048}, +}; + static const program_target_t flash = { 0x20000027, // Init 0x200001e3, // UnInit diff --git a/source/family/ti/cc3220sf/target.c b/source/family/ti/cc3220sf/target.c index b70ab9389..d7aa1f94d 100644 --- a/source/family/ti/cc3220sf/target.c +++ b/source/family/ti/cc3220sf/target.c @@ -3,7 +3,7 @@ * @brief Target information for the cc3220sf * * DAPLink Interface Firmware - * Copyright (c) 2009-2018, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 2048, - .sector_cnt = (MB(1) / 2048), - .flash_start = 0x01000000, - .flash_end = (0x01000000 + MB(1)), - .ram_start = 0x20000000, - .ram_end = 0x20040000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x01000000, + .flash_regions[0].end = 0x01000000 + MB(1), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20040000, }; diff --git a/source/family/toshiba/tz10xx/target_remap0.c b/source/family/toshiba/tz10xx/target_remap0.c index 046bc7e29..0a0a47fa4 100644 --- a/source/family/toshiba/tz10xx/target_remap0.c +++ b/source/family/toshiba/tz10xx/target_remap0.c @@ -3,7 +3,7 @@ * @brief Target information for the lpc1114 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -27,11 +27,12 @@ // target information target_cfg_t target_device = { - .sector_size = 1024, - .sector_cnt = (MB(1) / 1024), - .flash_start = 0, - .flash_end = MB(1), - .ram_start = 0x20000000, - .ram_end = 0x20008000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0, + .flash_regions[0].end = MB(1), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20008000, }; diff --git a/source/family/toshiba/tz10xx/tz10xx_prog_blob.h b/source/family/toshiba/tz10xx/tz10xx_prog_blob.h index 32e5fe0c4..c85cb40fd 100644 --- a/source/family/toshiba/tz10xx/tz10xx_prog_blob.h +++ b/source/family/toshiba/tz10xx/tz10xx_prog_blob.h @@ -1,5 +1,5 @@ /* Flash OS Routines (Automagically Generated) - * Copyright (c) 2009-2015 ARM Limited + * Copyright (c) 2009-2019 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,6 +45,17 @@ static const uint32_t tz10xx_flash_prog_blob[] = { 0x40004200, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 1024}, +}; + static const program_target_t flash = { 0x2000009F, // Init 0x200000B7, // UnInit diff --git a/source/family/wiznet/w7500/flash_blob.c b/source/family/wiznet/w7500/flash_blob.c index baf43f85e..69c0e385e 100644 --- a/source/family/wiznet/w7500/flash_blob.c +++ b/source/family/wiznet/w7500/flash_blob.c @@ -3,7 +3,7 @@ * @brief Flash algorithm for the W7500 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -30,6 +30,17 @@ static const uint32_t w7500_flash_prog_blob[] = { 0xe000ed00, 0xe000e180, 0xe000e000, 0x1fff1001, 0x00000000, }; +/** +* List of start and size for each size of flash sector +* The size will apply to all sectors between the listed address and the next address +* in the list. +* The last pair in the list will have sectors starting at that address and ending +* at address start + size. +*/ +static const sector_info_t sectors_info[] = { + {0, 256}, +}; + static const program_target_t flash = { 0x20000041, // Init 0x20000045, // UnInit diff --git a/source/family/wiznet/w7500/target.c b/source/family/wiznet/w7500/target.c index c51eb566c..ba8a39b26 100644 --- a/source/family/wiznet/w7500/target.c +++ b/source/family/wiznet/w7500/target.c @@ -3,7 +3,7 @@ * @brief Target information for the W7500 * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -26,11 +26,12 @@ // target information target_cfg_t target_device = { - .sector_size = 256, - .sector_cnt = 512, - .flash_start = 0x00000000, - .flash_end = 0x00000000 + KB(128), - .ram_start = 0x20000000, - .ram_end = 0x20004000, - .flash_algo = (program_target_t *) &flash, + .sectors_info = sectors_info, + .sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)), + .flash_regions[0].start = 0x00000000, + .flash_regions[0].end = 0x00000000 + KB(128), + .flash_regions[0].flags = kRegionIsDefault, + .flash_regions[0].flash_algo = (program_target_t *) &flash, + .ram_regions[0].start = 0x20000000, + .ram_regions[0].end = 0x20004000, }; diff --git a/source/hic_hal/atmel/sam3u2c/flash_hal_SAM3U.c b/source/hic_hal/atmel/sam3u2c/flash_hal_SAM3U.c index 6ed521a64..e247d08b8 100644 --- a/source/hic_hal/atmel/sam3u2c/flash_hal_SAM3U.c +++ b/source/hic_hal/atmel/sam3u2c/flash_hal_SAM3U.c @@ -3,7 +3,7 @@ * @brief * * DAPLink Interface Firmware - * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -147,15 +147,13 @@ uint32_t EraseChip(void) // Return value 0 == O.K. // Return value 1 == Error // Erase complete chip by erasing sector-by-sector - //Addr = target_device.flash_start; - Addr = g_board_info.target_cfg->flash_start; + Addr = g_board_info.target_cfg->flash_regions[0].start; //bootloader, interface flashing only concerns 1 flash region cortex_int_state_t state = cortex_int_get_and_disable(); do { _WritePage(Addr, (volatile uint32_t *)0, 1); Addr += (1 << 8); - //} while (Addr < target_device.flash_end); - } while (Addr < g_board_info.target_cfg->flash_end); + } while (Addr < g_board_info.target_cfg->flash_regions[0].end); cortex_int_restore(state); return (0); // O.K. diff --git a/source/hic_hal/stm32/stm32f103xb/flash.c b/source/hic_hal/stm32/stm32f103xb/flash.c index 79291ee77..2d36acc2d 100644 --- a/source/hic_hal/stm32/stm32f103xb/flash.c +++ b/source/hic_hal/stm32/stm32f103xb/flash.c @@ -62,13 +62,13 @@ uint32_t EraseChip(void) uint32_t ret = 0; // O.K. if (g_board_info.target_cfg) { HAL_FLASH_Unlock(); - - util_assert((g_board_info.target_cfg->flash_end - g_board_info.target_cfg->flash_start) % + //bootloader, interface flashing only concerns 1 flash region + util_assert((g_board_info.target_cfg->flash_regions[0].end - g_board_info.target_cfg->flash_regions[0].start) % FLASH_PAGE_SIZE == 0); memset(&erase_init, 0, sizeof(erase_init)); erase_init.TypeErase = FLASH_TYPEERASE_PAGES; - erase_init.PageAddress =g_board_info.target_cfg->flash_start; - erase_init.NbPages = (g_board_info.target_cfg->flash_end - g_board_info.target_cfg->flash_start) % FLASH_PAGE_SIZE; + erase_init.PageAddress = g_board_info.target_cfg->flash_regions[0].start; + erase_init.NbPages = (g_board_info.target_cfg->flash_regions[0].end - g_board_info.target_cfg->flash_regions[0].start) % FLASH_PAGE_SIZE; if (HAL_FLASHEx_Erase(&erase_init, &error) != HAL_OK) { ret = 1; } diff --git a/source/hic_hal/target_config.h b/source/target/target_config.h similarity index 59% rename from source/hic_hal/target_config.h rename to source/target/target_config.h index 972ff9afa..c441b3b52 100644 --- a/source/hic_hal/target_config.h +++ b/source/target/target_config.h @@ -41,37 +41,34 @@ extern "C" { #define TARGET_AUTO_INCREMENT_PAGE_SIZE (1024) //Additional flash and ram regions -#define MAX_EXTRA_FLASH_REGION 3 -#define MAX_EXTRA_RAM_REGION 3 +#define MAX_EXTRA_FLASH_REGION 10 +#define MAX_EXTRA_RAM_REGION 10 + +enum _region_flags { + kRegionIsDefault = (1 << 0), //out of bounds regions will use the same flash algo if this is set + kRegionIsSecure = (1 << 1) +}; -typedef struct flash_region_info { - uint32_t start; - uint32_t end; - program_target_t *flash_algo; -} flash_region_info_t; -typedef struct ram_region_info { +typedef struct region_info { uint32_t start; uint32_t end; -} ram_region_info_t; + uint32_t flags; + uint8_t alias_index; /*!