static void lmi_add_flash(target *t, size_t length) { struct target_flash *f = calloc(1, sizeof(*f)); f->start = 0; f->length = length; f->blocksize = 0x400; f->erase = lmi_flash_erase; f->write = lmi_flash_write; f->align = 4; f->erased = 0xff; target_add_flash(t, f); }
static void stm32f1_add_flash(target *t, uint32_t addr, size_t length, size_t erasesize) { struct target_flash *f = calloc(1, sizeof(*f)); f->start = addr; f->length = length; f->blocksize = erasesize; f->erase = stm32f1_flash_erase; f->write = stm32f1_flash_write; f->erased = 0xff; target_add_flash(t, f); }
static void efm32_add_flash(target *t, target_addr addr, size_t length, size_t page_size) { struct target_flash *f = calloc(1, sizeof(*f)); f->start = addr; f->length = length; f->blocksize = page_size; f->erase = efm32_flash_erase; f->write = target_flash_write_buffered; f->done = target_flash_done_buffered; f->write_buf = efm32_flash_write; f->buf_size = page_size; target_add_flash(t, f); }
static void kl_gen_add_flash(target *t, uint32_t addr, size_t length, size_t erasesize, size_t write_len) { struct kinetis_flash *kf = calloc(1, sizeof(*kf)); struct target_flash *f = &kf->f; f->start = addr; f->length = length; f->blocksize = erasesize; f->erase = kl_gen_flash_erase; f->write = kl_gen_flash_write; f->done = kl_gen_flash_done; f->erased = 0xff; kf->write_len = write_len; target_add_flash(t, f); }
static void stm32f4_add_flash(target *t, uint32_t addr, size_t length, size_t blocksize, uint8_t base_sector) { struct stm32f4_flash *sf = calloc(1, sizeof(*sf)); struct target_flash *f = &sf->f; f->start = addr; f->length = length; f->blocksize = blocksize; f->erase = stm32f4_flash_erase; f->write = stm32f4_flash_write; f->align = 4; f->erased = 0xff; sf->base_sector = base_sector; target_add_flash(t, f); }
static void sam4_add_flash(target *t, uint32_t eefc_base, uint32_t addr, size_t length) { struct sam_flash *sf = calloc(1, sizeof(*sf)); struct target_flash *f = &sf->f; f->start = addr; f->length = length; f->blocksize = SAM4_PAGE_SIZE * 8; f->erase = sam4_flash_erase; f->write = target_flash_write_buffered; f->done = target_flash_done_buffered; f->write_buf = sam3x_flash_write; f->buf_size = SAM4_PAGE_SIZE; sf->eefc_base = eefc_base; sf->write_cmd = EEFC_FCR_FCMD_WP; target_add_flash(t, f); }
static void stm32l4_add_flash(target *t, uint32_t addr, size_t length, size_t blocksize, uint32_t bank1_start) { struct stm32l4_flash *sf = calloc(1, sizeof(*sf)); struct target_flash *f = &sf->f; f->start = addr; f->length = length; f->blocksize = blocksize; f->erase = stm32l4_flash_erase; f->write = target_flash_write_buffered; f->done = target_flash_done_buffered; f->write_buf = stm32l4_flash_write; f->buf_size = 2048; f->erased = 0xff; sf->bank1_start = bank1_start; target_add_flash(t, f); }
static void msp432_add_flash(target *t, uint32_t addr, size_t length, target_addr prot_reg) { struct msp432_flash *mf = calloc(1, sizeof(*mf)); struct target_flash *f = &mf->f; f->start = addr; f->length = length; f->blocksize = SECTOR_SIZE; f->erase = msp432_flash_erase; f->write = msp432_flash_write; f->buf_size = SRAM_WRITE_BUF_SIZE; f->erased = 0xff; target_add_flash(t, f); /* Initialize ROM call pointers. Silicon rev B is not supported */ uint32_t flashctltable = target_mem_read32(t, ROM_APITABLE + OFS_FLASHCTLTABLE); mf->FlashCtl_eraseSector = target_mem_read32(t, flashctltable + OFS_FlashCtl_eraseSector); mf->FlashCtl_programMemory = target_mem_read32(t, flashctltable + OFS_FlashCtl_programMemory); mf->flash_protect_register = prot_reg; }