Skip to content

Commit

Permalink
Use defines for memory addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
vedranMv authored and dragonmux committed Apr 12, 2024
1 parent 62eea8d commit 9868269
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 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 @@ -330,12 +343,10 @@ bool kinetis_probe(target_s *const t)
return false;
case 0x090U: /* K20 Family, DIEID=0x1 */
t->driver = "MK20DX256";
target_add_ram(t, 0x1fff8000, 0x00008000); /* SRAM_L, 32 KB */
target_add_ram(t, 0x20000000, 0x00008000); /* SRAM_H, 32 KB */

kinetis_add_flash(t, 0x00000000, 0x40000, 0x800, KL_WRITE_LEN); /* P-Flash, 256 KB, 2 KB Sectors */
kinetis_add_flash(t, 0x10000000, 0x8000, 0x400, KL_WRITE_LEN); /* FlexNVM, 32 KB, 1 KB Sectors */

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 */
Expand Down

0 comments on commit 9868269

Please sign in to comment.