bool kinetis_probe(target *t) { uint32_t sdid = target_mem_read32(t, SIM_SDID); switch (sdid >> 20) { case 0x251: t->driver = "KL25"; target_add_ram(t, 0x1ffff000, 0x1000); target_add_ram(t, 0x20000000, 0x3000); kl_gen_add_flash(t, 0x00000000, 0x20000, 0x400); return true; case 0x231: t->driver = "KL27"; target_add_ram(t, 0x1fffe000, 0x2000); target_add_ram(t, 0x20000000, 0x6000); kl_gen_add_flash(t, 0x00000000, 0x40000, 0x400); return true; case 0x021: /* KL02 family */ switch((sdid>>16) & 0x0f) { case 3: t->driver = "KL02x32"; target_add_ram(t, 0x1FFFFC00, 0x400); target_add_ram(t, 0x20000000, 0xc00); kl_gen_add_flash(t, 0x00000000, 0x7FFF, 0x400); break; case 2: t->driver = "KL02x16"; target_add_ram(t, 0x1FFFFE00, 0x200); target_add_ram(t, 0x20000000, 0x600); kl_gen_add_flash(t, 0x00000000, 0x3FFF, 0x400); break; case 1: t->driver = "KL02x8"; target_add_ram(t, 0x1FFFFF00, 0x100); target_add_ram(t, 0x20000000, 0x300); kl_gen_add_flash(t, 0x00000000, 0x1FFF, 0x400); break; default: return false; } return true; } return false; }
bool kinetis_probe(target *t) { uint32_t sdid = target_mem_read32(t, SIM_SDID); switch (sdid >> 20) { case 0x251: t->driver = "KL25"; target_add_ram(t, 0x1ffff000, 0x1000); target_add_ram(t, 0x20000000, 0x3000); kl_gen_add_flash(t, 0x00000000, 0x20000, 0x400, KL_WRITE_LEN); break; case 0x231: t->driver = "KL27x128"; // MKL27 >=128kb target_add_ram(t, 0x1fffe000, 0x2000); target_add_ram(t, 0x20000000, 0x6000); kl_gen_add_flash(t, 0x00000000, 0x40000, 0x400, KL_WRITE_LEN); break; case 0x271: switch((sdid>>16)&0x0f){ case 4: t->driver = "KL27x32"; target_add_ram(t, 0x1ffff800, 0x0800); target_add_ram(t, 0x20000000, 0x1800); kl_gen_add_flash(t, 0x00000000, 0x8000, 0x400, KL_WRITE_LEN); break; case 5: t->driver = "KL27x64"; target_add_ram(t, 0x1ffff000, 0x1000); target_add_ram(t, 0x20000000, 0x3000); kl_gen_add_flash(t, 0x00000000, 0x10000, 0x400, KL_WRITE_LEN); break; default: return false; } break; case 0x021: /* KL02 family */ switch((sdid>>16) & 0x0f){ case 3: t->driver = "KL02x32"; target_add_ram(t, 0x1FFFFC00, 0x400); target_add_ram(t, 0x20000000, 0xc00); kl_gen_add_flash(t, 0x00000000, 0x7FFF, 0x400, KL_WRITE_LEN); break; case 2: t->driver = "KL02x16"; target_add_ram(t, 0x1FFFFE00, 0x200); target_add_ram(t, 0x20000000, 0x600); kl_gen_add_flash(t, 0x00000000, 0x3FFF, 0x400, KL_WRITE_LEN); break; case 1: t->driver = "KL02x8"; target_add_ram(t, 0x1FFFFF00, 0x100); target_add_ram(t, 0x20000000, 0x300); kl_gen_add_flash(t, 0x00000000, 0x1FFF, 0x400, KL_WRITE_LEN); break; default: return false; } break; case 0x031: /* KL03 family */ t->driver = "KL03"; target_add_ram(t, 0x1ffffe00, 0x200); target_add_ram(t, 0x20000000, 0x600); kl_gen_add_flash(t, 0, 0x8000, 0x400, KL_WRITE_LEN); break; case 0x220: /* K22F family */ t->driver = "K22F"; target_add_ram(t, 0x1c000000, 0x4000000); target_add_ram(t, 0x20000000, 0x100000); kl_gen_add_flash(t, 0, 0x40000, 0x800, KL_WRITE_LEN); kl_gen_add_flash(t, 0x40000, 0x40000, 0x800, KL_WRITE_LEN); break; case 0x620: /* K64F family. */ /* This should be 0x640, but according to the errata sheet * (KINETIS_1N83J) K64 and K24's will show up with the * subfamily nibble as 2 */ t->driver = "K64"; target_add_ram(t, 0x1FFF0000, 0x10000); target_add_ram(t, 0x20000000, 0x30000); kl_gen_add_flash(t, 0, 0x80000, 0x1000, K64_WRITE_LEN); kl_gen_add_flash(t, 0x80000, 0x80000, 0x1000, K64_WRITE_LEN); break; default: return false; } unsafe_enabled = false; target_add_commands(t, kinetis_cmd_list, t->driver); return true; }