Skip to content

Commit d5ef5eb

Browse files
committed
tms570: add basic support for TI TMS570
Signed-off-by: Sean Cross <[email protected]>
1 parent c561524 commit d5ef5eb

File tree

5 files changed

+50
-2
lines changed

5 files changed

+50
-2
lines changed

src/target/cortexar.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,11 @@ bool cortexr_probe(adiv5_access_port_s *const ap, const target_addr_t base_addre
922922
if (!target)
923923
return false;
924924

925+
// TI omitted the designer code on TMS570.
926+
if (target->designer_code == 0) {
927+
PROBE(ti_tms570_probe);
928+
}
929+
925930
#if CONFIG_BMDA == 0
926931
gdb_outf("Please report unknown device with Designer 0x%x Part ID 0x%x\n", target->designer_code, target->part_id);
927932
#else

src/target/meson.build

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,22 @@ target_ti_cortexa = declare_dependency(
341341
dependencies: target_cortexar,
342342
compile_args: ['-DENABLE_TI_SITARA=1'],
343343
)
344+
345+
target_ti_cortexr = declare_dependency(
346+
sources: files(
347+
'ti_tms570.c',
348+
'icepick.c'
349+
),
350+
dependencies: target_cortexar,
351+
compile_args: ['-DENABLE_TI_TMS570=1'],
352+
)
353+
344354
# If the Cortex-A/R target is not enabled, don't enable TI AM335x part support
345-
if enabled_targets.contains('cortexar')
355+
if not is_firmware_build or enabled_targets.contains('cortexar')
346356
target_ti = [
347357
target_ti_cortexm,
348358
target_ti_cortexa,
359+
target_ti_cortexr,
349360
]
350361
else
351362
target_ti = target_ti_cortexm
@@ -414,8 +425,9 @@ libbmd_target_deps = [
414425
target_rp,
415426
target_sam,
416427
target_stm,
417-
target_ti_cortexm,
418428
target_ti_cortexa,
429+
target_ti_cortexm,
430+
target_ti_cortexr,
419431
target_xilinx,
420432
]
421433

src/target/target_probe.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ TARGET_PROBE_WEAK_NOP(stm32l4_probe)
153153
TARGET_PROBE_WEAK_NOP(stm32mp15_ca7_probe)
154154
TARGET_PROBE_WEAK_NOP(stm32mp15_cm4_probe)
155155
TARGET_PROBE_WEAK_NOP(stm32wb0_probe)
156+
TARGET_PROBE_WEAK_NOP(ti_tms570_probe)
156157
TARGET_PROBE_WEAK_NOP(zynq7_probe)
157158

158159
LPC55_DP_PREPARE_WEAK_NOP(lpc55_dp_prepare)

src/target/target_probe.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ bool stm32l4_probe(target_s *target);
104104
bool stm32mp15_ca7_probe(target_s *target);
105105
bool stm32mp15_cm4_probe(target_s *target);
106106
bool stm32wb0_probe(target_s *target);
107+
bool ti_tms570_probe(target_s *target);
107108
bool zynq7_probe(target_s *target);
108109

109110
void lpc55_dp_prepare(adiv5_debug_port_s *dp);

src/target/ti_tms570.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include "general.h"
2+
#include "target.h"
3+
#include "target_internal.h"
4+
#include "cortexar.h"
5+
6+
#define TMS570_SYS_BASE 0xffffff00U
7+
#define TMS570_SYS_DEVID (TMS570_SYS_BASE + 0xf0U)
8+
#define TMS570_SCM_DEVID_ID_MASK 0x7ffe0007U
9+
#define TMS570_SCM_REVID_ID_TMS570 0x00440005U
10+
11+
/* Base address for the OCRAM regions, including their mirrors (including RETRAM) */
12+
#define TMS570_SRAM_BASE 0x08000000U
13+
#define TMS570_SRAM_ECC_BASE 0x08400000U
14+
#define TMS570_SRAM_SIZE 0x80000U
15+
16+
#define TMS570_OTP_PACKAGE_AND_FLASH_MEMORY_SIZE 0xf008015cU
17+
18+
bool ti_tms570_probe(target_s *const target)
19+
{
20+
const uint32_t part_id = target_mem32_read32(target, TMS570_SYS_DEVID);
21+
if (!part_id || ((part_id & TMS570_SCM_DEVID_ID_MASK) != TMS570_SCM_REVID_ID_TMS570)) {
22+
return false;
23+
}
24+
25+
target->driver = "TMS570";
26+
target_add_ram32(target, TMS570_SRAM_BASE, TMS570_SRAM_SIZE);
27+
target_add_ram32(target, TMS570_SRAM_ECC_BASE, TMS570_SRAM_SIZE);
28+
return true;
29+
}

0 commit comments

Comments
 (0)