kinetis: Refactored out some common code from kinetis_probe for the S32K14 lineup
This commit is contained in:
parent
fee6f28915
commit
72e4f4d2b2
|
@ -124,6 +124,17 @@ static void kl_gen_add_flash(target *t, uint32_t addr, size_t length,
|
||||||
target_add_flash(t, f);
|
target_add_flash(t, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void kl_s32k14_setup(
|
||||||
|
target *const t, const uint32_t sram_l, const uint32_t sram_h, const size_t flash_size, const size_t flexmem_size)
|
||||||
|
{
|
||||||
|
t->driver = "S32K14x";
|
||||||
|
target_add_ram(t, sram_l, 0x20000000 - sram_l);
|
||||||
|
target_add_ram(t, 0x20000000, sram_h);
|
||||||
|
|
||||||
|
kl_gen_add_flash(t, 0x00000000, flash_size, 0x1000, K64_WRITE_LEN); /* P-Flash, 4 KB Sectors */
|
||||||
|
kl_gen_add_flash(t, 0x10000000, flexmem_size, 0x1000, K64_WRITE_LEN); /* FlexNVM, 4 KB Sectors */
|
||||||
|
}
|
||||||
|
|
||||||
bool kinetis_probe(target *t)
|
bool kinetis_probe(target *t)
|
||||||
{
|
{
|
||||||
uint32_t sdid = target_mem_read32(t, SIM_SDID);
|
uint32_t sdid = target_mem_read32(t, SIM_SDID);
|
||||||
|
@ -326,44 +337,36 @@ bool kinetis_probe(target *t)
|
||||||
kl_gen_add_flash(t, 0x10000000, 0x00008000, 0x800, K64_WRITE_LEN); /* FlexNVM, 32 KB, 2 KB Sectors */
|
kl_gen_add_flash(t, 0x10000000, 0x00008000, 0x800, K64_WRITE_LEN); /* FlexNVM, 32 KB, 2 KB Sectors */
|
||||||
break;
|
break;
|
||||||
/* gen1 s32k14x */
|
/* gen1 s32k14x */
|
||||||
{
|
case 0x142: /* S32K142 */
|
||||||
uint32_t sram_l, sram_h;
|
case 0x143: /* S32K142W */
|
||||||
uint32_t flash, flexmem;
|
/* SRAM_L = 16KiB */
|
||||||
case 0x142: /* s32k142 */
|
/* SRAM_H = 12KiB */
|
||||||
case 0x143: /* s32k142w */
|
/* Flash = 256 KiB */
|
||||||
sram_l = 0x1FFFC000; /* SRAM_L, 16k */
|
/* FlexNVM = 64 KiB */
|
||||||
sram_h = 0x03000; /* SRAM_H, 12k */
|
kl_s32k14_setup(t, 0x1FFFC000, 0x03000, 0x00040000, 0x10000);
|
||||||
flash = 0x00040000; /* flash 256 KB */
|
break;
|
||||||
flexmem = 0x10000; /* FlexNVM 64 KB */
|
case 0x144: /* S32K144 */
|
||||||
goto do_common_s32k14x;
|
case 0x145: /* S32K144W */
|
||||||
case 0x144: /* s32k144 */
|
/* SRAM_L = 32KiB */
|
||||||
case 0x145: /* s32k144w */
|
/* SRAM_H = 28KiB */
|
||||||
sram_l = 0x1FFF8000; /* SRAM_L, 32k */
|
/* Flash = 512 KiB */
|
||||||
sram_h = 0x07000; /* SRAM_H, 28k */
|
/* FlexNVM = 64 KiB */
|
||||||
flash = 0x00080000; /* flash 512 KB */
|
kl_s32k14_setup(t, 0x1FFF8000, 0x07000, 0x00080000, 0x10000);
|
||||||
flexmem = 0x10000; /* FlexNVM 64 KB */
|
break;
|
||||||
goto do_common_s32k14x;
|
case 0x146: /* S32K146 */
|
||||||
case 0x146: /* s32k146 */
|
/* SRAM_L = 64KiB */
|
||||||
sram_l = 0x1fff0000; /* SRAM_L, 64k */
|
/* SRAM_H = 60KiB */
|
||||||
sram_h = 0x0f000; /* SRAM_H, 60k */
|
/* Flash = 1024 KiB */
|
||||||
flash = 0x00100000; /* flash 1024 KB */
|
/* FlexNVM = 64 KiB */
|
||||||
flexmem = 0x10000; /* FlexNVM 64 KB */
|
kl_s32k14_setup(t, 0x1fff0000, 0x0f000, 0x00100000, 0x10000);
|
||||||
goto do_common_s32k14x;
|
break;
|
||||||
case 0x148: /* S32K148 */
|
case 0x148: /* S32K148 */
|
||||||
sram_l = 0x1ffe0000; /* SRAM_L, 128 KB */
|
/* SRAM_L = 128 KiB */
|
||||||
sram_h = 0x1f000; /* SRAM_H, 124 KB */
|
/* SRAM_H = 124 KiB */
|
||||||
flash = 0x00180000; /* flash 1536 KB */
|
/* Flash = 1536 KiB */
|
||||||
flexmem = 0x80000; /* FlexNVM 512 KB */
|
/* FlexNVM = 512 KiB */
|
||||||
goto do_common_s32k14x;
|
kl_s32k14_setup(t, 0x1ffe0000, 0x1f000, 0x00180000, 0x80000);
|
||||||
do_common_s32k14x:
|
|
||||||
t->driver = "S32K14x";
|
|
||||||
target_add_ram(t, sram_l, 0x20000000 - sram_l);
|
|
||||||
target_add_ram(t, 0x20000000, sram_h);
|
|
||||||
|
|
||||||
kl_gen_add_flash(t, 0x00000000, flash, 0x1000, K64_WRITE_LEN); /* P-Flash, 4 KB Sectors */
|
|
||||||
kl_gen_add_flash(t, 0x10000000, flexmem, 0x1000, K64_WRITE_LEN); /* FlexNVM, 4 KB Sectors */
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue