Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for kinetis MK20DX256 chip #1797

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/target/kinetis.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,19 @@
/* 8 byte phrases need to be written to the k64 flash */
#define K64_WRITE_LEN 8U

/* Target registers */
#define MK20DX256_FLASH_BASE 0x00000000U
#define MK20DX256_FLASH_SIZE 0x00040000U
#define MK20DX256_FLASH_BLK_SIZE 0x00000800U
#define MK20DX256_FLEXNVM_BASE 0x10000000U
#define MK20DX256_FLEXNVM_SIZE 0x00008000U
#define MK20DX256_FLEXNVM_BLK_SIZE 0x00000400U
#define MK20DX256_SRAM_L_BASE 0x1fff8000U
#define MK20DX256_SRAM_L_SIZE 0x00008000U
#define MK20DX256_SRAM_H_BASE 0x20000000U
#define MK20DX256_SRAM_H_SIZE 0x00008000U


static bool kinetis_cmd_unsafe(target_s *t, int argc, const char **argv);

const command_s kinetis_cmd_list[] = {
Expand Down Expand Up @@ -327,7 +340,14 @@ bool kinetis_probe(target_s *const t)
}
break;
case 0x010U: /* K20 Family, DIEID=0x0 */
return false;
case 0x090U: /* K20 Family, DIEID=0x1 */
t->driver = "MK20DX256";
target_add_ram(t, MK20DX256_SRAM_L_BASE, MK20DX256_SRAM_L_SIZE); /* SRAM_L, 32 KB */
target_add_ram(t, MK20DX256_SRAM_H_BASE, MK20DX256_SRAM_H_SIZE); /* SRAM_H, 32 KB */
kinetis_add_flash(t, MK20DX256_FLASH_BASE, MK20DX256_FLASH_SIZE, MK20DX256_FLASH_BLK_SIZE, KL_WRITE_LEN); /* P-Flash, 256 KB, 2 KB Sectors */
kinetis_add_flash(t, MK20DX256_FLEXNVM_BASE, MK20DX256_FLEXNVM_SIZE, MK20DX256_FLEXNVM_BLK_SIZE, KL_WRITE_LEN); /* FlexNVM, 32 KB, 1 KB Sectors */
break;
case 0x110U: /* K20 Family, DIEID=0x2 */
case 0x190U: /* K20 Family, DIEID=0x3 */
case 0x230U: /* K21 Family, DIEID=0x4 */
Expand Down